@tacuchi/agent-workflow-cli 20.26.0 → 21.1.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 (220) hide show
  1. package/README.md +2 -1
  2. package/dist/adapters/node-file-system.js +3 -0
  3. package/dist/adapters/node-file-system.js.map +1 -1
  4. package/dist/application/capability/compose.js +161 -0
  5. package/dist/application/capability/compose.js.map +1 -0
  6. package/dist/application/capability/descriptor-loader.js +109 -0
  7. package/dist/application/capability/descriptor-loader.js.map +1 -0
  8. package/dist/application/capability/design-handler.js +299 -0
  9. package/dist/application/capability/design-handler.js.map +1 -0
  10. package/dist/application/capability/dispatcher.js +312 -0
  11. package/dist/application/capability/dispatcher.js.map +1 -0
  12. package/dist/application/capability/durable-effect.js +220 -0
  13. package/dist/application/capability/durable-effect.js.map +1 -0
  14. package/dist/application/capability/installed-inventory.js +168 -0
  15. package/dist/application/capability/installed-inventory.js.map +1 -0
  16. package/dist/application/capability/readiness.js +204 -0
  17. package/dist/application/capability/readiness.js.map +1 -0
  18. package/dist/application/capability/resolution.js +264 -0
  19. package/dist/application/capability/resolution.js.map +1 -0
  20. package/dist/application/capability/wrapper.js +187 -0
  21. package/dist/application/capability/wrapper.js.map +1 -0
  22. package/dist/application/context/manifest.js +11 -5
  23. package/dist/application/context/manifest.js.map +1 -1
  24. package/dist/application/context/measure.js +5 -2
  25. package/dist/application/context/measure.js.map +1 -1
  26. package/dist/application/context/plan-service.js +6 -6
  27. package/dist/application/context/plan-service.js.map +1 -1
  28. package/dist/application/design/design-bundle-service.js +148 -0
  29. package/dist/application/design/design-bundle-service.js.map +1 -0
  30. package/dist/application/design/design-gate-service.js +246 -0
  31. package/dist/application/design/design-gate-service.js.map +1 -0
  32. package/dist/application/design/design-graph-service.js +85 -0
  33. package/dist/application/design/design-graph-service.js.map +1 -0
  34. package/dist/application/design/design-index-service.js +132 -0
  35. package/dist/application/design/design-index-service.js.map +1 -0
  36. package/dist/application/design/design-proposal-service.js +69 -0
  37. package/dist/application/design/design-proposal-service.js.map +1 -0
  38. package/dist/application/design/design-publish-service.js +756 -0
  39. package/dist/application/design/design-publish-service.js.map +1 -0
  40. package/dist/application/design/design-record-service.js +100 -0
  41. package/dist/application/design/design-record-service.js.map +1 -0
  42. package/dist/application/design/design-resolver-service.js +165 -0
  43. package/dist/application/design/design-resolver-service.js.map +1 -0
  44. package/dist/application/flow/advance.js +533 -0
  45. package/dist/application/flow/advance.js.map +1 -0
  46. package/dist/application/flow/flow-service.js +65 -0
  47. package/dist/application/flow/flow-service.js.map +1 -0
  48. package/dist/application/flow/run-projection.js +80 -0
  49. package/dist/application/flow/run-projection.js.map +1 -0
  50. package/dist/application/flow/run-state-service.js +107 -0
  51. package/dist/application/flow/run-state-service.js.map +1 -0
  52. package/dist/application/flow/submit.js +423 -0
  53. package/dist/application/flow/submit.js.map +1 -0
  54. package/dist/application/resume-service.js +46 -14
  55. package/dist/application/resume-service.js.map +1 -1
  56. package/dist/application/self/install-skill.js +11 -0
  57. package/dist/application/self/install-skill.js.map +1 -1
  58. package/dist/application/self/uninstall.js +21 -0
  59. package/dist/application/self/uninstall.js.map +1 -1
  60. package/dist/application/semantic-operation/protocol.js +18 -12
  61. package/dist/application/semantic-operation/protocol.js.map +1 -1
  62. package/dist/application/semantic-operation/publish.js +56 -9
  63. package/dist/application/semantic-operation/publish.js.map +1 -1
  64. package/dist/application/skills-resolver-service.js +27 -6
  65. package/dist/application/skills-resolver-service.js.map +1 -1
  66. package/dist/application/status-service.js +5 -1
  67. package/dist/application/status-service.js.map +1 -1
  68. package/dist/application/workline-index-service.js +6 -0
  69. package/dist/application/workline-index-service.js.map +1 -1
  70. package/dist/application/workspace-init-service.js +22 -2
  71. package/dist/application/workspace-init-service.js.map +1 -1
  72. package/dist/cli/commands/capability.js +182 -0
  73. package/dist/cli/commands/capability.js.map +1 -0
  74. package/dist/cli/commands/designs.js +110 -0
  75. package/dist/cli/commands/designs.js.map +1 -0
  76. package/dist/cli/commands/flow.js +71 -0
  77. package/dist/cli/commands/flow.js.map +1 -0
  78. package/dist/cli/commands/index.js +6 -0
  79. package/dist/cli/commands/index.js.map +1 -1
  80. package/dist/cli/commands/resume.js +8 -0
  81. package/dist/cli/commands/resume.js.map +1 -1
  82. package/dist/cli/commands/skills.js +55 -2
  83. package/dist/cli/commands/skills.js.map +1 -1
  84. package/dist/cli/commands/status.js +50 -0
  85. package/dist/cli/commands/status.js.map +1 -1
  86. package/dist/cli/help-groups.js +9 -0
  87. package/dist/cli/help-groups.js.map +1 -1
  88. package/dist/cli/parser.js +7 -0
  89. package/dist/cli/parser.js.map +1 -1
  90. package/dist/cli/tui/data/workflow-content.js +5 -0
  91. package/dist/cli/tui/data/workflow-content.js.map +1 -1
  92. package/dist/cli/tui/tabs/workflow-tab.js +5 -1
  93. package/dist/cli/tui/tabs/workflow-tab.js.map +1 -1
  94. package/dist/domain/capability/descriptor.js +553 -0
  95. package/dist/domain/capability/descriptor.js.map +1 -0
  96. package/dist/domain/capability/effects.js +90 -0
  97. package/dist/domain/capability/effects.js.map +1 -0
  98. package/dist/domain/capability/protocol.js +494 -0
  99. package/dist/domain/capability/protocol.js.map +1 -0
  100. package/dist/domain/contract-reader.js +84 -0
  101. package/dist/domain/contract-reader.js.map +1 -0
  102. package/dist/domain/design/adapter.js +161 -0
  103. package/dist/domain/design/adapter.js.map +1 -0
  104. package/dist/domain/design/artifact-body.js +223 -0
  105. package/dist/domain/design/artifact-body.js.map +1 -0
  106. package/dist/domain/design/artifact.js +750 -0
  107. package/dist/domain/design/artifact.js.map +1 -0
  108. package/dist/domain/design/baseline.js +359 -0
  109. package/dist/domain/design/baseline.js.map +1 -0
  110. package/dist/domain/design/capability.js +310 -0
  111. package/dist/domain/design/capability.js.map +1 -0
  112. package/dist/domain/design/closure.js +161 -0
  113. package/dist/domain/design/closure.js.map +1 -0
  114. package/dist/domain/design/direct.js +108 -0
  115. package/dist/domain/design/direct.js.map +1 -0
  116. package/dist/domain/design/external-send.js +65 -0
  117. package/dist/domain/design/external-send.js.map +1 -0
  118. package/dist/domain/design/governance.js +298 -0
  119. package/dist/domain/design/governance.js.map +1 -0
  120. package/dist/domain/design/identity.js +145 -0
  121. package/dist/domain/design/identity.js.map +1 -0
  122. package/dist/domain/design/manifest.js +552 -0
  123. package/dist/domain/design/manifest.js.map +1 -0
  124. package/dist/domain/design/maturity.js +305 -0
  125. package/dist/domain/design/maturity.js.map +1 -0
  126. package/dist/domain/design/naming.js +117 -0
  127. package/dist/domain/design/naming.js.map +1 -0
  128. package/dist/domain/design/offline.js +92 -0
  129. package/dist/domain/design/offline.js.map +1 -0
  130. package/dist/domain/design/profiles.js +212 -0
  131. package/dist/domain/design/profiles.js.map +1 -0
  132. package/dist/domain/design/projections.js +165 -0
  133. package/dist/domain/design/projections.js.map +1 -0
  134. package/dist/domain/design/proposal.js +234 -0
  135. package/dist/domain/design/proposal.js.map +1 -0
  136. package/dist/domain/design/reference.js +234 -0
  137. package/dist/domain/design/reference.js.map +1 -0
  138. package/dist/domain/design/render-bundle.js +0 -0
  139. package/dist/domain/design/render-bundle.js.map +1 -0
  140. package/dist/domain/design/rendition.js +472 -0
  141. package/dist/domain/design/rendition.js.map +1 -0
  142. package/dist/domain/design/retired.js +61 -0
  143. package/dist/domain/design/retired.js.map +1 -0
  144. package/dist/domain/design/revision.js +219 -0
  145. package/dist/domain/design/revision.js.map +1 -0
  146. package/dist/domain/design/secrets.js +86 -0
  147. package/dist/domain/design/secrets.js.map +1 -0
  148. package/dist/domain/design/sources.js +180 -0
  149. package/dist/domain/design/sources.js.map +1 -0
  150. package/dist/domain/design/validation.js +19 -0
  151. package/dist/domain/design/validation.js.map +1 -0
  152. package/dist/domain/design/visual-evidence.js +155 -0
  153. package/dist/domain/design/visual-evidence.js.map +1 -0
  154. package/dist/domain/design/yaml-subset.js +390 -0
  155. package/dist/domain/design/yaml-subset.js.map +1 -0
  156. package/dist/domain/flow/answer.js +459 -0
  157. package/dist/domain/flow/answer.js.map +1 -0
  158. package/dist/domain/flow/authority.js +2276 -0
  159. package/dist/domain/flow/authority.js.map +1 -0
  160. package/dist/domain/flow/authorization.js +62 -0
  161. package/dist/domain/flow/authorization.js.map +1 -0
  162. package/dist/domain/flow/directive.js +421 -0
  163. package/dist/domain/flow/directive.js.map +1 -0
  164. package/dist/domain/flow/rules.js +140 -0
  165. package/dist/domain/flow/rules.js.map +1 -0
  166. package/dist/domain/flow/run-state.js +317 -0
  167. package/dist/domain/flow/run-state.js.map +1 -0
  168. package/dist/domain/harnesses.js +21 -0
  169. package/dist/domain/harnesses.js.map +1 -1
  170. package/dist/domain/safe-path.js +23 -0
  171. package/dist/domain/safe-path.js.map +1 -0
  172. package/dist/domain/skills.js +26 -3
  173. package/dist/domain/skills.js.map +1 -1
  174. package/package.json +1 -1
  175. package/skills/w/SKILL.md +15 -13
  176. package/skills/w/artifacts/README.md +3 -4
  177. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
  178. package/skills/w/commands/plan-exec.md +11 -5
  179. package/skills/w/commands/plan-new.md +6 -2
  180. package/skills/w/commands/plan-refine.md +6 -3
  181. package/skills/w/commands/quick.md +2 -2
  182. package/skills/w/commands/spec-new.md +2 -2
  183. package/skills/w/commands/spec-refine.md +1 -0
  184. package/skills/w/context/MANIFEST.json +57 -9
  185. package/skills/w/harness/HARNESS.md +20 -0
  186. package/skills/w/loops/CHASSIS.md +11 -20
  187. package/skills/w/loops/CODE-POLICIES.md +18 -9
  188. package/skills/w/loops/README.md +1 -1
  189. package/skills/w/loops/plan-exec-loop/LOOP.md +126 -62
  190. package/skills/w/loops/plan-new-loop/LOOP.md +71 -73
  191. package/skills/w/loops/plan-refine-loop/LOOP.md +20 -10
  192. package/skills/w/loops/quick-loop/LOOP.md +18 -26
  193. package/skills/w/loops/spec-refine-loop/LOOP.md +28 -30
  194. package/skills/w/modules/COMPACTION.md +2 -6
  195. package/skills/w/modules/DB-SCRIPTS-ONLY.md +2 -0
  196. package/skills/w/modules/DESIGN-REFERENCES.md +113 -0
  197. package/skills/w/modules/IDEATION-GATE.md +3 -3
  198. package/skills/w/modules/PERSIST-ROUTING.md +1 -0
  199. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +65 -0
  200. package/skills/w/modules/PLAN-INPUT.md +5 -3
  201. package/skills/w/modules/PLAN-REFINE-SPLIT.md +3 -1
  202. package/skills/w/modules/PLAN-SPLIT-GATE.md +7 -5
  203. package/skills/w/modules/PROMPT-CONTINUITY.md +3 -1
  204. package/skills/w/modules/SPEC-CHANGE-SHAPE.md +4 -4
  205. package/skills/w/roles/README.md +9 -5
  206. package/skills/w/roles/design/CONTRACT.md +80 -0
  207. package/skills/w/roles/design/ROLE.md +224 -0
  208. package/skills/w/schemas/capability-descriptor.schema.json +260 -0
  209. package/skills/w/schemas/design/design-baseline.v1.schema.json +71 -0
  210. package/skills/w/schemas/design/design-manifest.v1.schema.json +322 -0
  211. package/skills/w/schemas/design/design-render-bundle.v1.schema.json +191 -0
  212. package/skills/w/schemas/design/design-rendition.v1.schema.json +232 -0
  213. package/skills/w/schemas/design/design-review.v1.schema.json +72 -0
  214. package/skills/w/schemas/design/design-revocation.v1.schema.json +54 -0
  215. package/skills/w/schemas/design/ui-flow.v1.schema.json +211 -0
  216. package/skills/w/schemas/design/ui-screen.v1.schema.json +242 -0
  217. package/skills/w/artifacts/artifacts-design/SPEC.md +0 -42
  218. package/skills/w/modules/PLAN-DESIGN-SPECS.md +0 -12
  219. package/skills/w/modules/PLAN-REFINE-DESIGN-SPECS.md +0 -7
  220. package/skills/w/roles/ui-spec/ROLE.md +0 -147
