@khoavu882/doflow 2.0.0-beta.5 → 2.0.1

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 (494) hide show
  1. package/README.md +16 -16
  2. package/bin/doflow.js +22 -12
  3. package/core/.antigravity-plugin/plugin.json +1 -2
  4. package/core/.claude-plugin/plugin.json +1 -1
  5. package/core/.codex-plugin/plugin.json +1 -1
  6. package/core/.plugin/plugin.json +1 -1
  7. package/core/harnesses/claude/hooks/lib.sh +43 -24
  8. package/core/harnesses/claude/hooks/mcp-tool-guard.sh +4 -1
  9. package/core/harnesses/claude/hooks/permission-audit.sh +3 -0
  10. package/core/harnesses/claude/hooks/post-compact.sh +35 -32
  11. package/core/harnesses/claude/hooks/post-edit-lint.sh +2 -0
  12. package/core/harnesses/claude/hooks/post-shell-observe.sh +48 -0
  13. package/core/harnesses/claude/hooks/post-tool-failure.sh +3 -0
  14. package/core/harnesses/claude/hooks/pre-compact.sh +23 -27
  15. package/core/harnesses/claude/hooks/pre-implement-gate.sh +4 -1
  16. package/core/harnesses/claude/hooks/session-end.sh +23 -10
  17. package/core/harnesses/claude/hooks/skill-config-audit.sh +3 -0
  18. package/core/harnesses/claude/settings/settings.json +26 -9
  19. package/core/harnesses/claude/statusline/doflow-statusline.sh +1 -0
  20. package/core/harnesses/codex/agents/core-implementer.toml +1 -0
  21. package/core/harnesses/codex/agents/delivery-lead.toml +10 -0
  22. package/core/harnesses/codex/agents/quality-guardian.toml +1 -1
  23. package/core/harnesses/codex/agents/research-writer.toml +1 -1
  24. package/core/harnesses/codex/agents/reviewer.toml +10 -0
  25. package/core/harnesses/codex/agents/spec-analyst.toml +1 -1
  26. package/core/harnesses/codex/agents/system-architect.toml +1 -1
  27. package/core/harnesses/codex/hooks/hooks.json +0 -10
  28. package/core/harnesses/codex/hooks/lib.sh +44 -25
  29. package/core/harnesses/codex/hooks/mcp-tool-guard.sh +4 -1
  30. package/core/harnesses/codex/hooks/post-edit-lint.impl.sh +3 -1
  31. package/core/harnesses/codex/hooks/pre-compact.impl.sh +29 -26
  32. package/core/harnesses/codex/hooks/pre-implement-gate.sh +4 -1
  33. package/core/harnesses/codex/hooks/session-end.impl.sh +23 -10
  34. package/core/harnesses/codex/hooks/subagent-audit.sh +1 -0
  35. package/core/harnesses/copilot/hooks/doflow-lib.sh +94 -0
  36. package/core/harnesses/copilot/hooks/doflow-mcp-tool-guard.sh +9 -0
  37. package/core/harnesses/copilot/hooks/doflow-pre-implement-gate.sh +9 -0
  38. package/core/harnesses/copilot/hooks/doflow-session-start.sh +9 -0
  39. package/core/harnesses/copilot/hooks/doflow-stop-check.sh +9 -0
  40. package/core/harnesses/copilot/hooks/doflow-subagent-start.sh +9 -0
  41. package/core/harnesses/copilot/hooks/doflow-subagent-stop.sh +9 -0
  42. package/core/harnesses/copilot/hooks/doflow.json +51 -0
  43. package/core/harnesses/kiro/agents/doflow.json +1 -11
  44. package/core/harnesses/kiro/hooks/doflow.json +0 -10
  45. package/core/harnesses/kiro/hooks/lib.sh +26 -6
  46. package/core/harnesses/kiro/hooks/mcp-tool-guard.sh +8 -3
  47. package/core/harnesses/kiro/hooks/pre-implement-gate.sh +8 -3
  48. package/core/harnesses/kiro/hooks/session-start.sh +1 -0
  49. package/core/harnesses/kiro/hooks/stop-check.sh +1 -0
  50. package/core/harnesses/pi/extensions/doflow-guard.js +11 -2
  51. package/core/harnesses/shared/hooks/ENVELOPE_MIGRATION.md +1 -2
  52. package/core/harnesses/shared/hooks/adapters/antigravity.js +1 -1
  53. package/core/harnesses/shared/hooks/bridge/bridge.sh +126 -23
  54. package/core/harnesses/shared/hooks/bridge/envelope.jq +87 -18
  55. package/core/harnesses/shared/hooks/bridge/observe-model.sh +75 -0
  56. package/core/harnesses/shared/hooks/bridge/respond.sh +16 -2
  57. package/core/harnesses/shared/hooks/policies/capture-failure.sh +49 -16
  58. package/core/harnesses/shared/hooks/policies/compact-text.sh +46 -0
  59. package/core/harnesses/shared/hooks/policies/contract.sh +3 -0
  60. package/core/harnesses/shared/hooks/policies/deny-json.sh +20 -7
  61. package/core/harnesses/shared/hooks/policies/emission-rules.sh +37 -0
  62. package/core/harnesses/shared/hooks/policies/emission.jq +209 -0
  63. package/core/harnesses/shared/hooks/policies/emission.sh +383 -0
  64. package/core/harnesses/shared/hooks/policies/identity.sh +177 -0
  65. package/core/harnesses/shared/hooks/policies/lib.sh +63 -40
  66. package/core/harnesses/shared/hooks/policies/mcp-policy.conf +1 -1
  67. package/core/harnesses/shared/hooks/policies/mcp-tool-guard.sh +7 -8
  68. package/core/harnesses/shared/hooks/policies/pre-implementation-gate.sh +132 -57
  69. package/core/harnesses/shared/hooks/policies/session-context.sh +30 -1
  70. package/core/harnesses/shared/hooks/policies/stop-check.sh +27 -15
  71. package/core/harnesses/shared/hooks/policies/subagent-audit.sh +6 -3
  72. package/core/harnesses/shared/hooks/policies/summary-store.sh +347 -0
  73. package/core/harnesses/shared/hooks/policies/user-prompt-submit.sh +60 -155
  74. package/core/harnesses/shared/hooks/stream-hook-runner.js +58 -20
  75. package/core/harnesses/shared/locator/doflow-run +2 -3
  76. package/core/registry/advice.json +3 -3
  77. package/core/registry/assets.json +55 -82
  78. package/core/registry/capabilities.json +12 -0
  79. package/core/registry/contracts.json +58 -31
  80. package/core/registry/contribution-points.json +35 -0
  81. package/core/registry/gates.json +32 -0
  82. package/core/registry/guidance-caps.json +40 -0
  83. package/core/registry/harnesses.json +1445 -366
  84. package/core/registry/intake.json +53 -0
  85. package/core/registry/lifecycle.json +599 -996
  86. package/core/registry/mcp.json +5 -1
  87. package/core/registry/models.json +7 -1
  88. package/core/registry/package-templates/README.md +19 -0
  89. package/core/registry/package-templates/agent/files/agent.md +9 -0
  90. package/core/registry/package-templates/agent/template.json +4 -0
  91. package/core/registry/package-templates/capability-provider/files/provider.json +9 -0
  92. package/core/registry/package-templates/capability-provider/template.json +11 -0
  93. package/core/registry/package-templates/debate-preset/files/preset.json +26 -0
  94. package/core/registry/package-templates/debate-preset/template.json +4 -0
  95. package/core/registry/package-templates/intake-category/files/category.json +8 -0
  96. package/core/registry/package-templates/intake-category/template.json +4 -0
  97. package/core/registry/package-templates/review-preset/files/preset.json +30 -0
  98. package/core/registry/package-templates/review-preset/template.json +4 -0
  99. package/core/registry/package-templates/skill/files/SKILL.md +8 -0
  100. package/core/registry/package-templates/skill/template.json +4 -0
  101. package/core/registry/package-templates/worker/files/worker.json +92 -0
  102. package/core/registry/package-templates/worker/template.json +11 -0
  103. package/core/registry/packages/doflow/doflow-package.json +15 -0
  104. package/core/registry/packages/doflow/presets/debate-3.json +26 -0
  105. package/core/registry/protocols.json +61 -0
  106. package/core/registry/routes.json +17 -0
  107. package/core/registry/rules.json +431 -0
  108. package/core/registry/settings.json +272 -0
  109. package/core/registry/storage.json +687 -31
  110. package/core/registry/telemetry.json +236 -0
  111. package/core/registry/transcripts.json +142 -0
  112. package/core/registry/verification.json +76 -6
  113. package/core/registry/workflows.json +55 -0
  114. package/core/shared/agent-specs/core-implementer.md +3 -0
  115. package/core/shared/agent-specs/delivery-lead.md +68 -0
  116. package/core/shared/agent-specs/quality-guardian.md +5 -1
  117. package/core/shared/agent-specs/research-writer.md +10 -3
  118. package/core/shared/agent-specs/reviewer.md +53 -0
  119. package/core/shared/agent-specs/spec-analyst.md +5 -6
  120. package/core/shared/agent-specs/system-architect.md +5 -1
  121. package/core/shared/guidance/DOFLOW_CORE.md +1 -5
  122. package/core/shared/guidance/modes/MODE_DeepResearch.md +1 -1
  123. package/core/shared/guidance/modes/MODE_Orchestration.md +4 -3
  124. package/core/shared/guidance/modes/MODE_Task_Management.md +14 -14
  125. package/core/shared/guidance/pointers/codex.md +1 -4
  126. package/core/shared/guidance/references/ARTIFACT_FORMAT.md +30 -16
  127. package/core/shared/guidance/references/ARTIFACT_VOICE.md +3 -2
  128. package/core/shared/guidance/references/CONSTITUTION_BASE.md +17 -15
  129. package/core/shared/guidance/references/DIAGRAM_GUIDE.md +1 -1
  130. package/core/shared/guidance/references/DOFLOW_CHAIN.md +17 -19
  131. package/core/shared/guidance/references/EVIDENCE_LEDGER.md +7 -8
  132. package/core/shared/guidance/references/MODEL_SELECTION.md +5 -3
  133. package/core/shared/guidance/references/ORCHESTRATION.md +3 -2
  134. package/core/shared/guidance/references/WORKFLOW_HANDOFF.md +19 -1
  135. package/core/shared/guidance/rules/RULES.md +45 -0
  136. package/core/shared/scripts/doflow/bash/do-args.sh +37 -0
  137. package/core/shared/scripts/doflow/bash/do-exec-paths.sh +4 -0
  138. package/core/shared/scripts/doflow/bash/do-git-state.sh +15 -4
  139. package/core/shared/scripts/doflow/bash/do-parallel-check.sh +4 -0
  140. package/core/shared/scripts/doflow/bash/do-paths.sh +40 -2
  141. package/core/shared/scripts/doflow/bash/do-prereqs.sh +2 -1
  142. package/core/shared/scripts/doflow/bash/do-review-package.sh +4 -0
  143. package/core/shared/scripts/doflow/bash/do-task-brief.sh +58 -16
  144. package/core/shared/scripts/doflow/bash/render-audit.sh +26 -2
  145. package/core/shared/scripts/doflow/bash/render-diagrams.sh +1 -0
  146. package/core/shared/scripts/doflow/bash/render-puml.sh +2 -1
  147. package/core/shared/scripts/doflow/bash/validate-artifacts.sh +49 -5
  148. package/core/shared/scripts/doflow/bin/doflow-run +152 -34
  149. package/core/shared/skills/do/SKILL.md +14 -12
  150. package/core/shared/skills/do/references/advice_calls.md +26 -0
  151. package/core/shared/skills/do/references/pm_routing.md +1 -2
  152. package/core/shared/skills/do/references/program_mode.md +31 -0
  153. package/core/shared/skills/do-brainstorm/SKILL.md +45 -97
  154. package/core/shared/skills/do-brainstorm/references/handoff_branches.md +36 -0
  155. package/core/shared/skills/do-brainstorm/references/intent_seed.md +21 -0
  156. package/core/shared/skills/do-brainstorm/references/round_log.md +17 -0
  157. package/core/shared/skills/do-code-review/SKILL.md +48 -148
  158. package/core/shared/skills/do-code-review/content-types/markdown.md +24 -2
  159. package/core/shared/skills/do-code-review/references/tools.md +90 -0
  160. package/core/shared/skills/do-code-review/scripts/doc_quality_checker.py +549 -7
  161. package/core/shared/skills/do-design/SKILL.md +23 -20
  162. package/core/shared/skills/do-diagnose/SKILL.md +18 -6
  163. package/core/shared/skills/do-document/SKILL.md +12 -1
  164. package/core/shared/skills/do-document/references/deep_research.md +1 -2
  165. package/core/shared/skills/do-document/references/embedded-research.md +19 -7
  166. package/core/shared/skills/do-document/references/implementation-flow.md +5 -6
  167. package/core/shared/skills/do-execute-plan/SKILL.md +19 -60
  168. package/core/shared/skills/do-execute-plan/references/handoff_record.md +7 -2
  169. package/core/shared/skills/do-execute-plan/references/parallel_dispatch.md +13 -0
  170. package/core/shared/skills/do-execute-plan/references/readiness_gate.md +26 -1
  171. package/core/shared/skills/do-execute-plan/references/run_position.md +16 -2
  172. package/core/shared/skills/do-execute-plan/references/scaffold.md +17 -9
  173. package/core/shared/skills/do-execute-plan/references/state_checkpoint.md +11 -0
  174. package/core/shared/skills/do-execute-plan/references/task_attempts.md +78 -24
  175. package/core/shared/skills/do-flow/SKILL.md +10 -11
  176. package/core/shared/skills/do-flow/references/task_classes.md +5 -5
  177. package/core/shared/skills/do-git/SKILL.md +4 -0
  178. package/core/shared/skills/do-implement/SKILL.md +13 -14
  179. package/core/shared/skills/do-plan/SKILL.md +34 -20
  180. package/core/shared/skills/do-test/SKILL.md +7 -4
  181. package/core/shared/templates/doflow/constitution-template.md +9 -3
  182. package/core/shared/templates/doflow/data-model-template.md +1 -1
  183. package/core/shared/templates/doflow/design-template.md +113 -16
  184. package/core/shared/templates/doflow/plan-template.md +11 -10
  185. package/core/shared/templates/doflow/question-log-template.md +14 -2
  186. package/core/shared/templates/doflow/requirement-template.md +1 -1
  187. package/core/shared/workflows/do-flow-chain.md +2 -0
  188. package/core/worker-evidence/antigravity/checks.json +14 -0
  189. package/core/worker-evidence/codex/2026-10-18-cli-check.json +107 -0
  190. package/core/worker-evidence/codex/2026-10-18-live-run-edit.json +73 -0
  191. package/core/worker-evidence/codex/2026-10-18-live-run-read-only.json +62 -0
  192. package/core/worker-evidence/codex/2026-10-24-cli-check.json +126 -0
  193. package/core/worker-evidence/codex/checks.json +38 -0
  194. package/package.json +10 -6
  195. package/src/adapters/antigravity/index.js +143 -66
  196. package/src/adapters/claude/index.js +46 -5
  197. package/src/adapters/codex/agents.js +25 -15
  198. package/src/adapters/codex/hooks.js +39 -3
  199. package/src/adapters/codex/index.js +61 -13
  200. package/src/adapters/codex/native-projection.js +6 -2
  201. package/src/adapters/copilot/index.js +58 -23
  202. package/src/adapters/copy-tree.js +291 -46
  203. package/src/adapters/guidance-manifest.js +71 -0
  204. package/src/adapters/guidance-pointer.js +19 -0
  205. package/src/adapters/hook-commands.js +6 -10
  206. package/src/adapters/index.js +1 -0
  207. package/src/adapters/kiro/index.js +23 -12
  208. package/src/adapters/opencode/index.js +8 -8
  209. package/src/adapters/pi/hooks.js +2 -1
  210. package/src/adapters/pi/index.js +14 -7
  211. package/src/adapters/resolve-source.js +26 -2
  212. package/src/cli/commands/install.js +2 -1
  213. package/src/cli/commands/reconcile.js +53 -9
  214. package/src/cli/commands/remove.js +2 -2
  215. package/src/cli/commands/rollback.js +6 -3
  216. package/src/cli/commands/self-update.js +18 -9
  217. package/src/cli/commands/status.js +22 -3
  218. package/src/cli/commands/ui.js +99 -0
  219. package/src/cli/commands/update.js +2 -1
  220. package/src/cli/index.js +337 -32
  221. package/src/cli/runtime-commands.js +220 -60
  222. package/src/cli/shared.js +0 -2
  223. package/src/helper/git.js +1 -1
  224. package/src/helper/guardrails.js +1 -1
  225. package/src/helper/marker-merge.js +31 -13
  226. package/src/helper/package-ids.js +37 -0
  227. package/src/helper/semver.js +94 -0
  228. package/src/install/backup.js +105 -15
  229. package/src/install/context.js +1 -1
  230. package/src/install/targets.js +31 -16
  231. package/src/lifecycle/coverage.js +4 -16
  232. package/src/lifecycle/hook-tier.js +160 -0
  233. package/src/lifecycle/index.js +412 -78
  234. package/src/lifecycle/retired-harnesses.js +318 -0
  235. package/src/lifecycle/view.js +35 -15
  236. package/src/registry/index.js +551 -26
  237. package/src/registry/worker-ids.js +45 -0
  238. package/src/release/build-package.js +0 -3
  239. package/src/release/docs-blocks.js +472 -0
  240. package/src/release/preflight.js +425 -0
  241. package/src/release/rehearse.js +401 -0
  242. package/src/release/release-workflow.js +733 -0
  243. package/src/release/sync-plugin-versions.js +43 -7
  244. package/src/runtime/advice/bench-gate.js +25 -0
  245. package/src/runtime/advice/cli.js +59 -16
  246. package/src/runtime/advice/client.js +32 -9
  247. package/src/runtime/advice/config.js +98 -133
  248. package/src/runtime/advice/doctor.js +1 -1
  249. package/src/runtime/advice/elevation.js +97 -0
  250. package/src/runtime/advice/endpoint-guard.js +9 -3
  251. package/src/runtime/advice/mode.js +37 -0
  252. package/src/runtime/advice/record.js +18 -5
  253. package/src/runtime/advice/registry.js +4 -1
  254. package/src/runtime/advice/shadow-config.js +229 -0
  255. package/src/runtime/advice/shadow-dispatcher.js +276 -0
  256. package/src/runtime/brief-rules.js +81 -0
  257. package/src/runtime/brief-tools.js +111 -34
  258. package/src/runtime/candidate.js +20 -11
  259. package/src/runtime/capabilities/executor.js +450 -0
  260. package/src/runtime/capabilities/loopback.js +41 -0
  261. package/src/runtime/capabilities/sanitizer.js +88 -0
  262. package/src/runtime/capability-router.js +135 -3
  263. package/src/runtime/checkouts.js +73 -11
  264. package/src/runtime/claims.js +13 -7
  265. package/src/runtime/cli.js +196 -19
  266. package/src/runtime/config-home.js +42 -0
  267. package/src/runtime/context/arbitrate.js +767 -0
  268. package/src/runtime/context/delivery-store.js +4 -6
  269. package/src/runtime/context/emission-rules.js +118 -0
  270. package/src/runtime/context/identity.js +227 -0
  271. package/src/runtime/context/pointer.js +67 -12
  272. package/src/runtime/context/primary-command.js +117 -0
  273. package/src/runtime/context/primary.js +344 -0
  274. package/src/runtime/context/summary-store.js +655 -0
  275. package/src/runtime/context-pack.js +158 -79
  276. package/src/runtime/decision-register.js +13 -4
  277. package/src/runtime/dispatch/admission.js +392 -0
  278. package/src/runtime/dispatch/attempt-end.js +274 -0
  279. package/src/runtime/dispatch/command.js +628 -0
  280. package/src/runtime/dispatch/controls.js +904 -0
  281. package/src/runtime/dispatch/envelope.js +276 -0
  282. package/src/runtime/dispatch/grants.js +310 -0
  283. package/src/runtime/dispatch/integrate.js +617 -0
  284. package/src/runtime/dispatch/loop.js +1835 -0
  285. package/src/runtime/dispatch/store.js +352 -0
  286. package/src/runtime/dispatch/verify-run.js +201 -0
  287. package/src/runtime/evidence-ledger.js +52 -7
  288. package/src/runtime/failure/capture.js +3 -1
  289. package/src/runtime/failure/cli.js +25 -9
  290. package/src/runtime/failure/home.js +57 -30
  291. package/src/runtime/failure/store.js +7 -2
  292. package/src/runtime/feature-pointer.js +174 -0
  293. package/src/runtime/feature-resolve.js +13 -2
  294. package/src/runtime/fleet/command.js +77 -0
  295. package/src/runtime/fleet/projects.js +178 -0
  296. package/src/runtime/fleet/tree.js +383 -0
  297. package/src/runtime/freshness.js +33 -3
  298. package/src/runtime/git-memo.js +46 -0
  299. package/src/runtime/guidance/ablation.js +427 -0
  300. package/src/runtime/health.js +624 -18
  301. package/src/runtime/history-compactor.js +13 -3
  302. package/src/runtime/implementation-gate.js +281 -26
  303. package/src/runtime/intake/engine.js +677 -0
  304. package/src/runtime/intake/index.js +136 -0
  305. package/src/runtime/intake/manifest.js +140 -0
  306. package/src/runtime/intake/taxonomy.js +206 -0
  307. package/src/runtime/inventory/coverage.js +1 -1
  308. package/src/runtime/inventory/index.js +1 -1
  309. package/src/runtime/inventory/precedence.js +2 -2
  310. package/src/runtime/inventory/siblings.js +6 -4
  311. package/src/runtime/knowledge/code-corpus.js +277 -0
  312. package/src/runtime/knowledge/code-lexical.js +130 -0
  313. package/src/runtime/knowledge/code-retrieval.js +307 -0
  314. package/src/runtime/knowledge/code-validation.js +106 -0
  315. package/src/runtime/knowledge/gp3-gate.js +74 -0
  316. package/src/runtime/knowledge/graph-adapter.js +288 -0
  317. package/src/runtime/knowledge/graph-fallback.js +394 -0
  318. package/src/runtime/knowledge/hybrid.js +136 -8
  319. package/src/runtime/knowledge/retrieval.js +34 -1
  320. package/src/runtime/knowledge/rtk-compress.js +77 -0
  321. package/src/runtime/knowledge/semble-bridge.py +106 -0
  322. package/src/runtime/knowledge/semble-lifecycle.js +114 -0
  323. package/src/runtime/knowledge/semble-provider.js +365 -0
  324. package/src/runtime/lifecycle/cli.js +88 -10
  325. package/src/runtime/lifecycle/event-store.js +8 -6
  326. package/src/runtime/lifecycle/followup.js +38 -7
  327. package/src/runtime/lifecycle/overview.js +26 -2
  328. package/src/runtime/lifecycle/report-store.js +8 -10
  329. package/src/runtime/lifecycle/retention.js +95 -31
  330. package/src/runtime/lifecycle/root.js +9 -1
  331. package/src/runtime/lifecycle/status.js +34 -17
  332. package/src/runtime/lifecycle/store-upkeep.js +56 -7
  333. package/src/runtime/mask.js +134 -7
  334. package/src/runtime/mcp-consultations.js +40 -6
  335. package/src/runtime/model-router.js +79 -7
  336. package/src/runtime/models/catalogue.js +191 -0
  337. package/src/runtime/models/command.js +153 -0
  338. package/src/runtime/off-words.js +12 -0
  339. package/src/runtime/outcome.js +2 -2
  340. package/src/runtime/packages/command.js +1009 -0
  341. package/src/runtime/packages/contributions.js +116 -0
  342. package/src/runtime/packages/digest.js +132 -0
  343. package/src/runtime/packages/fetch.js +182 -0
  344. package/src/runtime/packages/grants.js +192 -0
  345. package/src/runtime/packages/index-file.js +134 -0
  346. package/src/runtime/packages/instruction.js +90 -0
  347. package/src/runtime/packages/manifest.js +331 -0
  348. package/src/runtime/packages/points.js +487 -0
  349. package/src/runtime/packages/programs.js +216 -0
  350. package/src/runtime/packages/scaffold.js +277 -0
  351. package/src/runtime/packages/source.js +90 -0
  352. package/src/runtime/packages/state.js +164 -0
  353. package/src/runtime/packages/store.js +449 -0
  354. package/src/runtime/packages/tar.js +106 -0
  355. package/src/runtime/packages/view.js +406 -0
  356. package/src/runtime/plan-check.js +59 -0
  357. package/src/runtime/plan-content.js +324 -0
  358. package/src/runtime/policy-init.js +118 -0
  359. package/src/runtime/profiles/doctor.js +96 -0
  360. package/src/runtime/profiles/resolve.js +244 -0
  361. package/src/runtime/profiles/rollback.js +254 -0
  362. package/src/runtime/profiles/sampler.js +41 -0
  363. package/src/runtime/readiness-record.js +16 -11
  364. package/src/runtime/readiness.js +46 -5
  365. package/src/runtime/research-request.js +50 -25
  366. package/src/runtime/retrieval-plan.js +10 -30
  367. package/src/runtime/retrieval-record.js +75 -5
  368. package/src/runtime/review/command.js +246 -0
  369. package/src/runtime/review/dominance.js +68 -0
  370. package/src/runtime/review/findings.js +434 -0
  371. package/src/runtime/review/identity.js +255 -0
  372. package/src/runtime/review/protocol-command.js +109 -0
  373. package/src/runtime/review/protocols.js +405 -0
  374. package/src/runtime/review/resolve-protocol.js +302 -0
  375. package/src/runtime/review/start.js +530 -0
  376. package/src/runtime/roadmap/attendance.js +137 -0
  377. package/src/runtime/roadmap/facts.js +479 -0
  378. package/src/runtime/roadmap/gates.js +273 -0
  379. package/src/runtime/roadmap/loop.js +1719 -0
  380. package/src/runtime/roadmap/merge.js +390 -0
  381. package/src/runtime/roadmap/rows.js +1122 -0
  382. package/src/runtime/roadmap/seed.js +1063 -0
  383. package/src/runtime/roadmap/worktree-cleanup.js +147 -0
  384. package/src/runtime/rules-report.js +336 -0
  385. package/src/runtime/scaffold/artifacts.js +60 -9
  386. package/src/runtime/scaffold/generate.js +21 -9
  387. package/src/runtime/settings/autopilot.js +106 -0
  388. package/src/runtime/settings/cli.js +280 -0
  389. package/src/runtime/settings/config-write.js +314 -0
  390. package/src/runtime/settings/files.js +271 -0
  391. package/src/runtime/settings/legacy.js +154 -0
  392. package/src/runtime/settings/lexical.js +56 -0
  393. package/src/runtime/settings/prepared-run.js +269 -0
  394. package/src/runtime/settings/project-layers.js +118 -0
  395. package/src/runtime/settings/refs.js +288 -0
  396. package/src/runtime/settings/registry.js +553 -0
  397. package/src/runtime/settings/resolve.js +713 -0
  398. package/src/runtime/settings/shared.js +37 -0
  399. package/src/runtime/settings/worker-billing.js +107 -0
  400. package/src/runtime/settings/write.js +269 -0
  401. package/src/runtime/slot-command.js +78 -0
  402. package/src/runtime/slots.js +671 -0
  403. package/src/runtime/source-version.js +1 -0
  404. package/src/runtime/state-root.js +217 -0
  405. package/src/runtime/storage/cli.js +12 -5
  406. package/src/runtime/storage/engine.js +9 -2
  407. package/src/runtime/storage/registry.js +14 -1
  408. package/src/runtime/storage/roots.js +66 -16
  409. package/src/runtime/storage/rules.js +82 -10
  410. package/src/runtime/storage/upkeep.js +10 -2
  411. package/src/runtime/storage/work-status.js +245 -26
  412. package/src/runtime/task-attempts.js +589 -69
  413. package/src/runtime/task-classifier.js +85 -14
  414. package/src/runtime/task-graph.js +373 -0
  415. package/src/runtime/task-run.js +778 -0
  416. package/src/runtime/task-scope.js +176 -55
  417. package/src/runtime/task-sources.js +147 -0
  418. package/src/runtime/task-state.js +373 -64
  419. package/src/runtime/team/admission.js +301 -0
  420. package/src/runtime/team/envelope.js +324 -0
  421. package/src/runtime/team/review-guard.js +156 -0
  422. package/src/runtime/trace/analyze.js +427 -0
  423. package/src/runtime/trace/baseline.js +770 -0
  424. package/src/runtime/trace/ledger.js +63 -140
  425. package/src/runtime/trace/otlp-export.js +568 -0
  426. package/src/runtime/trace/otlp-map.js +481 -0
  427. package/src/runtime/trace/spans.js +745 -0
  428. package/src/runtime/trace/telemetry.js +225 -0
  429. package/src/runtime/trace/views.js +1 -0
  430. package/src/runtime/transcripts/command.js +98 -0
  431. package/src/runtime/transcripts/cursor.js +326 -0
  432. package/src/runtime/transcripts/read.js +126 -0
  433. package/src/runtime/transcripts/readers/claude-jsonl.js +74 -0
  434. package/src/runtime/transcripts/readers/codex-rollout.js +70 -0
  435. package/src/runtime/transcripts/readers/copilot-events.js +90 -0
  436. package/src/runtime/transcripts/readers/kiro-jsonl.js +77 -0
  437. package/src/runtime/transcripts/readers/pi-jsonl.js +59 -0
  438. package/src/runtime/transcripts/registry.js +161 -0
  439. package/src/runtime/transcripts/stats.js +161 -0
  440. package/src/runtime/verb-view.js +267 -0
  441. package/src/runtime/verification/check-key.js +628 -0
  442. package/src/runtime/verification/contract-runner.js +546 -11
  443. package/src/runtime/verification/engine.js +499 -54
  444. package/src/runtime/verification/impact.js +617 -0
  445. package/src/runtime/verification/inflight.js +205 -0
  446. package/src/runtime/verification/registry.js +176 -0
  447. package/src/runtime/verification/reuse.js +184 -0
  448. package/src/runtime/verification/telemetry-emit.js +254 -0
  449. package/src/runtime/verification/test-selection.js +67 -7
  450. package/src/runtime/worker/active.js +90 -0
  451. package/src/runtime/worker/cancel.js +222 -0
  452. package/src/runtime/worker/catalogue.js +122 -0
  453. package/src/runtime/worker/command.js +677 -0
  454. package/src/runtime/worker/evidence.js +288 -0
  455. package/src/runtime/worker/launch.js +256 -0
  456. package/src/runtime/worker/models.js +137 -0
  457. package/src/runtime/worker/parsers.js +218 -0
  458. package/src/runtime/worker/probes/index.js +706 -0
  459. package/src/runtime/worker/process-tree.js +415 -0
  460. package/src/runtime/worker/quota.js +43 -0
  461. package/src/runtime/worker/readiness.js +713 -0
  462. package/src/runtime/worker/run-store.js +166 -0
  463. package/src/runtime/worker/supervisor.js +541 -0
  464. package/src/runtime/worker/worktree-check.js +252 -0
  465. package/src/runtime/workflow-engine.js +5 -1
  466. package/src/runtime/workflow-orchestrator.js +610 -67
  467. package/src/runtime/worktree.js +149 -22
  468. package/src/state/index.js +1 -1
  469. package/src/state/lockfile.js +64 -10
  470. package/src/state/run-lock.js +1 -1
  471. package/types/node-commonjs.d.ts +106 -7
  472. package/core/harnesses/claude/hooks/pre-bash-guard.sh +0 -10
  473. package/core/harnesses/codex/hooks/pre-bash-guard.sh +0 -10
  474. package/core/harnesses/gemini/hooks/hooks.json +0 -77
  475. package/core/harnesses/gemini/hooks/lib.sh +0 -302
  476. package/core/harnesses/gemini/hooks/mcp-tool-guard.sh +0 -10
  477. package/core/harnesses/gemini/hooks/post-edit-lint.sh +0 -39
  478. package/core/harnesses/gemini/hooks/pre-bash-guard.sh +0 -10
  479. package/core/harnesses/gemini/hooks/pre-compact.sh +0 -38
  480. package/core/harnesses/gemini/hooks/pre-implement-gate.sh +0 -10
  481. package/core/harnesses/gemini/hooks/session-end.impl.sh +0 -89
  482. package/core/harnesses/gemini/hooks/session-end.sh +0 -5
  483. package/core/harnesses/gemini/hooks/session-start.sh +0 -7
  484. package/core/harnesses/gemini/settings/adapter-defaults.json +0 -4
  485. package/core/harnesses/kiro/hooks/pre-bash-guard.sh +0 -24
  486. package/core/harnesses/shared/hooks/policies/blocked-patterns.conf +0 -91
  487. package/core/harnesses/shared/hooks/policies/pre-bash-guard.sh +0 -378
  488. package/core/shared/guidance/FLAGS.md +0 -25
  489. package/core/shared/guidance/rules/RULE_01_SAFETY.md +0 -25
  490. package/core/shared/guidance/rules/RULE_02_WORKFLOW.md +0 -23
  491. package/core/shared/guidance/rules/RULE_03_QUALITY.md +0 -14
  492. package/core/shared/guidance/rules/RULE_04_QUESTIONS.md +0 -46
  493. package/src/adapters/gemini/hooks.js +0 -251
  494. package/src/adapters/gemini/index.js +0 -429
