diff --git a/docs/agent.md b/docs/agent.md index 9d6f9ff..70ca25d 100644 --- a/docs/agent.md +++ b/docs/agent.md @@ -24,7 +24,7 @@ | `accounts/` | Account discovery, config dir setup, credential management, usage API | | `credentials/` | `AccountCredentialManager` — credential injection per account | | `lifecycle/` | `LifecycleController` — retry policy, signal recovery, missing signal instructions | -| `prompts/` | Mode-specific prompt builders (execute, discuss, plan, detail, refine) + shared blocks (codebase verification, deviation rules, git workflow) + inter-agent communication instructions | +| `prompts/` | Mode-specific prompt builders (execute, discuss, plan, detail, refine) + shared blocks (test integrity, deviation rules, git workflow, session startup, progress tracking) + inter-agent communication instructions | ## Key Flows @@ -178,21 +178,23 @@ Mode-specific prompts in `prompts/` are composed from shared blocks and mode-spe | `SIGNAL_FORMAT` | Signal output format (done/questions/error via `.cw/output/signal.json`) | | `INPUT_FILES` | Input file structure (manifest, assignment files, context files) | | `ID_GENERATION` | `cw id` usage for generating entity IDs | -| `CODEBASE_VERIFICATION` | "Training as hypothesis" pattern — read before writing, verify imports, follow patterns, check git log | +| `TEST_INTEGRITY` | Non-negotiable test rules — no self-validating tests, no assertion mutation, no skipping, independent tests, full suite runs | +| `SESSION_STARTUP` | Environment verification sequence — confirm working directory, check git state, establish green test baseline, read assignment | +| `PROGRESS_TRACKING` | Maintain `.cw/output/progress.md` after each commit — survives context compaction | | `DEVIATION_RULES` | Decision tree for handling unexpected situations (typo→fix, bug→fix if small, missing dep→coordinate, architectural mismatch→STOP) | -| `GIT_WORKFLOW` | Worktree-aware git guidance with rationale (frequent commits as recovery checkpoints, descriptive messages, specific staging to avoid cross-agent conflicts, no force-push) | -| `CONTEXT_MANAGEMENT` | Context compaction awareness (don't stop early, commit as checkpoints, parallel file reads) | +| `GIT_WORKFLOW` | Worktree-aware git guidance — specific file staging (no `git add .`), no force-push, check status first | +| `CONTEXT_MANAGEMENT` | Parallel file reads, cross-reference to progress tracking | | `buildInterAgentCommunication()` | Per-agent CLI instructions for `cw listen`, `cw ask`, `cw answer` (compact format with usage pattern summary) | ### Mode Prompts | Mode | File | Key Sections | |------|------|-------------| -| **execute** | `execute.ts` | Execution protocol (read→orient→test first→implement→verify→commit→signal), scope rules with rationale (7+ files = overscoping), codebase verification, deviation rules, git workflow, context management, anti-patterns (including anti-hardcoding) | -| **plan** | `plan.ts` | Dependency graph with wave analysis, file ownership for parallelism, specificity test ("Could a detail agent break this down?") | -| **detail** | `detail.ts` | Specificity test with good/bad examples, file ownership constraints, task sizing (1-5 files good, 7+ split), checkpoint guidance | -| **discuss** | `discuss.ts` | Goal-backward analysis (outcome→artifacts→wiring→failure points), question quality examples, decision quality examples, read-before-asking | -| **refine** | `refine.ts` | Improvement hierarchy (ambiguity > missing details > contradictions > unverifiable > missing edge cases), don't refine style, signal done if nothing to improve | +| **execute** | `execute.ts` | Session startup (baseline verification), execution protocol (RED-GREEN-REFACTOR: write failing tests→implement→verify→commit→iterate), test integrity rules, anti-patterns (self-validating tests, test mutation), scope rules (7+ files = overscoping), deviation rules, git workflow, progress tracking, Definition of Done checklist | +| **plan** | `plan.ts` | Testing strategy (tests per phase, not trailing phase), dependency graph with wave analysis, file ownership for parallelism, specificity test, Definition of Done checklist | +| **detail** | `detail.ts` | Mandatory test specifications (file path, scenarios, run command) for execute tasks, specificity test with good/bad examples, file ownership constraints, task sizing by lines changed, checkpoint guidance, Definition of Done checklist | +| **discuss** | `discuss.ts` | Goal-backward analysis (outcome→artifacts→wiring→failure points), question quality examples, decision quality with verification criteria, testability & verification question category, Definition of Done checklist | +| **refine** | `refine.ts` | Improvement hierarchy (ambiguity > missing details > contradictions > unverifiable requirements with testable acceptance criteria > missing edge cases as testable scenarios), Definition of Done checklist | ### Execute Prompt Dispatch