@@ -5,8 +5,8 @@ description: >-
5
5
  spec. Heir of the chassis (loops/CHASSIS.md). Deltas: the plan absorbs the
6
6
  TECHNICAL-NOTE level + Tasks phased by verifiable functional state
7
7
  (### Fn blocks with live state),
8
- code/impact-mapping research, planning gap taxonomy, and per-screen design
9
- SPECs via ui-design
8
+ code/impact-mapping research, planning gap taxonomy, and promotion of the
9
+ design closure to handoff via `design`
10
10
  when the plan includes UI. If the spec is not refined it suggests
11
11
  spec-refine first. Started by /w:plan-new; resumable. Invoke when a spec
12
12
  must become an executable plan.
@@ -26,12 +26,12 @@ PLAN
26
26
  `/w:plan-new` — **resumable** (same chassis mechanism, keyed off CHECKPOINT).
27
27
 
28
28
  ## Reads
29
- `docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Ready vs not** is read from the spec's frontmatter `status`: `ready-for-plan` proceed (legacy compat: a frontmatter-less spec carrying `## Refinement decisions`, or the older `## Q&A traceability`, counts as ready). Otherwise **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), **never a block**: the user may proceed. Questions the spec left with destination `PLAN` are **input to this loop**, not a reason to send it back.
29
+ `docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Ready vs not** is read from the spec's frontmatter `status`, never from the filename, and a spec that is not ready is a **soft suggestion** to refine first, never a block the four input modes are in [`PLAN-INPUT`](../../modules/PLAN-INPUT.md). Questions the spec left with destination `PLAN` are **input to this loop**, not a reason to send it back.
30
30
 
31
31
  ## Writes
32
- `docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists) — or **several sibling plans** when an accepted split applies (§ *Split gate (multi-plan)*). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the plan **includes UI**, it also produces **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its session** (see *Delta 4* they are not `docs/`, no auto-export).
32
+ `docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists) — or **several sibling plans** when an accepted split applies (§ *Split gate (multi-plan)*). With UI, also the design revision it publishes under `docs/designs` (chassis § *docs/ boundary*). It never graduates/exports anything else to `docs/`that is separate `export-*` work.
33
33
 
34
- > **slug**: short kebab-case derived from the spec's Requirement — only `[a-z0-9-]`, ≤ ~5 words / 40 chars. `aw next-number docs/plans` returns JSON (field `next` = `PPP`); the loop builds the full name. To locate plans, glob `docs/plans/PPP-plan-*.md`.
34
+ > **Naming** follows [`PLAN-INPUT`](../../modules/PLAN-INPUT.md) § *Numbering*: `aw next-number docs/plans` mints `PPP` and the slug is short kebab-case from the Requirement. To locate plans, glob `docs/plans/PPP-plan-*.md`.
35
35
 
36
36
  > **Adoption (command mode 4):** an **externally-built plan** (host plan mode, hand-written, another agent) is materialized by the **command** in a single pass — this loop does not run: transcribe + normalize into the Delta 1 schema, `## Origin` = "adopted from <source>" + attribution; then `plan-refine` closes schema gaps (its coherence gate degrades for spec-less plans). See `../../modules/PLAN-INPUT.md` (the command's `input` module).
