@aperant/framework 0.8.1 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/CHANGELOG.md +443 -1
  2. package/agents/apt-planner.md +39 -7
  3. package/dist/cli/commands/adr.mjs +1 -1
  4. package/dist/cli/commands/audit-branch-current.d.mts +25 -0
  5. package/dist/cli/commands/audit-branch-current.d.mts.map +1 -0
  6. package/dist/cli/commands/audit-branch-current.mjs +252 -0
  7. package/dist/cli/commands/audit-branch-current.mjs.map +1 -0
  8. package/dist/cli/commands/audit.d.mts.map +1 -1
  9. package/dist/cli/commands/audit.mjs +13 -2
  10. package/dist/cli/commands/audit.mjs.map +1 -1
  11. package/dist/cli/commands/check-version.d.mts.map +1 -1
  12. package/dist/cli/commands/check-version.mjs +19 -1
  13. package/dist/cli/commands/check-version.mjs.map +1 -1
  14. package/dist/cli/commands/context.mjs +3 -3
  15. package/dist/cli/commands/context.mjs.map +1 -1
  16. package/dist/cli/commands/coverage-check.d.mts.map +1 -1
  17. package/dist/cli/commands/coverage-check.mjs +74 -7
  18. package/dist/cli/commands/coverage-check.mjs.map +1 -1
  19. package/dist/cli/commands/detect-runtime.d.mts +6 -0
  20. package/dist/cli/commands/detect-runtime.d.mts.map +1 -0
  21. package/dist/cli/commands/detect-runtime.mjs +142 -0
  22. package/dist/cli/commands/detect-runtime.mjs.map +1 -0
  23. package/dist/cli/commands/driver-doctor.d.mts +29 -0
  24. package/dist/cli/commands/driver-doctor.d.mts.map +1 -0
  25. package/dist/cli/commands/driver-doctor.mjs +291 -0
  26. package/dist/cli/commands/driver-doctor.mjs.map +1 -0
  27. package/dist/cli/commands/gate.mjs +14 -0
  28. package/dist/cli/commands/gate.mjs.map +1 -1
  29. package/dist/cli/commands/init.d.mts.map +1 -1
  30. package/dist/cli/commands/init.mjs +9 -6
  31. package/dist/cli/commands/init.mjs.map +1 -1
  32. package/dist/cli/commands/install-from-source.d.mts +2 -0
  33. package/dist/cli/commands/install-from-source.d.mts.map +1 -0
  34. package/dist/cli/commands/install-from-source.mjs +2 -0
  35. package/dist/cli/commands/install-from-source.mjs.map +1 -0
  36. package/dist/cli/commands/modes.mjs +1 -1
  37. package/dist/cli/commands/route.d.mts.map +1 -1
  38. package/dist/cli/commands/route.mjs +38 -1
  39. package/dist/cli/commands/route.mjs.map +1 -1
  40. package/dist/cli/commands/triage.mjs +1 -1
  41. package/dist/cli/config/load.d.mts.map +1 -1
  42. package/dist/cli/config/load.mjs +9 -3
  43. package/dist/cli/config/load.mjs.map +1 -1
  44. package/dist/cli/coordination/auto-emit-artifact-ready.mjs +1 -1
  45. package/dist/cli/coordination/event-schema.d.mts.map +1 -1
  46. package/dist/cli/coordination/event-schema.mjs +18 -0
  47. package/dist/cli/coordination/event-schema.mjs.map +1 -1
  48. package/dist/cli/coverage-check/user-outcomes.d.mts +84 -0
  49. package/dist/cli/coverage-check/user-outcomes.d.mts.map +1 -0
  50. package/dist/cli/coverage-check/user-outcomes.mjs +265 -0
  51. package/dist/cli/coverage-check/user-outcomes.mjs.map +1 -0
  52. package/dist/cli/dispatch.d.mts.map +1 -1
  53. package/dist/cli/dispatch.mjs +18 -1
  54. package/dist/cli/dispatch.mjs.map +1 -1
  55. package/dist/cli/gate/context.d.mts +1 -0
  56. package/dist/cli/gate/context.d.mts.map +1 -1
  57. package/dist/cli/gate/context.mjs +14 -1
  58. package/dist/cli/gate/context.mjs.map +1 -1
  59. package/dist/cli/gate/gates/consistency-check.d.mts +1 -0
  60. package/dist/cli/gate/gates/consistency-check.d.mts.map +1 -1
  61. package/dist/cli/gate/gates/consistency-check.mjs +1 -0
  62. package/dist/cli/gate/gates/consistency-check.mjs.map +1 -1
  63. package/dist/cli/gate/gates/review-clean.d.mts +1 -0
  64. package/dist/cli/gate/gates/review-clean.d.mts.map +1 -1
  65. package/dist/cli/gate/gates/review-clean.mjs +1 -0
  66. package/dist/cli/gate/gates/review-clean.mjs.map +1 -1
  67. package/dist/cli/gate/gates/verify-approved.d.mts +1 -0
  68. package/dist/cli/gate/gates/verify-approved.d.mts.map +1 -1
  69. package/dist/cli/gate/gates/verify-approved.mjs +1 -0
  70. package/dist/cli/gate/gates/verify-approved.mjs.map +1 -1
  71. package/dist/cli/gate/registry.d.mts.map +1 -1
  72. package/dist/cli/gate/registry.mjs +9 -1
  73. package/dist/cli/gate/registry.mjs.map +1 -1
  74. package/dist/cli/host/detect.mjs +1 -1
  75. package/dist/cli/host/detect.mjs.map +1 -1
  76. package/dist/cli/install/find-workspace-framework-version.d.mts +16 -0
  77. package/dist/cli/install/find-workspace-framework-version.d.mts.map +1 -0
  78. package/dist/cli/install/find-workspace-framework-version.mjs +85 -0
  79. package/dist/cli/install/find-workspace-framework-version.mjs.map +1 -0
  80. package/dist/cli/install/install-from-source.d.mts +10 -0
  81. package/dist/cli/install/install-from-source.d.mts.map +1 -0
  82. package/dist/cli/install/install-from-source.mjs +271 -0
  83. package/dist/cli/install/install-from-source.mjs.map +1 -0
  84. package/dist/cli/install/install-kernel.d.mts.map +1 -1
  85. package/dist/cli/install/install-kernel.mjs +24 -0
  86. package/dist/cli/install/install-kernel.mjs.map +1 -1
  87. package/dist/cli/install/legacy-paths.d.mts +33 -11
  88. package/dist/cli/install/legacy-paths.d.mts.map +1 -1
  89. package/dist/cli/install/legacy-paths.mjs +163 -39
  90. package/dist/cli/install/legacy-paths.mjs.map +1 -1
  91. package/dist/cli/install/runtime-detect.mjs +1 -1
  92. package/dist/cli/install/runtime-detect.mjs.map +1 -1
  93. package/dist/cli/install/runtime-migrate.d.mts +34 -14
  94. package/dist/cli/install/runtime-migrate.d.mts.map +1 -1
  95. package/dist/cli/install/runtime-migrate.mjs +63 -30
  96. package/dist/cli/install/runtime-migrate.mjs.map +1 -1
  97. package/dist/cli/install/transforms/codex.d.mts.map +1 -1
  98. package/dist/cli/install/transforms/codex.mjs +28 -17
  99. package/dist/cli/install/transforms/codex.mjs.map +1 -1
  100. package/dist/cli/skill-author/contract.mjs +2 -2
  101. package/dist/cli/skill-author/contract.mjs.map +1 -1
  102. package/dist/cli/verify-proof/audit.d.mts +34 -0
  103. package/dist/cli/verify-proof/audit.d.mts.map +1 -0
  104. package/dist/cli/verify-proof/audit.mjs +53 -0
  105. package/dist/cli/verify-proof/audit.mjs.map +1 -0
  106. package/dist/cli/verify-proof/exec.d.mts +20 -0
  107. package/dist/cli/verify-proof/exec.d.mts.map +1 -0
  108. package/dist/cli/verify-proof/exec.mjs +74 -0
  109. package/dist/cli/verify-proof/exec.mjs.map +1 -0
  110. package/dist/cli/verify-proof/idl/index.d.mts +2 -0
  111. package/dist/cli/verify-proof/idl/index.d.mts.map +1 -0
  112. package/dist/cli/verify-proof/idl/index.mjs +13 -0
  113. package/dist/cli/verify-proof/idl/index.mjs.map +1 -0
  114. package/dist/cli/verify-proof/idl/types.d.ts +10 -0
  115. package/dist/cli/verify-proof/idl/types.d.ts.map +1 -0
  116. package/dist/cli/verify-proof/idl/types.js +10 -0
  117. package/dist/cli/verify-proof/idl/types.js.map +1 -0
  118. package/dist/cli/verify-proof/manifest-validator.d.mts +19 -0
  119. package/dist/cli/verify-proof/manifest-validator.d.mts.map +1 -0
  120. package/dist/cli/verify-proof/manifest-validator.mjs +182 -0
  121. package/dist/cli/verify-proof/manifest-validator.mjs.map +1 -0
  122. package/dist/cli/verify-proof/resolver.d.mts +105 -0
  123. package/dist/cli/verify-proof/resolver.d.mts.map +1 -0
  124. package/dist/cli/verify-proof/resolver.mjs +320 -0
  125. package/dist/cli/verify-proof/resolver.mjs.map +1 -0
  126. package/dist/cli/verify-proof/runtime-detect.d.mts +30 -0
  127. package/dist/cli/verify-proof/runtime-detect.d.mts.map +1 -0
  128. package/dist/cli/verify-proof/runtime-detect.mjs +209 -0
  129. package/dist/cli/verify-proof/runtime-detect.mjs.map +1 -0
  130. package/dist/cli/verify-proof/trust.d.mts +70 -0
  131. package/dist/cli/verify-proof/trust.d.mts.map +1 -0
  132. package/dist/cli/verify-proof/trust.mjs +174 -0
  133. package/dist/cli/verify-proof/trust.mjs.map +1 -0
  134. package/dist/driver-sdk/conformance.d.ts +41 -0
  135. package/dist/driver-sdk/conformance.d.ts.map +1 -0
  136. package/dist/driver-sdk/conformance.js +123 -0
  137. package/dist/driver-sdk/conformance.js.map +1 -0
  138. package/dist/driver-sdk/errors.d.ts +75 -0
  139. package/dist/driver-sdk/errors.d.ts.map +1 -0
  140. package/dist/driver-sdk/errors.js +80 -0
  141. package/dist/driver-sdk/errors.js.map +1 -0
  142. package/dist/driver-sdk/idl.d.ts +221 -0
  143. package/dist/driver-sdk/idl.d.ts.map +1 -0
  144. package/dist/driver-sdk/idl.js +140 -0
  145. package/dist/driver-sdk/idl.js.map +1 -0
  146. package/dist/driver-sdk/index.d.ts +28 -0
  147. package/dist/driver-sdk/index.d.ts.map +1 -0
  148. package/dist/driver-sdk/index.js +28 -0
  149. package/dist/driver-sdk/index.js.map +1 -0
  150. package/dist/driver-sdk/manifest.d.ts +93 -0
  151. package/dist/driver-sdk/manifest.d.ts.map +1 -0
  152. package/dist/driver-sdk/manifest.js +12 -0
  153. package/dist/driver-sdk/manifest.js.map +1 -0
  154. package/dist/driver-sdk/retry.d.ts +33 -0
  155. package/dist/driver-sdk/retry.d.ts.map +1 -0
  156. package/dist/driver-sdk/retry.js +50 -0
  157. package/dist/driver-sdk/retry.js.map +1 -0
  158. package/dist/plugin/.claude-plugin/plugin.json +4 -1
  159. package/dist/plugin/agents/apt-planner.md +39 -7
  160. package/dist/plugin/skills/apt/SKILL.md +75 -6
  161. package/dist/plugin/skills/apt-caveman/SKILL.md +64 -0
  162. package/dist/plugin/skills/apt-debug/SKILL.md +36 -4
  163. package/dist/plugin/skills/apt-debug/appendices/diagnose-discipline.md +2 -11
  164. package/dist/plugin/skills/apt-discuss/SKILL.md +4 -4
  165. package/dist/plugin/skills/apt-discuss/appendices/grill-discipline.md +2 -11
  166. package/dist/plugin/skills/apt-discuss/appendices/zoom-out-helper.md +0 -8
  167. package/dist/plugin/skills/apt-execute/SKILL.md +27 -4
  168. package/dist/plugin/skills/apt-execute/appendices/tdd-mode.md +2 -10
  169. package/dist/plugin/skills/apt-fan-out/SKILL.md +36 -1
  170. package/dist/plugin/skills/apt-handoff/SKILL.md +228 -0
  171. package/dist/plugin/skills/apt-improve/DEEPENING.md +0 -8
  172. package/dist/plugin/skills/apt-improve/INTERFACE-DESIGN.md +0 -8
  173. package/dist/plugin/skills/apt-improve/LANGUAGE.md +0 -8
  174. package/dist/plugin/skills/apt-improve/SKILL.md +4 -4
  175. package/dist/plugin/skills/apt-plan/SKILL.md +73 -5
  176. package/dist/plugin/skills/apt-plan/adapters/conductor.md +1 -1
  177. package/dist/plugin/skills/apt-pr-review/SKILL.md +1 -1
  178. package/dist/plugin/skills/apt-prototype/LOGIC.md +0 -8
  179. package/dist/plugin/skills/apt-prototype/SKILL.md +4 -4
  180. package/dist/plugin/skills/apt-prototype/UI.md +0 -8
  181. package/dist/plugin/skills/apt-quick/SKILL.md +31 -1
  182. package/dist/plugin/skills/apt-research/SKILL.md +526 -0
  183. package/dist/plugin/skills/apt-research/appendices/budget-loop.md +397 -0
  184. package/dist/plugin/skills/apt-research/appendices/claim-graph-schema.md +206 -0
  185. package/dist/plugin/skills/apt-research/appendices/domain-tools.md +236 -0
  186. package/dist/plugin/skills/apt-resume/SKILL.md +54 -31
  187. package/dist/plugin/skills/apt-run/SKILL.md +114 -16
  188. package/dist/plugin/skills/apt-setup/SKILL.md +97 -8
  189. package/dist/plugin/skills/apt-ship/SKILL.md +165 -9
  190. package/dist/plugin/skills/apt-spar/SKILL.md +84 -23
  191. package/dist/plugin/skills/apt-triage/AGENT-BRIEF.md +0 -8
  192. package/dist/plugin/skills/apt-triage/OUT-OF-SCOPE.md +0 -7
  193. package/dist/plugin/skills/apt-triage/SKILL.md +2 -2
  194. package/dist/plugin/skills/apt-update/SKILL.md +74 -17
  195. package/dist/plugin/skills/apt-verify-proof/SKILL.md +87 -1
  196. package/dist/plugin/skills/apt-zoom-out/SKILL.md +3 -3
  197. package/dist/schemas/quick-task.d.ts +17 -17
  198. package/dist/schemas/quick-task.d.ts.map +1 -1
  199. package/dist/schemas/quick-task.js +2 -2
  200. package/dist/schemas/quick-task.js.map +1 -1
  201. package/dist/types/config.d.ts +33 -0
  202. package/dist/types/config.d.ts.map +1 -1
  203. package/dist/types/state.d.ts +1 -1
  204. package/dist/types/state.d.ts.map +1 -1
  205. package/dist/types/task-record.d.ts +1 -1
  206. package/dist/types/task-record.d.ts.map +1 -1
  207. package/drivers/.gitkeep +0 -0
  208. package/drivers/api/README.md +40 -0
  209. package/drivers/api/driver.mjs +59 -0
  210. package/drivers/api/manifest.json +26 -0
  211. package/drivers/browser/README.md +105 -0
  212. package/drivers/browser/driver.mjs +134 -0
  213. package/drivers/browser/manifest.json +35 -0
  214. package/drivers/cli/README.md +44 -0
  215. package/drivers/cli/driver.mjs +62 -0
  216. package/drivers/cli/manifest.json +28 -0
  217. package/drivers/electron/README.md +64 -0
  218. package/drivers/electron/driver.mjs +87 -0
  219. package/drivers/electron/manifest.json +37 -0
  220. package/package.json +138 -133
  221. package/prompts/planner.md +1 -1
  222. package/prompts/spec_writer.md +1 -1
  223. package/skills/apt/SKILL.md +75 -6
  224. package/skills/apt-caveman/SKILL.md +64 -0
  225. package/skills/apt-debug/SKILL.md +36 -4
  226. package/skills/apt-debug/appendices/diagnose-discipline.md +2 -11
  227. package/skills/apt-discuss/SKILL.md +4 -4
  228. package/skills/apt-discuss/appendices/grill-discipline.md +2 -11
  229. package/skills/apt-discuss/appendices/zoom-out-helper.md +0 -8
  230. package/skills/apt-execute/SKILL.md +27 -4
  231. package/skills/apt-execute/appendices/tdd-mode.md +2 -10
  232. package/skills/apt-fan-out/SKILL.md +36 -1
  233. package/skills/apt-handoff/SKILL.md +228 -0
  234. package/skills/apt-improve/DEEPENING.md +0 -8
  235. package/skills/apt-improve/INTERFACE-DESIGN.md +0 -8
  236. package/skills/apt-improve/LANGUAGE.md +0 -8
  237. package/skills/apt-improve/SKILL.md +4 -4
  238. package/skills/apt-plan/SKILL.md +73 -5
  239. package/skills/apt-plan/adapters/conductor.md +1 -1
  240. package/skills/apt-planner.md +17 -1
  241. package/skills/apt-pr-review/SKILL.md +1 -1
  242. package/skills/apt-prototype/LOGIC.md +0 -8
  243. package/skills/apt-prototype/SKILL.md +4 -4
  244. package/skills/apt-prototype/UI.md +0 -8
  245. package/skills/apt-quick/SKILL.md +31 -1
  246. package/skills/apt-research/SKILL.md +526 -0
  247. package/skills/apt-research/appendices/budget-loop.md +397 -0
  248. package/skills/apt-research/appendices/claim-graph-schema.md +206 -0
  249. package/skills/apt-research/appendices/domain-tools.md +236 -0
  250. package/skills/apt-resume/SKILL.md +54 -31
  251. package/skills/apt-run/SKILL.md +114 -16
  252. package/skills/apt-setup/SKILL.md +97 -8
  253. package/skills/apt-ship/SKILL.md +165 -9
  254. package/skills/apt-spar/SKILL.md +84 -23
  255. package/skills/apt-triage/AGENT-BRIEF.md +0 -8
  256. package/skills/apt-triage/OUT-OF-SCOPE.md +0 -7
  257. package/skills/apt-triage/SKILL.md +2 -2
  258. package/skills/apt-update/SKILL.md +74 -17
  259. package/skills/apt-verify-proof/SKILL.md +87 -1
  260. package/skills/apt-zoom-out/SKILL.md +3 -3
  261. package/src/cli/commands/adr.mjs +1 -1
  262. package/src/cli/commands/audit-branch-current.mjs +250 -0
  263. package/src/cli/commands/audit.mjs +13 -2
  264. package/src/cli/commands/check-version.mjs +20 -1
  265. package/src/cli/commands/context.mjs +3 -3
  266. package/src/cli/commands/coverage-check.mjs +126 -44
  267. package/src/cli/commands/detect-runtime.mjs +143 -0
  268. package/src/cli/commands/driver-doctor.mjs +294 -0
  269. package/src/cli/commands/gate.mjs +15 -0
  270. package/src/cli/commands/init.mjs +9 -6
  271. package/src/cli/commands/install-from-source.mjs +1 -0
  272. package/src/cli/commands/modes.mjs +1 -1
  273. package/src/cli/commands/route.mjs +42 -1
  274. package/src/cli/commands/triage.mjs +1 -1
  275. package/src/cli/config/load.mjs +9 -3
  276. package/src/cli/coordination/auto-emit-artifact-ready.mjs +1 -1
  277. package/src/cli/coordination/event-schema.mjs +19 -0
  278. package/src/cli/coverage-check/user-outcomes.mjs +273 -0
  279. package/src/cli/dispatch.mjs +17 -1
  280. package/src/cli/gate/context.mjs +20 -1
  281. package/src/cli/gate/gates/consistency-check.mjs +1 -0
  282. package/src/cli/gate/gates/review-clean.mjs +1 -0
  283. package/src/cli/gate/gates/verify-approved.mjs +1 -0
  284. package/src/cli/gate/registry.mjs +11 -1
  285. package/src/cli/host/detect.mjs +1 -1
  286. package/src/cli/install/find-workspace-framework-version.mjs +88 -0
  287. package/src/cli/install/install-from-source.mjs +276 -0
  288. package/src/cli/install/install-kernel.mjs +24 -0
  289. package/src/cli/install/legacy-paths.mjs +164 -39
  290. package/src/cli/install/runtime-detect.mjs +1 -1
  291. package/src/cli/install/runtime-migrate.mjs +63 -30
  292. package/src/cli/install/transforms/codex.mjs +26 -17
  293. package/src/cli/skill-author/contract.mjs +2 -2
  294. package/src/cli/verify-proof/.gitkeep +0 -0
  295. package/src/cli/verify-proof/audit.mjs +55 -0
  296. package/src/cli/verify-proof/exec.mjs +74 -0
  297. package/src/cli/verify-proof/idl/index.mjs +23 -0
  298. package/src/cli/verify-proof/idl/types.ts +42 -0
  299. package/src/cli/verify-proof/manifest-schema.json +212 -0
  300. package/src/cli/verify-proof/manifest-validator.mjs +184 -0
  301. package/src/cli/verify-proof/resolver.mjs +330 -0
  302. package/src/cli/verify-proof/runtime-detect.mjs +211 -0
  303. package/src/cli/verify-proof/trust.mjs +187 -0
  304. package/templates/adr-format.md +0 -8
  305. package/templates/aperant-claude-md-appendix.md +1 -1
  306. package/templates/context-format.md +1 -9
  307. package/templates/proof-verification.md +51 -8
  308. package/workflows/verify-proof.md +130 -19