package/src/cli/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // doflow CLI — argument parsing, the installer command table, and dispatch.
3
3
  //
4
4
  // bin/doflow.js is only a forwarder into main() here. This module owns: parseArgs (verbatim from
5
- // the pre-extraction monolith), the ONE table mapping the nine installer command names to their
5
+ // the pre-extraction monolith), the ONE table mapping the ten installer command names to their
6
6
  // handlers under commands/, and the runtime verbs' forwarding via ./runtime-commands — whose
7
7
  // implementations stay one-per-module in src/runtime/. Adding an installer command means a new
8
8
  // file in src/cli/commands/, an entry in COMMANDS, and an edit to test/guards/cli-boundary.test.js,
@@ -12,10 +12,11 @@ const {
12
12
  handleCapabilitiesCommand, handleReadinessCommand, handleEvidenceCommand,
13
13
  EVIDENCE_SCORE_FIELDS, scoreFieldRefusal,
14
14
  } = require('../runtime/cli.js');
15
- const { pkg } = require('./shared.js');
15
+ const { pkg, REPO_ROOT } = require('./shared.js');
16
16
  const { VALID: VALID_TARGETS, DEFAULT_TARGETS } = require('../install/targets.js');
17
17
  const { dispatchRuntimeCommand } = require('./runtime-commands.js');
