Implements The Housekeeper, a new expert agent for home automation following the Librarian pattern. Communicates with core-api service which wraps Home Assistant REST API. New agent features: - CoreAPIClient with 13 home automation methods - 13 tools: list_areas, list_devices, get_device_state, turn_on, turn_off, toggle, list_scenes, activate_scene, list_scripts, run_script, list_automations, toggle_automation, get_history - PydanticAI agent with butler-friendly system prompt - HouseholdCapability registration for Steward coordination - delegate_to_housekeeper() wrapper for orchestration Also includes: - Dev port changed from 8123 to 8777 (avoids Home Assistant conflict) - Config: CORE_API_HOST, CORE_API_KEY, CORE_API_TIMEOUT - 44 unit tests for client and capability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3.3 KiB
3.3 KiB
LLM Agent Instructions
This document contains instructions and documentation references for AI assistants working with this codebase.
📖 Important: Before working on this project, read PHILOSOPHY.md to understand the system vision, architectural patterns, and design goals. All development should work towards realizing those patterns.
AGENTS.md
Start every session by reading this file. This file outlines the operational protocols, coding standards, and architectural decisions for this FastAPI project.
1. Agent Operational Protocols
🧠 Work Patterns (Plan-Act-Reflect)
- Plan: Before writing code, briefly outline your plan. Identify which files you will touch and what the side effects might be.
- Act: Execute the changes in small, atomic steps.
- Reflect: After coding, verify your work. Did you break existing tests? Did you add new tests?
🧪 Local Development Setup
- Always test locally first before committing and deploying. The build-deploy loop is slow.
- Start the local server with
./wakeup.sh- logs are written tologs/server.logfor easy tailing - Auto-reload: The wakeup script runs uvicorn in reload mode - code changes are picked up automatically without restart (except for requirements.txt changes)
- Test REST endpoints against
http://localhost:8777using curl or similar tools - Only deploy when a phase or feature is complete and tested locally
- Environment: Copy
.env.exampleto.envand configure for your local setup (Ollama, Redis, Qdrant hosts)
🌐 Internal Service Access
- git.schweitz.net: Access via
http://localhost:3002(direct Gitea) to bypass Authentik SSO- Example:
curl http://localhost:3002/jpmschweitzer/library-desk/raw/branch/main/README.md - Public repos are readable without authentication
- Related repos:
library-desk,scheduler
- Example:
🛡️ Git Discipline
- NEVER commit to
mainormasterdirectly. Always create a feature branch:feature/your-feature-nameorfix/issue-description. - Commit Messages: Use the Conventional Commits format.
feat: add user login endpointfix: resolve database connection timeoutrefactor: split monolith dependency file
- Atomic Commits: Keep commits small. One logical change = one commit.
📝 Changelog Maintenance
- Update
CHANGELOG.mdwith every user-facing change. - Format:
## [Unreleased] - YYYY-MM-DDfollowed by### Added,### Changed, or### Fixed.
2. FastAPI Architecture & Best Practices
Reference: FastAPI Best Practices
📂 Project Structure (Directory-based, NOT File-type based)
Do not group files by type (e.g., one huge routers folder). Group by domain/module inside a src/ directory.
Correct Structure:
src/
├── auth/
│ ├── router.py # Endpoints
│ ├── schemas.py # Pydantic models
│ ├── service.py # Business logic (CRUD, etc.)
│ ├── dependencies.py# Module-specific dependencies
│ └── config.py # Module-specific settings
├── posts/
│ ├── router.py
│ └── ...
└── main.py # App entry point