@@ -199,7 +199,7 @@ AskUserQuestion([
199
199
 
200
200
  **Routing:**
201
201
  - "Verification" → jump to **Step 2** (Batch 1 + Batch 2 only), then skip to **Step 4** (mapping) and **Step 5** (write)
202
- - "Pipeline" → jump to **Step 3b** (Batch 3 only, including Diagram Mode), then skip to **Step 4** and **Step 5**
202
+ - "Pipeline" → jump to **Step 3** (Batch 2: auto-branch, code review, TDD, PR Review Auto-Suggest, **Sparring Auto-Fire**) AND **Step 3b** (Batch 3 only, including Diagram Mode), then skip to **Step 4** and **Step 5**
203
203
  - "Orchestration" → jump to **Step 3c** (Batch 4 only), then skip to **Step 4** and **Step 5**
204
204
  - "Team Collaboration" → jump to **Step 3d** (Batch 5 only), then skip to **Step 4** and **Step 5**
205
205
  - "Visibility" → jump to **Step 3e** (Batch 6 only), then skip to **Step 4** and **Step 5**
@@ -359,6 +359,76 @@ AskUserQuestion([
359
359
  ])
360
360
  ```
361
361
 
362
+ ### Sparring Auto-Fire (FRAMEWORK-RFC-001)
363
+
364
+ Per-device opt-in for pipeline-integrated `/apt:spar`. Three phases — top-level Yes/No, then a conditional partner picker (if Yes) or hint sub-picker (if No). All three resolved fields land in `.aperant/config.local.json` per AUDIT-001 (NOT the shared `config.json`).
365
+
366
+ **Phase 1 — Top-level Yes/No:**
367
+
368
+ ```
369
+ AskUserQuestion([
370
+ {
371
+ question: "Enable /apt:spar to auto-fire after planning (and execution on DEEP tasks)? Spawns a second LLM provider to challenge the plan before you commit code.",
372
+ header: "Sparring Auto-Fire",
373
+ multiSelect: false,
374
+ options: [
375
+ { label: "No (Recommended for now)", description: "Keep /apt:spar manual-only. You invoke it yourself when you want a second opinion." },
376
+ { label: "Yes", description: "After every /apt:run plan stage (STANDARD) or plan+execute stages (DEEP), spawn a partner LLM to spar with the current host. QUICK tasks are hard-exempt." }
377
+ ]
378
+ }
379
+ ])
380
+ ```
381
+
382
+ **Phase 2 — Partner picker (only if Phase 1 = Yes):**
383
+
384
+ Before showing the picker, run `apt-tools host-detect` and parse `host.partner_transports.{codex,claude,gemini}` plus `host.cli`. Build the partner availability map:
385
+
386
+ ```bash
387
+ node packages/framework/bin/apt-tools.mjs host-detect
388
+ ```
389
+
390
+ For each of `codex`, `claude`, `gemini`, check whether ANY rung (MCP, plugin, raw CLI) under `host.partner_transports.<id>` is `detected: true` (or `"runtime-host-only"` for the MCP rung). Also exclude the current host (`host.cli`) — `/apt:spar` rejects same-host sparring by construction (Open Q1 — e.g. on `claude-code` host, the `claude` option is hidden because sparring against the same CLI is sycophancy).
391
+
392
+ If zero partners remain after filtering, print this graceful skip line and write `spar.enabled: true, spar.partner: null` so the user can opt back in later by installing a partner CLI and re-running `/apt:setup` → Pipeline:
393
+
394
+ ```
395
+ [apt:setup] Sparring auto-fire enabled but no partner CLIs detected. Install codex / claude / gemini and re-run /apt:setup → Pipeline → Sparring Auto-Fire to pick a partner.
396
+ ```
397
+
398
+ Otherwise, show the partner picker including only detected, non-same-host partners. Example (on a Claude Code host where codex MCP is loaded and gemini CLI is installed):
399
+
400
+ ```
401
+ AskUserQuestion([
402
+ {
403
+ question: "Which partner LLM should /apt:spar use by default? You can override per-invocation with --with <id>.",
404
+ header: "Sparring Partner",
405
+ multiSelect: false,
406
+ options: [
407
+ // Include only detected, non-same-host partners. Example shape:
408
+ { label: "Codex (gpt-5)", description: "OpenAI Codex CLI / MCP — sharp on type and edge-case reasoning." },
409
+ { label: "Gemini", description: "Google Gemini — sharp on broad search and doc citations." }
410
+ // "Claude (sonnet)" omitted on a claude-code host (same-host rejection).
411
+ ]
412
+ }
413
+ ])
414
+ ```
415
+
416
+ **Phase 3 — Hint sub-picker (only if Phase 1 = No):**
417
+
418
+ ```
419
+ AskUserQuestion([
420
+ {
421
+ question: "Print a one-line reminder at the end of each pipeline stage that /apt:spar is available?",
422
+ header: "Sparring Hint",
423
+ multiSelect: false,
424
+ options: [
425
+ { label: "No (Recommended)", description: "Silent. You remember to run /apt:spar yourself when needed." },
426
+ { label: "Yes", description: "Print `[apt] {stage} complete. /apt:spar available before next stage. (skill, not auto-fire)` at each stage hand-off." }
427
+ ]
428
+ }
429
+ ])
430
+ ```
431
+
362
432
  ### Task-level worktree isolation (only if host supports worktrees)
363
433
 
364
434
  First check `host.capabilities.worktrees` from the host-detect output. If `false` (Codex, Gemini, OpenCode), skip this question and leave `task_isolation.worktree_per_task` at its default (`false`).
@@ -888,10 +958,10 @@ Add a row to the Step 8 table:
888
958
 
889
959
  ---
890
960
 
891
- ## 3g. Present Settings (Batch 8: Task Tracking + Coding) (Pocock adoption AC13)
961
+ ## 3g. Present Settings (Batch 8: Task Tracking + Coding) (AC13)
892
962
 
893
963
  This batch captures the **task_tracking** backend and the **coding**
894
- defaults block introduced by the Pocock adoption (ST-10 apt:triage +
964
+ defaults block introduced by adoption (ST-10 apt:triage +
895
965
  ST-3 apt:execute --tdd).
896
966
 
897
967
  Per ID-01 (Framework full-featured locally; backends are pluggable), the
@@ -977,7 +1047,7 @@ AskUserQuestion([
977
1047
 
978
1048
  Migration rule: any existing config WITHOUT a `task_tracking` or
979
1049
  `coding` block gets defaults silently — NEVER error on a missing block.
980
- This is the migration path for projects that adopted Aperant pre-Pocock.
1050
+ This is the migration path for projects that adopted Aperant pre-vertical-slice.
981
1051
 
982
1052
  ### 3g.4 Review-Mode routing entry
983
1053
 
@@ -1111,14 +1181,17 @@ The selective-edit pass through Batch 9 MUST respect the §1b dispatch — it do
1111
1181
 
1112
1182
  ## 4. Map Answers to Config
1113
1183
 
1114
- **AUDIT-001 — file-routing contract for per-device fields (UPDATED 0.7.2):** the
1115
- following five fields are PER-DEVICE and MUST land in `.aperant/config.local.json`
1184
+ **AUDIT-001 — file-routing contract for per-device fields (UPDATED 0.8.1 for FRAMEWORK-RFC-001):** the
1185
+ following PER-DEVICE fields MUST land in `.aperant/config.local.json`
1116
1186
  (gitignored), NOT the shared `.aperant/config.json`:
1117
1187
  - `verification.open_report` — covered in the "Auto-Open" mapping below.
1118
1188
  - `multi_model.cross_verification.tools` — covered in the "Cross-Verification" mapping below.
1119
1189
  - `preferences.date_format` — covered in the "Date Format" mapping below.
1120
1190
  - `preferences.time_format` — covered in the "Time Format" mapping below.
1121
1191
  - `preferences.quick_task_post_verify` — covered in apt-quick SKILL config block.
1192
+ - `spar.enabled` — covered in the "Sparring Auto-Fire" mapping below (FRAMEWORK-RFC-001).
1193
+ - `spar.partner` — covered in the "Sparring Auto-Fire" mapping below (FRAMEWORK-RFC-001).
1194
+ - `spar.hint` — covered in the "Sparring Auto-Fire" mapping below (FRAMEWORK-RFC-001).
1122
1195
 
1123
1196
  All other fields (including `verification.evidence_capture`,
1124
1197
  `multi_model.cross_verification.enabled`, `multi_model.video_review.*`,
@@ -1128,7 +1201,10 @@ All other fields (including `verification.evidence_capture`,
1128
1201
  Implementation: use the framework's `writeLocalConfigField(targetDir, dotPath, value)`
1129
1202
  helper from `packages/framework/src/cli/config/load.mjs` (or its shell-out
1130
1203
  equivalent via `apt-tools config write . --local --key <dotpath> --value <json>`)
1131
- for the five fields above. NEVER hand-roll `JSON.parse(readFileSync('.aperant/config.json'))`
1204
+ for the per-device fields enumerated above (`verification.open_report`,
1205
+ `multi_model.cross_verification.tools`, `preferences.date_format`,
1206
+ `preferences.time_format`, `preferences.quick_task_post_verify`, and the
1207
+ three `spar.*` fields). NEVER hand-roll `JSON.parse(readFileSync('.aperant/config.json'))`
1132
1208
  followed by `writeFileSync('.aperant/config.json', ...)` for these fields — it
1133
1209
  will land per-device data in the shared file and re-introduce the
1134
1210
  shared-config trap AUDIT-001 was designed to close.
@@ -1176,6 +1252,18 @@ Map the user's selections to config values:
1176
1252
  - "Ask me" → `pr_review.suggest_after_ship: "ask"`
1177
1253
  - "Never" → `pr_review.suggest_after_ship: "never"`
1178
1254
 
1255
+ **Sparring Auto-Fire (FRAMEWORK-RFC-001):**
1256
+ - Phase 1 "No" → `spar.enabled: false`, ask Phase 3 (hint sub-picker)
1257
+ - Phase 1 "Yes" → `spar.enabled: true`, ask Phase 2 (partner picker)
1258
+ - Phase 2 "Codex" → `spar.partner: "codex"`
1259
+ - Phase 2 "Claude" → `spar.partner: "claude"`
1260
+ - Phase 2 "Gemini" → `spar.partner: "gemini"`
1261
+ - Phase 2 graceful-skip path (zero partners detected) → `spar.partner: null` (re-prompted inline by `/apt:run` gate handler when consent is on but partner is null)
1262
+ - Phase 3 "Yes" → `spar.hint: true`
1263
+ - Phase 3 "No" → `spar.hint: false` (or omit the field)
1264
+
1265
+ **AUDIT-001 — all three fields are PER-DEVICE** and MUST land in `.aperant/config.local.json` via `writeLocalConfigField(targetDir, dotPath, value)` (or its shell-out equivalent `apt-tools config write . --local --key <dotpath> --value <json>`). Do NOT touch shared `.aperant/config.json` for any `spar.*` field. The AUDIT-001 routing block above already enumerates `spar.enabled`, `spar.partner`, `spar.hint` as per-device — this addendum is the call-site reference for future contributors.
1266
+
1179
1267
  Note: task ids are slug-first since v0.6.6 — the date-format setting controls the trailing date component only.
1180
1268
 
1181
1269
  **Date Format:**
@@ -1211,7 +1299,7 @@ Note: task ids are slug-first since v0.6.6 — the date-format setting controls
1211
1299
  Write merged config to two files per AUDIT-001 routing (see Step 4 block):
1212
1300
 
1213
1301
  - Shared `.aperant/config.json` — all project policy values (the bulk of the answers).
1214
- - Per-device `.aperant/config.local.json` — the five AUDIT-001 fields enumerated in Step 4.
1302
+ - Per-device `.aperant/config.local.json` — the AUDIT-001 per-device fields enumerated in Step 4 (5 original + 3 `spar.*` fields per FRAMEWORK-RFC-001).
1215
1303
 
1216
1304
  ```bash
1217
1305
  mkdir -p .aperant
@@ -1302,6 +1390,7 @@ Display:
1302
1390
  | Auto Branch | {Yes/No} |
1303
1391
  | Code Review | {Yes/No} |
1304
1392
  | TDD Iron Law | {Yes/No} |
1393
+ | Sparring Auto-Fire | {Off / On (codex), On (claude), On (gemini)} (hint: {Yes/No}) |
1305
1394
  | Date Format | {DD-MM-YY / MM-DD-YY / YY-MM-DD} |
1306
1395
  | Time Format | {24h / 12h} |
1307
1396
  | Task Index | {Yes/No} |
@@ -16,9 +16,12 @@ execution_modes:
16
16
  - step
17
17
  allowed-tools: "Bash, Read, Write, Edit, Grep, Glob"
18
18
  argument-hint: "apt:ship [--draft | --title \"...\"]"
19
- gates:
19
+ gates:
20
+ - constitution-read
21
+ - verify-approved
20
22
  - review-clean
21
- - all-subtasks-complete
23
+ - consistency-check
24
+ - r-persona-alignment
22
25
  - gitignore-in-sync
23
26
  config_keys:
24
27
  - pipeline.auto_branch
@@ -59,7 +62,7 @@ node packages/framework/bin/apt-tools.mjs gate check . --task-id {task-id} --ski
59
62
  ```
60
63
 
61
64
  Parse the JSON envelope:
62
- - If `status == "ok"`: proceed to Section 1.
65
+ - If `status == "ok"`: proceed to Section 0.5 / 1.
63
66
  - If `status == "fail"` AND `forced` is empty (i.e. the user did NOT pass `--force`): STOP. Report the failed gates verbatim from `failed:[{id, severity, reason}]`, then emit:
64
67
  ```
65
68
  Hard gate failed. Fix the issues above, or re-run with:
@@ -70,6 +73,17 @@ Parse the JSON envelope:
70
73
 
71
74
  The ship gate covers constitution-read, verify-approved (qa_signoff.json verdict), review-clean (no unresolved critical/warning findings), gitignore-in-sync (.aperant/.gitignore conformance), and consistency-check (G8 — cross-artifact consistency between spec.md, implementation_plan.json, review.json, qa_signoff.json, and build-progress.json). Because these gates run here, Sections 1–3 below no longer need to re-check the verify verdict or block on review findings — the gate already did it.
72
75
 
76
+ ### 0.1 Parse `profile` from the envelope
77
+
78
+ The envelope carries `profile: "lite" | "full-pipeline"` derived from `taskRecord.track` (QUICK / DEBUG → lite; STANDARD / DEEP → full-pipeline). Capture it now — Sections 1, 2, and 3 branch on it:
79
+
80
+ ```bash
81
+ profile=$(echo "$gate_envelope" | jq -r '.profile // "full-pipeline"')
82
+ ```
83
+
84
+ - **`profile === "lite"`** (QUICK or DEBUG track): the three full-pipeline gates (`verify-approved`, `review-clean`, `consistency-check`) were skipped by design — those tracks do not produce `qa_signoff.json`, `review.json`, or a multi-subtask `implementation_plan.json`. SKIP Sections 1 (review.json + decision notes reads) and 2 (commit-to-subtask map). JUMP to Section 3's lite body branch.
85
+ - **`profile === "full-pipeline"`** (STANDARD or DEEP track): full pipeline ran — Sections 1, 2, and 3's full-body template all apply unchanged.
86
+
73
87
  ## 0.5 Pre-PR Committable Drift Check (C56 B2)
74
88
 
75
89
  Before gathering PR context, audit for uncommitted committable `.aperant/` state and stage anything the self-staging helper missed. This closes the artifact-leak class that the framework shipped with pre-C56: phases flipped in-progress, roadmap JSON touched, decision notes written — none of which followed into the PR's commits.
@@ -97,8 +111,79 @@ Parse the JSON envelope:
97
111
 
98
112
  Classification reference: `packages/framework/docs/artifact-lifecycle.md` (committable vs ephemeral matrix for every `.aperant/` subpath).
99
113
 
114
+ ## 0.7 Pre-PR Branch-Current Audit + Rebase Gate
115
+
116
+ Before any team-sync push (§5) or PR creation (§6), audit whether the task branch has drifted behind `origin/<base_branch>`. A PR opened against a stale base can silently no-op GitHub Actions when path-filter matrices evaluate against the merge-base — the recent Source Control panel pipeline lost ~20 min to this defect class before the operator noticed CI never engaged.
117
+
118
+ This section runs BEFORE Section 5 (Sync Team Bookkeeping). Order is load-bearing: if §0.7 runs after §5, the team-sync push races the post-§0.7 rebase, the captured `remote_tip_sha` is stale by the time §6 leases against it, and the lease fails on a commit `apt:ship` itself just pushed. The TD-02 structural test locks the §0.7 → §5 ordering.
119
+
120
+ Resolve the base branch (same `task get` envelope §6 uses):
121
+
122
+ ```bash
123
+ task_info=$(node packages/framework/bin/apt-tools.mjs task get . --id {task-id})
124
+ base_branch=$(echo "$task_info" | jq -r '.task.base_branch // "main"')
125
+ worktree_path=$(echo "$task_info" | jq -r '.task.worktree_path // empty')
126
+ ship_cwd=${worktree_path:-.}
127
+ ```
128
+
129
+ Run the audit from the worktree (or the project root when no worktree is recorded):
130
+
131
+ ```bash
132
+ audit_env=$(node packages/framework/bin/apt-tools.mjs audit branch-current "$ship_cwd" --base "$base_branch")
133
+ behind=$(echo "$audit_env" | jq -r '.behind // 0')
134
+ ahead=$(echo "$audit_env" | jq -r '.ahead // 0')
135
+ mergeable=$(echo "$audit_env" | jq -r '.mergeable')
136
+ audit_warning=$(echo "$audit_env" | jq -r '.audit_warning // empty')
137
+ remote_tip_sha_pre_rebase=$(echo "$audit_env" | jq -r '.remote_tip_sha // empty')
138
+ ```
139
+
140
+ Capture `remote_tip_sha_pre_rebase` now — §6's lease uses it.
141
+
142
+ **Branch on the envelope:**
143
+
144
+ - **`behind === 0`** → no rebase needed. The branch is current with `origin/<base_branch>` (or strictly ahead). Skip the rebase and proceed to §1. §6's push will use the plain `git push -u origin <branch>` form, not the lease form.
145
+
146
+ - **`behind > 0` AND `mergeable === true`** → run a clean rebase:
147
+ ```bash
148
+ git -C "$ship_cwd" rebase "origin/$base_branch"
149
+ ```
150
+ Proceed to §1. §6's push will use `--force-with-lease=refs/heads/<branch>:$remote_tip_sha_pre_rebase` because history was rewritten.
151
+
152
+ - **`behind > 0` AND `mergeable === false`** → STOP. Emit a structured error with the conflict preview verbatim:
153
+ ```
154
+ [APT:ship] Cannot ship — task branch is behind origin/{base_branch} and the rebase would conflict.
155
+ Conflicts preview:
156
+ - {path1}
157
+ - {path2}
158
+ Resolve manually (rebase or merge in the worktree), then re-run /apt:ship.
159
+ ```
160
+ Exit the skill — do NOT auto-resolve, do NOT proceed to §5 or §6.
161
+
162
+ - **`mergeable === null` AND `audit_warning === "git-version-too-old"`** → STOP with a friendlier message:
163
+ ```
164
+ [APT:ship] Cannot ship — local git is too old to probe mergeability (need git ≥ 2.38 for 'merge-tree --write-tree').
165
+ Upgrade git, rebase manually, or re-run /apt:ship after upgrading.
166
+ ```
167
+ Exit the skill.
168
+
169
+ - **`mergeable === null` AND `audit_warning === "fetch-failed"` or `"no-remote-base-ref"`** → STOP. The audit could not verify the remote tip, so we cannot lease safely. Emit:
170
+ ```
171
+ [APT:ship] Cannot ship — could not fetch origin/{base_branch} ({audit_warning}). Check network + remote, then re-run /apt:ship.
172
+ ```
173
+ Exit the skill.
174
+
175
+ **Autonomy gating.** Read the active task's autonomy level from `.aperant/state.json` (`active_tasks[{task-id}].autonomy`, falling back to `autonomy.default`):
176
+
177
+ - **Autonomy 0–1 (step / guided)** — print the audit envelope to the operator and ask `Rebase now? [Y/n]` before executing the `git rebase` line. On `N`, exit the skill (user can rebase manually and re-invoke).
178
+ - **Autonomy 2 (auto-chain)** — proceed silently on the clean-rebase branch; STOP on conflict regardless.
179
+ - **Autonomy 3 (YOLO)** — same as 2: silent on clean, STOP on conflict. Auto-resolution of conflicts is explicitly out of scope (see spec §Out of Scope).
180
+
181
+ The captured `remote_tip_sha_pre_rebase` and `behind` integer are referenced verbatim in §6's push command. Treat them as read-only state for the remainder of the skill.
182
+
100
183
  ## 1. Gather Context
101
184
 
185
+ **Profile guard:** Sections 1, 2, and 2.6 apply ONLY to `profile === "full-pipeline"`. When the envelope carried `profile === "lite"` (QUICK / DEBUG), SKIP Sections 1, 2, 2.6 and jump straight to Section 3 (`3.lite` branch).
186
+
102
187
  Read all available context for building the PR:
103
188
 
104
189
  ```bash
@@ -197,6 +282,53 @@ The helper lives at `packages/framework/src/cli/release-notes/ship-autodraft.mjs
197
282
 
198
283
  **Title:** Derived from task description. Keep it short (<70 characters).
199
284
 
285
+ ### 3.lite — `profile === "lite"` (QUICK and DEBUG)
286
+
287
+ When the gate envelope carries `profile === "lite"`, emit the lite PR body. QUICK and DEBUG do not produce `qa_signoff.json` or `review.json`, so the lite body sources verification evidence from `task.json.verification` (QUICK: `.aperant/quick/{task-id}/task.json`) or, when no per-track task.json exists (DEBUG fallback), from the active-task record in `state.active_tasks[task_id]`.
288
+
289
+ ```bash
290
+ # QUICK: per-track task.json carries the verification block
291
+ task_json=$(cat .aperant/quick/{task-id}/task.json 2>/dev/null)
292
+ # DEBUG fallback: no per-track task.json — verification is best-effort, omit the block if absent
293
+ ```
294
+
295
+ Lite body shape:
296
+
297
+ ```markdown
298
+ ## Summary
299
+
300
+ {one-liner from task.description in state.active_tasks[task-id]}
301
+
302
+ ## Verification
303
+
304
+ - Typecheck: {task.json.verification.typecheck}
305
+ - Lint: {task.json.verification.lint}
306
+ - Tests: {task.json.verification.test}
307
+ - Visual: {task.json.verification.visual}{when task.json.verification.evidence_path present, append: ` ({evidence_path})`}
308
+
309
+ {IF track === "DEBUG" AND .aperant/debug/{task-id}/DEBUG.md exists, append the RCA section distilled from the file's `## Conclusion` heading. The distillation is best-effort — quote the conclusion paragraph verbatim, keeping it under ~10 lines:}
310
+
311
+ ## RCA
312
+
313
+ {distilled from .aperant/debug/{task-id}/DEBUG.md `## Conclusion` section}
314
+
315
+ ## Commits
316
+
317
+ | Commit | Description |
318
+ |--------|-------------|
319
+ | `{sha}` | {message} |
320
+
321
+ ---
322
+
323
+ Built with [Aperant Framework](https://github.com/Mikalsen-AI/aperant-cloud-desktop/tree/main/packages/framework)
324
+ ```
325
+
326
+ The lite body omits `## QA Scores`, `## Review Findings`, `## Decision Traceability`, and the per-subtask column in `## Commits` — none of those signals exist on lite-profile tasks. Once the body is assembled, skip the rest of Section 3 and jump to Section 4.
327
+
328
+ ### 3.full — `profile === "full-pipeline"` (STANDARD and DEEP)
329
+
330
+ The body structure below is the full-pipeline template — unchanged from the pre-fix behavior. Render it when `profile === "full-pipeline"`.
331
+
200
332
  **Body structure:**
201
333
 
202
334
  ```markdown
@@ -307,27 +439,51 @@ Parse `worktree_path`, `branch`, and `base_branch` from the result.
307
439
 
308
440
  - **If the task record has `branch` and `worktree_path` (task-level worktree isolation active):**
309
441
  ```bash
310
- git -C {worktree_path} push -u origin {branch}
442
+ if [ "$behind" = "0" ]; then
443
+ git -C {worktree_path} push -u origin {branch}
444
+ else
445
+ # §0.7 rebased — lease against the pre-rebase remote tip so a concurrent
446
+ # advance of origin/{branch} between §0.7 and §6 trips the lease instead
447
+ # of silently overwriting the racing party's commit.
448
+ git -C {worktree_path} push --force-with-lease=refs/heads/{branch}:$remote_tip_sha_pre_rebase origin {branch} || {
449
+ echo '[APT:ship] Cannot ship — remote-advanced: origin/{branch} moved between §0.7 audit and §6 push. Re-run /apt:ship.' >&2
450
+ exit 1
451
+ }
452
+ fi
311
453
  gh pr create --title "{title}" --body "{body}" --base {base_branch} --head {branch}
312
454
  ```
313
- The PR targets the recorded `base_branch` (the branch the task was forked from), NOT `main`. This is the correct target when the user is shipping an intermediate milestone onto a longer-lived feature branch.
455
+ The PR targets the recorded `base_branch` (the branch the task was forked from), NOT `main`. This is the correct target when the user is shipping an intermediate milestone onto a longer-lived feature branch. The lease form is used only when §0.7 reported `behind > 0` (history was rewritten); on `behind === 0` a plain push is correct.
314
456
 
315
457
  - **If the task record has `branch` but no `worktree_path`:** Push the branch from the current cwd and create the PR against `base_branch`:
316
458
  ```bash
317
- git push -u origin {branch}
459
+ if [ "$behind" = "0" ]; then
460
+ git push -u origin {branch}
461
+ else
462
+ git push --force-with-lease=refs/heads/{branch}:$remote_tip_sha_pre_rebase origin {branch} || {
463
+ echo '[APT:ship] Cannot ship — remote-advanced: origin/{branch} moved between §0.7 audit and §6 push. Re-run /apt:ship.' >&2
464
+ exit 1
465
+ }
466
+ fi
318
467
  gh pr create --title "{title}" --body "{body}" --base {base_branch} --head {branch}
319
468
  ```
320
469
 
321
- - **If no task branch is recorded and we're on main/master:** Legacy behaviour — create a feature branch first:
470
+ - **If no task branch is recorded and we're on main/master:** Legacy behaviour — create a feature branch first. §0.7 only ran when a task record exists; this path is reached only on ad-hoc shipping and the rebase gate is necessarily skipped, so a plain push is correct (no rewritten history to lease against):
322
471
  ```bash
323
472
  git checkout -b {task-slug}
324
473
  git push -u origin {task-slug}
325
474
  gh pr create --title "{title}" --body "{body}"
326
475
  ```
327
476
 
328
- - **If no task branch is recorded and we're already on a feature branch:** Legacy behaviour — push HEAD and open a PR against `main`:
477
+ - **If no task branch is recorded and we're already on a feature branch:** Legacy behaviour — push HEAD and open a PR against `main`. When §0.7 ran (task record present), the lease form applies when `behind > 0`; on the ad-hoc / no-task-record path the gate is skipped and a plain push is correct:
329
478
  ```bash
330
- git push -u origin HEAD
479
+ if [ -n "${remote_tip_sha_pre_rebase:-}" ] && [ "$behind" != "0" ]; then
480
+ git push --force-with-lease=refs/heads/$(git rev-parse --abbrev-ref HEAD):$remote_tip_sha_pre_rebase origin HEAD || {
481
+ echo '[APT:ship] Cannot ship — remote-advanced: branch tip moved between §0.7 audit and §6 push. Re-run /apt:ship.' >&2
482
+ exit 1
483
+ }
484
+ else
485
+ git push -u origin HEAD
486
+ fi
331
487
  gh pr create --title "{title}" --body "{body}"
332
488
  ```
333
489
 
@@ -29,7 +29,7 @@ Two boundaries with adjacent skills:
29
29
  - **Spar is not a review skill.** `/codex:adversarial-review` and `/apt:review` are one-shot. Spar loops until convergence or the round cap.
30
30
  - **Spar is bidirectional 1:1.** Roundtable is 10-agent. If you want a 3-way debate, use `/apt:roundtable`.
31
31
 
32
- Hard rule, v1: **no artifact directory written.** The transcript stays in-conversation. The host prints a final verdict block, nothing persists to disk under `.aperant/sparring/` or anywhere else.
32
+ Termination posture (v1.1, amending SPAR-06): the termination headline is in-conversation; the long-form converged position is written to a single timestamped file under `.aperant/spar/`. No conversation-transcript dump, no `.aperant/sparring/` directory see `<state_files>` for the exact contract.
33
33
  </objective>
34
34
 
35
35
  <your_environment>
@@ -47,12 +47,12 @@ Hard rule, v1: **no artifact directory written.** The transcript stays in-conver
47
47
 
48
48
  **Reads:**
49
49
  - `AGENTS.md` — project constitution (principles, conventions, tech stack)
50
- - `.aperant/config.json` — `router.llm.providers` for partner fallback (read-only)
50
+ - `.aperant/config.json` — `router.llm.providers` for partner fallback (read-only). **NOTE:** `router.llm.providers.<id>.model` is NOT consulted for spar partner model selection — partner CLIs inherit their own native config (codex: `~/.codex/config.toml`; gemini: `GEMINI_MODEL` env / `~/.gemini/settings.json`). The `router.llm.providers` keys serve the cheap LLM-router classifier, a separately scoped reserved surface (see `packages/framework/src/types/config.ts:222-238`); do not conflate.
51
51
  - `.aperant/state.json` — `active_task` framing, optional
52
52
  - The live conversation transcript (when `[topic]` is empty)
53
53
 
54
54
  **Writes:**
55
- - **None.** No artifact directory written transcript stays in-conversation per SPAR-06. The final verdict is printed to stdout; nothing is persisted under `.aperant/sparring/` or any other path. This is a hard contractdo not "helpfully" add a transcript-dump file.
55
+ - A single markdown file at `.aperant/spar/<short-slug>-<YYYYMMDD-HHMMSS>.md` containing the long-form converged position, the verdict-per-round table, and any parallel-bug call-outs. No subdirectories; flat layout mirroring `.aperant/debug/` and `.aperant/roundtables/`. Write-once; not loaded back into context on subsequent runs. This narrows the SPAR-06 commitment (amended 2026-05-21 see task `apt-spar-readable-termination-summary_21-05-26`): the conversation transcript still stays in-conversation, full-transcript dumps to `.aperant/sparring/` are still rejected, but the long-form converged position is now persisted so it survives terminal close.
56
56
  </state_files>
57
57
 
58
58
  <rationalization>
@@ -64,7 +64,7 @@ The verify-before-cede rule is the whole skill. Every rationalization below name
64
64
  | "I don't need to verify — I already know I'm right." | Holding without evidence is equally forbidden. Your prior beliefs are not citations. If you can't open a file and point at a line, you don't actually know — you remember. The rule is symmetric: cede with evidence OR hold with evidence; never neither. |
65
65
  | "Only 1 round is needed — the partner's first response settles it." | True only if verification was performed. If round 1 ended with `verdict: cede` or `verdict: hold` and the verdict cited concrete evidence (`file:line`, test output, doc reference), terminating after round 1 is fine and expected. The danger is treating round 1 as a verdict because the partner's response *felt* conclusive. Speed without verification is not victory. |
66
66
  | "I'll skip host-detection and just call codex directly." | This breaks the bidirectional contract. `apt:spar` must work whether the user is on Claude Code, Codex CLI, Gemini CLI, or any of the 15+ runtimes `host-detect` covers. Hardcoding a partner makes the skill Claude-Code-centric and silently breaks the Codex→Claude direction. Always run `host-detect` (or honor `--with`) — never assume the host. |
67
- | "I'll persist the transcript so the user can revisit it." | SPAR-06 is non-negotiable in v1: no artifact directory written. The conversation transcript is the artifact. Adding a write under `.aperant/sparring/` creates an orphan-cleanup concern the user explicitly rejected; if persistence is needed later, that's a follow-up task, not a "helpful" addition here. |
67
+ | "I'll dump the full conversation transcript to disk." | Wrong scope. The SPAR-06 amendment (2026-05-21) writes ONLY the long-form converged position + verdict-per-round table + parallel call-outs to ONE timestamped file under `.aperant/spar/`. The conversation transcript stays in-conversation; full-transcript dumps to `.aperant/sparring/` are still rejected per the original SPAR-06 rationale (orphan-cleanup concern). Stick to the bounded artifact. |
68
68
  </rationalization>
69
69
 
70
70
  <autonomy_interaction>
@@ -74,7 +74,7 @@ The verify-before-cede rule is the whole skill. Every rationalization below name
74
74
  - **Autonomy 2 (Balanced, default):** Run the full loop (up to `--rounds N`, default 3) without mid-loop pauses. Pause **once** before the final converge/escalate decision in `<process>` §9 so the user can accept the termination summary or redirect.
75
75
  - **Autonomy 3 (YOLO):** Run end-to-end with no pauses. Print the termination summary and return.
76
76
 
77
- **v1 has no auto-trigger hooks (SPAR-07).** `apt:spar` is manually invoked onlyneither `/apt:plan` nor `/apt:review` chain into it automatically. Manual usage data will tell us whether auto-triggering helps; until then, deferring keeps the surface small.
77
+ **v2 honors install-time consent (SPAR-07).** When `.aperant/config.local.json` carries `spar.enabled: true` (set via the `/apt:setup` install prompt) AND `/apt:run` was invoked withor the `/apt` router auto-injected — `--spar-gates plan` (STANDARD) or `--spar-gates plan,execute` (DEEP), `/apt:spar` auto-fires between named pipeline stages. Manual `/apt:spar` invocation remains the canonical path (§1–§9 unchanged); auto-fire is opt-in per-device, never default-on per-project, never enabled on QUICK (Fast Path Guarantee). v1's "manually invoked only" rule was always deferred-pending-data per the original SPAR-07 escape hatch; founder manual-usage data is that trigger.
78
78
  </autonomy_interaction>
79
79
 
80
80
  <process>
@@ -133,7 +133,7 @@ Do NOT proceed; self-sparring is sycophancy by construction (the host cannot obj
133
133
 
134
134
  1. **Rung 1 — MCP tool** (`mcp__<partner>-mcp__*`, e.g. `mcp__codex-mcp__codex`). Detected if the host exposes its deferred-tool manifest via `CLAUDE_MCP_DEFERRED_TOOLS` and the tool is registered. When `detected: "runtime-host-only"` the framework process cannot probe the host's tool registry from outside — treat as candidate and attempt the tool call; if the tool is genuinely unavailable in the host's visible registry, fall through to rung 2.
135
135
  2. **Rung 2 — Plugin shim** (`${CLAUDE_PLUGIN_ROOT}/scripts/<partner>-companion.mjs`). Codex only (claude / gemini have no plugin shim).
136
- 3. **Rung 3 — Raw CLI on `$PATH`** (`codex exec`, `claude -p`, `gemini -m`).
136
+ 3. **Rung 3 — Raw CLI on `$PATH`** (`codex exec`, `claude -p`, `gemini`).
137
137
 
138
138
  Walk the ladder in order; pick the first rung with `detected: true` (or `"runtime-host-only"` for MCP). **MCP rung has a hard timeout** — default 900000ms (15 min), configurable via `apt-spar.mcp_timeout_ms` in `.aperant/config.json`. The MCP rung is a structured tool call, NOT a Bash invocation, so the Bash tool's 600000ms ceiling does NOT apply — the MCP rung can carry heavy-research partner runs (e.g. Claude Code partner doing multiple minutes of Read/Grep/Bash) where the Bash rungs would hit the host ceiling. On MCP timeout, **automatically fall through to rung 2 or rung 3** — do NOT fail the whole spar. Treat MCP timeout as "rung unavailable for this invocation."
139
139
 
@@ -183,20 +183,32 @@ The table below shows the canonical command shape per (partner × rung); the act
183
183
 
184
184
  | Partner | Rung | Command | Notes |
185
185
  |---|---|---|---|
186
- | codex | mcp | tool call: `mcp__codex-mcp__codex({prompt})` | Preferred. 900000ms (15 min) timeout (configurable `apt-spar.mcp_timeout_ms`); on timeout fall through to plugin then CLI. |
187
- | codex | plugin | `node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" task "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | **NO `--write`. NO `--effort` override.** Per SPAR-04 — spar is conversation, not patching. |
188
- | codex | cli | `codex exec "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | Precedent: `apt-pr-review/SKILL.md:1084`. Verify with `codex --help`. |
186
+ | codex | mcp | tool call: `mcp__codex-mcp__codex({prompt, model})` where `model` is parsed from `~/.codex/config.toml`'s `model = "<value>"` line (see §5a below). | Preferred. 900000ms (15 min) timeout (configurable `apt-spar.mcp_timeout_ms`); on timeout fall through to plugin then CLI. If `~/.codex/config.toml` is missing OR the `model =` line is absent/unparseable, treat MCP rung as UNAVAILABLE and fall through to plugin/CLI — never invent a default model (the MCP server's built-in fallback is stale `gpt-5.3-codex`, which is exactly the bug we are fixing). |
187
+ | codex | plugin | `node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" task "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | No `--model` flag — `codex-companion.mjs` invokes `codex exec` which inherits `~/.codex/config.toml` automatically. **NO `--write`. NO `--effort` override.** Per SPAR-04 — spar is conversation, not patching. |
188
+ | codex | cli | `codex exec "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | Precedent: `apt-pr-review/SKILL.md:1084`. No `--model` flag — `codex exec` inherits `~/.codex/config.toml` automatically. Verify with `codex --help`. |
189
189
  | claude | mcp | tool call: `mcp__claude-code-mcp__claude_code({prompt})` | Preferred. Same 900000ms (15 min) timeout + fallthrough rule. |
190
190
  | claude | plugin | n/a | No plugin shim exists for Claude. Skip this rung. |
191
191
  | claude | cli | `claude -p "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)" --output-format text` | Symmetric. Claude has no `--write` equivalent — asymmetric flags are a smell. |
192
192
  | gemini | mcp | tool call: `mcp__gemini-mcp__*({prompt})` | Preferred. Same 900000ms (15 min) timeout + fallthrough rule. Any `mcp__gemini-mcp__*` tool satisfies the rung. |
193
193
  | gemini | plugin | n/a | No plugin shim exists for Gemini. Skip this rung. |
194
- | gemini | cli | `gemini -m <model-from-router.llm.providers.gemini-cli> "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | Read the exact model name from `.aperant/config.json` at runtime do not hardcode. |
194
+ | gemini | cli | `gemini "$(cat <<'APT_SPAR_PROMPT_EOF' ... APT_SPAR_PROMPT_EOF\n)"` | No `-m` flag — gemini-cli resolves model via `--model` > `GEMINI_MODEL` env > `~/.gemini/settings.json` > built-in default per `docs/cli/model-routing.md:47-58`. Drop the flag, let the cascade work; users override per-shell via `GEMINI_MODEL=...` or per-project via `settings.json`. |
195
195
 
196
196
  Set the Bash tool's `timeout` parameter to `--timeout-ms` (default 300000).
197
197
 
198
198
  **Timeout calibration.** The 5-min Bash-rung default and 15-min MCP-rung default are sized for heavy-research partner runs — modern partner CLIs commonly spend multiple minutes doing real Read/Grep/Bash investigation before producing a round response. The two defaults are intentionally asymmetric: the Bash rungs (plugin shim, raw CLI) are capped at the Claude Code Bash tool's 600000ms (10 min) host ceiling, while the MCP rung — a structured tool call rather than a Bash invocation — has no host ceiling and can carry the worst-case 15-min Claude Code partner. For tighter budgets (e.g. CI), pass `--timeout-ms` explicitly. The MCP-rung override is downward-only: if you observe consistent partner-CLI wedges (auth handshakes, hosted-API stalls, CI lanes wanting fast failure), set `apt-spar.mcp_timeout_ms` BELOW the 15-min default in `.aperant/config.json` (e.g. `120000` for a 2-min fast-fail budget) — raising it above 15 min is unnecessary because the default already covers the documented worst case. Future versions may introduce per-partner defaults.
199
199
 
200
+ ## 5a. Codex MCP model resolution
201
+
202
+ The codex MCP rung (table row above) requires an explicit `model` arg sourced from the user's `~/.codex/config.toml`. The MCP server (`codex-mcp-server`) does NOT read `~/.codex/config.toml` itself — when no `model` is passed it falls back to a hardcoded stale `gpt-5.3-codex`, silently overriding the user's actual configured model. Resolve the model exactly once per spar invocation, before the rung-table walk:
203
+
204
+ ```bash
205
+ # Resolve the codex MCP model exactly once per spar invocation, before the rung table walk
206
+ CODEX_MCP_MODEL="$(grep -E '^model = "[^"]+"' "$HOME/.codex/config.toml" 2>/dev/null | head -1 | sed -E 's/^model = "([^"]+)".*/\1/')"
207
+ # If empty → codex MCP rung is UNAVAILABLE; fall through to plugin/CLI.
208
+ ```
209
+
210
+ If `$CODEX_MCP_MODEL` is empty (file missing, `model =` line absent, or value not double-quoted), treat the MCP rung as UNAVAILABLE and fall through to plugin → CLI. **Never invent a default** — the upstream MCP server's built-in `gpt-5.3-codex` fallback is exactly the bug this resolution path exists to fix.
211
+
200
212
  **Prompt-quoting safety.** The prompt is user-controlled (it comes from `[topic]` and/or conversation context) and may legitimately contain double quotes, dollar signs, backticks, or `$(...)` substitution that bash would otherwise expand or break on. NEVER interpolate `<prompt>` directly inside a double-quoted shell argument. Instead, pipe via a here-document so the shell treats the body as opaque text:
201
213
 
202
214
  ```bash
@@ -213,7 +225,7 @@ APT_SPAR_PROMPT_EOF
213
225
  )" --output-format text
214
226
 
215
227
  # Gemini direction
216
- gemini -m <model-from-router.llm.providers.gemini-cli> "$(cat <<'APT_SPAR_PROMPT_EOF'
228
+ gemini "$(cat <<'APT_SPAR_PROMPT_EOF'
217
229
  <prompt body — opaque, no shell expansion>
218
230
  APT_SPAR_PROMPT_EOF
219
231
  )"
@@ -298,21 +310,70 @@ The hard cap of 3 rounds is non-negotiable in v1 (see SPAR-05). Long-tail disagr
298
310
 
299
311
  ## 9. Termination Report
300
312
 
301
- Print a final block:
313
+ The termination report has two layers. **Layer 1 — Headline** is printed to stdout and is the only thing the user reads to understand the spar at a glance. **Layer 2 — Detail** is the verbatim long-form converged position; it is persisted to a single timestamped file under `.aperant/spar/` so it survives terminal close (per the SPAR-06 amendment of 2026-05-21 — see `<state_files>`).
314
+
315
+ ### Layer 1 — Headline (always printed)
316
+
317
+ Emit exactly this shape — `<-- copy this exact shape -->`:
302
318
 
319
+ ```text
320
+ === apt:spar — <outcome> ===
321
+ Topic: <one-line topic restatement>
322
+ Host: <cli-id> ↔ Partner: <cli-id> · Rounds: <n>/<cap>
323
+
324
+ Round 1: <one-sentence shift — what changed in the host's position, or what the partner caught>
325
+ Round 2: <one-sentence shift, omit this line entirely if rounds<2>
326
+ Round 3: <one-sentence shift, omit this line entirely if rounds<3>
327
+
328
+ Outcome: <one-sentence plain-English statement of what was agreed/disagreed and what it means for the next plan>
329
+
330
+ Next: <ONE suggested action — a single slash command or a single human-readable instruction. NOT a 4-item menu.>
331
+
332
+ Full detail: <path>
303
333
  ```
304
- === apt:spar — termination summary ===
305
- Topic: <one-line>
306
- Host: <cli-id> Partner: <cli-id> Rounds: <n>/<cap>
307
- Outcome: converged | held-disagreement | round-cap | partner-unreachable
308
- Converged position OR Held disagreement: <one-paragraph>
309
-
310
- Recommended next step:
311
- - continue: <best follow-up usually `/apt:plan` or `/apt:execute`>
312
- - escalate: `/apt:roundtable "<topic>"` for a 10-agent debate
313
- - pause: no further action; surface to the user for human input
334
+
335
+ Constraints baked into the headline (do NOT relax):
336
+
337
+ - **One sentence per round, max ~25 words.** No bullets, no nested lists.
338
+ - **No code fences, no JSON, no ASCII tables inside the headline.** Schemas, trust models, verdict-per-round tables, and parallel-bug call-outs all go in the Layer 2 file — never in the headline.
339
+ - **No trailing disposition question.** Do not append "Want me to file this?" or any similar re-ask. The autonomy policy in `<autonomy_interaction>` already governs whether the host pauses for user input; the headline does not re-prompt.
340
+ - **Outcome vocabulary** is exactly one of: `converged`, `held-disagreement`, `round-cap`, `partner-unreachable`. Do not invent new outcome words. These are the terminal-outcome words for the spar as a whole; they are distinct from the §7 per-round verdict words (`cede` / `hold` / `next-round` / `partner-unreachable`) — `partner-unreachable` is the only word shared between the two vocabularies.
341
+ - **`Full detail:`** names the path to the Layer 2 file written below.
342
+
343
+ ### Layer 2 Persist the long-form (Path B)
344
+
345
+ ALSO write a single markdown file at `.aperant/spar/<slug>-<YYYYMMDD-HHMMSS>.md` containing the verbatim long-form: the converged-position content (architecture, schemas, trust model), the verdict-per-round table, and any parallel-bug call-outs the spar surfaced. The headline's `Full detail:` line MUST reference this exact path.
346
+
347
+ **Slug derivation.** Lowercase the topic; replace each run of non-`[a-z0-9]` characters with a single `-`; trim leading/trailing `-`; take the first 6 hyphen-separated tokens; truncate the resulting string to 40 chars; trim any trailing `-` left by truncation. Final form MUST match `^[a-z0-9-]{1,40}$` — the slug is interpolated directly into the path string, so any character outside `[a-z0-9-]` is a path-injection vector and must NOT survive this step. Example: topic `"Should we use Shape C++ for the IDL layer or stay with Shape B"` → tokens `should we use shape c for` (the `++` collapses with the trailing whitespace into a single `-`) → slug `should-we-use-shape-c-for` (24 chars; under the 40-char cap).
348
+
349
+ **Timestamp format.** `YYYYMMDD-HHMMSS` (UTC, per-second granularity). Two spar invocations within the same second produce identical paths — acceptable risk for v1.1.
350
+
351
+ **Write invocation.** Use the same single-quoted heredoc safety pattern §5 uses for prompt-quoting — the body is opaque text and may legitimately contain backticks, `$(...)`, or other shell-active characters that bash would otherwise expand:
352
+
353
+ ```bash
354
+ mkdir -p .aperant/spar && cat > ".aperant/spar/<slug>-<YYYYMMDD-HHMMSS>.md" <<'APT_SPAR_LONGFORM_EOF'
355
+ # apt:spar long-form — <topic>
356
+
357
+ **Host:** <cli-id> · **Partner:** <cli-id> · **Rounds:** <n>/<cap> · **Outcome:** <outcome>
358
+
359
+ ## Converged position (or held disagreement)
360
+
361
+ <verbatim long-form: architecture, schemas, trust model, etc.>
362
+
363
+ ## Verdict per round
364
+
365
+ | Round | What host held | What partner caught | What host conceded |
366
+ |-------|----------------|---------------------|--------------------|
367
+ | 1 | ... | ... | ... |
368
+
369
+ ## Parallel call-outs
370
+
371
+ <bugs / observations surfaced during sparring that are independent of the topic; omit the whole section if none>
372
+ APT_SPAR_LONGFORM_EOF
314
373
  ```
315
374
 
316
- Nothing is written to disk the termination summary is in-conversation output only (per SPAR-06).
375
+ The `'APT_SPAR_LONGFORM_EOF'` (single-quoted heredoc terminator) is load-bearing — identical to the `APT_SPAR_PROMPT_EOF` convention in §5. It disables variable/command substitution inside the body so an attacker-controlled topic cannot execute commands.
376
+
377
+ This file is write-once and is NOT loaded back into context on subsequent `apt:spar` runs — it is purely a preservation artifact for the user.
317
378
 
318
379
  </process>
@@ -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/triage/AGENT-BRIEF.md
4
- Licensed under MIT. Modifications: aligned with Aperant's 5-state
5
- machine (needs-triage / needs-info / ready-for-agent / ready-for-human /
6
- wontfix) and the backend-pluggable mirror model (local-only / github-issues / app-inbox).
7
- -->
8
-
9
1
  # Triage Agent Brief — what to do with each state
10
2
 
11
3
  ## needs-triage (inbound)
@@ -1,10 +1,3 @@
1
- <!--
2
- Adapted from Matt Pocock's MIT-licensed skill suite:
3
- https://github.com/mattpocock/skills/blob/main/skills/engineering/triage/OUT-OF-SCOPE.md
4
- Licensed under MIT. Modifications: aligned with Aperant's pipeline
5
- (other skills exist for the out-of-scope concerns — explicit pointers).
6
- -->
7
-
8
1
  # Triage Out-of-Scope
9
2
 
10
3
  What this skill is NOT. Knowing the boundary prevents triage from