@tacuchi/agent-workflow-cli 20.25.0 → 21.0.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 (124) hide show
  1. package/README.md +1 -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/design/design-gate-service.js +246 -0
  5. package/dist/application/design/design-gate-service.js.map +1 -0
  6. package/dist/application/design/design-graph-service.js +85 -0
  7. package/dist/application/design/design-graph-service.js.map +1 -0
  8. package/dist/application/design/design-index-service.js +132 -0
  9. package/dist/application/design/design-index-service.js.map +1 -0
  10. package/dist/application/design/design-publish-service.js +488 -0
  11. package/dist/application/design/design-publish-service.js.map +1 -0
  12. package/dist/application/design/design-resolver-service.js +165 -0
  13. package/dist/application/design/design-resolver-service.js.map +1 -0
  14. package/dist/application/resume-service.js +23 -4
  15. package/dist/application/resume-service.js.map +1 -1
  16. package/dist/application/self/install-skill.js +25 -8
  17. package/dist/application/self/install-skill.js.map +1 -1
  18. package/dist/application/semantic-operation/protocol.js +18 -12
  19. package/dist/application/semantic-operation/protocol.js.map +1 -1
  20. package/dist/application/semantic-operation/publish.js +56 -9
  21. package/dist/application/semantic-operation/publish.js.map +1 -1
  22. package/dist/application/skills-resolver-service.js +19 -4
  23. package/dist/application/skills-resolver-service.js.map +1 -1
  24. package/dist/application/status-service.js +1 -0
  25. package/dist/application/status-service.js.map +1 -1
  26. package/dist/application/workline-index-service.js +6 -0
  27. package/dist/application/workline-index-service.js.map +1 -1
  28. package/dist/application/workspace-init-service.js +9 -1
  29. package/dist/application/workspace-init-service.js.map +1 -1
  30. package/dist/cli/commands/designs.js +110 -0
  31. package/dist/cli/commands/designs.js.map +1 -0
  32. package/dist/cli/commands/index.js +2 -0
  33. package/dist/cli/commands/index.js.map +1 -1
  34. package/dist/cli/commands/resume.js +8 -0
  35. package/dist/cli/commands/resume.js.map +1 -1
  36. package/dist/cli/commands/status.js +45 -0
  37. package/dist/cli/commands/status.js.map +1 -1
  38. package/dist/cli/help-groups.js +3 -0
  39. package/dist/cli/help-groups.js.map +1 -1
  40. package/dist/cli/parser.js +1 -0
  41. package/dist/cli/parser.js.map +1 -1
  42. package/dist/domain/design/artifact-body.js +223 -0
  43. package/dist/domain/design/artifact-body.js.map +1 -0
  44. package/dist/domain/design/artifact.js +606 -0
  45. package/dist/domain/design/artifact.js.map +1 -0
  46. package/dist/domain/design/baseline.js +359 -0
  47. package/dist/domain/design/baseline.js.map +1 -0
  48. package/dist/domain/design/capability.js +51 -0
  49. package/dist/domain/design/capability.js.map +1 -0
  50. package/dist/domain/design/closure.js +161 -0
  51. package/dist/domain/design/closure.js.map +1 -0
  52. package/dist/domain/design/governance.js +298 -0
  53. package/dist/domain/design/governance.js.map +1 -0
  54. package/dist/domain/design/identity.js +145 -0
  55. package/dist/domain/design/identity.js.map +1 -0
  56. package/dist/domain/design/manifest.js +552 -0
  57. package/dist/domain/design/manifest.js.map +1 -0
  58. package/dist/domain/design/maturity.js +234 -0
  59. package/dist/domain/design/maturity.js.map +1 -0
  60. package/dist/domain/design/naming.js +117 -0
  61. package/dist/domain/design/naming.js.map +1 -0
  62. package/dist/domain/design/projections.js +165 -0
  63. package/dist/domain/design/projections.js.map +1 -0
  64. package/dist/domain/design/reference.js +234 -0
  65. package/dist/domain/design/reference.js.map +1 -0
  66. package/dist/domain/design/retired.js +61 -0
  67. package/dist/domain/design/retired.js.map +1 -0
  68. package/dist/domain/design/revision.js +219 -0
  69. package/dist/domain/design/revision.js.map +1 -0
  70. package/dist/domain/design/secrets.js +86 -0
  71. package/dist/domain/design/secrets.js.map +1 -0
  72. package/dist/domain/design/validation.js +75 -0
  73. package/dist/domain/design/validation.js.map +1 -0
  74. package/dist/domain/design/yaml-subset.js +390 -0
  75. package/dist/domain/design/yaml-subset.js.map +1 -0
  76. package/dist/domain/safe-path.js +23 -0
  77. package/dist/domain/safe-path.js.map +1 -0
  78. package/dist/domain/skills.js +27 -3
  79. package/dist/domain/skills.js.map +1 -1
  80. package/package.json +1 -1
  81. package/skills/w/SKILL.md +13 -11
  82. package/skills/w/artifacts/README.md +3 -4
  83. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
  84. package/skills/w/commands/README.md +2 -0
  85. package/skills/w/commands/export-diagrams.md +1 -1
  86. package/skills/w/commands/export-manuals.md +1 -1
  87. package/skills/w/commands/export-reports.md +1 -1
  88. package/skills/w/commands/export-scripts.md +1 -1
  89. package/skills/w/commands/fix-git.md +1 -1
  90. package/skills/w/commands/generate-launch.md +2 -2
  91. package/skills/w/commands/persist.md +2 -2
  92. package/skills/w/commands/plan-exec.md +13 -7
  93. package/skills/w/commands/plan-new.md +8 -4
  94. package/skills/w/commands/plan-refine.md +8 -5
  95. package/skills/w/commands/quick.md +4 -4
  96. package/skills/w/commands/resume.md +2 -2
  97. package/skills/w/commands/spec-new.md +4 -4
  98. package/skills/w/commands/spec-refine.md +3 -2
  99. package/skills/w/commands/status.md +1 -1
  100. package/skills/w/commands/workspace-init.md +1 -1
  101. package/skills/w/context/MANIFEST.json +19 -8
  102. package/skills/w/harness/HARNESS.md +14 -10
  103. package/skills/w/loops/CHASSIS.md +9 -8
  104. package/skills/w/loops/CODE-POLICIES.md +22 -7
  105. package/skills/w/loops/README.md +1 -1
  106. package/skills/w/loops/plan-exec-loop/LOOP.md +127 -61
  107. package/skills/w/loops/plan-new-loop/LOOP.md +66 -70
  108. package/skills/w/loops/plan-refine-loop/LOOP.md +15 -7
  109. package/skills/w/loops/spec-refine-loop/LOOP.md +14 -12
  110. package/skills/w/modules/DESIGN-REFERENCES.md +109 -0
  111. package/skills/w/modules/PERSIST-ROUTING.md +1 -0
  112. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +84 -0
  113. package/skills/w/roles/README.md +7 -5
  114. package/skills/w/roles/design/ROLE.md +217 -0
  115. package/skills/w/schemas/design/design-baseline.v1.schema.json +71 -0
  116. package/skills/w/schemas/design/design-manifest.v1.schema.json +322 -0
  117. package/skills/w/schemas/design/design-review.v1.schema.json +72 -0
  118. package/skills/w/schemas/design/design-revocation.v1.schema.json +54 -0
  119. package/skills/w/schemas/design/ui-flow.v1.schema.json +211 -0
  120. package/skills/w/schemas/design/ui-screen.v1.schema.json +214 -0
  121. package/skills/w/artifacts/artifacts-design/SPEC.md +0 -42
  122. package/skills/w/modules/PLAN-DESIGN-SPECS.md +0 -12
  123. package/skills/w/modules/PLAN-REFINE-DESIGN-SPECS.md +0 -7
  124. 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.
