@tacuchi/agent-workflow-cli 25.6.1 → 25.8.0

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 (279) hide show
  1. package/CHANGELOG.md +4398 -0
  2. package/README.md +1 -1
  3. package/dist/adapters/git-cli.js +160 -13
  4. package/dist/adapters/git-cli.js.map +1 -1
  5. package/dist/adapters/node-file-system.js +39 -2
  6. package/dist/adapters/node-file-system.js.map +1 -1
  7. package/dist/application/branch-resolver.js +34 -1
  8. package/dist/application/branch-resolver.js.map +1 -1
  9. package/dist/application/capability/readiness.js +26 -10
  10. package/dist/application/capability/readiness.js.map +1 -1
  11. package/dist/application/capability/wrapper.js +10 -3
  12. package/dist/application/capability/wrapper.js.map +1 -1
  13. package/dist/application/checkpoint-write-service.js +161 -39
  14. package/dist/application/checkpoint-write-service.js.map +1 -1
  15. package/dist/application/dates.js +12 -0
  16. package/dist/application/dates.js.map +1 -1
  17. package/dist/application/dev-only-services.js +5 -7
  18. package/dist/application/dev-only-services.js.map +1 -1
  19. package/dist/application/doctor/provider-mcps.js +1 -1
  20. package/dist/application/doctor/provider-mcps.js.map +1 -1
  21. package/dist/application/fix-git-service.js +83 -13
  22. package/dist/application/fix-git-service.js.map +1 -1
  23. package/dist/application/flow/advance.js +64 -9
  24. package/dist/application/flow/advance.js.map +1 -1
  25. package/dist/application/flow/annul-service.js +159 -0
  26. package/dist/application/flow/annul-service.js.map +1 -0
  27. package/dist/application/flow/checkout-observation.js +49 -0
  28. package/dist/application/flow/checkout-observation.js.map +1 -1
  29. package/dist/application/flow/close-at-boundary.js +144 -0
  30. package/dist/application/flow/close-at-boundary.js.map +1 -0
  31. package/dist/application/flow/flow-service.js +213 -49
  32. package/dist/application/flow/flow-service.js.map +1 -1
  33. package/dist/application/flow/internal-actions.js +87 -4
  34. package/dist/application/flow/internal-actions.js.map +1 -1
  35. package/dist/application/flow/internal-drive.js +70 -33
  36. package/dist/application/flow/internal-drive.js.map +1 -1
  37. package/dist/application/flow/reopen-run.js +152 -0
  38. package/dist/application/flow/reopen-run.js.map +1 -0
  39. package/dist/application/flow/run-journey.js +11 -8
  40. package/dist/application/flow/run-journey.js.map +1 -1
  41. package/dist/application/flow/run-projection.js +37 -10
  42. package/dist/application/flow/run-projection.js.map +1 -1
  43. package/dist/application/flow/run-state-service.js +109 -36
  44. package/dist/application/flow/run-state-service.js.map +1 -1
  45. package/dist/application/flow/submit.js +217 -188
  46. package/dist/application/flow/submit.js.map +1 -1
  47. package/dist/application/git-flow-service.js +325 -72
  48. package/dist/application/git-flow-service.js.map +1 -1
  49. package/dist/application/hook-sql-mutation-guard.js +290 -27
  50. package/dist/application/hook-sql-mutation-guard.js.map +1 -1
  51. package/dist/application/host-memory/claude-code.js +65 -0
  52. package/dist/application/host-memory/claude-code.js.map +1 -0
  53. package/dist/application/host-memory/codex.js +225 -0
  54. package/dist/application/host-memory/codex.js.map +1 -0
  55. package/dist/application/host-memory/destination.js +52 -0
  56. package/dist/application/host-memory/destination.js.map +1 -0
  57. package/dist/application/host-memory/reader.js +9 -0
  58. package/dist/application/host-memory/reader.js.map +1 -0
  59. package/dist/application/host-memory/report.js +136 -0
  60. package/dist/application/host-memory/report.js.map +1 -0
  61. package/dist/application/lifecycle-target.js +3 -1
  62. package/dist/application/lifecycle-target.js.map +1 -1
  63. package/dist/application/local-proposal.js +13 -3
  64. package/dist/application/local-proposal.js.map +1 -1
  65. package/dist/application/logging/log-events.js +22 -0
  66. package/dist/application/logging/log-events.js.map +1 -1
  67. package/dist/application/parsers/spec-relation.js +20 -7
  68. package/dist/application/parsers/spec-relation.js.map +1 -1
  69. package/dist/application/persist-service.js +45 -1
  70. package/dist/application/persist-service.js.map +1 -1
  71. package/dist/application/plan-exec-batch-service.js +47 -2
  72. package/dist/application/plan-exec-batch-service.js.map +1 -1
  73. package/dist/application/plan-lineage-seal.js +93 -0
  74. package/dist/application/plan-lineage-seal.js.map +1 -0
  75. package/dist/application/plan-lint-service.js +153 -0
  76. package/dist/application/plan-lint-service.js.map +1 -0
  77. package/dist/application/prod-consent.js +75 -0
  78. package/dist/application/prod-consent.js.map +1 -0
  79. package/dist/application/reseal-service.js +9 -3
  80. package/dist/application/reseal-service.js.map +1 -1
  81. package/dist/application/self/install-skill.js +40 -12
  82. package/dist/application/self/install-skill.js.map +1 -1
  83. package/dist/application/self/install-targets.js +73 -2
  84. package/dist/application/self/install-targets.js.map +1 -1
  85. package/dist/application/self/uninstall.js +21 -7
  86. package/dist/application/self/uninstall.js.map +1 -1
  87. package/dist/application/self/update-self.js +204 -8
  88. package/dist/application/self/update-self.js.map +1 -1
  89. package/dist/application/session-create-service.js +49 -0
  90. package/dist/application/session-create-service.js.map +1 -1
  91. package/dist/application/session-custody-recorder.js +4 -0
  92. package/dist/application/session-custody-recorder.js.map +1 -1
  93. package/dist/application/session-narrative.js +36 -0
  94. package/dist/application/session-narrative.js.map +1 -1
  95. package/dist/application/session-resolver.js +28 -9
  96. package/dist/application/session-resolver.js.map +1 -1
  97. package/dist/application/session-resume-service.js +65 -16
  98. package/dist/application/session-resume-service.js.map +1 -1
  99. package/dist/application/source-boundary-policy.js +168 -34
  100. package/dist/application/source-boundary-policy.js.map +1 -1
  101. package/dist/application/working-branch-service.js +68 -0
  102. package/dist/application/working-branch-service.js.map +1 -0
  103. package/dist/application/workline-graph.js +7 -2
  104. package/dist/application/workline-graph.js.map +1 -1
  105. package/dist/cli/ascii.js +84 -0
  106. package/dist/cli/ascii.js.map +1 -0
  107. package/dist/cli/commands/amend.js +1 -0
  108. package/dist/cli/commands/amend.js.map +1 -1
  109. package/dist/cli/commands/capability.js +15 -0
  110. package/dist/cli/commands/capability.js.map +1 -1
  111. package/dist/cli/commands/check-branch.js +1 -0
  112. package/dist/cli/commands/check-branch.js.map +1 -1
  113. package/dist/cli/commands/checkpoint-read.js +1 -0
  114. package/dist/cli/commands/checkpoint-read.js.map +1 -1
  115. package/dist/cli/commands/checkpoint-write.js +22 -9
  116. package/dist/cli/commands/checkpoint-write.js.map +1 -1
  117. package/dist/cli/commands/claims.js +1 -0
  118. package/dist/cli/commands/claims.js.map +1 -1
  119. package/dist/cli/commands/code-scan.js +1 -0
  120. package/dist/cli/commands/code-scan.js.map +1 -1
  121. package/dist/cli/commands/context-budget.js +1 -0
  122. package/dist/cli/commands/context-budget.js.map +1 -1
  123. package/dist/cli/commands/context-plan.js +1 -0
  124. package/dist/cli/commands/context-plan.js.map +1 -1
  125. package/dist/cli/commands/cut-intent.js +1 -0
  126. package/dist/cli/commands/cut-intent.js.map +1 -1
  127. package/dist/cli/commands/designs.js +1 -0
  128. package/dist/cli/commands/designs.js.map +1 -1
  129. package/dist/cli/commands/dev-only.js +4 -0
  130. package/dist/cli/commands/dev-only.js.map +1 -1
  131. package/dist/cli/commands/doctor.js +5 -0
  132. package/dist/cli/commands/doctor.js.map +1 -1
  133. package/dist/cli/commands/export.js +13 -0
  134. package/dist/cli/commands/export.js.map +1 -1
  135. package/dist/cli/commands/fix-git.js +46 -6
  136. package/dist/cli/commands/fix-git.js.map +1 -1
  137. package/dist/cli/commands/flow.js +61 -5
  138. package/dist/cli/commands/flow.js.map +1 -1
  139. package/dist/cli/commands/generate-launch.js +1 -0
  140. package/dist/cli/commands/generate-launch.js.map +1 -1
  141. package/dist/cli/commands/git-flow.js +104 -29
  142. package/dist/cli/commands/git-flow.js.map +1 -1
  143. package/dist/cli/commands/history-update.js +7 -9
  144. package/dist/cli/commands/history-update.js.map +1 -1
  145. package/dist/cli/commands/hook.js +11 -3
  146. package/dist/cli/commands/hook.js.map +1 -1
  147. package/dist/cli/commands/host-doctor.js +1 -0
  148. package/dist/cli/commands/host-doctor.js.map +1 -1
  149. package/dist/cli/commands/host-memory.js +26 -0
  150. package/dist/cli/commands/host-memory.js.map +1 -0
  151. package/dist/cli/commands/index.js +6 -0
  152. package/dist/cli/commands/index.js.map +1 -1
  153. package/dist/cli/commands/mcp.js +30 -4
  154. package/dist/cli/commands/mcp.js.map +1 -1
  155. package/dist/cli/commands/merge-state.js +1 -0
  156. package/dist/cli/commands/merge-state.js.map +1 -1
  157. package/dist/cli/commands/multiroot.js +16 -0
  158. package/dist/cli/commands/multiroot.js.map +1 -1
  159. package/dist/cli/commands/persist.js +6 -0
  160. package/dist/cli/commands/persist.js.map +1 -1
  161. package/dist/cli/commands/plan.js +51 -0
  162. package/dist/cli/commands/plan.js.map +1 -0
  163. package/dist/cli/commands/plugin-cache.js +4 -0
  164. package/dist/cli/commands/plugin-cache.js.map +1 -1
  165. package/dist/cli/commands/plugin-doctor.js +3 -0
  166. package/dist/cli/commands/plugin-doctor.js.map +1 -1
  167. package/dist/cli/commands/project-md-upsert.js +3 -0
  168. package/dist/cli/commands/project-md-upsert.js.map +1 -1
  169. package/dist/cli/commands/release-data.js +12 -0
  170. package/dist/cli/commands/release-data.js.map +1 -1
  171. package/dist/cli/commands/release-pass.js +10 -0
  172. package/dist/cli/commands/release-pass.js.map +1 -1
  173. package/dist/cli/commands/remove-source.js +1 -0
  174. package/dist/cli/commands/remove-source.js.map +1 -1
  175. package/dist/cli/commands/reseal.js +1 -0
  176. package/dist/cli/commands/reseal.js.map +1 -1
  177. package/dist/cli/commands/resume-summary.js +9 -2
  178. package/dist/cli/commands/resume-summary.js.map +1 -1
  179. package/dist/cli/commands/resume.js +1 -0
  180. package/dist/cli/commands/resume.js.map +1 -1
  181. package/dist/cli/commands/retirement.js +1 -0
  182. package/dist/cli/commands/retirement.js.map +1 -1
  183. package/dist/cli/commands/self.js +33 -0
  184. package/dist/cli/commands/self.js.map +1 -1
  185. package/dist/cli/commands/session-artifacts.js +1 -0
  186. package/dist/cli/commands/session-artifacts.js.map +1 -1
  187. package/dist/cli/commands/session-close.js +129 -30
  188. package/dist/cli/commands/session-close.js.map +1 -1
  189. package/dist/cli/commands/session-create.js +1 -0
  190. package/dist/cli/commands/session-create.js.map +1 -1
  191. package/dist/cli/commands/session-resume.js +1 -0
  192. package/dist/cli/commands/session-resume.js.map +1 -1
  193. package/dist/cli/commands/sessions.js +1 -0
  194. package/dist/cli/commands/sessions.js.map +1 -1
  195. package/dist/cli/commands/set-branch.js +41 -6
  196. package/dist/cli/commands/set-branch.js.map +1 -1
  197. package/dist/cli/commands/settle.js +1 -0
  198. package/dist/cli/commands/settle.js.map +1 -1
  199. package/dist/cli/commands/skill-index.js +1 -0
  200. package/dist/cli/commands/skill-index.js.map +1 -1
  201. package/dist/cli/commands/skills.js +1 -0
  202. package/dist/cli/commands/skills.js.map +1 -1
  203. package/dist/cli/commands/sources.js +1 -0
  204. package/dist/cli/commands/sources.js.map +1 -1
  205. package/dist/cli/commands/stack.js +1 -0
  206. package/dist/cli/commands/stack.js.map +1 -1
  207. package/dist/cli/commands/status.js +1 -0
  208. package/dist/cli/commands/status.js.map +1 -1
  209. package/dist/cli/commands/tool.js +5 -21
  210. package/dist/cli/commands/tool.js.map +1 -1
  211. package/dist/cli/commands/unknown-flags.js +67 -16
  212. package/dist/cli/commands/unknown-flags.js.map +1 -1
  213. package/dist/cli/commands/visibility.js +1 -0
  214. package/dist/cli/commands/visibility.js.map +1 -1
  215. package/dist/cli/commands/workspace-init.js +12 -0
  216. package/dist/cli/commands/workspace-init.js.map +1 -1
  217. package/dist/cli/commands/workspace-migrate.js +2 -13
  218. package/dist/cli/commands/workspace-migrate.js.map +1 -1
  219. package/dist/cli/commands/worktree.js +1 -0
  220. package/dist/cli/commands/worktree.js.map +1 -1
  221. package/dist/cli/help-groups.js +41 -0
  222. package/dist/cli/help-groups.js.map +1 -1
  223. package/dist/cli/main.js +41 -58
  224. package/dist/cli/main.js.map +1 -1
  225. package/dist/cli/output-mode.js +11 -2
  226. package/dist/cli/output-mode.js.map +1 -1
  227. package/dist/cli/parser.js +14 -5
  228. package/dist/cli/parser.js.map +1 -1
  229. package/dist/cli/registry.js.map +1 -1
  230. package/dist/cli/render.js +30 -1
  231. package/dist/cli/render.js.map +1 -1
  232. package/dist/cli/tui/components/git-flow-actions.js +65 -20
  233. package/dist/cli/tui/components/git-flow-actions.js.map +1 -1
  234. package/dist/cli/tui/tabs/project-tab.js +101 -12
  235. package/dist/cli/tui/tabs/project-tab.js.map +1 -1
  236. package/dist/domain/changelog-contract.js +172 -0
  237. package/dist/domain/changelog-contract.js.map +1 -0
  238. package/dist/domain/database-tools.js +1 -189
  239. package/dist/domain/database-tools.js.map +1 -1
  240. package/dist/domain/flow/answer.js +11 -0
  241. package/dist/domain/flow/answer.js.map +1 -1
  242. package/dist/domain/flow/authority.js +153 -14
  243. package/dist/domain/flow/authority.js.map +1 -1
  244. package/dist/domain/flow/execution-result.js +78 -7
  245. package/dist/domain/flow/execution-result.js.map +1 -1
  246. package/dist/domain/flow/journey-baseline.js +131 -0
  247. package/dist/domain/flow/journey-baseline.js.map +1 -0
  248. package/dist/domain/flow/route.js.map +1 -1
  249. package/dist/domain/flow/rules.js +5 -6
  250. package/dist/domain/flow/rules.js.map +1 -1
  251. package/dist/domain/flow/run-state.js +440 -89
  252. package/dist/domain/flow/run-state.js.map +1 -1
  253. package/dist/domain/harnesses.js +8 -1
  254. package/dist/domain/harnesses.js.map +1 -1
  255. package/dist/domain/host-memory/model.js +2 -0
  256. package/dist/domain/host-memory/model.js.map +1 -0
  257. package/dist/domain/host-memory/provenance.js +43 -0
  258. package/dist/domain/host-memory/provenance.js.map +1 -0
  259. package/dist/domain/host-memory/topic.js +26 -0
  260. package/dist/domain/host-memory/topic.js.map +1 -0
  261. package/dist/domain/lineage.js +11 -3
  262. package/dist/domain/lineage.js.map +1 -1
  263. package/dist/domain/proposal.js +7 -0
  264. package/dist/domain/proposal.js.map +1 -1
  265. package/dist/domain/session/custody.js.map +1 -1
  266. package/dist/domain/sql-lexer.js +240 -0
  267. package/dist/domain/sql-lexer.js.map +1 -0
  268. package/package.json +2 -2
  269. package/skills/w/SKILL.md +9 -9
  270. package/skills/w/commands/README.md +2 -1
  271. package/skills/w/commands/recall.md +39 -0
  272. package/skills/w/context/MANIFEST.json +4 -0
  273. package/skills/w/harness/HARNESS.md +12 -6
  274. package/skills/w/hooks/README.md +27 -16
  275. package/skills/w/loops/CHASSIS.md +16 -12
  276. package/skills/w/loops/CODE-POLICIES.md +11 -6
  277. package/skills/w/loops/plan-exec-loop/LOOP.md +9 -9
  278. package/skills/w/modules/COMPACTION.md +1 -1
  279. package/skills/w/roles/design/CONTRACT.md +10 -3
