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.
Files changed (190) hide show
  1. package/README.md +719 -0
  2. package/VERSION +1 -0
  3. package/docs/ANVIL-REPO-IMPLEMENTATION-PLAN.md +441 -0
  4. package/docs/FIRST-SKILL-TUTORIAL.md +408 -0
  5. package/docs/INSTALLATION-RETRO-NOTES.md +458 -0
  6. package/docs/INSTALLATION.md +984 -0
  7. package/docs/anvil-hud.md +469 -0
  8. package/docs/anvil-init.md +255 -0
  9. package/docs/anvil-state.md +210 -0
  10. package/docs/boris-cherny-ralph-wiggum-insights.md +608 -0
  11. package/docs/command-reference.md +2022 -0
  12. package/docs/hooks-tts.md +368 -0
  13. package/docs/implementation-guide.md +810 -0
  14. package/docs/linear-github-integration.md +247 -0
  15. package/docs/local-issues.md +677 -0
  16. package/docs/patterns/README.md +419 -0
  17. package/docs/planning-responsibilities.md +139 -0
  18. package/docs/session-workflow.md +573 -0
  19. package/docs/simplification-plan-template.md +297 -0
  20. package/docs/simplification-principles.md +129 -0
  21. package/docs/specifications/CCS-RALPH-INTEGRATION-DESIGN.md +633 -0
  22. package/docs/specifications/CCS-RESEARCH-REPORT.md +169 -0
  23. package/docs/specifications/PLAN-ANV-verification-ralph-wiggum.md +403 -0
  24. package/docs/specifications/PLAN-parallel-tracks-anvil-memory-ccs.md +494 -0
  25. package/docs/specifications/SPEC-ANV-VRW/component-01-verify.md +208 -0
  26. package/docs/specifications/SPEC-ANV-VRW/component-02-stop-gate.md +226 -0
  27. package/docs/specifications/SPEC-ANV-VRW/component-03-posttooluse.md +209 -0
  28. package/docs/specifications/SPEC-ANV-VRW/component-04-ralph-wiggum.md +604 -0
  29. package/docs/specifications/SPEC-ANV-VRW/component-05-atomic-actions.md +311 -0
  30. package/docs/specifications/SPEC-ANV-VRW/component-06-verify-subagent.md +264 -0
  31. package/docs/specifications/SPEC-ANV-VRW/component-07-claude-md.md +363 -0
  32. package/docs/specifications/SPEC-ANV-VRW/index.md +182 -0
  33. package/docs/specifications/SPEC-ANV-anvil-memory.md +573 -0
  34. package/docs/specifications/SPEC-ANV-context-checkpoints.md +781 -0
  35. package/docs/specifications/SPEC-ANV-verification-ralph-wiggum.md +789 -0
  36. package/docs/sync.md +122 -0
  37. package/global/CLAUDE.md +140 -0
  38. package/global/agents/verify-app.md +164 -0
  39. package/global/commands/anvil-settings.md +527 -0
  40. package/global/commands/anvil-sync.md +121 -0
  41. package/global/commands/change.md +197 -0
  42. package/global/commands/clarify.md +252 -0
  43. package/global/commands/cleanup.md +292 -0
  44. package/global/commands/commit-push-pr.md +207 -0
  45. package/global/commands/decay-review.md +127 -0
  46. package/global/commands/discover.md +158 -0
  47. package/global/commands/doc-coverage.md +122 -0
  48. package/global/commands/evidence.md +307 -0
  49. package/global/commands/explore.md +121 -0
  50. package/global/commands/force-exit.md +135 -0
  51. package/global/commands/handoff.md +191 -0
  52. package/global/commands/healthcheck.md +302 -0
  53. package/global/commands/hud.md +84 -0
  54. package/global/commands/insights.md +319 -0
  55. package/global/commands/linear-setup.md +184 -0
  56. package/global/commands/lint-fix.md +198 -0
  57. package/global/commands/orient.md +510 -0
  58. package/global/commands/plan.md +228 -0
  59. package/global/commands/ralph.md +346 -0
  60. package/global/commands/ready.md +182 -0
  61. package/global/commands/release.md +305 -0
  62. package/global/commands/retro.md +96 -0
  63. package/global/commands/shard.md +166 -0
  64. package/global/commands/spec.md +227 -0
  65. package/global/commands/sprint.md +184 -0
  66. package/global/commands/tasks.md +228 -0
  67. package/global/commands/test-and-commit.md +151 -0
  68. package/global/commands/validate.md +132 -0
  69. package/global/commands/verify.md +251 -0
  70. package/global/commands/weekly-review.md +156 -0
  71. package/global/hooks/__pycache__/ralph_context_monitor.cpython-314.pyc +0 -0
  72. package/global/hooks/__pycache__/statusline_agent_sync.cpython-314.pyc +0 -0
  73. package/global/hooks/anvil_memory_observe.ts +322 -0
  74. package/global/hooks/anvil_memory_session.ts +166 -0
  75. package/global/hooks/anvil_memory_stop.ts +187 -0
  76. package/global/hooks/parse_transcript.py +116 -0
  77. package/global/hooks/post_merge_cleanup.sh +132 -0
  78. package/global/hooks/post_tool_format.sh +215 -0
  79. package/global/hooks/ralph_context_monitor.py +240 -0
  80. package/global/hooks/ralph_stop.sh +502 -0
  81. package/global/hooks/statusline.sh +1110 -0
  82. package/global/hooks/statusline_agent_sync.py +224 -0
  83. package/global/hooks/stop_gate.sh +250 -0
  84. package/global/lib/.claude/anvil-state.json +21 -0
  85. package/global/lib/__pycache__/agent_registry.cpython-314.pyc +0 -0
  86. package/global/lib/__pycache__/claim_service.cpython-314.pyc +0 -0
  87. package/global/lib/__pycache__/coderabbit_service.cpython-314.pyc +0 -0
  88. package/global/lib/__pycache__/config_service.cpython-314.pyc +0 -0
  89. package/global/lib/__pycache__/coordination_service.cpython-314.pyc +0 -0
  90. package/global/lib/__pycache__/doc_coverage_service.cpython-314.pyc +0 -0
  91. package/global/lib/__pycache__/gate_logger.cpython-314.pyc +0 -0
  92. package/global/lib/__pycache__/github_service.cpython-314.pyc +0 -0
  93. package/global/lib/__pycache__/hygiene_service.cpython-314.pyc +0 -0
  94. package/global/lib/__pycache__/issue_models.cpython-314.pyc +0 -0
  95. package/global/lib/__pycache__/issue_provider.cpython-314.pyc +0 -0
  96. package/global/lib/__pycache__/linear_data_service.cpython-314.pyc +0 -0
  97. package/global/lib/__pycache__/linear_provider.cpython-314.pyc +0 -0
  98. package/global/lib/__pycache__/local_provider.cpython-314.pyc +0 -0
  99. package/global/lib/__pycache__/quality_service.cpython-314.pyc +0 -0
  100. package/global/lib/__pycache__/ralph_state.cpython-314.pyc +0 -0
  101. package/global/lib/__pycache__/state_manager.cpython-314.pyc +0 -0
  102. package/global/lib/__pycache__/transcript_parser.cpython-314.pyc +0 -0
  103. package/global/lib/__pycache__/verification_runner.cpython-314.pyc +0 -0
  104. package/global/lib/__pycache__/verify_iteration.cpython-314.pyc +0 -0
  105. package/global/lib/__pycache__/verify_subagent.cpython-314.pyc +0 -0
  106. package/global/lib/agent_registry.py +995 -0
  107. package/global/lib/anvil-state.sh +435 -0
  108. package/global/lib/claim_service.py +515 -0
  109. package/global/lib/coderabbit_service.py +314 -0
  110. package/global/lib/config_service.py +423 -0
  111. package/global/lib/coordination_service.py +331 -0
  112. package/global/lib/doc_coverage_service.py +1305 -0
  113. package/global/lib/gate_logger.py +316 -0
  114. package/global/lib/github_service.py +310 -0
  115. package/global/lib/handoff_generator.py +775 -0
  116. package/global/lib/hygiene_service.py +712 -0
  117. package/global/lib/issue_models.py +257 -0
  118. package/global/lib/issue_provider.py +339 -0
  119. package/global/lib/linear_data_service.py +210 -0
  120. package/global/lib/linear_provider.py +987 -0
  121. package/global/lib/linear_provider.py.backup +671 -0
  122. package/global/lib/local_provider.py +486 -0
  123. package/global/lib/orient_fast.py +457 -0
  124. package/global/lib/quality_service.py +470 -0
  125. package/global/lib/ralph_prompt_generator.py +563 -0
  126. package/global/lib/ralph_state.py +1202 -0
  127. package/global/lib/state_manager.py +417 -0
  128. package/global/lib/transcript_parser.py +597 -0
  129. package/global/lib/verification_runner.py +557 -0
  130. package/global/lib/verify_iteration.py +490 -0
  131. package/global/lib/verify_subagent.py +250 -0
  132. package/global/skills/README.md +155 -0
  133. package/global/skills/quality-gates/SKILL.md +252 -0
  134. package/global/skills/skill-template/SKILL.md +109 -0
  135. package/global/skills/testing-strategies/SKILL.md +337 -0
  136. package/global/templates/CHANGE-template.md +105 -0
  137. package/global/templates/HANDOFF-template.md +63 -0
  138. package/global/templates/PLAN-template.md +111 -0
  139. package/global/templates/SPEC-template.md +93 -0
  140. package/global/templates/ralph/PROMPT.md.template +89 -0
  141. package/global/templates/ralph/fix_plan.md.template +31 -0
  142. package/global/templates/ralph/progress.txt.template +23 -0
  143. package/global/tests/__pycache__/test_doc_coverage.cpython-314.pyc +0 -0
  144. package/global/tests/test_doc_coverage.py +520 -0
  145. package/global/tests/test_issue_models.py +299 -0
  146. package/global/tests/test_local_provider.py +323 -0
  147. package/global/tools/README.md +178 -0
  148. package/global/tools/__pycache__/anvil-hud.cpython-314.pyc +0 -0
  149. package/global/tools/anvil-hud.py +3622 -0
  150. package/global/tools/anvil-hud.py.bak +3318 -0
  151. package/global/tools/anvil-issue.py +432 -0
  152. package/global/tools/anvil-memory/CLAUDE.md +49 -0
  153. package/global/tools/anvil-memory/README.md +42 -0
  154. package/global/tools/anvil-memory/bun.lock +25 -0
  155. package/global/tools/anvil-memory/bunfig.toml +9 -0
  156. package/global/tools/anvil-memory/package.json +23 -0
  157. package/global/tools/anvil-memory/src/__tests__/ccs/context-monitor.test.ts +535 -0
  158. package/global/tools/anvil-memory/src/__tests__/ccs/edge-cases.test.ts +645 -0
  159. package/global/tools/anvil-memory/src/__tests__/ccs/fixtures.ts +363 -0
  160. package/global/tools/anvil-memory/src/__tests__/ccs/index.ts +8 -0
  161. package/global/tools/anvil-memory/src/__tests__/ccs/integration.test.ts +417 -0
  162. package/global/tools/anvil-memory/src/__tests__/ccs/prompt-generator.test.ts +571 -0
  163. package/global/tools/anvil-memory/src/__tests__/ccs/ralph-stop.test.ts +440 -0
  164. package/global/tools/anvil-memory/src/__tests__/ccs/test-utils.ts +252 -0
  165. package/global/tools/anvil-memory/src/__tests__/commands.test.ts +657 -0
  166. package/global/tools/anvil-memory/src/__tests__/db.test.ts +641 -0
  167. package/global/tools/anvil-memory/src/__tests__/hooks.test.ts +272 -0
  168. package/global/tools/anvil-memory/src/__tests__/performance.test.ts +427 -0
  169. package/global/tools/anvil-memory/src/__tests__/test-utils.ts +113 -0
  170. package/global/tools/anvil-memory/src/commands/checkpoint.ts +197 -0
  171. package/global/tools/anvil-memory/src/commands/get.ts +115 -0
  172. package/global/tools/anvil-memory/src/commands/init.ts +94 -0
  173. package/global/tools/anvil-memory/src/commands/observe.ts +163 -0
  174. package/global/tools/anvil-memory/src/commands/search.ts +112 -0
  175. package/global/tools/anvil-memory/src/db.ts +638 -0
  176. package/global/tools/anvil-memory/src/index.ts +205 -0
  177. package/global/tools/anvil-memory/src/types.ts +122 -0
  178. package/global/tools/anvil-memory/tsconfig.json +29 -0
  179. package/global/tools/ralph-loop.sh +359 -0
  180. package/package.json +45 -0
  181. package/scripts/anvil +822 -0
  182. package/scripts/extract_patterns.py +222 -0
  183. package/scripts/init-project.sh +541 -0
  184. package/scripts/install.sh +229 -0
  185. package/scripts/postinstall.js +41 -0
  186. package/scripts/rollback.sh +188 -0
  187. package/scripts/sync.sh +623 -0
  188. package/scripts/test-statusline.sh +248 -0
  189. package/scripts/update_claude_md.py +224 -0
  190. package/scripts/verify.sh +255 -0
