anvil-dev-framework 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +719 -0
- package/VERSION +1 -0
- package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
- package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
- package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
- package/docs/INSTALLATION.md +984 -0
- package/docs/anvil-hud.md +469 -0
- package/docs/anvil-init.md +255 -0
- package/docs/anvil-state.md +210 -0
- package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
- package/docs/command-reference.md +2022 -0
- package/docs/hooks-tts.md +368 -0
- package/docs/implementation-guide.md +810 -0
- package/docs/linear-github-integration.md +247 -0
- package/docs/local-issues.md +677 -0
- package/docs/patterns/README.md +419 -0
- package/docs/planning-responsibilities.md +139 -0
- package/docs/session-workflow.md +573 -0
- package/docs/simplification-plan-template.md +297 -0
- package/docs/simplification-principles.md +129 -0
- package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
- package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
- package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
- package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
- package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
- package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
- package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
- package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
- package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
- package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
- package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
- package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
- package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
- package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
- package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
- package/docs/sync.md +122 -0
- package/global/CLAUDE.md +140 -0
- package/global/agents/verify-app.md +164 -0
- package/global/commands/anvil-settings.md +527 -0
- package/global/commands/anvil-sync.md +121 -0
- package/global/commands/change.md +197 -0
- package/global/commands/clarify.md +252 -0
- package/global/commands/cleanup.md +292 -0
- package/global/commands/commit-push-pr.md +207 -0
- package/global/commands/decay-review.md +127 -0
- package/global/commands/discover.md +158 -0
- package/global/commands/doc-coverage.md +122 -0
- package/global/commands/evidence.md +307 -0
- package/global/commands/explore.md +121 -0
- package/global/commands/force-exit.md +135 -0
- package/global/commands/handoff.md +191 -0
- package/global/commands/healthcheck.md +302 -0
- package/global/commands/hud.md +84 -0
- package/global/commands/insights.md +319 -0
- package/global/commands/linear-setup.md +184 -0
- package/global/commands/lint-fix.md +198 -0
- package/global/commands/orient.md +510 -0
- package/global/commands/plan.md +228 -0
- package/global/commands/ralph.md +346 -0
- package/global/commands/ready.md +182 -0
- package/global/commands/release.md +305 -0
- package/global/commands/retro.md +96 -0
- package/global/commands/shard.md +166 -0
- package/global/commands/spec.md +227 -0
- package/global/commands/sprint.md +184 -0
- package/global/commands/tasks.md +228 -0
- package/global/commands/test-and-commit.md +151 -0
- package/global/commands/validate.md +132 -0
- package/global/commands/verify.md +251 -0
- package/global/commands/weekly-review.md +156 -0
- package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
- package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
- package/global/hooks/anvil_memory_observe.ts +322 -0
- package/global/hooks/anvil_memory_session.ts +166 -0
- package/global/hooks/anvil_memory_stop.ts +187 -0
- package/global/hooks/parse_transcript.py +116 -0
- package/global/hooks/post_merge_cleanup.sh +132 -0
- package/global/hooks/post_tool_format.sh +215 -0
- package/global/hooks/ralph_context_monitor.py +240 -0
- package/global/hooks/ralph_stop.sh +502 -0
- package/global/hooks/statusline.sh +1110 -0
- package/global/hooks/statusline_agent_sync.py +224 -0
- package/global/hooks/stop_gate.sh +250 -0
- package/global/lib/.claude/anvil-state.json +21 -0
- package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
- package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
- package/global/lib/agent_registry.py +995 -0
- package/global/lib/anvil-state.sh +435 -0
- package/global/lib/claim_service.py +515 -0
- package/global/lib/coderabbit_service.py +314 -0
- package/global/lib/config_service.py +423 -0
- package/global/lib/coordination_service.py +331 -0
- package/global/lib/doc_coverage_service.py +1305 -0
- package/global/lib/gate_logger.py +316 -0
- package/global/lib/github_service.py +310 -0
- package/global/lib/handoff_generator.py +775 -0
- package/global/lib/hygiene_service.py +712 -0
- package/global/lib/issue_models.py +257 -0
- package/global/lib/issue_provider.py +339 -0
- package/global/lib/linear_data_service.py +210 -0
- package/global/lib/linear_provider.py +987 -0
- package/global/lib/linear_provider.py.backup +671 -0
- package/global/lib/local_provider.py +486 -0
- package/global/lib/orient_fast.py +457 -0
- package/global/lib/quality_service.py +470 -0
- package/global/lib/ralph_prompt_generator.py +563 -0
- package/global/lib/ralph_state.py +1202 -0
- package/global/lib/state_manager.py +417 -0
- package/global/lib/transcript_parser.py +597 -0
- package/global/lib/verification_runner.py +557 -0
- package/global/lib/verify_iteration.py +490 -0
- package/global/lib/verify_subagent.py +250 -0
- package/global/skills/README.md +155 -0
- package/global/skills/quality-gates/SKILL.md +252 -0
- package/global/skills/skill-template/SKILL.md +109 -0
- package/global/skills/testing-strategies/SKILL.md +337 -0
- package/global/templates/CHANGE-template.md +105 -0
- package/global/templates/HANDOFF-template.md +63 -0
- package/global/templates/PLAN-template.md +111 -0
- package/global/templates/SPEC-template.md +93 -0
- package/global/templates/ralph/PROMPT.md.template +89 -0
- package/global/templates/ralph/fix_plan.md.template +31 -0
- package/global/templates/ralph/progress.txt.template +23 -0
- package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
- package/global/tests/test_doc_coverage.py +520 -0
- package/global/tests/test_issue_models.py +299 -0
- package/global/tests/test_local_provider.py +323 -0
- package/global/tools/README.md +178 -0
- package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
- package/global/tools/anvil-hud.py +3622 -0
- package/global/tools/anvil-hud.py.bak +3318 -0
- package/global/tools/anvil-issue.py +432 -0
- package/global/tools/anvil-memory/CLAUDE.md +49 -0
- package/global/tools/anvil-memory/README.md +42 -0
- package/global/tools/anvil-memory/bun.lock +25 -0
- package/global/tools/anvil-memory/bunfig.toml +9 -0
- package/global/tools/anvil-memory/package.json +23 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
- package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
- package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
- package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
- package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
- package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
- package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
- package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
- package/global/tools/anvil-memory/src/commands/get.ts +115 -0
- package/global/tools/anvil-memory/src/commands/init.ts +94 -0
- package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
- package/global/tools/anvil-memory/src/commands/search.ts +112 -0
- package/global/tools/anvil-memory/src/db.ts +638 -0
- package/global/tools/anvil-memory/src/index.ts +205 -0
- package/global/tools/anvil-memory/src/types.ts +122 -0
- package/global/tools/anvil-memory/tsconfig.json +29 -0
- package/global/tools/ralph-loop.sh +359 -0
- package/package.json +45 -0
- package/scripts/anvil +822 -0
- package/scripts/extract_patterns.py +222 -0
- package/scripts/init-project.sh +541 -0
- package/scripts/install.sh +229 -0
- package/scripts/postinstall.js +41 -0
- package/scripts/rollback.sh +188 -0
- package/scripts/sync.sh +623 -0
- package/scripts/test-statusline.sh +248 -0
- package/scripts/update_claude_md.py +224 -0
- package/scripts/verify.sh +255 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# Pattern Catalog
|
|
2
|
+
|
|
3
|
+
> Detailed explanations of the patterns integrated into Anvil.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Structural Guardrails (Droid Patterns)](#1-structural-guardrails)
|
|
10
|
+
2. [Task Memory Patterns (Beads)](#2-task-memory-patterns)
|
|
11
|
+
3. [Spec-Driven Patterns](#3-spec-driven-patterns)
|
|
12
|
+
4. [Memory Patterns](#4-memory-patterns)
|
|
13
|
+
5. [Quality Gate Patterns](#5-quality-gate-patterns)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Structural Guardrails
|
|
18
|
+
|
|
19
|
+
Source: Factory AI Droid system prompt
|
|
20
|
+
|
|
21
|
+
### 1.1 Environment Validation Checkpoint
|
|
22
|
+
|
|
23
|
+
**Problem**: AI agents are non-deterministic. Without validation, agents build on unstable foundations.
|
|
24
|
+
|
|
25
|
+
**Pattern**: Before ANY file changes, verify:
|
|
26
|
+
1. Git status is clean
|
|
27
|
+
2. On feature branch (not main)
|
|
28
|
+
3. Dependencies installed from lockfile
|
|
29
|
+
4. Tests passing (baseline)
|
|
30
|
+
5. Types passing (baseline)
|
|
31
|
+
|
|
32
|
+
**Implementation**: `/validate` command
|
|
33
|
+
|
|
34
|
+
**Key Insight**: If ANY step fails, STOP. Do not proceed.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### 1.2 Read-Before-Write Protocol
|
|
39
|
+
|
|
40
|
+
**Problem**: Agents hallucinate code that doesn't exist—inventing API parameters, configuration fields, and function signatures.
|
|
41
|
+
|
|
42
|
+
**Pattern**:
|
|
43
|
+
1. Before proposing changes → open and read target files
|
|
44
|
+
2. Before claiming understanding → cite actual code with file paths
|
|
45
|
+
3. Before adding new code → review similar existing module
|
|
46
|
+
4. Never say "I assume" about code you can read
|
|
47
|
+
|
|
48
|
+
**Evidence**: Master of Code research showed separating retrieval from generation reduces hallucination by 60-80%.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### 1.3 Living Task Management
|
|
53
|
+
|
|
54
|
+
**Problem**: Without task tracking, agents lose their place, repeat work, and miss steps.
|
|
55
|
+
|
|
56
|
+
**Pattern**:
|
|
57
|
+
- Decompose tasks into explicit checklists
|
|
58
|
+
- Update status after each major step
|
|
59
|
+
- Detect stuck states (same action 3+ times)
|
|
60
|
+
- Report blockers immediately
|
|
61
|
+
|
|
62
|
+
**Implementation**: Linear integration with status updates
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 1.4 Evidence-Based PR Completion
|
|
67
|
+
|
|
68
|
+
**Problem**: Agents claim completion without verification.
|
|
69
|
+
|
|
70
|
+
**Pattern**: Create PR ONLY when evidence captured:
|
|
71
|
+
- Lint output (0 errors)
|
|
72
|
+
- Type check output (0 errors)
|
|
73
|
+
- Test output (all pass)
|
|
74
|
+
- Git status (only expected files)
|
|
75
|
+
|
|
76
|
+
**Implementation**: `/evidence` command
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### 1.5 Convention Discovery Phase
|
|
81
|
+
|
|
82
|
+
**Problem**: AI generates "technically correct code that feels foreign to your codebase."
|
|
83
|
+
|
|
84
|
+
**Pattern**:
|
|
85
|
+
1. Find similar existing module
|
|
86
|
+
2. Document observed conventions
|
|
87
|
+
3. Create plan using discovered patterns
|
|
88
|
+
4. Reference example in implementation
|
|
89
|
+
|
|
90
|
+
**Implementation**: Convention examples in `.claude/examples/`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 1.6 Multi-Stage Verification
|
|
95
|
+
|
|
96
|
+
**Problem**: Agents cannot reliably verify their own work.
|
|
97
|
+
|
|
98
|
+
**Pattern**: Three verification stages:
|
|
99
|
+
1. **Smoke Tests**: Compile, lint, existing tests
|
|
100
|
+
2. **Correctness**: New tests, edge cases, integration
|
|
101
|
+
3. **External Review**: CodeRabbit, Semgrep, human review
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 2. Task Memory Patterns
|
|
106
|
+
|
|
107
|
+
Source: Beads issue tracker (Steve Yegge)
|
|
108
|
+
|
|
109
|
+
### 2.1 Ready Work Calculation
|
|
110
|
+
|
|
111
|
+
**Problem**: Without dependency awareness, agents pick blocked tasks.
|
|
112
|
+
|
|
113
|
+
**Pattern**:
|
|
114
|
+
1. Query all active issues
|
|
115
|
+
2. Filter where ALL blockers are Done
|
|
116
|
+
3. Sort by priority, then age
|
|
117
|
+
4. Present ready work list
|
|
118
|
+
|
|
119
|
+
**Implementation**: `/ready` command
|
|
120
|
+
|
|
121
|
+
**Key Insight**: Agents can instantly orient when they can query ready work.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### 2.2 Discovered-From Linking
|
|
126
|
+
|
|
127
|
+
**Problem**: Agents file issues but lose discovery context.
|
|
128
|
+
|
|
129
|
+
**Pattern**: When discovering new work:
|
|
130
|
+
1. File immediately (don't defer)
|
|
131
|
+
2. Link to parent issue
|
|
132
|
+
3. Add discovery context
|
|
133
|
+
4. Add "discovered" label
|
|
134
|
+
|
|
135
|
+
**Implementation**: `/discover` command
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 2.3 Session Handoff Prompts
|
|
140
|
+
|
|
141
|
+
**Problem**: Sessions end abruptly. Next session starts cold.
|
|
142
|
+
|
|
143
|
+
**Pattern**: At session end, generate:
|
|
144
|
+
- What was completed
|
|
145
|
+
- What's in progress
|
|
146
|
+
- What was discovered
|
|
147
|
+
- Recommended next task
|
|
148
|
+
- Critical context
|
|
149
|
+
|
|
150
|
+
**Implementation**: `/handoff` command
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### 2.4 Memory Decay Reviews
|
|
155
|
+
|
|
156
|
+
**Problem**: Issue trackers accumulate cruft, wasting context.
|
|
157
|
+
|
|
158
|
+
**Pattern**: Weekly maintenance:
|
|
159
|
+
- Archive issues closed >30 days
|
|
160
|
+
- Summarize before archiving
|
|
161
|
+
- Target <50 active issues
|
|
162
|
+
|
|
163
|
+
**Implementation**: `/decay-review` command
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### 2.5 Quick Agent Orientation
|
|
168
|
+
|
|
169
|
+
**Problem**: New sessions re-read everything, wasting tokens.
|
|
170
|
+
|
|
171
|
+
**Pattern**: Session startup:
|
|
172
|
+
1. Check for handoff (<48 hours)
|
|
173
|
+
2. Query in-progress issues
|
|
174
|
+
3. Query ready work
|
|
175
|
+
4. Report and await direction
|
|
176
|
+
|
|
177
|
+
**Implementation**: `/orient` command
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 3. Spec-Driven Patterns
|
|
182
|
+
|
|
183
|
+
Sources: BMAD, SpecKit, OpenSpec, Agent OS
|
|
184
|
+
|
|
185
|
+
### 3.1 Phase-Gated Workflows
|
|
186
|
+
|
|
187
|
+
**Problem**: Agents jump straight to coding without understanding.
|
|
188
|
+
|
|
189
|
+
**Pattern**: Human checkpoints between phases:
|
|
190
|
+
```
|
|
191
|
+
EXPLORE → [approve] → SPECIFY → [approve] → PLAN → [approve] → TASKS
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Key Insight**: Phase gates prevent disasters.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 3.2 Three-Tier Context Hierarchy
|
|
199
|
+
|
|
200
|
+
**Problem**: Monolithic context documents exceed windows.
|
|
201
|
+
|
|
202
|
+
**Pattern**:
|
|
203
|
+
| Tier | Location | Contents | Lifetime |
|
|
204
|
+
|------|----------|----------|----------|
|
|
205
|
+
| Global | ~/.claude/ | Standards, templates | Permanent |
|
|
206
|
+
| Project | .claude/ | CLAUDE.md, constitution | Project |
|
|
207
|
+
| Feature | .claude/specs/ | Specifications | Feature |
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### 3.3 Document Sharding
|
|
212
|
+
|
|
213
|
+
**Problem**: Large specs cause context rot.
|
|
214
|
+
|
|
215
|
+
**Pattern**: Break specs into atomic pieces:
|
|
216
|
+
```
|
|
217
|
+
SPEC-001-auth.md (master)
|
|
218
|
+
SPEC-001-auth/
|
|
219
|
+
├── epic-001-registration.md
|
|
220
|
+
├── epic-002-login.md
|
|
221
|
+
└── epic-003-reset.md
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Benefit**: ~80% token savings by loading only relevant shards.
|
|
225
|
+
|
|
226
|
+
**Implementation**: `/shard` command
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### 3.4 Brownfield Change Management
|
|
231
|
+
|
|
232
|
+
**Problem**: Most work modifies existing code, not greenfield.
|
|
233
|
+
|
|
234
|
+
**Pattern**: Separate specs (what IS) from changes (what SHOULD change):
|
|
235
|
+
```
|
|
236
|
+
.claude/specs/ → Source of truth
|
|
237
|
+
.claude/changes/ → Delta proposals
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Use ADDED/MODIFIED/REMOVED markers for clarity.
|
|
241
|
+
|
|
242
|
+
**Implementation**: `/change` command
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### 3.5 Gherkin Acceptance Criteria
|
|
247
|
+
|
|
248
|
+
**Problem**: Vague requirements are unverifiable.
|
|
249
|
+
|
|
250
|
+
**Pattern**: GIVEN/WHEN/THEN scenarios:
|
|
251
|
+
```
|
|
252
|
+
GIVEN a registered user
|
|
253
|
+
WHEN they submit valid credentials
|
|
254
|
+
THEN a session is created
|
|
255
|
+
AND they are redirected to dashboard
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Benefits**:
|
|
259
|
+
- Unambiguous
|
|
260
|
+
- Testable
|
|
261
|
+
- Scoped
|
|
262
|
+
- Human-readable
|
|
263
|
+
- AI-parseable
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### 3.6 Constitution Pattern
|
|
268
|
+
|
|
269
|
+
**Problem**: Agents make decisions that violate core principles.
|
|
270
|
+
|
|
271
|
+
**Pattern**: Non-negotiable principles that cannot be overridden:
|
|
272
|
+
- Security principles (5)
|
|
273
|
+
- Code quality principles (5)
|
|
274
|
+
- Architecture principles (4)
|
|
275
|
+
- Process principles (5)
|
|
276
|
+
- What we will NOT do (10)
|
|
277
|
+
|
|
278
|
+
**Implementation**: `.claude/constitution.md`
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 4. Memory Patterns
|
|
283
|
+
|
|
284
|
+
Sources: Claude-Mem, research
|
|
285
|
+
|
|
286
|
+
### 4.1 Five-Layer Memory System
|
|
287
|
+
|
|
288
|
+
| Layer | Purpose | Location | Decay |
|
|
289
|
+
|-------|---------|----------|-------|
|
|
290
|
+
| Spec | What to build | .claude/specs/ | Archive on complete |
|
|
291
|
+
| Task | What to do | Linear | Archive >30 days |
|
|
292
|
+
| Session | What happened | Claude-Mem | Compress |
|
|
293
|
+
| Handoff | Where we left off | .claude/handoffs/ | Keep last 7 |
|
|
294
|
+
| Convention | How to build | CLAUDE.md | Rarely |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### 4.2 Progressive Disclosure
|
|
299
|
+
|
|
300
|
+
**Problem**: Loading all context wastes tokens.
|
|
301
|
+
|
|
302
|
+
**Pattern**: Three disclosure layers:
|
|
303
|
+
1. **Index**: Just titles and IDs
|
|
304
|
+
2. **Summary**: Key points and status
|
|
305
|
+
3. **Full**: Complete content
|
|
306
|
+
|
|
307
|
+
Load deeper layers only when needed.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### 4.3 Semantic Search Over History
|
|
312
|
+
|
|
313
|
+
**Problem**: Keyword search misses related content.
|
|
314
|
+
|
|
315
|
+
**Pattern**: Vector embeddings enable natural language queries:
|
|
316
|
+
- "What did we do about authentication?"
|
|
317
|
+
- "Where was the rate limiting discussion?"
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 5. Quality Gate Patterns
|
|
322
|
+
|
|
323
|
+
### 5.1 Pre-Work Gate
|
|
324
|
+
|
|
325
|
+
**When**: Before any code changes
|
|
326
|
+
|
|
327
|
+
**Checks**:
|
|
328
|
+
- [ ] Git status clean
|
|
329
|
+
- [ ] On feature branch
|
|
330
|
+
- [ ] Dependencies installed
|
|
331
|
+
- [ ] Tests passing
|
|
332
|
+
- [ ] Types passing
|
|
333
|
+
|
|
334
|
+
**Implementation**: `/validate` command
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### 5.2 During-Work Gate
|
|
339
|
+
|
|
340
|
+
**When**: Continuous during implementation
|
|
341
|
+
|
|
342
|
+
**Behaviors**:
|
|
343
|
+
- Read before write
|
|
344
|
+
- Follow conventions
|
|
345
|
+
- File discovered work
|
|
346
|
+
- Update task status
|
|
347
|
+
- Report stuck states
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
### 5.3 Pre-PR Gate
|
|
352
|
+
|
|
353
|
+
**When**: Before creating pull request
|
|
354
|
+
|
|
355
|
+
**Checks**:
|
|
356
|
+
- [ ] Lint passes (with output)
|
|
357
|
+
- [ ] Types pass (with output)
|
|
358
|
+
- [ ] Tests pass (with output)
|
|
359
|
+
- [ ] Only expected files changed
|
|
360
|
+
- [ ] Evidence captured
|
|
361
|
+
|
|
362
|
+
**Implementation**: `/evidence` command
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### 5.4 Post-PR Gate
|
|
367
|
+
|
|
368
|
+
**When**: After PR created
|
|
369
|
+
|
|
370
|
+
**Tools**:
|
|
371
|
+
- CodeRabbit: AI code review
|
|
372
|
+
- Semgrep: Security scanning
|
|
373
|
+
- Trivy: Vulnerability detection
|
|
374
|
+
- Gitleaks: Secret detection
|
|
375
|
+
- Human review: Final approval
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Pattern Integration
|
|
380
|
+
|
|
381
|
+
These patterns work together:
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
Session Start
|
|
385
|
+
│
|
|
386
|
+
├─► /orient (Quick Orientation)
|
|
387
|
+
│ │
|
|
388
|
+
│ └─► /ready (Ready Work Calculation)
|
|
389
|
+
│ │
|
|
390
|
+
│ └─► /validate (Environment Validation)
|
|
391
|
+
│
|
|
392
|
+
Feature Work
|
|
393
|
+
│
|
|
394
|
+
├─► /explore (Discovery + Read-Before-Write)
|
|
395
|
+
│ │
|
|
396
|
+
│ └─► /spec (Gherkin Scenarios)
|
|
397
|
+
│ │
|
|
398
|
+
│ └─► /plan (Document Sharding)
|
|
399
|
+
│ │
|
|
400
|
+
│ └─► /tasks (Task Memory)
|
|
401
|
+
│
|
|
402
|
+
Implementation
|
|
403
|
+
│
|
|
404
|
+
├─► Convention Discovery
|
|
405
|
+
│ │
|
|
406
|
+
│ └─► Living Task Management
|
|
407
|
+
│ │
|
|
408
|
+
│ └─► /discover (Discovered-From Linking)
|
|
409
|
+
│ │
|
|
410
|
+
│ └─► /evidence (Evidence-Based PR)
|
|
411
|
+
│
|
|
412
|
+
Session End
|
|
413
|
+
│
|
|
414
|
+
└─► /handoff (Session Handoff)
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
*For command details, see the [Command Reference](command-reference.md).*
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Planning Responsibilities
|
|
2
|
+
|
|
3
|
+
> Clear ownership of planning functions. No overlap, no gaps.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Principle
|
|
8
|
+
|
|
9
|
+
**Human orchestrates, Claude executes.**
|
|
10
|
+
|
|
11
|
+
Claude doesn't decide what to work on. Claude presents options, provides context, and awaits direction. The human makes priority decisions.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Planning Functions
|
|
16
|
+
|
|
17
|
+
| Function | Owner | Tool/Method |
|
|
18
|
+
|----------|-------|-------------|
|
|
19
|
+
| **What exists** | Linear | Issue backlog |
|
|
20
|
+
| **What's blocked** | Linear + `/ready` | Dependency tracking |
|
|
21
|
+
| **What's ready** | `/ready` command | Filters unblocked work |
|
|
22
|
+
| **What's context** | `/orient` command | Handoffs, git state |
|
|
23
|
+
| **What's priority** | Human | Uses `/sprint` for suggestions |
|
|
24
|
+
| **What's approved** | Human | Explicit approval gates |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Command Responsibilities
|
|
29
|
+
|
|
30
|
+
### Session Start: `/orient`
|
|
31
|
+
**Answers:** "Where am I? What happened? What's going on?"
|
|
32
|
+
- Reads recent handoff
|
|
33
|
+
- Checks git state
|
|
34
|
+
- Reports in-progress work
|
|
35
|
+
- Shows ready work summary
|
|
36
|
+
- **Does NOT** start working
|
|
37
|
+
|
|
38
|
+
### Ready Work: `/ready`
|
|
39
|
+
**Answers:** "What CAN I work on?"
|
|
40
|
+
- Queries Linear for active issues
|
|
41
|
+
- Filters to unblocked items
|
|
42
|
+
- Sorts by priority then age
|
|
43
|
+
- **Does NOT** recommend priorities
|
|
44
|
+
|
|
45
|
+
### Session Focus: `/sprint`
|
|
46
|
+
**Answers:** "What SHOULD I work on?"
|
|
47
|
+
- Summarizes state (blocked, in-progress, review, todo)
|
|
48
|
+
- Suggests top 3 based on simple heuristics
|
|
49
|
+
- Highlights blockers needing human action
|
|
50
|
+
- **Does NOT** decide for you
|
|
51
|
+
|
|
52
|
+
### Metrics: `/weekly-review`
|
|
53
|
+
**Answers:** "How did we do? What to improve?"
|
|
54
|
+
- Analyzes past week
|
|
55
|
+
- Calculates metrics
|
|
56
|
+
- Identifies patterns
|
|
57
|
+
- **Does NOT** plan upcoming work
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## What's NOT in Anvil
|
|
62
|
+
|
|
63
|
+
Deliberately excluded orchestration patterns:
|
|
64
|
+
|
|
65
|
+
| Pattern | Why Excluded |
|
|
66
|
+
|---------|--------------|
|
|
67
|
+
| Scrum master agent | Over-engineered for solo dev |
|
|
68
|
+
| Automated priority calculation | Human judgment is better |
|
|
69
|
+
| Multi-agent task routing | Research shows performance degradation |
|
|
70
|
+
| Sprint planning meetings | Single person doesn't need ceremonies |
|
|
71
|
+
| Velocity tracking | Irrelevant without team |
|
|
72
|
+
| Story point estimation | Use t-shirt sizes or time estimates directly |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Decision Flow
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
┌─────────────┐
|
|
80
|
+
│ Human │ "I want to start a session"
|
|
81
|
+
└──────┬──────┘
|
|
82
|
+
│
|
|
83
|
+
▼
|
|
84
|
+
┌─────────────┐
|
|
85
|
+
│ /orient │ Reports state, awaits direction
|
|
86
|
+
└──────┬──────┘
|
|
87
|
+
│
|
|
88
|
+
▼
|
|
89
|
+
┌─────────────┐
|
|
90
|
+
│ Human │ "What should I work on?"
|
|
91
|
+
└──────┬──────┘
|
|
92
|
+
│
|
|
93
|
+
▼
|
|
94
|
+
┌─────────────┐
|
|
95
|
+
│ /sprint │ Suggests priorities, awaits selection
|
|
96
|
+
└──────┬──────┘
|
|
97
|
+
│
|
|
98
|
+
▼
|
|
99
|
+
┌─────────────┐
|
|
100
|
+
│ Human │ "Work on ENG-123"
|
|
101
|
+
└──────┬──────┘
|
|
102
|
+
│
|
|
103
|
+
▼
|
|
104
|
+
┌─────────────┐
|
|
105
|
+
│ /validate │ Verifies environment, begins work
|
|
106
|
+
└─────────────┘
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Anti-Patterns
|
|
112
|
+
|
|
113
|
+
❌ **Claude deciding priorities**
|
|
114
|
+
- "I'll work on ENG-123 since it's highest priority"
|
|
115
|
+
- Fix: Always await human selection
|
|
116
|
+
|
|
117
|
+
❌ **Complex priority algorithms**
|
|
118
|
+
- WSJF, weighted scoring, dependency graphs
|
|
119
|
+
- Fix: Simple heuristics + human judgment
|
|
120
|
+
|
|
121
|
+
❌ **Automated task assignment**
|
|
122
|
+
- "Routing this to backend agent"
|
|
123
|
+
- Fix: Single generalist, human directs
|
|
124
|
+
|
|
125
|
+
❌ **Skipping human approval gates**
|
|
126
|
+
- Auto-proceeding from spec to implementation
|
|
127
|
+
- Fix: Explicit approval at each phase
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Summary
|
|
132
|
+
|
|
133
|
+
| Stage | Who Decides | Claude's Role |
|
|
134
|
+
|-------|-------------|---------------|
|
|
135
|
+
| What to work on | Human | Present options |
|
|
136
|
+
| Spec approval | Human | Generate, await approval |
|
|
137
|
+
| Plan approval | Human | Generate, await approval |
|
|
138
|
+
| How to implement | Claude | Execute with skill |
|
|
139
|
+
| When to stop | Human | Report progress, await direction |
|