@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
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: apt:handoff
3
+ description: "Agent-to-agent handoff — compact current conversation into a HANDOFF artifact in the repo for a fresh agent to pick up"
4
+ apt-skill-version: {{APT_VERSION}}
5
+ stage: pause
6
+ intent: capture
7
+ when_to_use: "An agent (not a human) needs to transfer in-flight work to a different agent — different model, different CLI, a fan-out peer, or a fresh context window. Writes a HANDOFF artifact under .aperant/ so the receiver picks up exactly where the sender left off. NOT for human end-of-day stops (use /apt:pause) and NOT for harness auto-compact (the query loop handles that itself)."
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
+ - step
17
+ allowed-tools: "Bash, Read, Write"
18
+ argument-hint: "apt:handoff [what the next session will focus on]"
19
+ gates: []
20
+ ---
21
+ <objective>
22
+ Compact the current conversation into a HANDOFF document so a different agent — different model, different CLI, fan-out peer, or fresh context window — can pick up the work without re-discovering everything you already know.
23
+
24
+ Writes the handoff to `.aperant/handoffs/{id}/HANDOFF.md` (or `{task_dir}/handoffs/{id}/HANDOFF.md` when inside a routed task) so the artifact lives with the repo, survives across machines, and is discoverable by `/apt:resume` and team-status tooling.
25
+
26
+ **Use when:** an agent decides to transfer the work mid-flight. Examples — sender hit context-budget cap, the next phase needs a different model (e.g. Codex for a heavy refactor), a fan-out conductor is sharding scope to peers, or a planning agent is handing a locked plan to an executor.
27
+
28
+ **Do NOT use when:**
29
+ - The human operator wants to stop — use `/apt:pause` (it stashes uncommitted work and updates `CONTINUE_INDEX.md`).
30
+ - The harness is about to auto-compact — the query loop handles that itself; agents executing plans must checkpoint to `build-progress.json` instead.
31
+ - A new task is starting fresh — use `/apt` (router) or `/apt:plan`.
32
+ </objective>
33
+
34
+ <your_environment>
35
+ - **Working directory:** The project root (or current task worktree if `state.active_tasks[taskId].worktree_path` is set)
36
+ - **apt-tools path:** `node packages/framework/bin/apt-tools.mjs` or the locally installed `apt-tools` binary
37
+ - **Constitution:** Read `AGENTS.md` in the project root if it exists
38
+ - **Handoff index:** `.aperant/HANDOFFS_INDEX.md`
39
+ - **Sibling skills:** `/apt:pause` (human stop), `/apt:resume` (restore from CONTINUE *or* HANDOFF), `/apt:fan-out` (parallel peers)
40
+ </your_environment>
41
+
42
+ <state_files>
43
+ ## State Files
44
+
45
+ **Reads:**
46
+ - `AGENTS.md` — Project constitution
47
+ - Active Aperant artifacts for the current task, if any:
48
+ - `{task_dir}/spec.md`, `{task_dir}/implementation_plan.json`, `{task_dir}/build-progress.json`
49
+ - `{task_dir}/qa_signoff.json`, `{task_dir}/review.json`
50
+ - `.aperant/debug/*/DEBUG.md`, `.aperant/quick/*/TASK.md`
51
+ - Git state (branch, uncommitted changes, recent commits)
52
+ - `.aperant/state.json` — active tasks, worktree paths
53
+
54
+ **Writes:**
55
+ - `{task_dir}/handoffs/{handoff-id}/HANDOFF.md` — if inside a routed task
56
+ - `.aperant/handoffs/{handoff-id}/HANDOFF.md` — if ad-hoc work outside any task
57
+ - `.aperant/HANDOFFS_INDEX.md` — index of all open handoffs
58
+
59
+ **Does NOT touch:**
60
+ - The git working tree. Handoffs are read-only against code. If there are uncommitted changes the sender intends the receiver to keep working on, reference them in the HANDOFF (path + status from `git status --short`) — do NOT stash. Stashing is `/apt:pause` semantics, not `/apt:handoff`.
61
+ </state_files>
62
+
63
+ <process>
64
+
65
+ ## 1. Determine Handoff Location
66
+
67
+ Generate a handoff id: `handoff-{YYYYMMDD-HHMM}-{short-slug-of-next-focus}` (e.g. `handoff-20260522-1430-finish-mcp-token-rotation`).
68
+
69
+ **If inside a routed task** (task_dir is known from the conversation, or `state.json` has an active task for the current branch):
70
+ - Write to `{task_dir}/handoffs/{handoff-id}/HANDOFF.md`
71
+
72
+ **If ad-hoc work** (manual coding, not routed through /apt):
73
+ - Write to `.aperant/handoffs/{handoff-id}/HANDOFF.md`
74
+
75
+ ```bash
76
+ mkdir -p {handoff_dir}
77
+ ```
78
+
79
+ ## 2. Gather Current State
80
+
81
+ ### 2a. Git State
82
+ ```bash
83
+ git branch --show-current
84
+ git status --short
85
+ git log --oneline -5
86
+ git stash list
87
+ ```
88
+
89
+ ### 2b. Active Aperant Artifacts
90
+ Check and read status of any of: `implementation_plan.json`, `build-progress.json`, `qa_signoff.json`, `review.json`, `.aperant/debug/*/DEBUG.md`.
91
+
92
+ ### 2c. Conversation Context
93
+ From the current conversation, extract:
94
+ - What task was being worked on and the user's framing of why
95
+ - Key decisions made + rationale (especially decisions NOT obvious from the diff)
96
+ - What was tried, what worked, what failed and why
97
+ - Live blockers and open questions
98
+ - Any external state the receiver must check (running processes, deployed previews, CI runs, MCP server sessions)
99
+
100
+ ## 3. Write HANDOFF.md
101
+
102
+ Create `{handoff_dir}/HANDOFF.md`:
103
+
104
+ ```markdown
105
+ # Handoff: {one-line summary of what the next agent should focus on}
106
+
107
+ ## Session Info
108
+ - **Date:** {ISO datetime}
109
+ - **Sender:** {model + CLI, e.g. "Claude Opus 4.7 / Claude Code"}
110
+ - **Suggested receiver:** {model + CLI hint, or "any agent"}
111
+ - **Branch:** {current branch}
112
+ - **Worktree:** {worktree_path if task-isolated, else repo root}
113
+ - **Last commit:** {hash} — {message}
114
+ - **Task ID:** {task-id, if routed task; else "ad-hoc"}
115
+
116
+ ## Focus For The Receiver
117
+ {The single most important paragraph — what is the receiver supposed to DO next, in concrete terms. If the user passed args to /apt:handoff, that text drives this section.}
118
+
119
+ ## What Was Being Done
120
+ {Plain-language description of the current activity and how it fits the broader task.}
121
+
122
+ ## Decisions Made (do NOT relitigate)
123
+ - {decision 1} — {rationale}
124
+ - {decision 2} — {rationale}
125
+
126
+ ## Existing Artifacts (read these, do not duplicate)
127
+ - `{path or URL}` — {what it contains, why it matters}
128
+ - `{path or URL}` — {what it contains, why it matters}
129
+
130
+ > Reference paths and URLs instead of pasting content. PRDs, plans, ADRs, issues, commits, diffs, /apt:debug DEBUG.md, /apt:design DESIGN.md — link, don't copy.
131
+
132
+ ## Current State
133
+ - **Pipeline stage:** {plan | execute | verify | review | debug | design | quick | none}
134
+ - **Subtask progress:** {n}/{total} (if applicable, with the in-flight subtask id)
135
+ - **Uncommitted changes:** {yes/no — list files, do not stash}
136
+ - **External state the receiver must check:** {running dev servers, open PRs, MCP sessions, etc.}
137
+
138
+ ## Blockers
139
+ - {blocker 1 — what's needed to unblock, and which file/person/check resolves it}
140
+ - (none)
141
+
142
+ ## What Was Tried
143
+ - {approach 1} — {outcome}
144
+ - {approach 2} — {outcome}
145
+
146
+ ## Next Steps (ordered)
147
+ 1. {immediate next action}
148
+ 2. {following action}
149
+ 3. {…}
150
+
151
+ ## Suggested Skills
152
+ Tell the receiver which Aperant skills are likely to fire next. Map verbs to the live `/apt:*` registry — do NOT invent skill names.
153
+
154
+ - `/apt:resume` — first thing the receiver should run to load this handoff into context.
155
+ - `/apt:execute` — if a plan exists and subtasks remain.
156
+ - `/apt:debug` — if the open blocker is a reproducible bug without a known cause.
157
+ - `/apt:spar` — if the next decision wants a second-LLM challenge before committing.
158
+ - `/apt:plan` — if scope changed and the existing plan is stale.
159
+ - (omit any that don't apply)
160
+
161
+ ## Redaction Checklist
162
+ Before saving, scrub the HANDOFF for:
163
+ - [ ] API keys, bearer tokens, OAuth secrets (Anthropic, Stripe, Convex, GitHub, etc.)
164
+ - [ ] Database connection strings with passwords
165
+ - [ ] Personally identifiable information not already in the repo
166
+ - [ ] Internal URLs that should not leave the team
167
+ ```
168
+
169
+ ## 4. Update Handoff Index
170
+
171
+ Update `.aperant/HANDOFFS_INDEX.md`. Create with this header if it does not exist:
172
+ ```markdown
173
+ # Open Handoffs
174
+
175
+ | Focus | Branch | Date | Suggested receiver | Location |
176
+ |-------|--------|------|--------------------|----------|
177
+ ```
178
+
179
+ Append one row:
180
+ ```
181
+ | {focus (truncated to 60 chars)} | {branch} | {YYYY-MM-DD HH:MM} | {model hint or "any"} | {relative path to HANDOFF.md} |
182
+ ```
183
+
184
+ If a row already exists for this handoff path, update it instead of appending.
185
+
186
+ ## 5. Report
187
+
188
+ ```
189
+ Handoff written: {handoff_dir}/HANDOFF.md
190
+
191
+ Summary:
192
+ Focus: {one-line}
193
+ Branch: {branch}
194
+ Pipeline stage: {stage}
195
+ Suggested next skill: {/apt:resume → /apt:{stage}}
196
+ Open handoffs: {total count from index}
197
+
198
+ Receiver picks up with:
199
+ /apt:resume # discovers this handoff via HANDOFFS_INDEX.md
200
+ OR read {handoff_dir}/HANDOFF.md directly
201
+ ```
202
+
203
+ </process>
204
+
205
+ <notes>
206
+ ## Why this skill exists separately from /apt:pause
207
+
208
+ `/apt:pause` and `/apt:handoff` write the same shape of artifact but have different triggers and side effects:
209
+
210
+ | | `/apt:pause` | `/apt:handoff` |
211
+ |---|---|---|
212
+ | Trigger | Human types it | Agent decides mid-work |
213
+ | Audience | Future-you (same human) | A different agent |
214
+ | Uncommitted work | Stashes via `git stash` | Does NOT stash — references in-place |
215
+ | Index file | `.aperant/CONTINUE_INDEX.md` | `.aperant/HANDOFFS_INDEX.md` |
216
+ | Artifact name | `CONTINUE.md` | `HANDOFF.md` |
217
+ | Typical follow-up | Human runs `/apt:resume` hours/days later | Receiver agent runs `/apt:resume` immediately |
218
+
219
+ Keeping the index files separate lets `/apt:resume` distinguish "the human stopped here" from "another agent dropped this in your lap" when presenting recovery options.
220
+
221
+ ## Receiver contract
222
+
223
+ The receiver is expected to:
224
+ 1. Run `/apt:resume` (or read HANDOFF.md directly).
225
+ 2. Load the referenced artifacts (paths under "Existing Artifacts").
226
+ 3. Verify the listed external state still holds (e.g. dev server still running, PR still open).
227
+ 4. Delete the HANDOFF.md and its index row after picking up. `/apt:resume` handles the cleanup automatically; manual readers should do it themselves to keep `HANDOFFS_INDEX.md` from drifting.
228
+ </notes>
@@ -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/improve-codebase-architecture/DEEPENING.md
4
- Licensed under MIT. Modifications: scoped to Aperant's apt:improve
5
- Phase-1 explore step and aligned with the deletion-test priority
6
- rubric in Phase 2.
7
- -->
8
-
9
1
  # DEEPENING — Domain-modeling depth lens
