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,197 @@
1
+ # /change - Brownfield Change Proposal
2
+
3
+ > Document proposed changes to existing code with clear delta markers.
4
+
5
+ ## When to Use
6
+ - When modifying existing functionality
7
+ - For refactoring existing code
8
+ - When change impacts multiple existing files
9
+ - To document migration or upgrade plans
10
+
11
+ ## Why This Exists
12
+ Most work is **brownfield** (modifying existing code), not greenfield. Change documents capture:
13
+ - What exists now (baseline)
14
+ - What will change (delta)
15
+ - Impact on existing functionality
16
+ - Migration considerations
17
+
18
+ ## Execution Steps
19
+
20
+ ### Step 1: Document Current State
21
+ Read and understand existing code:
22
+ - Current behavior
23
+ - Current file structure
24
+ - Current dependencies
25
+ - Current tests
26
+
27
+ ### Step 2: Write Change Proposal
28
+
29
+ Create file at: `.claude/changes/CHANGE-[issue-key]-[slug].md`
30
+
31
+ Template:
32
+ ```markdown
33
+ ---
34
+ change_id: CHANGE-[number]
35
+ title: [Change Description]
36
+ status: draft | approved | implemented
37
+ created: YYYY-MM-DD
38
+ linear_issue: [Issue key]
39
+ risk_level: low | medium | high
40
+ ---
41
+
42
+ # Change Proposal: [Title]
43
+
44
+ ## Summary
45
+ [1-2 sentence description of the change]
46
+
47
+ ## Motivation
48
+ [Why is this change needed? What problem does it solve?]
49
+
50
+ ## Current State
51
+ [Description of how things work now]
52
+
53
+ ### Affected Files (Current)
54
+ | File | Purpose | Lines |
55
+ |------|---------|-------|
56
+ | src/components/X.tsx | [Current purpose] | ~150 |
57
+ | src/hooks/useX.ts | [Current purpose] | ~80 |
58
+
59
+ ## Proposed Changes
60
+
61
+ ### File: src/components/X.tsx
62
+
63
+ #### MODIFIED: Function `handleSubmit`
64
+ ```typescript
65
+ // BEFORE (lines 45-55)
66
+ const handleSubmit = async (data: FormData) => {
67
+ await api.submit(data);
68
+ router.push('/success');
69
+ };
70
+
71
+ // AFTER
72
+ const handleSubmit = async (data: FormData) => {
73
+ // ADDED: Validation step
74
+ const validated = await validateData(data);
75
+ if (!validated.success) {
76
+ setError(validated.error);
77
+ return;
78
+ }
79
+ // MODIFIED: Use validated data
80
+ await api.submit(validated.data);
81
+ router.push('/success');
82
+ };
83
+ ```
84
+
85
+ #### ADDED: New state
86
+ ```typescript
87
+ // ADDED at line 12
88
+ const [error, setError] = useState<string | null>(null);
89
+ ```
90
+
91
+ #### REMOVED: Deprecated prop
92
+ ```typescript
93
+ // REMOVED from props interface
94
+ interface Props {
95
+ // REMOVED: legacyMode: boolean;
96
+ onSuccess: () => void;
97
+ }
98
+ ```
99
+
100
+ ---
101
+
102
+ ### File: src/hooks/useX.ts
103
+
104
+ #### MODIFIED: Return type
105
+ ```typescript
106
+ // BEFORE
107
+ return { data, loading };
108
+
109
+ // AFTER
110
+ return { data, loading, error }; // ADDED: error
111
+ ```
112
+
113
+ ## New Files
114
+ | File | Purpose |
115
+ |------|---------|
116
+ | src/utils/validation.ts | New validation utilities |
117
+
118
+ ## Deleted Files
119
+ | File | Reason |
120
+ |------|--------|
121
+ | src/legacy/oldHelper.ts | Replaced by new validation |
122
+
123
+ ## Impact Analysis
124
+
125
+ ### Breaking Changes
126
+ - [ ] API contract changes: [Yes/No - details]
127
+ - [ ] Database schema changes: [Yes/No - details]
128
+ - [ ] Environment variable changes: [Yes/No - details]
129
+
130
+ ### Affected Consumers
131
+ | Consumer | Impact | Migration Needed |
132
+ |----------|--------|------------------|
133
+ | [Component/Service] | [Impact] | [Yes/No] |
134
+
135
+ ### Test Impact
136
+ - [ ] Existing tests need updates: [List tests]
137
+ - [ ] New tests needed: [List new tests]
138
+
139
+ ## Migration Plan
140
+ [If breaking changes, how will migration happen?]
141
+
142
+ 1. [Step 1]
143
+ 2. [Step 2]
144
+ 3. [Step 3]
145
+
146
+ ## Rollback Plan
147
+ [How to revert if something goes wrong]
148
+
149
+ ## Risk Assessment
150
+ | Risk | Likelihood | Impact | Mitigation |
151
+ |------|------------|--------|------------|
152
+ | [Risk] | Low/Med/High | Low/Med/High | [Mitigation] |
153
+
154
+ ## Open Questions
155
+ - [ ] [Question]
156
+ ```
157
+
158
+ ### Step 3: Request Approval
159
+
160
+ Output:
161
+ ```
162
+ ## Change Proposal Created
163
+
164
+ **File**: .claude/changes/CHANGE-[key]-[slug].md
165
+ **Risk Level**: [low/medium/high]
166
+
167
+ ### Change Summary
168
+ - **Files Modified**: X
169
+ - **Files Added**: Y
170
+ - **Files Deleted**: Z
171
+ - **Breaking Changes**: [Yes/No]
172
+
173
+ ### Key Changes
174
+ 1. [Change 1 summary]
175
+ 2. [Change 2 summary]
176
+
177
+ **Next Step**: Review and approve change proposal, then run `/plan` to create implementation plan.
178
+ ```
179
+
180
+ ## Delta Markers
181
+ Use consistent markers in code blocks:
182
+ - `// ADDED:` - New code being added
183
+ - `// MODIFIED:` - Existing code being changed
184
+ - `// REMOVED:` - Code being deleted
185
+ - `// BEFORE` / `// AFTER` - For showing transformations
186
+
187
+ ## Key Behaviors
188
+ - Always show current state before changes
189
+ - Use delta markers consistently
190
+ - Highlight breaking changes prominently
191
+ - Include rollback plan for risky changes
192
+ - Think about migration for consumers
193
+
194
+ ## Integration Points
195
+ - May follow: `/explore` discovery
196
+ - Precedes: `/plan` (or may replace `/spec` for pure refactors)
197
+ - Creates: `.claude/changes/CHANGE-*.md`
@@ -0,0 +1,252 @@
1
+ # /clarify - Interactive Requirement Disambiguation
2
+
3
+ > Use AskUserQuestion to gather explicit decisions when requirements are ambiguous.
4
+
5
+ ## When to Use
6
+ - Requirements contain "or" / alternatives
7
+ - Multiple valid approaches exist
8
+ - Scope is fuzzy or negotiable
9
+ - Before writing a specification with open questions
10
+ - When you need explicit decisions before implementation
11
+
12
+ ## When NOT to Use
13
+ - Requirements are clear and unambiguous
14
+ - User has already provided detailed specifications
15
+ - Simple yes/no questions (just ask directly)
16
+
17
+ ## Execution Steps
18
+
19
+ ### Step 1: Identify Ambiguities
20
+
21
+ Analyze the request for:
22
+ - **Alternatives**: "We could use X or Y"
23
+ - **Scope questions**: "Should this include Z?"
24
+ - **Technical choices**: "Which library/pattern/approach?"
25
+ - **Priorities**: "What matters most: speed, cost, simplicity?"
26
+ - **Constraints**: "Any limitations on the solution?"
27
+
28
+ ### Step 2: Convert to Structured Questions
29
+
30
+ For each ambiguity, create an AskUserQuestion entry:
31
+
32
+ **Guidelines:**
33
+ - **header**: Max 12 characters, noun-like ("Provider", "Scope", "Priority")
34
+ - **question**: Full sentence ending with "?"
35
+ - **multiSelect**: `true` if multiple options can be chosen together
36
+ - **options**: 2-4 choices, most recommended first with "(Recommended)"
37
+ - **descriptions**: Why this option, what it enables/implies
38
+
39
+ ### Step 3: Present Questions via AskUserQuestion
40
+
41
+ ```typescript
42
+ AskUserQuestion({
43
+ questions: [
44
+ {
45
+ header: "[short-label]",
46
+ question: "[Full question text?]",
47
+ multiSelect: [true/false],
48
+ options: [
49
+ { label: "[Option 1] (Recommended)", description: "[Why choose this]" },
50
+ { label: "[Option 2]", description: "[Why choose this]" },
51
+ { label: "[Option 3]", description: "[Why choose this]" }
52
+ ]
53
+ },
54
+ // ... up to 4 questions per call
55
+ ]
56
+ })
57
+ ```
58
+
59
+ **Note**: User can always select "Other" to provide custom input.
60
+
61
+ ### Step 4: Chain Additional Questions if Needed
62
+
63
+ If more than 4 questions, or if answers reveal new questions:
64
+ - Process first batch of answers
65
+ - Ask follow-up questions based on selections
66
+ - Continue until all ambiguities resolved
67
+
68
+ ### Step 5: Generate Clarification Report
69
+
70
+ After gathering all answers, output:
71
+
72
+ ```markdown
73
+ ## Clarification Report
74
+
75
+ **Feature**: [Feature name]
76
+ **Date**: [YYYY-MM-DD]
77
+
78
+ ### Decisions Captured
79
+
80
+ | Question | Answer | Rationale |
81
+ |----------|--------|-----------|
82
+ | [Question 1] | [Selected option] | [From description or user input] |
83
+ | [Question 2] | [Selected option(s)] | [Rationale] |
84
+
85
+ ### Resolved Ambiguities
86
+ 1. **[Topic]**: Decided on [choice] because [reason]
87
+ 2. **[Topic]**: Decided on [choice] because [reason]
88
+
89
+ ### Remaining Open Questions
90
+ - [Any questions that couldn't be resolved]
91
+
92
+ ### Next Steps
93
+ - Run `/spec` to create specification with these decisions
94
+ - Or run `/explore` if more discovery needed first
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Examples
100
+
101
+ ### Example 1: Authentication Feature
102
+
103
+ **Input**: "Add user authentication to the app"
104
+
105
+ **Analysis**: Multiple ambiguities detected:
106
+ - Which auth provider?
107
+ - Session handling approach?
108
+ - 2FA requirement?
109
+
110
+ **AskUserQuestion call**:
111
+ ```typescript
112
+ AskUserQuestion({
113
+ questions: [
114
+ {
115
+ header: "Provider",
116
+ question: "Which authentication provider should we implement?",
117
+ multiSelect: false,
118
+ options: [
119
+ { label: "Google OAuth (Recommended)", description: "Widest adoption, fastest setup" },
120
+ { label: "GitHub OAuth", description: "Developer-focused audience" },
121
+ { label: "Email/Password", description: "Traditional, no external dependency" },
122
+ { label: "Multiple providers", description: "Support several options" }
123
+ ]
124
+ },
125
+ {
126
+ header: "2FA",
127
+ question: "Is two-factor authentication required?",
128
+ multiSelect: false,
129
+ options: [
130
+ { label: "Yes (Recommended)", description: "Required for security compliance" },
131
+ { label: "Optional", description: "Users can enable if they want" },
132
+ { label: "No", description: "Not needed for this use case" }
133
+ ]
134
+ },
135
+ {
136
+ header: "Session",
137
+ question: "How long should user sessions last?",
138
+ multiSelect: false,
139
+ options: [
140
+ { label: "24 hours (Recommended)", description: "Balance between UX and security" },
141
+ { label: "1 week", description: "Convenience-focused" },
142
+ { label: "1 hour", description: "High-security environment" }
143
+ ]
144
+ }
145
+ ]
146
+ })
147
+ ```
148
+
149
+ ### Example 2: Feature Scope
150
+
151
+ **Input**: "Improve the search functionality"
152
+
153
+ **Analysis**: Scope is vague - what improvements?
154
+
155
+ **AskUserQuestion call**:
156
+ ```typescript
157
+ AskUserQuestion({
158
+ questions: [
159
+ {
160
+ header: "Scope",
161
+ question: "Which search improvements should we prioritize?",
162
+ multiSelect: true,
163
+ options: [
164
+ { label: "Faster results", description: "Optimize query performance" },
165
+ { label: "Better relevance", description: "Improve ranking algorithm" },
166
+ { label: "More filters", description: "Add filtering options" },
167
+ { label: "Autocomplete", description: "Suggestions as user types" }
168
+ ]
169
+ },
170
+ {
171
+ header: "Priority",
172
+ question: "What matters most for this improvement?",
173
+ multiSelect: false,
174
+ options: [
175
+ { label: "User experience (Recommended)", description: "Make it feel fast and intuitive" },
176
+ { label: "Accuracy", description: "Ensure results are highly relevant" },
177
+ { label: "Feature parity", description: "Match competitor capabilities" }
178
+ ]
179
+ }
180
+ ]
181
+ })
182
+ ```
183
+
184
+ ### Example 3: Technical Architecture
185
+
186
+ **Input**: "Add real-time updates to the dashboard"
187
+
188
+ **Analysis**: Technical approach unclear
189
+
190
+ **AskUserQuestion call**:
191
+ ```typescript
192
+ AskUserQuestion({
193
+ questions: [
194
+ {
195
+ header: "Approach",
196
+ question: "Which real-time technology should we use?",
197
+ multiSelect: false,
198
+ options: [
199
+ { label: "WebSockets (Recommended)", description: "Full duplex, lowest latency" },
200
+ { label: "Server-Sent Events", description: "Simpler, server-to-client only" },
201
+ { label: "Polling", description: "Simplest, works everywhere" }
202
+ ]
203
+ },
204
+ {
205
+ header: "Updates",
206
+ question: "Which dashboard elements need real-time updates?",
207
+ multiSelect: true,
208
+ options: [
209
+ { label: "Metrics/stats", description: "Numbers and charts" },
210
+ { label: "Activity feed", description: "Recent actions list" },
211
+ { label: "Notifications", description: "Alerts and messages" },
212
+ { label: "All elements", description: "Full dashboard refresh" }
213
+ ]
214
+ }
215
+ ]
216
+ })
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Best Practices
222
+
223
+ ### Question Design
224
+ 1. **Be specific**: "Which auth provider?" not "How should auth work?"
225
+ 2. **Provide context**: Descriptions should explain implications
226
+ 3. **Recommend wisely**: First option should be genuinely best for most cases
227
+ 4. **Limit options**: 2-4 choices per question, not exhaustive lists
228
+
229
+ ### When to Chain Questions
230
+ - First question reveals scope for follow-ups
231
+ - User selects "Other" and provides context that needs clarification
232
+ - More than 4 distinct decision points exist
233
+
234
+ ### Storing Decisions
235
+ Always capture clarification answers for future reference:
236
+ - Include in specification document
237
+ - Reference in implementation plan
238
+ - Add to Linear issue description
239
+
240
+ ---
241
+
242
+ ## Integration Points
243
+ - **Precedes**: `/spec`, `/plan`, `/explore`
244
+ - **Used by**: Any command encountering ambiguity
245
+ - **Stores**: Decisions in clarification report
246
+ - **References**: Linear issues, existing specifications
247
+
248
+ ## Key Behaviors
249
+ - **Always offer "Other"**: AskUserQuestion includes this automatically
250
+ - **Don't over-ask**: If answer is obvious, don't ask
251
+ - **Batch related questions**: Group related decisions in one call
252
+ - **Follow up intelligently**: New questions based on answers, not pre-planned