@@ -29,7 +29,7 @@ PLAN
29
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.
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
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`.
35
35
 
@@ -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:**
105
-
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*).
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.**
118
100
 
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.)*
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.
120
106
 
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`.
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.
122
109
 
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.)*
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`.
124
114
 
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,17 @@ 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.
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.
196
192
  - 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.
193
+ - **Split branch**: `Guardar planes` writes the N siblings → `finalize`.
198
194
  - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
199
195
 
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.
196
+ > **After generating:** run `plan-exec`; use optional `plan-refine` when the structure changes first.
201
197
 
202
198
  ## Conditional modules
203
199
 
204
200
  - `split` — the canonical multi-plan gate → `../../modules/PLAN-SPLIT-GATE.md`
205
201
  - `split` — the incremental journey shape → `../../modules/INCREMENTAL-STRATEGY.md`
206
- - `ui` — per-screen design SPECs → `../../modules/PLAN-DESIGN-SPECS.md`
202
+ - `ui` — the design closure to promote and the roots to pin → `../../modules/DESIGN-REFERENCES.md`
207
203
  - `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
@@ -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
@@ -169,7 +177,7 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
169
177
 
170
178
  ## Conditional modules
171
179
 
172
- - `ui` — design SPECs for changed screens → `../../modules/PLAN-REFINE-DESIGN-SPECS.md`
180
+ - `ui` — the design closure, the roots, and this loop's delta rule → `../../modules/DESIGN-REFERENCES.md`
173
181
  - `simulation` — the life of temporary behavior → `../../modules/SIMULATION-LIFECYCLE.md`