18
18
  const { usageError } = require('../runtime/cli-result.js');
19
+ const { printSafe } = require('../runtime/mask.js');
19
20
 
20
21
  const cmdInstall = require('./commands/install.js');
21
22
  const cmdUpdate = require('./commands/update.js');
@@ -26,6 +27,7 @@ const cmdTools = require('./commands/tools.js');
26
27
  const cmdListBackups = require('./commands/list-backups.js');
27
28
  const cmdRollback = require('./commands/rollback.js');
28
29
  const cmdSelfUpdate = require('./commands/self-update.js');
30
+ const cmdUi = require('./commands/ui.js');
29
31
 
30
32
  /** The installer command surface, written down once. The runtime verbs are dispatched separately
31
33
  * (see ./runtime-commands) because their namespace is owned by the doflow-run verb table. */
@@ -39,6 +41,8 @@ const COMMANDS = {
39
41
  'list-backups': cmdListBackups,
40
42
  rollback: cmdRollback,
41
43
  'self-update': cmdSelfUpdate,
44
+ // The launcher takes the core root as an argument so it loads nothing but three built-ins (092 IC-008).
45
+ ui: (o ) => cmdUi(o, REPO_ROOT),
42
46
  };
43
47
 
44
48
  /** "skip all backup protection" must be an explicit, deliberate choice, never a default combo. */