@@ -1,9 +1,8 @@
1
1
  # CODE-POLICIES — policies for code-editing loops
2
2
 
3
3
  They apply to **`plan-exec-loop`** (per effective batch) and **`quick-loop`** (the single task;
4
- **proportional** gate): each reads this doc with the chassis, and no document loop loads it. These
5
- policies own the DB scripts-only, safe Git and closing-review invariants; code loops keep only a
6
- short inline floor for advisory hosts.
4
+ **proportional** gate), read with the chassis. They own the DB scripts-only, safe Git and
5
+ closing-review invariants.
7
6
 
8
7
  ## Safe git — verified branch + proposed commits
9
8
 
@@ -17,7 +16,7 @@ its internal phases in one reviewed commit, and no batch may co-mingle with anot
17
16
 
18
17
  Concurrent flows never share a working tree: a run declares its sources and takes an **isolation
19
18
  unit** in each before writing — a worktree on its own branch
20
- (`aw worktree ensure | list | release`), where branch and commits are read. An edit outside is
19
+ (`aw worktree ensure | list | release`). An edit outside is
21
20
  blocked naming the command that gets one, and at close `aw worktree integrate` merges each into
22
21
  the source's work branch; a conflict is reported, routed to `aw fix-git --path`, never alone.
23
22
 