37
37
 
@@ -49,80 +49,72 @@ Full doctrine in the chassis (§ *Internal sessions* + *Numbering*). This loop's
49
49
 
50
50
  ## Delta 1 — Deliverable: the RICH PLAN (`PPP-plan-<slug>.md`)
51
51
 
52
- The plan absorbs the `TECHNICAL-NOTE` level **inline** (user decision) + the roadmap:
52
+ The plan keeps technical detail and roadmap inline:
53
53
 
54
54
  ```markdown
55
55
  # Plan PPP — <slug>
56
56
 
57
57
  > Derived from docs/specs/NNN-spec-<slug>.md · generated by plan-new-loop
58
- > Estado: open ← plan-level machine state (open | done); plan-exec closes it
59
-
60
- ## Origin source spec · prompt (bootstrapped via spec-new) · "adopted from <source>" + attribution (external plan — /w:plan-new mode 4 / /w:persist)
61
- ## Solution the how (core): 1–2 summary sentences + the AS-IS → TO-BE
62
- delta (current vs target wiring, brief) + a closing
63
- "Final behavior" block how the flow behaves at the end,
64
- aligned with the spec criteria. One narration, not four.
65
- ## Impacted FE · BE · DB (schemas/tables/functions) · APIs · integr. (core)
66
- ## Dependencies docs / sources / databases / sessions · inter-plan order on a split (opt.)
67
- ## Tasks (core) `### Fn <name>` blocks per the phase contract
68
- below: each one a verifiable functional state with its
69
- `> Estado:` line, its evidence and its `- [ ] Tn.m`
70
- units of purpose never a list of layers or files.
71
- The `### Fn` headers are the ONLY source of phases;
72
- there is no separate Phases table.
73
- ## Validations validations / constraints / business logic (core)
74
- ## Risks / impact technical risks and impacts (opt.)
75
- ## Assumptions assumptions — only the delta over the spec, never re-imported (opt.)
76
- ## Open questions pending — core when any exist; OMIT the section when empty
58
+ > Estado: open
59
+
60
+ ## Origin source spec/prompt or adopted source + attribution
61
+ ## Solution the how: brief AS-IS → TO-BE + closing "Final behavior" block (core)
62
+ ## Impacted FE · BE · DB · APIs · integrations (core)
63
+ ## Dependencies docs · sources · DBs · sessions · inter-plan order (opt.)
64
+ ## Design references the baselines this plan's roots pin (opt. only with UI)
65
+ ## Tasks `### Fn` blocks: the ONLY source of phases (core)
66
+ ## Execution batches complete phase partition; contract in PLAN-EXECUTION-BATCHES (core)
67
+ ## Validations cross-cutting validations and constraints (core)
68
+ ## Risks / impact technical risks and impacts (opt.)
69
+ ## Assumptions delta over the spec only (opt.)
70
+ ## Open questions pending; core when any exist; OMIT the section when empty
77
71
  ```
78
72
 
79
- > **Scales with complexity:** the `(core)` sections go **always**; the `(opt.)` ones only when the plan warrants them — a small plan may omit `Dependencies`, `Risks`, `Assumptions`. Concise > exhaustive. *(Legacy plans: `Summary`, `Current state (AS-IS)`, `Target state (TO-BE)`, `Final behavior`, `Phases` and `Estimated time` existed as separate sections — readers tolerate both shapes; new plans never write them.)*
73
+ Core sections always appear; optional ones only when warranted. Legacy readers tolerate the old
74
+ separate sections. New plans never write them. The exec session has no `TECHNICAL-NOTE` or own
75
+ `TASKS`: detail and progress live in this plan.
80
76
 
81
- > **Catalog implication:** `TECHNICAL-NOTE` stops being a session artifact and becomes **sections of the plan-doc**. Reconciled in [`plan-exec-loop`](../plan-exec-loop/LOOP.md): the single plan-exec session carries **no** `TECHNICAL-NOTE` nor its own `TASKS`; the technical detail and the progress live inline in the plan-doc (living).
77
+ Batch syntax, inference and runtime semantics are defined once in
78
+ [`PLAN-EXECUTION-BATCHES`](../../modules/PLAN-EXECUTION-BATCHES.md).
82
79
 
83
80
  ## Phase contract (canonical)
84
81
 
85
- A `### Fn` block is a **verifiable state of the system**, never a list of layers, files or classes. It answers one question: *what can the system do or demonstrate at the end that it could not at the start?* The contract is defined **once** here — [`plan-refine-loop`](../plan-refine-loop/LOOP.md) and [`plan-exec-loop`](../plan-exec-loop/LOOP.md) reference it and never redefine it.
86
-
87
- **Required — every phase, always:**
82
+ A `### Fn` block is a **verifiable state of the system**, never a list of layers, files or classes.
83
+ This is the single contract; the other PLAN loops reference it.
88
84
 
