@aperant/framework 0.8.0 → 0.8.4

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 (271) hide show
  1. package/CHANGELOG.md +311 -1
  2. package/README.md +12 -0
  3. package/agents/apt-planner.md +5 -4
  4. package/dist/cli/commands/adr.mjs +1 -1
  5. package/dist/cli/commands/audit-branch-current.d.mts +25 -0
  6. package/dist/cli/commands/audit-branch-current.d.mts.map +1 -0
  7. package/dist/cli/commands/audit-branch-current.mjs +252 -0
  8. package/dist/cli/commands/audit-branch-current.mjs.map +1 -0
  9. package/dist/cli/commands/audit.d.mts.map +1 -1
  10. package/dist/cli/commands/audit.mjs +13 -2
  11. package/dist/cli/commands/audit.mjs.map +1 -1
  12. package/dist/cli/commands/check-version.d.mts.map +1 -1
  13. package/dist/cli/commands/check-version.mjs +19 -1
  14. package/dist/cli/commands/check-version.mjs.map +1 -1
  15. package/dist/cli/commands/context.mjs +3 -3
  16. package/dist/cli/commands/context.mjs.map +1 -1
  17. package/dist/cli/commands/detect-runtime.d.mts +6 -0
  18. package/dist/cli/commands/detect-runtime.d.mts.map +1 -0
  19. package/dist/cli/commands/detect-runtime.mjs +136 -0
  20. package/dist/cli/commands/detect-runtime.mjs.map +1 -0
  21. package/dist/cli/commands/driver-doctor.d.mts +29 -0
  22. package/dist/cli/commands/driver-doctor.d.mts.map +1 -0
  23. package/dist/cli/commands/driver-doctor.mjs +291 -0
  24. package/dist/cli/commands/driver-doctor.mjs.map +1 -0
  25. package/dist/cli/commands/gate.mjs +14 -0
  26. package/dist/cli/commands/gate.mjs.map +1 -1
  27. package/dist/cli/commands/init.d.mts.map +1 -1
  28. package/dist/cli/commands/init.mjs +76 -33
  29. package/dist/cli/commands/init.mjs.map +1 -1
  30. package/dist/cli/commands/install-from-source.d.mts +2 -0
  31. package/dist/cli/commands/install-from-source.d.mts.map +1 -0
  32. package/dist/cli/commands/install-from-source.mjs +2 -0
  33. package/dist/cli/commands/install-from-source.mjs.map +1 -0
  34. package/dist/cli/commands/modes.mjs +1 -1
  35. package/dist/cli/commands/route.d.mts.map +1 -1
  36. package/dist/cli/commands/route.mjs +38 -1
  37. package/dist/cli/commands/route.mjs.map +1 -1
  38. package/dist/cli/commands/triage.mjs +1 -1
  39. package/dist/cli/config/load.d.mts.map +1 -1
  40. package/dist/cli/config/load.mjs +9 -3
  41. package/dist/cli/config/load.mjs.map +1 -1
  42. package/dist/cli/coordination/auto-emit-artifact-ready.mjs +1 -1
  43. package/dist/cli/coordination/event-schema.d.mts.map +1 -1
  44. package/dist/cli/coordination/event-schema.mjs +18 -0
  45. package/dist/cli/coordination/event-schema.mjs.map +1 -1
  46. package/dist/cli/design/frontmatter-schema.d.mts +4 -4
  47. package/dist/cli/dispatch.d.mts.map +1 -1
  48. package/dist/cli/dispatch.mjs +18 -1
  49. package/dist/cli/dispatch.mjs.map +1 -1
  50. package/dist/cli/gate/context.d.mts +1 -0
  51. package/dist/cli/gate/context.d.mts.map +1 -1
  52. package/dist/cli/gate/context.mjs +14 -1
  53. package/dist/cli/gate/context.mjs.map +1 -1
  54. package/dist/cli/gate/gates/consistency-check.d.mts +1 -0
  55. package/dist/cli/gate/gates/consistency-check.d.mts.map +1 -1
  56. package/dist/cli/gate/gates/consistency-check.mjs +1 -0
  57. package/dist/cli/gate/gates/consistency-check.mjs.map +1 -1
  58. package/dist/cli/gate/gates/review-clean.d.mts +1 -0
  59. package/dist/cli/gate/gates/review-clean.d.mts.map +1 -1
  60. package/dist/cli/gate/gates/review-clean.mjs +1 -0
  61. package/dist/cli/gate/gates/review-clean.mjs.map +1 -1
  62. package/dist/cli/gate/gates/verify-approved.d.mts +1 -0
  63. package/dist/cli/gate/gates/verify-approved.d.mts.map +1 -1
  64. package/dist/cli/gate/gates/verify-approved.mjs +1 -0
  65. package/dist/cli/gate/gates/verify-approved.mjs.map +1 -1
  66. package/dist/cli/gate/registry.d.mts.map +1 -1
  67. package/dist/cli/gate/registry.mjs +9 -1
  68. package/dist/cli/gate/registry.mjs.map +1 -1
  69. package/dist/cli/install/cli-to-install-root.d.mts.map +1 -1
  70. package/dist/cli/install/cli-to-install-root.mjs +0 -2
  71. package/dist/cli/install/cli-to-install-root.mjs.map +1 -1
  72. package/dist/cli/install/find-workspace-framework-version.d.mts +16 -0
  73. package/dist/cli/install/find-workspace-framework-version.d.mts.map +1 -0
  74. package/dist/cli/install/find-workspace-framework-version.mjs +85 -0
  75. package/dist/cli/install/find-workspace-framework-version.mjs.map +1 -0
  76. package/dist/cli/install/install-from-source.d.mts +10 -0
  77. package/dist/cli/install/install-from-source.d.mts.map +1 -0
  78. package/dist/cli/install/install-from-source.mjs +271 -0
  79. package/dist/cli/install/install-from-source.mjs.map +1 -0
  80. package/dist/cli/install/install-kernel.d.mts.map +1 -1
  81. package/dist/cli/install/install-kernel.mjs +24 -0
  82. package/dist/cli/install/install-kernel.mjs.map +1 -1
  83. package/dist/cli/install/legacy-paths.d.mts +33 -11
  84. package/dist/cli/install/legacy-paths.d.mts.map +1 -1
  85. package/dist/cli/install/legacy-paths.mjs +161 -39
  86. package/dist/cli/install/legacy-paths.mjs.map +1 -1
  87. package/dist/cli/install/runtime-detect.d.mts +2 -6
  88. package/dist/cli/install/runtime-detect.d.mts.map +1 -1
  89. package/dist/cli/install/runtime-detect.mjs +9 -4
  90. package/dist/cli/install/runtime-detect.mjs.map +1 -1
  91. package/dist/cli/install/runtime-migrate.d.mts +34 -14
  92. package/dist/cli/install/runtime-migrate.d.mts.map +1 -1
  93. package/dist/cli/install/runtime-migrate.mjs +63 -30
  94. package/dist/cli/install/runtime-migrate.mjs.map +1 -1
  95. package/dist/cli/install/transforms/codex.d.mts.map +1 -1
  96. package/dist/cli/install/transforms/codex.mjs +28 -17
  97. package/dist/cli/install/transforms/codex.mjs.map +1 -1
  98. package/dist/cli/install/transforms/pi.d.mts +6 -0
  99. package/dist/cli/install/transforms/pi.d.mts.map +1 -0
  100. package/dist/cli/install/transforms/pi.mjs +37 -0
  101. package/dist/cli/install/transforms/pi.mjs.map +1 -0
  102. package/dist/cli/personas/sidecar.d.mts +1 -1
  103. package/dist/cli/roadmap/lifecycle.d.mts +1 -1
  104. package/dist/cli/roadmap/rollup.d.mts +2 -2
  105. package/dist/cli/skill-author/contract.mjs +2 -2
  106. package/dist/cli/skill-author/contract.mjs.map +1 -1
  107. package/dist/cli/verify-proof/audit.d.mts +34 -0
  108. package/dist/cli/verify-proof/audit.d.mts.map +1 -0
  109. package/dist/cli/verify-proof/audit.mjs +53 -0
  110. package/dist/cli/verify-proof/audit.mjs.map +1 -0
  111. package/dist/cli/verify-proof/exec.d.mts +20 -0
  112. package/dist/cli/verify-proof/exec.d.mts.map +1 -0
  113. package/dist/cli/verify-proof/exec.mjs +74 -0
  114. package/dist/cli/verify-proof/exec.mjs.map +1 -0
  115. package/dist/cli/verify-proof/idl/index.d.mts +2 -0
  116. package/dist/cli/verify-proof/idl/index.d.mts.map +1 -0
  117. package/dist/cli/verify-proof/idl/index.mjs +14 -0
  118. package/dist/cli/verify-proof/idl/index.mjs.map +1 -0
  119. package/dist/cli/verify-proof/idl/types.d.ts +9 -0
  120. package/dist/cli/verify-proof/idl/types.d.ts.map +1 -0
  121. package/dist/cli/verify-proof/idl/types.js +9 -0
  122. package/dist/cli/verify-proof/idl/types.js.map +1 -0
  123. package/dist/cli/verify-proof/manifest-validator.d.mts +19 -0
  124. package/dist/cli/verify-proof/manifest-validator.d.mts.map +1 -0
  125. package/dist/cli/verify-proof/manifest-validator.mjs +182 -0
  126. package/dist/cli/verify-proof/manifest-validator.mjs.map +1 -0
  127. package/dist/cli/verify-proof/resolver.d.mts +43 -0
  128. package/dist/cli/verify-proof/resolver.d.mts.map +1 -0
  129. package/dist/cli/verify-proof/resolver.mjs +160 -0
  130. package/dist/cli/verify-proof/resolver.mjs.map +1 -0
  131. package/dist/cli/verify-proof/runtime-detect.d.mts +27 -0
  132. package/dist/cli/verify-proof/runtime-detect.d.mts.map +1 -0
  133. package/dist/cli/verify-proof/runtime-detect.mjs +116 -0
  134. package/dist/cli/verify-proof/runtime-detect.mjs.map +1 -0
  135. package/dist/cli/verify-proof/trust.d.mts +70 -0
  136. package/dist/cli/verify-proof/trust.d.mts.map +1 -0
  137. package/dist/cli/verify-proof/trust.mjs +174 -0
  138. package/dist/cli/verify-proof/trust.mjs.map +1 -0
  139. package/dist/plugin/.claude-plugin/plugin.json +4 -1
  140. package/dist/plugin/agents/apt-executor.md +12 -0
  141. package/dist/plugin/agents/apt-planner.md +5 -4
  142. package/dist/plugin/agents/apt-team-docs-narrator.md +11 -0
  143. package/dist/plugin/skills/apt/SKILL.md +78 -8
  144. package/dist/plugin/skills/apt-caveman/SKILL.md +64 -0
  145. package/dist/plugin/skills/apt-debug/SKILL.md +36 -4
  146. package/dist/plugin/skills/apt-debug/appendices/diagnose-discipline.md +2 -11
  147. package/dist/plugin/skills/apt-discuss/SKILL.md +4 -4
  148. package/dist/plugin/skills/apt-discuss/appendices/grill-discipline.md +2 -11
  149. package/dist/plugin/skills/apt-discuss/appendices/zoom-out-helper.md +0 -8
  150. package/dist/plugin/skills/apt-execute/SKILL.md +40 -4
  151. package/dist/plugin/skills/apt-execute/appendices/tdd-mode.md +2 -10
  152. package/dist/plugin/skills/apt-fan-out/SKILL.md +159 -0
  153. package/dist/plugin/skills/apt-handoff/SKILL.md +228 -0
  154. package/dist/plugin/skills/apt-improve/DEEPENING.md +0 -8
  155. package/dist/plugin/skills/apt-improve/INTERFACE-DESIGN.md +0 -8
  156. package/dist/plugin/skills/apt-improve/LANGUAGE.md +0 -8
  157. package/dist/plugin/skills/apt-improve/SKILL.md +4 -4
  158. package/dist/plugin/skills/apt-plan/SKILL.md +23 -5
  159. package/dist/plugin/skills/apt-plan/adapters/conductor.md +1 -1
  160. package/dist/plugin/skills/apt-pr-review/SKILL.md +8 -1
  161. package/dist/plugin/skills/apt-prototype/LOGIC.md +0 -8
  162. package/dist/plugin/skills/apt-prototype/SKILL.md +4 -4
  163. package/dist/plugin/skills/apt-prototype/UI.md +0 -8
  164. package/dist/plugin/skills/apt-quick/SKILL.md +31 -1
  165. package/dist/plugin/skills/apt-resume/SKILL.md +54 -31
  166. package/dist/plugin/skills/apt-review/SKILL.md +4 -0
  167. package/dist/plugin/skills/apt-run/SKILL.md +134 -21
  168. package/dist/plugin/skills/apt-setup/SKILL.md +97 -8
  169. package/dist/plugin/skills/apt-ship/SKILL.md +165 -9
  170. package/dist/plugin/skills/apt-spar/SKILL.md +77 -25
  171. package/dist/plugin/skills/apt-triage/AGENT-BRIEF.md +0 -8
  172. package/dist/plugin/skills/apt-triage/OUT-OF-SCOPE.md +0 -7
  173. package/dist/plugin/skills/apt-triage/SKILL.md +2 -2
  174. package/dist/plugin/skills/apt-update/SKILL.md +74 -17
  175. package/dist/plugin/skills/apt-verify/SKILL.md +11 -0
  176. package/dist/plugin/skills/apt-verify-proof/SKILL.md +48 -1
  177. package/dist/plugin/skills/apt-watch-ci/SKILL.md +2 -2
  178. package/dist/plugin/skills/apt-zoom-out/SKILL.md +3 -3
  179. package/dist/schemas/quick-task.d.ts +17 -17
  180. package/dist/schemas/quick-task.d.ts.map +1 -1
  181. package/dist/schemas/quick-task.js +2 -2
  182. package/dist/schemas/quick-task.js.map +1 -1
  183. package/dist/types/config.d.ts +33 -0
  184. package/dist/types/config.d.ts.map +1 -1
  185. package/dist/types/state.d.ts +1 -1
  186. package/dist/types/state.d.ts.map +1 -1
  187. package/dist/types/task-record.d.ts +1 -1
  188. package/dist/types/task-record.d.ts.map +1 -1
  189. package/package.json +134 -133
  190. package/prompts/planner.md +1 -1
  191. package/prompts/spec_writer.md +1 -1
  192. package/skills/apt/SKILL.md +78 -8
  193. package/skills/apt-caveman/SKILL.md +64 -0
  194. package/skills/apt-debug/SKILL.md +36 -4
  195. package/skills/apt-debug/appendices/diagnose-discipline.md +2 -11
  196. package/skills/apt-discuss/SKILL.md +4 -4
  197. package/skills/apt-discuss/appendices/grill-discipline.md +2 -11
  198. package/skills/apt-discuss/appendices/zoom-out-helper.md +0 -8
  199. package/skills/apt-execute/SKILL.md +27 -4
  200. package/skills/apt-execute/appendices/tdd-mode.md +2 -10
  201. package/skills/apt-fan-out/SKILL.md +36 -1
  202. package/skills/apt-handoff/SKILL.md +228 -0
  203. package/skills/apt-improve/DEEPENING.md +0 -8
  204. package/skills/apt-improve/INTERFACE-DESIGN.md +0 -8
  205. package/skills/apt-improve/LANGUAGE.md +0 -8
  206. package/skills/apt-improve/SKILL.md +4 -4
  207. package/skills/apt-plan/SKILL.md +23 -5
  208. package/skills/apt-plan/adapters/conductor.md +1 -1
  209. package/skills/apt-planner.md +1 -1
  210. package/skills/apt-prototype/LOGIC.md +0 -8
  211. package/skills/apt-prototype/SKILL.md +4 -4
  212. package/skills/apt-prototype/UI.md +0 -8
  213. package/skills/apt-quick/SKILL.md +31 -1
  214. package/skills/apt-resume/SKILL.md +54 -31
  215. package/skills/apt-run/SKILL.md +114 -16
  216. package/skills/apt-setup/SKILL.md +97 -8
  217. package/skills/apt-ship/SKILL.md +165 -9
  218. package/skills/apt-spar/SKILL.md +65 -16
  219. package/skills/apt-triage/AGENT-BRIEF.md +0 -8
  220. package/skills/apt-triage/OUT-OF-SCOPE.md +0 -7
  221. package/skills/apt-triage/SKILL.md +2 -2
  222. package/skills/apt-update/SKILL.md +74 -17
  223. package/skills/apt-verify-proof/SKILL.md +48 -1
  224. package/skills/apt-zoom-out/SKILL.md +3 -3
  225. package/src/cli/commands/adr.mjs +1 -1
  226. package/src/cli/commands/audit-branch-current.mjs +250 -0
  227. package/src/cli/commands/audit.mjs +13 -2
  228. package/src/cli/commands/check-version.mjs +20 -1
  229. package/src/cli/commands/context.mjs +3 -3
  230. package/src/cli/commands/detect-runtime.mjs +134 -0
  231. package/src/cli/commands/driver-doctor.mjs +294 -0
  232. package/src/cli/commands/gate.mjs +15 -0
  233. package/src/cli/commands/init.mjs +75 -33
  234. package/src/cli/commands/install-from-source.mjs +1 -0
  235. package/src/cli/commands/modes.mjs +1 -1
  236. package/src/cli/commands/route.mjs +42 -1
  237. package/src/cli/commands/triage.mjs +1 -1
  238. package/src/cli/config/load.mjs +9 -3
  239. package/src/cli/coordination/auto-emit-artifact-ready.mjs +1 -1
  240. package/src/cli/coordination/event-schema.mjs +19 -0
  241. package/src/cli/dispatch.mjs +17 -1
  242. package/src/cli/gate/context.mjs +20 -1
  243. package/src/cli/gate/gates/consistency-check.mjs +1 -0
  244. package/src/cli/gate/gates/review-clean.mjs +1 -0
  245. package/src/cli/gate/gates/verify-approved.mjs +1 -0
  246. package/src/cli/gate/registry.mjs +11 -1
  247. package/src/cli/install/cli-to-install-root.mjs +0 -2
  248. package/src/cli/install/find-workspace-framework-version.mjs +88 -0
  249. package/src/cli/install/install-from-source.mjs +276 -0
  250. package/src/cli/install/install-kernel.mjs +24 -0
  251. package/src/cli/install/legacy-paths.mjs +162 -39
  252. package/src/cli/install/runtime-detect.mjs +9 -4
  253. package/src/cli/install/runtime-migrate.mjs +63 -30
  254. package/src/cli/install/transforms/codex.mjs +26 -17
  255. package/src/cli/install/transforms/pi.mjs +37 -0
  256. package/src/cli/skill-author/contract.mjs +2 -2
  257. package/src/cli/verify-proof/.gitkeep +0 -0
  258. package/src/cli/verify-proof/audit.mjs +55 -0
  259. package/src/cli/verify-proof/exec.mjs +74 -0
  260. package/src/cli/verify-proof/idl/index.mjs +24 -0
  261. package/src/cli/verify-proof/idl/types.ts +41 -0
  262. package/src/cli/verify-proof/manifest-schema.json +211 -0
  263. package/src/cli/verify-proof/manifest-validator.mjs +184 -0
  264. package/src/cli/verify-proof/resolver.mjs +163 -0
  265. package/src/cli/verify-proof/runtime-detect.mjs +122 -0
  266. package/src/cli/verify-proof/trust.mjs +187 -0
  267. package/templates/adr-format.md +0 -8
  268. package/templates/aperant-claude-md-appendix.md +1 -1
  269. package/templates/context-format.md +1 -9
  270. package/templates/proof-verification.md +19 -5
  271. package/workflows/verify-proof.md +56 -14
