@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
@@ -0,0 +1,236 @@
1
+ # Domain Tools, Gates, and Output Templates
2
+
3
+ > Per-domain tool surface, reasoning gates, and synthesis output template.
4
+ > Load when domain has been detected (Step 1d) or when synthesizing
5
+ > (Step 10).
6
+
7
+ The four domains are detected from the user's question in Step 1d and
8
+ recorded as immutable in `research-spec.md ## Domain`. The detected
9
+ domain determines which tools each `apt-researcher` role gets, which
10
+ reasoning steps are enabled, and what shape the final `RESEARCH.md`
11
+ output takes.
12
+
13
+ ## Domain detection signals
14
+
15
+ | Domain | Signals | Examples |
16
+ |---|---|---|
17
+ | **mechanistic** | physics, math, distributed systems, algorithms, deterministic engineering systems with provable behavior | "how does Raft handle leader election", "what does axle stiffness do to chassis dynamics", "is this algorithm O(log n)" |
18
+ | **empirical** | medicine, biology, nutrition, psychology, public-health, social science, anything where human variation dominates and replication matters | "does intermittent fasting cause muscle loss", "what's the effect of X on Y in older adults", "is supplement X effective" |
19
+ | **strategic** | tool/vendor comparison, market analysis, license/contract evaluation, anything where the answer depends on vendor disclosure + ecosystem health | "best embedded DB for offline-first 2026", "should we pick Vitest or Bun test", "is Turso safe to depend on" |
20
+ | **general** | catch-all when none of the above fit; usually broad knowledge questions or framing-questions | "what is consensus in distributed systems", "explain bitemporal databases" |
21
+
22
+ Ambiguous question → `general`. The user can override with explicit
23
+ flag (future: `--domain <name>`); for v1, signal-based detection is
24
+ authoritative.
25
+
26
+ ## Per-domain tool surface
27
+
28
+ Each `apt-researcher` role gets the base tools (Read, Grep, Glob,
29
+ WebSearch, WebFetch, Context7) PLUS the domain extras below.
30
+
31
+ ### mechanistic
32
+
33
+ | Tool | How invoked | Used by |
34
+ |---|---|---|
35
+ | arxiv search | `curl "http://export.arxiv.org/api/query?search_query=..."` | Retriever |
36
+ | PDF reader | `curl -o /tmp/x.pdf {url} && pdftotext /tmp/x.pdf -` | Builder, Skeptic, Retriever |
37
+ | Wolfram Alpha (if API key set) | `curl "https://api.wolframalpha.com/v2/query?..."` | Builder, Skeptic |
38
+
39
+ First-principles derivation: **ENABLED**. Builder and Skeptic may
40
+ produce derivations grounded in domain theory. Judge accepts them
41
+ into `claims.json` at `source_tier: derived-theory` (weight 0.6
42
+ in `uncertainty` formula).
43
+
44
+ ### empirical
45
+
46
+ | Tool | How invoked | Used by |
47
+ |---|---|---|
48
+ | Crossref DOI resolve | `curl "https://api.crossref.org/works/{doi}"` | Retriever, citation audit |
49
+ | PubMed E-utilities | `curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=..."` | Retriever |
50
+ | PMC full-text fetch | `curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&id={pmcid}"` | Builder, Skeptic |
51
+ | Europe PMC fallback | `curl "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=..."` | Retriever |
52
+
53
+ First-principles derivation: **DEMOTED**. Builder/Skeptic may invoke
54
+ theory (mechanism, leucine threshold, etc.) but Judge demotes the
55
+ output to `source_tier: hypothesis` (weight 0.1). Hypotheses cannot
56
+ reach `confidence: high` regardless of how compelling the reasoning
57
+ sounds — only empirical evidence at `tier ≥ independent-test` can
58
+ elevate a claim to `high`.
59
+
60
+ Citation audit is **MANDATORY** every iteration (not every N) in
61
+ empirical domains. Every new citation MUST be DOI/PMID-verified
62
+ via Crossref or NCBI before promotion to `sources.json`. Failures
63
+ go straight to `suspect-citations.md` and the claim depending on
64
+ them is downgraded.
65
+
66
+ ### strategic
67
+
68
+ | Tool | How invoked | Used by |
69
+ |---|---|---|
70
+ | GitHub releases | `gh release list -R {owner}/{repo} --limit 20` | Retriever |
71
+ | GitHub code search | `gh search code "..." --limit 20` | Retriever, Skeptic |
72
+ | License fetch | `gh api repos/{owner}/{repo}/license` or WebFetch raw LICENSE | Retriever |
73
+ | Changelog fetch | WebFetch `CHANGELOG.md` or `gh api repos/{owner}/{repo}/contents/CHANGELOG.md` | Retriever |
74
+ | Package metadata | `npm view {pkg} --json` / `pip show {pkg} --verbose` / `cargo search {pkg}` | Retriever |
75
+
76
+ First-principles derivation: **DISABLED**. "Derive whether libSQL is
77
+ stable from theory" is nonsense. Builder is instructed to synthesize
78
+ from sources only. If Builder produces a derivation-shaped output,
79
+ Judge rejects it with `## reason: derivation invalid in strategic domain`.
80
+
81
+ Vendor-only evidence is a spar trigger (see `overnight-loop.md`
82
+ §spar-triggers). Strategic domain treats vendor-doc as
83
+ `source_tier: vendor-doc` (weight 0.5) — NOT a high tier.
84
+
85
+ ### general
86
+
87
+ Default tool surface. First-principles is **SOFT-ENABLED with
88
+ hypothesis demotion** — Builder/Skeptic may derive but Judge
89
+ demotes to `hypothesis` until empirical or primary-doc evidence
90
+ elevates the claim.
91
+
92
+ ## Output gates (Step 10 — synthesis)
93
+
94
+ The synthesis template in `RESEARCH.md` has a common core (defined in
95
+ the main SKILL.md `## 10. Synthesize`) PLUS domain-specific sections.
96
+
97
+ ### mechanistic
98
+
99
+ Add:
100
+
101
+ ```markdown
102
+ ## First-principles derivations
103
+
104
+ For each derivation accepted into the claim graph at
105
+ `source_tier: derived-theory`:
106
+
107
+ - **{derivation name}** — claim {C-id}
108
+ - Premises: {what we assumed}
109
+ - Steps: {compact derivation}
110
+ - Cross-check vs sources: {which sources confirm/contradict the derivation}
111
+ - Failure mode: {when does this derivation break?}
112
+ ```
113
+
114
+ If a derivation contradicts an empirical source, the derivation is
115
+ flagged as bounded — Judge MUST note the boundary condition.
116
+
117
+ ### empirical
118
+
119
+ Add (mandatory, non-negotiable):
120
+
121
+ ```markdown
122
+ ## Not medical / financial / safety advice
123
+
124
+ This research synthesis is informational. It is not a substitute for
125
+ professional advice from a licensed clinician, financial advisor, or
126
+ safety expert. Individual circumstances vary; outcomes that apply to
127
+ populations may not apply to any specific person.
128
+
129
+ ## What this CAN'T tell you
130
+
131
+ - {Specific question the evidence does not address}
132
+ - {Specific population the evidence does not cover}
133
+ - {Specific interaction or confounder the evidence cannot resolve}
134
+
135
+ ## Quality of evidence
136
+
137
+ For each cited study supporting a critical claim:
138
+
139
+ | Source | Design | n | Peer-reviewed | Replicated | Notes |
140
+ |---|---|---|---|---|---|
141
+ | {S-id} | {RCT/cohort/meta} | {n} | {yes/no} | {yes/no/unknown} | {note} |
142
+ ```
143
+
144
+ Imperatives in the synthesis prose ("you should…", "do X", "avoid Y")
145
+ are STRIPPED by Judge. Empirical synthesis uses descriptive language
146
+ ("evidence suggests…", "in the populations studied…").
147
+
148
+ If the synthesis would recommend a course of action affecting health,
149
+ finance, or safety, Judge inserts: "**Discuss with a qualified
150
+ professional before acting on this synthesis.**"
151
+
152
+ ### strategic
153
+
154
+ Add (mandatory):
155
+
156
+ ```markdown
157
+ ## Conditional-tree recommendation
158
+
159
+ ```
160
+ if {decision-relevant condition A}:
161
+ → recommend {Option X}
162
+ → reason: {1-line}
163
+ elif {decision-relevant condition B}:
164
+ → recommend {Option Y}
165
+ → reason: {1-line}
166
+ else:
167
+ → no clear winner — {what's the unresolved question}
168
+ ```
169
+
170
+ ## Vendor-claim conflicts
171
+
172
+ For each option where evidence is vendor-only or vendors disagree:
173
+
174
+ - **{Option}** — {dimension}
175
+ - Vendor claim: {what the vendor says}
176
+ - Independent confirmation: {available | NOT AVAILABLE}
177
+ - Risk if vendor claim is wrong: {what breaks}
178
+
179
+ ## Decision blockers
180
+
181
+ Questions only the user can answer that change the recommendation:
182
+
183
+ - {Question} — affects: {which option(s)}
184
+ ```
185
+
186
+ Single-winner output is **REJECTED** by Judge when evidence is
187
+ vendor-only across the deciding dimension. The skill produces a
188
+ conditional tree or explicit "no clear winner" — never a confident
189
+ universal recommendation in those cases.
190
+
191
+ ### general
192
+
193
+ Add:
194
+
195
+ ```markdown
196
+ ## Outstanding gaps
197
+
198
+ - {Open question that the synthesis does not close}
199
+
200
+ ## Recommended next reads
201
+
202
+ - {Source} — covers {what aspect}
203
+ ```
204
+
205
+ ## Mode-specific additions (orthogonal to domain)
206
+
207
+ Applied AFTER the domain gates. From the main SKILL.md `## 10.
208
+ Synthesize`, repeated here for the per-domain reader:
209
+
210
+ - **UNDERSTAND** → mental model section with mechanism + analogy
211
+ - **VERIFY** → verdict line (`confirmed | partially confirmed | false |
212
+ contested | unknown`)
213
+ - **SOLVE** → candidate approaches table + `## Falsification status`.
214
+ For code-domain SOLVE: blocks `CONVERGED` if no falsification was
215
+ run (test / simulator / model-checker / formal-method sketch).
216
+ Force STALLED with `## Cannot certify without falsification` and
217
+ enumerate what falsification harness would be needed.
218
+ - **COMPARE** → dimensions × options matrix + per-cell evidence
219
+ pointers (conditional-tree comes from the strategic domain gate)
220
+
221
+ ## Tool-surface fallbacks
222
+
223
+ If a domain tool is unavailable in the current environment (e.g.
224
+ `gh` not installed, no network access for Crossref), the affected
225
+ role MUST report this in its output:
226
+
227
+ ```
228
+ ## Tool unavailable
229
+ - {tool name}: {why unavailable}
230
+ - Impact on this iteration: {what could not be done}
231
+ ```
232
+
233
+ Judge records the missing capability in `iteration-log.md` and adjusts
234
+ stop-state evaluation: a STALLED verdict resulting from missing tools
235
+ gets `## Cannot resolve without` annotated with "tool {X} unavailable
236
+ in this environment". The user can resolve and `--resume`.
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: apt:resume
3
- description: "Restore context from a paused session or recover from a crash"
3
+ description: "Restore context from a paused session, an agent handoff, or recover from a crash"
4
4
  apt-skill-version: {{APT_VERSION}}
5
5
  stage: resume
6
6
  intent: capture
7
- when_to_use: "The user is returning to paused work or recovering from a crash and needs to restore context from CONTINUE artifacts or the active-task state."
7
+ when_to_use: "The user is returning to paused work, picking up an agent-to-agent handoff, or recovering from a crash and needs to restore context from CONTINUE artifacts, HANDOFF artifacts, or the active-task state."
8
8
  user_invocable: true
9
9
  internal: false
10
10
  spawns_agent: false
@@ -19,14 +19,15 @@ argument-hint: "apt:resume [task-id]"
19
19
  gates: []
20
20
  ---
21
21
  <objective>
22
- Restore context and continue work after a session break — whether it was a graceful pause (CONTINUE files exist) or a crash/disconnect (no CONTINUE but state.json has an active task). Supports multiple paused sessions — shows all and lets the user pick which to resume.
22
+ Restore context and continue work after a session break — whether it was a graceful pause (CONTINUE files exist), an agent-to-agent handoff (HANDOFF files exist, written by `/apt:handoff`), or a crash/disconnect (no CONTINUE/HANDOFF but state.json has an active task). Supports multiple resumable sessions of mixed type — shows all and lets the user pick which to resume.
23
23
  </objective>
24
24
 
25
25
  <your_environment>
26
26
  - **Working directory:** The project root (where you were invoked)
27
27
  - **apt-tools path:** `node packages/framework/bin/apt-tools.mjs` or the locally installed `apt-tools` binary
28
28
  - **Constitution:** Read `AGENTS.md` in the project root if it exists
29
- - **Pause index:** `.aperant/CONTINUE_INDEX.md` (lists all paused sessions)
29
+ - **Pause index:** `.aperant/CONTINUE_INDEX.md` (human-pause sessions written by `/apt:pause`)
30
+ - **Handoff index:** `.aperant/HANDOFFS_INDEX.md` (agent-to-agent handoffs written by `/apt:handoff`)
30
31
  - **Legacy handoff:** `.aperant/CONTINUE.md` (pre-v2 single-file format, migrate if found)
31
32
  - **State:** `.aperant/state.json` (always exists if initialized)
32
33
  - **Cross-agent team signal:** `.aperant/team-status/{agent-id}.json` records (gitignored, TTL-expired) are the canonical "who's working on what" surface; `state.active_tasks` is this agent's local view.
@@ -35,74 +36,85 @@ Restore context and continue work after a session break — whether it was a gra
35
36
 
36
37
  <process>
37
38
 
38
- ## 1. Discover Paused Sessions
39
+ ## 1. Discover Resumable Sessions
40
+
41
+ Each discovered session is tagged with a **type** — `pause` (human stopped, `CONTINUE.md`) or `handoff` (agent transferred work, `HANDOFF.md`) — and tracked alongside its location. Scan both surfaces; do not assume only one exists.
39
42
 
40
43
  ### 1a. Check for pause index
41
- Read `.aperant/CONTINUE_INDEX.md` if it exists — this is the primary source of paused sessions.
44
+ Read `.aperant/CONTINUE_INDEX.md` if it exists — primary source for `type=pause` sessions.
45
+
46
+ ### 1b. Check for handoff index
47
+ Read `.aperant/HANDOFFS_INDEX.md` if it exists — primary source for `type=handoff` sessions (agent-to-agent transfers from `/apt:handoff`).
42
48
 
43
- ### 1b. Check for legacy CONTINUE.md
49
+ ### 1c. Check for legacy CONTINUE.md
44
50
  If `.aperant/CONTINUE.md` exists (pre-v2 format), treat it as one paused session. Migrate it after resume:
45
51
  - Move it to the appropriate task dir or `.aperant/paused/` location
46
- - Add it to the index
52
+ - Add it to `CONTINUE_INDEX.md`
47
53
 
48
- ### 1c. Scan for task-level CONTINUE files
49
- As a fallback, scan for CONTINUE.md files that might not be in the index:
54
+ ### 1d. Scan for task-level CONTINUE and HANDOFF files
55
+ As a fallback, scan for files that might not be in either index:
50
56
  ```bash
51
57
  find .aperant/tasks/*/CONTINUE.md .aperant/paused/*/CONTINUE.md 2>/dev/null
58
+ find .aperant/tasks/*/handoffs/*/HANDOFF.md .aperant/handoffs/*/HANDOFF.md 2>/dev/null
52
59
  ```
53
60
 
54
- ### 1d. Check state.json for active tasks
61
+ ### 1e. Check state.json for active tasks
55
62
  ```bash
56
63
  node packages/framework/bin/apt-tools.mjs health-check .
57
64
  node packages/framework/bin/apt-tools.mjs task list .
58
65
  ```
59
66
 
60
- Combine all sources into a unified list of resumable sessions.
67
+ Combine all sources into a unified list of resumable sessions, each carrying `{ type, path, branch, focus_or_task, date, suggested_receiver? }`.
61
68
 
62
69
  ## 2. Present Sessions
63
70
 
64
- ### If multiple paused sessions found:
71
+ ### If multiple resumable sessions found:
72
+
73
+ Render handoffs FIRST (agent dropped work in your lap = higher urgency than human-paused work). Tag each row with `[pause]` or `[handoff]`.
65
74
 
66
75
  ```
67
- Paused Sessions
76
+ Resumable Sessions
68
77
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
78
 
70
- 1. Chat UI Polish + Sidebar Redesign
79
+ 1. [handoff] Finish MCP token rotation wiring
80
+ Branch: feat/mcp-rotation | Handed off: 2026-05-22 14:30
81
+ Sender: Claude Opus 4.7 / Claude Code → Receiver: any agent
82
+ → .aperant/handoffs/handoff-20260522-1430-finish-mcp-token-rotation/HANDOFF.md
83
+
84
+ 2. [pause] Chat UI Polish + Sidebar Redesign
71
85
  Branch: closing-phase-4 | Paused: 2026-04-13
72
86
  Progress: 6/9 items done
73
87
  → .aperant/paused/paused-20260413-chat-ui-polish/CONTINUE.md
74
88
 
75
- 2. Onboarding State Unification
89
+ 3. [pause] Onboarding State Unification
76
90
  Branch: feat/onboarding-sync | Paused: 2026-04-13
77
91
  Progress: executing subtask 3/5
78
92
  → .aperant/tasks/task-20260413-onboarding-sync/CONTINUE.md
79
93
 
80
- 3. Fix DB Path in services.ts
81
- Branch: closing-phase-4 | Paused: 2026-04-12
82
- Progress: planned, not started
83
- → .aperant/tasks/task-20260412-fix-db-path/CONTINUE.md
84
-
85
94
  Which session to resume? (number, or "all" to see full context for each)
86
95
  ```
87
96
 
88
97
  Wait for user selection before proceeding.
89
98
 
90
- ### If one paused session found:
99
+ ### If one resumable session found:
91
100
  Proceed directly to Step 3 with that session.
92
101
 
93
- ### If no paused sessions but active tasks in state.json:
102
+ ### If no resumable sessions but active tasks in state.json:
94
103
  Follow crash recovery flow (Step 4).
95
104
 
96
105
  ### If nothing found:
97
106
  ```
98
- No paused sessions or active tasks found.
107
+ No paused sessions, handoffs, or active tasks found.
99
108
 
100
109
  → Start something new: /apt "describe your task"
101
110
  ```
102
111
 
103
112
  ## 3. Resume Selected Session
104
113
 
105
- Read the selected CONTINUE.md and extract:
114
+ Branch on `type`:
115
+
116
+ ### 3a. type=pause — read CONTINUE.md
117
+ Extract:
106
118
  - **Task description** — What was being worked on
107
119
  - **Branch** — Which branch to be on
108
120
  - **Decisions made** — Context that must not be lost
@@ -110,26 +122,37 @@ Read the selected CONTINUE.md and extract:
110
122
  - **Current state** — Pipeline stage, progress
111
123
  - **Next steps** — Ordered list of what to do next
112
124
 
125
+ ### 3b. type=handoff — read HANDOFF.md
126
+ Extract the handoff-specific fields:
127
+ - **Focus For The Receiver** — the load-bearing paragraph; this drives the immediate next action
128
+ - **Sender / Suggested receiver** — model + CLI hints (warn if the current agent is a poor fit, e.g. handoff suggested Codex for a heavy refactor and the receiver is a small model)
129
+ - **Existing Artifacts** — open each referenced path/URL into context BEFORE acting
130
+ - **Decisions Made (do NOT relitigate)** — treat as locked context
131
+ - **Uncommitted changes** — handoffs do NOT stash; verify the listed files still exist in the working tree with `git status --short` and reconcile if drift occurred since the handoff was written
132
+ - **External state the receiver must check** — verify each item (dev server running, PR open, MCP session live) before resuming
133
+ - **Suggested Skills** — use as the next-action recommendation
134
+
113
135
  ### Check Branch
114
136
  ```bash
115
137
  git branch --show-current
116
138
  ```
117
139
  If not on expected branch: suggest `git checkout {expected-branch}`
118
140
 
119
- ### Restore Stashed Work
120
- If CONTINUE.md indicates stashed changes, find and pop the matching stash:
141
+ ### Restore Stashed Work (pause only)
142
+ For `type=pause` ONLY — if CONTINUE.md indicates stashed changes, find and pop the matching stash:
121
143
  ```bash
122
144
  git stash list | grep "apt-pause: {task description}"
123
145
  ```
146
+ `type=handoff` never stashes; skip this step for handoffs.
124
147
 
125
148
  ### Present Context Summary
126
- Display all key context from CONTINUE.md, then suggest the next action based on pipeline stage.
149
+ Display all key context from the artifact, then suggest the next action based on pipeline stage (pause) or Focus + Suggested Skills (handoff).
127
150
 
128
151
  ### Clean Up After Resume
129
152
  After user confirms they have context:
130
- - Remove the CONTINUE.md file that was resumed
131
- - Remove its row from CONTINUE_INDEX.md
132
- - If the index is now empty, delete CONTINUE_INDEX.md
153
+ - Remove the resumed artifact file (`CONTINUE.md` or `HANDOFF.md`)
154
+ - Remove its row from the matching index (`CONTINUE_INDEX.md` or `HANDOFFS_INDEX.md`)
155
+ - If the index is now empty, delete it
133
156
 
134
157
  ## 4. Crash Recovery (no CONTINUE, stale active_tasks)
135
158
 
@@ -17,7 +17,7 @@ execution_modes:
17
17
  - plan-mode
18
18
  - plan-only
19
19
  allowed-tools: "Bash, Read, Write, Edit, Grep, Glob, Task"
20
- argument-hint: "apt:run [task description] [--skip-review] [--phase-mode auto|agent-team|sub-agents|sequential]"
20
+ argument-hint: "apt:run [task description] [--skip-review] [--phase-mode auto|agent-team|sub-agents|sequential] [--spar-gates plan[,execute]]"
21
21
  gates:
22
22
  - constitution-read
23
23
  - constitution-coverage
@@ -58,7 +58,14 @@ As of C32 the STANDARD and DEEP auto pipelines **terminate on review** (`plan
58
58
 
59
59
  1. Read `AGENTS.md` if it exists
60
60
  2. Parse task description from `$ARGUMENTS` (everything before flags)
61
- 3. Parse flags: `--skip-review`, `--dry-run`
61
+ 3. Parse flags: `--skip-review`, `--dry-run`, `--phase-mode <mode>`, `--spar-gates <comma-list>`.
62
+ - `--spar-gates <plan|execute|plan,execute>` (FRAMEWORK-RFC-001) — comma-separated stage list to auto-fire `/apt:spar` after. Per-invocation override of `.aperant/config.local.json` `spar.enabled`. On QUICK track, print the verbatim hard-reject line and discard the flag (Fast Path Guarantee — CLAUDE.md):
63
+
64
+ ```
65
+ [apt:run] --spar-gates ignored for QUICK track (Fast Path Guarantee)
66
+ ```
67
+
68
+ On STANDARD / DEEP / DEBUG tracks, the flag is honored and consumed by §3b (plan gate) and §4b (execute gate). Default is to fall back to merged-config `spar.enabled` semantics — see §3b / §4b for the full resolution order. The flag accepts only `plan`, `execute`, or `plan,execute` — any other value is rejected with `[apt:run] --spar-gates accepts plan, execute, or plan,execute`.
62
69
 
63
70
  ```bash
64
71
  node packages/framework/bin/apt-tools.mjs state .
@@ -127,6 +134,12 @@ node packages/framework/bin/apt-tools.mjs commit "plan: create implementation pl
127
134
 
128
135
  **Output:** spec.md, implementation_plan.json
129
136
 
137
+ **Spar hint surface (FRAMEWORK-RFC-001).** If merged-config `spar.hint === true` AND `spar.enabled === false`, print:
138
+ ```
139
+ [apt] plan complete. /apt:spar available before next stage. (skill, not auto-fire)
140
+ ```
141
+ Skip the print on `spar.enabled === true` (the gate handler in §3b already fires).
142
+
130
143
  If `--dry-run` flag is set:
131
144
  ```
132
145
  Dry run complete. Plan created but not executed.
@@ -137,6 +150,51 @@ Remove --dry-run to execute the full pipeline.
137
150
  ```
138
151
  Exit.
139
152
 
153
+ ## 3b. Stage 1.5 — Spar Gate (plan)
154
+
155
+ **FRAMEWORK-RFC-001 — auto-fire `/apt:spar` after the plan stage when consent is on.**
156
+
157
+ Resolve effective gates:
158
+
159
+ 1. **Track gate.** If track is `QUICK`, **skip this entire section** and continue to §4. QUICK is hard-exempt per CLAUDE.md Fast Path Guarantee. If the user passed `--spar-gates` on a QUICK invocation, §1 already printed the verbatim hard-reject and discarded the flag.
160
+ 2. **Read merged config** via `loadMergedProjectConfig(.)`:
161
+
162
+ ```bash
163
+ node packages/framework/bin/apt-tools.mjs config show . --merged
164
+ ```
165
+
166
+ Parse `spar.enabled` (boolean) and `spar.partner` (`'codex' | 'claude' | 'gemini' | null`). When `spar.enabled === true`, build default gates by track: `["plan"]` for STANDARD, `["plan", "execute"]` for DEEP.
167
+ 3. **Per-invocation override.** If the user passed `--spar-gates <list>` on the `/apt:run` invocation (parsed in §1), the explicit value WINS over merged-config defaults (per-invocation precedence — classic config precedence).
168
+ 4. **Gate check.** If `"plan"` is not in the resolved gate list, skip the rest of this section.
169
+
170
+ If `"plan"` is in the resolved gate list, dispatch the spar gate.
171
+
172
+ **Compose the topic frame (1–2 sentences).** Prefer `spec.md` §Scope (the first paragraph under the `## 1. Scope` heading). If spec.md has no `## 1. Scope` heading (QUICK-skipped or non-PRD-shaped — Open Q4 graceful fallback), use the task description passed to `/apt:run`.
173
+
174
+ **Dispatch `/apt:spar`** with the topic frame. **Pipeline-mode invocation MUST carry `--timeout-ms 120000`** (2-min Bash-rung fast-fail per spec §4.6 "Pipeline-mode timeout rationale" — pipeline gates run under a tighter budget than manual `apt:spar`). **NO `--rounds` flag** (per FRAMEWORK-BUG-038 fix — pipeline gates always defer to the skill default; passing `--rounds 1` would re-introduce the Round 1 unilateral-terminate bug). When `spar.partner` is set in merged config, append `--with <partner>`; when null, omit `--with` and let `apt:spar` use the host-default-partner mapping in `apt-spar/SKILL.md` §3.
175
+
176
+ ```
177
+ /apt:spar --timeout-ms 120000 [--with <partner>] <topic-frame-from-spec.md-or-task-description>
178
+ ```
179
+
180
+ **Pipeline-mode timeout rationale.** `apt-spar/SKILL.md:198` "Timeout calibration" notes that modern partner CLIs commonly spend multiple minutes doing real Read/Grep/Bash investigation, justifying the manual-mode 5-min Bash-rung / 15-min MCP-rung defaults. Pipeline-mode partner queries are NARROWER than manual: the gate prompt is a focused 1-2-sentence frame on a specific just-completed stage, not open-ended brainstorming. 2 minutes is adequate for that narrower scope, and `partner-unreachable` (the rung ladder exhausts within 2 min) skips the gate cleanly without blocking the pipeline. Worst-case DEEP wall budget: 2 gates × 3 rounds × 2 min = 12 min (vs ~90 min before this clamp under MCP-rung partner degradation). MCP-rung tightening is out of scope per Open Q5 — see spec §4.6.
181
+
182
+ **Consent-on but partner-null inline prompt.** If `spar.enabled: true && spar.partner === null` (consent given but no partner detected at install — graceful skip path), prompt the user inline before dispatch (the inline prompt's dispatch ALSO carries `--timeout-ms 120000` and NO `--rounds` flag):
183
+
184
+ ```
185
+ [apt:run] Sparring auto-fire is enabled but no partner was set at install. Pick one now ([1] codex / [2] claude / [3] gemini / [s] skip this gate):
186
+ ```
187
+
188
+ Map response → invoke `/apt:spar --timeout-ms 120000 --with <id> <topic-frame>` (no `--rounds`), or skip the gate. Do NOT write the choice back to `config.local.json` automatically — the user re-runs `/apt:setup` → Pipeline → Sparring Auto-Fire to persist.
189
+
190
+ **After spar returns to natural convergence:**
191
+
192
+ 1. Read the spar termination headline (printed inline by `apt:spar/SKILL.md` §9 Layer 1).
193
+ 2. Capture the Layer 2 file path from the `Full detail:` line of the headline (e.g. `.aperant/spar/<slug>-<YYYYMMDD-HHMMSS>.md`).
194
+ 3. Append both the one-line headline summary AND the Layer 2 file path into the executor's spawn context for §4 (the executor reads spar findings before subtask 1).
195
+
196
+ If the gate emits `partner-unreachable` (rung ladder exhausted within timeout), skip the gate cleanly and continue to §4 — do NOT fail the pipeline.
197
+
140
198
  ## 4. Stage 2 — Execute (apt:execute)
141
199
 
142
200
  Branch on `PHASE_MODE`:
@@ -168,6 +226,34 @@ Execute the apt:execute workflow inline:
168
226
 
169
227
  **Output:** All subtasks completed, build-progress.json updated
170
228
 
229
+ **Spar hint surface (FRAMEWORK-RFC-001).** If merged-config `spar.hint === true` AND `spar.enabled === false`, print:
230
+ ```
231
+ [apt] execute complete. /apt:spar available before next stage. (skill, not auto-fire)
232
+ ```
233
+ Skip on `spar.enabled === true` (the gate handler in §4b already fires).
234
+
235
+ ## 4b. Stage 2.5 — Spar Gate (execute)
236
+
237
+ **FRAMEWORK-RFC-001 — auto-fire `/apt:spar` after the execute stage on DEEP (or explicit user opt-in).**
238
+
239
+ Same resolution logic as §3b, but the gate name is `"execute"` and the topic frame is composed from `build-progress.json` (1–2 sentences summarizing the diff that just landed, e.g. "N subtasks completed against the M-file plan; the largest change touched <path>"). If `build-progress.json` is missing or empty, fall back to the task description (Open Q4 graceful fallback).
240
+
241
+ **Track gate:** if track is `QUICK`, skip this section entirely (Fast Path Guarantee). Default gates from merged-config `spar.enabled === true` only include `"execute"` on DEEP. STANDARD does NOT enter this block by default; DEEP does. User-passed `--spar-gates plan,execute` opts STANDARD into this block too (per-invocation precedence).
242
+
243
+ **Gate check:** if `"execute"` is not in the resolved gate list, skip this section.
244
+
245
+ If `"execute"` is in the resolved gate list, dispatch as in §3b — same pipeline-mode budget:
246
+
247
+ ```
248
+ /apt:spar --timeout-ms 120000 [--with <partner>] <topic-frame-from-build-progress.json>
249
+ ```
250
+
251
+ **NO `--rounds` flag** (per FRAMEWORK-BUG-038 — pipeline always defers to skill default). Same `--timeout-ms 120000` 2-min Bash-rung fast-fail as §3b. Same inline-prompt path for the `enabled: true && partner === null` graceful-skip case (the inline-prompt dispatch ALSO carries `--timeout-ms 120000`).
252
+
253
+ After spar returns, parse the termination headline + Layer 2 path and append both into the verifier's spawn context for §5 (the verifier reads execute-gate spar findings alongside its de-anchored re-read).
254
+
255
+ `partner-unreachable` skips the gate cleanly — pipeline continues to §5.
256
+
171
257
  ## 5. Stage 3 — Verify (apt:verify)
172
258
 
173
259
  **De-anchored re-read (PHASE_MODE=sequential only — roundtable 2026-05-14 R2):**
@@ -183,6 +269,8 @@ This block exists because the roundtable's STANDARD-track de-anchoring relies on
183
269
 
184
270
  Sub-agents and agent-team modes skip this block — they get fresh-context isolation by spawning, which makes the de-anchored re-read redundant.
185
271
 
272
+ **Spar findings context (FRAMEWORK-RFC-001).** If §3b or §4b dispatched `/apt:spar`, the verifier MUST read the Layer 2 file (`.aperant/spar/<slug>-<YYYYMMDD-HHMMSS>.md`) before scoring — both gate files when DEEP fired both gates. Spar findings flagged as `parallel call-outs` in the Layer 2 file may require `qa_signoff.json` `notes` entries even when not blocking. The headline summary already lives in the verifier's spawn context (appended by §3b / §4b); the Layer 2 read is the load-bearing detail loop.
273
+
186
274
  Execute the apt:verify workflow inline:
187
275
 
188
276
  1. Check all subtasks completed
@@ -200,6 +288,12 @@ Execute the apt:verify workflow inline:
200
288
 
201
289
  **Output:** qa_signoff.json with status
202
290
 
291
+ **Spar hint surface (FRAMEWORK-RFC-001).** If merged-config `spar.hint === true` AND `spar.enabled === false`, print:
292
+ ```
293
+ [apt] verify complete. /apt:spar available before next stage. (skill, not auto-fire)
294
+ ```
295
+ Skip on `spar.enabled === true` (no verify-stage gate exists in v2 — see spec §8 Out of Scope; this nudge surfaces /apt:spar as a manual option only).
296
+
203
297
  If `qa_signoff.json` status is `"rejected"` after max iterations:
204
298
  ```
205
299
  Verification failed after {n} iterations. Issues remain:
@@ -236,28 +330,32 @@ Execute the apt:review workflow inline (see `apt-review/SKILL.md`):
236
330
 
237
331
  **Output:** review.json (written to task directory)
238
332
 
333
+ **Spar hint surface (FRAMEWORK-RFC-001).** If merged-config `spar.hint === true` AND `spar.enabled === false`, print:
334
+ ```
335
+ [apt] review complete. /apt:spar available before next stage. (skill, not auto-fire)
336
+ ```
337
+ Skip on `spar.enabled === true` (no pre-ship gate exists in v2 — see spec §8 Out of Scope).
338
+
239
339
  **This is the task review, not the PR review.** It runs inline without sub-agents. For heavy multi-agent PR review, use `/apt:pr-review` separately.
240
340
 
241
341
  ## 7. Pipeline Summary
242
342
 
243
- ```
244
- Pipeline Complete: {task description}
343
+ Render the phase rail panel verbatim — branch glyphs `┌─ │ └─`, status glyphs `✓` (done) / `●` (active) / `○` (pending/skipped), inline metrics per row drawn from the artifacts written across §3–§6:
245
344
 
345
+ ```
346
+ [APT] Pipeline Complete: {task description}
347
+ ┌─ Phase rail: {short task name} ───────────────────
348
+ │ Phase 1 Plan ✓ {n} subtasks
349
+ │ Phase 2 Execute ✓ {completed}/{total} subtasks, {k} commits
350
+ │ Phase 3 Verify ✓ {qa_status} {completeness}/{correctness}/{quality}/{coverage}
351
+ │ Phase 4 Review ✓ {assessment} {scores}, {findings_count} findings ({fixed} fixed)
352
+ └───────────────────────────────────────────────────
246
353
  Branch: apt/{sanitized-task-name}
247
- Stages:
248
- 1. Plan: spec.md + implementation_plan.json ({n} subtasks)
249
- 2. Execute: {completed}/{total} subtasks completed
250
- 3. Verify: {qa_status} (scores: {completeness}/{correctness}/{quality}/{coverage})
251
- 4. Review: {assessment} ({findings} found, {fixed} fixed, {remaining} remaining)
252
-
253
- Artifacts:
254
- - spec.md
255
- - implementation_plan.json
256
- - build-progress.json
257
- - qa_signoff.json
258
- - review.json
354
+ Artifacts: spec.md · implementation_plan.json · build-progress.json · qa_signoff.json · review.json
259
355
  ```
260
356
 
357
+ Substitute live values from the on-disk artifacts: `build-progress.json.completed_subtasks.length` for the commits count, `qa_signoff.json.verdict` + `scores` for verify, `review.json.assessment` + `scores` + `findings.length` for review. Use `●` for a stage still in flight (e.g. verify rejected mid-rerun), `○` only for a stage skipped entirely. The `[APT] Pipeline Complete` header above the panel is the backward-compat marker for external log-grep tooling — keep it.
358
+
261
359
  **Always end with a "What's Next" recommendation:**
262
360
 
263
361
  ```