89
85
  ```markdown
90
86
  ### F1 — <result-oriented name>
91
-
92
87
  > Estado: pendiente
93
88
 
94
89
  **Resultado:** <the new verifiable state of the system>
95
-
96
90
  **Trabajo:**
97
91
  - [ ] T1.1 — <coherent unit of work>
98
-
99
92
  **Validación de fase:** <the primary proof that the promised state was reached>
100
-
101
93
  **Condición de salida:** <falsifiable result · contract preserved>
102
94
  ```
103
95
 
104
- **Conditional added to that block only when its own condition holds:**
96
+ **Required**: `Resultado` · `Trabajo` · `Validación de fase` · `Condición de salida` · the state
97
+ line. **Conditional**: `Estado inicial` when unclear · `Recorrido afectado` for a distributed
98
+ change · `Dependencias` when direct sequence is insufficient · `Límite de simulación` (**only** when temporary behavior exists) · `Diferido` when work was consciously excluded.
99
+ **A new phase never writes an empty conditional block.**
105
100
 
106
- ```markdown
107
- **Estado inicial:** <where the phase starts>
108
- **Recorrido afectado:** <consumer components current boundary>
109
- **Dependencias:** <phase(s) that must land first>
110
- **Límite de simulación:** antes <where it is> después <where it lands, or removed>
111
- **Diferido:** <work consciously reserved for another phase>
112
- ```
113
-
114
- - **Required**: `Resultado` · `Trabajo` · `Validación de fase` · `Condición de salida`, plus the `> Estado:` line.
115
- - **Conditional**: `Estado inicial` (when it is not obvious) · `Recorrido afectado` (distributed change) · `Dependencias` (the phase cannot run in direct sequence) · `Límite de simulación` (**only** when temporary behavior exists) · `Diferido` (only when work was consciously excluded).
116
-
117
- **A new phase never writes an empty conditional block.** No temporary behavior in the change → no `Límite de simulación` line at all; nothing consciously excluded → no `Diferido`. Writing the label with `no aplica` under it is the failure mode this split exists to prevent: it invites inventing a stub to justify the heading, and turns a contract into a form to fill in. The gates check the same way — an absent conditional block is not a gap (§ *Convergence / exit*).
101
+ **Phase state = machine state.** One bare `> Estado: <value>` line uses `pendiente` | `en ejecución`
102
+ | `bloqueada` | `validada`. It is updated in place and counted
103
+ **alongside not instead of —** checkboxes. `validada` requires completed work, a true exit
104
+ condition, its validation **ran and passed**, and a green review gate. **Never** because all its checkboxes are ticked.
105
+ Legacy blocks have no line; a missing one reads `pendiente`, and nothing is back-filled.
118
106
 
119
- **Phase state = machine state.** One `> Estado: <value>` line directly under the `### Fn` heading; vocabulary `pendiente` | `en ejecución` | `bloqueada` | `validada`, updated **in place**, never duplicated. It is what `aw status` counts (`phases_validated` / `phases_total`), **alongside — not instead of —** the checkbox progress. A phase reaches `validada` only when its work is done, its `Condición de salida` holds, its validation **ran and passed**, and the closing review gate passed. **Never** because all its checkboxes are ticked. *(Legacy plans carry no line at all: `aw status` reports them as zero phases — checkbox progress only. A missing line among stated blocks reads `pendiente`, and nothing is back-filled.)*
107
+ **The state line carries its value alone**; an annotated value reads as `pendiente`. A blocker
108
+ uses its own `> Bloqueo: <reason>` line and the session records.
120
109
 
121
- **The state line carries its value alone** no comment, no suffix, no annotation; an annotated value reads as `pendiente`. A blocker's reason lives on its own `> Bloqueo: <reason>` line inside the block, and in `CHECKPOINT`, `## Open questions` and `BACKLOG`.
110
+ **The plan carries its own state, and it is a different axis.** Its title-level value is `open` | `done`;
111
+ only final validation writes `done` plus `> Cierre: YYYY-MM-DD · sesión NNN`.
112
+ Position disambiguates the two marks. `done` with open work is `inconsistent`; all phases green without
113
+ closure is `final_validation_pending`.
122
114
 
123
- **The plan carries its own state, and it is a different axis.** One `> Estado:` line under the title, vocabulary `open` | `done`, born `open` with the plan; `plan-exec` writes `done` only after the final validation, adding a `> Cierre: YYYY-MM-DD · sesión NNN` line for the date and session (§ *Delta 6* there). `aw status` derives `plan_state` from that declaration **and** both counters: a `done` over open tasks or unvalidated phases reads `inconsistent`, and every phase `validada` with no closure reads `final_validation_pending` — still open. Position disambiguates the two marks: the plan-level one lives under the title, the phase-level one inside its `### Fn` block. *(Legacy: `> Estado: done — YYYY-MM-DD · sesión NNN` is still read; the next legitimate write normalizes it.)*
124
-
125
- **Granularity is semantic, not mechanical.** A phase earns its place when it leaves a demonstrable state, can be reviewed as a unit, and — when the change carries temporary behavior — moves or retires a simulation. A task is a **coherent unit of purpose** and may touch several files. Naming an edit operation — "create class X", "add method Y", "update the import" — describes a **micro step**: internal to execution, recorded in `CHECKPOINT` when a resume needs it, never a plan entry. `XS–S` stays an orientation of risk and scope; it never mandates splitting a semantic task into mechanical operations.
115
+ **Granularity is semantic, not mechanical.** A phase leaves a demonstrable state. A task is a
116
+ coherent purpose and may touch many files; an edit operation is a **micro step**, never a plan
117
+ entry. `XS–S` informs risk and scope but does not force mechanical splitting.
126
118
 
127
119
  ## Delta 2 — Gap taxonomy (of "plan")
128
120
 
@@ -140,17 +132,19 @@ Replaces the spec gap taxonomy with a planning-oriented one:
140
132
  | Structural micro-tasks | the plan enumerates files, classes or methods as entries | the AI groups them by purpose |
141
133
  | Simulation without lifecycle | temporary behavior exists with no phase that displaces it and no phase that retires it | the AI derives both / **human** |
142
134
  | Phase without evidence | the block declares no `Validación de fase` | the AI derives it from the criteria / **human** |
135
+ | Invalid execution batches | phases are missing/duplicated or cross an ineligible continuous boundary | the AI re-infers the maximal partition |
143
136
  | Over-engineered solution | approach heavier than the criteria need — needless abstraction/layer/dependency, or a phase/task not required to meet the spec (chassis § *Minimality*) | AI proposes the lighter path + **human** confirms (**probe** if "lighter works" is a runnable doubt) |