@@ -41,8 +41,9 @@ you must follow when classifying.
41
41
  - **Config:** `.aperant/config.json` — project preferences
42
42
  - **State:** `.aperant/state.json` — execution state
43
43
  - **Task directories:** `.aperant/tasks/{task-id}/` — each task gets isolated artifacts
44
- - **Codex repo skills:** `.agents/skills/apt*/` — native Codex discovery surface installed by `apt-tools init`
45
- - **Claude agents:** `.claude/agents/apt-*.md` — specialized agent definitions for heavy workflows
44
+ - **Claude surface:** `.claude/skills/`, `.claude/agents/`
45
+ - **Codex surface:** `.codex/commands/`, `.codex/agents/`
46
+ - **Pi surface:** `.pi/prompts/`, `.pi/skills/`
46
47
  </your_environment>
47
48
 
48
49
  <mandatory_first_step>
@@ -385,18 +386,27 @@ Parse `task_id`, `task_dir`, and (if present) `worktree.worktree_path` / `worktr
385
386
  Important nuances:
386
387
  - `task_dir` is an **absolute path** under the main repo's `.aperant/tasks/{task-id}/`. All spec/plan/progress artifacts live there and are shared across worktrees.
387
388
  - `apt-tools` commands still receive the **project root** as `<project-dir>` — they coordinate state through the main repo's `.aperant/`. The worktree only affects *code editing* cwd.
388
- - When spawning an agent, set its `cwd` (or prefix its Bash calls with `cd {worktree_path} &&`) to the worktree. Pass `worktree_path` in the agent's context so it knows where it is.
389
+ - When spawning an agent, set its `cwd` (or prefix its Bash calls with `cd {worktree_path} &&`) to the worktree for code reads/edits. Pass `worktree_path` in the agent's context so it knows where code work happens.
390
+ - Planner artifact safety: do **not** spawn `apt-planner` with host-level worktree isolation that gives it a separate copied repo. The planner must write `spec.md` and `implementation_plan.json` to the absolute main-repo `task_dir` from `task create`; `.aperant/tasks/**` is gitignored, so artifacts written under a disposable worktree can be invisible to git and lost when that worktree is cleaned.
389
391
  - If no `worktree` block is returned, proceed in the project root as before.
390
392
 
391
393
  ### Step 3: Spawn Planner Agent
392
394
 
393
395
  **If `spawn_agent` is true (STANDARD/DEEP):**
394
396
 
395
- Print phase marker BEFORE spawning:
397
+ Print the phase rail BEFORE spawning. Render the panel verbatim — branch glyphs `┌─ │ └─`, status glyphs `✓` (done) / `●` (active) / `○` (pending), one phase per row, inline metrics on completed rows when available:
398
+
396
399
  ```
397
400
  [APT] Phase 1/N — Planning (spawning apt-planner agent)
401
+ ┌─ Phase rail: {short task name} ───────────────────
402
+ │ Phase 1 Plan ● spawning apt-planner
403
+ │ Phase 2 Execute ○
404
+ │ Phase 3 Verify ○
405
+ │ Phase 4 Review ○
406
+ └───────────────────────────────────────────────────
398
407
  ```
399
- (N = total pipeline phases: e.g. plan+execute+verify+review = 4, discuss+plan+… = 5)
408
+
409
+ (N = total pipeline phases: e.g. plan+execute+verify+review = 4, discuss+plan+… = 5. Keep the `[APT] Phase X/N` header line — it's the backward-compat marker that external grep tooling relies on. The rail panel sits directly below it.)
400
410
 
401
411
  You **MUST** use the `Task` tool to spawn `apt-planner` — do NOT write
402
412
  `spec.md` or `implementation_plan.json` inline using the `Write` tool. The
@@ -413,8 +423,9 @@ Spawn `apt-planner` via Task tool with context:
413
423
  ```
414
424
  Task: {task_description}
415
425
  Task ID: {task_id}
416
- Task Dir: {task_dir}
426
+ Task Dir: {task_dir} # absolute path under the main repo, not under worktree_path
417
427
  Track: {track}
428
+ Worktree Path: {worktree_path or "none"}
418
429
 
419
430
  <files_to_read>
420
431
  - CLAUDE.md (if exists)
@@ -422,7 +433,7 @@ Track: {track}
422
433
  - Any brainstorm notes at .aperant/context/notes/{task_id}-brainstorm.md
423
434
  </files_to_read>
424
435
 
425
- Write spec.md and implementation_plan.json to {task_dir}/
436
+ Write spec.md and implementation_plan.json to {task_dir}/. Do not write plan artifacts to `{worktree_path}/.aperant/tasks/...` or any relative `.aperant/tasks/...` path.
426
437
  ```
427
438
 
428
439
  After the agent returns, emit a token running-total line:
@@ -444,9 +455,32 @@ The user's chosen option has a `pipeline` array (e.g. `["plan", "execute", "veri
444
455
  **execution_mode = "auto":**
445
456
  Auto-chain without waiting. STANDARD and DEEP auto pipelines both follow Plan → execute → verify → review (DEEP additionally leads with discuss).
446
457
 
447
- Each phase transition MUST emit a status marker for visibility:
458
+ Each phase transition MUST emit a status marker AND re-render the phase rail showing the updated state for ALL phases. The rail is the user's primary signal — render it verbatim, do not summarize or skip.
459
+
448
460
  ```
449
461
  [APT] Phase {current}/{total} — {name} (spawning {agent})
462
+ ┌─ Phase rail: {short task name} ───────────────────
463
+ │ Phase 1 Plan ✓ {N} subtasks
464
+ │ Phase 2 Execute ● spawning apt-executor
465
+ │ Phase 3 Verify ○
466
+ │ Phase 4 Review ○
467
+ └───────────────────────────────────────────────────
468
+ ```
469
+
470
+ Metric conventions per phase row (omit metrics on `○` pending rows):
471
+ - **Plan ✓**: `N subtasks`
472
+ - **Execute ✓**: `N commits, K tests` (or `N/M subtasks` mid-execute on `●`)
473
+ - **Verify ✓**: `APPROVED a/b/c/d` (completeness/correctness/quality/coverage)
474
+ - **Review ✓**: `APPROVE a/b/c/d/e/f, K findings fixed` (or `request-changes, K open`)
475
+ - **Ship ✓**: `PR #N` (the SHIPPED collapsed variant — see below)
476
+
477
+ When ship completes (lifecycle `shipped-pending-merge` + PR URL exists), collapse to the SHIPPED variant:
478
+
479
+ ```
480
+ ┌─ {short task name} ────────────────────── ✅ SHIPPED
481
+ │ Plan ✓ Execute ✓ Verify ✓ Review ✓ Ship ✓
482
+ │ PR #{N}: {url}
483
+ └───────────────────────────────────────────────────
450
484
  ```
451
485
 
452
486
  Full auto-chain sequence (STANDARD = 4 phases, DEEP = 5 phases):
@@ -459,6 +493,42 @@ Full auto-chain sequence (STANDARD = 4 phases, DEEP = 5 phases):
459
493
  After EACH agent returns, emit the token running-total line (same pattern
460
494
  as Step 3: `tokens tally` then print `[APT] Tokens: input+output = total`).
461
495
 
496
+ #### Consent-driven --spar-gates auto-inject (FRAMEWORK-RFC-001)
497
+
498
+ The route envelope carries the consent signal deterministically — do NOT
499
+ re-read `.aperant/config.local.json` from prompt-space. Two envelope fields
500
+ drive the decision, both emitted by `route.mjs` per spec §4.10:
501
+
502
+ 1. **`envelope.spar_inject_gates`** — present only on the flag-override path
503
+ (explicit `--quick` / `--deep` / `--debug`) when consent is on AND the
504
+ user did NOT pass an explicit `--spar-gates`. Value is `"plan"` (STANDARD)
505
+ or `"plan,execute"` (DEEP). When set, append `--spar-gates <value>` to
506
+ the chained `/apt:run` invocation. **Do NOT recompute** — the deterministic
507
+ contract lives in code, not prompt-space.
508
+
509
+ 2. **`envelope.spar_consent`** — present on the host-LLM classify path.
510
+ Shape: `{ enabled: boolean, partner: string|null, user_passed_explicit_gates: boolean }`.
511
+ After you (the host model) pick a track via Step 0c:
512
+ - **Track === QUICK or DEBUG: do NOT inject.** QUICK is Fast-Path-exempt
513
+ (CLAUDE.md Fast Path Guarantee); DEBUG produces no spec/plan to spar
514
+ against.
515
+ - **Track === STANDARD** AND `spar_consent.enabled === true` AND
516
+ `spar_consent.user_passed_explicit_gates === false`: append
517
+ `--spar-gates plan` to the `/apt:run` invocation.
518
+ - **Track === DEEP** AND `spar_consent.enabled === true` AND
519
+ `spar_consent.user_passed_explicit_gates === false`: append
520
+ `--spar-gates plan,execute` to the `/apt:run` invocation.
521
+ - `user_passed_explicit_gates === true`: the user already supplied
522
+ `--spar-gates` — do NOT double-inject. Their flag is already in the
523
+ dispatched invocation.
524
+
525
+ If `envelope.spar_consent` is absent (consent never configured) AND
526
+ `envelope.spar_inject_gates` is absent, do NOT inject. The signal is
527
+ **deterministic** — Step 4 reads ONLY the envelope fields above. Do NOT
528
+ re-read `.aperant/config.local.json` from prompt-space; the
529
+ consent-resolution helper is wired into `route.mjs` and the envelope is
530
+ the canonical contract. The structural test grep-locks this invariant.
531
+
462
532
  **execution_mode = "step" or "research":**
463
533
  After each stage in the pipeline, show result and ask before proceeding:
464
534
  ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: apt:caveman
3
+ description: "Ultra-compressed communication mode — toggle terse 'smart caveman' output to cut token usage ~75% while keeping full technical accuracy"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: ops
6
+ intent: configure
7
+ when_to_use: "The user invokes /apt:caveman, or says 'caveman mode', 'talk like caveman', 'be brief', 'less tokens'. Toggles a persistent terse output mode. Off with 'stop caveman' or 'normal mode'."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: false
11
+ agent_name: null
12
+ task_context: none
13
+ default_execution_mode: auto
14
+ execution_modes:
15
+ - auto
16
+ allowed-tools: ""
17
+ argument-hint: "apt:caveman"
18
+ gates: []
19
+ ---
20
+
21
+ Respond terse like smart caveman. All technical substance stay. Only fluff die.
22
+
23
+ ## Persistence
24
+
25
+ ACTIVE EVERY RESPONSE once triggered. No revert after many turns. No filler drift. Still active if unsure. Off only when user says "stop caveman" or "normal mode".
26
+
27
+ ## Rules
28
+
29
+ Drop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries (sure/certainly/of course/happy to), hedging. Fragments OK. Short synonyms (big not extensive, fix not "implement a solution for"). Abbreviate common terms (DB/auth/config/req/res/fn/impl). Strip conjunctions. Use arrows for causality (X -> Y). One word when one word enough.
30
+
31
+ Technical terms stay exact. Code blocks unchanged. Errors quoted exact.
32
+
33
+ Pattern: `[thing] [action] [reason]. [next step].`
34
+
35
+ Not: "Sure! I'd be happy to help you with that. The issue you're experiencing is likely caused by..."
36
+ Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"
37
+
38
+ ### Examples
39
+
40
+ **"Why React component re-render?"**
41
+
42
+ > Inline obj prop -> new ref -> re-render. `useMemo`.
43
+
44
+ **"Explain database connection pooling."**
45
+
46
+ > Pool = reuse DB conn. Skip handshake -> fast under load.
47
+
48
+ ## Auto-Clarity Exception
49
+
50
+ Drop caveman temporarily for: security warnings, irreversible action confirmations, multi-step sequences where fragment order risks misread, user asks to clarify or repeats question. Resume caveman after clear part done.
51
+
52
+ Example — destructive op:
53
+
54
+ > **Warning:** This will permanently delete all rows in the `users` table and cannot be undone.
55
+ >
56
+ > ```sql
57
+ > DROP TABLE users;
58
+ > ```
59
+ >
60
+ > Caveman resume. Verify backup exist first.
61
+
62
+ ## Boundaries
63
+
64
+ Code, commits, PRs: write normal (full sentences in commit bodies / PR descriptions). Only conversational output is compressed. `stop caveman` / `normal mode` reverts.
@@ -22,7 +22,7 @@ gates: []
22
22
  <objective>
23
23
  Debug an issue using the scientific method: observe symptoms, form hypotheses, test them systematically, and reach a conclusion. State persists across context resets via `.aperant/debug/{session-id}/DEBUG.md`.
24
24
 
25
- **Diagnose-discipline posture loader (Pocock adoption AC10).** You MUST
25
+ **Diagnose-discipline posture loader.** You MUST
26
26
  load `appendices/diagnose-discipline.md` into reasoning context at
27
27
  session start. It carries the 6-phase loop (Reproduce → Minimise →
28
28
  Hypothesise → Instrument → Fix → Regression-test) and the **Phase-1
@@ -61,12 +61,44 @@ reproduction, so loading this appendix is non-trivial.
61
61
  ## 1. Initialize or Resume Session
62
62
 
63
63
  Parse `$ARGUMENTS`:
64
- - **New session:** Generate session ID from timestamp (`debug-YYYYMMDD-HHmm`)
65
- - **`--resume <session-id>`:** Read existing `.aperant/debug/{session-id}/DEBUG.md` and continue from last state
66
- - **`--resume` (no id):** Find the most recent session in `.aperant/debug/` and resume it
64
+ - **New session:** resolve a canonical task id (see 1a below), then use it as the `{session-id}` for the debug working directory.
65
+ - **`--resume <session-id>`:** Read existing `.aperant/debug/{session-id}/DEBUG.md` and continue from last state. Skip Section 1a — the session id is already canonical.
66
+ - **`--resume` (no id):** Find the most recent session in `.aperant/debug/` and resume it. Skip Section 1a.
67
67
 
68
68
  If resuming, read DEBUG.md and skip to the current phase (observe/hypothesize/test/conclude).
69
69
 
70
+ ### 1a. Resolve canonical task id (idempotent — new sessions only)
71
+
72
+ DEBUG now produces a canonical state.active_tasks record so `/apt:ship` can find the task via the lite ship profile once the fix is committed. The body owns idempotency because `apt-tools task create` does NOT guard against existing ids (see spec §3 R8).
73
+
74
+ Two invocation paths converge here:
75
+
76
+ - **Router path** (`/apt` → `/apt:debug`): the router has already called `task create` and injected `task_id` into your skill context.
77
+ - **Direct path** (`/apt:debug foo`): no `task_id` in context — you create one now.
78
+
79
+ Sequence:
80
+
81
+ 1. **If `task_id` is present in skill context** (router path):
82
+ ```bash
83
+ apt-tools task get . --id {task_id}
84
+ ```
85
+ - If exit 0 AND the returned record has `track === "DEBUG"` → reuse, skip the create call. Adopt `task_id` as `{session-id}`.
86
+ - Else (record missing OR wrong track) → call:
87
+ ```bash
88
+ apt-tools task create . --description "$ARGUMENTS" --track DEBUG --id {task_id}
89
+ ```
90
+ Adopt the id as `{session-id}`.
91
+
92
+ 2. **If no `task_id` in skill context** (direct path):
93
+ ```bash
94
+ apt-tools task create . --description "$ARGUMENTS" --track DEBUG
95
+ ```
96
+ Parse the generated `task_id` from the envelope and adopt it as `{session-id}`. The canonical id replaces the legacy `debug-YYYYMMDD-HHmm` form.
97
+
98
+ The debug working dir at `.aperant/debug/{session-id}/` stays — that working artifact is preserved (per spec §3 R7). The canonical task record at `.aperant/tasks/{task-id}/` is created in parallel by `task create`, and both share the same id.
99
+
100
+ ### 1b. Create debug working directory
101
+
70
102
  ```bash
71
103
  mkdir -p .aperant/debug/{session-id}
72
104
  mkdir -p .aperant/debug/{session-id}/checkpoints
@@ -1,12 +1,3 @@
1
- <!--
2
- Adapted from Matt Pocock's MIT-licensed skill suite:
3
- https://github.com/mattpocock/skills/blob/main/skills/engineering/diagnose
4
- Licensed under MIT. Modifications: ported as an apt:debug posture loader
5
- so the 6-phase loop attaches to the existing 5-phase apt:debug body
6
- without forking apt:debug's control flow. Aligned with apt:debug's
7
- DEBUG.md state file and checkpoint conventions.
8
- -->
9
-
10
1
  # Diagnose Discipline — apt:debug posture loader (6-phase loop)
11
2
 
12
3
  This appendix loads into `apt:debug`'s reasoning context as a posture
@@ -15,7 +6,7 @@ upgrade. The existing apt:debug body has 5 phases (Observe → Hypothesize
15
6
  symptom-gathering with reproduction. Open question #1 was verified — the
16
7
  gap is real, the appendix is non-trivial.
17
8
 
18
- This appendix carries the 6-phase Pocock discipline. The skill body
9
+ This appendix carries the 6-phase Aperant discipline. The skill body
19
10
  loads it and uses Phase 1 (Reproduce) as a **hard prerequisite** before
20
11
  advancing from Observe to Hypothesize.
21
12
 
@@ -82,7 +73,7 @@ run on demand to trigger the failure.
82
73
 
83
74
  These are different mental modes. Minimise asks "what's the smallest
84
75
  thing that still fails?" — a reductive activity. Hypothesise asks
85
- "WHY does it fail?" — an explanatory activity. Pocock's discipline
76
+ "WHY does it fail?" — an explanatory activity. the discipline
86
77
  separates them because skipping Phase 2 and going straight from "I can
87
78
  repro" to "here's why" tends to anchor on the first plausible cause
88
79
  and miss alternatives.
@@ -47,7 +47,7 @@ These are two postures of the same skill, not two different skills. The
47
47
  intent-detection step below decides which one to enter — same file, same
48
48
  artifact layout, different section populated.
49
49
 
50
- **Decision-lock posture loader (Pocock adoption ID-02 + ID-04 — AC11).**
50
+ **Decision-lock posture loader (ID-02 + ID-04 — AC11).**
51
51
  When entering decision-lock posture, you MUST load
52
52
  `appendices/grill-discipline.md` into reasoning context. It carries the
53
53
  validated 100-token reframe sentence ("Your job is not to emit a plan;
@@ -60,7 +60,7 @@ source for the autonomy-aware rule; downstream skills (`apt:improve`,
60
60
  `apt:triage`) reference it rather than re-stating the policy. Brainstorm
61
61
  posture does NOT load this appendix.
62
62
 
63
- **Brainstorm posture zoom-out helper (Pocock adoption AC6 + AC11).**
63
+ **Brainstorm posture zoom-out helper (AC6 + AC11).**
64
64
  When in brainstorm posture and the user's turn contains a zoom-out
65
65
  trigger phrase ("give me a broader picture", "I'm lost in this area",
66
66
  "explain how this fits", "what's the surrounding architecture", "zoom
@@ -565,9 +565,9 @@ Review-Auto is Auto Mode **plus one human checkpoint at the batch end**. It does
565
565
 
566
566
  Do NOT introduce per-decision staging ("show me D-01, wait, show me D-02, wait...") — that collapses review-auto into spaced interactive mode and defeats the point of joint reasoning up front. Do NOT skip the pause ("autonomy is high, let's just write it") — that collapses review-auto into auto. The one pause at the end is the whole identity of this mode.
567
567
 
568
- ## 6.5. Grill Mode (`--grill` flag — Pocock `grill-with-docs` overlay)
568
+ ## 6.5. Grill Mode (`--grill` flag — Aperant `grill-with-docs` overlay)
569
569
 
570
- **Activate when:** the user invoked the skill with `--grill`. This is an **overlay**, not a mode — it stacks on top of whichever Section 6 mode is active (Interactive by default; combine with `--auto` etc. as desired). The overlay does two things: (1) it applies Pocock's 4 grill moves during decision resolution; (2) it fires inline writes to CONTEXT.md and ADRs as terms resolve and decisions pass the Nygard 3-gate.
570
+ **Activate when:** the user invoked the skill with `--grill`. This is an **overlay**, not a mode — it stacks on top of whichever Section 6 mode is active (Interactive by default; combine with `--auto` etc. as desired). The overlay does two things: (1) it applies the 4 grill moves during decision resolution; (2) it fires inline writes to CONTEXT.md and ADRs as terms resolve and decisions pass the Nygard 3-gate.
571
571
 
572
572
  The discipline this overlay loads is already in [`appendices/grill-discipline.md`](./appendices/grill-discipline.md) — re-read the reframe sentence and the autonomy degradation table before each grill turn. **Do NOT duplicate that content here.** What follows is only the moves + writer-call instructions specific to the overlay.
573
573
 
@@ -1,12 +1,3 @@
1
- <!--
2
- Adapted from Matt Pocock's MIT-licensed skill suite:
3
- https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs
4
- Licensed under MIT. Modifications: ported as an apt:discuss posture loader,
5
- extended with the validated 100-token reframe sentence and the
6
- autonomy-aware degradation table from the Pocock adoption brainstorm
7
- (Architectural principles to lock §2).
8
- -->
9
-
10
1
  # Grill Discipline — apt:discuss posture loader
11
2
 
12
3
  This appendix loads into `apt:discuss`'s reasoning context whenever the
@@ -15,7 +6,7 @@ skill is invoked in decision-lock posture (or as a sub-step inside
15
6
  artifacts:
16
7
 
17
8
  1. The 100-token **reframe sentence** validated by the V2 grill-comparison
18
- experiment (43/44 vs 38/44 blind-judge score against Pocock's verbatim
9
+ experiment (43/44 vs 38/44 blind-judge score against the verbatim
19
10
  `grill-with-docs`).
20
11
  2. The **autonomy-aware degradation table** that prevents full-auto runs
21
12
  from grinding to a halt grilling every gray area.
@@ -98,7 +89,7 @@ where the user has a concrete task with implicit gray areas). The
98
89
  options) does NOT load this appendix; brainstorm has its own posture
99
90
  encoded in apt:discuss's `<objective>` block.
100
91
 
101
- `apt:zoom-out` (a sibling skill, also Pocock-adopted) does NOT load
92
+ `apt:zoom-out` (a sibling skill, also adopted) does NOT load
102
93
  this appendix. Zoom-out is descriptive ("show me the broader picture"),
103
94
  not normative ("lock this decision"). Loading grill-discipline there
104
95
  would mis-fire the reframe sentence on a read-only operation.
@@ -1,11 +1,3 @@
1
- <!--
2
- Adapted from Matt Pocock's MIT-licensed skill suite:
3
- https://github.com/mattpocock/skills/blob/main/skills/engineering/zoom-out
4
- Licensed under MIT. Modifications: ported as a loaded-helper for apt:discuss
5
- brainstorm mode so the discipline activates without spawning the full
6
- apt:zoom-out skill (the latter is a router-invocable verb on its own).
7
- -->
8
-
9
1
  # Zoom-Out Helper — apt:discuss brainstorm mode loaded helper
10
2
 
11
3
  This appendix loads into `apt:discuss` brainstorm mode when the user's
@@ -15,7 +15,7 @@ execution_modes:
15
15
  - auto
16
16
  - step
17
17
  allowed-tools: "Read, Write, Edit, Bash, Grep, Glob"
18
- argument-hint: "apt:execute [--continue] [--subtask <id>] [--parallel] [--wave <N>] [--tdd] [--no-tdd]"
18
+ argument-hint: "apt:execute [--continue] [--subtask <id>] [--parallel] [--wave <N>] [--tdd] [--no-tdd] [--spar]"
19
19
  gates:
20
20
  - constitution-read
21
21
  - constitution-coverage
@@ -139,7 +139,7 @@ Before loading context, determine execution mode:
139
139
 
140
140
  4. **If Sequential Mode:** proceed to Section 1 below (existing behavior, unchanged).
141
141
 
142
- ### 0a.1. TDD Discipline Detection (Pocock adoption AC3)
142
+ ### 0a.1. TDD Discipline Detection
143
143
 
144
144
  Compute whether the vertical-tracer-bullet TDD discipline is active for
145
145
  this run. The `<tdd_iron_law>` block in Section 3c is gated on this
@@ -168,13 +168,13 @@ else:
168
168
 
169
169
  Carry `tdd_active` forward to Section 3c. When `tdd_active === false`,
170
170
  the iron-law block is skipped entirely and execute behaves identically
171
- to the pre-Pocock single-commit flow. When `tdd_active === true`, the
171
+ to the pre-vertical-slice single-commit flow. When `tdd_active === true`, the
172
172
  red-green-refactor sequence is mandatory and audited by gate G9.
173
173
 
174
174
  **The QUICK exemption is a constraint, not a toggle.** A user who passes
175
175
  `--tdd` on a QUICK-routed task gets `tdd_active = false` and a one-line
176
176
  note in the run report: "TDD requested but skipped — QUICK Fast Path
177
- Guarantee (ID-05)". The Pocock appendix
177
+ Guarantee (ID-05)". The Aperant appendix
178
178
  `appendices/tdd-mode.md` carries the rationale.
179
179
 
180
180
  ## 1. Load Context
@@ -453,6 +453,19 @@ After all subtasks are completed:
453
453
  node packages/framework/bin/apt-tools.mjs commit "build: all subtasks complete" --files implementation_plan.json build-progress.json
454
454
  ```
455
455
 
456
+ ### Mark lifecycle phase as `verifying`
457
+
458
+ Flip the task's lifecycle phase at the success-end boundary so the next stage
459
+ (`/apt:verify`) finds the task in the correct from-state. Mirror the same CLI
460
+ shape as the start-boundary call in Section 2 — quick tasks (no phase linkage)
461
+ silently no-op, and the update is idempotent so it is safe to re-run on
462
+ `--continue`. Skip this step if any subtask ended in `"blocked"` — only the
463
+ all-subtasks-completed branch should advance the phase.
464
+
465
+ ```bash
466
+ node packages/framework/bin/apt-tools.mjs task update . --id {task-id} --lifecycle-phase verifying
467
+ ```
468
+
456
469
  Output:
457
470
  ```
458
471
  Execution complete:
@@ -463,6 +476,29 @@ Execution complete:
463
476
  Next: /apt:verify
464
477
  ```
465
478
 
479
+ ### 4a. --spar flag (FRAMEWORK-RFC-001)
480
+
481
+ If `$ARGUMENTS` contained `--spar`, dispatch `/apt:spar` against the
482
+ just-completed implementation before reporting Next.
483
+
484
+ Topic frame: 1-2 sentences derived from `build-progress.json` summarizing
485
+ the diff that just landed (e.g. "N subtasks completed against the M-file
486
+ plan; the largest change touched <path>"). If `build-progress.json` is
487
+ missing or empty (corner case), use the task description from
488
+ `.aperant/state.json` as a graceful fallback.
489
+
490
+ Same `--timeout-ms 120000` pipeline-mode budget and NO `--rounds` flag
491
+ (per FRAMEWORK-BUG-038 — pipeline gates always defer to the skill
492
+ default). When merged-config `spar.partner` is set, append `--with <partner>`.
493
+
494
+ ```
495
+ /apt:spar --timeout-ms 120000 [--with <partner>] <topic-frame-from-build-progress.json>
496
+ ```
497
+
498
+ After spar returns, append the termination headline + Layer 2 path
499
+ (`.aperant/spar/<slug>-<ts>.md`) into the report output so the user can
500
+ review findings before invoking `/apt:verify`.
501
+
466
502
  ## 5. Wave-Parallel Execution
467
503
 
468
504
  When wave mode is active (determined in Section 0), execution follows the wave structure instead of flat sequential order. This is the throughput multiplier — independent subtasks run in parallel across multiple agent contexts.
@@ -1,16 +1,8 @@
1
- <!--
2
- Adapted from Matt Pocock's MIT-licensed skill suite:
3
- https://github.com/mattpocock/skills/blob/main/skills/engineering/tdd
4
- Licensed under MIT. Modifications: ported as an apt:execute appendix
5
- gated by `tdd_active` (config.coding.tdd_default || --tdd flag) and
6
- made QUICK-exempt per Aperant's Fast Path Guarantee (ID-05).
7
- -->
8
-
9
1
  # TDD Mode — Vertical Tracer-Bullet Discipline (apt:execute appendix)
10
2
 
11
3
  This appendix loads into `apt:execute`'s context when `tdd_active === true`
12
4
  (see SKILL.md §0a.1). It carries the vertical-tracer-bullet discipline
13
- Pocock's `tdd` skill captured. The audit gate G9 (`tdd-iron-law`) enforces
5
+ the `tdd` skill captured. The audit gate G9 (`tdd-iron-law`) enforces
14
6
  the commit order; this prose explains the **why**.
15
7
 
16
8
  ## Why vertical tracer bullets, not horizontal layers
@@ -90,7 +82,7 @@ that their flag was overridden by the constraint.
90
82
  ## Backward-compat alias
91
83
 
92
84
  The legacy `config.tdd.iron_law` key continues to enable TDD for
93
- projects that adopted Aperant before the Pocock content-format
85
+ projects that adopted Aperant before content-format
94
86
  upgrade. The new computation rolls it into `tdd_active`:
95
87
 
96
88
  ```
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: apt:fan-out
3
+ description: "Cross-task fan-out — spawn N apt-executor workers from one conductor terminal, each in its own worktree"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: execute
6
+ intent: x-fan-out
7
+ when_to_use: "You have N pre-planned, independent tasks (no file overlap, no cross-dependencies) and want to run them concurrently from a single host CLI session."
8
+ user_invocable: true
9
+ internal: false
10
+ spawns_agent: true
11
+ agent_name: "apt-executor"
12
+ task_context: require-existing
13
+ default_execution_mode: auto
14
+ execution_modes:
15
+ - auto
16
+ - step
17
+ allowed-tools: "Bash, Read, Write, Task"
18
+ argument-hint: "apt:fan-out --tasks <id,id,id> [--phases <m/p,m/p>] [--unblocked]"
19
+ gates: []
20
+ ---
21
+ <objective>
22
+ Run N pre-planned Aperant tasks concurrently from one conductor terminal. This skill is a thin orchestrator over the generalized wave engine (`unit_kind: "task"` path, see ADR-0003) and the existing primitives: `apt-tools worktree create --task`, `apt-tools lock claim`, `apt-tools event append`, and the `parallelization.max_tasks` quota. No daemon, no job queue, no in-skill scheduling. The host CLI's main thread is the conductor (ADR-0001); each spawned apt-executor subagent runs in its own worktree (ADR-0002).
23
+
24
+ This is the "I have 16 unblocked tasks in this phase, run them all" surface. It replaces the old workaround of opening 16 sibling terminals manually.
25
+ </objective>
26
+
27
+ <your_environment>
28
+ - **Working directory:** Project root (where you were invoked).
29
+ - **apt-tools path:** `node packages/framework/bin/apt-tools.mjs` (or `node .aperant/deps/node_modules/@aperant/framework/bin/apt-tools.mjs` when running from an install mirror).
30
+ - **Concurrency cap:** `parallelization.max_tasks` from `.aperant/config.json` (default 4, no paternalism cap per D-07). Read via `cli/config/parallelization.mjs:getMaxTasks(config)`.
31
+ - **Worker identity:** Each spawned worker exports `APT_AGENT_ID=fanout-${batch_id}-${task_id}` before any `apt-tools ...` invocation (per FRAMEWORK-BUG-033 defect 3). This pins their `team-status/{agentId}.json` rows across short-lived CLI calls.
32
+ - **Constitution:** Read `AGENTS.md` if it exists.
33
+ </your_environment>
34
+
35
+ <state_files>
36
+ ## State Files
37
+
38
+ **Reads:**
39
+ - `.aperant/state.json` — `active_tasks[*]` filtered when `--phases` or `--unblocked` resolves the task list.
40
+ - `.aperant/roadmap/{scope}/milestones.json` — milestone/phase membership for `--phases`.
41
+ - `.aperant/config.json:parallelization.max_tasks` — concurrency cap.
42
+
43
+ **Writes (indirectly via spawned workers):**
44
+ - `.aperant/team-status/fanout-${batch_id}-${task_id}.json` — one stable file per worker (per FRAMEWORK-BUG-033 defect 3 fix).
45
+ - `.aperant/state.json:active_tasks[*].assigned_to` — workers stamp their `APT_AGENT_ID` on claim (per FRAMEWORK-BUG-033 defect 2 fix).
46
+ - `.aperant/events/{today}.jsonl` — `task-claimed`, `wave-started`, `wave-completed` events.
47
+
48
+ **No filesystem state of its own.** The skill body is pure orchestration glue; all heavy lifting reuses existing primitives.
49
+ </state_files>
50
+
51
+ <process>
52
+
53
+ ## 1. Resolve the batch — canonical task ID list
54
+
55
+ The three input forms (`--tasks`, `--phases`, `--unblocked`) all resolve to a canonical `task_ids: [...]` list via the apt-tools helper:
56
+
57
+ ```bash
58
+ node packages/framework/bin/apt-tools.mjs fan-out resolve . --tasks T1,T2,T3,T4
59
+ # OR
60
+ node packages/framework/bin/apt-tools.mjs fan-out resolve . --phases m1/p1,m1/p2
61
+ # OR
62
+ node packages/framework/bin/apt-tools.mjs fan-out resolve . --unblocked
63
+ ```
64
+
65
+ Returns:
66
+ ```json
67
+ {
68
+ "status": "ok",
69
+ "command": "fan-out-resolve",
70
+ "task_ids": ["T1", "T2", "T3", "T4"],
71
+ "source": "tasks",
72
+ "batch_id": "fanout-20260519-abc123"
73
+ }
74
+ ```
75
+
76
+ If `--tasks` IDs fail the `/^[a-z0-9_-]+$/i` validation regex, the helper returns `status: error` and the skill body MUST abort.
77
+
78
+ ## 2. Ensure each task has a worktree
79
+
80
+ For each `task_id` in the batch:
81
+
82
+ ```bash
83
+ node packages/framework/bin/apt-tools.mjs worktree create --task ${task_id}
84
+ ```
85
+
86
+ (Skip if `state.active_tasks[task_id].worktree_path` is already set — the create command is idempotent.)
87
+
88
+ ## 3. Spawn N apt-executor subagents
89
+
90
+ Read the `parallelization.max_tasks` cap from `.aperant/config.json` (or default 4). Slice `task_ids` into batches of size `min(cap, task_ids.length)`. For each task in the current batch, dispatch via the host CLI's `Task` tool with `run_in_background: true`:
91
+
92
+ - `subagent: apt-executor`
93
+ - `prompt` includes:
94
+ - `batch_id` (from step 1)
95
+ - `task_id`
96
+ - The worktree path for this task
97
+ - A reminder: "Export `APT_AGENT_ID=fanout-${batch_id}-${task_id}` in every Bash invocation that runs `apt-tools` — see `packages/framework/agents/apt-executor.md` §0a."
98
+
99
+ The executor agent's `<process>` §0a already documents the env-export rule; the spawn prompt just has to seed `batch_id` and `task_id`.
100
+
101
+ ## 4. Poll team-status until all workers reach a terminal state
102
+
103
+ ```bash
104
+ node packages/framework/bin/apt-tools.mjs team list .
105
+ ```
106
+
107
+ Each worker's row uses its `APT_AGENT_ID=fanout-${batch_id}-${task_id}`. A worker is "done" when its corresponding task's `lifecycle_phase` is one of `closed`, `shipped-pending-merge`, or `blocked`.
108
+
109
+ **On each poll, re-render the multi-task phase rail verbatim** — one boxed panel per worker, branch glyphs `┌─ │ └─` separating panels, status glyphs `✓` (done) / `●` (active) / `○` (pending), inline metrics on completed rows. Pull metrics from each worker's `build-progress.json` / `qa_signoff.json` / `review.json` (see paths in `.aperant/tasks/{task_id}/`):
110
+
111
+ ```
112
+ [APT] Fan-out status: {N} workers
113
+ ┌─ {task 1 short name} ─────────────────────────────
114
+ │ Phase 1 Plan ✓
115
+ │ Phase 2 Execute ✓ 7 commits, 81 tests
116
+ │ Phase 3 Verify ✓ APPROVED 9/10/9/9
117
+ │ Phase 4 Review ✓ APPROVE 9/9/9/10/10, 5 findings fixed
118
+ │ Phase 5 Ship ● opening PR
119
+
120
+ └─ {task 2 short name} ─────────────────────────────
121
+ Phase 1 Plan ✓
122
+ Phase 2 Execute ✓ 14 commits, 129 tests
123
+ Phase 3 Verify ● running
124
+ Phase 4 Review ○
125
+ Phase 5 Ship ○
126
+
127
+ Churned for {Xm Ys} · {K} local agents still running
128
+ ```
129
+
130
+ The first panel uses `┌─ ... │` (top-with-stem); the LAST panel uses `└─ ... ` (bottom corner). Footer line: "Churned" = elapsed since the most recent lifecycle event across all in-flight workers; "K local agents still running" = count of workers whose `lifecycle_phase` is non-terminal AND `assigned_to` is non-null.
131
+
132
+ ## 5. Report
133
+
134
+ When all workers reach a terminal state, render the rail one final time. For each shipped worker (lifecycle `shipped-pending-merge` + `pr_url` set), collapse that panel to the SHIPPED variant:
135
+
136
+ ```
137
+ [APT] Fan-out complete
138
+ ┌─ {task 1 short name} ────────────────────── ✅ SHIPPED
139
+ │ Plan ✓ Execute ✓ Verify ✓ Review ✓ Ship ✓
140
+ │ PR #{N}: {url}
141
+
142
+ └─ {task 2 short name} ─────────────────────── ⚠ BLOCKED
143
+ {one-line reason}
144
+ ```
145
+
146
+ Mix SHIPPED / BLOCKED / in-flight variants in the same rail. Below the panel, emit one consolidated summary: which tasks closed (verdict + PR URL), which are awaiting merge, which blocked. Recommend `/apt:close-task --all` for the post-merge sweep. The `[APT] Fan-out` header lines above each rail are the backward-compat markers for external log-grep tooling — keep them.
147
+
148
+ </process>
149
+
150
+ ## Design references
151
+
152
+ - **ADR-0001** — Host CLI main thread is the conductor; no daemon, no in-skill queue.
153
+ - **ADR-0002** — One worktree per task; workers run independent feature branches.
154
+ - **ADR-0003** — Wave engine accepts `unit_kind: "task"` so cross-task fan-out reuses the same primitives as intra-task subtask waves.
155
+
156
+ ## Config keys
157
+
158
+ - `parallelization.max_tasks` (default 4) — concurrency cap for the spawn loop.
159
+ - `parallelization.max_agents` (default 4) — global agent quota; the spawn loop respects whichever cap is lower.