@@ -51,28 +55,62 @@ function assertNoBackupRequiresForce(o ) {
51
55
 
52
56
  function parseArgs(argv ) {
53
57
  const o = { cmd: null, positional: [], targets: [], mcp: null, dryRun: false, force: false, adopt: false,
58
+ otlpHttp: false,
54
59
  noBackup: false, prune: null, global: false, json: false, help: false, version: false,
55
60
  tools: null, action: 'status', days: null, slug: null,
56
61
  // Explicitly null, not absent. `handleReadinessCommand` declares defaults of `'feature'` and
57
62
  // `'default'`, and a JavaScript default parameter fires on `undefined` — so an *absent* key
58
63
  // silently reinstated exactly the identity defect readiness.ts fixed by failing closed.
59
- taskClass: null, taskId: null };
64
+ taskClass: null, taskId: null,
65
+ flagsGiven: [] };
60
66
  for (let i = 0; i < argv.length; i++) {
61
67
  const a = argv[i];
62
- switch (a) {
68
+ if (a.startsWith('-')) o.flagsGiven.push(a);
69
+ // `--commit` is the roadmap verb's own flag: anywhere else it must reach the default branch and get
70
+ // that verb's unknown-flag answer, as it did before it was added. '' matches no case.
71
+ switch (a === '--commit' && o.cmd !== 'roadmap' ? '' : a) {
63
72
  case '-h': case '--help': o.help = true; break;
64
- case '-v': case '--version': o.version = true; break;
73
+ case '-v': o.version = true; break;
74
+ case '--version':
75
+ if (o.cmd === 'package' && argv[i + 1] !== undefined && !argv[i + 1].startsWith('-')) {
76
+ o.packageVersion = argv[++i];
77
+ } else o.version = true;
78
+ break;
65
79
  case '-n': case '--dry-run': o.dryRun = true; break;
80
+ case '--otlp-http': o.otlpHttp = true; break;
66
81
  case '-f': case '--force': o.force = true; break;
67
82
  case '--adopt': o.adopt = true; break;
83
+ // task-attempt --action cancel (run): a switch, so it cannot go through parseRuntimeFlag,
84
+ // which reads only flags that take a value (IC-017).
85
+ case '--adopt-unowned': o.adoptUnowned = true; break;
86
+ // worker --action run: wait for the run to end. A switch, like --adopt-unowned (081 IC-026).
87
+ case '--wait': o.wait = true; break;
88
+ // slot --action run: refuse at once instead of queueing (115 IC-008). A switch, so key `noWait`.
89
+ case '--no-wait': o.noWait = true; break;
90
+ // slot --action run -- <command> [args...]: everything after the first `--` is the command's
91
+ // own argv, never parsed here (115 IC-008). Any other verb still refuses a bare `--` below.
92
+ case '--':
93
+ if (o.cmd === 'slot') { o.slotCommand = argv.slice(i + 1); i = argv.length; break; }
94
+ if (o.cmd === 'plan-check') break;
95
+ console.error(unknownFlagMessage(a)); process.exit(unknownFlagExit(o.cmd));
96
+ break;
97
+ // worker --action run|describe|select: the isolated-edit recipe and baseline (082 IC-014).
98
+ case '--edit': o.edit = true; break;
68
99
  case '-g': case '--global': o.global = true; break;
69
100
  case '--no-backup': o.noBackup = true; break;
70
101
  case '--permissions': o.permissions = true; break;
71
102
  case '--statusline': o.statusline = true; break;
72
103
  case '--json': o.json = true; break;
104
+ case '--show-origin': o.showOrigin = true; break;
73
105
  case '--bare': o.bare = true; break;
74
106
  case '--no-record': o.noRecord = true; break;
107
+ // context-emit: decide and render without taking a claim or writing a ledger line.
108
+ case '--peek': o.peek = true; break;
75
109
  case '--check': o.check = true; break;
110
+ // roadmap --action init-policy: commit the policy onto local develop by plumbing instead of only writing it.
111
+ case '--commit': o.commit = true; break;
112
+ // package --action verify: rewrite an unreadable state.json (never widens, 122 IC-009).
113
+ case '--repair': o.repair = true; break;
76
114
  // decision --action list: every decision by id, not just the live ones.
77
115
  case '--all': o.all = true; break;
78
116
  // lifecycle --action overview: the /do maintain view, with a larger list and a pending count.
@@ -84,6 +122,8 @@ function parseArgs(argv ) {
84
122
  // advise --action configure: these are deliberately presence-only switches.
85
123
  case '--off': o.off = true; break;
86
124
  case '--project': o.project = true; break;
125
+ // evidence --action retire: retire every item the ledger classes stale.
126
+ case '--stale': o.stale = true; break;
87
127
  // goal --action check: record the item as not met (evidence is still required, as the reason).
88
128
  case '--unmet': o.unmet = true; break;
89
129
  // goal --action link: move a feature that already serves another goal.
@@ -109,12 +149,13 @@ function parseArgs(argv ) {
109
149
  }
110
150
  case '--action': {
111
151
  const val = argv[i + 1];
112
- if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(1); }
152
+ // `review`, `protocol`, `config`, `primary` and `package` answer a missing value as usage, exit 2; other verbs keep exit 1.
153
+ if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(o.cmd === 'review' || o.cmd === 'protocol' || o.cmd === 'config' || o.cmd === 'primary' || o.cmd === 'fleet' || o.cmd === 'transcript' || o.cmd === 'package' || o.cmd === 'worktree' ? 2 : 1); }
113
154
  o.action = val; o.actionGiven = true; i++; break;
114
155
  }
115
156
  case '--task-class': {
116
157
  const val = argv[i + 1];
117
- if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(1); }
158
+ if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(o.cmd === 'protocol' || o.cmd === 'rules' ? 2 : 1); }
118
159
  o.taskClass = val; i++; break;
119
160
  }
120
161
  case '--task-id': {
@@ -193,29 +234,56 @@ function parseArgs(argv ) {
193
234
  // its validation subtly wrong.
194
235
  const runtime = parseRuntimeFlag(a, argv, i, o);
195
236
  if (runtime !== null) { i = runtime; break; }
196
- if (a.startsWith('-')) { console.error(`doflow: unknown flag '${a}'`); process.exit(1); }
237
+ // slot, primary, fleet and transcript report an unknown flag as their own usage error (exit 2, 115 IC-008, 120 IC-008).
238
+ if (a.startsWith('-') && (o.cmd === 'slot' || o.cmd === 'primary' || o.cmd === 'fleet' || o.cmd === 'transcript')) (o.extraFlags = o.extraFlags || []).push(a);
239
+ else if (a.startsWith('-') && o.cmd !== 'plan-check') { console.error(unknownFlagMessage(a)); process.exit(unknownFlagExit(o.cmd)); }
197
240
  else if (!o.cmd) o.cmd = a;
198
241
  else o.positional.push(a);
199
242
  }
200
243
  }
201
244
  }
