@aperant/framework 0.6.3 → 0.6.5

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 (244) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +64 -10
  3. package/agents/apt-improver.md +99 -0
  4. package/agents/apt-planner.md +115 -10
  5. package/dist/__test-helpers/run-cmd.d.mts +4 -2
  6. package/dist/__test-helpers/run-cmd.d.mts.map +1 -1
  7. package/dist/__test-helpers/run-cmd.mjs +56 -15
  8. package/dist/__test-helpers/run-cmd.mjs.map +1 -1
  9. package/dist/cli/artifacts/classification.d.mts.map +1 -1
  10. package/dist/cli/artifacts/classification.mjs +10 -0
  11. package/dist/cli/artifacts/classification.mjs.map +1 -1
  12. package/dist/cli/ci-watch/lock.d.mts +53 -0
  13. package/dist/cli/ci-watch/lock.d.mts.map +1 -0
  14. package/dist/cli/ci-watch/lock.mjs +172 -0
  15. package/dist/cli/ci-watch/lock.mjs.map +1 -0
  16. package/dist/cli/ci-watch/state.d.mts +36 -0
  17. package/dist/cli/ci-watch/state.d.mts.map +1 -0
  18. package/dist/cli/ci-watch/state.mjs +103 -0
  19. package/dist/cli/ci-watch/state.mjs.map +1 -0
  20. package/dist/cli/ci-watch/stop-matrix.d.mts +58 -0
  21. package/dist/cli/ci-watch/stop-matrix.d.mts.map +1 -0
  22. package/dist/cli/ci-watch/stop-matrix.mjs +164 -0
  23. package/dist/cli/ci-watch/stop-matrix.mjs.map +1 -0
  24. package/dist/cli/cli-wrappers/ci-watch.d.mts +2 -0
  25. package/dist/cli/cli-wrappers/ci-watch.d.mts.map +1 -0
  26. package/dist/cli/cli-wrappers/ci-watch.mjs +9 -0
  27. package/dist/cli/cli-wrappers/ci-watch.mjs.map +1 -0
  28. package/dist/cli/commands/adr.d.mts +5 -0
  29. package/dist/cli/commands/adr.d.mts.map +1 -0
  30. package/dist/cli/commands/adr.mjs +228 -0
  31. package/dist/cli/commands/adr.mjs.map +1 -0
  32. package/dist/cli/commands/ci-watch.d.mts +7 -0
  33. package/dist/cli/commands/ci-watch.d.mts.map +1 -0
  34. package/dist/cli/commands/ci-watch.mjs +465 -0
  35. package/dist/cli/commands/ci-watch.mjs.map +1 -0
  36. package/dist/cli/commands/context.d.mts +7 -0
  37. package/dist/cli/commands/context.d.mts.map +1 -0
  38. package/dist/cli/commands/context.mjs +224 -0
  39. package/dist/cli/commands/context.mjs.map +1 -0
  40. package/dist/cli/commands/event.d.mts.map +1 -1
  41. package/dist/cli/commands/event.mjs +59 -24
  42. package/dist/cli/commands/event.mjs.map +1 -1
  43. package/dist/cli/commands/host-detect.d.mts +1 -1
  44. package/dist/cli/commands/host-detect.d.mts.map +1 -1
  45. package/dist/cli/commands/host-detect.mjs +30 -3
  46. package/dist/cli/commands/host-detect.mjs.map +1 -1
  47. package/dist/cli/commands/init.d.mts.map +1 -1
  48. package/dist/cli/commands/init.mjs +73 -5
  49. package/dist/cli/commands/init.mjs.map +1 -1
  50. package/dist/cli/commands/modes.d.mts +13 -0
  51. package/dist/cli/commands/modes.d.mts.map +1 -0
  52. package/dist/cli/commands/modes.mjs +220 -0
  53. package/dist/cli/commands/modes.mjs.map +1 -0
  54. package/dist/cli/commands/pr-review-audit-fixer.d.mts +41 -2
  55. package/dist/cli/commands/pr-review-audit-fixer.d.mts.map +1 -1
  56. package/dist/cli/commands/pr-review-audit-fixer.mjs +91 -14
  57. package/dist/cli/commands/pr-review-audit-fixer.mjs.map +1 -1
  58. package/dist/cli/commands/route.d.mts.map +1 -1
  59. package/dist/cli/commands/route.mjs +11 -2
  60. package/dist/cli/commands/route.mjs.map +1 -1
  61. package/dist/cli/commands/task.d.mts.map +1 -1
  62. package/dist/cli/commands/task.mjs +136 -6
  63. package/dist/cli/commands/task.mjs.map +1 -1
  64. package/dist/cli/commands/tokens.d.mts.map +1 -1
  65. package/dist/cli/commands/tokens.mjs +150 -6
  66. package/dist/cli/commands/tokens.mjs.map +1 -1
  67. package/dist/cli/commands/triage.d.mts +8 -0
  68. package/dist/cli/commands/triage.d.mts.map +1 -0
  69. package/dist/cli/commands/triage.mjs +259 -0
  70. package/dist/cli/commands/triage.mjs.map +1 -0
  71. package/dist/cli/config/post-merge-sweep.d.mts +18 -0
  72. package/dist/cli/config/post-merge-sweep.d.mts.map +1 -1
  73. package/dist/cli/config/post-merge-sweep.mjs +48 -3
  74. package/dist/cli/config/post-merge-sweep.mjs.map +1 -1
  75. package/dist/cli/consistency/registry.d.mts +11 -0
  76. package/dist/cli/consistency/registry.d.mts.map +1 -1
  77. package/dist/cli/consistency/registry.mjs +13 -0
  78. package/dist/cli/consistency/registry.mjs.map +1 -1
  79. package/dist/cli/coordination/agent-identity.d.mts +9 -0
  80. package/dist/cli/coordination/agent-identity.d.mts.map +1 -1
  81. package/dist/cli/coordination/agent-identity.mjs +11 -0
  82. package/dist/cli/coordination/agent-identity.mjs.map +1 -1
  83. package/dist/cli/coordination/event-log.d.mts +27 -0
  84. package/dist/cli/coordination/event-log.d.mts.map +1 -1
  85. package/dist/cli/coordination/event-log.mjs +72 -2
  86. package/dist/cli/coordination/event-log.mjs.map +1 -1
  87. package/dist/cli/design/frontmatter-schema.d.mts +3 -3
  88. package/dist/cli/design/frontmatter-schema.d.mts.map +1 -1
  89. package/dist/cli/design/frontmatter-schema.mjs +3 -1
  90. package/dist/cli/design/frontmatter-schema.mjs.map +1 -1
  91. package/dist/cli/dispatch.d.mts.map +1 -1
  92. package/dist/cli/dispatch.mjs +14 -1
  93. package/dist/cli/dispatch.mjs.map +1 -1
  94. package/dist/cli/gate/registry.d.mts +11 -0
  95. package/dist/cli/gate/registry.d.mts.map +1 -1
  96. package/dist/cli/gate/registry.mjs +13 -0
  97. package/dist/cli/gate/registry.mjs.map +1 -1
  98. package/dist/cli/help.d.mts.map +1 -1
  99. package/dist/cli/help.mjs +1 -0
  100. package/dist/cli/help.mjs.map +1 -1
  101. package/dist/cli/host/detect.d.mts +1 -0
  102. package/dist/cli/host/detect.d.mts.map +1 -1
  103. package/dist/cli/host/detect.mjs +5 -0
  104. package/dist/cli/host/detect.mjs.map +1 -1
  105. package/dist/cli/route/envelope.d.mts +68 -4
  106. package/dist/cli/route/envelope.d.mts.map +1 -1
  107. package/dist/cli/route/envelope.mjs +140 -103
  108. package/dist/cli/route/envelope.mjs.map +1 -1
  109. package/dist/cli/route/skill-discover.d.mts +11 -0
  110. package/dist/cli/route/skill-discover.d.mts.map +1 -1
  111. package/dist/cli/route/skill-discover.mjs +46 -1
  112. package/dist/cli/route/skill-discover.mjs.map +1 -1
  113. package/dist/cli/skill-author/contract.d.mts +20 -0
  114. package/dist/cli/skill-author/contract.d.mts.map +1 -1
  115. package/dist/cli/skill-author/contract.mjs +27 -0
  116. package/dist/cli/skill-author/contract.mjs.map +1 -1
  117. package/dist/cli/skill-author/skill-template.d.mts.map +1 -1
  118. package/dist/cli/skill-author/skill-template.mjs +4 -3
  119. package/dist/cli/skill-author/skill-template.mjs.map +1 -1
  120. package/dist/cli/task/worktree-cleanup.d.mts +9 -1
  121. package/dist/cli/task/worktree-cleanup.d.mts.map +1 -1
  122. package/dist/cli/task/worktree-cleanup.mjs +190 -9
  123. package/dist/cli/task/worktree-cleanup.mjs.map +1 -1
  124. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  125. package/dist/plugin/agents/apt-planner.md +1 -1
  126. package/dist/plugin/skills/apt/SKILL.md +111 -5
  127. package/dist/plugin/skills/apt-author-skill/SKILL.md +11 -0
  128. package/dist/plugin/skills/apt-bootstrap/SKILL.md +1 -0
  129. package/dist/plugin/skills/apt-classify/SKILL.md +1 -0
  130. package/dist/plugin/skills/apt-close-task/SKILL.md +1 -0
  131. package/dist/plugin/skills/apt-create-docs/SKILL.md +1 -0
  132. package/dist/plugin/skills/apt-debug/SKILL.md +2 -0
  133. package/dist/plugin/skills/apt-design/SKILL.md +2 -0
  134. package/dist/plugin/skills/apt-discuss/SKILL.md +2 -0
  135. package/dist/plugin/skills/apt-docs/SKILL.md +2 -0
  136. package/dist/plugin/skills/apt-execute/SKILL.md +1 -0
  137. package/dist/plugin/skills/apt-mockup/SKILL.md +2 -0
  138. package/dist/plugin/skills/apt-pause/SKILL.md +1 -0
  139. package/dist/plugin/skills/apt-personas/SKILL.md +1 -0
  140. package/dist/plugin/skills/apt-plan/SKILL.md +2 -0
  141. package/dist/plugin/skills/apt-pr-review/SKILL.md +1 -0
  142. package/dist/plugin/skills/apt-quick/SKILL.md +2 -0
  143. package/dist/plugin/skills/apt-resume/SKILL.md +1 -0
  144. package/dist/plugin/skills/apt-review/SKILL.md +1 -0
  145. package/dist/plugin/skills/apt-roadmap/SKILL.md +1 -0
  146. package/dist/plugin/skills/apt-roundtable/SKILL.md +2 -0
  147. package/dist/plugin/skills/apt-run/SKILL.md +1 -0
  148. package/dist/plugin/skills/apt-scan/SKILL.md +1 -0
  149. package/dist/plugin/skills/apt-setup/SKILL.md +1 -0
  150. package/dist/plugin/skills/apt-ship/SKILL.md +6 -5
  151. package/dist/plugin/skills/apt-stress-test/SKILL.md +1 -0
  152. package/dist/plugin/skills/apt-terminal/SKILL.md +1 -0
  153. package/dist/plugin/skills/apt-update/SKILL.md +5 -0
  154. package/dist/plugin/skills/apt-verify/SKILL.md +1 -0
  155. package/dist/plugin/skills/apt-verify-proof/SKILL.md +1 -0
  156. package/dist/types/config.d.ts +85 -0
  157. package/dist/types/config.d.ts.map +1 -1
  158. package/package.json +125 -122
  159. package/prompts/coder.md +2 -0
  160. package/prompts/planner.md +12 -0
  161. package/prompts/spec_writer.md +9 -0
  162. package/skills/apt/SKILL.md +112 -5
  163. package/skills/apt-author-skill/SKILL.md +11 -0
  164. package/skills/apt-bootstrap/SKILL.md +1 -0
  165. package/skills/apt-classify/SKILL.md +1 -0
  166. package/skills/apt-close-task/SKILL.md +33 -1
  167. package/skills/apt-create-docs/SKILL.md +1 -0
  168. package/skills/apt-debug/SKILL.md +41 -6
  169. package/skills/apt-debug/appendices/diagnose-discipline.md +119 -0
  170. package/skills/apt-design/SKILL.md +2 -0
  171. package/skills/apt-diagram/SKILL.md +342 -0
  172. package/skills/apt-diagram/appendices/design-discipline.md +97 -0
  173. package/skills/apt-discuss/SKILL.md +27 -0
  174. package/skills/apt-discuss/appendices/grill-discipline.md +104 -0
  175. package/skills/apt-discuss/appendices/zoom-out-helper.md +79 -0
  176. package/skills/apt-docs/SKILL.md +2 -0
  177. package/skills/apt-execute/SKILL.md +49 -5
  178. package/skills/apt-execute/appendices/tdd-mode.md +107 -0
  179. package/skills/apt-improve/DEEPENING.md +84 -0
  180. package/skills/apt-improve/INTERFACE-DESIGN.md +97 -0
  181. package/skills/apt-improve/LANGUAGE.md +104 -0
  182. package/skills/apt-improve/SKILL.md +141 -0
  183. package/skills/apt-mockup/SKILL.md +2 -0
  184. package/skills/apt-pause/SKILL.md +1 -0
  185. package/skills/apt-personas/SKILL.md +1 -0
  186. package/skills/apt-plan/SKILL.md +149 -4
  187. package/skills/apt-planner.md +42 -1
  188. package/skills/apt-pr-review/SKILL.md +47 -16
  189. package/skills/apt-prototype/LOGIC.md +109 -0
  190. package/skills/apt-prototype/SKILL.md +143 -0
  191. package/skills/apt-prototype/UI.md +90 -0
  192. package/skills/apt-quick/SKILL.md +32 -0
  193. package/skills/apt-resume/SKILL.md +1 -0
  194. package/skills/apt-review/SKILL.md +3 -0
  195. package/skills/apt-roadmap/SKILL.md +1 -0
  196. package/skills/apt-roundtable/SKILL.md +2 -0
  197. package/skills/apt-run/SKILL.md +33 -4
  198. package/skills/apt-scan/SKILL.md +1 -0
  199. package/skills/apt-setup/SKILL.md +129 -2
  200. package/skills/apt-ship/SKILL.md +52 -4
  201. package/skills/apt-stress-test/SKILL.md +1 -0
  202. package/skills/apt-terminal/SKILL.md +1 -0
  203. package/skills/apt-triage/AGENT-BRIEF.md +84 -0
  204. package/skills/apt-triage/OUT-OF-SCOPE.md +75 -0
  205. package/skills/apt-triage/SKILL.md +169 -0
  206. package/skills/apt-update/SKILL.md +3 -0
  207. package/skills/apt-verify/SKILL.md +4 -0
  208. package/skills/apt-verify-proof/SKILL.md +4 -0
  209. package/skills/apt-watch-ci/SKILL.md +163 -0
  210. package/skills/apt-zoom-out/SKILL.md +130 -0
  211. package/src/cli/artifacts/classification.mjs +10 -0
  212. package/src/cli/ci-watch/lock.mjs +178 -0
  213. package/src/cli/ci-watch/state.mjs +103 -0
  214. package/src/cli/ci-watch/stop-matrix.mjs +181 -0
  215. package/src/cli/cli-wrappers/ci-watch.mjs +9 -0
  216. package/src/cli/commands/adr.mjs +243 -0
  217. package/src/cli/commands/ci-watch.mjs +503 -0
  218. package/src/cli/commands/context.mjs +244 -0
  219. package/src/cli/commands/event.mjs +63 -24
  220. package/src/cli/commands/host-detect.mjs +33 -7
  221. package/src/cli/commands/init.mjs +83 -5
  222. package/src/cli/commands/modes.mjs +215 -0
  223. package/src/cli/commands/pr-review-audit-fixer.mjs +95 -16
  224. package/src/cli/commands/route.mjs +11 -2
  225. package/src/cli/commands/task.mjs +152 -18
  226. package/src/cli/commands/tokens.mjs +157 -6
  227. package/src/cli/commands/triage.mjs +277 -0
  228. package/src/cli/config/post-merge-sweep.mjs +49 -3
  229. package/src/cli/consistency/registry.mjs +14 -0
  230. package/src/cli/coordination/agent-identity.mjs +12 -0
  231. package/src/cli/coordination/event-log.mjs +73 -2
  232. package/src/cli/design/frontmatter-schema.mjs +3 -1
  233. package/src/cli/dispatch.mjs +15 -1
  234. package/src/cli/gate/registry.mjs +14 -0
  235. package/src/cli/help.mjs +1 -0
  236. package/src/cli/host/detect.mjs +5 -0
  237. package/src/cli/route/envelope.mjs +140 -106
  238. package/src/cli/route/skill-discover.mjs +46 -1
  239. package/src/cli/skill-author/contract.mjs +29 -0
  240. package/src/cli/skill-author/skill-template.mjs +4 -3
  241. package/src/cli/task/worktree-cleanup.mjs +191 -9
  242. package/templates/adr-format.md +56 -0
  243. package/templates/config.json +4 -0
  244. package/templates/context-format.md +34 -0