174
182
  - `replan` — replanning executed work → `../../modules/REPLANNING.md`
175
183
  - `split` — splitting a plan in place → `../../modules/PLAN-REFINE-SPLIT.md`
@@ -5,8 +5,8 @@ description: >-
5
5
  until PLAN can design without inventing behavior, scope or product
6
6
  decisions. Heir of the chassis (loops/CHASSIS.md). Deltas: current-behavior
7
7
  baseline, change-shape gate, gap taxonomy classified by destination,
8
- conditional ideation gate, ## UI spec via the ui-design capability, and the
9
- ready-for-plan gate that stamps the status frontmatter plan-new reads.
8
+ conditional ideation gate, ## Design references via the design capability, and
9
+ the ready-for-plan gate that stamps the status frontmatter plan-new reads.
10
10
  Started by /w:spec-refine (or the live escalation from quick-loop);
11
11
  resumable via CHECKPOINT and re-runnable on demand.
12
12
  ---
@@ -50,7 +50,7 @@ Updates `docs/specs/NNN-spec-<slug>.md` **in place** (when the user picks `Guard
50
50
 
51
51
  > **Not every shape decision creates a file** (§ *Change-shape gate*). An accepted **split** writes the reduced original **and** the extracted sibling specs; a replacement by **`Crear una nueva spec`** writes one new file and leaves this one untouched; **`Reformular esta spec`** creates nothing — it edits this same file, same number, same path. Every write, new or overwriting, is confirmed first.
52
52
 
53
- > **Boundary invariant:** this loop writes **only** into `docs/specs`. It never graduates/exports other artifacts to `docs/` — that is separate `export-*` work (chassis § *docs/ boundary*).
53
+ > **Boundary invariant:** this loop writes **only** into `docs/specs` and, when the requirement involves UI, the **design package** it composes under `docs/designs` (chassis § *docs/ boundary* — the package is the capability's own deliverable, not a graduated artifact). It never graduates/exports anything else to `docs/` — that is separate `export-*` work.
54
54
 
55
55
  ## Internal sessions — SPEC instance
56
56
 
@@ -66,9 +66,9 @@ Full doctrine in the chassis (§ *Internal sessions* + *Numbering*). This loop's
66
66
 
67
67
  ## Composes
68
68
 
69
- The **UI unspecified** gap (when the requirement involves UI; see *Gap taxonomy*) is resolved by **composing** the **`ui-design`** capability (built-in default `ui-spec`; rebindable via `.workflow/skills.toml`): it authors the UI spec natively (structure, vocabulary, Markdown format). It is the chassis' composed-capability resolution mode (next to *research*, *probe* and *human*): the loop contributes iteration/Q&A (design system, theme, variants, disambiguation) **via the same structured-choice**, and integrates the result as the spec's `## UI spec` section.
69
+ The **UI unspecified** gap (when the requirement involves UI; see *Gap taxonomy*) is resolved by the composed **`design`** capability ([`../../roles/design/ROLE.md`](../../roles/design/ROLE.md)) over the **UI Design Package v1**: reuse a compatible baseline or open an `outline` revision, publish it through the CLI, and leave in the spec **only** its `## Design references` package, baseline hint and digest. The loop contributes iteration/Q&A (design system, theme, variants, disambiguation) **via the same structured-choice**; the capability contributes what a correct package looks like. Full rule: [`DESIGN-REFERENCES.md`](../../modules/DESIGN-REFERENCES.md).
70
70
 
71
- > **Two levels of the same capability:** here (SPEC) it produces `## UI spec` the UI's *what*, coarse grain; in PLAN the plan loops produce **per-screen design SPECs** derived from that section (see [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)).
71
+ > **Two levels of the same capability:** here (SPEC) the design closes at `outline` and the spec keeps its exact reference; in PLAN the plan loops promote to `handoff` exactly the closure they implement and pin the exact roots (see [`DESIGN-REFERENCES.md`](../../modules/DESIGN-REFERENCES.md)). One package, two questions — never two formats.
72
72
 
73
73
  Other transversal capabilities the engine always uses: `research` (**inline** — chassis § *Research*), `sql` (DB rule inside research — chassis). All resolved by config; `off` → the loop continues without the capability and, if it was needed, says so or asks. The spec's **prose** follows the **ambient** writing conventions (the host auto-applies an installed writing skill if present), not a composed role.
74
74
 
@@ -106,8 +106,8 @@ status: ready-for-plan ← stamped on Guardar (vocabulary: draft | refining |
106
106
  does not capture — NEVER a 1:1 restatement of a criterion)
107
107
  ## Assumptions (declared)
108
108
 
109
- ## UI spec (opt. — if UI is involved; via the ui-design capability / ui-spec skill)
110
- Structured Markdown description (screens regions/components). See [`ui-spec`](../../roles/ui-spec/ROLE.md).
109
+ ## Design references (opt. — if UI is involved; via the composed design capability)
110
+ The exact package, baseline hint and digest — never the design itself. See [`design`](../../roles/design/ROLE.md).
111
111
 
112
112
  ## Decisions ← ADDED — the material decisions, NOT the run's history
113
113
  The choices a reader needs in order to interpret the contract, each with its why.
@@ -140,7 +140,7 @@ The choices a reader needs in order to interpret the contract, each with its why
140
140
  | Hidden assumptions | the spec assumes unstated things | **research** validates / **human** confirms | SPEC |
141
141
  | Over-specified requirement | scope/criteria gold-plated — beyond the actual need (chassis § *Minimality*) | **human** (AI proposes the cut, human ratifies) | SPEC |
142
142
  | Unexplored solution space *(conditional)* | the spec settles on the first conceivable approach **and** a trigger fires (see *Ideation gate*) | **human consents** → **ideation** | SPEC — only on a trigger |
143
- | UI unspecified *(if it applies)* | the requirement involves UI but `## UI spec` is missing | **`ui-design` capability** | SPEC |
143
+ | UI unspecified *(if it applies)* | the requirement involves UI but `## Design references` is missing | composed **`design`** capability | SPEC |
144
144
  | Architecture | how to distribute technical responsibilities | — | **`PLAN`** — declare, never close here |
145
145
  | Implementation | library, class, method, pattern, folder layout | — | **`PLAN`** / `EXEC` — outside the spec |
146
146
  | Executable technical risk | whether an integration really works | — | **`PLAN`** (probe), unless the answer changes the contract |
@@ -180,9 +180,10 @@ spec-refine-loop(spec):
180
180
  batch = top ≤3 blocking ; pending_human = [] # gap questions ONLY — the shape was resolved above
181
181
  seed CHECKPOINT.Pending/Next = batch (refine_session) # BEFORE: seed the intent (artifact-first)
182
182
  for each gap in batch:
183
- if gap = UI (requirement involves UI, ## UI spec missing):
184
- compose ui-design → author ## UI spec # design-system/theme via structured-choice (counts in the batch)
185
- work = integrate(work, ui) # ## UI spec
183
+ if gap = UI (requirement involves UI, ## Design references missing):
184
+ compose design → reuse a compatible baseline OR publish an `outline` revision
185
+ # design-system/theme via structured-choice (counts in the batch)
186
+ work = integrate(work, design) # → ## Design references (package + hint + digest)
186
187
  else if gap = Unexplored solution space and a trigger fires:
187
188
  pending_human.push("ideation offer") # `Explorar ideas` | `Seguir sin ideación`
188
189
  else if factual(gap) and attempts[gap] < MAX:
@@ -234,12 +235,13 @@ finalize:
234
235
  - **Inline research** → the fact lands in `## Context` / `## Behavioral changes`; if it settles a choice, the choice goes to `## Decisions` (+ ref to the session's `CONCLUSIONS`).
235
236
  - **Ideation** → per verdict (§ *Ideation gate*): `Adoptar` → the spec's sections + `## Decisions` · `Descartar` → `CONCLUSIONS` · `Aparcar` → `## Open questions`.
236
237
  - **Human** → `## Decisions`, as the decision plus its why. **Not** a `Q:` transcript: the question-by-question trace stays in the session.
237
- - **`ui-design` capability** (UI gap) → the spec's `## UI spec` section.
238
+ - **Composed `design`** (UI gap) → the package under `docs/designs/` (published through the CLI) + the spec's `## Design references` section, and nothing else in the spec.
238
239
  - **Owned by `PLAN` or deferred** → `## Open questions` with its destination, and nothing else in the spec.
239
240
  - **Inconclusive or unresolved research** → `## Open questions` (deferred) + the refine session's `BACKLOG.md` (only if something is deferred).
240
241
 
241
242
  ## Conditional modules
242
243
 
243
244
  - `shape` — the change-shape gate and its split / replace branches → `../../modules/SPEC-CHANGE-SHAPE.md`
245
+ - `ui` — what the spec keeps when the requirement involves UI → `../../modules/DESIGN-REFERENCES.md`
244
246
  - `web` — the conditional ideation gate, its triggers and verdicts → `../../modules/IDEATION-GATE.md`
245
247
  - `resume` — the SPEC keys of compact / resume → `../../modules/SPEC-REFINE-KEYS.md`
@@ -0,0 +1,109 @@
1
+ # DESIGN-REFERENCES — how a spec and a plan cite design instead of carrying it
2
+
3
+ Loaded when the run involves UI (signal `ui`).
4
+
5
+ The **UI unspecified** gap is resolved by the [`design`](../roles/design/ROLE.md)
6
+ capability over the **UI Design Package v1**. A spec and a plan **reference** a
7
+ design; neither contains one. The block below is all they carry.
8
+
9
+ ## The reference block
10
+
11
+ ```markdown
12
+ ## Design references
13
+
14
+ - package: `DES-001@r4`
15
+ baseline_hint: `docs/designs/007-design-alta-familia/baselines/DES-001-r004.json`
16
+ digest: `sha256:<64 hex>`
17
+ ```
18
+
19
+ - `package` pins **identity and revision**. `latest`, a folder slug, a bare
20
+ `DES-001` or a title are rejected: each answers a different question next year
21
+ than it does today.
22
+ - `baseline_hint` is a **location hint**, never the identity. A renamed dossier
23
+ keeps the reference valid and reports the hint as stale.
24
+ - `digest` seals the exact bytes; one that no longer matches never resolves
25
+ quietly.
26
+ - Several packages are several blocks. A package named in prose **without being
27
+ pinned** is reported, not ignored.
28
+
29
+ **Never in the document**: Screen Specifications, flow graphs, state inventories,
30
+ region or component tables, mockups, embedded images. Those live in the package,
31
+ at their own revision — a document carrying them is a document whose design
32
+ cannot be superseded without editing it.
33
+
34
+ Publishing the package is the loop writing a composed deliverable through the
35
+ CLI, not graduating a session artifact (chassis § *docs/ boundary*).
36
+
37
+ ## SPEC — close the requirement at `outline`
38
+
39
+ 1. **Reuse before minting.** `aw designs` lists what the workspace already has; a
40
+ compatible baseline is reused rather than given a second identity.
41
+ 2. **Otherwise open an `outline` revision.** Not a shortcut: the spec closes *what*
42
+ the interface must accomplish and legitimately still holds unknowns. `handoff`
43
+ is PLAN's call — PLAN knows what will actually be implemented.
44
+ 3. **Publish, then reference.** Citing a baseline that was never published is the
45
+ dangling reference this contract removes.
46
+
47
+ `spec-new` only **records the need**; it mints nothing. Design-system, theme and
48
+ surface ambiguities are resolved like any other SPEC gap — *structured-choice*,
49
+ counting inside the same ≤3 batch. The section sits where `## UI spec` used to,
50
+ right before `## Decisions`.
51
+
52
+ ## PLAN — promote the closure, pin the roots
53
+
54
+ 1. **Read the spec's `## Design references`.** No section and a plan with screens
55
+ means the spec never closed its design — a gap back to `spec-refine`, not
56
+ something PLAN invents.
57
+ 2. **Express what this plan implements as exact roots** — the flows, screens and
58
+ screen states its phases will build.
59
+ 3. **Compute the closure**: a flow reaches its nodes, a screen its flows, and both
60
+ reach the rules, tokens and assets they depend on. It stops there. `flow_refs`
61
+ is *not* followed — it records which flows visit a screen, so following it drags
62
+ in designs the plan never consumes.
63
+ 4. **Promote exactly that closure to `handoff`**, nothing else. Ten screens in
64
+ `outline` and three promoted is a package's normal shape; promoting it wholesale
65
+ because one task needed one screen makes maturity meaningless.
66
+ 5. **Publish the revision**, then write the roots.
67
+
68
+ The plan declares its own `## Design references` — same block — after
69
+ `## Dependencies`, before `## Tasks`. **Its own, not a copy of the spec's**: that
70
+ is what lets a refine move this plan to `@r5` while a sibling stays on `@r4`. A
71
+ plan whose task pins a baseline it never declared resolves against nothing, and
72
+ says so.
73
+
74
+ Then each phase or task pins the exact roots it consumes:
75
+
76
+ ```markdown
77
+ - [ ] T3.2 — Alta de familia desde el formulario · DES-001@r4 / SCR-002@r2#empty
78
+ ```
79
+
80
+ `<package>@rN / <artifact>@rN[#state]`. Both revisions are mandatory; the anchor
81
+ is optional and only a screen has one. A phase whose tasks share one root may pin
82
+ it once at phase level. Never acceptable: naming `DES-001` without a revision —
83
+ `plan-exec` reports it instead of guessing. And a rendition never answers for a
84
+ root: an approved image is not the current semantics, nor a conformance claim.
85
+
86
+ ## quick — read it, never rewrite it
87
+
88
+ `quick` **reads and validates** (`aw designs`, `aw designs --plan`); it changes
89
+ nothing a baseline seals — normative content, a maturity, an approval. A visual
90
+ tweak that turns out to need a new state or a redrawn journey **escalates with the
91
+ evidence it gathered**: `plan-refine` for the package, `spec-refine` when behavior
92
+ or acceptance moves. Editing it silently moves the revision with nobody's approval
93
+ while every consumer stays pinned to the old digest.
94
+
95
+ ## plan-refine — the delta, and only the delta
96
+
97
+ - **New revisions only for the artifacts the refine actually affects.** An
98
+ untouched screen keeps its revision, maturity and digest.
99
+ - **Never re-point another consumer.** Two plans may pin the same baseline;
100
+ publishing `@rN+1` for one leaves the other's reference exactly as it was —
101
+ that is what makes a published revision immutable rather than merely
102
+ discouraged from changing.
103
+ - **Re-point only this plan** — its `## Design references` and the tasks whose
104
+ artifacts moved. The spec's section is not touched: it records the baseline the
105
+ *requirement* closed on.
106
+ - **Behavior or acceptance changed → `spec-refine` first.** Redrawing a journey,
107
+ adding a state the requirement never described or moving an acceptance criterion
108
+ is a functional change. Closing it here leaves the spec and the package
109
+ disagreeing with no way to tell which is right.
@@ -7,6 +7,7 @@ Loaded when classifying what to persist (signal `classification`).
7
7
  | **Analysis / conclusions / design notes** | findings, comparisons, diagnoses, adjudications, recommendations | `research` → `docs/research/NNN-research-<slug>.md` |
8
8
  | **Requirement** | describes a *wish*: what should exist/change, acceptance criteria derivable | `spec` → `docs/specs/NNN-spec-<slug>.md`, born `status: draft`, `## Origin` = "adopted from host conversation" → offer `/w:spec-refine` |
9
9
  | **Plan** | already answers the *how*: phases/tasks/solution — e.g. the host plan-mode output | `plan` → `docs/plans/NNN-plan-<slug>.md` (adoption) → offer `/w:plan-refine` / `/w:plan-exec` |
10
+ | **Durable UI idea** | screens, flows, states meant to last | `spec` **first**, then the design in the package it identifies ([`DESIGN-REFERENCES.md`](DESIGN-REFERENCES.md)); never a Screen Specification *instead of* the Requirement, and `persist` writes no package |
10
11
  | Mixed / ambiguous | e.g. analysis that ends in a requirement | one `persist` per document, each confirmed; a research doc plus a spec draft that cites it is a valid split |
11
12
 
12
13
  ## `docs/research/` — the analysis home (owned by this command)
@@ -0,0 +1,84 @@
1
+ # PLAN execution batches
2
+
3
+ This module is the single contract for grouping PLAN phases into execution units. `plan-new`
4
+ and `plan-refine` declare the intended units; `plan-exec` infers them again from live state.
5
+
6
+ ## Plan interface
7
+
8
+ Every new or refined plan carries this core section after `## Tasks`:
9
+
10
+ ```markdown
11
+ ## Execution batches
12
+
13
+ - B1 · continuous · F1-F3
14
+ - B2 · isolated · F4
15
+ ```
16
+
17
+ Rows use sequential `B1..Bn` ids and form a complete, disjoint phase partition in order. A batch
18
+ contains consecutive phases and uses one of two exact modes:
19
+
20
+ - `continuous` — implement every phase first; validate and review the combined diff at batch
21
+ close; then create one commit per changed Git source.
22
+ - `isolated` — the traditional cycle for one phase. It is still a batch, so the same state,
23
+ validation, review and Git rules apply at its close.
24
+
25
+ The phase contracts, dependencies, risks and open questions are the reproducible evidence.
26
+
27
+ ## Inference
28
+
29
+ Choose the maximal consecutive `continuous` ranges. A range is eligible only when all of these
30
+ are true:
31
+
32
+ 1. Every dependency is already satisfied or is an earlier phase in the same range.
33
+ 2. No phase result, proof, probe or human decision determines how a later phase must be built.
34
+ 3. There is no unresolved question, live blocker, operative handoff or irreversible external
35
+ action between its phases.
36
+ 4. No intermediate commit, release, review or deployment is a required recovery boundary.
37
+ 5. The combined change is coherent, recoverable and reviewable as one unit.
38
+
39
+ Anything else is `isolated`. If every phase is eligible, the whole plan is one batch. This is an
40
+ AI inference from observable facts, not a preference question; planning writes it without asking.
41
+ The PLAN gate fails when a phase is missing, duplicated, reordered or grouped across an
42
+ ineligible boundary.
43
+
44
+ ## Runtime authority
45
+
46
+ Before editing, `plan-exec` repeats the inference over pending phases using the plan plus live
47
+ dependencies, branches, working trees, blockers and risks.
48
+ It may merge or split the declared batches without asking: current evidence wins.
49
+ The declared section remains planning structure;
50
+ the effective batches and any difference are recorded in `CHECKPOINT`.
51
+
52
+ A legacy plan without `## Execution batches` is valid. Execution infers effective batches and
53
+ records them in `CHECKPOINT`; it does not normalize the plan merely to add the section.
54
+
55
+ ## Continuous cycle
56
+
57
+ For one effective batch:
58
+
59
+ 1. Verify every affected source and seed one batch intent before editing.
60
+ 2. Implement its phases in order. Mark local tasks done and set reached phases to `en ejecución`,
61
+ but run no phase proof, test runner, build, lint or closing review between them.
62
+ 3. After all implementation is written, run every phase proof in order, then the justified
63
+ focused/risk checks and applicable cross-cutting validations. The last pending batch also runs
64
+ the plan's final validation here, before Git.
65
+ 4. Fix failures autonomously and rerun the affected checks. Review the whole batch diff once.
66
+ 5. Only when every check, exit condition and review is green, flip all batch phases to `validada`,
67
+ update `CHECKPOINT`, and enter the Git step.
68
+
69
+ This is the narrow exception to the chassis' per-phase artifact beat and clean-tree rule: the
70
+ batch is the execution boundary. Task checkboxes and phase states keep it resumable.
71
+
72
+ A real blocker or structural/functional deviation stops immediately. No unproven phase becomes
73
+ `validada`; the combined changes remain uncommitted and the actual states plus the unblocking
74
+ action go to `CHECKPOINT`.
75
+
76
+ ## Git authorization
77
+
78
+ A green batch produces exactly one proposed commit per affected source. One consolidated approval
79
+ covers all of those commits. If the user explicitly pre-authorized commits conditional on every
80
+ batch check passing, record that authorization before editing and commit without another question.
81
+ A failed or unrun check never satisfies the condition and never creates a commit. For the last
82
+ pending batch, the same authorization also marks the fully validated plan `done` before committing,
83
+ so that final plan write is included in the source's single commit; there is no second completion
84
+ question or commit.