Imported from cloud-ai-summit-cz/apps (
AGENTS.md). Install upstream withnpx skills add cloud-ai-summit-cz/apps. Copyright stays with the author.
Agent Development Guidelines
1. Purpose
Provide a clear, single reference for implementing, extending, and maintaining AI agents and related services (Python backends, data scripts, frontend interactions) in this repository, with emphasis on spec-driven development using the docs/ folder.
2. Core Principles
- Favor simplicity and readability over premature abstraction.
- Keep functionality self‑documenting; use docstrings, not progress/status comments.
- Minimize surface area: small, cohesive modules > large monoliths.
- Explicit > implicit for data contracts, configuration, and side effects.
- Make cheap experiments disposable (prefixed
adhoc_), not permanent.
3. Project‑Wide Conventions
3.1 Documentation & Specs Structure
- Specs Structure:
PRD.md(root): Product narrative, goals, and success metrics.specs/platform/: Cross-cutting concerns (Architecture, Data Models, Security, Deployment, Observability, Testing).specs/platform/decisions/: Platform-wide Architecture Decision Records (ADRs).specs/services/<service>/: Service-specific specs (ARCHITECTURE, DATA_MODELS, DEPLOYMENT, OBSERVABILITY, SECURITY, TESTING, RUNBOOKS, contracts, decisions).specs/services/<service>/decisions/: Service-specific ADRs.specs/services/<service>/contracts/: OpenAPI/AsyncAPI/Proto/GraphQL and consumer contracts.
- Primary documentation channel inside code: docstrings (revise them whenever code changes behavior or signature).
- Only add code comments for non‑obvious logic or critical nuances. Never for progress logs, migration notes, or "previous implementation" commentary.
- Use
docs/IMPLEMENTATION_LOG.mdfor implementation notes and technical decisions as you work; keep ADRs inspecs/**/decisions/small and focused. - Add confirmed recurring pitfalls to
docs/COMMON_ERRORS.md(after user confirmation—see Section 6). - Each component/service keeps concise run & test instructions in its local
README.md.
3.2 Refactoring & Improvements
Opportunistic simplifications are encouraged. When you see a refactor beyond the immediate task:
- Perform low‑risk, obviously beneficial cleanups directly (pure simplification, dead code removal).
- For broader architectural shifts, surface a brief rationale in chat before proceeding.
3.3 Experiments & Troubleshooting
When investigating complex issues:
- Prefer quick inline or REPL tests first.
- Use PowerShell friendly commands (Windows dev baseline).
- Load environment variables from
.envwhen relevant. - If a throwaway script is necessary, name it
adhoc_test_<purpose>.py(see Section 7) and delete after insights are integrated.
3.4 Technology Stack
- Primary backend language: Python, package & env management via
uv(pyproject.tomlauthoritative; avoidrequirements.txt). - API framework: FastAPI.
- Data validation: Pydantic models (under
models/). - Frontend: React +
assistant-ui(Tailwind present).
4. Python Agent & Service Guidelines
4.1 Structure & Modeling
- Use Pydantic models for request/response & internal validated schemas. Place in
models/. - Keep service boundaries explicit (e.g.,
routes/,services/,repositories/).
4.2 Documentation & Style
- Every public class/function: docstring specifying purpose, parameters, return value(s), exceptions.
- Avoid redundant comments explaining obvious code or restating names.
4.3 Logging
- Use Python
loggingwith appropriate levels: DEBUG (diagnostics), INFO (lifecycle events), WARNING (recoverable anomalies), ERROR (failures), CRITICAL (systemic outages). - No print statements in production paths.
4.4 Testing
- Use
pytest. - Prefer unit tests (mocks) for logic; integration tests for IO (DB, external HTTP, vector stores, etc.).
- If a one‑off exploratory script was needed, port validated findings into tests and delete the ad‑hoc script.
4.5 Ports & Local Dev
- Assign distinct default ports per service to avoid collisions (document them in the service
README.md).
5. Spec-Driven Development: specs/ Folder & PRD
The specs/ folder (and PRD.md) is the single source of truth for project specifications, architecture, and planning.
5.1 Documentation Structure
| Document | Location | Purpose | Update Frequency | Agent Autonomy |
|---|---|---|---|---|
| PRD | PRD.md |
Product narrative, goals, user stories, success metrics | Per feature/sprint | User-controlled - agents suggest changes, user approves |
| ARCHITECTURE | specs/platform/ARCHITECTURE.md |
System architecture, technology stack, design patterns, key decisions | When architecture evolves | User-controlled - agents propose, user confirms |
| DATA_MODELS | specs/platform/DATA_MODELS.md |
Shared database schemas, message formats, data structures | When data model changes | User-controlled - agents suggest, user reviews |
| API Contracts | specs/services/*/contracts/ |
OpenAPI/AsyncAPI definitions | When APIs change | User-controlled - agents can draft, user approves |
| OBSERVABILITY | specs/platform/OBSERVABILITY.md |
Monitoring strategy, logging approach, metrics, alerts | During observability setup | User-controlled - agents propose, user decides |
| TESTING | specs/platform/TESTING.md |
Testing strategy, test scenarios, coverage requirements | When test approach changes | User-controlled - agents suggest, user confirms |
| DEPLOYMENT | specs/platform/DEPLOYMENT.md |
Deployment procedures, environments, infrastructure | When deployment changes | User-controlled - agents draft, user reviews |
| IMPLEMENTATION | docs/IMPLEMENTATION.md |
High-level implementation plan and detailed task checklist | Daily/per task | User-controlled - agents update progress after tasks |
| IMPLEMENTATION_LOG | docs/IMPLEMENTATION_LOG.md |
Chronological journal of decisions, progress, completed work | After each significant change | Agent-maintained - freely updated by agents |
| TROUBLESHOOTING | docs/TROUBLESHOOTING.md |
Common errors, solutions, workarounds | When issues are resolved | Collaborative - agents suggest after user confirms issue is common |
5.2 Agent Update Rules
Freely Update (No Approval Needed)
- docs/IMPLEMENTATION_LOG.md: Add timestamped entries for completed features, architectural decisions made, technical choices, integration notes.
- Format:
## YYYY-MM-DD - Brief Title\n\nDetails... - Keep entries concise but informative
- Reference related tasks from
docs/IMPLEMENTATION.md
- Format:
Suggest & Wait for Approval
- PRD.md: Propose new requirements or changes to existing ones
- specs/platform/ARCHITECTURE.md: Suggest architectural changes or design improvements
- specs/platform/DATA_MODELS.md: Propose schema changes or new data structures
- specs/services/*/contracts/: Suggest new endpoints or contract modifications
- specs/platform/OBSERVABILITY.md: Recommend monitoring/logging enhancements
- specs/platform/TESTING.md: Propose new test strategies or coverage improvements
- specs/platform/DEPLOYMENT.md: Suggest deployment procedure changes
- docs/IMPLEMENTATION.md: Update task completion status, add subtasks
Collaborative Process
- docs/TROUBLESHOOTING.md:
- When encountering an error, solve it and mention in chat
- If user confirms it's a common/recurring issue, add structured entry
- Include: problem description, symptoms, root cause, solution, prevention
- Never add unconfirmed or one-off issues
5.3 Documentation Workflow
When starting a new feature:
- Check
PRD.mdfor user stories and acceptance criteria - Review
specs/platform/ARCHITECTURE.mdfor architectural constraints and patterns - Consult
specs/platform/DATA_MODELS.mdand service contracts for interfaces - Update
docs/IMPLEMENTATION.mdwith task breakdown if needed - Begin implementation with this context
During implementation:
- Follow design patterns and constraints from
specs/platform/ARCHITECTURE.md - Maintain docstrings in code (no progress comments)
- Log significant decisions in
docs/IMPLEMENTATION_LOG.mdas you go - If you discover design issues, raise in chat—don't mutate
specs/platform/ARCHITECTURE.mdunilaterally
After completing a feature:
- Update
docs/IMPLEMENTATION_LOG.mdwith summary and key decisions - Mark tasks complete in
docs/IMPLEMENTATION.md - If API/data model changed, propose updates to respective specs
- Update component
README.mdif operational changes exist
When encountering issues:
- Solve the problem
- Mention solution in chat
- If user confirms it's recurring, add to
docs/TROUBLESHOOTING.md
6. Reinforced Documentation & Logging Rules
These constraints prevent uncontrolled documentation sprawl and progress leakage into code:
-
Implementation Log Boundaries: Implementation progress, rationale, or "this replaces X" notes belong in
docs/IMPLEMENTATION_LOG.md—never as inline code comments or new files. -
Troubleshooting Workflow: Only after confirming with the user that an issue is broadly relevant, add it to
docs/TROUBLESHOOTING.md. Do not create parallel error collections. -
Controlled Design Changes: Architectural or behavioral design alterations should be reflected (after approval) in
specs/platform/ARCHITECTURE.md. Treat it as a guiding artifact; do not mutate it unilaterally. -
Localized Documentation First: Prefer updating the affected component's
README.mdfor usage/run/test changes before touching high‑level design docs. -
Tests over Scratch Scripts: Validate behaviors via
pytest(unit/integration). Temporary investigative scripts must follow Section 7 and be removed post‑learning. -
Communication Channel Priority: To inform about implementation decisions use:
- (a)
docs/IMPLEMENTATION_LOG.md(for technical decisions) - (b) chat output (for status updates)
- (c) component
README.md(brief operational changes) - (d)
specs/platform/ARCHITECTURE.md(after approval for architectural changes)
- (a)
-
New Doc File Exception: If a truly new doc artifact is justified, prefix filename with
ADHOC_and notify user. Expect eventual consolidation or deletion. -
No Progress/History Comments: Ban inline comments like "// updated previous logic" or "# temporary hack (will remove)"—instead record durable decisions in
docs/IMPLEMENTATION_LOG.md.
7. Ad‑Hoc / Disposable Artifacts
| Type | Naming Pattern | Purpose | Lifecycle |
|---|---|---|---|
| Python scratch test | adhoc_test_*.py or adhoc_*.py |
Quick reproduction / isolate behavior | Delete after converting insight into real tests/code |
| Documentation draft | ADHOC_*.md |
Rare: staging ground for large doc refactor | Merge content into canonical doc then delete |
Rules:
- Must not be imported by production code.
- Must not hold secrets or credentials.
- Track none of them in long‑term design history; only distilled results.
8. Change Control & Communication
- Before major architectural changes: summarize intent, risk, alternatives in chat for approval.
- After implementing a feature: update relevant docstrings +
docs/IMPLEMENTATION_LOG.md. - If you discover systemic flaw: propose remediation path; avoid broad speculative refactors without confirmation.
- When proposing doc changes: provide specific diff or summary of proposed changes for user review.
9. Quick Reference Checklist
Development Flow
- Review
PRD.mdandspecs/platform/ARCHITECTURE.mdfor context - Define/confirm data contract (Pydantic model, update
specs/platform/DATA_MODELS.mdif proposing changes) - Write/extend tests (failing first where feasible)
- Implement feature (docstrings maintained—no progress comments)
- Run
pytest(unit + integration if relevant) - Update
docs/IMPLEMENTATION_LOG.mdwith decisions and completion - Update service
README.mdfor operational changes - Mark tasks complete in
docs/IMPLEMENTATION.md - Remove any
adhoc_artifacts created during exploration
Documentation Update Flow
- Need to change architecture? → Propose in chat, update
specs/platform/ARCHITECTURE.mdafter approval - Completed a feature? → Log in
docs/IMPLEMENTATION_LOG.mdimmediately - Found a recurring issue? → Solve it, mention in chat, add to
docs/TROUBLESHOOTING.mdif user confirms - New API endpoint? → Implement, then propose contract update in
specs/services/*/contracts/ - Schema change? → Propose
specs/platform/DATA_MODELS.mdupdate before implementing
Ad‑Hoc Script Flow
- Name with
adhoc_prefix - Isolate experiment
- Migrate result into tests or code
- Delete script
10. Scope & Precedence
This AGENTS.md centralizes operational & stylistic guidance. If conflicts arise:
- Explicit user instruction (chat) overrides this file case‑by‑case
specs/platform/ARCHITECTURE.mdgoverns architecture (pending approved changes)PRD.mddefines what we're building- This file governs daily engineering discipline & hygiene
11. Context for AI Agents
When working on this codebase:
- Always check
specs/andPRD.mdfirst - they contain the authoritative specifications - docs/IMPLEMENTATION_LOG.md is your journal - update it freely as you work
- Propose, don't assume - for design/requirement changes, always ask the user first
- specs/platform/README.md - provides an overview and navigation guide for all documentation
- The documentation structure supports spec-driven development, enabling you to understand project context before writing code