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,166 @@
1
+ # /shard - Break Large Specs into Atomic Pieces
2
+
3
+ > Split large specifications into smaller, focused documents.
4
+
5
+ ## When to Use
6
+ - When a spec exceeds ~500 lines
7
+ - When a feature has multiple distinct epics
8
+ - When context window efficiency is needed
9
+ - To enable parallel work streams
10
+
11
+ ## Why Sharding Matters
12
+ Large specs cause problems:
13
+ - Exceed useful context window
14
+ - Mix unrelated concerns
15
+ - Make progress tracking difficult
16
+ - Prevent parallel work
17
+
18
+ Sharding provides:
19
+ - ~80% token savings (load only relevant shard)
20
+ - Clear ownership boundaries
21
+ - Independent progress tracking
22
+ - Parallel implementation paths
23
+
24
+ ## Execution Steps
25
+
26
+ ### Step 1: Identify Shard Boundaries
27
+ Review the spec and identify natural divisions:
28
+ - By user story / epic
29
+ - By technical domain
30
+ - By implementation phase
31
+ - By team/assignee
32
+
33
+ ### Step 2: Create Shard Structure
34
+
35
+ Directory structure:
36
+ ```
37
+ .claude/specs/current/
38
+ ├── SPEC-001-auth.md # Master spec (index)
39
+ └── SPEC-001-auth/ # Shard directory
40
+ ├── epic-001-registration.md
41
+ ├── epic-002-login.md
42
+ ├── epic-003-password-reset.md
43
+ └── epic-004-session-mgmt.md
44
+ ```
45
+
46
+ ### Step 3: Create Master Spec (Index)
47
+
48
+ The master spec becomes an index:
49
+ ```markdown
50
+ ---
51
+ spec_id: SPEC-001
52
+ title: Authentication System
53
+ status: in-progress
54
+ sharded: true
55
+ ---
56
+
57
+ # Authentication System Specification
58
+
59
+ ## Overview
60
+ [High-level description]
61
+
62
+ ## Shards
63
+
64
+ | Shard | Title | Status | Owner |
65
+ |-------|-------|--------|-------|
66
+ | epic-001 | User Registration | In Progress | - |
67
+ | epic-002 | Login Flow | Todo | - |
68
+ | epic-003 | Password Reset | Todo | - |
69
+ | epic-004 | Session Management | Todo | - |
70
+
71
+ ## Cross-Cutting Concerns
72
+ [Things that affect all shards]
73
+
74
+ ## Dependencies
75
+ [Dependencies between shards]
76
+
77
+ ## Shared Decisions
78
+ [Decisions that apply to all shards]
79
+ ```
80
+
81
+ ### Step 4: Create Individual Shards
82
+
83
+ Each shard is a complete mini-spec:
84
+ ```markdown
85
+ ---
86
+ shard_id: SPEC-001/epic-001
87
+ parent: SPEC-001
88
+ title: User Registration
89
+ status: draft
90
+ ---
91
+
92
+ # User Registration
93
+
94
+ ## Overview
95
+ [Specific to this shard]
96
+
97
+ ## Requirements
98
+ [Just this shard's requirements]
99
+
100
+ ## Acceptance Criteria
101
+ [Just this shard's criteria]
102
+
103
+ ## Technical Notes
104
+ [Specific technical considerations]
105
+ ```
106
+
107
+ ### Step 5: Report Sharding
108
+
109
+ Output:
110
+ ```
111
+ ## Specification Sharded
112
+
113
+ **Master Spec**: SPEC-001-auth.md
114
+ **Shards Created**: 4
115
+
116
+ | Shard | File | Lines | Status |
117
+ |-------|------|-------|--------|
118
+ | epic-001 | epic-001-registration.md | 85 | Ready |
119
+ | epic-002 | epic-002-login.md | 72 | Ready |
120
+ | epic-003 | epic-003-password-reset.md | 64 | Ready |
121
+ | epic-004 | epic-004-session-mgmt.md | 91 | Ready |
122
+
123
+ **Original**: 450 lines → **Per shard**: ~78 lines avg
124
+
125
+ ### Token Savings
126
+ - Loading master only: ~200 tokens
127
+ - Loading one shard: ~300 tokens
128
+ - Loading all (old way): ~1,800 tokens
129
+ - **Savings**: ~83% when working on single epic
130
+
131
+ **Next**: Each shard can now be planned and implemented independently.
132
+ ```
133
+
134
+ ## Sharding Guidelines
135
+
136
+ | Original Size | Recommendation |
137
+ |--------------|----------------|
138
+ | <200 lines | Don't shard |
139
+ | 200-500 lines | Consider sharding if distinct parts |
140
+ | >500 lines | Should shard |
141
+
142
+ ## Shard Naming Convention
143
+ ```
144
+ SPEC-[number]-[slug]/
145
+ ├── epic-[number]-[slug].md
146
+ ├── story-[number]-[slug].md
147
+ └── technical-[topic].md
148
+ ```
149
+
150
+ ## Key Behaviors
151
+ - Master spec becomes lightweight index
152
+ - Each shard is self-contained
153
+ - Cross-cutting concerns stay in master
154
+ - Shards can be worked on independently
155
+ - Update master status as shards complete
156
+
157
+ ## Anti-Patterns
158
+ - ❌ Shards that reference each other heavily
159
+ - ❌ Master spec that's still too detailed
160
+ - ❌ Shards with unclear boundaries
161
+ - ❌ Orphaned shards (no master)
162
+
163
+ ## Integration Points
164
+ - Applied to: Large specifications
165
+ - Enables: Parallel work streams
166
+ - Improves: Context efficiency
@@ -0,0 +1,227 @@
1
+ # /spec - Generate Formal Specification
2
+
3
+ > Create a detailed specification document for a feature or change.
4
+
5
+ ## When to Use
6
+ - After `/explore` discovery phase
7
+ - Before implementation of non-trivial features
8
+ - When requirements need formal documentation
9
+ - For features that will span multiple sessions
10
+
11
+ ## Prerequisites
12
+ - Discovery completed (`/explore`)
13
+ - Requirements understood
14
+ - Stakeholder alignment on scope
15
+
16
+ ## Execution Steps
17
+
18
+ ### Step 1: Gather Scope Decisions (Interactive)
19
+
20
+ Before writing, use AskUserQuestion to confirm key scope decisions:
21
+
22
+ ```typescript
23
+ AskUserQuestion({
24
+ questions: [
25
+ {
26
+ header: "Scope",
27
+ question: "How comprehensive should this specification be?",
28
+ multiSelect: false,
29
+ options: [
30
+ { label: "MVP - Core only (Recommended)", description: "Minimal requirements, fastest to ship" },
31
+ { label: "Standard", description: "Expected features, reasonable coverage" },
32
+ { label: "Comprehensive", description: "Full feature set, all edge cases" }
33
+ ]
34
+ },
35
+ {
36
+ header: "Timeline",
37
+ question: "What's the expected implementation timeline?",
38
+ multiSelect: false,
39
+ options: [
40
+ { label: "Single session", description: "Can complete in one work session" },
41
+ { label: "Multi-session", description: "Spans multiple sessions, needs handoffs" },
42
+ { label: "Multi-sprint", description: "Large effort, needs decomposition" }
43
+ ]
44
+ }
45
+ ]
46
+ })
47
+ ```
48
+
49
+ If requirements have open questions, run `/clarify` first to resolve ambiguities before proceeding
50
+
51
+ ### Step 2: Write Specification
52
+
53
+ Create file at: `.claude/specs/current/SPEC-[issue-key]-[slug].md`
54
+
55
+ Template:
56
+ ```markdown
57
+ ---
58
+ spec_id: SPEC-[number]
59
+ title: [Feature Name]
60
+ status: draft | approved | implemented | archived
61
+ created: YYYY-MM-DD
62
+ updated: YYYY-MM-DD
63
+ linear_issue: [Issue key]
64
+ ---
65
+
66
+ # [Feature Name] Specification
67
+
68
+ ## Overview
69
+ [2-3 sentence description of what this feature does and why]
70
+
71
+ ## Problem Statement
72
+ [What problem does this solve? What's the current pain point?]
73
+
74
+ ## Requirements
75
+
76
+ ### Functional Requirements
77
+ 1. **[REQ-001]**: [Requirement description]
78
+ 2. **[REQ-002]**: [Requirement description]
79
+ 3. **[REQ-003]**: [Requirement description]
80
+
81
+ ### Non-Functional Requirements
82
+ - **Performance**: [Any performance requirements]
83
+ - **Security**: [Any security considerations]
84
+ - **Accessibility**: [Any a11y requirements]
85
+
86
+ ## User Stories
87
+
88
+ ### [Story 1 Title]
89
+ **As a** [user type]
90
+ **I want** [goal]
91
+ **So that** [benefit]
92
+
93
+ ### [Story 2 Title]
94
+ ...
95
+
96
+ ## Acceptance Criteria (Gherkin)
97
+
98
+ ### Scenario: [Scenario Name]
99
+ ```gherkin
100
+ GIVEN [precondition]
101
+ AND [additional precondition]
102
+ WHEN [action]
103
+ THEN [expected result]
104
+ AND [additional result]
105
+ ```
106
+
107
+ ### Scenario: [Edge Case]
108
+ ```gherkin
109
+ GIVEN [precondition]
110
+ WHEN [action]
111
+ THEN [expected behavior]
112
+ ```
113
+
114
+ ## Technical Considerations
115
+
116
+ ### Affected Components
117
+ | Component | Change Type | Notes |
118
+ |-----------|-------------|-------|
119
+ | [Component] | New/Modified | [Details] |
120
+
121
+ ### Data Model Changes
122
+ [Any database or state changes needed]
123
+
124
+ ### API Changes
125
+ [Any API endpoints added or modified]
126
+
127
+ ### Dependencies
128
+ - [Dependency on other features/systems]
129
+
130
+ ## Out of Scope
131
+ - [Explicitly excluded item]
132
+ - [Future consideration, not this iteration]
133
+
134
+ ## Open Questions
135
+ - [ ] [Question needing resolution]
136
+ - [ ] [Decision needed]
137
+
138
+ ## Risks and Mitigations
139
+ | Risk | Impact | Mitigation |
140
+ |------|--------|------------|
141
+ | [Risk] | High/Med/Low | [Mitigation strategy] |
142
+
143
+ ## References
144
+ - [Link to related documentation]
145
+ - [Link to design mocks]
146
+ - [Link to exploration report]
147
+ ```
148
+
149
+ ### Step 3: Request Approval (Interactive)
150
+
151
+ After presenting the specification summary, use AskUserQuestion for approval:
152
+
153
+ ```typescript
154
+ AskUserQuestion({
155
+ questions: [
156
+ {
157
+ header: "Approval",
158
+ question: "Do you approve this specification to proceed?",
159
+ multiSelect: false,
160
+ options: [
161
+ { label: "Approve - proceed to /plan", description: "Spec is complete, create implementation plan" },
162
+ { label: "Needs revision", description: "Identify specific changes needed" },
163
+ { label: "Needs clarification", description: "Run /clarify to resolve open questions" },
164
+ { label: "Reject - start over", description: "Requirements significantly wrong" }
165
+ ]
166
+ }
167
+ ]
168
+ })
169
+ ```
170
+
171
+ **If approved**: Proceed to `/plan` to create implementation plan.
172
+ **If needs revision**: Ask what specific changes are needed.
173
+ **If needs clarification**: Run `/clarify` with identified questions.
174
+
175
+ Output:
176
+ ```
177
+ ## Specification Created
178
+
179
+ **File**: .claude/specs/current/SPEC-[key]-[slug].md
180
+ **Status**: Draft → [Approved/Needs Revision]
181
+
182
+ ### Summary
183
+ [Brief summary of what was specified]
184
+
185
+ ### Key Decisions Captured
186
+ 1. [Decision 1]
187
+ 2. [Decision 2]
188
+
189
+ ### Open Questions (if any)
190
+ 1. [Question 1]
191
+ 2. [Question 2]
192
+ ```
193
+
194
+ ## Key Behaviors
195
+ - Specifications must be **approved** before implementation
196
+ - Use Gherkin scenarios for testable criteria
197
+ - Be explicit about what's out of scope
198
+ - Surface risks and open questions
199
+ - Keep specs focused—one feature per spec
200
+
201
+ ## State Sync (ANV-176)
202
+
203
+ After creating the specification, update the session state:
204
+
205
+ ```bash
206
+ python3 global/lib/state_manager.py spec ".claude/specs/current/SPEC-XXX.md"
207
+ ```
208
+
209
+ This updates `.claude/anvil-state.json` with:
210
+ - `phase: "spec"`
211
+ - `activeSpec: [path to spec file]`
212
+ - Sets `lastCommand: "/spec"`
213
+
214
+ And syncs to the agent registry for statusline visibility.
215
+
216
+ ## Integration Points
217
+ - Follows: `/explore` discovery
218
+ - Uses: `/clarify` for open questions (via AskUserQuestion)
219
+ - Precedes: `/plan` implementation planning
220
+ - Creates: `.claude/specs/current/SPEC-*.md`
221
+ - References: Exploration report
222
+
223
+ ## Anti-Patterns
224
+ - ❌ Writing spec without scope confirmation
225
+ - ❌ Proceeding with unresolved open questions
226
+ - ❌ Skipping approval step
227
+ - ❌ Using text options instead of AskUserQuestion menus
@@ -0,0 +1,184 @@
1
+ # /sprint - Quick Session Planning
2
+
3
+ > Fast prioritization for what to work on this session. Builds on `/ready` output with broader context and recommendations.
4
+
5
+ ## When to Use
6
+ - After `/orient` when multiple options exist
7
+ - When unsure what to prioritize
8
+ - Before starting a work session
9
+
10
+ ## Pre-Flight: Check Linear Configuration
11
+
12
+ **CRITICAL**: Before querying Linear, verify project configuration.
13
+
14
+ ```bash
15
+ if [ -f ".claude/linear.yaml" ]; then
16
+ TEAM_KEY=$(grep "team_key:" .claude/linear.yaml | cut -d'"' -f2)
17
+ echo "Linear team: $TEAM_KEY"
18
+ else
19
+ echo "⚠️ LINEAR NOT CONFIGURED"
20
+ echo "Run /linear-setup first"
21
+ exit 1
22
+ fi
23
+ ```
24
+
25
+ **If no linear.yaml**: Stop and prompt user to run `/linear-setup`. Do NOT query Linear.
26
+
27
+ ## Execution Steps
28
+
29
+ ### Step 1: Get Ready Work (from /ready logic)
30
+
31
+ **Internally apply /ready's unblocked work calculation:**
32
+
33
+ 1. Query Linear for issues where:
34
+ - Team = [team_key from linear.yaml]
35
+ - Status in (Todo, Backlog)
36
+
37
+ 2. Filter for unblocked:
38
+ - Check `blockedBy` relationships
39
+ - If any blocking issue is NOT in "Done" → blocked
40
+ - If ALL blockers are "Done" (or none) → ready
41
+
42
+ 3. Check agent conflicts via `.claude/coordination.md`:
43
+ - Parse Active Sessions table
44
+ - Match issue keys to active agent work
45
+ - Mark conflicts (warn, don't block)
46
+
47
+ This gives you the **ready work pool** with conflict awareness.
48
+
49
+ ### Step 2: Get Broader State Context
50
+
51
+ Query additional issues from Linear **for this team**:
52
+
53
+ ```
54
+ Query Linear for issues where:
55
+ - Team = [team_key from linear.yaml]
56
+ - Status in (Blocked, In Progress, In Review)
57
+ - Limit 20 per status
58
+ ```
59
+
60
+ This provides context beyond just ready work.
61
+
62
+ ### Step 3: Build State Summary
63
+
64
+ ```markdown
65
+ ## Sprint State — [team_key]
66
+
67
+ | Status | Count | Attention Needed |
68
+ |--------|-------|------------------|
69
+ | Blocked | X | [Can you unblock something?] |
70
+ | In Progress | X | [Finish or continue] |
71
+ | In Review | X | [Address feedback] |
72
+ | Ready (unblocked) | X | [From /ready - available to start] |
73
+
74
+ **Agent Conflicts**: Y ready issues have active agents working on them
75
+ ```
76
+
77
+ ### Step 4: Identify Priorities
78
+
79
+ Apply this priority framework:
80
+
81
+ 1. **Blocked items you can unblock** — Huge value, multiplier effect
82
+ 2. **In Review with feedback** — Address quickly to unblock merge
83
+ 3. **In Progress items** — Finish what's started (momentum)
84
+ 4. **High priority Ready work** — P0/P1 items without agent conflicts
85
+ 5. **Lower priority Ready work** — P2/P3 available items
86
+
87
+ **Agent conflict handling:**
88
+ - Prefer recommending items WITHOUT active agents
89
+ - If all high-priority items have conflicts, warn but still show them
90
+ - User ultimately decides whether to work on conflicting items
91
+
92
+ ### Step 5: Suggest Top 3
93
+
94
+ ```markdown
95
+ ## Suggested Focus
96
+
97
+ 1. **[TEAM-XXX]**: [Title]
98
+ - Why: [Reason - e.g., "unblocks 2 other issues"]
99
+ - Effort: [Estimate if known]
100
+ - Status: Available | ⚠️ [agent-id] active
101
+
102
+ 2. **[TEAM-XXX]**: [Title]
103
+ - Why: [Reason]
104
+ - Effort: [Estimate]
105
+ - Status: Available | ⚠️ conflict
106
+
107
+ 3. **[TEAM-XXX]**: [Title]
108
+ - Why: [Reason]
109
+ - Effort: [Estimate]
110
+ - Status: Available
111
+
112
+ ## Blockers Requiring Attention
113
+ - [TEAM-XXX] blocked by [external dependency / decision needed]
114
+
115
+ ## Agent Conflicts (Informational)
116
+ - [TEAM-YYY] has active agent: swift-falcon-a3f2
117
+ (You can still work on this, but coordinate to avoid conflicts)
118
+ ```
119
+
120
+ ### Step 6: Await Selection
121
+
122
+ ```
123
+ Which would you like to work on? (Or specify different task)
124
+ ```
125
+
126
+ ## Key Behaviors
127
+ - **ALWAYS check linear.yaml first** — never show issues from wrong team
128
+ - **Use /ready logic** for unblocked work detection
129
+ - **Check coordination.md** for agent conflicts (inherited from /ready)
130
+ - Fast — should complete in <30 seconds
131
+ - Suggest, don't decide — highlight reasoning
132
+ - Prefer available items over conflicting ones in recommendations
133
+
134
+ ## What This Command Does NOT Do
135
+ - Query issues from other teams
136
+ - Assign work automatically
137
+ - Calculate weighted priorities (WSJF)
138
+ - Create new issues
139
+ - Replace human judgment
140
+ - Block work on conflicting issues (warns only)
141
+
142
+ ## Error: Linear Not Configured
143
+
144
+ If linear.yaml is missing, output:
145
+
146
+ ```
147
+ ## Sprint — ⚠️ Linear Not Configured
148
+
149
+ This project is not mapped to a Linear team.
150
+
151
+ **To configure:**
152
+ 1. Run `/linear-setup` to select or create a team
153
+ 2. Then run `/sprint` again
154
+
155
+ Cannot show sprint state without team configuration.
156
+ ```
157
+
158
+ ## Relationship to Other Commands
159
+
160
+ | Command | Purpose | Scope | Output |
161
+ |---------|---------|-------|--------|
162
+ | `/ready` | List unblocked work | Todo/Backlog only | Data report |
163
+ | `/sprint` | Prioritize session | All active states | Top 3 recommendations |
164
+
165
+ **How they relate:**
166
+ - `/sprint` **builds on** `/ready` — uses same unblocked detection + agent conflicts
167
+ - `/sprint` **adds** broader state view (In Progress, In Review, Blocked)
168
+ - `/sprint` **adds** prioritization reasoning and recommendations
169
+ - `/ready` is useful standalone for quick "what's available?" checks
170
+ - `/sprint` is the full planning experience
171
+
172
+ ```
173
+ /orient → /ready (optional quick check) → /sprint (full planning) → /validate → work
174
+ ↑ ↑
175
+ Quick data query Decision assistance with context
176
+ ```
177
+
178
+ ## Integration Points
179
+ - Requires: `.claude/linear.yaml` (team configuration)
180
+ - Uses: `.claude/coordination.md` (active agent detection - shared with /ready)
181
+ - Uses: Linear MCP (filtered by team)
182
+ - Builds on: `/ready` logic (unblocked detection, agent conflicts)
183
+ - After: `/orient`
184
+ - Before: `/validate` → work