10
2
 
11
3
  This lens asks: **does this area model the domain at the right depth?**
@@ -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/improve-codebase-architecture/INTERFACE-DESIGN.md
4
- Licensed under MIT. Modifications: scoped to Aperant's apt:improve
5
- Phase-1 explore step and aligned with apt:review Pass 4's boundary
6
- audit semantics (this lens is proactive; Pass 4 is reactive).
7
- -->
8
-
9
1
  # INTERFACE-DESIGN — Boundary-shape lens
10
2
 
11
3
  This lens asks: **are the boundaries between modules well-shaped?** Are
@@ -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/improve-codebase-architecture/LANGUAGE.md
4
- Licensed under MIT. Modifications: scoped to Aperant's apt:improve
5
- Phase-1 explore step and aligned with CONTEXT.md's aliases-to-avoid
6
- field — this lens reads that field to catch term conflations.
7
- -->
8
-
9
1
  # LANGUAGE — Naming-consistency lens
10
2
 
11
3
  This lens asks: **does the codebase use the same word for the same
@@ -22,15 +22,15 @@ gates: []
22
22
 
23
23
  # Improve — Proactive Refactor Discovery
24
24
 
25
- Open question #2 in the Pocock adoption spec was answered concretely:
25
+ Open question #2 in adoption spec was answered concretely:
26
26
  `apt:review` Pass 4 (architecture) is strictly **reactive** — it audits
