agent-tmux 0.1.0

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 (161) hide show
  1. package/.codex/skills/speckit/SKILL.md +173 -0
  2. package/.codex/skills/speckit/assets/templates/checklist-template.md +49 -0
  3. package/.codex/skills/speckit/assets/templates/notes-entrypoints-template.md +11 -0
  4. package/.codex/skills/speckit/assets/templates/notes-questions-template.md +7 -0
  5. package/.codex/skills/speckit/assets/templates/notes-readme-template.md +36 -0
  6. package/.codex/skills/speckit/assets/templates/notes-session-template.md +21 -0
  7. package/.codex/skills/speckit/assets/templates/plan-template.md +126 -0
  8. package/.codex/skills/speckit/assets/templates/spec-template.md +135 -0
  9. package/.codex/skills/speckit/assets/templates/tasks-template.md +269 -0
  10. package/.codex/skills/speckit/references/acceptance.md +183 -0
  11. package/.codex/skills/speckit/references/analyze.md +186 -0
  12. package/.codex/skills/speckit/references/checklist.md +302 -0
  13. package/.codex/skills/speckit/references/clarify-auto.md +69 -0
  14. package/.codex/skills/speckit/references/clarify-detailed.md +78 -0
  15. package/.codex/skills/speckit/references/clarify.md +189 -0
  16. package/.codex/skills/speckit/references/constitution.md +90 -0
  17. package/.codex/skills/speckit/references/group.md +89 -0
  18. package/.codex/skills/speckit/references/implement-task.md +115 -0
  19. package/.codex/skills/speckit/references/implement.md +129 -0
  20. package/.codex/skills/speckit/references/notes.md +82 -0
  21. package/.codex/skills/speckit/references/plan-deep.md +87 -0
  22. package/.codex/skills/speckit/references/plan-from-questions.md +115 -0
  23. package/.codex/skills/speckit/references/plan-from-review.md +89 -0
  24. package/.codex/skills/speckit/references/plan.md +97 -0
  25. package/.codex/skills/speckit/references/review-plan.md +156 -0
  26. package/.codex/skills/speckit/references/specify.md +246 -0
  27. package/.codex/skills/speckit/references/tasks.md +155 -0
  28. package/.codex/skills/speckit/references/taskstoissues.md +33 -0
  29. package/.codex/skills/speckit/scripts/bash/check-prerequisites.sh +206 -0
  30. package/.codex/skills/speckit/scripts/bash/common.sh +191 -0
  31. package/.codex/skills/speckit/scripts/bash/create-new-feature.sh +259 -0
  32. package/.codex/skills/speckit/scripts/bash/extract-coded-points.sh +322 -0
  33. package/.codex/skills/speckit/scripts/bash/extract-spec-ids.sh +238 -0
  34. package/.codex/skills/speckit/scripts/bash/extract-tasks.sh +295 -0
  35. package/.codex/skills/speckit/scripts/bash/extract-user-stories.sh +312 -0
  36. package/.codex/skills/speckit/scripts/bash/setup-notes.sh +182 -0
  37. package/.codex/skills/speckit/scripts/bash/setup-plan.sh +110 -0
  38. package/.codex/skills/speckit/scripts/bash/show-todo-tasks.sh +257 -0
  39. package/.codex/skills/speckit/scripts/bash/spec-group-checklist.sh +402 -0
  40. package/.codex/skills/speckit/scripts/bash/spec-group-members.sh +215 -0
  41. package/.codex/skills/speckit/scripts/bash/spec-registry-graph.sh +399 -0
  42. package/.specify/memory/constitution.md +67 -0
  43. package/.specify/templates/agent-file-template.md +28 -0
  44. package/.specify/templates/checklist-template.md +49 -0
  45. package/.specify/templates/plan-template.md +126 -0
  46. package/.specify/templates/spec-template.md +135 -0
  47. package/.specify/templates/tasks-template.md +269 -0
  48. package/README.md +128 -0
  49. package/README.zh-CN.md +127 -0
  50. package/bun.lock +269 -0
  51. package/dist/cli/commands/codex/forkHome.js +88 -0
  52. package/dist/cli/commands/codex/send.js +55 -0
  53. package/dist/cli/commands/codex/sessionInfo.js +42 -0
  54. package/dist/cli/commands/codex/spawn.js +68 -0
  55. package/dist/cli/commands/find.js +26 -0
  56. package/dist/cli/commands/paneKill.js +33 -0
  57. package/dist/cli/commands/paneSpawn.js +40 -0
  58. package/dist/cli/commands/paneTitle.js +33 -0
  59. package/dist/cli/commands/read.js +34 -0
  60. package/dist/cli/commands/send.js +51 -0
  61. package/dist/cli/commands/snapshot.js +19 -0
  62. package/dist/cli/commands/ui/select.js +41 -0
  63. package/dist/cli/commands/windowKill.js +25 -0
  64. package/dist/cli/commands/windowLs.js +15 -0
  65. package/dist/cli/commands/windowNew.js +28 -0
  66. package/dist/cli/commands/windowRename.js +25 -0
  67. package/dist/cli/index.js +365 -0
  68. package/dist/cli/parse.js +39 -0
  69. package/dist/lib/codex/forkHome.js +101 -0
  70. package/dist/lib/codex/isCodexPane.js +55 -0
  71. package/dist/lib/codex/send.js +58 -0
  72. package/dist/lib/codex/sessionInfo.js +449 -0
  73. package/dist/lib/codex/spawn.js +246 -0
  74. package/dist/lib/contracts/types.js +2 -0
  75. package/dist/lib/fs/safeRm.js +32 -0
  76. package/dist/lib/io/readStdin.js +14 -0
  77. package/dist/lib/os/process.js +55 -0
  78. package/dist/lib/output/format.js +95 -0
  79. package/dist/lib/proc/lsof.js +42 -0
  80. package/dist/lib/proc/ps.js +60 -0
  81. package/dist/lib/targeting/errors.js +13 -0
  82. package/dist/lib/targeting/resolvePaneTarget.js +91 -0
  83. package/dist/lib/targeting/resolveWindowTarget.js +40 -0
  84. package/dist/lib/targeting/scope.js +58 -0
  85. package/dist/lib/tmux/capturePane.js +20 -0
  86. package/dist/lib/tmux/exec.js +66 -0
  87. package/dist/lib/tmux/paneOps.js +29 -0
  88. package/dist/lib/tmux/paste.js +23 -0
  89. package/dist/lib/tmux/sendKeys.js +47 -0
  90. package/dist/lib/tmux/session.js +29 -0
  91. package/dist/lib/tmux/snapshotPanes.js +46 -0
  92. package/dist/lib/tmux/snapshotWindows.js +24 -0
  93. package/dist/lib/tmux/windowOps.js +32 -0
  94. package/dist/lib/ui/popupSelect.js +432 -0
  95. package/dist/lib/ui/popupSupport.js +76 -0
  96. package/package.json +23 -0
  97. package/src/cli/commands/codex/forkHome.ts +141 -0
  98. package/src/cli/commands/codex/send.ts +83 -0
  99. package/src/cli/commands/codex/sessionInfo.ts +59 -0
  100. package/src/cli/commands/codex/spawn.ts +90 -0
  101. package/src/cli/commands/find.ts +40 -0
  102. package/src/cli/commands/paneKill.ts +49 -0
  103. package/src/cli/commands/paneSpawn.ts +53 -0
  104. package/src/cli/commands/paneTitle.ts +50 -0
  105. package/src/cli/commands/read.ts +48 -0
  106. package/src/cli/commands/send.ts +71 -0
  107. package/src/cli/commands/snapshot.ts +28 -0
  108. package/src/cli/commands/ui/select.ts +49 -0
  109. package/src/cli/commands/windowKill.ts +35 -0
  110. package/src/cli/commands/windowLs.ts +20 -0
  111. package/src/cli/commands/windowNew.ts +40 -0
  112. package/src/cli/commands/windowRename.ts +36 -0
  113. package/src/cli/index.ts +430 -0
  114. package/src/lib/codex/forkHome.ts +148 -0
  115. package/src/lib/codex/isCodexPane.ts +56 -0
  116. package/src/lib/codex/send.ts +84 -0
  117. package/src/lib/codex/sessionInfo.ts +521 -0
  118. package/src/lib/codex/spawn.ts +305 -0
  119. package/src/lib/contracts/types.ts +30 -0
  120. package/src/lib/fs/safeRm.ts +32 -0
  121. package/src/lib/io/readStdin.ts +11 -0
  122. package/src/lib/output/format.ts +105 -0
  123. package/src/lib/proc/lsof.ts +44 -0
  124. package/src/lib/proc/ps.ts +70 -0
  125. package/src/lib/targeting/errors.ts +25 -0
  126. package/src/lib/targeting/resolvePaneTarget.ts +106 -0
  127. package/src/lib/targeting/resolveWindowTarget.ts +45 -0
  128. package/src/lib/targeting/scope.ts +76 -0
  129. package/src/lib/tmux/capturePane.ts +21 -0
  130. package/src/lib/tmux/exec.ts +90 -0
  131. package/src/lib/tmux/paneOps.ts +35 -0
  132. package/src/lib/tmux/paste.ts +20 -0
  133. package/src/lib/tmux/sendKeys.ts +72 -0
  134. package/src/lib/tmux/session.ts +27 -0
  135. package/src/lib/tmux/snapshotPanes.ts +52 -0
  136. package/src/lib/tmux/snapshotWindows.ts +23 -0
  137. package/src/lib/tmux/windowOps.ts +43 -0
  138. package/src/lib/ui/popupSelect.ts +561 -0
  139. package/src/lib/ui/popupSupport.ts +84 -0
  140. package/tests/e2e/codexForkHome.test.ts +146 -0
  141. package/tests/e2e/codexSessionInfo.test.ts +112 -0
  142. package/tests/e2e/codexTuiSend.test.ts +68 -0
  143. package/tests/integration/codexSpawn.test.ts +113 -0
  144. package/tests/integration/paneOps.test.ts +60 -0
  145. package/tests/integration/sendRead.test.ts +52 -0
  146. package/tests/integration/snapshot.test.ts +39 -0
  147. package/tests/integration/tmuxHarness.ts +39 -0
  148. package/tests/integration/windowOps.test.ts +60 -0
  149. package/tests/unit/codexSend.test.ts +105 -0
  150. package/tests/unit/codexSessionInfo.test.ts +88 -0
  151. package/tests/unit/codexSpawn.test.ts +34 -0
  152. package/tests/unit/keys.test.ts +30 -0
  153. package/tests/unit/outputFormat.test.ts +52 -0
  154. package/tests/unit/popupSelect.test.ts +77 -0
  155. package/tests/unit/popupSupport.test.ts +109 -0
  156. package/tests/unit/resolvePaneTarget.test.ts +43 -0
  157. package/tests/unit/resolveWindowTarget.test.ts +36 -0
  158. package/tests/unit/safeRm.test.ts +41 -0
  159. package/tests/unit/scope.test.ts +57 -0
  160. package/tsconfig.json +14 -0
  161. package/vitest.config.ts +16 -0