@@ -9,6 +9,8 @@ user_invocable: true
9
9
  internal: false
10
10
  spawns_agent: true
11
11
  agent_name: "apt-planner"
12
+ task_context: create-new
13
+ default_track: STANDARD
12
14
  default_execution_mode: auto
13
15
  execution_modes:
14
16
  - auto
@@ -108,7 +110,17 @@ If `{task_dir}/design.md` exists (emitted by a prior `/apt:design` run), load it
108
110
 
109
111
  ## 5. Write Specification
110
112
 
111
- Create `spec.md` in the task directory (`{task_dir}` passed from the router, e.g. `.aperant/tasks/{task-id}/spec.md`):
113
+ Create `spec.md` in the task directory (`{task_dir}` passed from the router, e.g. `.aperant/tasks/{task-id}/spec.md`).
114
+
115
+ **Content format branches on track (Fast Path Guarantee — Pocock adoption ID-05):**
116
+
117
+ ### 5.A. QUICK track — legacy 4-section format (hard-exempt from PRD upgrade)
118
+
119
+ When `track === "QUICK"` (the `apt:classify` rubric routed this as a one-shot
120
+ task) OR the complexity is `SIMPLE`, write the existing minimal 4-section
121
+ spec. Do NOT promote to PRD shape. The QUICK path is a constraint, not a
122
+ toggle — the user opted into one-shot speed; PRD ceremony would violate
123
+ that contract.
112
124
 