144
137
  | Missing deps | order unclear | research / human |
145
138
  | Spec criteria uncovered | tasks don't trace to acceptance criteria | the AI derives + human confirms |
146
139
  | Unaddressed risks | technical risks unmitigated/undeclared | human / **probe** (Delta 5) |
147
- | UI without design SPEC *(if it applies)* | the plan includes UI (FE/screens in `Impacted`, `## UI spec` in the spec, or UI tasks) without `NNN-SPEC-*.md` in the session | **`ui-design` capability** |
140
+ | UI without design *(if it applies)* | the plan includes UI (FE/screens in `Impacted`, `## Design references` in the spec, or UI tasks) and pins no exact root, or its roots are not `handoff` | **`design`** (promote the closure, pin the roots) |
148
141
 
149
142
  > **Author the Solution the laziest-that-works way** (chassis § *Minimality*, generative side): reuse what the codebase/stdlib/platform already provides before proposing new abstractions, layers or dependencies — the coherence gate then only *confirms* minimality, never repairs over-engineering after the fact.
150
143
 
151
144
  ## Delta 3 — What research investigates here
152
145
 
153
- The chassis' **inline** research specializes: mapping **code/impact** — affected FE/BE/DB components, AS-IS wiring, dependencies. It feeds `Solution` (its AS-IS → TO-BE delta) and `Impacted`. The chassis DB rule applies unchanged (read-only queries into `SCRIPTS.sql`, MCP chosen via a content question when >1 without default).
146
+ Inline research maps affected code, AS-IS wiring and dependencies into `Solution`/`Impacted`.
147
+ The chassis DB rule applies unchanged.
154
148
 
155
149
  ## Sequence
156
150
 
@@ -159,30 +153,31 @@ plan-new-loop(spec):
159
153
  input = glob(docs/specs/NNN-spec-*.md) | argument path
160
154
  if the spec is not status: ready-for-plan (nor a legacy mark):
161
155
  soft-suggest /w:spec-refine # never blocks — the user may proceed anyway
162
- session = create_or_resume("<slug>-plan-new") # CLI prepends global NNN
163
- seed SESSION.Success criteria = coherence-gate checklist # verification-first, BEFORE
156
+ session = create_or_resume("<slug>-plan-new")
157
+ seed SESSION.Success criteria = coherence-gate checklist
164
158
  work = plan skeleton (Delta 1) derived from the spec (+ checkpoint progress if resuming)
165
- repeat: # chassis engine
159
+ work.Execution batches = infer maximal phase partition (PLAN-EXECUTION-BATCHES)
160
+ repeat:
166
161
  gaps = detect_gaps(work) (Delta 2 taxonomy) minus the exhausted ones
167
162
  if gaps == ∅: break
168
163
  batch ≤3 → seed CHECKPOINT.Pending/Next → resolve each gap:
169
- research (maps code/impact — Delta 3) · human (structured-choice) · probe (Delta 5) · ui-design (Delta 4)
170
- integrate + update CHECKPOINT # artifact-first cycle
164
+ research · human (structured-choice) · probe · design (promote closure + pin roots)
165
+ integrate + update CHECKPOINT
171
166
  coherence gate (read-only) = Success criteria green:
172
- - every spec acceptance criterion traces to a phase/task
173
- (split: each criterion → exactly one sibling — complete, disjoint partition)
167
+ - every spec criterion traces to a phase/task (split: exactly one sibling)
174
168
  - the Final behavior block of ## Solution covers the criteria
175
169
  - every ### Fn leaves a verifiable state with its own exit condition — never a list of layers or files
176
170
  - the order allows early integration · deps without cycles · Impacted consistent with Solution
