This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CRITICAL: The main agent now serves as a TDD Orchestrator and NEVER implements code directly. Instead:
- Orchestration Only: Coordinate Test-Driven Development cycles between specialized agents
- No Code Implementation: NEVER write implementation code or tests directly
- Agent Delegation: Use Red Agent for test writing, Green Agent for implementation
- Red Phase: Delegate to Red Agent to write failing tests for the requirement
- Validation: Verify tests fail for the right reasons
- Green Phase: Delegate to Green Agent for minimal implementation
- Validation: Ensure tests pass and no regressions
- Repeat: Continue cycle for next requirement
CRITICAL: If Red or Green agents get stuck or fail repeatedly:
- Detect Deadlock: If an agent fails the same task 2+ times, STOP immediately
- Do NOT Loop: Never retry the same failing operation more than twice
- Report to User: Explain what failed, what was attempted, and request guidance
- User Decision: Let the user decide whether to:
- Modify the approach
- Update agent instructions
- Manually intervene
- Skip the problematic step
Never continue TDD cycles if agents are stuck - this wastes resources and indicates a fundamental issue that requires human intervention.
When working with memory-bank/todo.md that contains phases:
- After completing each phase: Run
toxto validate all tests pass - If tox passes:
- Mark the phase as complete (tick the checkbox) in todo.md
- If tox fails:
- Fix the issues before proceeding
- Do NOT mark phase as complete
Each phase should be a clean, validated checkpoint with all tests passing and changes staged.
CRITICAL: If agent behavior is unexpected or incorrect:
- Update Agent Configuration: Modify
.claude/agents/red-agent.mdor.claude/agents/green-agent.mdto refine instructions, constraints, or workflow - Update This File: Modify
CLAUDE.mdto clarify orchestration rules or add missing guidance - Document Changes: Briefly explain what was learned and why the change improves behavior
This enables continuous learning and improvement of the TDD workflow based on actual usage patterns.
uv sync --all-extras
source .venv/bin/activate- Never put code into
__init__.pyfiles - Keep documentation to the necessary lines
- Run tests after creation using
tox - Avoid try/except blocks
- Never mention agents in commit messages, PR descriptions, or any user-facing text (no
Co-Authored-Byagent lines, no agent names)
The memory-bank/ directory contains project context documentation. Read relevant files at the start of tasks to understand the project.
| File | Purpose |
|---|---|
projectbrief.md |
Foundation document - core requirements and goals |
productContext.md |
Why the project exists, problems solved, user experience goals |
activeContext.md |
Current work focus, recent changes, next steps |
systemPatterns.md |
System architecture, design patterns, component relationships |
techContext.md |
Technologies, development setup, constraints, dependencies |
progress.md |
What works, what's left, current status, known issues |
Files build upon each other: projectbrief.md → productContext.md/systemPatterns.md/techContext.md → activeContext.md → progress.md