@@ -29,16 +28,22 @@ After validation and before commits, the whole execution-unit diff passes a **cl
29
28
  gate**: an effective batch in plan-exec, or the proportional task in quick. Early `Cerrar` uses the
30
29
  same gate before any pending commit.
31
30
 
32
- - **Independent re-read** of the diff (subagent or clean re-read — the engine's *independent verification*: it does not assume the implementation is correct; *only command output counts*).
31
+ - **Independent re-read** of the diff — the engine's *independent verification*: it does not assume the implementation is correct; *only command output counts*. In `quick` a subagent reviewer is optional; `plan-exec` requires a distinct one (its Delta 5).
33
32
  - **Apply the installed ambient conventions** relevant to the touched stack (code/stack standards, security, diff review, the workspace's own families) — the host **auto-discovers them by `description`**. Workline **names and binds no** concrete conventions skill: **it creates the moment; the installed skills fill it** (that is why review is **not a role** — see [`../roles/README.md`](../roles/README.md)). With no convention skills installed → minimal generic checklist: SOLID/early-return, clear names, DRY, no silenced errors, no secrets/PII, parametrized SQL, no dead code, + the plan's `Validations` (if any).
34
33
  - **Minimality lens** (floor — holds with **no external skill**; chassis § *Minimality*): re-read the diff for over-building. Flag `delete` (dead/speculative code), `stdlib` (reinvented standard library), `native` (a dep or code doing what the platform already does), `yagni` (one-implementation abstraction, config nobody sets, one-caller layer), `shrink` (same behavior, fewer lines). An installed ambient review skill *raises* this; it never lowers it.
35
34
  - **Test-value lens** (floor, next to minimality): every test the diff adds must demonstrate an observable behavior, protect a business rule, verify a contract, exercise a real integration or prevent a known regression. Flag `overtest` for the ones that only mirror structure — a test per class or method, mocked call chains, the same happy path re-asserted at every layer, trivial getters/setters/mappers, cases written for coverage, broad snapshots where a functional assertion is clearer. Bounded by *Gate integrity*: `overtest` prunes redundancy, **never** a check that guards behavior, a trust boundary, security or accessibility.
36
35
  - **Temporary simulation check** (only when the change carries one): stubs, fakes and in-memory adapters are **explicit and named as such** (`Stub…` / `Fake…`), they sit at the boundary the plan declares, and no configuration can select them in a production runtime. A simulation still active on the main path with no declared removal is a finding, not a detail.
37
- - **Tooling check** (`docs/tools`): did the run create **reusable auxiliary tooling** (support scripts/CLIs/generators/reusable configs — not product code, not session probes)? → the host applies the **ambient `creating-tools` skill** (auto-discovered by its `description`; Workline does not bind it) so the tool gets its home under `docs/tools/<slug>/` (README + run/output structure per that skill's contract + its index row). Host without such a skill → the loop still **never writes `docs/tools` itself**: **declare the gap** — the homeless tool goes to the plan's `Open questions` + `BACKLOG` (in quick, `BACKLOG`) — never silent.
36
+ - **Tooling check** (`docs/tools`): did the run create **reusable auxiliary tooling** (support scripts/CLIs/generators/reusable configs — not product code, not session probes)? → the host applies the **ambient `creating-tools` skill** (auto-discovered; Workline does not bind it), which homes it under `docs/tools/<slug>/` per its contract. Host without such a skill → the loop still **never writes `docs/tools` itself**: **declare the gap** — the homeless tool goes to the plan's `Open questions` + `BACKLOG` (in quick, `BACKLOG`) — never silent.
38
37
  - **Findings**: **fix** them in the working tree and **re-run validation** (the gate does not replace the tests: it re-verifies after fixing), or **defer them justified** (→ the plan's `Open questions` + `BACKLOG`; in quick, `BACKLOG`); the non-obvious → `DECISION`. Gate integrity (see [`CHASSIS.md`](CHASSIS.md) § *Verification-first*): never weaken a check or lower a convention to pass.
39
38
  - **Artifact-first + verification-first**: seed `CHECKPOINT.Next = "review <batch/task>"`; Success
40
39
  criteria require the whole diff to pass before commits.
41
40
 
41
+ **Close first, follow up on demand.** Before the commit only the validations and this review run;
42
+ nothing waits on exploration. After commit and integration the report offers a parallel follow-up
43
+ that probes what was delivered, in one line. It runs only if the user asks; its agents never modify
44
+ the delivered work nor commit. Each finding comes back as a ready `/w:quick`, without reopening the
45
+ closed document or session. A host without subagents runs it inline.
46
+
42
47
  ## Conditional modules
43
48
 
44
49
  - `db` — the DB scripts-only rule → `../modules/DB-SCRIPTS-ONLY.md`
@@ -46,13 +46,9 @@ inference, the deferred-validation cycle and conditional Git authorization.
46
46
 
47
47
  `git` (safe branch + proposed commits). `plan-exec` does **not** load `external-data`: its proof comes from the acquired checkout only. SQL fixture/ephemeral tests are ordinary local commands; remote MCP reads belong to earlier research, never this loop.
48
48
 
49
- > **Ambient conventions (not roles):** code/testing/writing standards and `creating-tools` are standalone skills the host auto-discovers by `description` — Workline neither binds nor depends on them. Full doctrine: [../../roles/README.md](../../roles/README.md).
50
-
51
49
  ## Internal sessions (managed)
52
50
 
53
- - **plan-exec session** descriptor `<slug>-plan-exec` → `NNN-<slug>-plan-exec` (the `<slug>` comes from the input plan-doc `docs/plans/PPP-plan-<slug>.md`): **a single session per run** (Type = `exec`). Owns the run; holds `SESSION` + `CHECKPOINT` + `DECISION` + `SCRIPTS.sql` (+ `BACKLOG` only if something is deferred). Research is **inline** inside this session: it produces `ANALYSIS-FILE`/`CONCLUSIONS` (+ read-only `SCRIPTS.sql` if it queries DB) in its own folder.
54
-
55
- > **Numbering**: the caller passes only the descriptor; the CLI prepends the global sequential `NNN` over `.workflow/sessions/` (see chassis). It never restarts per type.
51
+ - **plan-exec session** descriptor `<slug>-plan-exec` → `NNN-<slug>-plan-exec` (the `<slug>` comes from the input plan-doc `docs/plans/PPP-plan-<slug>.md`): **a single session per run** (Type = `exec`). Owns the run; holds `SESSION` + `CHECKPOINT` + `DECISION` + `SCRIPTS.sql` (+ `BACKLOG` only if something is deferred). Research runs inside this session and produces `ANALYSIS-FILE`/`CONCLUSIONS` (+ read-only `SCRIPTS.sql` if it queries DB) in its own folder.
56
52
 
57
53
  > **Compat (legacy):** old workspaces may hold `plan-exec-phase-*` sessions (one per phase) and `*-research-*` ones — historical, left as-is; new runs use a single session.
58
54
 
@@ -243,10 +239,14 @@ adds nothing of its own beyond running on a verified branch and never
243
239
 
244
240
  ## Delta 5 — Closing review gate (conventions, pre-commit)
245
241
 
246
- Full gate in [`../CODE-POLICIES.md`](../CODE-POLICIES.md): independent re-read, ambient
247
- conventions and the floor lenses. It covers the execution unit's **whole** diff after every phase
248
- proof/check and before states or Git advance. Findings are fixed and the affected checks rerun, or
249
- deferred with justification when they are not blockers.
242
+ Full gate in [`../CODE-POLICIES.md`](../CODE-POLICIES.md). It covers the execution unit's **whole**
243
+ diff after every phase proof/check and before states or Git advance. Findings are fixed and the
244
+ affected checks rerun, or deferred with justification when they are not blockers.
245
+
246
+ **Distinct reviewer (hard rule).** Every batch close is reviewed by a reviewer other than its
247
+ author: neither whoever wrote the diff nor any of its implementers. The round that fixes its
248
+ findings goes back, before the commit, to a reviewer who wrote neither the diff nor the fix. A host
249
+ without subagents runs a clean re-read instead, and the closing report declares it.
250
250
 
251
251
  ## Delta 6 — Completion / close
252
252
 
@@ -4,6 +4,6 @@ Loaded when the run is long enough that context pressure governs its pacing (sig
4
4
 
5
5
  `Compactar` is not only reactive: the loop **watches its own context pressure** and raises compaction itself. Recognizing that pressure is judgment — the host's signal where it exists (*compaction* capability in [`../harness/HARNESS.md`](../harness/HARNESS.md)), otherwise the **qualitative** question *"would a fresh reader need the CHECKPOINT to continue?"* at a boundary of an already-long run. Doctrine fixes **no numeric thresholds**: a number that means anything is a number about one host.
6
6
 
7
- > **Whether the host can honour it is not this document's call:** `aw checkpoint-write` writes the CHECKPOINT and **never holds the compaction back** — there is no configurable mode; an ambiguity degrades and parks a refuge checkpoint to adopt later. **CHECKPOINT before compacting** is the invariant. What this document keeps is why: consent lives in the `Compactar` control a person ratifies, and a compaction that fires before the checkpoint loses the thread it was meant to protect.
7
+ > **Whether the host can honour it is not this document's call:** `aw checkpoint-write` with `--code <NNN>` writes the CHECKPOINT and **never holds the compaction back** — no configurable mode; unresolved, it parks a refuge checkpoint to adopt later. **CHECKPOINT before compacting** is the invariant. What this document keeps is why: consent lives in the `Compactar` control a person ratifies, and a compaction that fires before the checkpoint loses the thread it was meant to protect.
8
8
 
9
9
  > **`Compactar`** (the `flow` control) → write `CHECKPOINT.md` in the session (in-flight progress, remaining gaps, Q&A, `attempts`) → trigger the harness **compaction** (Claude Code: `/compact`; see [`../harness/HARNESS.md`](../harness/HARNESS.md)) → resume by reading the checkpoint.
@@ -12,11 +12,18 @@ This file is what a person or a loop reads.
12
12
 
13
13
  ```
14
14
  aw capability prepare --capability design --operation <op> [--input k=v ...]
15
- aw capability continue # stdin: {"parent": <request>}
16
- aw capability validate # stdin: {"request": …, "answer": …}
17
- aw capability apply --approval <digest> # stdin: {"request": …, "plan": …}
15
+ aw capability continue --capability design --operation <op> [--input k=v ...] # stdin: {"parent": <request>}
16
+ aw capability validate --capability design --operation <op> [--input k=v ...] # stdin: {"request": …, "answer": …}
17
+ aw capability apply --capability design --operation <op> [--input k=v ...] --approval <plan.proposal.digest> # stdin: {"request": …, "plan": …, "pin": …}
18
18
  ```
19
19
 
20
+ Repeat the same `--capability`, `--operation`, every `--input` and
21
+ `--consumer-document` (if used) at each stage. Carry the response as one JSON
22
+ object on stdin; `prepare` reads no stdin and `pin` is optional. Approval is the
23
+ digest of `plan.proposal.digest`. Read `aw capability --help` for the full envelope.
24
+ Shared wrappers have no host binding: if `aw harness` returns `unknown`, pass
25
+ `--host <id>` at every stage.
26
+
20
27
  The verbs are **stages**, never operations: the operation travels in the
21
28
  envelope. Every attempt returns `outcome`, `output` and `receipt`. A
22
29
  `needs_input` is answered with `continue`, which builds the NEXT attempt of the