177
- - the simulation boundary, ONLY when the change carries one, is located, its displacement planned, and one phase owns its retirement
178
- - every phase declares its primary evidence; per-layer tests are justified, never automatic
179
- - resumable: a stop between phases leaves a stable state and a legible next intent
180
- - minimality (chassis § *Minimality*): the Solution is the lightest that meets its Final behavior block; no phase/task/abstraction the criteria don't require
181
- - (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
171
+ - ONLY when the change carries simulation, its displacement and retirement are owned
172
+ - every phase declares primary evidence; layer tests are justified
173
+ - Execution batches partitions every phase once and crosses only eligible boundaries
174
+ - resumable between units and within one through states/checkboxes
175
+ - minimality: no solution/phase/task heavier than Final behavior requires
176
+ - (UI) every screen/UI task pins an exact root against a declared baseline · that closure is handoff · nothing outside it was promoted
182
177
  whatever fails → comes back as a gap
183
- if split accepted (§ Split gate (multi-plan)): work = the N sibling plans (same session; cut in CHECKPOINT)
178
+ if split accepted: work = N sibling plans
184
179
  structured_choice(content: [Guardar planes, Preguntar algo más], flow: [Compactar, Cerrar])
185
- Guardar planes → per sibling: aw next-number docs/plans → write (confirmation if it exists)
180
+ Guardar planes → mint + write each sibling
186
181
  else:
187
182
  structured_choice(content: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
188
183
  Guardar → write docs/plans/PPP-plan-<slug>.md (confirmation if it exists)
@@ -192,16 +187,19 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
192
187
  ## Convergence / exit
193
188
 
194
189
  - **No material gaps** → **coherence gate** (the *Sequence* checklist; the PLAN-new instance of the chassis convergence gate). Criterion→task traceability is a **checked invariant**, never a separate section.
195
- - **The gate judges functional states, not size.** A plan converges when every `### Fn` is a verifiable state with its exit condition and its primary evidence — plus its simulation boundary located, **only when the change carries one**; a phase that only enumerates layers or files comes back as a gap, however small it is.
196
- - Passes `Guardar plan` (writes with confirmation if it exists) → `finalize`.
197
- - **Split branch**: `Guardar planes` writes the N siblings sequentially (mint before each write) `finalize` one session, one HISTORY row.
190
+ - **The gate judges functional states, not size.** Each phase needs an exit condition, evidence and,
191
+ **only when the change carries one**, its simulation lifecycle.
192
+ - Passes the save confirmation and, only after it, the write (confirmed again if the document
193
+ exists) → `finalize`. On the split branch the same step writes the N siblings.
194
+
195
+ > **When the gate is evaluated, when the offer appears and with what alternatives, is not this document's call:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document. The *Sequence* above stays as the loop's shape; it is not its scheduler.
198
196
  - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
199
197
 
200
- > **After generating:** the plan can go straight to `plan-exec`, or if changes arise before executing (new requirements, scope adjustments) — pass through [`plan-refine-loop`](../plan-refine-loop/LOOP.md) (`/w:plan-refine`, auxiliary and **not mandatory**), which refines it in place.
198
+ > **After generating:** run `plan-exec`; use optional `plan-refine` when the structure changes first.
201
199
 
202
200
  ## Conditional modules
203
201
 
204
202
  - `split` — the canonical multi-plan gate → `../../modules/PLAN-SPLIT-GATE.md`
205
203
  - `split` — the incremental journey shape → `../../modules/INCREMENTAL-STRATEGY.md`
206
- - `ui` — per-screen design SPECs → `../../modules/PLAN-DESIGN-SPECS.md`
204
+ - `ui` — the design closure to promote and the roots to pin → `../../modules/DESIGN-REFERENCES.md`
207
205
  - `probe` — probe (PoC) tasks → `../../modules/PLAN-PROBE-TASKS.md`
@@ -6,7 +6,7 @@ description: >-
6
6
  (loops/CHASSIS.md). Deltas: functional journey map, phases re-shaped by
7
7
  verifiable state (contract in plan-new-loop), simulation lifecycle,
8
8
  evidence by behavior, executability gate, replanning of partially executed
9
- plans, and design SPECs via ui-design on UI changes. Started by
9
+ plans, and design revisions scoped to the delta on UI changes. Started by
10
10
  /w:plan-refine — also the return path when plan-exec stops on a structural
11
11
  deviation; resumable and re-runnable on demand.
12
12
  ---
@@ -31,6 +31,11 @@ This loop turns a plan into a sequence of **verifiable states of the system**. E
31
31
 
32
32
  The phase contract is defined **once** in [`plan-new-loop`](../plan-new-loop/LOOP.md) § *Phase contract (canonical)* — this loop **applies** it and never redefines it: a `### Fn` block is a state the system reaches, with its `> Estado:` line, its work, its evidence and its exit condition.
33
33
 
34
+ The plan's execution-unit interface is likewise defined once in
35
+ [`PLAN-EXECUTION-BATCHES`](../../modules/PLAN-EXECUTION-BATCHES.md). This loop re-infers and
36
+ writes its complete phase partition; it never asks the human to choose an optimization the repo
37
+ can establish.
38
+
34
39
  ## Auxiliary / NOT mandatory
35
40
  `plan-exec` runs **any** plan that is already executable, refined or not — there is **no** gate requiring plan-refine. This loop exists to incorporate changes (new requirements, scope adjustments, deps/risks spotted on re-read) **before** executing, and to give an unexecutable plan the shape its execution needs, without regenerating it from scratch.
36
41
 
@@ -41,7 +46,7 @@ The phase contract is defined **once** in [`plan-new-loop`](../plan-new-loop/LOO
41
46
  `docs/plans/PPP-plan-*.md` (glob — locates the plan by number; or the exact path from the command argument). **Always the plan itself**: this loop edits it in place; there is no separate "refined" file. Provenance is irrelevant — generated by `plan-new`, **hand-written, or adopted** from a host planner (`plan-new` mode 4 / `persist`); existence is the only requirement.
42
47
 
43
48
  ## Writes
44
- Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions`. Since it overwrites an existing doc, it asks the user's **confirmation**. On an accepted split (§ *Split gate — refine semantics*) it also **creates** the extracted sibling plans (newly minted `docs/plans` files). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the refine **touches UI**, it also produces/updates **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its own session** (see *Delta 4* they are not `docs/`, no auto-export).
49
+ Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions`. Since it overwrites an existing doc, it asks the user's **confirmation**. On an accepted split (§ *Split gate — refine semantics*) it also **creates** the extracted sibling plans (newly minted `docs/plans` files). It writes `docs/plans` and, when the refine **touches UI**, the **revision it publishes** scoped to the artifacts the delta actually affects — of the design package under `docs/designs` (chassis § *docs/ boundary*; see [`DESIGN-REFERENCES.md`](../../modules/DESIGN-REFERENCES.md)). It never graduates/exports anything else to `docs/` that is separate `export-*` work.
45
50
 
46
51
  ## Inherits
47
52
 
@@ -57,7 +62,8 @@ Full doctrine in the chassis (§ *Internal sessions* + *Numbering*). This loop's
57
62
 
58
63
  ## Delta 1 — Deliverable: the PLAN, edited in place
59
64
 
60
- The plan uses the **same skeleton** [`plan-new-loop`](../plan-new-loop/LOOP.md) produces (§ *Delta 1 — RICH PLAN*: `Solution` (with its Final behavior block)/`Impacted`/`Tasks` (`### Fn` blocks)/`Validations`/… with `(core)` sections always and `(opt.)` by complexity). plan-refine does **not** change the schema: it **completes/adjusts** the existing sections **in place** and **adds** one trace section:
65
+ The plan uses the **same skeleton** [`plan-new-loop`](../plan-new-loop/LOOP.md) produces, including
66
+ the core `## Execution batches` section. plan-refine completes it in place and adds one trace:
61
67
 
62
68
  ```markdown
63
69
  ## Refinement decisions ← NEW (ADDED) — the run's single trace
@@ -73,7 +79,7 @@ question that changed nothing, is NOT transcribed.
73
79
 
74
80
  > **Execution updates progress; refinement changes structure.** `plan-exec` updates the plan's operational state in place — task checkboxes, the phase `> Estado:` line with its `> Bloqueo:` line while blocked, declared deferrals and the plan's own status mark. It does **not** redesign contracts, phase shape or order, participating components, evidence or simulation boundaries: those structural changes are this loop's, and a change of functional behavior belongs to `spec-refine`.
75
81
 
76
- > **Normalize on write, never invent.** A save through this loop leaves the document on the current contract. The plan-level `> Estado:` line sits under the title — `open`, unless execution already closed it, and then with the date and session on their own `> Cierre:` line. Each `### Fn` carries its required blocks, and **no conditional block is written empty**: a phase with no temporary behavior gets no `Límite de simulación`, one with nothing excluded gets no `Diferido`. Normalizing is a rewrite of form — it never changes a phase's state, never ticks a box, and never closes a plan.
82
+ > **Normalize on write, never invent.** A save through this loop leaves the document on the current contract, and **no conditional block is written empty**: a phase with no temporary behavior gets no `Límite de simulación`, one with nothing excluded gets no `Diferido`. Normalizing is a rewrite of form — it never changes a phase's state, never ticks a box, and never closes a plan.
77
83
 
78
84
  ## Delta 2 — Gap taxonomy (of "plan")
79
85
 
@@ -123,6 +129,7 @@ This loop's instance of the chassis convergence gate — the same one `plan-exec
123
129
  - **Phases** — each leaves a verifiable state with its exit condition, none is a list of layers or files, the order allows early integration, deferrals are explicit.
124
130
  - **Simulation** *(only when the change carries one)* — initial boundary identified, every displacement foreseen, one phase owns the retirement, nothing can stay active by accident. No temporary behavior → the check does not apply, and no empty `Límite de simulación` is required.
125
131
  - **Evidence** — every phase declares its primary proof, per-layer tests are justified, the same scenario is not duplicated by default, declared risks have evidence or an explicit deferral.
132
+ - **Execution batches** — every phase appears once; maximal continuous ranges cross no decision, proof, handoff, irreversible action or required recovery boundary.
126
133
  - **Resumability** — tasks legible enough for a `CHECKPOINT`, intermediate states stable, pending work distinguishable from work already `validada`.
127
134
 
128
135
  ## Sequence
@@ -135,17 +142,18 @@ plan-refine-loop(plan):
135
142
  work = read(plan) (+ the spec if realignment is needed; + checkpoint/exec history if resuming or returning from plan-exec)
136
143
  journey = map(observable contract, technical journey, incremental strategy, evidence) # bounded research
137
144
  work = phases grouped by verifiable state (phase contract) + simulation lifecycle if any + primary proof each
145
+ work.Execution batches = infer maximal phase partition (PLAN-EXECUTION-BATCHES)
138
146
  keep validated phases and their completed tasks; redesign ONLY pending work
139
147
  repeat: # chassis engine
140
148
  gaps = detect_gaps(work) (plan-new taxonomy + plan↔spec drift) minus the exhausted ones
141
149
  if gaps == ∅: break
142
150
  batch ≤3 → seed CHECKPOINT.Pending/Next → resolve each gap:
143
151
  research (scoped to the delta — Delta 3) · human (structured-choice) · probe (chassis) ·
144
- ui-design (Delta 4, only new/changed screens)
152
+ design (revisions only for the artifacts this refine affects; behavior/acceptance → spec-refine first)
145
153
  integrate + update CHECKPOINT # artifact-first cycle
146
154
  executability gate (read-only) = Success criteria green:
147
- - contract · journey · phases · simulation · evidence · resumability (§ Executability gate)
148
- - plan-new checklist (criterion→task · Final behavior block of Solution · deps · Impacted↔Solution · UI→current SPEC · minimality)
155
+ - contract · journey · phases · simulation · evidence · execution batches · resumability (§ Executability gate)
156
+ - plan-new checklist (criterion→task · Final behavior block of Solution · deps · Impacted↔Solution · UI→exact roots · minimality)
149
157
  # spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior block/Validations (see Delta 2)
150
158
  - re-refine's own check: the plan is REALIGNED with what changed
151
159
  whatever fails → comes back as a gap
@@ -161,15 +169,17 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
161
169
  ## Convergence / exit
162
170
 
163
171
  - **No material gaps** → **executability gate** (the *Sequence* checklist: contract · journey · phases · simulation · evidence · resumability, plus plan-new's coherence checks and the re-refine's own realignment check).
164
- - Passes → `Guardar plan refinado` (edits in place with confirmation) → `finalize`.
165
- - **Split branch**: `Guardar planes` edits the original reduced and writes the extracted siblings → `finalize`.
172
+ - Passes → the save confirmation and, only after it, the in-place edit → `finalize`. On the split
173
+ branch the same step edits the original reduced and writes the extracted siblings.
174
+
175
+ > **When the gate is evaluated, when the offer appears and with what alternatives, is not this document's call:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document. The write follows the confirmation, never the other way round.
166
176
  - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
167
177
 
168
178
  > **After refining:** the plan goes to `plan-exec`, which re-checks this same gate on entry — a plan saved here should never bounce back for its structure.
169
179
 
170
180
  ## Conditional modules
171
181
 
172
- - `ui` — design SPECs for changed screens → `../../modules/PLAN-REFINE-DESIGN-SPECS.md`
182
+ - `ui` — the design closure, the roots, and this loop's delta rule → `../../modules/DESIGN-REFERENCES.md`
173
183
  - `simulation` — the life of temporary behavior → `../../modules/SIMULATION-LIFECYCLE.md`
174
184
  - `replan` — replanning executed work → `../../modules/REPLANNING.md`
175
185
  - `split` — splitting a plan in place → `../../modules/PLAN-REFINE-SPLIT.md`
@@ -48,20 +48,20 @@ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **a
48
48
 
49
49
  ## QUICK delta — minimal ceremony
50
50
 
51
+ > **Directed tranche:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document — it names the boundary in force, its alternatives, and the exact invocation when something has to run outside. What stays here is the *why*, plus every step that is judgment or preference.
52
+
51
53
  - **No phases, no plan-doc**: the prompt **is** the task (a single unit). No roadmap.
52
54
  - **Proportional verification-first** (minimal ceremony): even here the check is **seeded before**, sized to the task. Code: one test (bug repro → fix) or "existing build/lint/tests stay green" (chore). **Analysis/design**: a **short falsifiable rubric**, *ratified by the user* before pursuing it. It is the run's `SESSION.Success criteria` (see [chassis § *Verification-first*](../CHASSIS.md)).
53
55
  - **Git and DB inline** (full policies in [`../CODE-POLICIES.md`](../CODE-POLICIES.md)): before editing, verify each source's expected branch (`aw check-branch`); **proposed** commit (approve first) — never `push`/`--amend`/`--no-verify`. The AI **never executes DML/DDL**: migrations are drafted into the session's `SCRIPTS.sql` (read-only queries do run, via MCP).
54
56
  - **One session. One commit** proposed at the end (only if there were code changes), **after the proportional closing review gate** ([`../CODE-POLICIES.md`](../CODE-POLICIES.md) § *Closing review gate*): diff re-read + ambient conventions; fix or defer; nothing reaches the commit unreviewed.
55
- - **Entry SIZE GATE** (before creating the session): on receiving the objective, evaluate whether it **exceeds a quick**. It fires **only on clear signals** (≥2 of: needs architecture · ≥2 sources · multiple deliverables · large feature/refactor · ambiguous requirements needing elicitation); signals already resolved by *adopted context* do **not** fire (e.g. a host pre-analysis in this conversation that removed the ambiguity — chassis § *Adopted context*); borderline → **continue in quick without asking** (if it later grows, mid-loop escalation covers it). A **resume** of an existing quick does **not** re-fire the gate. If it fires → **structured-choice** (1 content question, recommendation first + `flow` control; `Cerrar` here = abort, nothing created yet):
56
- - **`Cambiar a SPEC`** (recommended) **no quick session is created**: run the *Live transition to SPEC* (next bullet).
57
- - **`Seguir en quick`** continue normally (`create_or_resume` + loop).
58
- - **`Recortar alcance`** → the AI proposes the **sub-task that DOES fit** a quick; the loop continues with it (`SESSION.Objective` = the sub-task; the original prompt goes into the session's `## Origin`) and the rest is deferred to `BACKLOG` ("trimmed at the gate — may warrant its own spec, `/w:spec-new`").
59
- - **Anti-duplicate** (the `create_or_resume` spirit): if a spec whose `## Origin` references this same objective already exists (or an equivalent `*-spec-refine` session), the recommended option becomes **resuming that spec** (`/w:spec-refine` semantics) — never a second draft.
57
+ - **Entry SIZE GATE** (before creating the session): a quick that should have been a spec costs more than the ceremony it saved, so the size of the objective is judged **before** anything exists. Your part is recognizing the signals; the threshold, the question and its options are the CLI's. A signal already resolved by *adopted context* is **not** a signal (chassis § *Adopted context*). A **resume** of an existing quick never re-fires it.
58
+ - **`Recortar alcance`**, if chosen: propose the **sub-task that DOES fit** a quick (`SESSION.Objective` = the sub-task; the original prompt goes into `## Origin`) and defer the rest to `BACKLOG` ("trimmed at the gate — may warrant its own spec, `/w:spec-new`").
59
+ - **`Cambiar a SPEC`**, if chosen: **no quick session is created** — run the *Live transition to SPEC* (next bullet).
60
60
  - **Live transition to SPEC** (shared by the gate and mid-loop escalation). On acceptance, the work line **moves to the SPEC flow**: the explicit consent in the structured-choice **equals invoking the destination command** (*consented exception* — rule 3 of the *Continuity rule*, [`../../SKILL.md`](../../SKILL.md) § *Operating context*). On the SPEC side:
61
61
  1. **Materialize the draft** via the [`../../commands/spec-new.md`](../../commands/spec-new.md) procedure: `aw next-number docs/specs`, slug, schema, single-pass **NO RESEARCH** — its bounded reconnaissance does **not** re-fire (this run's context arrives adopted). `## Origin` = "escalated from `/w:quick`" + the original prompt (+ the origin quick session if it exists). The draft is born `status: draft`: only the SPEC gate promotes it to `ready-for-plan`.
62
62
  2. **Load and execute** [`../spec-refine-loop/LOOP.md`](../spec-refine-loop/LOOP.md) — over that spec (trampoline pattern).
63
63
  3. The run's session is that loop's **normal** `NNN-<slug>-spec-refine` (the CLI numbers it; its `## Origin` records the escalation). **Invariant 2 intact**: quick, while it is quick, never writes `docs/` — the draft is written by the SPEC flow, post-consent.
64
- - **Mid-loop escalation + handoff**: if the task grows (same gate signals) propose moving up to **SPEC/PLAN** (structured-choice, recommendation first). If the user accepts:
64
+ - **Mid-loop escalation + handoff**: if the task grows, declare the signals again the CLI applies the same threshold and, if it fires, asks. If the user accepts moving up:
65
65
  1. The **already-edited code stays** in the working tree (never reverted) and is **recorded** in `CHECKPOINT` + `BACKLOG`: "uncommitted changes in `<source>` — decide commit/discard on resume" (the "rejected commit" pattern, [`../CODE-POLICIES.md`](../CODE-POLICIES.md) § *Safe git*).
66
66
  2. The quick session goes to `finalize` with the **pointer** in `BACKLOG`: to **PLAN** → "escalated to `docs/plans/PPP` — resume there" (**deferred** as today: seed + pointer, no live entry); to **SPEC** → "escalated to `docs/specs/NNN` — **continued live** (session `NNN-<slug>-spec-refine`)".
67
67
  3. The artifacts (`DECISION`, `SCRIPTS.sql`) **stay in the quick session** as referenceable context for the new session (never migrated).
@@ -71,21 +71,13 @@ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **a
71
71
 
72
72
  ```
73
73
  quick-loop(prompt):
74
- # SIZE GATE BEFORE creating a session; new work lines only (a resume does not re-fire it)
75
- if the objective exceeds a quick (≥2 clear signals see delta):
76
- if a spec / spec-refine session for this objective already exists → recommend RESUMING it (/w:spec-refine) # anti-duplicate
77
- structured_choice(content: [Cambiar a SPEC (recommended), Seguir en quick, Recortar alcance],
78
- flow: [Compactar, Cerrar]) # Cerrar here = abort (nothing created yet)
79
- Cambiar a SPEC → live transition (see delta): draft (spec-new procedure) +
80
- load and execute ../spec-refine-loop/LOOP.md → END (no quick session)
81
- Recortar alcance → objective = the proposed sub-task; the rest → BACKLOG when the session is created
82
- Seguir en quick → continue
83
- s = create_or_resume("<slug>-quick") # CLI prepends global NNN; always a light session
84
- seed SESSION.Objective = the prompt
74
+ # The CLI drives the entry gate, its anti-duplicate search and the session, and
75
+ # stops at each boundary it cannot decide; it verifies the seeding afterwards.
76
+ # `Cambiar a SPEC` live transition (see delta): draft (spec-new procedure) +
77
+ # load and execute ../spec-refine-loop/LOOP.md END (no quick session)
85
78
  if the conversation already established analysis/conclusions → # adopted context (chassis)
86
79
  adopt them (SESSION.Origin = "adopted from host conversation"; reference in CONCLUSIONS) — never re-derive/re-ask
87
- seed SESSION.Success criteria = the deliverable's check # verification-first, BEFORE: test(s) if code · short RATIFIED rubric if analysis/design
88
- seed CHECKPOINT.Pending/Next = the task (s) # BEFORE: seed the intent (artifact-first)
80
+ author SESSION.Success criteria = the deliverable's check # test(s) if code · short RATIFIED rubric if analysis/design
89
81
  work the task (minimal loop):
90
82
  if it edits code → verify each source's expected branch (`aw check-branch`); mismatch → pause + resolve
91
83
  produce the deliverable: edit code (minimal change) OR author the analysis/design
@@ -93,11 +85,11 @@ quick-loop(prompt):
93
85
  if DB change (DDL/DML) → SCRIPTS.sql (session artifact, DO NOT execute)
94
86
  if non-obvious decision → DECISION
95
87
  if doubt/gap → inline research, a probe OR structured-choice # chassis § Proof of concept
96
- if the task GROWS → propose escalating to SPEC/PLAN # structured-choice, recommendation first
97
- accepts PLAN → handoff (progress stays; BACKLOG→seeded plan — resume there, deferred) → goto finalize
98
- accepts SPEC → handoff (progress stays; BACKLOG→"continued live") → finalize →
99
- live transition (see delta): draft if missing + spec-refine-loop
100
- convergence gate: Success criteria green # tests green if code · rubric satisfied if analysis/design
88
+ if the task GROWS → declare the signals again; if the CLI asks and the user accepts:
89
+ PLAN → handoff (progress stays; BACKLOG→seeded plan — resume there, deferred) → goto finalize
90
+ SPEC → handoff (progress stays; BACKLOG→"continued live") → finalize →
91
+ live transition (see delta): draft if missing + spec-refine-loop
92
+ convergence gate: run the Success criteria and hand back their real output
101
93
  if there were code changes:
102
94
  closing review gate (proportional): # diff re-read + installed ambient conventions
103
95
  findings → fix (re-validate) OR defer justified (BACKLOG)
@@ -108,11 +100,11 @@ finalize: CHECKPOINT (AFTER: Pending→Completed) + BACKLOG (only if something i
108
100
 
109
101
  ## Convergence / exit
110
102
 
111
- - **Success criteria green** (proportional) + closing review gate passed and commit proposed if there was code (or skipping it approved) → `Cerrar`.
103
+ - Closing review gate passed and commit proposed if there was code (or skipping it approved) → `Cerrar`.
112
104
  - `Cerrar`/`Compactar` (`flow` control) → persists `CHECKPOINT` + `BACKLOG` (resumable).
113
105
  - **No export**: nothing goes to `docs/`. Anything worth preserving → promoted separately via `export-*`, or escalated (to SPEC **live** — the line continues in spec-refine already as SPEC flow; to PLAN **deferred**, seed + pointer).
114
106
 
115
- > QUICK's *convergence gate* is **proportional verification-first**: a **short** `Success criteria` seeded at start (not the *absence* of a checklist — its minimal version) for code, "the change does what the prompt asked + tests/build green"; for analysis/design, a short ratified rubric. Minimal ceremony by design, but **always with the check declared first**.
107
+ > QUICK's *convergence gate* is **proportional verification-first**: a **short** `Success criteria` declared at start (not the *absence* of a checklist — its minimal version). The CLI evaluates it, and it evaluates the **real output** of running those criteria a claim that they passed is not a result.
116
108
 
117
109
  ## Conditional modules
118
110