113
125
  ```markdown
114
126
  # Task: {task description}
@@ -129,6 +141,79 @@ Create `spec.md` in the task directory (`{task_dir}` passed from the router, e.g
129
141
  {What this task explicitly does NOT cover}
130
142
  ```
131
143
 
144
+ ### 5.B. STANDARD / DEEP / COMPLEX tracks — PRD-shaped spec.md
145
+
146
+ When `track ∈ {"STANDARD", "DEEP"}` OR complexity is `STANDARD` or
147
+ `COMPLEX`, write a PRD-shaped spec.md so the artifact survives the task
148
+ and is committable as a second-consumer document. Section ordering is
149
+ **load-bearing** — downstream tooling (`apt-tools coverage-check`,
150
+ `apt-tools consistency check`) reads sections by header.
151
+
152
+ ```markdown
153
+ # Spec: {task title}
154
+
155
+ **Task ID:** {task-id}
156
+ **Track:** {STANDARD | DEEP}
157
+ **Scope:** {framework | desktop | web | core | ui | backend | docs}
158
+
159
+ ## Problem Statement
160
+
161
+ {What pain are we solving? Cite empirical evidence, prior decisions, or
162
+ codebase artifacts where possible. State what's broken or missing today.}
163
+
164
+ ## Solution
165
+
166
+ {One paragraph: the chosen approach. Then a bulleted net delta of what
167
+ ships: new files, modified files, new flags, new config, new skills.}
168
+
169
+ ## User Stories
170
+
171
+ {One story per user value slice. Format: "**US-NN (persona).** As a
172
+ {persona}, when I {trigger}, I want {behavior} so I can {outcome}."
173
+ Stories map 1:1 onto subtasks in implementation_plan.json.}
174
+
175
+ ## Implementation Decisions
176
+
177
+ {Load-bearing principles carried forward into every subtask. Format:
178
+ "### ID-NN: {decision title}" + rationale + practical consequence. Each
179
+ ID-NN is referenced from subtask descriptions where relevant.}
180
+
181
+ ## Testing Decisions
182
+
183
+ {One block per test family: "### TD-NN: {test family name}" + what's
184
+ covered + which subtask owns the test file. Critical: Fast Path Guarantee
185
+ regression tests (QUICK-exempt assertions) MUST be enumerated here.}
186
+
187
+ ## Out of Scope
188
+
189
+ {Explicit non-goals. Each bullet names what is deferred + where it
190
+ belongs (parallel track, v2 follow-up, separate task).}
191
+
192
+ ## Further Notes
193
+
194
+ {Sequencing rationale, risk surface, dependencies on other parts of the
195
+ codebase, files-affected preview, and any other context the executor
196
+ needs but that doesn't fit the seven primary sections.}
197
+
198
+ ### Acceptance Criteria
199
+
200
+ {Cross-cutting AC1..ACN list — each acceptance criterion gets a stable
201
+ ID. Subtasks reference these IDs via their per-subtask
202
+ `acceptance_criteria` field (see Section 6). This list IS the
203
+ plan-coverage-check input.}
204
+ ```
205
+
206
+ **Constraint — do NOT interview the user.** The PRD is synthesized from
207
+ the task description + codebase investigation + AGENTS.md, not from a
208
+ clarifying interview. If a section truly cannot be filled, write
209
+ `{TBD — needs user input}` so the gap is visible; do NOT pause for
210
+ clarification (that's `apt:discuss`'s job, not the planner's).
211
+
212
+ **Section ordering is mandatory.** `apt-tools coverage-check validate`
213
+ greps `## Acceptance Criteria` for AC IDs; `apt-tools consistency check`
214
+ greps `## Solution` and `## User Stories`. Renaming or reordering these
215
+ breaks downstream tooling.
216
+
132
217
  ### 5.1. Design Reference section (C24 — when design.md exists)
133
218
 
134
219
  When `{task_dir}/design.md` exists, `spec.md` MUST include a `## Design Reference` section **directly below `## Requirements`**. The section cites the design artifact by relative path and enumerates which screens and components the subtasks cover. Shape:
@@ -210,35 +295,95 @@ When `status: warn` (non-blocking enforcement) and the user is in **auto mode**
210
295
 
211
296
  ## 6. Create Implementation Plan
212
297
 
213
- Create `implementation_plan.json` in the task directory (`{task_dir}/implementation_plan.json`):
298
+ Create `implementation_plan.json` in the task directory (`{task_dir}/implementation_plan.json`).
299
+
300
+ **Subtask schema branches on track (Pocock adoption ID-05 — Fast Path Guarantee).**
301
+
302
+ ### 6.A. QUICK track / SIMPLE complexity — legacy flat subtask schema
303
+
304
+ ```json
305
+ {
306
+ "task": "{task description}",
307
+ "complexity": "simple",
308
+ "spec": "spec.md",
309
+ "subtasks": [
310
+ {
311
+ "id": "1",
312
+ "title": "{subtask title}",
313
+ "description": "{what to do — concrete, not vague}",
314
+ "files": ["path/to/file1.ts", "path/to/file2.ts"],
315
+ "dependencies": [],
316
+ "status": "pending",
317
+ "verification": "{command or check to verify completion}"
318
+ }
319
+ ]
320
+ }
321
+ ```
322
+
323
+ QUICK subtasks omit `hitl`, `afk`, `acceptance_criteria`, and `user_value`
324
+ fields. The one-shot path doesn't need user-value framing or per-subtask
325
+ HITL gates.
326
+
327
+ ### 6.B. STANDARD / DEEP / COMPLEX — vertical-slice subtask schema
214
328
 
215
329
  ```json
216
330
  {
217
331
  "task": "{task description}",
218
- "complexity": "simple|standard|complex",
332
+ "complexity": "standard|complex",
219
333
  "spec": "spec.md",
334
+ "vertical_slice_schema_version": "1",
220
335
  "declared_persona_tier": "primary",
221
336
  "declared_personas": ["mobile-dev"],
222
337
  "tier_confidence": "high",
223
338
  "subtasks": [
224
339
  {
225
340
  "id": "1",
226
- "title": "{subtask title}",
341
+ "title": "{subtask title — user-value framing, not 'add UI'}",
227
342
  "description": "{what to do — concrete, not vague}",
228
343
  "files": ["path/to/file1.ts", "path/to/file2.ts"],
344
+ "acceptance_criteria": ["AC1", "AC3"],
229
345
  "dependencies": [],
230
346
  "status": "pending",
347
+ "hitl": "required | review | none",
348
+ "afk": "safe | unsafe",
349
+ "user_value": "{one-line user-value framing — who benefits, how}",
231
350
  "verification": "{command or check to verify completion}"
232
351
  }
233
352
  ]
234
353
  }
235
354
  ```
236
355
 
356
+ **Mandatory STANDARD/DEEP fields (per subtask):**
357
+
358
+ - `hitl` — `"required" | "review" | "none"`. `required` means a human MUST
359
+ approve the subtask before proceeding (autonomy 1 always pauses;
360
+ autonomy 2 batches recommendations; autonomy 3 escalates only on
361
+ conflict). `review` means the human reviews the diff after the agent
362
+ ships it (post-hoc, not blocking). `none` means agent-only.
363
+ - `afk` — `"safe" | "unsafe"`. `safe` means the agent may proceed
364
+ unattended without supervision. `unsafe` means the agent should pause
365
+ at the start of this subtask if no human is present (autonomy < 3).
366
+ - `acceptance_criteria` — `string[]` of id-refs (`"AC1"`, `"AC3"`, …)
367
+ into the spec.md `## Acceptance Criteria` section. Every AC in spec.md
368
+ MUST be referenced by at least one subtask (gate G8 consistency-check
369
+ enforces this on ship).
370
+ - `user_value` — one-line framing of WHO benefits and HOW. Prevents
371
+ horizontal slicing ("add UI" / "add backend") — every subtask must be
372
+ a vertical user-shippable slice with a defensible value framing.
373
+
374
+ **Plan-level fields for STANDARD/DEEP:**
375
+
376
+ - `vertical_slice_schema_version` — `"1"` (current). Stable across the
377
+ v1 schema window; bumped when the subtask shape changes incompatibly.
378
+ Plans without this field are treated as legacy flat schema.
379
+
237
380
  Reference `prompts/planner.md` for subtask decomposition patterns:
238
381
  - Each subtask should be completable in one focused session
239
382
  - Dependencies must form a DAG (no circular deps)
240
383
  - Verification must be automated (test command, grep check, type check)
241
384
  - Files list must be exhaustive — every file the subtask touches
385
+ - Subtask title MUST frame user value, not file scope (e.g., "Solo
386
+ dogfooder gets PRD-shaped spec on STANDARD", NOT "edit apt-plan SKILL.md")
242
387
 
243
388
  **Framework-scope doc-sync rule (C33).** When `task.scope === "framework"` AND any subtask's `files` intersect `packages/framework/src/cli/**`, the plan MUST end with a subtask whose title contains `Doc sync` (case-insensitive) and whose `files` list includes at least one of `packages/framework/skills/apt-*/SKILL.md`, `packages/framework/agents/apt-*.md`, `packages/framework/templates/agents-*.md`, or `CLAUDE.md`. The detailed rule and rationale live in `packages/framework/agents/apt-planner.md` §5.1; the planner agent appends this subtask automatically when it would otherwise be missing. Smoke-drain emits a warn-only signal for plans that violate the rule.
244
389
 
@@ -59,7 +59,10 @@ For STANDARD and COMPLEX tasks:
59
59
 
60
60
  ## 4. Write Specification
61
61
 
62
- Create `{task_dir}/spec.md`:
62
+ Content format branches on track (Pocock adoption ID-05, Fast Path Guarantee).
63
+
64
+ ### 4.A. QUICK track / SIMPLE complexity — legacy 4-section spec
65
+
63
66
  ```markdown
64
67
  # Task: {task description}
65
68
 
@@ -79,6 +82,44 @@ Create `{task_dir}/spec.md`:
79
82
  {What this task explicitly does NOT cover}
80
83
  ```
81
84
 
85
+ ### 4.B. STANDARD / DEEP / COMPLEX — PRD-shaped spec.md
86
+
87
+ ```markdown
88
+ # Spec: {task title}
89
+
90
+ **Task ID:** {task-id}
91
+ **Track:** {STANDARD | DEEP}
92
+ **Scope:** {framework | desktop | web | core | ui | backend | docs}
93
+
94
+ ## Problem Statement
95
+ {What pain are we solving?}
96
+
97
+ ## Solution
98
+ {Chosen approach + bulleted net delta.}
99
+
100
+ ## User Stories
101
+ {**US-NN (persona).** stories, 1:1 onto subtasks.}
102
+
103
+ ## Implementation Decisions
104
+ {### ID-NN load-bearing principles.}
105
+
106
+ ## Testing Decisions
107
+ {### TD-NN test families. Fast Path regressions enumerated here.}
108
+
109
+ ## Out of Scope
110
+ {Non-goals with deferral target.}
111
+
112
+ ## Further Notes
113
+ {Sequencing, risk surface, dependencies, files-affected preview.}
114
+
115
+ ### Acceptance Criteria
116
+ {**AC1..ACN** stable IDs referenced by subtasks.}
117
+ ```
118
+
119
+ PRD section ordering is load-bearing — downstream tooling greps by header.
120
+ Do NOT interview the user; synthesize from task description + codebase +
121
+ AGENTS.md.
122
+
82
123
  ## 5. Create Implementation Plan
83
124
 
84
125
  Create `{task_dir}/implementation_plan.json`:
@@ -9,6 +9,7 @@ user_invocable: true
9
9
  internal: false
10
10
  spawns_agent: false
11
11
  agent_name: null
12
+ task_context: self-managed
12
13
  default_execution_mode: auto
13
14
  execution_modes:
14
15
  - auto
@@ -1453,33 +1454,63 @@ node packages/framework/bin/apt-tools.mjs workflow advance . --id ${REVIEW_ID} -
1453
1454
 
1454
1455
  If `WORKTREE_PATH != .` AND fixes were applied in Phase 6/7:
1455
1456
 
1457
+ Get the PR head ref (for branch reviews, use the branch name directly):
1456
1458
  ```bash
1457
- cd ${WORKTREE_PATH}
1459
+ PR_HEAD_REF=$(gh pr view ${PR_NUMBER} --json headRefName -q .headRefName)
1460
+ ```
1458
1461
 
1459
- # Commit all staged fixes
1460
- git add -A
1461
- git commit -m "fix: auto-fix review findings from /apt:pr-review (review ${REVIEW_ID})"
1462
+ #### Confirmation gate (BUG-009 fix)
1462
1463
 
1463
- # Push fixes back to the PR branch
1464
- # For PRs: push to the PR's head ref
1465
- git push origin HEAD:${PR_HEAD_REF}
1464
+ Whether the push prompts for confirmation is controlled by `pr_review.confirm_before_push` in `.aperant/config.json` (tri-state: `ask` | `auto` | `never`; default when absent: `auto` at autonomy ≥ 2, `ask` at autonomy < 2). Mirrors the `pr_review.suggest_after_ship` precedent in `/apt:ship` Section 7.1 — `ask` is honest about the irreversible-ish nature of the push (re-triggers CI on origin, visible to teammates); `auto` honors yolo pipelines.
1466
1465
 
1467
- cd -
1466
+ ```bash
1467
+ confirm_mode=$(jq -r '.pr_review.confirm_before_push // empty' .aperant/config.json)
1468
+ autonomy=$(jq -r '.autonomy.default // 2' .aperant/config.json)
1469
+ if [ -z "$confirm_mode" ]; then
1470
+ if [ "${autonomy}" -ge 2 ]; then confirm_mode="auto"; else confirm_mode="ask"; fi
1471
+ fi
1468
1472
  ```
1469
1473
 
1470
- Where `PR_HEAD_REF` is the PR's head branch name (e.g., `feat/auth`). Get it from:
1474
+ Branch on `confirm_mode`:
1475
+
1476
+ - **`never`** — Skip push entirely. Print "fixes left in worktree; push manually with `git -C ${WORKTREE_PATH} push origin HEAD:${PR_HEAD_REF}`". Proceed to Step 0b cleanup.
1477
+ - **`auto`** — Proceed silently to the catch-all + push below. No prompt.
1478
+ - **`ask`** — Emit the structured question: `Fixes are ready in the worktree. Push to ${PR_HEAD_REF}? (y/n)`. On `n` or any non-`y`: same skip behavior as `never`. On `y` (or empty enter): proceed.
1479
+
1480
+ `confirm_before_push` is purely additive — it does not affect `authorship_override`, `authorship_overrides`, `max_rounds`, or `suggest_after_ship` in the same `pr_review` block.
1481
+
1482
+ #### Catch-all + push (BUG-010 fix)
1483
+
1484
+ The fixer pipeline normally produces atomic per-finding commits, so the worktree is clean by the time Step 0 runs. The catch-all commit below exists ONLY to capture uncommitted residue (rare — e.g. a fixer's pre-return self-audit failed to detect a stray edit). Guard it before committing:
1485
+
1471
1486
  ```bash
1472
- gh pr view ${PR_NUMBER} --json headRefName -q .headRefName
1473
- ```
1487
+ cd ${WORKTREE_PATH}
1474
1488
 
1475
- For branch reviews: push to the branch name directly.
1489
+ # Guard 1: skip the catch-all entirely if the tree is clean.
1490
+ # Per-finding commits with proper messages are strictly better history than a single catch-all.
1491
+ if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
1492
+ # Guard 2: explicit allowlist instead of `git add -A`.
1493
+ # `git add -A` would sweep orchestrator-level Read/Write side-effects
1494
+ # (metadata.json, audit.json, validated.md, etc.) into the PR. Bad.
1495
+ # Stage ONLY files in the review's touched set, computed from the iteration diffs.
1496
+ REVIEW_TOUCHED=$(git diff --name-only ${ITERATION_START_SHA:-HEAD~4}..HEAD 2>/dev/null \
1497
+ | grep -v '^\.aperant/' \
1498
+ | tr '\n' ' ')
1499
+ if [ -n "$REVIEW_TOUCHED" ]; then
1500
+ # shellcheck disable=SC2086
1501
+ git add -- $REVIEW_TOUCHED
1502
+ fi
1503
+ # Only commit if `git add --` actually staged something.
1504
+ if ! git diff --cached --quiet; then
1505
+ git commit -m "fix: auto-fix review findings from /apt:pr-review (review ${REVIEW_ID})"
1506
+ fi
1507
+ fi
1476
1508
 
1477
- **IMPORTANT:** Ask the user for confirmation before pushing:
1478
- ```
1479
- Fixes are ready in the worktree. Push to ${PR_HEAD_REF}? (y/n)
1509
+ git push origin HEAD:${PR_HEAD_REF}
1510
+ cd -
1480
1511
  ```
1481
1512
 
1482
- If the user declines, skip the push but still write the report. The fixes remain in the worktree for manual review.
1513
+ Two guards. The outer `if` skips the whole catch-all path when the tree is clean. The inner allowlist (filter to files in the iteration-diff scope, minus anything under `.aperant/`) prevents `git add` from sweeping arbitrary orchestrator side-effects into the PR. Both guards default to the safe no-op shape on the happy path (fixers committed atomically, clean tree).
1483
1514
 
1484
1515
  ### Step 0b: Cleanup Worktree
1485
1516
 
@@ -0,0 +1,109 @@
1
+ <!--
2
+ Adapted from Matt Pocock's MIT-licensed skill suite:
3
+ https://github.com/mattpocock/skills/blob/main/skills/engineering/prototype/LOGIC.md
4
+ Licensed under MIT. Modifications: scoped to terminal-app prototypes
5
+ that validate state machines, protocols, and control flow. Aligned with
6
+ the 5 universal rules in apt-prototype/SKILL.md.
7
+ -->
8
+
9
+ # LOGIC branch — Terminal app for state-machine validation
10
+
11
+ When the user's question is about **behavior**, the prototype is a
12
+ single terminal app that the user runs and watches. The output prints
13
+ every state transition so the user can FEEL whether the logic works,
14
+ not just reason about it.
15
+
16
+ ## When this branch fires
17
+
18
+ Question types that route here:
19
+
20
+ - "Does this state machine work?"
21
+ - "Does this control flow handle edge case X?"
22
+ - "Can this protocol handle out-of-order messages?"
23
+ - "What does the worker pool do under back-pressure?"
24
+ - "Does this retry policy actually converge?"
25
+
26
+ Question types that DO NOT route here (use UI branch instead):
27
+
28
+ - "Does this UI shape feel right?"
29
+ - "Is this flow discoverable?"
30
+ - "Does this layout work on mobile?"
31
+
32
+ ## File shape
33
+
34
+ ONE file. Pick the project's primary runtime (TypeScript via `tsx`,
35
+ JavaScript via `node`, Python via `python3`, etc.). The shape:
36
+
37
+ ```
38
+ // THROWAWAY PROTOTYPE — do not merge, do not extend, do not test.
39
+ // Question: "{verbatim question from user}"
40
+ // Decision criterion: "{what does 'yes' look like? what does 'no' look like?}"
41
+
42
+ // --- State machine model ---
43
+ // {Declare states, transitions, and any guards.}
44
+
45
+ // --- Transition driver ---
46
+ // {A function that takes (currentState, event) and returns nextState,
47
+ // PRINTING every transition so the user can see what's happening.}
48
+
49
+ // --- Scripted run ---
50
+ // {5-10 sequential transitions that exercise the interesting paths.}
51
+ ```
52
+
53
+ ## Single-command invocation
54
+
55
+ The prototype runs with ONE command. Examples:
56
+
57
+ - `node prototype.mjs` — no transpile, no build, no install
58
+ - `pnpm dlx tsx prototype.ts` — uses dlx so no dependency added to the project
59
+ - `python3 prototype.py` — no virtualenv setup
60
+
61
+ If your prototype needs any of: webpack, vite, esbuild, a database
62
+ connection, an environment variable — you are prototyping the wrong
63
+ question. Re-scope to the BEHAVIOR question; the infrastructure is a
64
+ separate concern.
65
+
66
+ ## Surface-state-transparently — concrete examples
67
+
68
+ A terminal app prints state transitions inline:
69
+
70
+ ```
71
+ [T+0] state=IDLE
72
+ [T+1] event=user.click.submit → state=SUBMITTING
73
+ [T+2] event=network.timeout → state=RETRYING (attempt 1)
74
+ [T+3] event=network.timeout → state=RETRYING (attempt 2)
75
+ [T+4] event=network.timeout → state=FAILED (exceeded retries)
76
+ ```
77
+
78
+ The user reads this output and either says "yes that's what I wanted"
79
+ or "no, the retry policy needs jitter" — and the question is answered
80
+ in 30 seconds of looking, not 3 hours of staring at a flowchart.
81
+
82
+ If the state machine has parallel regions or hierarchical states, print
83
+ the full state vector at each transition, not just the leaf state.
84
+
85
+ ## When the scripted run isn't enough
86
+
87
+ If the user needs to drive the state machine interactively (the
88
+ question is "what happens when I hit submit twice quickly?"), add a
89
+ tiny REPL loop:
90
+
91
+ ```
92
+ > submit
93
+ [T+1] event=user.click.submit → state=SUBMITTING
94
+ > submit
95
+ [T+2] event=user.click.submit (REJECTED — already submitting)
96
+ [T+2] state=SUBMITTING
97
+ > timeout
98
+ [T+3] event=network.timeout → state=RETRYING (attempt 1)
99
+ ```
100
+
101
+ Keep the REPL parser dumb (split on space, no quoting, no escape
102
+ handling). The user isn't testing your parser; they're testing the
103
+ state machine.
104
+
105
+ ## Throwaway discipline reminder
106
+
107
+ When the question is answered, delete the prototype file. Do not let it
108
+ linger as "documentation of the design decision" — that's what
109
+ `apt-tools adr write` or `.aperant/context/notes/` are for.
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: apt:prototype
3
+ description: "Question-driven throwaway prototyping with 5-rule discipline — LOGIC branch (terminal-app for state-machine validation) and UI branch (delegates to apt:mockup)"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: design
6
+ intent: design
7
+ when_to_use: "The user has a question that wants a runnable prototype rather than a plan — 'does this state machine work?' (LOGIC branch) or 'does this UI shape feel right?' (UI branch). Throwaway code by design; do NOT confuse this with apt:plan or apt:execute."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: false
11
+ agent_name: null
12
+ task_context: create-new
13
+ default_track: STANDARD
14
+ default_execution_mode: step
15
+ execution_modes:
16
+ - auto
17
+ - step
18
+ allowed-tools: "Bash, Read, Write, Edit, Grep, Glob"
19
+ argument-hint: "apt:prototype [question]"
20
+ gates: []
21
+ config_keys:
22
+ - coding.prototype_discipline
23
+ ---
24
+
25
+ # Prototype — Question-Driven Throwaway Code
26
+
27
+ This skill ships throwaway code that answers ONE question. It is NOT a
28
+ planning artifact, NOT a feature, and NOT something to merge. The output
29
+ is a single-command-runnable prototype that lets the user feel whether
30
+ the question's answer is "yes" or "no", then gets thrown away.
31
+
32
+ **Pocock adoption attribution.** Discipline ported from Matt Pocock's
33
+ MIT-licensed `prototype` skill. Routes between two branches by
34
+ question-type; the UI branch delegates to Aperant's existing
35
+ `/apt:mockup` skill for HTML+Tailwind variants. The LOGIC branch and
36
+ the 5-rule discipline are new for Aperant.
37
+
38
+ ## When to Use
39
+
40
+ - The user asks a question (not a "build me X" request) — "does this
41
+ state machine work?", "does this UI shape feel right?", "would users
42
+ find this discoverable?"
43
+ - A throwaway prototype is the cheapest answer (cheaper than designing,
44
+ planning, building, then discovering the answer was "no")
45
+ - The answer can be felt by running the prototype, not just reasoning
46
+ about it
47
+
48
+ ## When NOT to Use
49
+
50
+ - The user has a feature request — use `/apt:plan` + `/apt:execute`
51
+ - The user wants a polished mockup to share — use `/apt:mockup` directly
52
+ (the UI branch of this skill delegates there anyway)
53
+ - The user wants production code with tests — that's TDD-mode
54
+ `/apt:execute --tdd`, not a prototype
55
+
56
+ ## Branch routing
57
+
58
+ Inspect the user's question:
59
+
60
+ - **LOGIC branch** — triggers: "does this state machine work?", "does
61
+ this control flow handle edge case X?", "can this protocol handle
62
+ out-of-order messages?". Answer: a single-file terminal app the user
63
+ can run with one command to feel the state transitions.
64
+ - **UI branch** — triggers: "does this UI shape feel right?", "is this
65
+ flow discoverable?", "does this layout work on mobile?". Answer:
66
+ delegate to `/apt:mockup --variants 3` for HTML+Tailwind parallel
67
+ variants.
68
+
69
+ If the question is genuinely ambiguous, ask ONE clarifying question
70
+ ("are you asking about behavior or appearance?") — do NOT enter a long
71
+ interview.
72
+
73
+ ## The 5 Universal Rules (Pocock discipline, applies to both branches)
74
+
75
+ These five rules apply to EVERY prototype this skill produces. They are
76
+ load-bearing — violating them collapses the prototype into ceremony
77
+ disguised as a question.
78
+
79
+ 1. **Throwaway-marked.** Every prototype file MUST carry a top-of-file
80
+ comment: `// THROWAWAY PROTOTYPE — do not merge, do not extend, do
81
+ not test.` This is not optional. Files without this marker drift into
82
+ production code and the question never gets answered cleanly.
83
+
84
+ 2. **Single-command-run.** The prototype runs with ONE command. No
85
+ build step. No dependency install. `node prototype.mjs` or `pnpm dlx
86
+ tsx prototype.ts` or `bash prototype.sh` — pick one and stop. If you
87
+ reach for webpack, you're prototyping a build, not the question.
88
+
89
+ 3. **No-persistence-default.** The prototype does NOT touch any
90
+ persistent store (libSQL, Convex, localStorage, .aperant/state.json).
91
+ Everything is in-memory. If persistence is part of the question,
92
+ explicitly opt in via a tmpfile — never the project's actual stores.
93
+
94
+ 4. **Skip-polish.** No error handling for impossible scenarios. No
95
+ accessibility audit. No mobile responsive breakpoints unless the
96
+ question is about mobile. No animation refinement. Polish is what
97
+ you do AFTER the prototype answered "yes"; doing it now obscures
98
+ whether the answer was actually "yes".
99
+
100
+ 5. **Surface-state-transparently.** The prototype prints / renders its
101
+ internal state at every step the user might want to inspect. A
102
+ terminal app prints every state transition. A UI prototype shows
103
+ the data shape next to the rendered output. The user must be able
104
+ to SEE what's happening — they can't feel an answer to "does this
105
+ work" if the state is hidden.
106
+
107
+ ## LOGIC branch — terminal app for state-machine validation
108
+
109
+ When the question is about behavior / control flow / state machines /
110
+ protocols:
111
+
112
+ 1. Read `LOGIC.md` for the discipline (ported from Pocock's
113
+ `prototype/LOGIC.md` with MIT attribution).
114
+ 2. Write ONE file (e.g., `prototype.mjs`, `prototype.ts`, or
115
+ `prototype.py`) that:
116
+ - Models the state machine in code
117
+ - Provides a command-line driver that fires transitions one at a
118
+ time, printing each state
119
+ - Includes a 5-10 turn scripted run at the bottom that exercises the
120
+ interesting paths
121
+ 3. Write a one-line invocation: `node prototype.mjs` (or whatever).
122
+ 4. Verify: run it. The user reads the output, gets their answer, and
123
+ the file is deleted.
124
+
125
+ ## UI branch — delegates to apt:mockup
126
+
127
+ When the question is about layout / aesthetics / flow / discoverability:
128
+
129
+ 1. Read `UI.md` for the discipline (ported from Pocock's
130
+ `prototype/UI.md` with MIT attribution).
131
+ 2. Invoke `/apt:mockup --variants 3` as a sub-step. apt:mockup already
132
+ enforces the UI-specific universal rules (zero-dep Tailwind CDN, no
133
+ JS, throwaway HTML iterations preserved).
134
+ 3. The 5 universal rules above still apply — verify each HTML file
135
+ carries the `<!-- THROWAWAY PROTOTYPE -->` marker.
136
+
137
+ ## Output contract
138
+
139
+ - Single prototype file (LOGIC) OR 3 HTML variants via apt:mockup (UI).
140
+ - No commits. No tests. No docs. The skill emits a final note: "Delete
141
+ this when the question is answered."
142
+ - If the user wants to convert the prototype into real code, that's a
143
+ separate `/apt:plan` invocation.