245
+ if (o.cmd === 'plan-check') o.extraFlags = o.flagsGiven;
202
246
  return o;
203
247
  }
204
248
 
249
+ /** Verbs that answer an unrecognised flag as a usage error (exit 2); every other verb keeps exit 1. */
250
+ function unknownFlagExit(cmd ) {
251
+ return cmd === 'protocol' || cmd === 'config' || cmd === 'rules' || cmd === 'review' || cmd === 'worktree' || cmd === 'attendance' ? 2 : 1;
252
+ }
253
+
254
+ /** Longest part of an unrecognised argument echoed back; the rest is cut and marked. */
255
+ const UNKNOWN_FLAG_ECHO_CHARS = 80;
256
+
257
+ /** The unknown-flag error: the argument is untrusted text, so it is made print-safe (no control
258
+ * characters, one line) and cut to a bounded length (FU-8eqytg). */
259
+ function unknownFlagMessage(arg ) {
260
+ const safe = printSafe(String(arg));
261
+ const shown = safe.length > UNKNOWN_FLAG_ECHO_CHARS ? `${safe.slice(0, UNKNOWN_FLAG_ECHO_CHARS)}...` : safe;
262
+ return `doflow: unknown flag '${shown}'`;
263
+ }
264
+
205
265
  /** Single-value arguments of the runtime verbs → the option key each one writes. */