27
27
  the current diff for boundary violations. The work-intent "look at this
28
28
  codebase and tell me what to refactor proactively" has no home today
29
29
  (users retrofit it onto `apt:discuss --brainstorm` or `/apt:roundtable`,
30
30
  both scope-mismatched). This skill is that home.
31
31
 
32
- **Pocock adoption attribution.** 3-phase workflow + DEEPENING /
33
- INTERFACE-DESIGN / LANGUAGE lenses ported from Matt Pocock's MIT-licensed
32
+ **Aperant adoption attribution.** 3-phase workflow + DEEPENING /
33
+ INTERFACE-DESIGN / LANGUAGE lenses ported from
34
34
  `improve-codebase-architecture` skill. Aperant-specific: spawns the
35
35
  `apt-improver` agent and references `apt-discuss/appendices/grill-discipline.md`
36
36
  as the canonical source for the autonomy-aware deepening loop rather than
@@ -118,7 +118,7 @@ The deepening loop produces a concrete refactor plan (which becomes
118
118
  - `INTERFACE-DESIGN.md` — boundary-shape lens
119
119
  - `LANGUAGE.md` — naming-consistency lens
120
120
 
121
- All three are ported from Matt Pocock's improve-codebase-architecture
121
+ All three are ported from 's improve-codebase-architecture
122
122
  skill with MIT attribution per AC15.
123
123
 
124
124
  ## Agent spawned
@@ -19,7 +19,7 @@ execution_modes:
19
19
  - plan-only
20
20
  - research
21
21
  allowed-tools: "Read, Grep, Glob, Write, Bash, WebSearch"
22
- argument-hint: "apt:plan [task description]"
22
+ argument-hint: "apt:plan [task description] [--spar]"
23
23
  gates:
24
24
  - constitution-read
25
25
  - constitution-coverage
@@ -33,7 +33,7 @@ Analyze a task, assess complexity, investigate the codebase, and produce a struc
33
33
  - **apt-tools path:** `node packages/framework/bin/apt-tools.mjs` or the locally installed `apt-tools` binary
34
34
  - **Prompts directory:** Installed alongside this command in the @aperant/framework package
35
35
  - **Constitution:** Read `AGENTS.md` in the project root if it exists — it defines project principles, tech stack, and conventions that override defaults
36
- - **Task directory:** `{task_dir}` — passed from the router. All plan artifacts (spec.md, implementation_plan.json) are written here, NOT to project root.
36
+ - **Task directory:** `{task_dir}` — passed from the router as an absolute main-repo path. All plan artifacts (spec.md, implementation_plan.json) are written here, NOT to project root and NOT to a worktree-local `.aperant/tasks/` directory.
37
37
  </your_environment>
38
38
 
39
39
  <state_files>
@@ -122,9 +122,9 @@ If `{task_dir}/design.md` exists (emitted by a prior `/apt:design` run), load it
122
122
 
123
123
  ## 5. Write Specification
124
124
 
125
- Create `spec.md` in the task directory (`{task_dir}` passed from the router, e.g. `.aperant/tasks/{task-id}/spec.md`).
125
+ Create `spec.md` in the task directory (`{task_dir}` passed from the router, e.g. `/abs/main/repo/.aperant/tasks/{task-id}/spec.md`). Do not use a relative `.aperant/tasks/{task-id}/spec.md` path when the agent is running in a worktree.
126
126
 
127
- **Content format branches on track (Fast Path Guarantee — Pocock adoption ID-05):**
127
+ **Content format branches on track (Fast Path Guarantee — ID-05):**
128
128
 
129
129
  ### 5.A. QUICK track — legacy 4-section format (hard-exempt from PRD upgrade)
130
130
 
@@ -309,7 +309,7 @@ When `status: warn` (non-blocking enforcement) and the user is in **auto mode**
309
309
 
310
310
  Create `implementation_plan.json` in the task directory (`{task_dir}/implementation_plan.json`).
311
311
 
312
- **Subtask schema branches on track (Pocock adoption ID-05 — Fast Path Guarantee).**
312
+ **Subtask schema branches on track.**
313
313
 
314
314
  ### 6.A. QUICK track / SIMPLE complexity — legacy flat subtask schema
315
315
 
@@ -454,6 +454,24 @@ Plan created:
454
454
  Next: /apt:execute
455
455
  ```
456
456
 
457
+ ### 9b. --spar flag (FRAMEWORK-RFC-001)
458
+
459
+ If `$ARGUMENTS` contained `--spar`, dispatch `/apt:spar` against the
460
+ just-written `spec.md` + `implementation_plan.json` before reporting Next.
461
+
462
+ Topic frame: the §1 Scope paragraph from `spec.md` (1-2 sentences). Same
463
+ `--timeout-ms 120000` pipeline-mode budget and NO `--rounds` flag (per
464
+ FRAMEWORK-BUG-038 — pipeline gates always defer to the skill default).
465
+ When merged-config `spar.partner` is set, append `--with <partner>`.
466
+
467
+ ```
468
+ /apt:spar --timeout-ms 120000 [--with <partner>] <topic-frame-from-spec.md-§Scope>
469
+ ```
470
+
471
+ After spar returns, append the termination headline + Layer 2 path
472
+ (`.aperant/spar/<slug>-<ts>.md`) into the report output so the user can
473
+ review findings before invoking `/apt:execute`.
474
+
457
475
  ### 9a. Mode-Aware Compact Suggestion (Human-in-the-Loop Only)
458
476
 
459
477
  Decide whether to show a compact suggestion by reading the **per-task autonomy** from state — not the global default, because the router asks per-task and stores the answer on the task record.
@@ -42,7 +42,7 @@ auto-stamped `terminal_id`.
42
42
 
43
43
  This replaces the earlier markdown-discipline emit step. The earlier
44
44
  step was correctly skipped on QUICK / SIMPLE classified tasks (Fast
45
- Path Guarantee, Pocock adoption ID-05) — moving the emit to a
45
+ Path Guarantee, ID-05) — moving the emit to a
46
46
  framework postcondition makes it work uniformly across QUICK, STANDARD,
47
47
  DEEP, and COMPLEX without violating the Fast Path Guarantee.
48
48
 
@@ -1110,6 +1110,8 @@ For `AUTHORSHIP_MODE == "owned"`, continue normally.
1110
1110
 
1111
1111
  AI agents have near-zero marginal cost per fix. The framework fixes **all** confirmed findings — critical, high, medium, and low — regardless of autonomy level. There is no severity gate and no "report for manual resolution" path. If a finding was confirmed by the validator, it gets fixed.
1112
1112
 
1113
+ **Hard rule — context budget is NOT a valid skip reason.** The orchestrator MAY NOT defer, drop, downgrade, or "punt for follow-up" any confirmed finding because its own context window feels heavy, because the run has already produced many fixes, or because it judges marginal value low. The query loop auto-compacts on its own — trust it. Per-finding fix work happens inside fix agents (separate context windows), so orchestrator pressure does not justify cutting their inputs. The only valid skip reasons are the ones enumerated in Key Principle #2 (`fixable: false`, critical finding without user approval, file assigned to another fixer). Any other skip is an unauthorized policy deviation — emit all confirmed findings to fixers, then let the audit gate adjudicate outcomes.
1114
+
1113
1115
  | Autonomy | Action |
1114
1116
  |----------|--------|
1115
1117
  | `< 2` | Show findings summary before fixing. Then proceed with auto-fix. |
@@ -1647,7 +1649,7 @@ node packages/framework/bin/apt-tools.mjs workflow destroy . --id ${REVIEW_ID}
1647
1649
  Agents do NOT assign confidence percentages. Either they have evidence (actual code snippet from Read tool) or they do not have a finding. The validator independently verifies every finding against real code.
1648
1650
 
1649
1651
  ### 2. Fix Everything Found
1650
- If it was found and confirmed, fix it. ALL severities. "This is minor" is NOT a valid skip reason. The only valid skip reasons are: `fixable: false`, critical findings without user approval, or files assigned to another fixer.
1652
+ If it was found and confirmed, fix it. ALL severities. "This is minor" is NOT a valid skip reason. **Neither is "my context window is heavy" or "I've already done a lot this run"** — orchestrator context pressure never authorizes dropping a confirmed finding (see Phase 6 → Principle: Fix Everything). The only valid skip reasons are: `fixable: false`, critical findings without user approval, or files assigned to another fixer.
1651
1653
 
1652
1654
  ### 3. Findings Flow Through Files
1653
1655
  Agents write to `.aperant/pr-reviews/{review-id}/findings/`. The orchestrator reads with the Read tool. Fix agents read finding files directly. This keeps the orchestrator context under 30%.
@@ -1711,6 +1713,11 @@ Fix agents self-report their outcome via a status line (`FIXED: X | FAILED: Y |
1711
1713
  **Wrong:** Skipping Phase 6 entirely when autonomy < 2.
1712
1714
  **Right:** Always fix all confirmed findings. At autonomy < 2, show findings summary first, then proceed with auto-fix. The only difference is whether findings are displayed before fixing — not whether they get fixed.
1713
1715
 
1716
+ ### Mistake 7a: Dropping Findings Because Orchestrator Context Feels Heavy
1717
+
1718
+ **Wrong:** Mid-Phase-6, the orchestrator decides "my window is getting heavy after 6 specialist rounds + Round 1 fixes — I'll skip the minor findings and report a partial fix." This is an unauthorized policy deviation, even when phrased as "judgment call" or "context-budget reasons."
1719
+ **Right:** Spawn fix agents for **every** confirmed finding regardless of orchestrator context state. Fix work happens in the fixer's window, not yours. The query loop auto-compacts when it needs to — trust it. If you genuinely cannot fit the spawn calls, that is a framework bug to file (not a license to ship a partial fix); emit all findings to fixers in the smallest batches possible and let the audit gate adjudicate. Severity, "diminishing returns," and your own token pressure are NOT skip authorities — only the three reasons in Key Principle #2 are.
1720
+
1714
1721
  ### Mistake 8: Forgetting to Update metadata.json
1715
1722
 
1716
1723
  **Wrong:** Writing review.json but leaving metadata.json stuck at `"status": "in-progress"`.
@@ -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/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
1
  # LOGIC branch — Terminal app for state-machine validation
10
2
 
11
3
  When the user's question is about **behavior**, the prototype is a
@@ -29,7 +29,7 @@ planning artifact, NOT a feature, and NOT something to merge. The output
29
29
  is a single-command-runnable prototype that lets the user feel whether
30
30
  the question's answer is "yes" or "no", then gets thrown away.
31
31
 
32
- **Pocock adoption attribution.** Discipline ported from Matt Pocock's
32
+ **Aperant adoption attribution.** Discipline ported from 's
33
33
  MIT-licensed `prototype` skill. Routes between two branches by
34
34
  question-type; the UI branch delegates to Aperant's existing
35
35
  `/apt:mockup` skill for HTML+Tailwind variants. The LOGIC branch and
@@ -70,7 +70,7 @@ If the question is genuinely ambiguous, ask ONE clarifying question
70
70
  ("are you asking about behavior or appearance?") — do NOT enter a long
71
71
  interview.
72
72
 
73
- ## The 5 Universal Rules (Pocock discipline, applies to both branches)
73
+ ## The 5 Universal Rules (Aperant discipline, applies to both branches)
74
74
 
75
75
  These five rules apply to EVERY prototype this skill produces. They are
76
76
  load-bearing — violating them collapses the prototype into ceremony
@@ -109,7 +109,7 @@ disguised as a question.
109
109
  When the question is about behavior / control flow / state machines /
110
110
  protocols:
111
111
 
112
- 1. Read `LOGIC.md` for the discipline (ported from Pocock's
112
+ 1. Read `LOGIC.md` for the discipline (ported from 's
113
113
  `prototype/LOGIC.md` with MIT attribution).
114
114
  2. Write ONE file (e.g., `prototype.mjs`, `prototype.ts`, or
115
115
  `prototype.py`) that:
@@ -126,7 +126,7 @@ protocols:
126
126
 
127
127
  When the question is about layout / aesthetics / flow / discoverability:
128
128
 
129
- 1. Read `UI.md` for the discipline (ported from Pocock's
129
+ 1. Read `UI.md` for the discipline (ported from 's
130
130
  `prototype/UI.md` with MIT attribution).
131
131
  2. Invoke `/apt:mockup --variants 3` as a sub-step. apt:mockup already
132
132
  enforces the UI-specific universal rules (zero-dep Tailwind CDN, no
@@ -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/prototype/UI.md
4
- Licensed under MIT. Modifications: routed through Aperant's existing
5
- apt:mockup skill rather than a freestanding HTML+Tailwind generator;
6
- aligned with the 5 universal rules in apt-prototype/SKILL.md.
7
- -->
8
-
9
1
  # UI branch — Delegates to apt:mockup
10
2
 
11
3
  When the user's question is about **appearance / layout / flow /
@@ -52,7 +52,37 @@ Execute a small task quickly without full pipeline overhead. For small fixes, do
52
52
 
53
53
  Extract the task description from `$ARGUMENTS`.
54
54
 
55
- Generate a task ID: `quick-{YYYYMMDD}-{short-slug}` (e.g., `quick-20260410-fix-typo`).
55
+ ### 1a. Resolve canonical task id (idempotent)
56
+
57
+ QUICK now produces a canonical state.active_tasks record so `/apt:ship` can find the task via the lite ship profile. The body owns idempotency because `apt-tools task create` does NOT guard against existing ids (see spec §3 R8).
58
+
59
+ Two invocation paths converge here:
60
+
61
+ - **Router path** (`/apt` → `/apt:quick`): the router has already called `task create` and injected `task_id` into your skill context.
62
+ - **Direct path** (`/apt:quick foo`): no `task_id` in context — you create one now.
63
+
64
+ Sequence:
65
+
66
+ 1. **If `task_id` is present in skill context** (router path):
67
+ ```bash
68
+ apt-tools task get . --id {task_id}
69
+ ```
70
+ - If exit 0 AND the returned record has `track === "QUICK"` → reuse, skip the create call.
71
+ - Else (record missing OR wrong track) → call:
72
+ ```bash
73
+ apt-tools task create . --description "$ARGUMENTS" --track QUICK --id {task_id}
74
+ ```
75
+ Parse `task_id` from the returned envelope (it will match the id you passed).
76
+
77
+ 2. **If no `task_id` in skill context** (direct path):
78
+ ```bash
79
+ apt-tools task create . --description "$ARGUMENTS" --track QUICK
80
+ ```
81
+ Parse the generated `task_id` from the envelope — it will be the canonical `{slug}_YY-MM-DD` shape.
82
+
83
+ The task id is now canonical (no more `quick-YYYYMMDD-*` invention). `QuickTaskSchema` accepts both the canonical `{slug}_YY-MM-DD` form and the legacy `quick-YYYYMMDD-{slug}` form for back-compat with already-shipped task records on disk.
84
+
85
+ ### 1b. Create QUICK working directory
56
86
 
57
87
  ```bash
58
88
  mkdir -p .aperant/quick/{task-id}