@@ -0,0 +1,158 @@
1
+ # /discover - File Discovered Work
2
+
3
+ > Immediately capture work discovered during implementation.
4
+
5
+ ## When to Use
6
+ - When you find something that needs fixing while working on something else
7
+ - When you notice technical debt
8
+ - When a bug is discovered during development
9
+ - When scope creep is detected (but shouldn't be addressed now)
10
+
11
+ ## Pre-Flight: Check Linear Configuration
12
+
13
+ **CRITICAL**: Before creating issues, verify project configuration.
14
+
15
+ ```bash
16
+ if [ -f ".claude/linear.yaml" ]; then
17
+ TEAM_KEY=$(grep "team_key:" .claude/linear.yaml | cut -d'"' -f2)
18
+ echo "Filing discovery in team: $TEAM_KEY"
19
+ else
20
+ echo "⚠️ LINEAR NOT CONFIGURED"
21
+ echo "Run /linear-setup first"
22
+ exit 1
23
+ fi
24
+ ```
25
+
26
+ **If no linear.yaml**: Stop and prompt user to run `/linear-setup`. Do NOT create issues.
27
+
28
+ ## Why This Matters
29
+ Discovered work creates a dilemma:
30
+ - **If ignored**: It gets forgotten
31
+ - **If addressed immediately**: Scope creep, context switching
32
+ - **Solution**: File it immediately in the correct team, continue current work
33
+
34
+ ## Execution Steps
35
+
36
+ ### Step 1: Capture Context
37
+ Before you forget, note:
38
+ - What was discovered
39
+ - Where it was found (file, line number)
40
+ - Why it matters
41
+ - How it relates to current work
42
+
43
+ ### Step 2: Create Linear Issue in Configured Team
44
+
45
+ Use Linear MCP to create the issue in the configured team:
46
+
47
+ ```
48
+ Create issue in team [team_key from linear.yaml]:
49
+ - Title: "[Brief description of discovered work]"
50
+ - Labels: ["discovered"]
51
+ - Description: [formatted below]
52
+ ```
53
+
54
+ **Issue Description:**
55
+ ```markdown
56
+ ## Discovery Context
57
+ **Discovered while**: Working on [current issue key]
58
+ **Found in**: [file path, line number]
59
+
60
+ ## Description
61
+ [What was discovered and why it matters]
62
+
63
+ ## Recommended Action
64
+ [What should be done about this]
65
+ ```
66
+
67
+ ### Step 3: Link to Parent
68
+ Set "discovered from" or "related to" relationship:
69
+ - Links discovered issue to the work where it was found
70
+ - Preserves context for future
71
+
72
+ ### Step 4: Continue Original Work
73
+ After filing:
74
+ - Return focus to original task
75
+ - Don't context switch to fix discovered issue
76
+ - Trust that it's captured and won't be lost
77
+
78
+ ### Step 5: Report Discovery
79
+
80
+ Output:
81
+ ```
82
+ ## Discovered Work Filed — [team_key]
83
+
84
+ **Issue Created**: [TEAM-XXX]
85
+ **Title**: [Title]
86
+ **Priority**: [Priority]
87
+ **Discovered From**: [Parent issue key]
88
+
89
+ **Link**: [Linear URL]
90
+
91
+ Continuing with original task: [Current issue key]
92
+ ```
93
+
94
+ ## Error: Linear Not Configured
95
+
96
+ If linear.yaml is missing, output:
97
+
98
+ ```
99
+ ## Discover — ⚠️ Linear Not Configured
100
+
101
+ This project is not mapped to a Linear team.
102
+
103
+ **To configure:**
104
+ 1. Run `/linear-setup` to select or create a team
105
+ 2. Then run `/discover` again
106
+
107
+ Cannot file discovered work without team configuration.
108
+
109
+ **Workaround**: Note the discovery in a comment or TODO for now.
110
+ ```
111
+
112
+ ## Quick Discovery Format
113
+ For rapid capture during flow:
114
+
115
+ ```
116
+ /discover "Brief title" --from [current-issue] --priority P2
117
+ ```
118
+
119
+ Creates issue with minimal friction, full details can be added later.
120
+
121
+ ## What Qualifies as Discovered Work
122
+
123
+ **File immediately**:
124
+ - Bugs found in unrelated code
125
+ - Missing error handling
126
+ - Security concerns
127
+ - Performance issues
128
+ - Technical debt
129
+ - Missing tests
130
+ - Documentation gaps
131
+ - Accessibility issues
132
+
133
+ **Don't file** (just fix):
134
+ - Typos in files you're already editing
135
+ - Trivial fixes in your current scope
136
+ - Things that take <5 minutes and are in scope
137
+
138
+ ## Key Behaviors
139
+ - **ALWAYS check linear.yaml first** — file in correct team only
140
+ - File **immediately**—don't say "I'll remember"
141
+ - Include discovery context (where, when, why)
142
+ - Link to parent issue
143
+ - Don't interrupt current work to fix
144
+ - Assess priority independently (discovered P0 bug should be P0)
145
+
146
+ ## Anti-Patterns
147
+ - ❌ Creating issues without checking linear.yaml
148
+ - ❌ "I'll file this later" (you won't)
149
+ - ❌ Fixing discovered issues immediately (scope creep)
150
+ - ❌ Filing without context (future you won't understand)
151
+ - ❌ Not linking to parent (loses discovery trail)
152
+
153
+ ## Integration Points
154
+ - Requires: `.claude/linear.yaml` (team configuration)
155
+ - Uses: Linear MCP (create_issue with team filter)
156
+ - Creates: Linear issue with "discovered" label
157
+ - Used during: Any implementation work
158
+ - References: Current task being worked on
@@ -0,0 +1,122 @@
1
+ # /doc-coverage - Documentation Coverage Report
2
+
3
+ > Check documentation coverage and identify gaps.
4
+
5
+ ## When to Use
6
+ - Before creating a PR to check documentation status
7
+ - During `/healthcheck` to assess project health
8
+ - When adding new features to identify missing docs
9
+ - To track documentation debt over time
10
+
11
+ ## Execution Steps
12
+
13
+ ### Step 1: Run Coverage Analysis
14
+
15
+ ```bash
16
+ python3 global/lib/doc_coverage_service.py --report
17
+ ```
18
+
19
+ This generates a full coverage report showing:
20
+ - Overall coverage percentage
21
+ - Coverage by type (API, commands, hooks, skills)
22
+ - List of undocumented exports
23
+
24
+ ### Step 2: Interpret Results
25
+
26
+ | Coverage | Status | Action |
27
+ |----------|--------|--------|
28
+ | >= 80% | Healthy | Maintain coverage |
29
+ | 60-79% | Warning | Address gaps before they grow |
30
+ | < 60% | Critical | Prioritize documentation work |
31
+
32
+ ### Step 3: Review Gaps
33
+
34
+ For each undocumented export:
35
+ 1. Determine if documentation is truly needed
36
+ 2. Check if export should be private (underscore prefix)
37
+ 3. Add to documentation backlog if needed
38
+
39
+ ### Step 4: Update State
40
+
41
+ Coverage snapshot is stored in `anvil-state.json` for tracking over time.
42
+
43
+ ## CLI Options
44
+
45
+ | Flag | Description |
46
+ |------|-------------|
47
+ | `--report` | Full markdown report (default) |
48
+ | `--check` | CI mode - exit 1 if below threshold |
49
+ | `--gaps` | Show only undocumented exports |
50
+ | `--json` | Output in JSON format |
51
+ | `--threshold N` | Set coverage threshold (default: 80) |
52
+
53
+ ## Example Output
54
+
55
+ ```markdown
56
+ ## Documentation Coverage Report
57
+
58
+ ### Summary
59
+
60
+ | Metric | Value | Status |
61
+ |--------|-------|--------|
62
+ | Total Exports | 268 | — |
63
+ | Documented | 217 | — |
64
+ | Coverage | 81.0% | Healthy |
65
+
66
+ ### Coverage by Type
67
+
68
+ | Type | Total | Documented | Coverage |
69
+ |------|-------|------------|----------|
70
+ | api | 45 | 38 | 84.4% |
71
+ | command | 32 | 30 | 93.8% |
72
+ | hook | 12 | 10 | 83.3% |
73
+
74
+ ### Undocumented Exports
75
+
76
+ | Export | Type | Source | Line |
77
+ |--------|------|--------|------|
78
+ | `new_function` | function | global/lib/service.py | 142 |
79
+ | `/new-cmd` | command | global/commands/new.md | 1 |
80
+ ```
81
+
82
+ ## CI Integration
83
+
84
+ Add to your CI pipeline:
85
+
86
+ ```bash
87
+ python3 global/lib/doc_coverage_service.py --check --threshold 80
88
+ ```
89
+
90
+ Exit codes:
91
+ - `0`: Coverage meets threshold
92
+ - `1`: Coverage below threshold
93
+
94
+ ## State Integration
95
+
96
+ After running, coverage data is stored:
97
+
98
+ ```json
99
+ {
100
+ "session": {
101
+ "docCoverage": {
102
+ "percent": 81.0,
103
+ "total": 268,
104
+ "documented": 217,
105
+ "status": "healthy",
106
+ "timestamp": "2026-01-11T12:00:00Z"
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ ## Key Behaviors
113
+ - Non-blocking by default (reports status, doesn't fail)
114
+ - Use `--check` for CI enforcement
115
+ - Excludes test files and private exports automatically
116
+ - Tracks coverage trends via state snapshots
117
+
118
+ ## Integration Points
119
+ - Used by: `/healthcheck` command
120
+ - Updates: `.claude/anvil-state.json`
121
+ - Reads: Source files via glob patterns
122
+ - Parses: Python AST, TypeScript regex, Markdown headers
@@ -0,0 +1,307 @@
1
+ # /evidence - Capture Quality Gate Proof
2
+
3
+ > Capture evidence that quality gates pass before PR creation.
4
+
5
+ ## When to Use
6
+ - Before creating a pull request
7
+ - After completing implementation
8
+ - When claiming work is "done"
9
+
10
+ ## Why Evidence Matters
11
+ Agents (and humans) claim "it works" without verification. Evidence:
12
+ - Proves quality gates actually passed
13
+ - Provides PR reviewers with confidence
14
+ - Creates accountability
15
+ - Catches "it worked on my machine" issues
16
+
17
+ ## Execution Steps
18
+
19
+ ### Step 1: Run All Quality Checks
20
+
21
+ Execute each check and capture output:
22
+
23
+ ```bash
24
+ # Lint
25
+ npm run lint 2>&1 | tee lint-output.txt
26
+
27
+ # TypeScript
28
+ npm run typecheck 2>&1 | tee typecheck-output.txt
29
+
30
+ # Tests
31
+ npm test 2>&1 | tee test-output.txt
32
+
33
+ # Git status
34
+ git status
35
+ git diff --stat
36
+ ```
37
+
38
+ ### Step 2: Verify Expected File Changes
39
+
40
+ ```bash
41
+ git diff --name-only HEAD
42
+ ```
43
+
44
+ Compare against plan:
45
+ - Are all expected files changed?
46
+ - Are there unexpected changes?
47
+ - Are there missing changes?
48
+
49
+ ### Step 3: Documentation Status
50
+
51
+ Check if documentation needs updating:
52
+
53
+ 1. Review files changed this branch:
54
+ ```bash
55
+ git diff --name-only main...HEAD
56
+ ```
57
+
58
+ 2. If `src/` or implementation files changed, consider:
59
+ - Did you update relevant documentation in `docs/`?
60
+ - Does README need updating?
61
+ - Are there new APIs that need documenting?
62
+
63
+ 3. Document status:
64
+ ```markdown
65
+ ### Documentation Status
66
+ - [ ] No docs needed (internal/infrastructure change only)
67
+ - [ ] Docs updated: [list files]
68
+ - [ ] Docs TODO: [what needs updating]
69
+ ```
70
+
71
+ **Note**: This is a soft prompt—use judgment. Internal refactors don't need docs, but new features do.
72
+
73
+ ---
74
+
75
+ ### Step 4: Changelog Entry
76
+
77
+ Verify changelog was updated for user-facing changes:
78
+
79
+ 1. Check if CHANGELOG.md was modified:
80
+ ```bash
81
+ git diff --name-only main...HEAD | grep -c "CHANGELOG.md" || echo "0"
82
+ ```
83
+
84
+ 2. If no changelog change detected AND work is user-facing:
85
+ ```markdown
86
+ ### Changelog Status
87
+ ⚠️ No CHANGELOG.md entry detected for this branch.
88
+
89
+ Did you add an entry to the [Unreleased] section?
90
+ - [ ] Added changelog entry
91
+ - [ ] No user-facing changes (internal only)
92
+ ```
93
+
94
+ 3. If changelog was updated:
95
+ ```markdown
96
+ ### Changelog Status
97
+ ✅ Entry added to [Unreleased] section
98
+ ```
99
+
100
+ **Guideline**: Add changelog entries for:
101
+ - New features (### Added)
102
+ - Bug fixes (### Fixed)
103
+ - Breaking changes (### Changed + BREAKING CHANGE note)
104
+ - Removed functionality (### Removed)
105
+
106
+ Skip for: internal refactors, test-only changes, documentation updates.
107
+
108
+ ---
109
+
110
+ ### Step 5: Code Review (Optional)
111
+
112
+ If code review is enabled in `.claude/anvil.config.json`:
113
+
114
+ 1. Check configuration:
115
+ ```bash
116
+ # Read config if exists
117
+ if [ -f ".claude/anvil.config.json" ]; then
118
+ cat .claude/anvil.config.json | grep -A5 '"codeReview"'
119
+ fi
120
+ ```
121
+
122
+ 2. Based on `codeReview.enforcement` setting:
123
+
124
+ | Enforcement | Behavior |
125
+ |-------------|----------|
126
+ | `hard` | Run review automatically. Block PR if critical issues found. |
127
+ | `soft` | Prompt: "Run code review? (recommended)" Proceed either way. |
128
+ | `manual` | Skip automatic prompt. User triggers when wanted. |
129
+
130
+ 3. If enabled, run configured tool:
131
+ ```bash
132
+ # Default command (configurable)
133
+ coderabbit --prompt-only
134
+ ```
135
+
136
+ 4. Include results in evidence:
137
+ ```markdown
138
+ ### Code Review
139
+ **Tool**: CodeRabbit
140
+ **Status**: ✅ No critical issues / ⚠️ X issues found
141
+
142
+ [Summary of findings if any]
143
+ ```
144
+
145
+ 5. If code review not configured:
146
+ ```markdown
147
+ ### Code Review
148
+ Not configured. Enable with `/anvil-settings codeReview on`
149
+ ```
150
+
151
+ ---
152
+
153
+ ### Step 6: Compile Evidence Block
154
+
155
+ Output format:
156
+ ```markdown
157
+ ## Quality Gate Evidence
158
+
159
+ ### Lint
160
+ ```
161
+ ✓ No ESLint errors
162
+ ```
163
+
164
+ ### TypeScript
165
+ ```
166
+ ✓ No type errors found
167
+ ```
168
+
169
+ ### Tests
170
+ ```
171
+ Test Suites: 12 passed, 12 total
172
+ Tests: 47 passed, 47 total
173
+ Snapshots: 0 total
174
+ Time: 3.245s
175
+ ```
176
+
177
+ ### Git Status
178
+ ```
179
+ On branch feature/ENG-123-new-feature
180
+ Changes staged for commit:
181
+ modified: src/components/NewFeature.tsx
182
+ new file: src/hooks/useNewFeature.ts
183
+ modified: src/services/api.ts
184
+ ```
185
+
186
+ ### File Changes Summary
187
+ | File | Status | Expected |
188
+ |------|--------|----------|
189
+ | src/components/NewFeature.tsx | Modified | ✅ Yes |
190
+ | src/hooks/useNewFeature.ts | Added | ✅ Yes |
191
+ | src/services/api.ts | Modified | ✅ Yes |
192
+ | [unexpected files] | | ❌ Investigate |
193
+
194
+ ### Documentation Status
195
+ - [x] Docs updated: docs/feature-guide.md
196
+ - [ ] No docs needed
197
+ - [ ] Docs TODO
198
+
199
+ ### Changelog Status
200
+ ✅ Entry added to [Unreleased] section
201
+
202
+ ### Code Review
203
+ Not configured / ✅ No critical issues / ⚠️ X issues to address
204
+
205
+ ### Evidence Collected
206
+ - **Date**: YYYY-MM-DD HH:MM
207
+ - **Branch**: feature/ENG-123-new-feature
208
+ - **Commit**: [hash]
209
+
210
+ ✅ All quality gates passed. Ready for PR.
211
+ ```
212
+
213
+ ### Step 7: Include in PR Description
214
+
215
+ When creating PR, include evidence block:
216
+
217
+ ```markdown
218
+ ## Changes
219
+ [Description of changes]
220
+
221
+ ## Quality Evidence
222
+ [Paste evidence block]
223
+
224
+ ## Testing
225
+ - [x] Lint passes
226
+ - [x] Types pass
227
+ - [x] Tests pass
228
+ - [x] Manual testing completed
229
+
230
+ ## Screenshots (if UI changes)
231
+ [Screenshots]
232
+
233
+ ## Linear Issue
234
+ Closes [Issue key]
235
+ ```
236
+
237
+ ## Evidence Checklist
238
+
239
+ | Gate | Must Pass | Evidence |
240
+ |------|-----------|----------|
241
+ | Lint | ✅ 0 errors | Command output |
242
+ | TypeScript | ✅ 0 errors | Command output |
243
+ | Tests | ✅ All pass | Test summary |
244
+ | Git Status | ✅ Only expected | File list |
245
+ | Manual Test | ✅ Works | Description or screenshot |
246
+ | Documentation | ⚪ Soft prompt | Status noted |
247
+ | Changelog | ⚪ Soft prompt | Entry added or justified skip |
248
+ | Code Review | ⚪ If configured | Review results (when enabled) |
249
+
250
+ **Legend**: ✅ = Required | ⚪ = Soft prompt (use judgment)
251
+
252
+ ## Failure Handling
253
+
254
+ If any gate fails:
255
+ ```
256
+ ## Quality Gate Evidence
257
+
258
+ ### ❌ Tests FAILED
259
+ ```
260
+ Test Suites: 11 passed, 1 failed
261
+ Tests: 45 passed, 2 failed
262
+
263
+ FAIL src/hooks/useNewFeature.test.ts
264
+ ● useNewFeature › should handle error state
265
+ Expected: "error"
266
+ Received: undefined
267
+ ```
268
+
269
+ **Action Required**: Fix failing tests before PR.
270
+ ```
271
+
272
+ Do NOT create PR with failing gates.
273
+
274
+ ## Key Behaviors
275
+ - Capture actual command output, not just "it passed"
276
+ - Include timestamps for accountability
277
+ - Verify file changes match plan
278
+ - Surface unexpected changes
279
+ - Never proceed with failures
280
+
281
+ ## State Sync (ANV-176)
282
+
283
+ After capturing evidence, update the session state:
284
+
285
+ ```bash
286
+ python3 global/lib/state_manager.py evidence
287
+ ```
288
+
289
+ This updates `.claude/anvil-state.json` with:
290
+ - `phase: "verify"`
291
+ - Sets `lastCommand: "/evidence"`
292
+
293
+ And syncs to the agent registry for statusline visibility.
294
+
295
+ ## Linear Auto-Update Note
296
+
297
+ When your PR includes a Linear issue key (e.g., `ANV-123`) and is merged, Linear automatically moves the issue to Done. You don't need to manually update the issue status after PR merge.
298
+
299
+ See [Linear-GitHub Integration Guide](../../docs/linear-github-integration.md) for details.
300
+
301
+ ## Integration Points
302
+ - Follows: Implementation work
303
+ - Precedes: PR creation
304
+ - References: `/validate` baseline
305
+ - Used in: PR description
306
+ - Updates: `.claude/anvil-state.json` via state_manager.py
307
+ - Note: Linear issues auto-update on PR merge (no manual update needed)
@@ -0,0 +1,121 @@
1
+ # /explore - Discovery Phase
2
+
3
+ > Conduct discovery before implementing a feature. Read existing code, find patterns, understand context.
4
+
5
+ ## When to Use
6
+ - **Always** before implementing a new feature
7
+ - When working in unfamiliar part of codebase
8
+ - Before writing a specification
9
+ - When requirements reference existing functionality
10
+
11
+ ## Execution Steps
12
+
13
+ ### Step 1: Understand the Request
14
+ Clarify:
15
+ - What is being requested?
16
+ - What problem does it solve?
17
+ - Who is affected?
18
+
19
+ ### Step 2: Search Existing Code
20
+ Look for related functionality:
21
+ ```bash
22
+ # Search for related files
23
+ find src -name "*[keyword]*" -type f
24
+
25
+ # Search for related code
26
+ grep -r "[pattern]" src/ --include="*.ts" --include="*.tsx"
27
+ ```
28
+
29
+ ### Step 3: Read Similar Modules
30
+ Identify and open the most similar existing implementation:
31
+ - Read the full file(s)
32
+ - Note patterns used
33
+ - Note conventions followed
34
+ - Document any deviations from standards
35
+
36
+ ### Step 4: Check Existing Specs
37
+ Look in `.claude/specs/` for related specifications:
38
+ - Current specs that might be affected
39
+ - Archived specs for historical context
40
+ - Related feature documentation
41
+
42
+ ### Step 5: Document Conventions
43
+ Note observed patterns:
44
+ - File naming conventions
45
+ - Component structure
46
+ - State management approach
47
+ - Error handling patterns
48
+ - Testing patterns
49
+
50
+ ### Step 6: Generate Exploration Report
51
+
52
+ Output format:
53
+ ```markdown
54
+ ## Exploration Report: [Feature Name]
55
+
56
+ ### Request Understanding
57
+ [Summary of what's being requested and why]
58
+
59
+ ### Related Existing Code
60
+ | File | Relevance | Key Patterns |
61
+ |------|-----------|--------------|
62
+ | src/components/Similar.tsx | High | Uses [pattern] |
63
+ | src/services/related.ts | Medium | [relevant detail] |
64
+
65
+ ### Observed Conventions
66
+ 1. **Components**: [How similar components are structured]
67
+ 2. **State**: [How state is managed]
68
+ 3. **API**: [How API calls are made]
69
+ 4. **Testing**: [How similar features are tested]
70
+
71
+ ### Existing Specs
72
+ - [Spec name]: [Relevance]
73
+
74
+ ### Key Findings
75
+ 1. [Important discovery]
76
+ 2. [Constraint or consideration]
77
+ 3. [Potential reuse opportunity]
78
+
79
+ ### Recommended Approach
80
+ [Brief recommendation based on discovery]
81
+
82
+ ### Open Questions
83
+ - [ ] [Question needing clarification]
84
+ - [ ] [Technical decision needed]
85
+
86
+ ### Ready for Specification: [Yes/No]
87
+ [If no, what's needed first]
88
+ ```
89
+
90
+ ## Key Behaviors
91
+ - **Read before writing**—never speculate about code you haven't opened
92
+ - Cite specific files and line numbers
93
+ - Note conventions to follow (not just functionality)
94
+ - Surface conflicts or inconsistencies
95
+ - Ask clarifying questions before proceeding
96
+
97
+ ## Anti-Patterns to Avoid
98
+ - ❌ Assuming code structure without reading it
99
+ - ❌ Skipping this step because it "seems simple"
100
+ - ❌ Not documenting findings
101
+ - ❌ Ignoring existing patterns
102
+
103
+ ## State Sync (ANV-176)
104
+
105
+ After generating the exploration report, update the session state:
106
+
107
+ ```bash
108
+ python3 global/lib/state_manager.py explore
109
+ ```
110
+
111
+ This updates `.claude/anvil-state.json` with:
112
+ - `phase: "explore"`
113
+ - Sets `lastCommand: "/explore"`
114
+
115
+ And syncs to the agent registry for statusline visibility.
116
+
117
+ ## Integration Points
118
+ - Precedes: `/spec` command
119
+ - References: `.claude/specs/` directory
120
+ - References: `.claude/examples/` for conventions
121
+ - Updates: `.claude/anvil-state.json` via state_manager.py