206
266
  const RUNTIME_STRING_FLAGS = new Map([
207
267
  // `scaffold`. The resolver's own ambiguous-feature error tells the caller to "re-run with
208
268
  // --slug=<chosen>"; without this flag that hint would name an argument this CLI rejects.
209
269
  ['--slug', 'slug'],
270
+ ['--listen-address', 'listenAddress'], // ui: explicit private interface for TLS phone access
271
+ ['--tls-cert', 'tlsCert'], // ui: absolute PEM certificate chain
272
+ ['--tls-key', 'tlsKey'], // ui: absolute PEM private key
273
+ // `--reason <text>` is parsed by its own case above; this entry is the `--reason=<text>` spelling
274
+ // of the same flag (FU-8eqytg), so the two forms mean the same on every verb that accepts it.
275
+ ['--reason', 'reason'],
210
276
  ['--rationale', 'rationale'], // classify: why this class was proposed · decision --action add: why it was decided
211
277
  ['--request', 'request'], // classify: request text for an advisory second opinion
212
278
  ['--request-file', 'requestFile'], // classify: request text read from a file
213
279
  // decision --action add. `--statement`, `--stage`, `--slug` and `--batch` above are shared.
280
+ ['--run-id', 'runId'], // intake --action undo: the sort run to undo (default: the latest)
214
281
  ['--topic', 'topic'], // the subject key a decision is live on
215
282
  ['--channel', 'channel'], // question | gate | prompt | default | resolution
216
283
  ['--supersedes', 'supersedes'], // comma-separated DEC-### ids this decision replaces
217
284
  ['--refs', 'refs'], // comma-separated ids the decision touches, e.g. FR-001,IC-002
218
285
  ['--source', 'source'], // where the decision was stated, e.g. design/design-02-question.md#question-1
286
+ ['--index', 'index'], // package add: local pinned package index
219
287
  // followup and lifecycle (feature 046). `--statement`, `--stage`, `--slug`, `--batch`, `--reason`,
220
288
  // `--channel`, `--state`, `--source`, `--intent`, `--task-class` and `--task-id` above are shared.
221
289
  ['--ids', 'ids'], // followup: comma-separated FU-xxxxxx ids to take, settle or promote
@@ -264,6 +332,18 @@ const RUNTIME_STRING_FLAGS = new Map([
264
332
  ['--mandatory-file', 'mandatoryFile'], // context-pack: caller-supplied mandatory fields
265
333
  ['--max-bytes', 'maxBytes'], // context-pack: per-call cap in bytes
266
334
  ['--expand', 'expand'], // context-pack: pointer id to expand
335
+ // 078 context-emit (IC-005). Identity is read from the environment only; no flag sets it.
336
+ ['--event', 'event'], // context-emit: launch | prompt | delta
337
+ ['--cwd', 'cwd'], // context-emit: the working directory the emission is for
338
+ ['--session', 'session'], // context-emit: the harness session id
339
+ ['--nudge', 'nudge'], // context-emit: nudge | suppress | none
340
+ // 078 context-grant (IC-013). `--max-bytes` above is shared.
341
+ ['--summary', 'summary'], // context-grant: a summary id, or pending
342
+ ['--to-run', 'toRun'], // context-grant: the recipient run id
343
+ ['--to-lineage', 'toLineage'], // context-grant: the recipient lineage id
344
+ ['--from-worktree', 'fromWorktree'], // context-grant: source scope worktree (default DOFLOW_WORKTREE or cwd)
345
+ ['--from-run', 'fromRun'], // context-grant: source scope run (default DOFLOW_RUN_ID or local)
346
+ ['--from-lineage', 'fromLineage'], // context-grant: source scope lineage (default DOFLOW_LINEAGE_ID or main)
267
347
  ['--stage-id', 'stageId'], // research-request: active feature stage
268
348
  ['--question', 'question'], // research-request: external question
269
349
  ['--blocking', 'blocking'], // research-request: true | false
@@ -289,7 +369,10 @@ const RUNTIME_STRING_FLAGS = new Map([
289
369
  ['--tier', 'tier'], // brief-tools: the task line's tier (light | standard | frontier)
290
370
  ['--harness', 'harness'], // brief-tools: the harness the brief is for
291
371
  ['--policy', 'policy'], // enforcement: lifecycle policy id
292
- ['--profile', 'profile'], // enforcement: coverage profile filter
372
+ ['--profile', 'profile'], // enforcement profile; retrieve --scope code: lexical-only|hybrid
373
+ ['--root', 'root'], // retrieve --scope code: project root (never harness-home)
374
+ ['--index-action', 'indexAction'], // retrieve --scope code: explicit build|refresh
375
+ ['--model-path', 'modelPath'], // retrieve --scope code: verified existing local Semble model
293
376
  ['--heading-level', 'headingLevel'], // brief-tools: 2 (default) or 3
294
377
  ['--tasks', 'tasks'], // brief-tools: comma-separated plan task ids for tier advice
295
378
  ['--plan-path', 'planPath'], // verify: a feature plan.md whose doflow-verification
@@ -298,10 +381,65 @@ const RUNTIME_STRING_FLAGS = new Map([
298
381
  ['--verification-input', 'verificationInput'], // verify: manifest JSON file for explicit structuralChecks/requirements (IC-022)
299
382
  ['--verification-phase', 'verificationPhase'], // verify: postimplementation (IC-022)
300
383
  ['--baseline-ref', 'baselineRef'], // verify: explicit ancestor commit or ref to measure change against (IC-022)
384
+ ['--base', 'base'], // review --action start: the commit or ref the changed paths are measured from (095b IC-001)
385
+ ['--preset', 'preset'], // review --action start: a review preset id to run with, never looser than the decided one (119 IC-005)
386
+ ['--layer', 'layer'], // config validate|set|unset: user | project | local, checked in handleConfigCommand (119 IC-008)
387
+ ['--prepared-run', 'preparedRun'], // config validate: a prepared-run file to check, writes nothing (119 IC-010)
301
388
  ['--error', 'errorMessage'], // recover: the failure text to classify
302
389
  ['--agent', 'agent'], // recover: which agent produced the failure
303
390
  ['--task', 'task'], // task-attempt: the plan task id, e.g. A.1
304
391
  ['--token', 'token'], // task-attempt finish|release: the fencing token claim returned
392
+ // 080 task-attempt (IC-017). Read as text and validated in handleTaskAttemptCommand, so an
393
+ // integer is digits only (`5abc` and `-1` are usage) rather than what parseInt makes of it.
394
+ ['--owner-override', 'ownerOverride'], // claim: why someone other than the declared owner takes the task
395
+ ['--epoch', 'epoch'], // claim: the run epoch the caller was handed
396
+ ['--reserve-tokens', 'reserveTokens'], // claim: tokens held against the run's budget while active
397
+ ['--exec-worktree', 'execWorktree'], // claim: the worktree the attempt executes in
398
+ ['--tokens', 'tokens'], // finish|release|report-usage: tokens the attempt used, as reported
399
+ ['--tokens-basis', 'tokensBasis'], // finish|release|report-usage: measured | estimated
400
+ ['--budget-attempts', 'budgetAttempts'], // start: the run's attempt limit
401
+ ['--budget-tokens', 'budgetTokens'], // start: the run's token limit
402
+ ['--by', 'by'], // start|pause|cancel|reopen|resume: who acts on the run
403
+ ['--ack', 'ack'], // resume: the digest the unacknowledged resume reported
404
+ // 081 worker (IC-025, IC-026). Read as text and validated in handleWorkerCommand.
405
+ // `--need`, `--harness`, `--budget-tokens`, `--task`, `--token`, `--by` and `--reason` are shared.
406
+ ['--prompt-file', 'promptFile'], // worker run: the brief the worker receives
407
+ ['--timeout-seconds', 'timeoutSeconds'], // worker run: 1 to 14400
408
+ ['--worker-run', 'workerRun'], // worker status|cancel: a w-<12 hex> run id
409
+ ['--checks', 'checks'], // worker evidence: checks file
410
+ ['--out', 'out'], // worker evidence: output record path
411
+ ['--model-check', 'modelCheck'], // worker probe: a declared model-check id
412
+ // 082 dispatch (IC-001, IC-038) and worker --child-of (IC-015). Read as text and validated in
413
+ // executeDispatchCommand / handleWorkerCommand. `--slug`, `--by`, `--reason`, `--mode`,
414
+ // `--reserve-tokens`, `--budget-attempts`, `--budget-tokens`, `--harness`, `--need`, `--status`,
415
+ // `--summary`, `--tokens`, `--tokens-basis`, `--prompt-file`, `--request-id`, `--task`, `--token`,
416
+ // `--ack`, `--request` and `--exec-worktree` are shared.
417
+ ['--concurrency', 'concurrency'], // dispatch start: 1 to 4
418
+ ['--billing-cap', 'billingCap'], // dispatch start: free-only worker billing ceiling
419
+ ['--fallback', 'fallback'], // dispatch start|resume: quota fallback mode off | ask | auto (106 IC-005)
420
+ ['--ladder', 'ladder'], // dispatch start: worker rungs, comma-separated harness ids (106 IC-005)
421
+ ['--verify-argv', 'verifyArgv'], // dispatch start: the verification argv as a JSON array
422
+ ['--verify-seconds', 'verifySeconds'], // dispatch start: 1 to 14400
423
+ ['--attempt-seconds', 'attemptSeconds'], // dispatch start: 1 to 14280
424
+ ['--max-seconds', 'maxSeconds'], // dispatch run: 1 to 14400
425
+ ['--spawn-grant', 'spawnGrant'], // dispatch start: the spawn grant declaration as JSON
426
+ ['--dispatch', 'dispatch'], // dispatch submit: a d-<12 hex> dispatch id
427
+ ['--child-of', 'childOf'], // worker run: the granter's w-<12 hex> run id
428
+ ['--run', 'run'], // trace spans, trace analyze, trace export: keep one run key or run id (088 IC-011, 091 IC-001, 091 IC-006)
429
+ ['--emit', 'emit'], // trace analyze: print a batch for an existing verb, evidence | followups (091 IC-001)
430
+ ['--row', 'row'], // roadmap: restricts the step to one in-flight row (108 IC-001)
431
+ ['--draft', 'draft'], // roadmap seed: the draft file to check, apply or amend (113 IC-001)
432
+ ['--id', 'id'], // package --action list|show|update: the package id
433
+ ['--plan', 'planId'], // package --action add|update: apply the plan file with this 16-hex plan id (122 IC-006)
434
+ ['--points', 'points'], // package --action new: point[:local] entries, comma-separated
435
+ ['--dir', 'dir'], // package --action new: authored package target directory
436
+ ['--name', 'name'], // slot: the slot's name, 1 to 64 characters of a-z, 0-9 and - (115 IC-008)
437
+ ['--label', 'label'], // slot --action run: the holder's label, at most 80 characters (115 IC-008)
438
+ ['--cursor', 'cursor'], // transcript --action read: the cursor an earlier read returned (093 IC-022) · followup --action list: the nextCursor of an earlier page (137 IC-004)
439
+ ['--limit', 'limit'], // transcript --action read: at most this many events, validated in the verb (093 IC-022) · followup --action list: the page size (137 IC-004)
440
+ ['--view', 'view'], // followup --action list, lifecycle --action overview, classify: brief or full, validated in the verb (137 IC-001)
441
+ ['--window', 'window'], // transcript --action stats: minutes, 1 to 60, validated in the verb (093 IC-023)
442
+ ['--port', 'port'], // ui: the Console's port, 0 to 65535, checked in commands/ui.ts (092 IC-008)
305
443
  ]);
306
444
 
307
445
  /** Repeatable arguments — each occurrence appends rather than replaces. */
@@ -314,14 +452,17 @@ const RUNTIME_LIST_FLAGS = new Map([
314
452
  ['--need', 'need'],
315
453
  ['--path', 'paths'], // leak-scan: the files to scan, one per occurrence
316
454
  ['--exclude', 'exclude'], // leak-scan: extra path segments to skip · lifecycle --action release: slugs left out
455
+ ['--exclude-family', 'excludeFamily'], // model-role: model family to exclude from review candidates
317
456
  ['--feature', 'feature'], // lifecycle --action release: a feature slug to add, one per occurrence
318
457
  ['--item', 'item'], // goal --action add: a checklist item, one per occurrence · goal --action check: the one item id (C3)
458
+ ['--blocker', 'blocker'], // dispatch submit: one blocker line per occurrence, at most 20
319
459
  ]);
320
460
 
321
461
  /** Non-negative integer arguments. */
322
462
  const RUNTIME_INT_FLAGS = new Map([
323
463
  ['--iteration', 'iteration'], // recover: retries already spent, bounding the retry budget
324
464
  ['--observed-exit', 'observedExit'], // evidence --action add: exit status of the observed command (0 is meaningful)
465
+ ['--timeout', 'timeout'], // slot --action run: seconds to wait for the slot; the verb checks 1 to 86400 (115 IC-008)
325
466
  ]);
326
467
 
327
468
  /**
@@ -345,6 +486,7 @@ function parseRuntimeFlag(arg , argv , i , o )
345
486
  const inline = eq === -1 ? null : arg.slice(eq + 1);
346
487
  const key = RUNTIME_STRING_FLAGS.get(name) || RUNTIME_LIST_FLAGS.get(name) || RUNTIME_INT_FLAGS.get(name);
347
488
  if (!key) return null;
489
+ if ((name === '--listen-address' || name === '--tls-cert' || name === '--tls-key') && o.cmd !== 'ui') return null;
348
490
 
349
491
  let value = inline;
350
492
  let next = i;
@@ -366,13 +508,11 @@ function parseRuntimeFlag(arg , argv , i , o )
366
508
  if (!Number.isFinite(parsed) || parsed < 0) { console.error(`doflow: ${name} expects a non-negative integer, got '${value}'`); process.exit(2); }
367
509
  o[key] = parsed;
368
510
  } else if (RUNTIME_LIST_FLAGS.has(name)) {
369
- // --exclude alone also accepts a comma-joined value (`--exclude bin,src,core`), not just the
370
- // repeatable form (`--exclude bin --exclude src`) every other list flag uses — the two used to
371
- // be parsed by two separate code paths (a dedicated switch case handling only the space
372
- // spelling's comma-splitting, this generic path handling both spellings but never splitting),
373
- // so `--exclude=bin,src` silently excluded nothing while `--exclude bin,src` worked. One path,
374
- // both spellings, same behavior now.
375
- const parts = name === '--exclude' ? value.split(',').map((s ) => s.trim()).filter(Boolean) : [value];
511
+ // --exclude and --exclude-family both accept comma lists or repeated flags. Keep --exclude's
512
+ // existing trimming, empty-item filtering, and split behavior unchanged for its callers.
513
+ const parts = name === '--exclude' || name === '--exclude-family'
514
+ ? value.split(',').map((s ) => s.trim()).filter(Boolean)
515
+ : [value];
376
516
  (o[key] = o[key] || []).push(...parts);
377
517
  } else if (name === '--evidence-id' && o.cmd === 'research-request') {
378
518
  (o.evidenceIds = o.evidenceIds || []).push(value);
@@ -396,6 +536,7 @@ Commands:
396
536
  list-backups List available backups
397
537
  self-update git pull + reinstall
398
538
  tools Inspect or manage registered external tools
539
+ ui [<project>] Run the DoFlow Console, a separately installed package (--port N; exit 2 when it is not installed)
399
540
  capabilities Show registered abstract capabilities and resolved providers
400
541
  enforcement Report lifecycle policy enforcement coverage (--harness, --policy)
401
542
  doctor System health and capability smoke check diagnostics
@@ -403,33 +544,92 @@ Commands:
403
544
  evidence Record a stage's evidence batch, or inspect what is recorded (--task-id)
404
545
  claim Record a claim, link evidence to it, or list them (--task-id, --action)
405
546
  context-pack Compile a task's evidence and claims into a context block (--task-id)
547
+ context-emit Decide and render one launch, prompt or delta emission (--event, --cwd)
548
+ context-grant Grant one compacted summary to a launched run and lineage (--summary, --to-run, --to-lineage)
406
549
  retrieval-plan Declare a stage's information needs, attempt retrieval, then report every declared item
407
550
  outcome Record a task's terminal state with its basis, or show it (--task-id)
408
- classify Validate a proposed task class and return its workflow (--task-class)
551
+ classify Validate a proposed task class and return its workflow (--task-class [--view brief|full])
409
552
  workflow Resolve a task class to its stages, gates and readiness templates
410
553
  orchestrate Start or resume a run: complete stages, decide gates (--action)
411
554
  research-request Open, list or resolve a feature-stage research question (--task-id)
412
- task-attempt Claim, finish, release or read the attempts on a plan's tasks (--action, --slug)
413
- retrieve BM25 search over the installed guidance tree (--query)
414
- model-role Resolve a model role to ranked provider candidates (--role)
555
+ task-attempt Claim, finish, release, run controls, resume, inspect, reopen or report usage on a plan's task attempts (--action, --slug)
556
+ worker Discover, probe, describe, select, run, status or cancel an external headless worker on a claimed task (--action)
557
+ dispatch Run a feature's task graph: start, step, run, submit, spawn, pause, inspect, cancel, takeover or resume (--action)
558
+ retrieve BM25 guidance search by default; use --scope code for scoped project retrieval (--query)
559
+ model-role Resolve a model role to ranked provider candidates (--role, --exclude-family)
415
560
  advise Route decision questions to the configured local model (--action)
416
561
  brief-tools Tier, tools and report-format block for a dispatch brief (--owner)
417
562
  route Resolve an information need to a healthy provider (--intent)
418
563
  verify Compile the verification contract and report against it (--task-id)
419
564
  recover Classify a verification failure and plan the bounded retry (--error)
420
- trace Trajectory of the current or most recent workflow (run ledger)
565
+ trace Trajectory of the current or most recent workflow (run ledger).
566
+ trace spans [<project>] the span view; trace analyze [<project>] its detectors (exit 1 on a finding);
567
+ trace export --otlp-http [<project>] export spans via OTLP/HTTP
421
568
  stats Aggregate local run-ledger usage
422
569
  indicators Per-stage and per-gate timings from the orchestration record
423
570
  discover Missed capability opportunities in recorded runs
424
571
  inventory Shadowed copies, drift and unmanaged files across both install scopes
425
572
  storage Report stored data and retention bounds (--action report|prune|upkeep)
573
+ config Show each setting's effective value and where it came from, print the settings schema, or validate, set or unset one (exit 0 ok, 1 refused, 2 usage).
574
+ config [list] [--show-origin] [--json] [-g] [<project path>] read-only
575
+ config schema [--json] every key with its type, values, default, scope and whether config set may write it, the locked invariants and the presets
576
+ config validate <key> <json-value> [--layer user|project|local] [--json] check a value, writes nothing
577
+ config validate --prepared-run <file> [--json] check a prepared-run file (task class, settings, presets), one entry per fault, writes nothing
578
+ config set <key> <json-value> --layer user|project|local [--json] validate, then write that layer's file; refuses security-relevant and invariant.* keys
579
+ config unset <key> --layer user|project|local [--json] remove the key from that layer's file
426
580
  scaffold Emit the reviewable code scaffold the active feature's artifacts imply
427
581
  decision Register, list or compact the active feature's decisions (--action init|add|list|compact)
428
- followup Record, list, take, settle, promote or report what a feature left unfinished (--action add|list|take|settle|promote|report)
429
- lifecycle Open follow-ups, feature tracking, releases and status for the project (--action overview|init|release|status|merged)
582
+ intake Sort, preview, undo, list or file prompt text for the active feature's additional-context folder (--action sort|preview|undo|list|file-prompt)
583
+ followup Record, list, take, settle, promote or report what a feature left unfinished (--action add|list|take|settle|promote|report; list: [--view brief|full] [--cursor <c>] [--limit <n>] [--ids <FU-id,...>])
584
+ lifecycle Open follow-ups, feature tracking, releases and status for the project (--action overview|init|release|status|merged; overview: [--view brief|full])
430
585
  goal Add, check, link, list or close a goal and its checklist (--action add|item|check|link|list|done)
431
586
  failure List, settle or switch off the failures DoFlow captured on this machine (--action list|settle|capture)
432
587
  (a value beginning with '-' must be written --flag=value)
588
+ roadmap Session-driven autopilot runner (--action render|status|next|audit|init-policy [--check] [--row <id>] [--run <id>]).
589
+ roadmap --action init-policy [--commit] writes the gate policy for review, or with --commit commits it onto local develop when develop is not checked out in a worktree (otherwise it prints the commands to run there; never pushes);
590
+ roadmap seed --action check|apply|amend --draft <path> [--json] validates and writes new rows;
591
+ rows written while autopilot is on land proposed; roadmap promote <id...> [--json] (person: asks y/N on the terminal) makes them ready
592
+ plan-check Check a plan's task lines the way the task-attempt ledger reads them: plan-check <plan path> [--json]
593
+ review Validate a feature's review/findings.json; print errors, advisories and counts (exit 0 valid, 1 invalid, 2 usage).
594
+ review --action check [--slug <name> | --path <findings.json>] [--json]
595
+ review --action start [--slug <name>] [--base <ref>] [--json] [--preset <id>] verify precondition and review protocol; --base must be the review's base (exit 0 ok or not applicable, 1 refused, 2 usage)
596
+ protocol Print the review and debate protocol presets, or the one a run would use (read-only, writes nothing).
597
+ protocol --action list [--kind review|debate] [--json]
598
+ protocol --action resolve --kind review|debate [--task-class <id>] [--risk <level>] [--preset <id>] [--json] (exit 0 resolved, 1 refused, 2 usage)
599
+ rules Print the values the runtime owns for this project, each with its source (read-only, writes nothing).
600
+ rules [--task-class <id>] [-g] [--json] [<project>] review protocol per class (attended and unattended), gate floors and loop limits, tiers and worker models, review and autopilot settings (exit 0, 2 usage)
601
+ primary Resolve which harness and model the main session runs (read-only).
602
+ primary --action resolve [--json] (exit 0, 1 refused, 2 usage)
603
+ primary --action observed [--json] checkouts and session hook records (exit 0, 1 cannot list checkouts, 2 usage)
604
+ fleet List the projects this machine knows (read-only).
605
+ fleet --action projects [--json] from the user-state upkeep-roots and the hook project directories (exit 0, 1 cannot list projects, 2 usage)
606
+ fleet --action tree [--json] one project's agent hierarchy as nodes and edges (exit 0, 1 cannot list checkouts, 2 usage)
607
+ transcript Read an agent's recent events, or the project's traffic (read-only, run in a project).
608
+ transcript --action read --agent <key> [--cursor <c>] [--limit <n>] [--json] masked events and DoFlow's record events (exit 0, 1 agent-not-in-project or session-not-in-project, 2 usage)
609
+ transcript --action stats [--window <minutes 1..60>] [--json] events per minute, tool calls, tokens, who works with whom (exit 0, 2 usage)
610
+ worktree Remove a merged feature's worktree and branch, never by force (--action cleanup).
611
+ worktree --action cleanup --slug <row slug> [--json] copies agent-docs/doflow/<slug> back to the main checkout first (exit 0 cleaned, 1 kept or lease-held with the reason, 2 usage)
612
+ attendance Say whether a person is watching a stage (read-only).
613
+ attendance --task-id <row slug> [--run <rl-id>] [--json] prints "unattended <source>" or "attended <reason>" (exit 0, 2 usage)
614
+ package List the contribution points a package may fill, check a package directory, show the packages, add and update a local package, or turn it on and off.
615
+ package --action points [--json]
616
+ package --action check --path <dir> [--json] (read-only; exit 0 clean, 1 findings, 2 usage)
617
+ package --action list [--id <id>] [--json] (read-only; exit 0, 1 when a package is neither active nor disabled)
618
+ package --action show --id <id> [--json] (read-only; exit 0, 1 unknown id, 2 no --id)
619
+ package --action add --source <spec> [--json] (plans a local or granted remote source; exit 0, 1 refused, 2 usage)
620
+ package --action add --index <file> --id <id> [--version <v>] [--json] (selects a pinned source; needs a fetch grant)
621
+ package --action add --plan <planId> [--json] (stores the package and records it disabled; exit 0, 1 refused, e.g. digest-mismatch)
622
+ package --action update --id <id> | --plan <planId> [--json] (plan a new copy from the recorded source, or apply the plan; a changed digest above inert prints the new trust line)
623
+ package --action new --id <id> --points <point[:local],...> [--dir <path>] [--json] (writes an authored package folder only; exit 0 created, 1 refused, 2 usage)
624
+ package --action enable|disable --id <id> [--json] (sets the lock bit; enable prints the resulting state, and for needs-trust the exact grant line and file; exit 0, 1 incompatible or unknown, 2 no --id)
625
+ package --action trust|exempt --id <id> [--json] (prints the grant line a person appends to grants.jsonl and writes nothing; exempt exits 1 while the host is inside the range)
626
+ package --action revoke --id <id> [--json] (records a revocation in state.json; only a later trust line counts)
627
+ package --action remove --id <id> [--json] (disables, deletes the store entry and lock row, records a revocation and a removed tombstone, then lists the settings, records and grant lines that still name the package and rewrites none; exit 0, 1 unknown id or the bundled package, 2 no --id)
628
+ package --action verify [--repair] [--json] (re-hashes enabled third-party entries and records suspensions; exit 0 intact, 1 findings; --repair rewrites an unreadable state.json)
629
+ slot Named machine-wide queue, one holder at a time (--action run|list|peek|release).
630
+ slot --action run --name <name> [--label <text>] [--timeout <s>] [--no-wait] -- <command> [args...]
631
+ slot --action release --name <name> --by <who> --reason <text>
632
+ models Synchronize, list, or inspect observed models across workers (--action sync|list|describe)
433
633
  leak-scan Report DoFlow-internal identifiers in shipped files (--path, repeatable)
434
634
 
435
635
  Scope (mutually exclusive — global wins if both given):
@@ -444,7 +644,7 @@ Scope (mutually exclusive — global wins if both given):
444
644
  Options:
445
645
  -t, --target <list> Comma-separated: ${VALID_TARGETS.join(',')} (default: ${DEFAULT_TARGETS.join(',')})
446
646
  --mcp <list> Comma-separated MCP server names, or all or none, for every targeted
447
- harness that takes MCP servers (all but gemini). Default: none, or the
647
+ harness that takes MCP servers (all of them). Default: none, or the
448
648
  selection a harness has recorded in doflow.lock, or the servers an
449
649
  installed harness already has; a real terminal prompts on install.
450
650
  Recorded per harness.
@@ -455,27 +655,61 @@ Options:
455
655
  the file is still a conflict. For a tree installed before the neutral
456
656
  ledger existed, which nothing else can re-adopt
457
657
  --no-backup Skip backup (requires --force; ignored by rollback's safety snapshot)
458
- --prune <N> Keep the N newest backups after install or update (default 3; 0 keeps all)
658
+ --prune <N> Keep the N newest backups after install, update or reconcile (default 3; 0 keeps all)
459
659
  --days <N> Run-ledger window in calendar days (trace, stats, discover)
660
+ --run <key|id> trace spans, trace analyze, trace export: keep the traces of one run key or run id
661
+ --emit evidence|followups
662
+ trace analyze: print only the batch for evidence --action add --batch -,
663
+ or for followup --action add --batch <file> (with --task-id, cites its evidence)
664
+ --otlp-http trace export: export spans to an OpenTelemetry collector via OTLP/HTTP JSON
460
665
  --slug <name> Scaffold this feature instead of the branch-resolved active one
461
666
 
462
667
  Runtime verb arguments (accept --flag value or --flag=value):
463
- --task-class classify, workflow, readiness, context-pack, outcome --action record
464
- --task-id readiness, evidence, claim, context-pack, retrieval-plan, outcome, verify, advise
465
- --action claim: list|add|link|retract|supersede · evidence: list|add|supersede
668
+ --task-class classify, workflow, readiness, context-pack, outcome --action record, protocol --action resolve
669
+ --task-id readiness, evidence, claim, context-pack, retrieval-plan, outcome, verify, advise, retrieve,
670
+ trace analyze --emit followups (the ledger read for evidence ids)
671
+ --action claim: list|add|link|retract|supersede · evidence: list|add|supersede|retire
466
672
  verify: report|contract · retrieval-plan: declare|report|attempt
467
673
  outcome: record|show · advise: ask|outcome|configure · tools: see above
468
674
  followup: add|list|take|settle|promote|report
469
- task-attempt: claim|finish|release|status
675
+ task-attempt: claim|finish|release|status|start|pause|cancel|resume|inspect|reopen|report-usage
676
+ worker: discover|probe|describe|select|run|status|cancel|evidence
677
+ dispatch: start|step|run|submit|spawn|pause|inspect|cancel|takeover|resume
470
678
  lifecycle: overview|init|release|status|merged
471
679
  goal: add|item|check|link|list|done
472
680
  failure: list|settle|capture
681
+ roadmap: render|status|next|audit|init-policy (seed: check|apply|amend; promote <id...>)
682
+ slot: run|list|peek|release
683
+ worktree: cleanup
684
+ models: sync|list|describe
685
+ review: check|start
686
+ protocol: list|resolve
687
+ primary: resolve|observed
688
+ fleet: projects|tree
689
+ transcript: read|stats
690
+ package: points|check|list|show|add|update|enable|disable|trust|exempt|revoke|verify|remove
473
691
  --task, --token, --owner, --mode,
474
- --result, --evidence-id, --reason task-attempt (claim: --task --owner --mode manual|sequential|subagent;
475
- finish: --task --token --result COMPLETED|BLOCKED|ABANDONED|INCONCLUSIVE
476
- [--evidence-id]; release: --task --token --reason)
692
+ --result, --evidence-id, --reason task-attempt (claim: --task --owner --mode manual|sequential|subagent
693
+ [--owner-override <reason>] [--epoch <n>=1+] [--reserve-tokens <n>]
694
+ [--exec-worktree <path>];
695
+ finish: --task --token --result COMPLETED|BLOCKED|ABANDONED|INCONCLUSIVE|FAILED
696
+ [--evidence-id] [--reason, required with FAILED];
697
+ release: --task --token --reason; finish and release also
698
+ [--tokens <n> --tokens-basis measured|estimated];
699
+ start: --by [--budget-attempts <n>=1+] [--budget-tokens <n>=1+];
700
+ pause: --by --reason; cancel: --by --reason, one attempt with
701
+ --task --token, else the run [--adopt-unowned];
702
+ reopen: --task --token --by --reason;
703
+ report-usage: --task --token --tokens <n> --tokens-basis
704
+ measured|estimated, once on an ended attempt with no usage;
705
+ resume: report and digest, then --ack sha256:<hex> --by [--reason];
706
+ inspect: graph, task states, budgets and run totals.
707
+ Exit 0 applied or read; 1 refused, stale or ack-required, the
708
+ disposition in the JSON; 2 usage or an unreadable store or plan)
477
709
  --rationale, --proposed-by, --calling-skill classify
478
710
  --request <text>, --request-file <file> classify (mutually exclusive; optional second opinion)
711
+ --view brief|full followup --action list (default brief), lifecycle --action overview, classify (default full); brief drops detail, full is the whole answer
712
+ --cursor <c>, --limit <n> followup --action list (the cursor is opaque: pass back a page's nextCursor); also transcript --action read
479
713
  --intent, --query, --check route
480
714
  --statement, --claim-id,
481
715
  --evidence-id, --relation claim
@@ -483,14 +717,25 @@ Runtime verb arguments (accept --flag value or --flag=value):
483
717
  --capability, --locator, --content,
484
718
  --absence evidence --action add (one item)
485
719
  --need <intent> evidence --action add (bind evidence to retrieval needs)
720
+ --scope code --profile lexical-only|hybrid,
721
+ --root <project>, --index-action build|refresh,
722
+ --model-path <local-dir> retrieve code scope (guidance remains the default)
486
723
  --batch <file|-> evidence --action add (a stage's JSON batch)
487
724
  --evidence-id, --replaced-by evidence --action supersede (retire one item, point
488
725
  forward to the item that replaces it)
726
+ --stale evidence --action retire (retire every item the ledger
727
+ classes stale, with no replacement; fresh items stay)
489
728
  --verification-plan, --scope,
490
729
  --invariants,
491
730
  --user-decision-pending readiness: inputs the caller states rather than
492
731
  evidence establishes; reported back as such
493
732
  --objective context-pack
733
+ --event, --cwd, --session, --harness,
734
+ --nudge, --max-bytes, --task-id,
735
+ --slug, --peek context-emit (identity comes from the environment only)
736
+ --summary, --to-run, --to-lineage,
737
+ --from-worktree, --from-run,
738
+ --from-lineage, --max-bytes context-grant
494
739
  --need <intent[,intent]>,
495
740
  --stage, --status retrieval-plan (--need is repeatable), outcome
496
741
  --mcp-outcome <server>=<outcome> orchestrate --action handoff, repeatable: used | nothing-usable |
@@ -511,6 +756,20 @@ Runtime verb arguments (accept --flag value or --flag=value):
511
756
  --model, --endpoint, --project,
512
757
  --off advise --action configure
513
758
  --path, --exclude (repeatable) leak-scan
759
+ --slug | --path review --action check (at most one; with neither, the active feature)
760
+ --path <dir> package --action check (exactly one package directory)
761
+ --id <id> package --action list (one package), show, update (required unless --plan), enable, disable, trust, exempt, revoke and remove
762
+ --source <spec> package --action add (local dir, git:https://<host>/<repo>[#<subdir>]@<ref>, npm:<name>@<version or range>)
763
+ --index <file>, --version <v> package --action add --id <id> (local pinned index; default highest compatible stable version)
764
+ --plan <planId> package --action add and update (apply the plan; it is kept for 24 hours)
765
+ --points <point[:local],...> package --action new (open points and optional local ids)
766
+ --dir <path> package --action new (default: <project>/.doflow/package/<id>/)
767
+ --repair package --action verify (rewrite an unreadable state.json; every grant line present is revoked, never widened)
768
+ --base <ref> review --action start (measure the changed paths from this commit, which must be the review's base; --path is refused)
769
+ --preset <id> review --action start, protocol --action resolve (run this preset; refused when looser than the decided protocol)
770
+ --prepared-run <file> config validate (check a prepared-run file instead of one key; exit 2 with a key, value or --layer)
771
+ --layer user|project|local config validate, set, unset (which settings file; project and local are the current project's .doflow/settings.json and settings.local.json)
772
+ --kind review|debate, --risk <level> protocol (--kind filters list and selects what resolve decides; --risk is the change's risk level)
514
773
  --ids, --as, --evidence, --title,
515
774
  --release, --source, --channel followup (add, list, take, settle, promote)
516
775
  --file <path|->, --stdin, --text,
@@ -523,8 +782,52 @@ Runtime verb arguments (accept --flag value or --flag=value):
523
782
  --tag, --confirm, --feature,
524
783
  --exclude (repeatable), --reason lifecycle (release, merged)
525
784
  --fp, --as, --reason, --set, --all failure (list, settle, capture)
785
+ --run-id <id> intake --action undo (default: the latest sort run that has a move to undo)
786
+ --stdin | --file <path>, --stage intake --action file-prompt (the text, unchanged, from exactly one of --stdin or --file; --stage names the filing stage)
787
+ --harness, --need (repeatable),
788
+ --model-check, --budget-tokens,
789
+ --task, --token, --prompt-file,
790
+ --timeout-seconds, --wait, --edit,
791
+ --child-of, --request, --exec-worktree,
792
+ --worker-run, --by, --reason,
793
+ --checks, --out worker (probe: [--model-check <id> --budget-tokens <n>];
794
+ describe: --harness [--edit]; select: [--edit];
795
+ run: --harness --task --token
796
+ --prompt-file [--timeout-seconds 1-14400] [--wait] [--edit]
797
+ [--child-of <w-id> --request <d-id.cN> --exec-worktree <path>];
798
+ status, cancel: --worker-run or --task --token;
799
+ cancel also --by --reason;
800
+ evidence: --harness --out and exactly one of --checks <file>
801
+ (free CLI checks) or --worker-run <w-id> (an ended run).
802
+ Exit 0 done; 1 refused or
803
+ none-eligible, the disposition in the JSON; 2 usage)
804
+ --slug, --by, --reason, --concurrency,
805
+ --mode, --verify-argv, --verify-seconds,
806
+ --attempt-seconds, --reserve-tokens,
807
+ --budget-attempts, --budget-tokens,
808
+ --spawn-grant, --harness, --need,
809
+ --max-seconds, --dispatch, --status,
810
+ --summary, --blocker (repeatable),
811
+ --tokens, --tokens-basis, --prompt-file,
812
+ --request-id, --task, --ack dispatch (start: --by [--concurrency 1-4] [--mode auto|sequential|manual]
813
+ [--verify-argv <json>] [--verify-seconds <n>] [--attempt-seconds <n>]
814
+ [--reserve-tokens <n>] [--budget-attempts <n>] [--budget-tokens <n>]
815
+ [--spawn-grant <json>] [--harness <id>] [--need <id>];
816
+ step: [--by]; run: [--by] [--max-seconds 1-14400];
817
+ submit: --dispatch <d-id> --status success|failure --summary <text>
818
+ [--blocker <text>] [--tokens <n> --tokens-basis measured|estimated];
819
+ spawn: --prompt-file --reserve-tokens <n>, or --request-id;
820
+ pause, cancel: --by --reason; takeover: --task --by --reason;
821
+ resume: report and digest, then --ack sha256:<hex> --by [--reason];
822
+ inspect. Exit 0 done; 1 refused, stale or ack-required, the
823
+ disposition in the JSON; 2 usage or an unreadable store or plan)
526
824
  --error, --failed-check,
527
825
  --iteration, --agent recover
826
+ --name, --label, --timeout,
827
+ --no-wait, --by, --reason slot (run: --name [--label <text>] [--timeout 1-86400] [--no-wait] -- <command> [args...],
828
+ everything after -- is the command's own argv; list; release: --name --by
829
+ --reason. Exit: run passes the command's code, 75 when busy or timed out;
830
+ release 1 while the holder is alive; 2 usage)
528
831
  --json Machine-readable output (status)
529
832
 
530
833
  External tools:
@@ -559,6 +862,8 @@ async function main(argv ) {
559
862
  if (handler) return handler(o);
560
863
  return await dispatchRuntimeCommand(o);
561
864
  } catch (error ) {
865
+ // A repeated `remove` with nothing left is a finished job, not a failure (FU-0wgcyt).
866
+ if (error?.code === 'DOFLOW_NOTHING_TO_REMOVE') { console.log(`[INFO] ${error.message}`); return; }
562
867
  // Recorded silently when it is a programming error (IC-016); the output and exit status below
563
868
  // are the same whether or not anything was written.
564
869
  // Required here, not at load, so a CLI whose failure modules cannot be loaded still runs as today.