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,2022 @@
1
+ # Anvil Command Reference
2
+
3
+ > Complete documentation for the Anvil CLI and all slash commands.
4
+
5
+ ---
6
+
7
+ ## Quick Reference
8
+
9
+ | Command | One-liner |
10
+ |---------|-----------|
11
+ | `anvil init` | Initialize a new project with Anvil framework |
12
+ | `anvil-issue` | Manage local issues without Linear integration |
13
+ | `/orient` | Start-of-session orientation and context recovery |
14
+ | `/ready` | List unblocked work sorted by priority |
15
+ | `/sprint` | Quick session planning with focus suggestions |
16
+ | `/handoff` | Generate session continuity doc for next session |
17
+ | `/explore` | Discovery phase before new feature work |
18
+ | `/spec` | Generate formal feature specification |
19
+ | `/plan` | Create implementation plan from approved spec |
20
+ | `/tasks` | Create Linear sub-issues from approved plan |
21
+ | `/change` | Brownfield change proposal for existing features |
22
+ | `/discover` | File discovered work (bugs, debt) during implementation |
23
+ | `/validate` | Environment validation before code changes |
24
+ | `/evidence` | Capture quality gate proof before PR |
25
+ | `/linear-setup` | Configure Linear integration for project |
26
+ | `/anvil-sync` | Sync framework updates to project |
27
+ | `/anvil-settings` | Manage framework settings |
28
+ | `/release` | Consolidate [Unreleased] into versioned release |
29
+ | `/healthcheck` | Framework diagnostics and session health |
30
+ | `/retro` | Write retrospective to capture learnings |
31
+ | `/shard` | Break large specs into atomic pieces |
32
+ | `/decay-review` | Archive old issues and clean handoffs |
33
+ | `/weekly-review` | Weekly analytics and improvement recommendations |
34
+ | `/insights` | Synthesize patterns from retros and healthchecks |
35
+ | `/hud` | Launch multi-agent monitoring dashboard |
36
+ | `/ralph` | Ralph Wiggum autonomous execution mode (power tool) |
37
+
38
+ ---
39
+
40
+ ## Table of Contents
41
+
42
+ - [Anvil CLI](#anvil-cli)
43
+ - [Installation](#installation)
44
+ - [Usage](#usage)
45
+ - [Options](#options)
46
+ - [Hook Options Explained](#hook-options-explained)
47
+ - [Examples](#examples)
48
+ - [What Gets Created](#what-gets-created)
49
+ - [Local Issue CLI](#local-issue-cli)
50
+ - [Overview](#overview)
51
+ - [Commands](#commands)
52
+ - [Status Workflow](#status-workflow)
53
+ - [Priority Levels](#priority-levels)
54
+ - [Slash Commands Overview](#slash-commands-overview)
55
+ - [Session Commands](#session-commands)
56
+ - [/orient](#orient)
57
+ - [/ready](#ready)
58
+ - [/sprint](#sprint)
59
+ - [/handoff](#handoff)
60
+ - [Workflow Commands](#workflow-commands)
61
+ - [/explore](#explore)
62
+ - [/spec](#spec)
63
+ - [/plan](#plan)
64
+ - [/tasks](#tasks)
65
+ - [/change](#change)
66
+ - [/discover](#discover)
67
+ - [Quality Commands](#quality-commands)
68
+ - [/validate](#validate)
69
+ - [/evidence](#evidence)
70
+ - [/healthcheck](#healthcheck)
71
+ - [/retro](#retro)
72
+ - [Multi-Agent Commands](#multi-agent-commands)
73
+ - [/hud](#hud)
74
+ - [Maintenance Commands](#maintenance-commands)
75
+ - [/release](#release)
76
+ - [/shard](#shard)
77
+ - [/decay-review](#decay-review)
78
+ - [/weekly-review](#weekly-review)
79
+ - [/insights](#insights)
80
+ - [Power Mode Commands](#power-mode-commands)
81
+ - [/ralph](#ralph)
82
+ - [Setup Commands](#setup-commands)
83
+ - [/linear-setup](#linear-setup)
84
+ - [/anvil-sync](#anvil-sync)
85
+ - [/anvil-settings](#anvil-settings)
86
+ - [Command Cheat Sheet](#command-cheat-sheet)
87
+ - [Command Dependencies](#command-dependencies)
88
+
89
+ ---
90
+
91
+ ## Anvil CLI
92
+
93
+ The `anvil` command-line tool initializes new projects with the Anvil Framework.
94
+
95
+ ### Installation
96
+
97
+ **Option 1: Bun (Recommended)**
98
+ ```bash
99
+ bun install -g anvil-dev-framework
100
+ ```
101
+
102
+ **Option 2: npm**
103
+ ```bash
104
+ npm install -g anvil-dev-framework
105
+ ```
106
+
107
+ **Option 3: Homebrew (macOS)**
108
+ ```bash
109
+ brew tap alexandercahiz/anvil
110
+ brew install anvil
111
+ ```
112
+
113
+ **Option 4: From Source**
114
+ ```bash
115
+ git clone https://github.com/alexandercahiz/anvil-dev-framework.git
116
+ cd anvil-dev-framework
117
+ ./scripts/install.sh # Auto-configures PATH
118
+ ```
119
+
120
+ ### Usage
121
+
122
+ ```bash
123
+ anvil init [options]
124
+ anvil --help
125
+ anvil --version
126
+ ```
127
+
128
+ ### Options
129
+
130
+ | Option | Description |
131
+ |--------|-------------|
132
+ | `--template <type>` | Project template: `saas`, `api-python`, `generic` (default: generic) |
133
+ | `--no-tts` | Disable TTS voice announcements (keeps safety hooks) |
134
+ | `--no-memory` | Disable claude-mem context loading (keeps safety hooks) |
135
+ | `--no-hooks` | Skip ALL hooks including safety (use with caution) |
136
+ | `--with-linear` | Include Linear integration setup |
137
+ | `--force` | Overwrite existing configuration (backs up first) |
138
+ | `--dry-run` | Preview changes without modifying filesystem |
139
+
140
+ ### Hook Options Explained
141
+
142
+ By default, Anvil installs all hooks including:
143
+ - **Safety hooks**: Block dangerous `rm -rf` commands, prevent `.env` file access
144
+ - **TTS announcements**: Voice feedback for session events
145
+ - **Memory integration**: Load context from claude-mem at session start
146
+
147
+ Use `--no-tts` or `--no-memory` to disable specific features while keeping safety protections:
148
+
149
+ ```bash
150
+ # Full setup (default)
151
+ anvil init
152
+
153
+ # No voice announcements, but safety hooks active
154
+ anvil init --no-tts
155
+
156
+ # No memory loading, but safety hooks and TTS active
157
+ anvil init --no-memory
158
+
159
+ # Safety hooks only (no TTS, no memory)
160
+ anvil init --no-tts --no-memory
161
+
162
+ # Minimal setup - NO SAFETY PROTECTIONS (shows warning)
163
+ anvil init --no-hooks
164
+ ```
165
+
166
+ ### Examples
167
+
168
+ ```bash
169
+ # Initialize with all features
170
+ anvil init
171
+
172
+ # Preview what would be created
173
+ anvil init --dry-run
174
+
175
+ # SaaS project (Next.js + Supabase + Vercel) with Linear
176
+ anvil init --template saas --with-linear
177
+
178
+ # Python API project (FastAPI + PostgreSQL)
179
+ anvil init --template api-python
180
+
181
+ # Silent mode (no voice) with safety hooks
182
+ anvil init --no-tts
183
+
184
+ # Reinitialize existing project (backs up existing files)
185
+ anvil init --force
186
+ ```
187
+
188
+ ### What Gets Created
189
+
190
+ ```
191
+ .claude/
192
+ ├── CLAUDE.md # Project configuration (from template)
193
+ ├── constitution.md # Non-negotiable principles
194
+ ├── product.md # Product definition
195
+ ├── settings.local.json # Hook configurations
196
+ ├── commands/ # Symlinks to slash commands
197
+ ├── hooks/ # Symlinks to hook scripts
198
+ │ └── utils/tts/ # TTS provider scripts
199
+ ├── specs/ # Specification documents
200
+ │ ├── current/
201
+ │ └── archive/
202
+ ├── handoffs/ # Session continuity documents
203
+ ├── retros/ # Retrospective documents
204
+ ├── docs/ # Project documentation
205
+ ├── examples/ # Code convention examples
206
+ ├── agents/ # Agent configurations
207
+ └── changes/ # Change proposals
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Local Issue CLI
213
+
214
+ The `anvil-issue` command-line tool provides file-based issue tracking for projects without Linear integration. All Anvil workflow commands (`/orient`, `/ready`, `/sprint`, `/tasks`) work seamlessly with local issues.
215
+
216
+ ### Overview
217
+
218
+ **When to Use**: Projects without Linear integration, offline development, personal projects, or when you prefer local issue storage.
219
+
220
+ **Storage**: Issues are stored in `~/.anvil/issues/index.json`
221
+
222
+ **Provider Detection**: Anvil automatically uses local issues when no `.claude/linear.yaml` exists.
223
+
224
+ ### Commands
225
+
226
+ | Command | Description |
227
+ |---------|-------------|
228
+ | `list` | List issues (optionally filtered by status) |
229
+ | `create` | Create a new issue |
230
+ | `show` | Show issue details |
231
+ | `update` | Update an existing issue |
232
+ | `move` | Change issue status |
233
+ | `assign` | Assign issue to an agent |
234
+ | `stats` | Show issue statistics |
235
+ | `ready` | Show issues ready to work on |
236
+ | `delete` | Delete an issue |
237
+
238
+ #### list
239
+
240
+ List issues with optional filtering.
241
+
242
+ ```bash
243
+ anvil-issue list [OPTIONS]
244
+ ```
245
+
246
+ | Option | Description |
247
+ |--------|-------------|
248
+ | `--status`, `-s` | Filter by status (backlog, todo, in-progress, in-review, done, cancelled) |
249
+ | `--limit`, `-n` | Maximum issues to show (default: 50) |
250
+
251
+ **Examples:**
252
+ ```bash
253
+ anvil-issue list
254
+ anvil-issue list --status todo
255
+ anvil-issue list --status in-progress --limit 10
256
+ ```
257
+
258
+ #### create
259
+
260
+ Create a new issue.
261
+
262
+ ```bash
263
+ anvil-issue create --title "TITLE" [OPTIONS]
264
+ ```
265
+
266
+ | Option | Description |
267
+ |--------|-------------|
268
+ | `--title`, `-t` | Issue title (required) |
269
+ | `--description`, `-d` | Issue description |
270
+ | `--priority`, `-p` | Priority: urgent/p0, high/p1, medium/p2, low/p3, none/p4 |
271
+ | `--labels`, `-l` | Comma-separated labels |
272
+ | `--parent` | Parent issue identifier (creates sub-issue) |
273
+
274
+ **Examples:**
275
+ ```bash
276
+ anvil-issue create --title "Add dark mode"
277
+ anvil-issue create --title "Critical bug" --priority urgent --labels "bug,critical"
278
+ anvil-issue create --title "Phase 1: Setup" --parent LOCAL-001
279
+ ```
280
+
281
+ #### show
282
+
283
+ Show detailed issue information.
284
+
285
+ ```bash
286
+ anvil-issue show IDENTIFIER
287
+ ```
288
+
289
+ **Example:**
290
+ ```bash
291
+ anvil-issue show LOCAL-001
292
+ ```
293
+
294
+ #### update
295
+
296
+ Update an existing issue.
297
+
298
+ ```bash
299
+ anvil-issue update IDENTIFIER [OPTIONS]
300
+ ```
301
+
302
+ | Option | Description |
303
+ |--------|-------------|
304
+ | `--title`, `-t` | New title |
305
+ | `--description`, `-d` | New description |
306
+ | `--priority`, `-p` | New priority |
307
+ | `--labels`, `-l` | New labels (comma-separated) |
308
+
309
+ **Example:**
310
+ ```bash
311
+ anvil-issue update LOCAL-001 --title "Updated title" --priority high
312
+ ```
313
+
314
+ #### move
315
+
316
+ Change issue status.
317
+
318
+ ```bash
319
+ anvil-issue move IDENTIFIER --to STATUS
320
+ ```
321
+
322
+ **Examples:**
323
+ ```bash
324
+ anvil-issue move LOCAL-001 --to in-progress
325
+ anvil-issue move LOCAL-001 --to done
326
+ ```
327
+
328
+ #### assign
329
+
330
+ Assign or unassign an agent.
331
+
332
+ ```bash
333
+ anvil-issue assign IDENTIFIER [OPTIONS]
334
+ ```
335
+
336
+ | Option | Description |
337
+ |--------|-------------|
338
+ | `--agent`, `-a` | Agent ID to assign |
339
+ | `--unassign`, `-u` | Remove assignment |
340
+
341
+ **Examples:**
342
+ ```bash
343
+ anvil-issue assign LOCAL-001 --agent swift-falcon-a3f2
344
+ anvil-issue assign LOCAL-001 --unassign
345
+ ```
346
+
347
+ #### stats
348
+
349
+ Show issue statistics.
350
+
351
+ ```bash
352
+ anvil-issue stats
353
+ ```
354
+
355
+ **Output:**
356
+ ```
357
+ === Issue Statistics ===
358
+
359
+ Total Issues: 15
360
+ Assigned: 3
361
+ Unassigned: 12
362
+
363
+ --- By Status ---
364
+ Backlog 5
365
+ Todo 4
366
+ In Progress 2
367
+ In Review 1
368
+ Done 3
369
+
370
+ --- By Priority ---
371
+ P0 1
372
+ P1 3
373
+ P2 8
374
+ P3 3
375
+ ```
376
+
377
+ #### ready
378
+
379
+ Show issues ready to work on, sorted by priority.
380
+
381
+ ```bash
382
+ anvil-issue ready [OPTIONS]
383
+ ```
384
+
385
+ | Option | Description |
386
+ |--------|-------------|
387
+ | `--limit`, `-n` | Maximum issues (default: 10) |
388
+
389
+ #### delete
390
+
391
+ Delete an issue.
392
+
393
+ ```bash
394
+ anvil-issue delete IDENTIFIER [OPTIONS]
395
+ ```
396
+
397
+ | Option | Description |
398
+ |--------|-------------|
399
+ | `--hard` | Permanently delete (default: soft delete/cancel) |
400
+
401
+ **Examples:**
402
+ ```bash
403
+ anvil-issue delete LOCAL-001 # Marks as cancelled
404
+ anvil-issue delete LOCAL-001 --hard # Permanently removes
405
+ ```
406
+
407
+ ### Status Workflow
408
+
409
+ ```
410
+ ┌─────────┐
411
+ │ Backlog │ Not yet prioritized
412
+ └────┬────┘
413
+
414
+ ┌────▼────┐
415
+ │ Todo │ Ready to start
416
+ └────┬────┘
417
+
418
+ ┌────▼─────────┐
419
+ │ In Progress │ Being worked on
420
+ └────┬─────────┘
421
+
422
+ ┌────▼────────┐
423
+ │ In Review │ PR awaiting review
424
+ └────┬────────┘
425
+
426
+ ┌────▼────┐
427
+ │ Done │ Completed
428
+ └─────────┘
429
+ ```
430
+
431
+ ### Priority Levels
432
+
433
+ | Priority | Code | Description |
434
+ |----------|------|-------------|
435
+ | Urgent | P0 | Drop everything, fix now |
436
+ | High | P1 | Next up after current task |
437
+ | Medium | P2 | This sprint (default) |
438
+ | Low | P3 | Backlog |
439
+ | None | P4 | No priority set |
440
+
441
+ The `ready` command sorts by priority (P0 first) then by age (oldest first).
442
+
443
+ **See Also**: [Local Issue Tracking Guide](local-issues.md) for comprehensive documentation including Python API and migration guides.
444
+
445
+ ---
446
+
447
+ ## Slash Commands Overview
448
+
449
+ Anvil provides 23 slash commands organized into six categories:
450
+
451
+ | Category | Commands | Purpose |
452
+ |----------|----------|---------|
453
+ | **Session** | `/orient`, `/ready`, `/sprint`, `/handoff` | Session lifecycle management |
454
+ | **Workflow** | `/explore`, `/spec`, `/plan`, `/tasks`, `/change`, `/discover` | Phase-gated development |
455
+ | **Quality** | `/validate`, `/evidence`, `/healthcheck`, `/retro` | Quality assurance |
456
+ | **Multi-Agent** | `/hud` | Multi-agent coordination |
457
+ | **Maintenance** | `/release`, `/shard`, `/decay-review`, `/weekly-review`, `/insights` | System maintenance |
458
+ | **Setup** | `/linear-setup`, `/anvil-sync`, `/anvil-settings` | Project configuration |
459
+
460
+ ---
461
+
462
+ ## Session Commands
463
+
464
+ ### /orient
465
+
466
+ **Purpose**: Session startup orientation and context recovery.
467
+
468
+ **When to Use**: Start of every session.
469
+
470
+ **Fast-Path Execution** (Recommended):
471
+ ```bash
472
+ python3 global/lib/orient_fast.py # Full (~700ms)
473
+ python3 global/lib/orient_fast.py --fast # Skip Linear (~200ms)
474
+ python3 global/lib/orient_fast.py --json # JSON output
475
+ ```
476
+
477
+ The fast-path script runs all checks in parallel (10-20x faster than manual steps).
478
+
479
+ **What It Does**:
480
+ 1. Checks for recent handoff document (< 48 hours)
481
+ 2. Reads git state (branch, uncommitted changes, recent commits)
482
+ 3. Queries Linear for in-progress issues (cached for 60s)
483
+ 4. Calculates ready work (no blockers)
484
+ 5. Presents options and waits for direction
485
+
486
+ **Output Format**:
487
+
488
+ ```markdown
489
+ ## Session Orientation
490
+
491
+ ### Resuming From
492
+ [Last handoff: 2025-12-16 or Fresh start]
493
+
494
+ ### Current Branch
495
+ `feature/xyz` — 3 commits ahead of main
496
+
497
+ ### In-Progress Work
498
+ | Issue | Title | Progress |
499
+ |-------|-------|----------|
500
+ | ENG-42 | Fix auth flow | 60% complete |
501
+
502
+ ### Ready Work Available
503
+ | Priority | Issue | Title | Age |
504
+ |----------|-------|-------|-----|
505
+ | P0 | ENG-38 | Critical bug | 3 days |
506
+ | P1 | ENG-45 | New feature | 5 days |
507
+
508
+ ### Recommended Action
509
+ Continue ENG-42 (in progress) or switch to ENG-38 (higher priority)?
510
+
511
+ Awaiting direction.
512
+ ```
513
+
514
+ **Success Criteria**: Agent understands current state and awaits human direction before proceeding.
515
+
516
+ ---
517
+
518
+ ### /ready
519
+
520
+ **Purpose**: Calculate ready (unblocked) work from Linear.
521
+
522
+ **When to Use**: Before selecting a task, when unsure what to work on.
523
+
524
+ **Relationship to /sprint**: `/ready` is the **foundation** — a pure data query for unblocked work. `/sprint` **builds on** `/ready` by adding broader context (In Progress, In Review, Blocked items) and Top 3 recommendations. Use `/ready` when you just want to see what's available; use `/sprint` when you need help prioritizing.
525
+
526
+ **What It Does**:
527
+ 1. Fetches issues from Linear (filtered by team from `linear.yaml`)
528
+ 2. Filters issues where ALL blockers are Done (or no blockers)
529
+ 3. Checks for agent conflicts via `.claude/coordination.md`
530
+ 4. Sorts by priority (P0 first), then age (oldest first)
531
+ 5. Presents ready work list with conflict warnings
532
+
533
+ **Algorithm**:
534
+
535
+ ```
536
+ For each issue in (Todo, Backlog):
537
+ If issue has no "blocked by" relationships:
538
+ Add to ready set
539
+ Else:
540
+ For each blocker:
541
+ If blocker.status != Done:
542
+ Mark issue as blocked
543
+ Break
544
+ If not blocked:
545
+ Add to ready set
546
+
547
+ Check coordination.md for active agents:
548
+ For each ready issue:
549
+ If issue key matches active agent work:
550
+ Mark with conflict warning
551
+
552
+ Sort ready set by:
553
+ 1. Priority (P0 > P1 > P2 > P3 > None)
554
+ 2. Created date (oldest first)
555
+
556
+ Return ready items with status
557
+ ```
558
+
559
+ **Output Format**:
560
+
561
+ ```markdown
562
+ ## Ready Work — [team_key]
563
+
564
+ | Priority | Issue | Title | Age | Status |
565
+ |----------|-------|-------|-----|--------|
566
+ | P0 | ENG-38 | Critical auth bug | 3d | Available |
567
+ | P1 | ENG-42 | Password reset | 5d | ⚠️ swift-falcon-a3f2 active |
568
+ | P2 | ENG-51 | Profile page | 2d | Available |
569
+
570
+ **Total ready**: 3 issues
571
+ **Blocked**: 2 issues waiting on dependencies
572
+ **Conflicts**: 1 issue has active agent
573
+
574
+ Recommend starting with: ENG-38 (Critical auth bug)
575
+ ```
576
+
577
+ ---
578
+
579
+ ### /sprint
580
+
581
+ **Purpose**: Quick session planning and prioritization.
582
+
583
+ **When to Use**: After `/orient` when multiple work options exist.
584
+
585
+ **Relationship to /ready**: `/sprint` internally uses `/ready`'s unblocked work logic, then adds broader context by also querying In Progress, In Review, and Blocked items. It provides Top 3 recommendations with reasoning.
586
+
587
+ **What It Does**:
588
+ 1. Applies `/ready`'s logic to get unblocked Todo/Backlog items with agent conflicts
589
+ 2. Also queries In Progress, In Review, and Blocked issues
590
+ 3. Builds state summary table
591
+ 4. Identifies priorities using heuristics
592
+ 5. Suggests top 3 focus items (preferring available over conflicting)
593
+ 6. Highlights blockers needing human action
594
+
595
+ **Priority Heuristics** (in order):
596
+ 1. Blocked items you can unblock (high value)
597
+ 2. In-review items with feedback (quick wins)
598
+ 3. In-progress items (momentum)
599
+ 4. High priority ready items (P0/P1) — **available** over conflicting
600
+
601
+ **Output Format**:
602
+
603
+ ```markdown
604
+ ## Sprint State — [team_key]
605
+
606
+ | Status | Count | Attention Needed |
607
+ |--------|-------|------------------|
608
+ | Blocked | 2 | Waiting on external API decision |
609
+ | In Progress | 1 | ENG-42 (60% complete) |
610
+ | In Review | 1 | ENG-38 has feedback |
611
+ | Ready | 5 | 2 P1, 3 P2 items (1 has active agent) |
612
+
613
+ ## Suggested Focus
614
+
615
+ 1. **ENG-38**: Address review feedback
616
+ - Why: Quick to complete, unblocks merge
617
+ - Effort: ~30 min
618
+
619
+ 2. **ENG-42**: Continue password reset
620
+ - Why: Already in progress, has momentum
621
+ - Effort: ~2 hours remaining
622
+
623
+ 3. **ENG-51**: Start profile page
624
+ - Why: P2, available (no agent conflicts)
625
+ - Effort: ~3 hours
626
+
627
+ ## Agent Conflicts
628
+ ⚠️ ENG-45 has swift-falcon-a3f2 active — skipped in recommendations
629
+
630
+ ## Blockers Requiring Attention
631
+ - ENG-50 blocked by external API team decision
632
+
633
+ Which would you like to work on?
634
+ ```
635
+
636
+ ---
637
+
638
+ ### /handoff
639
+
640
+ **Purpose**: Generate session continuity document for next session.
641
+
642
+ **When to Use**: End of every session, before context compaction, when switching tasks.
643
+
644
+ **What It Does**:
645
+ 1. Summarizes work completed this session
646
+ 2. Documents in-progress state
647
+ 3. Lists discovered work filed
648
+ 4. Records critical context
649
+ 5. Captures environment state
650
+ 6. Recommends next task
651
+
652
+ **Output Location**: `.claude/handoffs/[YYYY-MM-DD]-[topic].md`
653
+
654
+ **Output Format**:
655
+
656
+ ```markdown
657
+ ---
658
+ session_date: 2025-12-17
659
+ session_time: 09:00 - 12:30
660
+ branch: feature/password-reset
661
+ ---
662
+
663
+ # Session Handoff: December 17, 2025
664
+
665
+ ## Session Summary
666
+ Implemented password reset email flow and discovered rate limiting gap.
667
+
668
+ ## Completed This Session
669
+ | Issue | Title | Outcome |
670
+ |-------|-------|---------|
671
+ | ENG-42 | Email templates | Merged PR #123 |
672
+
673
+ ## In Progress
674
+ | Issue | Title | Current State | Next Step |
675
+ |-------|-------|---------------|-----------|
676
+ | ENG-38 | Reset flow | 60% - Email done | Implement reset endpoint |
677
+
678
+ ## Discovered Work Filed
679
+ | Issue | Title | Discovered From | Priority |
680
+ |-------|-------|-----------------|----------|
681
+ | ENG-52 | Rate limiting | ENG-38 | P1 |
682
+
683
+ ## Recommended Next Task
684
+ **ENG-38** — Continue password reset (momentum, 60% complete)
685
+
686
+ ## Critical Context for Next Session
687
+ - Password reset uses new email service (`src/services/email.ts`)
688
+ - Rate limiting discovery (ENG-52) should be addressed before launch
689
+ - Test user: `reset-test@example.com` in staging
690
+
691
+ ## Environment State
692
+ - Branch: `feature/password-reset`
693
+ - PR: #125 (draft)
694
+ - Tests: 14/16 passing (2 skipped pending mock)
695
+
696
+ ## Files Modified This Session
697
+ - src/services/email.ts (new)
698
+ - src/components/ResetForm.tsx (modified)
699
+ - src/app/api/auth/reset/route.ts (new)
700
+ ```
701
+
702
+ ---
703
+
704
+ ## Workflow Commands
705
+
706
+ ### /explore
707
+
708
+ **Purpose**: Discovery phase before any new feature work.
709
+
710
+ **When to Use**: Before starting any new feature or significant change.
711
+
712
+ **What It Does**:
713
+ 1. Clarifies the request with the user
714
+ 2. Searches for existing related code
715
+ 3. Reads related files, noting patterns
716
+ 4. Checks existing specs for overlap
717
+ 5. Reviews architecture constraints
718
+ 6. Generates exploration report
719
+
720
+ **Gate**: Wait for user confirmation before proceeding to /spec
721
+
722
+ **Output Format**:
723
+
724
+ ```markdown
725
+ ## Exploration Report: [Feature Name]
726
+
727
+ ### Understanding
728
+ [1-2 sentences summarizing the request]
729
+
730
+ ### Existing Related Code
731
+ | File | Relevance | Notes |
732
+ |------|-----------|-------|
733
+ | src/auth/login.ts | High | Similar auth pattern |
734
+ | src/services/user.ts | Medium | User data access |
735
+
736
+ ### Observed Patterns
737
+ - Authentication: JWT with refresh tokens
738
+ - API routes: Next.js App Router style
739
+ - Error handling: Custom AppError class
740
+
741
+ ### Existing Specs
742
+ - None overlapping (or list overlaps)
743
+
744
+ ### Architecture Constraints
745
+ - Must use existing Supabase client
746
+ - Should follow existing error patterns
747
+
748
+ ### Questions Before Proceeding
749
+ 1. [Any clarifying questions]
750
+
751
+ ### Recommendation
752
+ [Proceed to spec / Need more info / Blocked by X]
753
+
754
+ Awaiting approval to proceed with /spec.
755
+ ```
756
+
757
+ ---
758
+
759
+ ### /spec
760
+
761
+ **Purpose**: Generate formal feature specification.
762
+
763
+ **When to Use**: After exploration phase is approved.
764
+
765
+ **What It Does**:
766
+ 1. Creates structured specification document
767
+ 2. Defines functional and non-functional requirements
768
+ 3. Writes Gherkin-style acceptance scenarios
769
+ 4. Documents technical considerations
770
+ 5. Explicitly lists out-of-scope items
771
+ 6. Captures open questions
772
+
773
+ **Output Location**: `.claude/specs/current/SPEC-[YYYYMMDD]-[XXX]-[slug].md`
774
+
775
+ **Gate**: All open questions must be answered, status must be 'approved' before /plan
776
+
777
+ **Output Format**:
778
+
779
+ ```markdown
780
+ ---
781
+ spec_id: SPEC-20251217-001
782
+ title: Password Reset Flow
783
+ status: draft
784
+ created: 2025-12-17
785
+ author: Claude
786
+ ---
787
+
788
+ # Password Reset Flow
789
+
790
+ ## Overview
791
+ Allow users to reset their password via email verification.
792
+
793
+ ## Requirements
794
+
795
+ ### Functional Requirements
796
+ 1. **FR-1**: User can request password reset by email
797
+ 2. **FR-2**: System sends reset link valid for 1 hour
798
+ 3. **FR-3**: User can set new password via reset link
799
+ 4. **FR-4**: System invalidates all existing sessions on reset
800
+
801
+ ### Non-Functional Requirements
802
+ 1. **NFR-1**: Reset link must be cryptographically secure
803
+ 2. **NFR-2**: Rate limit: max 3 requests per email per hour
804
+ 3. **NFR-3**: Email delivery within 30 seconds
805
+
806
+ ## User Scenarios
807
+
808
+ ### Scenario: Successful password reset
809
+
810
+ **Context**:
811
+ - **GIVEN** a registered user with email "user@example.com"
812
+ - **AND** the user has forgotten their password
813
+
814
+ **Action**:
815
+ - **WHEN** the user requests a password reset
816
+ - **AND** clicks the link in the email
817
+ - **AND** enters a new valid password
818
+
819
+ **Outcome**:
820
+ - **THEN** the password is updated
821
+ - **AND** all existing sessions are invalidated
822
+ - **AND** user is redirected to login
823
+
824
+ ### Scenario: Expired reset link
825
+
826
+ **Context**:
827
+ - **GIVEN** a reset link older than 1 hour
828
+
829
+ **Action**:
830
+ - **WHEN** the user clicks the expired link
831
+
832
+ **Outcome**:
833
+ - **THEN** the system shows "Link expired" message
834
+ - **AND** offers to request a new reset link
835
+
836
+ ## Technical Considerations
837
+ - Use existing Supabase auth for token generation
838
+ - Store reset tokens in `password_reset_requests` table
839
+ - Use existing email service for delivery
840
+
841
+ ## Out of Scope
842
+ - Password strength requirements (existing)
843
+ - Two-factor authentication (separate feature)
844
+ - Account lockout (separate feature)
845
+
846
+ ## Open Questions
847
+ 1. ~~What is the reset link expiry time?~~ → 1 hour (decided)
848
+ 2. Should we notify on successful reset? → **NEEDS ANSWER**
849
+
850
+ ## Dependencies
851
+ - Email service must be operational
852
+ - Supabase connection required
853
+ ```
854
+
855
+ ---
856
+
857
+ ### /plan
858
+
859
+ **Purpose**: Create implementation plan from approved specification.
860
+
861
+ **When to Use**: After spec is approved (status = approved, no open questions).
862
+
863
+ **Prerequisites**:
864
+ - **Exploration completed** (`/explore`) — soft gate warns if skipped
865
+ - Specification approved (`/spec`)
866
+ - No blocking open questions
867
+
868
+ **Explore Gate**:
869
+
870
+ Before creating a plan, `/plan` checks for evidence of exploration:
871
+
872
+ ```
873
+ ⚠️ **Exploration Check**
874
+
875
+ No recent `/explore` found for this feature.
876
+
877
+ Before planning, run `/explore [feature name]` to:
878
+ - Search for existing code that might solve this
879
+ - Find patterns to follow
880
+ - Discover infrastructure to reuse
881
+
882
+ **Why this matters**: In 5/7 recent retros, we found existing infrastructure
883
+ that would have saved implementation time.
884
+
885
+ Continue anyway? Or run `/explore` first?
886
+ ```
887
+
888
+ **What It Does**:
889
+ 1. Verifies exploration was done (soft gate)
890
+ 2. Breaks spec into implementation phases
891
+ 3. Lists specific file changes per phase
892
+ 4. Defines testing strategy
893
+ 5. Identifies risks and mitigations
894
+ 6. Documents rollback plan
895
+
896
+ **Output Location**: `.claude/specs/current/PLAN-[YYYYMMDD]-[XXX]-[slug].md`
897
+
898
+ **Gate**: Plan must be approved before /tasks
899
+
900
+ **Output Format**:
901
+
902
+ ```markdown
903
+ ---
904
+ plan_id: PLAN-20251217-001
905
+ spec_id: SPEC-20251217-001
906
+ title: Password Reset Implementation
907
+ estimated_hours: 6
908
+ ---
909
+
910
+ # Implementation Plan: Password Reset
911
+
912
+ ## Approach
913
+ Implement as vertical slice: database → API → UI in single branch.
914
+
915
+ ## Phase 1: Database Setup (1h)
916
+ ### Files to Create
917
+ - `supabase/migrations/[timestamp]_password_reset.sql`
918
+
919
+ ### Changes
920
+ - Create `password_reset_requests` table
921
+ - Add RLS policies for reset tokens
922
+ - Create cleanup function for expired tokens
923
+
924
+ ### Verification
925
+ - Migration applies cleanly
926
+ - RLS policies tested
927
+
928
+ ## Phase 2: API Endpoints (2h)
929
+ ### Files to Create
930
+ - `src/app/api/auth/reset/request/route.ts`
931
+ - `src/app/api/auth/reset/confirm/route.ts`
932
+
933
+ ### Files to Modify
934
+ - `src/services/authService.ts` (add reset methods)
935
+
936
+ ### Verification
937
+ - Unit tests for service methods
938
+ - API route tests with mocks
939
+
940
+ ## Phase 3: UI Components (2h)
941
+ ### Files to Create
942
+ - `src/components/auth/ResetRequestForm.tsx`
943
+ - `src/components/auth/ResetConfirmForm.tsx`
944
+ - `src/app/reset-password/page.tsx`
945
+
946
+ ### Verification
947
+ - Component renders correctly
948
+ - Form validation works
949
+ - Error states display
950
+
951
+ ## Phase 4: Integration & Polish (1h)
952
+ ### Tasks
953
+ - Email template styling
954
+ - Error message refinement
955
+ - E2E test for full flow
956
+
957
+ ### Verification
958
+ - Full flow works in staging
959
+ - E2E test passes
960
+
961
+ ## Testing Strategy
962
+ | Type | Coverage | Files |
963
+ |------|----------|-------|
964
+ | Unit | Service methods | authService.test.ts |
965
+ | Integration | API routes | reset.test.ts |
966
+ | E2E | Full flow | reset.e2e.ts |
967
+
968
+ ## Risks and Mitigations
969
+ | Risk | Likelihood | Mitigation |
970
+ |------|------------|------------|
971
+ | Email delivery delay | Medium | Retry logic, user feedback |
972
+ | Token collision | Low | Use UUID v4 |
973
+
974
+ ## Rollback Plan
975
+ 1. Revert migration: `supabase migration repair --status reverted [timestamp]`
976
+ 2. Remove API routes
977
+ 3. Remove UI components
978
+ 4. Remove service methods
979
+ ```
980
+
981
+ ---
982
+
983
+ ### /tasks
984
+
985
+ **Purpose**: Create Linear sub-issues from approved implementation plan, nested under parent feature issue.
986
+
987
+ **When to Use**: After plan is approved.
988
+
989
+ **What It Does**:
990
+ 1. Identifies parent issue from spec's `linear_issue:` field
991
+ 2. Creates sub-issues for each implementation phase using `--parent` flag
992
+ 3. Sets dependencies (blocked by relationships)
993
+ 4. Adds acceptance criteria from spec
994
+ 5. Assigns estimates
995
+ 6. Adds appropriate labels
996
+
997
+ **Rules**:
998
+ - **Always create as sub-issues** under the parent feature issue
999
+ - Each task completable in 1-4 hours
1000
+ - Each task has clear acceptance criteria
1001
+ - Each task independently verifiable
1002
+ - Dependencies explicitly set
1003
+ - Title convention: `[PARENT-ID] Phase N: [Description]`
1004
+
1005
+ **CLI Reference**:
1006
+
1007
+ | Command | Option | Description |
1008
+ |---------|--------|-------------|
1009
+ | `create-issue` | `--team` | Team UUID (required) |
1010
+ | | `--title` | Issue title (required) |
1011
+ | | `--description` | Description text |
1012
+ | | `--parent` | Parent UUID (for sub-issues) |
1013
+ | `update-issue` | `--id` | Issue ID e.g. "ANV-12" |
1014
+ | | `--state` | State UUID (not name!) |
1015
+ | | `--parent` | Parent UUID |
1016
+ | `list-issues` | `--team` | Team UUID (required) |
1017
+ | | `--status` | Filter by state name e.g. "In Progress" |
1018
+ | | `--state` | Filter by state UUID |
1019
+ | | `--full` | Include full details (labels, comments) |
1020
+
1021
+ > **Common Mistakes**:
1022
+ > - Use `list-issues` NOT `list_issues` (hyphens, not underscores)
1023
+ > - Use `--team` NOT `--team-id`
1024
+ > - Use `--status` to filter by state name, `--state` for state UUID
1025
+
1026
+ **CLI Examples**:
1027
+ ```bash
1028
+ # Create new sub-issue
1029
+ python3 scripts/linear.py create-issue \
1030
+ --team "TEAM_UUID" \
1031
+ --title "[ANV-5] Phase 1: Core Implementation" \
1032
+ --parent "parent-issue-uuid"
1033
+
1034
+ # Convert existing issue to sub-issue
1035
+ python3 scripts/linear.py update-issue \
1036
+ --id "ANV-12" \
1037
+ --parent "parent-issue-uuid"
1038
+
1039
+ # List issues for a team (filter by status name)
1040
+ python3 scripts/linear.py list-issues --team "TEAM_UUID" --status "In Progress"
1041
+ ```
1042
+
1043
+ **Output**: Linear sub-issues created with links provided, nested under parent
1044
+
1045
+ ---
1046
+
1047
+ ### /change
1048
+
1049
+ **Purpose**: Create brownfield change proposal for modifying existing features.
1050
+
1051
+ **When to Use**: When modifying existing functionality that has a spec.
1052
+
1053
+ **What It Does**:
1054
+ 1. Identifies affected existing specs
1055
+ 2. Documents proposed changes with delta markers
1056
+ 3. Assesses impact on existing functionality
1057
+ 4. Creates migration plan if needed
1058
+
1059
+ **Output Location**: `.claude/changes/CHANGE-[YYYYMMDD]-[XXX]/`
1060
+
1061
+ **Output Format**:
1062
+
1063
+ ```markdown
1064
+ ---
1065
+ change_id: CHANGE-20251217-001
1066
+ affects_specs: [SPEC-20251201-001]
1067
+ title: Add 2FA to Login
1068
+ ---
1069
+
1070
+ # Change Proposal: Add 2FA to Login
1071
+
1072
+ ## Summary
1073
+ Add optional two-factor authentication to existing login flow.
1074
+
1075
+ ## Motivation
1076
+ Security requirement for enterprise users.
1077
+
1078
+ ## Proposed Changes
1079
+
1080
+ ### MODIFIED: Login Flow (SPEC-20251201-001)
1081
+ **Previously**: Single-factor password authentication
1082
+ **Now**: Password + optional TOTP verification
1083
+
1084
+ ### ADDED: 2FA Setup
1085
+ New requirement for users to enable/disable 2FA.
1086
+
1087
+ ### ADDED: Backup Codes
1088
+ Allow recovery if user loses 2FA device.
1089
+
1090
+ ## Impact Analysis
1091
+ - Existing users: No change unless they enable 2FA
1092
+ - Login API: Backward compatible (2FA optional)
1093
+ - Database: New table for TOTP secrets
1094
+
1095
+ ## Migration Required
1096
+ - [ ] Add `user_2fa_settings` table
1097
+ - [ ] Backfill existing users with 2FA disabled
1098
+
1099
+ ## Rollback Plan
1100
+ Feature flag allows disabling 2FA without code changes.
1101
+ ```
1102
+
1103
+ ---
1104
+
1105
+ ### /discover
1106
+
1107
+ **Purpose**: File discovered work during implementation.
1108
+
1109
+ **When to Use**: When you find bugs, missing features, or technical debt while working on something else.
1110
+
1111
+ **What It Does**:
1112
+ 1. Creates Linear issue immediately
1113
+ 2. Links to parent issue (discovered-from)
1114
+ 3. Adds discovery context
1115
+ 4. Sets appropriate priority
1116
+ 5. Adds `discovered` label
1117
+
1118
+ **Usage**: `/discover [title]`
1119
+
1120
+ **Output**: Linear issue created with link
1121
+
1122
+ ---
1123
+
1124
+ ## Quality Commands
1125
+
1126
+ ### /validate
1127
+
1128
+ **Purpose**: Environment validation checkpoint before any code changes.
1129
+
1130
+ **When to Use**: Before making any changes to the codebase.
1131
+
1132
+ **What It Does**:
1133
+ 1. Checks git status (must be clean)
1134
+ 2. Checks branch (must not be main)
1135
+ 3. Runs `npm ci` (dependencies)
1136
+ 4. Runs `npm test` (baseline)
1137
+ 5. Runs `npm run typecheck` (types)
1138
+
1139
+ **Critical Behavior**: If ANY step fails → STOP and report. Do NOT proceed.
1140
+
1141
+ **Output Format**:
1142
+
1143
+ ```markdown
1144
+ ## Environment Validation
1145
+
1146
+ | Check | Status | Details |
1147
+ |-------|--------|---------|
1148
+ | Git Status | ✅ PASS | Working tree clean |
1149
+ | Branch | ✅ PASS | On `feature/reset` (not main) |
1150
+ | Dependencies | ✅ PASS | npm ci completed |
1151
+ | Tests | ✅ PASS | 142/142 passing |
1152
+ | Types | ✅ PASS | No errors |
1153
+
1154
+ **Result**: Environment validated. Safe to proceed with changes.
1155
+ ```
1156
+
1157
+ Or if failed:
1158
+
1159
+ ```markdown
1160
+ ## Environment Validation
1161
+
1162
+ | Check | Status | Details |
1163
+ |-------|--------|---------|
1164
+ | Git Status | ❌ FAIL | 3 uncommitted files |
1165
+ | Branch | — | Skipped |
1166
+ | Dependencies | — | Skipped |
1167
+ | Tests | — | Skipped |
1168
+ | Types | — | Skipped |
1169
+
1170
+ **Result**: BLOCKED. Cannot proceed until git status is clean.
1171
+
1172
+ **Action Required**: Commit or stash uncommitted changes.
1173
+ ```
1174
+
1175
+ ---
1176
+
1177
+ ### /evidence
1178
+
1179
+ **Purpose**: Capture quality gate proof before creating PR.
1180
+
1181
+ **When to Use**: After implementation complete, before creating or updating PR.
1182
+
1183
+ **What It Does**:
1184
+ 1. Runs lint, captures full output
1185
+ 2. Runs typecheck, captures full output
1186
+ 3. Runs tests, captures full output
1187
+ 4. Runs git status, lists changed files
1188
+ 5. Checks documentation status (soft prompt)
1189
+ 6. Checks changelog entry (soft prompt)
1190
+ 7. Runs code review if configured (optional)
1191
+ 8. Formats evidence block for PR
1192
+
1193
+ **Quality Gate Types**:
1194
+
1195
+ | Gate | Type | Description |
1196
+ |------|------|-------------|
1197
+ | Lint | ✅ Required | Must pass with 0 errors |
1198
+ | TypeScript | ✅ Required | Must pass with 0 errors |
1199
+ | Tests | ✅ Required | All tests must pass |
1200
+ | Git Status | ✅ Required | Only expected files changed |
1201
+ | Documentation | ⚪ Soft | Prompts if docs may need updating |
1202
+ | Changelog | ⚪ Soft | Warns if no [Unreleased] entry |
1203
+ | Code Review | ⚪ Optional | Runs if enabled in config |
1204
+
1205
+ **Configuration** (`.claude/anvil.config.json`):
1206
+
1207
+ ```json
1208
+ {
1209
+ "codeReview": {
1210
+ "enabled": true,
1211
+ "tool": "coderabbit",
1212
+ "command": "coderabbit --prompt-only",
1213
+ "enforcement": "soft"
1214
+ }
1215
+ }
1216
+ ```
1217
+
1218
+ Code review enforcement levels:
1219
+ - **hard**: Run automatically, block PR if critical issues
1220
+ - **soft**: Prompt "Run code review? (recommended)"
1221
+ - **manual**: Skip automatic prompt, user triggers when wanted
1222
+
1223
+ **Output Format**:
1224
+
1225
+ ```markdown
1226
+ ## Quality Gate Evidence
1227
+
1228
+ ### Lint Check
1229
+ ```
1230
+ $ npm run lint
1231
+ ✔ No problems found
1232
+ ```
1233
+
1234
+ ### Type Check
1235
+ ```
1236
+ $ npm run typecheck
1237
+ ✔ No errors
1238
+ ```
1239
+
1240
+ ### Test Results
1241
+ ```
1242
+ $ npm test
1243
+ Test Suites: 3 passed, 3 total
1244
+ Tests: 12 passed, 12 total
1245
+ ```
1246
+
1247
+ ### Changed Files
1248
+ ```
1249
+ $ git status
1250
+ Changes to be committed:
1251
+ new file: src/services/email.ts
1252
+ modified: src/services/authService.ts
1253
+ ```
1254
+
1255
+ ### Documentation Status
1256
+ - [x] Docs updated: docs/api-reference.md
1257
+ - [ ] No docs needed
1258
+ - [ ] Docs TODO
1259
+
1260
+ ### Changelog Status
1261
+ ✅ Entry added to [Unreleased] section
1262
+
1263
+ ### Code Review
1264
+ **Tool**: CodeRabbit
1265
+ **Status**: ✅ No critical issues
1266
+
1267
+ **Result**: All gates passed. Ready for PR.
1268
+ ```
1269
+
1270
+ ---
1271
+
1272
+ ### /healthcheck
1273
+
1274
+ **Purpose**: Framework diagnostics and session health analysis.
1275
+
1276
+ **When to Use**: After sessions with issues, periodically for maintenance, debugging framework problems.
1277
+
1278
+ **What It Does**:
1279
+ 1. Reads current session logs (`logs/*.json`)
1280
+ 2. Analyzes session transcript for patterns
1281
+ 3. Identifies blocked commands, tool errors, hook failures
1282
+ 4. Calculates metrics (success rate, tool invocations)
1283
+ 5. Generates actionable recommendations
1284
+ 6. Saves report to `.claude/healthchecks/YYYY-MM/`
1285
+
1286
+ **Metrics Tracked**:
1287
+ | Metric | Description |
1288
+ |--------|-------------|
1289
+ | Tool Invocations | Total tool calls in session |
1290
+ | Success Rate | Percentage of successful tool calls |
1291
+ | Blocked Commands | Commands blocked by safety hooks |
1292
+ | Tool Errors | Tools that returned errors |
1293
+ | Hook Failures | Hooks that failed to execute |
1294
+
1295
+ **Status Thresholds**:
1296
+ | Status | Criteria |
1297
+ |--------|----------|
1298
+ | ✅ Healthy | Success rate > 95% |
1299
+ | ⚠️ Warning | Success rate 80-95% |
1300
+ | ❌ Problem | Success rate < 80% |
1301
+
1302
+ **Output Format**:
1303
+
1304
+ ```markdown
1305
+ # Healthcheck: 2025-12-26 14:46
1306
+
1307
+ **Session ID**: abc123...
1308
+ **Duration**: ~1 hour
1309
+ **Status**: ✅ Healthy
1310
+
1311
+ ## Metrics
1312
+ | Metric | Value | Status |
1313
+ |--------|-------|--------|
1314
+ | Tool Invocations | 17 | — |
1315
+ | Success Rate | 100% | ✅ |
1316
+ | Blocked Commands | 0 | ✅ |
1317
+
1318
+ ## Recommendations
1319
+ Framework operating normally. No action required.
1320
+ ```
1321
+
1322
+ **Integration**: Use `/discover` to file any issues found during healthcheck.
1323
+
1324
+ ---
1325
+
1326
+ ### /retro
1327
+
1328
+ **Purpose**: Write a retrospective to capture learnings.
1329
+
1330
+ **When to Use**: After completing significant work, after debugging >1 hour, after unexpected complexity.
1331
+
1332
+ **What It Does**:
1333
+ 1. Identifies topic (usually issue key + title)
1334
+ 2. Assesses outcome (success/partial/failed)
1335
+ 3. Writes narrative of what happened
1336
+ 4. Extracts one key learning
1337
+ 5. Defines one "next time" action
1338
+ 6. Saves to `.claude/retros/YYYY-MM/[slug].md`
1339
+
1340
+ **Output Format**:
1341
+
1342
+ ```markdown
1343
+ # ENG-42: Password Reset Token Generation
1344
+
1345
+ **Outcome:** success
1346
+ **Date:** 2025-12-17
1347
+
1348
+ ## What Happened
1349
+ Started by copying the email verification pattern but discovered
1350
+ password reset needs single-use tokens with faster expiry...
1351
+
1352
+ ## Key Learning
1353
+ Don't assume similar features can share infrastructure.
1354
+
1355
+ ## For Next Time
1356
+ Make a requirements checklist BEFORE copying patterns.
1357
+ ```
1358
+
1359
+ ---
1360
+
1361
+ ## Multi-Agent Commands
1362
+
1363
+ ### /hud
1364
+
1365
+ **Purpose**: Launch the multi-agent monitoring dashboard.
1366
+
1367
+ **When to Use**: When running multiple Claude Code agents in parallel.
1368
+
1369
+ **What It Does**:
1370
+ 1. Opens terminal-based dashboard (TUI)
1371
+ 2. Shows all active agents with context usage
1372
+ 3. Displays cost per agent and total
1373
+ 4. Shows which issues each agent is working on
1374
+ 5. Warns on context thresholds (>70%, >85%)
1375
+
1376
+ **Launch**:
1377
+ ```bash
1378
+ # In a separate terminal pane
1379
+ uv run global/tools/anvil-hud.py
1380
+
1381
+ # Demo mode with sample data
1382
+ uv run global/tools/anvil-hud.py --demo
1383
+ ```
1384
+
1385
+ **Dashboard Keybindings**:
1386
+ | Key | Action |
1387
+ |-----|--------|
1388
+ | `q` | Quit HUD |
1389
+ | `r` | Force refresh |
1390
+ | `d` | Toggle detailed view |
1391
+ | `?` | Show help |
1392
+
1393
+ **Agent Panel Shows**:
1394
+ - **Agent ID**: Human-readable name (e.g., `swift-falcon-a3f2`)
1395
+ - **Model**: Current model (Opus/Sonnet/Haiku)
1396
+ - **Context**: Usage percentage with color-coded warnings
1397
+ - **Cost**: Session spend in USD
1398
+ - **Project**: Working directory
1399
+ - **Status**: Active, idle, or stale
1400
+
1401
+ **Status Indicators**:
1402
+ | Icon | Meaning |
1403
+ |------|---------|
1404
+ | ● | Active (recent activity) |
1405
+ | ○ | Idle (no recent activity) |
1406
+ | ⚠ | Context warning (>70%) |
1407
+ | 🔴 | Context critical (>85%) |
1408
+
1409
+ **Data Sources**:
1410
+ - `~/.anvil/agents.json` — Agent registry (auto-updated by statusline hook)
1411
+ - `.claude/anvil-state.json` — Current session state
1412
+
1413
+ **Related Commands**:
1414
+ - `/orient` — Registers agent at session start
1415
+ - `/handoff` — Preserves context before ending session
1416
+
1417
+ ---
1418
+
1419
+ ## Maintenance Commands
1420
+
1421
+ ### /release
1422
+
1423
+ **Purpose**: Consolidate [Unreleased] changes into a versioned release.
1424
+
1425
+ **When to Use**: At sprint end, after major feature merges, when ready to cut a release.
1426
+
1427
+ **Why This Exists**: In multi-agent environments, version assignment is dangerous. Multiple agents working simultaneously can create version conflicts. This command provides a single coordination point.
1428
+
1429
+ **Multi-Agent Rule**: Agents NEVER assign versions during development. All agents add entries to [Unreleased]. One agent or human runs `/release` at the coordination point.
1430
+
1431
+ **What It Does**:
1432
+ 1. Parses CHANGELOG.md [Unreleased] section
1433
+ 2. Calculates version bump (BREAKING→major, Added→minor, Fixed→patch)
1434
+ 3. Shows preview and requires confirmation
1435
+ 4. Transforms changelog: [Unreleased] → [X.Y.Z] - date
1436
+ 5. Updates VERSION file
1437
+ 6. Creates annotated git tag
1438
+
1439
+ **Version Bump Rules**:
1440
+
1441
+ | Change Type | Bump | Example |
1442
+ |-------------|------|---------|
1443
+ | `BREAKING CHANGE` | MAJOR | 1.3.0 → 2.0.0 |
1444
+ | `### Added` | MINOR | 1.3.0 → 1.4.0 |
1445
+ | `### Changed/Fixed/Removed` only | PATCH | 1.3.0 → 1.3.1 |
1446
+
1447
+ **Output Format**:
1448
+ ```markdown
1449
+ ## Release Preview
1450
+
1451
+ **Current version**: 1.3.0
1452
+ **New version**: 1.4.0 (MINOR bump)
1453
+ **Reason**: New features added
1454
+
1455
+ ### Changes to include:
1456
+ - Enhanced `/evidence` Command
1457
+ - Enhanced `/handoff` Command
1458
+
1459
+ **Proceed with release?** [y/N]
1460
+ ```
1461
+
1462
+ After confirmation:
1463
+ ```markdown
1464
+ ## Release Complete
1465
+
1466
+ **Version**: 1.4.0
1467
+ **Tag**: v1.4.0
1468
+ **Commit**: abc1234
1469
+
1470
+ Next steps:
1471
+ 1. Push to remote: `git push origin main --tags`
1472
+ 2. Create GitHub release (optional)
1473
+ ```
1474
+
1475
+ ---
1476
+
1477
+ ### /shard
1478
+
1479
+ **Purpose**: Break large specifications into atomic pieces.
1480
+
1481
+ **When to Use**: When specs exceed ~2000 tokens.
1482
+
1483
+ **What It Does**:
1484
+ 1. Analyzes spec for natural boundaries
1485
+ 2. Creates master spec with references
1486
+ 3. Creates epic shards
1487
+ 4. Creates story shards from epics
1488
+ 5. Maintains cross-references
1489
+
1490
+ **Output Structure**:
1491
+
1492
+ ```
1493
+ .claude/specs/current/
1494
+ ├── SPEC-001-user-auth.md # Master (overview + refs)
1495
+ ├── SPEC-001-user-auth/
1496
+ │ ├── epic-001-registration.md # Epic shard
1497
+ │ ├── epic-002-login.md # Epic shard
1498
+ │ └── epic-003-password-reset.md # Epic shard
1499
+ │ ├── story-001-request.md # Story shard
1500
+ │ └── story-002-confirm.md # Story shard
1501
+ ```
1502
+
1503
+ ---
1504
+
1505
+ ### /decay-review
1506
+
1507
+ **Purpose**: Weekly maintenance to archive old work.
1508
+
1509
+ **When to Use**: Weekly (suggest: Friday afternoon).
1510
+
1511
+ **What It Does**:
1512
+ 1. Finds issues closed >30 days ago
1513
+ 2. Adds archive summary comment
1514
+ 3. Archives the issues
1515
+ 4. Cleans handoff directory (keeps last 7)
1516
+ 5. Reports metrics
1517
+
1518
+ **Target Metrics**:
1519
+ - Active issues: < 50
1520
+ - Active handoffs: ≤ 7
1521
+
1522
+ ---
1523
+
1524
+ ### /weekly-review
1525
+
1526
+ **Purpose**: Generate weekly analytics and improvement recommendations.
1527
+
1528
+ **When to Use**: Weekly (suggest: Monday morning).
1529
+
1530
+ **What It Does**:
1531
+ 1. Runs Prompt Coach analysis (if installed)
1532
+ 2. Gathers metrics from Linear
1533
+ 3. Analyzes CodeRabbit patterns
1534
+ 4. Reviews discovered work
1535
+ 5. Generates improvement recommendations
1536
+
1537
+ **Output Format**:
1538
+
1539
+ ```markdown
1540
+ ## Weekly Review: Dec 11-17, 2025
1541
+
1542
+ ### Metrics
1543
+ | Metric | This Week | Target | Status |
1544
+ |--------|-----------|--------|--------|
1545
+ | Orientation time | 1.5 min | < 2 min | ✅ |
1546
+ | Ready work accuracy | 98% | > 95% | ✅ |
1547
+ | Phase gate compliance | 100% | 100% | ✅ |
1548
+ | First-pass PR rate | 65% | > 70% | ⚠️ |
1549
+
1550
+ ### Prompt Quality
1551
+ - Clarification rate: 12% (target: <15%) ✅
1552
+ - Time lost to vague prompts: 15 min
1553
+ - Top improvement: Include file paths in bug reports
1554
+
1555
+ ### CodeRabbit Patterns
1556
+ - Most common finding: Missing error handling (3 instances)
1557
+ - Recommendation: Add error handling to skill checklist
1558
+
1559
+ ### Discovered Work
1560
+ - 4 issues discovered this week
1561
+ - 2 from ENG-38, 2 from ENG-45
1562
+ - All P2 or lower (no blockers created)
1563
+
1564
+ ### Actions for Next Week
1565
+ 1. Focus on error handling in new code
1566
+ 2. Update convention examples with error patterns
1567
+ 3. Review P2 discovered issues for patterns
1568
+ ```
1569
+
1570
+ ---
1571
+
1572
+ ### /insights
1573
+
1574
+ **Purpose**: Synthesize patterns from recent retrospectives, healthchecks, and handoffs.
1575
+
1576
+ **When to Use**: Weekly, after multiple healthchecks, or before starting similar work.
1577
+
1578
+ **Data Sources**:
1579
+
1580
+ | Source | Path | Contains |
1581
+ |--------|------|----------|
1582
+ | Retrospectives | `.claude/retros/` | Session learnings |
1583
+ | Healthchecks | `.claude/healthchecks/` | Framework diagnostics |
1584
+ | Handoffs | `.claude/handoffs/` | Session context |
1585
+
1586
+ **What It Does**:
1587
+ 1. Reads retrospectives and healthchecks from last 2 weeks
1588
+ 2. Identifies patterns (issues mentioned 2+ times)
1589
+ 3. Categorizes by source: Development Patterns vs Framework Health
1590
+ 4. Outputs separate improvement recommendations
1591
+ 5. **Generates CLAUDE.md patch** with table rows for patterns
1592
+ 6. Optionally applies patch to update project's CLAUDE.md
1593
+
1594
+ **CLAUDE.md Integration**:
1595
+
1596
+ After identifying patterns, `/insights` generates a patch:
1597
+
1598
+ ```markdown
1599
+ ## CLAUDE.md Patch
1600
+
1601
+ Add these rows to the "Project-Learned Patterns" table in CLAUDE.md:
1602
+
1603
+ | Pattern | Evidence | Added |
1604
+ |---------|----------|-------|
1605
+ | Discover Before Building | BGG-149, BGG-146 | 2025-12-31 |
1606
+ | Always Destructure Query Results | BGG-148 | 2025-12-31 |
1607
+
1608
+ **Apply this patch?**
1609
+ - Say "apply patch" to update CLAUDE.md automatically
1610
+ - Or copy the table rows manually
1611
+ ```
1612
+
1613
+ This closes the feedback loop: patterns learned from retros flow back into CLAUDE.md.
1614
+
1615
+ **Output Format**:
1616
+
1617
+ ```markdown
1618
+ ## Insights: Dec 11-17, 2025
1619
+
1620
+ ### Development Patterns (from retros)
1621
+
1622
+ **Process**
1623
+ - Skipping /explore leads to rework (3 instances)
1624
+
1625
+ **Tooling**
1626
+ - ESLint rule for exhaustive-deps would catch hook issues
1627
+
1628
+ ### Framework Health (from healthchecks)
1629
+
1630
+ **Hook Issues**
1631
+ - Pre-tool-use hook timeout on large files (2 sessions)
1632
+
1633
+ **Safety Rules**
1634
+ - rm -rf blocked appropriately (no false positives)
1635
+
1636
+ ### Recommended Actions
1637
+
1638
+ **Development Improvements**
1639
+ 1. Add pre-/spec checklist to verify /explore was run
1640
+
1641
+ **Framework Improvements**
1642
+ 1. Increase hook timeout for Bash operations
1643
+
1644
+ ### No Action Needed
1645
+ - One-off issue with staging database (resolved)
1646
+ ```
1647
+
1648
+ ---
1649
+
1650
+ ## Setup Commands
1651
+
1652
+ ### /linear-setup
1653
+
1654
+ **Purpose**: Configure Linear integration for this project.
1655
+
1656
+ **When to Use**: First time setting up a project, or when Linear team changes.
1657
+
1658
+ **What It Does**:
1659
+ 1. Checks for existing `.claude/linear.yaml` configuration
1660
+ 2. Lists available Linear teams
1661
+ 3. Lets user select a team (or create new one)
1662
+ 4. Optionally filters to a specific project within the team
1663
+ 5. Saves configuration to `.claude/linear.yaml`
1664
+
1665
+ **Why It Matters**:
1666
+ Without Linear configuration, commands like `/orient`, `/sprint`, `/tasks`, and `/discover` will show issues from ALL teams or fail. This ensures each project maps to the correct Linear team.
1667
+
1668
+ **Output**: Creates/updates `.claude/linear.yaml`:
1669
+ ```yaml
1670
+ team_key: "ANV"
1671
+ team_id: "uuid-here"
1672
+ project_name: ""
1673
+ project_id: ""
1674
+ issue_prefix: "ANV"
1675
+ ```
1676
+
1677
+ **Configuration Reference**:
1678
+
1679
+ | Field | Required | Description |
1680
+ |-------|----------|-------------|
1681
+ | `team_key` | Yes | 2-4 letter team identifier |
1682
+ | `team_id` | Yes | Linear UUID for the team |
1683
+ | `project_name` | No | Filter to specific project |
1684
+ | `project_id` | No | Linear UUID for the project |
1685
+ | `issue_prefix` | Yes | Prefix for issue IDs |
1686
+
1687
+ ---
1688
+
1689
+ ### /anvil-sync
1690
+
1691
+ **Purpose**: Sync Anvil framework updates to this project or global config.
1692
+
1693
+ **When to Use**: After pulling framework updates, when commands or hooks seem outdated.
1694
+
1695
+ **Arguments**:
1696
+ - `target`: Where to sync — `project` (default), `global`, or `both`
1697
+ - `force`: Overwrite protected files (default: false)
1698
+ - `dry-run`: Preview changes without applying (default: false)
1699
+
1700
+ **What It Does**:
1701
+ 1. Locates Anvil framework source (ANVIL_HOME or auto-detect)
1702
+ 2. Syncs hooks, examples, agents, commands based on target
1703
+ 3. Protects customized files (CLAUDE.md, product.md, constitution.md)
1704
+ 4. Updates version marker (.anvil-version)
1705
+
1706
+ **Protected Files** (not overwritten without `force:true`):
1707
+ - `CLAUDE.md` — Project-specific AI instructions
1708
+ - `product.md` — Product definition
1709
+ - `constitution.md` — Project principles
1710
+ - `settings.local.json` — Local permissions and hooks
1711
+
1712
+ **Always Updated**:
1713
+ - `hooks/` — All hook scripts
1714
+ - `examples/` — Reference templates
1715
+ - `agents/` — Sub-agent definitions
1716
+ - `commands/` — Slash commands
1717
+
1718
+ **Usage Examples**:
1719
+ ```
1720
+ /anvil-sync # Sync current project
1721
+ /anvil-sync target:global # Sync ~/.claude/
1722
+ /anvil-sync target:both # Sync both
1723
+ /anvil-sync dry-run:true # Preview changes
1724
+ /anvil-sync force:true # Overwrite protected files
1725
+ ```
1726
+
1727
+ **CLI Alternative**:
1728
+ ```bash
1729
+ # From anywhere with ANVIL_HOME set
1730
+ anvil-sync --global --project .
1731
+
1732
+ # Or directly
1733
+ $ANVIL_HOME/scripts/sync.sh --project /path/to/project
1734
+ ```
1735
+
1736
+ ---
1737
+
1738
+ ### /anvil-settings
1739
+
1740
+ **Purpose**: Manage Anvil framework settings for the current project.
1741
+
1742
+ **When to Use**: Configure auto-trigger behavior, view current settings, reset to defaults.
1743
+
1744
+ **Usage**:
1745
+ ```bash
1746
+ /anvil-settings # View all settings
1747
+ /anvil-settings autoRetro on # Enable auto-retro prompt
1748
+ /anvil-settings autoHealthcheck on # Enable auto-healthcheck
1749
+ /anvil-settings reset # Reset to defaults
1750
+ ```
1751
+
1752
+ **Available Settings**:
1753
+
1754
+ | Setting | Default | Description |
1755
+ |---------|---------|-------------|
1756
+ | `autoRetro` | `off` | Prompt for `/retro` at session end |
1757
+ | `autoHealthcheck` | `off` | Run `/healthcheck` at session end |
1758
+
1759
+ **What It Does**:
1760
+ 1. Reads `.claude/anvil.config.json`
1761
+ 2. Displays or modifies settings
1762
+ 3. Creates config file if missing
1763
+
1764
+ **Config File**: `.claude/anvil.config.json`
1765
+ ```json
1766
+ {
1767
+ "version": "1.0",
1768
+ "autoRetro": false,
1769
+ "autoHealthcheck": false
1770
+ }
1771
+ ```
1772
+
1773
+ **Output Format**:
1774
+ ```markdown
1775
+ ## Anvil Settings
1776
+
1777
+ | Setting | Value | Description |
1778
+ |---------|-------|-------------|
1779
+ | autoRetro | off | Prompt for /retro at session end |
1780
+ | autoHealthcheck | off | Run /healthcheck at session end |
1781
+ ```
1782
+
1783
+ **Auto-Trigger Behavior**:
1784
+
1785
+ When enabled, the stop hook reads the config and outputs a reminder:
1786
+
1787
+ ```
1788
+ [Anvil Auto-Trigger]
1789
+ The following commands are configured to run at session end:
1790
+ → /healthcheck
1791
+ → /retro
1792
+
1793
+ Consider running these commands before ending the session.
1794
+ ```
1795
+
1796
+ This reminder appears in the hook output, prompting you to run the configured commands.
1797
+
1798
+ ---
1799
+
1800
+ ## Power Mode Commands
1801
+
1802
+ ### /ralph
1803
+
1804
+ **Purpose**: Ralph Wiggum autonomous execution mode for long-running, unattended AI development.
1805
+
1806
+ > **Important**: Ralph is a specialized power tool for specific scenarios, NOT a replacement for the standard workflow. Use it for large refactoring, migrations, or overnight runs — not for daily work.
1807
+
1808
+ **When to Use**:
1809
+ - Large-scale refactoring with clear completion criteria
1810
+ - Framework migrations (Jest→Vitest, CJS→ESM)
1811
+ - TDD with clear failing tests to pass
1812
+ - Greenfield projects with detailed specs
1813
+ - Test coverage expansion
1814
+ - Overnight/unattended execution
1815
+
1816
+ **When NOT to Use**:
1817
+ - Exploratory work
1818
+ - Ambiguous requirements
1819
+ - Security-sensitive code
1820
+ - Architecture decisions
1821
+ - Quick fixes (overkill)
1822
+ - Interactive debugging
1823
+
1824
+ **Usage**:
1825
+ ```bash
1826
+ # Start autonomous execution
1827
+ /ralph start "Migrate all tests from Jest to Vitest"
1828
+
1829
+ # With options
1830
+ /ralph start "Add OAuth authentication" --max-iterations 30
1831
+
1832
+ # Check progress
1833
+ /ralph status
1834
+
1835
+ # Stop early
1836
+ /ralph stop
1837
+ ```
1838
+
1839
+ **Arguments**:
1840
+
1841
+ | Argument | Description |
1842
+ |----------|-------------|
1843
+ | `start [description]` | Initialize Ralph mode with a task |
1844
+ | `status` | Show current iteration and progress |
1845
+ | `stop` | Force exit Ralph mode cleanly |
1846
+
1847
+ **Flags**:
1848
+
1849
+ | Flag | Default | Description |
1850
+ |------|---------|-------------|
1851
+ | `--max-iterations` | 50 | Maximum iterations before stopping |
1852
+ | `--completion-promise` | COMPLETE | Text that signals completion |
1853
+
1854
+ **What It Does**:
1855
+
1856
+ 1. **Start**: Breaks task into atomic TODO items, creates PROMPT.md, fix_plan.md, progress.txt
1857
+ 2. **Loop**: Executes ONE item per iteration, updates progress.txt, checks completion
1858
+ 3. **Safety**: Circuit breaker stops stuck loops automatically
1859
+
1860
+ **Files Created**:
1861
+
1862
+ | File | Purpose |
1863
+ |------|---------|
1864
+ | `PROMPT.md` | Main prompt fed to Claude each iteration |
1865
+ | `fix_plan.md` | TODO list with checkboxes |
1866
+ | `progress.txt` | Iteration log to prevent repeated mistakes |
1867
+ | `.claude/ralph-state.json` | State tracking |
1868
+
1869
+ **Circuit Breaker (Safety)**:
1870
+
1871
+ Ralph includes automatic safety stops:
1872
+
1873
+ | Condition | Threshold | Action |
1874
+ |-----------|-----------|--------|
1875
+ | No file changes | 3 iterations | Stop loop |
1876
+ | Repeated errors | 5 iterations | Stop loop |
1877
+ | Max iterations | 50 (default) | Stop loop |
1878
+ | `<fatal>` signal | Immediate | Stop loop |
1879
+
1880
+ **Cost Estimates**:
1881
+
1882
+ | Scenario | Estimated Cost |
1883
+ |----------|----------------|
1884
+ | 10 iterations, small codebase | $5-15 |
1885
+ | 50 iterations, medium codebase | $50-100+ |
1886
+ | 100+ iterations, large codebase | $200+ |
1887
+
1888
+ **Start small**: Use `--max-iterations 10` to understand costs before overnight runs.
1889
+
1890
+ **Output Format** (`/ralph status`):
1891
+ ```markdown
1892
+ ## Ralph Wiggum Status
1893
+
1894
+ | Metric | Value |
1895
+ |--------|-------|
1896
+ | Status | Running |
1897
+ | Iteration | 5 of 50 |
1898
+ | Started | 2026-01-07T10:00:00Z |
1899
+ | Duration | 45 minutes |
1900
+ | Items Complete | 3 of 8 |
1901
+ | Last Action | Implemented OAuth callback |
1902
+
1903
+ ### Recent Progress (last 3 iterations)
1904
+ - Iteration 5: Added token refresh logic
1905
+ - Iteration 4: Fixed callback URL parsing
1906
+ - Iteration 3: Implemented OAuth redirect
1907
+ ```
1908
+
1909
+ **Environment Variables**:
1910
+
1911
+ | Variable | Default | Description |
1912
+ |----------|---------|-------------|
1913
+ | `RALPH_MAX_ITERATIONS` | 50 | Max iterations |
1914
+ | `RALPH_COMPLETION_PROMISE` | COMPLETE | Completion text |
1915
+ | `RALPH_STATE_FILE` | .claude/ralph-state.json | State file path |
1916
+ | `RALPH_ENABLE_LOGGING` | false | Enable detailed logging |
1917
+
1918
+ **Decision Guide**:
1919
+ ```
1920
+ Is this task...
1921
+ ├── Quick fix or bug? → Use standard workflow
1922
+ ├── Exploratory / unclear? → Use standard workflow
1923
+ ├── Needs human decisions? → Use standard workflow
1924
+ ├── Large with clear spec? → Consider Ralph
1925
+ ├── Migration / refactoring? → Consider Ralph
1926
+ └── Overnight / unattended? → Ralph is ideal
1927
+ ```
1928
+
1929
+ ---
1930
+
1931
+ ## Command Cheat Sheet
1932
+
1933
+ ### Daily Workflow
1934
+ ```
1935
+ /orient → /sprint → /validate → [work] → /discover → /evidence → /handoff
1936
+ ```
1937
+
1938
+ ### New Feature Flow
1939
+ ```
1940
+ /explore → /spec → [approve] → /plan → [approve] → /tasks → [implement]
1941
+ ```
1942
+
1943
+ ### Brownfield Change Flow
1944
+ ```
1945
+ /explore → /change → [approve] → /plan → [approve] → /tasks → [implement]
1946
+ ```
1947
+
1948
+ ### Weekly Maintenance
1949
+ ```
1950
+ /weekly-review → /insights → /decay-review
1951
+ ```
1952
+
1953
+ ### Ralph Wiggum Mode (Power Tool)
1954
+ ```
1955
+ /ralph start "task description" → [autonomous loop] → /ralph status → completion
1956
+ ```
1957
+
1958
+ > **Note**: Ralph is for large refactoring, migrations, or overnight runs — NOT for daily work.
1959
+
1960
+ ---
1961
+
1962
+ ## Command Dependencies
1963
+
1964
+ ```
1965
+ ┌─────────────┐
1966
+ │ /orient │
1967
+ └──────┬──────┘
1968
+
1969
+ ┌──────▼──────┐
1970
+ │ /ready │
1971
+ └──────┬──────┘
1972
+
1973
+ ┌──────▼──────┐
1974
+ │ /validate │
1975
+ └──────┬──────┘
1976
+
1977
+ ┌─────────────────┼─────────────────┐
1978
+ │ │ │
1979
+ ┌──────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐
1980
+ │ /explore │ │ /change │ │ [direct] │
1981
+ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘
1982
+ │ │ │
1983
+ ┌──────▼──────┐ ┌──────▼──────┐ │
1984
+ │ /spec │ │ [approve] │ │
1985
+ └──────┬──────┘ └──────┬──────┘ │
1986
+ │ │ │
1987
+ ┌──────▼──────┐ │ │
1988
+ │ [approve] │ │ │
1989
+ └──────┬──────┘ │ │
1990
+ │ │ │
1991
+ ┌──────▼──────┐ ┌──────▼──────┐ │
1992
+ │ /plan │◄──┤ /plan │ │
1993
+ └──────┬──────┘ └─────────────┘ │
1994
+ │ │
1995
+ ┌──────▼──────┐ │
1996
+ │ [approve] │ │
1997
+ └──────┬──────┘ │
1998
+ │ │
1999
+ ┌──────▼──────┐ │
2000
+ │ /tasks │ │
2001
+ └──────┬──────┘ │
2002
+ │ │
2003
+ └─────────────────┬─────────────────┘
2004
+
2005
+ ┌──────▼──────┐
2006
+ │ [implement] │
2007
+ │ │
2008
+ │ /discover │
2009
+ └──────┬──────┘
2010
+
2011
+ ┌──────▼──────┐
2012
+ │ /evidence │
2013
+ └──────┬──────┘
2014
+
2015
+ ┌──────▼──────┐
2016
+ │ /handoff │
2017
+ └─────────────┘
2018
+ ```
2019
+
2020
+ ---
2021
+
2022
+ *For implementation details, see the [Implementation Guide](implementation-guide.md).*