@@ -0,0 +1,269 @@
1
+ ---
2
+
3
+ description: "Task list template for feature implementation"
4
+ ---
5
+
6
+ # Tasks: [FEATURE NAME]
7
+
8
+ **Input**: Design documents from `/specs/[###-feature-name]/`
9
+ **Prerequisites**: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/, notes/ (optional)
10
+
11
+ **Tests**: The examples below include test tasks. Tests are OPTIONAL by default - only include
12
+ them if explicitly requested in the feature specification, or if your project’s quality gates require
13
+ tests for this change. If a change touches performance-sensitive paths, include performance regression
14
+ defenses (baseline + guard) unless explicitly justified. If a change introduces breaking changes, include
15
+ a migration note task (plan.md / PR) and follow the project’s compatibility policy (do not add “silent”
16
+ compat layers unless they are explicitly planned).
17
+
18
+ **Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
19
+
20
+ ## Format: `[ID] [P?] [Story] Description`
21
+
22
+ - **[P]**: Can run in parallel (different files, no dependencies)
23
+ - **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
24
+ - Include exact file paths in descriptions
25
+
26
+ ## Path Conventions
27
+
28
+ - **Single project**: `src/`, `tests/` at repository root
29
+ - **Web app**: `backend/src/`, `frontend/src/`
30
+ - **Mobile**: `api/src/`, `ios/src/` or `android/src/`
31
+ - Paths shown below assume single project - adjust based on plan.md structure
32
+
33
+ <!--
34
+ ============================================================================
35
+ IMPORTANT: The tasks below are SAMPLE TASKS for illustration purposes only.
36
+
37
+ The $speckit tasks stage MUST replace these with actual tasks based on:
38
+ - User stories from spec.md (with their priorities P1, P2, P3...)
39
+ - Feature requirements from plan.md
40
+ - Entities from data-model.md
41
+ - Endpoints from contracts/
42
+
43
+ Tasks MUST be organized by user story so each story can be:
44
+ - Implemented independently
45
+ - Tested independently
46
+ - Delivered as an MVP increment
47
+
48
+ DO NOT keep these sample tasks in the generated tasks.md file.
49
+ ============================================================================
50
+ -->
51
+
52
+ ## Phase 1: Setup (Shared Infrastructure)
53
+
54
+ **Purpose**: Project initialization and basic structure
55
+
56
+ - [ ] T001 Create project structure per implementation plan
57
+ - [ ] T002 Initialize [language] project with [framework] dependencies
58
+ - [ ] T003 [P] Configure linting and formatting tools
59
+
60
+ ---
61
+
62
+ ## Phase 2: Foundational (Blocking Prerequisites)
63
+
64
+ **Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
65
+
66
+ **⚠️ CRITICAL**: No user story work can begin until this phase is complete
67
+
68
+ Examples of foundational tasks (adjust based on your project):
69
+
70
+ - [ ] T004 Setup database schema and migrations framework
71
+ - [ ] T005 [P] Implement authentication/authorization framework
72
+ - [ ] T006 [P] Setup API routing and middleware structure
73
+ - [ ] T007 Create base models/entities that all stories depend on
74
+ - [ ] T008 Configure error handling and logging infrastructure
75
+ - [ ] T00X [P] Define unified minimal IR + drift prevention (docs/specs + parser/codegen)
76
+ - [ ] T00X [P] Define deterministic identity model (instanceId/txnSeq/opId) and remove random/time defaults
77
+ - [ ] T00X [P] Enforce transaction boundary (no IO in txn window, no writable ref escape hatches)
78
+ - [ ] T00X [P] Define external reactive source integration: signal-dirty (pull-based), no render-level tearing (single snapshot anchor), and sharded notify to avoid O(N) selector work
79
+ - [ ] T00X [P] Encapsulate internal hooks as explicit injectable contracts (Runtime Services); avoid magic fields / parameter explosion; document migration in specs/[###-feature]/plan.md
80
+ - [ ] T00X [P] Normalize package public submodules: PascalCase `src/*.ts` (except `index.ts`/`global.d.ts`), move non-submodule code into `src/internal/**`, and keep `exports` from exposing internals
81
+ - [ ] T00X [P] Decompose oversized modules/files (≥1000 LOC or expected to exceed): define a decomposition brief (mutually exclusive submodules), pick structure (flat `*.*.ts` vs directory), keep refactor semantics-preserving, and add incremental verification checkpoints
82
+ - [ ] T00X [P] Add controlled trial-run harness (RunSession + Evidence/IR export) with schema validation; ensure parallel sessions are isolated
83
+ - [ ] T00X [P] Define performance budget + baseline measurement approach (benchmark/profile)
84
+ - [ ] T00X [P] Define diagnostic events/Devtools surfaces + expected overhead (enabled vs disabled)
85
+ - [ ] T00X [P] Provide user-facing performance mental model (≤5 keywords, cost model, optimization ladder) and align terminology across docs/benchmarks/diagnostics
86
+ - [ ] T009 Setup environment configuration management
87
+
88
+ **Checkpoint**: Foundation ready - user story implementation can now begin in parallel
89
+
90
+ ---
91
+
92
+ ## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP
93
+
94
+ **Goal**: [Brief description of what this story delivers]
95
+
96
+ **Independent Test**: [How to verify this story works on its own]
97
+
98
+ ### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️
99
+
100
+ > **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
101
+
102
+ - [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test\_[name].py
103
+ - [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test\_[name].py
104
+
105
+ ### Implementation for User Story 1
106
+
107
+ - [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
108
+ - [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
109
+ - [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
110
+ - [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
111
+ - [ ] T016 [US1] Add validation and error handling
112
+ - [ ] T017 [US1] Add logging for user story 1 operations
113
+
114
+ **Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
115
+
116
+ ---
117
+
118
+ ## Phase 4: User Story 2 - [Title] (Priority: P2)
119
+
120
+ **Goal**: [Brief description of what this story delivers]
121
+
122
+ **Independent Test**: [How to verify this story works on its own]
123
+
124
+ ### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️
125
+
126
+ - [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test\_[name].py
127
+ - [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test\_[name].py
128
+
129
+ ### Implementation for User Story 2
130
+
131
+ - [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
132
+ - [ ] T021 [US2] Implement [Service] in src/services/[service].py
133
+ - [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
134
+ - [ ] T023 [US2] Integrate with User Story 1 components (if needed)
135
+
136
+ **Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
137
+
138
+ ---
139
+
140
+ ## Phase 5: User Story 3 - [Title] (Priority: P3)
141
+
142
+ **Goal**: [Brief description of what this story delivers]
143
+
144
+ **Independent Test**: [How to verify this story works on its own]
145
+
146
+ ### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️
147
+
148
+ - [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test\_[name].py
149
+ - [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test\_[name].py
150
+
151
+ ### Implementation for User Story 3
152
+
153
+ - [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
154
+ - [ ] T027 [US3] Implement [Service] in src/services/[service].py
155
+ - [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
156
+
157
+ **Checkpoint**: All user stories should now be independently functional
158
+
159
+ ---
160
+
161
+ [Add more user story phases as needed, following the same pattern]
162
+
163
+ ---
164
+
165
+ ## Phase N: Polish & Cross-Cutting Concerns
166
+
167
+ **Purpose**: Improvements that affect multiple user stories
168
+
169
+ - [ ] TXXX [P] Documentation updates in docs/
170
+ - [ ] TXXX Code cleanup and refactoring
171
+ - [ ] TXXX Performance optimization across all stories
172
+ - [ ] TXXX Performance regression guard (bench/profile baseline + CI-friendly check if applicable)
173
+ - [ ] TXXX Diagnosability & explainability polish (events/trace/devtools UX + overhead validation)
174
+ - [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/
175
+ - [ ] TXXX Security hardening
176
+ - [ ] TXXX Run quickstart.md validation
177
+
178
+ ---
179
+
180
+ ## Dependencies & Execution Order
181
+
182
+ ### Phase Dependencies
183
+
184
+ - **Setup (Phase 1)**: No dependencies - can start immediately
185
+ - **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
186
+ - **User Stories (Phase 3+)**: All depend on Foundational phase completion
187
+ - User stories can then proceed in parallel (if staffed)
188
+ - Or sequentially in priority order (P1 → P2 → P3)
189
+ - **Polish (Final Phase)**: Depends on all desired user stories being complete
190
+
191
+ ### User Story Dependencies
192
+
193
+ - **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
194
+ - **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable
195
+ - **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable
196
+
197
+ ### Within Each User Story
198
+
199
+ - Tests (if included) MUST be written and FAIL before implementation
200
+ - Models before services
201
+ - Services before endpoints
202
+ - Core implementation before integration
203
+ - Story complete before moving to next priority
204
+
205
+ ### Parallel Opportunities
206
+
207
+ - All Setup tasks marked [P] can run in parallel
208
+ - All Foundational tasks marked [P] can run in parallel (within Phase 2)
209
+ - Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
210
+ - All tests for a user story marked [P] can run in parallel
211
+ - Models within a story marked [P] can run in parallel
212
+ - Different user stories can be worked on in parallel by different team members
213
+
214
+ ---
215
+
216
+ ## Parallel Example: User Story 1
217
+
218
+ ```bash
219
+ # Launch all tests for User Story 1 together (if tests requested):
220
+ Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
221
+ Task: "Integration test for [user journey] in tests/integration/test_[name].py"
222
+
223
+ # Launch all models for User Story 1 together:
224
+ Task: "Create [Entity1] model in src/models/[entity1].py"
225
+ Task: "Create [Entity2] model in src/models/[entity2].py"
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Implementation Strategy
231
+
232
+ ### MVP First (User Story 1 Only)
233
+
234
+ 1. Complete Phase 1: Setup
235
+ 2. Complete Phase 2: Foundational (CRITICAL - blocks all stories)
236
+ 3. Complete Phase 3: User Story 1
237
+ 4. **STOP and VALIDATE**: Test User Story 1 independently
238
+ 5. Deploy/demo if ready
239
+
240
+ ### Incremental Delivery
241
+
242
+ 1. Complete Setup + Foundational → Foundation ready
243
+ 2. Add User Story 1 → Test independently → Deploy/Demo (MVP!)
244
+ 3. Add User Story 2 → Test independently → Deploy/Demo
245
+ 4. Add User Story 3 → Test independently → Deploy/Demo
246
+ 5. Each story adds value without breaking previous stories
247
+
248
+ ### Parallel Team Strategy
249
+
250
+ With multiple developers:
251
+
252
+ 1. Team completes Setup + Foundational together
253
+ 2. Once Foundational is done:
254
+ - Developer A: User Story 1
255
+ - Developer B: User Story 2
256
+ - Developer C: User Story 3
257
+ 3. Stories complete and integrate independently
258
+
259
+ ---
260
+
261
+ ## Notes
262
+
263
+ - [P] tasks = different files, no dependencies
264
+ - [Story] label maps task to specific user story for traceability
265
+ - Each user story should be independently completable and testable
266
+ - Verify tests fail before implementing
267
+ - Commit after each task or logical group
268
+ - Stop at any checkpoint to validate story independently
269
+ - Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence
@@ -0,0 +1,183 @@
1
+ ---
2
+ description: Perform a post-implementation acceptance review by validating every coded point in spec.md against the current codebase.
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Goal
14
+
15
+ Run a “God View” acceptance pass **after implementation**: verify every coded point in `spec.md` (e.g., `FR-xxx`, `NFR-xxx`, `SC-xxx`) against the latest source code, and surface drift, conflicts, and missing coverage.
16
+
17
+ ## Operating Constraints
18
+
19
+ - **Default to READ-ONLY**: do **not** modify any files unless the user explicitly asks.
20
+ - **Parallel Work Safety (Non-Negotiable)**: Assume the working tree may contain unrelated, uncommitted changes from other parallel tasks.
21
+ - ABSOLUTELY PROHIBITED: any form of `git restore`, `git checkout -- <path>`, `git reset`, `git clean`, `git stash`.
22
+ - Avoid staging/committing/history rewriting unless explicitly requested by the user: `git add`, `git commit`, `git rebase`, `git merge`, `git cherry-pick`, `git push`.
23
+ - Read-only git commands are allowed (e.g., `git status`, `git diff`).
24
+ - **Evidence-driven**: Do not mark an item as PASS without pointing to concrete evidence (file paths / symbols / tests / commands).
25
+ - **Non-resident commands**: If unsure a command terminates, use `timeout 30s <command>` (or an equivalent one-shot invocation).
26
+
27
+ ## Execution Steps
28
+
29
+ ### 1) Initialize Context
30
+
31
+ This stage supports validating **one or multiple** specs in a single run.
32
+
33
+ **Target specs (multi-spec mode):**
34
+
35
+ - If `$ARGUMENTS` contains one or more feature ids (e.g. `026`, `026-my-feature`, `027`), treat them as targets.
36
+ - If `SPECIFY_FEATURE` is already set (e.g. when using `$speckit acceptance 026 027`), include it as a target as well.
37
+ - Target ordering (important): if both `SPECIFY_FEATURE` and `$ARGUMENTS` are present, treat `SPECIFY_FEATURE` as the **first** target, then append `$ARGUMENTS` tokens in order.
38
+ - De-duplicate targets; keep the resulting order.
39
+ - **Spec Group shorthand**: if a target feature is a “Spec Group” (its feature directory contains `spec-registry.json` or `spec-registry.md`), expand it into member specs (in registry order) by running:
40
+ `SKILL_DIR/scripts/bash/spec-group-members.sh <group> --json`
41
+ Then append its `members` immediately after the group target (de-duplicate). This enables a “group-id-only” shorthand while still running multi-spec acceptance.
42
+ - If no targets are provided, fall back to the inferred “current” feature (single-spec mode).
43
+
44
+ From repo root, set `REPO_ROOT="$(pwd)"` so you can form absolute paths consistently.
45
+
46
+ For **each** target feature, run:
47
+
48
+ `SKILL_DIR/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks --feature <id>`
49
+
50
+ Parse JSON for `FEATURE_DIR` and `AVAILABLE_DOCS`. All paths must be absolute.
51
+
52
+ Derive absolute paths:
53
+
54
+ - `SPEC = FEATURE_DIR/spec.md`
55
+ - `PLAN = FEATURE_DIR/plan.md`
56
+ - `TASKS = FEATURE_DIR/tasks.md`
57
+ - `CONSTITUTION = REPO_ROOT/.specify/memory/constitution.md`
58
+
59
+ Abort with a clear error if any required file is missing (and instruct which prerequisite command to run).
60
+ For single quotes in args like "I'm Groot", use escape syntax: e.g. `I'\''m Groot` (or double-quote if possible: `"I'm Groot"`).
61
+
62
+ ### 2) Optional Checklist Gate
63
+
64
+ For each `FEATURE_DIR`, if `FEATURE_DIR/checklists/` exists:
65
+
66
+ - Scan all checklist files in `checklists/`.
67
+ - For each checklist, count:
68
+ - Total items: lines matching `- [ ]` or `- [X]` or `- [x]`
69
+ - Completed items: lines matching `- [X]` or `- [x]`
70
+ - Incomplete items: lines matching `- [ ]`
71
+ - If any checklist is incomplete: **STOP** and ask whether to continue acceptance anyway.
72
+
73
+ ### 3) Load Artifacts (Progressive Disclosure)
74
+
75
+ - **REQUIRED (per spec)**: `spec.md`, `plan.md`, `tasks.md`
76
+ - **REQUIRED**: `.specify/memory/constitution.md` (for MUST/SHOULD validation)
77
+ - **IF EXISTS (per spec)**: `research.md`, `data-model.md`, `contracts/`, `quickstart.md`
78
+
79
+ From `spec.md`, load the minimum needed to extract and interpret coded points:
80
+
81
+ - Functional Requirements
82
+ - Non-Functional Requirements
83
+ - Success Criteria
84
+ - User Stories (only as supporting context)
85
+
86
+ ### 4) Build Coded Points Inventory (SSoT = spec.md)
87
+
88
+ Prefer a deterministic, script-backed inventory over ad-hoc grep.
89
+
90
+ **MUST** run `SKILL_DIR/scripts/bash/extract-coded-points.sh --json` once for all targets (repeat `--feature`):
91
+
92
+ `SKILL_DIR/scripts/bash/extract-coded-points.sh --json --feature 024 --feature 025`
93
+
94
+ Use the script output as the source-of-truth inventory:
95
+
96
+ - `points`: the canonical coded points list (**definitions** only; one row per code)
97
+ - `occurrences`: all mentions (includes cross-references like “see FR-004”)
98
+ - `duplicateDefinitions`: same code defined multiple times (treat as DRIFT/HIGH)
99
+ - `orphanReferences`: code referenced but never defined (treat as FAIL/HIGH)
100
+
101
+ Only fall back to manual search if the script fails or the spec format is non-standard.
102
+
103
+ ### 5) Determine Implementation Footprint
104
+
105
+ Prefer a deterministic, script-backed inventory over ad-hoc parsing.
106
+
107
+ **MUST** run `SKILL_DIR/scripts/bash/extract-tasks.sh --json` once for all targets (repeat `--feature`):
108
+
109
+ `SKILL_DIR/scripts/bash/extract-tasks.sh --json --feature 024 --feature 025`
110
+
111
+ Use the script output as the source-of-truth task inventory:
112
+
113
+ - `tasks`: task list with `done` status + phase/story/[P] + `refs` (if tasks lines contain `Refs:`)
114
+ - `counts` / `byPhase` / `byStory`
115
+ - `duplicates`: duplicate task ids (treat as DRIFT/HIGH)
116
+
117
+ Optionally (read-only), if the repo is a git repo:
118
+
119
+ - Use `git diff --name-only` (and/or `git status`) to list changed files
120
+ - Classify each changed file as “in-scope” (mentioned in tasks/plan) vs “out-of-scope” (potential drift / parallel work)
121
+
122
+ Do **not** assume the diff equals the feature; treat tasks/plan as the feature boundary and flag mismatches.
123
+
124
+ ### 6) Evidence Gathering Per Coded Point
125
+
126
+ For **each** coded point (e.g., `FR-001`), collect (per spec):
127
+
128
+ - **Implementation evidence**: file paths + key symbols or config knobs that implement it
129
+ - **Verification evidence**: tests (unit/integration/contract), quickstart steps, checklist items, or reproducible commands
130
+ - **Task linkage**: which task IDs implement/validate it (prefer explicit references; otherwise infer by text + file path overlap)
131
+ - **Drift check**:
132
+ - If code contradicts `spec.md` or `plan.md` → mark **DRIFT**
133
+ - If code conflicts with constitution MUSTs → mark **DRIFT (CRITICAL)**
134
+
135
+ If you cannot prove PASS, mark **PARTIAL/UNKNOWN** and explain what evidence is missing.
136
+
137
+ ### 7) Produce Acceptance Matrix (Compact, Exhaustive Over Codes)
138
+
139
+ Output acceptance matrices covering **every** coded point in **each** spec.
140
+
141
+ Important: In multi-spec mode, codes like `FR-001` are **not globally unique**. Always include the feature id (or spec directory) in the matrix key.
142
+
143
+ Recommended format:
144
+
145
+ | Feature | Code | Type | Status | Evidence | Verification | Task IDs | Notes / Drift |
146
+ | ------- | ---- | ---- | ------ | -------- | ------------ | -------- | ------------- |
147
+
148
+ Status must be one of:
149
+
150
+ - **PASS**: implemented + verified
151
+ - **PARTIAL**: implemented but missing verification / measurable criteria
152
+ - **FAIL**: not implemented
153
+ - **DRIFT**: implemented but contradicts spec/plan/constitution
154
+ - **UNKNOWN**: insufficient evidence to decide
155
+
156
+ ### 8) Cross-Cutting Checks
157
+
158
+ - **Plan alignment**: major architecture choices, dependencies, and project structure still match the codebase.
159
+ - **NFR coverage**: performance budgets/baselines and diagnosability requirements are reflected in code/tests/docs.
160
+ - **Constitution alignment**: only flag what’s actually applicable, but treat MUST violations as CRITICAL.
161
+ - **Cross-spec conflicts (multi-spec mode)**: highlight any contradictory requirements/plans, shared-file contention, or API/contract drift between the target specs.
162
+
163
+ ### 9) Quality Gates (One-Shot)
164
+
165
+ - Prefer explicit “quality gates” commands written in `plan.md`.
166
+ - If missing, infer the minimal one-shot checks from repo conventions (e.g., `typecheck` / `lint` / `test`) and run them once (avoid watch mode).
167
+ - Record PASS/FAIL and a short blocker summary (no walls of logs).
168
+
169
+ ### 10) Next Actions
170
+
171
+ Provide a prioritized list:
172
+
173
+ - CRITICAL drift to resolve first
174
+ - Missing coded points
175
+ - Missing verification (tests/bench/diagnostics)
176
+
177
+ Ask the user:
178
+
179
+ “Do you want me to turn the top N gaps into concrete follow-up tasks (and where should they live: append to `tasks.md` vs a separate follow-up file)?”
180
+
181
+ ## Context
182
+
183
+ $ARGUMENTS
@@ -0,0 +1,186 @@
1
+ ---
2
+ description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Goal
14
+
15
+ Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `$speckit tasks` has successfully produced a complete `tasks.md`.
16
+
17
+ ## Operating Constraints
18
+
19
+ **STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
20
+
21
+ **Parallel Work Safety (Non-Negotiable)**: Assume the working tree may contain unrelated changes from other concurrent tasks. Never run any command that discards or rewrites changes (e.g., any form of `git restore`, `git checkout -- <path>`, `git reset`, `git clean`, `git stash`).
22
+
23
+ **Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `$speckit analyze`.
24
+
25
+ ## Execution Steps
26
+
27
+ ### 1. Initialize Analysis Context
28
+
29
+ Run `SKILL_DIR/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. If you need to target a specific spec by number/id, add `--feature 025` (or `--feature 025-my-feature`). Derive absolute paths:
30
+
31
+ - SPEC = FEATURE_DIR/spec.md
32
+ - PLAN = FEATURE_DIR/plan.md
33
+ - TASKS = FEATURE_DIR/tasks.md
34
+
35
+ Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
36
+ For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
37
+
38
+ ### 2. Load Artifacts (Progressive Disclosure)
39
+
40
+ Load only the minimal necessary context from each artifact:
41
+
42
+ **From spec.md:**
43
+
44
+ - Overview/Context
45
+ - Functional Requirements
46
+ - Non-Functional Requirements
47
+ - User Stories
48
+ - Edge Cases (if present)
49
+
50
+ **From plan.md:**
51
+
52
+ - Architecture/stack choices
53
+ - Data Model references
54
+ - Phases
55
+ - Technical constraints
56
+
57
+ **From tasks.md:**
58
+
59
+ - Task IDs
60
+ - Descriptions
61
+ - Phase grouping
62
+ - Parallel markers [P]
63
+ - Referenced file paths
64
+
65
+ **From constitution:**
66
+
67
+ - Load `.specify/memory/constitution.md` for principle validation
68
+
69
+ ### 3. Build Semantic Models
70
+
71
+ Create internal representations (do not include raw artifacts in output):
72
+
73
+ - **Requirements inventory**: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" → `user-can-upload-file`)
74
+ - **User story/action inventory**: Discrete user actions with acceptance criteria
75
+ - **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
76
+ - **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
77
+
78
+ ### 4. Detection Passes (Token-Efficient Analysis)
79
+
80
+ Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
81
+
82
+ #### A. Duplication Detection
83
+
84
+ - Identify near-duplicate requirements
85
+ - Mark lower-quality phrasing for consolidation
86
+
87
+ #### B. Ambiguity Detection
88
+
89
+ - Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
90
+ - Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
91
+
92
+ #### C. Underspecification
93
+
94
+ - Requirements with verbs but missing object or measurable outcome
95
+ - User stories missing acceptance criteria alignment
96
+ - Tasks referencing files or components not defined in spec/plan
97
+
98
+ #### D. Constitution Alignment
99
+
100
+ - Any requirement or plan element conflicting with a MUST principle
101
+ - Missing mandated sections or quality gates from constitution
102
+
103
+ #### E. Coverage Gaps
104
+
105
+ - Requirements with zero associated tasks
106
+ - Tasks with no mapped requirement/story
107
+ - Non-functional requirements not reflected in tasks (e.g., performance, security)
108
+
109
+ #### F. Inconsistency
110
+
111
+ - Terminology drift (same concept named differently across files)
112
+ - Data entities referenced in plan but absent in spec (or vice versa)
113
+ - Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
114
+ - Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
115
+
116
+ ### 5. Severity Assignment
117
+
118
+ Use this heuristic to prioritize findings:
119
+
120
+ - **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
121
+ - **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
122
+ - **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
123
+ - **LOW**: Style/wording improvements, minor redundancy not affecting execution order
124
+
125
+ ### 6. Produce Compact Analysis Report
126
+
127
+ Output a Markdown report (no file writes) with the following structure:
128
+
129
+ ## Specification Analysis Report
130
+
131
+ | ID | Category | Severity | Location(s) | Summary | Recommendation |
132
+ | --- | ----------- | -------- | ---------------- | ---------------------------- | ------------------------------------ |
133
+ | A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
134
+
135
+ (Add one row per finding; generate stable IDs prefixed by category initial.)
136
+
137
+ **Coverage Summary Table:**
138
+
139
+ | Requirement Key | Has Task? | Task IDs | Notes |
140
+ | --------------- | --------- | -------- | ----- |
141
+
142
+ **Constitution Alignment Issues:** (if any)
143
+
144
+ **Unmapped Tasks:** (if any)
145
+
146
+ **Metrics:**
147
+
148
+ - Total Requirements
149
+ - Total Tasks
150
+ - Coverage % (requirements with >=1 task)
151
+ - Ambiguity Count
152
+ - Duplication Count
153
+ - Critical Issues Count
154
+
155
+ ### 7. Provide Next Actions
156
+
157
+ At end of report, output a concise Next Actions block:
158
+
159
+ - If CRITICAL issues exist: Recommend resolving before `$speckit implement`
160
+ - If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
161
+ - Provide explicit command suggestions: e.g., "Run $speckit specify with refinement", "Run $speckit plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
162
+
163
+ ### 8. Offer Remediation
164
+
165
+ Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
166
+
167
+ ## Operating Principles
168
+
169
+ ### Context Efficiency
170
+
171
+ - **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
172
+ - **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
173
+ - **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
174
+ - **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
175
+
176
+ ### Analysis Guidelines
177
+
178
+ - **NEVER modify files** (this is read-only analysis)
179
+ - **NEVER hallucinate missing sections** (if absent, report them accurately)
180
+ - **Prioritize constitution violations** (these are always CRITICAL)
181
+ - **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
182
+ - **Report zero issues gracefully** (emit success report with coverage statistics)
183
+
184
+ ## Context
185
+
186
+ $ARGUMENTS