@tacuchi/agent-workflow-cli 20.26.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 (110) 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/semantic-operation/protocol.js +18 -12
  17. package/dist/application/semantic-operation/protocol.js.map +1 -1
  18. package/dist/application/semantic-operation/publish.js +56 -9
  19. package/dist/application/semantic-operation/publish.js.map +1 -1
  20. package/dist/application/skills-resolver-service.js +19 -4
  21. package/dist/application/skills-resolver-service.js.map +1 -1
  22. package/dist/application/status-service.js +1 -0
  23. package/dist/application/status-service.js.map +1 -1
  24. package/dist/application/workline-index-service.js +6 -0
  25. package/dist/application/workline-index-service.js.map +1 -1
  26. package/dist/application/workspace-init-service.js +9 -1
  27. package/dist/application/workspace-init-service.js.map +1 -1
  28. package/dist/cli/commands/designs.js +110 -0
  29. package/dist/cli/commands/designs.js.map +1 -0
  30. package/dist/cli/commands/index.js +2 -0
  31. package/dist/cli/commands/index.js.map +1 -1
  32. package/dist/cli/commands/resume.js +8 -0
  33. package/dist/cli/commands/resume.js.map +1 -1
  34. package/dist/cli/commands/status.js +45 -0
  35. package/dist/cli/commands/status.js.map +1 -1
  36. package/dist/cli/help-groups.js +3 -0
  37. package/dist/cli/help-groups.js.map +1 -1
  38. package/dist/cli/parser.js +1 -0
  39. package/dist/cli/parser.js.map +1 -1
  40. package/dist/domain/design/artifact-body.js +223 -0
  41. package/dist/domain/design/artifact-body.js.map +1 -0
  42. package/dist/domain/design/artifact.js +606 -0
  43. package/dist/domain/design/artifact.js.map +1 -0
  44. package/dist/domain/design/baseline.js +359 -0
  45. package/dist/domain/design/baseline.js.map +1 -0
  46. package/dist/domain/design/capability.js +51 -0
  47. package/dist/domain/design/capability.js.map +1 -0
  48. package/dist/domain/design/closure.js +161 -0
  49. package/dist/domain/design/closure.js.map +1 -0
  50. package/dist/domain/design/governance.js +298 -0
  51. package/dist/domain/design/governance.js.map +1 -0
  52. package/dist/domain/design/identity.js +145 -0
  53. package/dist/domain/design/identity.js.map +1 -0
  54. package/dist/domain/design/manifest.js +552 -0
  55. package/dist/domain/design/manifest.js.map +1 -0
  56. package/dist/domain/design/maturity.js +234 -0
  57. package/dist/domain/design/maturity.js.map +1 -0
  58. package/dist/domain/design/naming.js +117 -0
  59. package/dist/domain/design/naming.js.map +1 -0
  60. package/dist/domain/design/projections.js +165 -0
  61. package/dist/domain/design/projections.js.map +1 -0
  62. package/dist/domain/design/reference.js +234 -0
  63. package/dist/domain/design/reference.js.map +1 -0
  64. package/dist/domain/design/retired.js +61 -0
  65. package/dist/domain/design/retired.js.map +1 -0
  66. package/dist/domain/design/revision.js +219 -0
  67. package/dist/domain/design/revision.js.map +1 -0
  68. package/dist/domain/design/secrets.js +86 -0
  69. package/dist/domain/design/secrets.js.map +1 -0
  70. package/dist/domain/design/validation.js +75 -0
  71. package/dist/domain/design/validation.js.map +1 -0
  72. package/dist/domain/design/yaml-subset.js +390 -0
  73. package/dist/domain/design/yaml-subset.js.map +1 -0
  74. package/dist/domain/safe-path.js +23 -0
  75. package/dist/domain/safe-path.js.map +1 -0
  76. package/dist/domain/skills.js +27 -3
  77. package/dist/domain/skills.js.map +1 -1
  78. package/package.json +1 -1
  79. package/skills/w/SKILL.md +10 -8
  80. package/skills/w/artifacts/README.md +3 -4
  81. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
  82. package/skills/w/commands/plan-exec.md +11 -5
  83. package/skills/w/commands/plan-new.md +6 -2
  84. package/skills/w/commands/plan-refine.md +6 -3
  85. package/skills/w/commands/quick.md +2 -2
  86. package/skills/w/commands/spec-new.md +2 -2
  87. package/skills/w/commands/spec-refine.md +1 -0
  88. package/skills/w/context/MANIFEST.json +19 -8
  89. package/skills/w/loops/CHASSIS.md +2 -2
  90. package/skills/w/loops/CODE-POLICIES.md +22 -7
  91. package/skills/w/loops/README.md +1 -1
  92. package/skills/w/loops/plan-exec-loop/LOOP.md +127 -61
  93. package/skills/w/loops/plan-new-loop/LOOP.md +66 -70
  94. package/skills/w/loops/plan-refine-loop/LOOP.md +15 -7
  95. package/skills/w/loops/spec-refine-loop/LOOP.md +14 -12
  96. package/skills/w/modules/DESIGN-REFERENCES.md +109 -0
  97. package/skills/w/modules/PERSIST-ROUTING.md +1 -0
  98. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +84 -0
  99. package/skills/w/roles/README.md +7 -5
  100. package/skills/w/roles/design/ROLE.md +217 -0
  101. package/skills/w/schemas/design/design-baseline.v1.schema.json +71 -0
  102. package/skills/w/schemas/design/design-manifest.v1.schema.json +322 -0
  103. package/skills/w/schemas/design/design-review.v1.schema.json +72 -0
  104. package/skills/w/schemas/design/design-revocation.v1.schema.json +54 -0
  105. package/skills/w/schemas/design/ui-flow.v1.schema.json +211 -0
  106. package/skills/w/schemas/design/ui-screen.v1.schema.json +214 -0
  107. package/skills/w/artifacts/artifacts-design/SPEC.md +0 -42
  108. package/skills/w/modules/PLAN-DESIGN-SPECS.md +0 -12
  109. package/skills/w/modules/PLAN-REFINE-DESIGN-SPECS.md +0 -7
  110. package/skills/w/roles/ui-spec/ROLE.md +0 -147
package/skills/w/SKILL.md CHANGED
@@ -48,7 +48,7 @@ USER invokes
48
48
  │ the export-* read the artifacts
49
49
 
50
50
  docs/ ZONE — permanent, user-facing documents
51
- specs · plans (flows) · research (persist / no-flow) · scripts · manuals · diagrams · reports (export-*) · tools (ambient)
51
+ specs · plans (flows) · designs (UI Design Packages) · research (persist / no-flow) · scripts · manuals · diagrams · reports (export-*) · tools (ambient)
52
52
  ```
53
53
 
54
54
  - **Layer 1** — high level. Single-pass or starts a loop. No iteration logic.
@@ -108,7 +108,7 @@ The flows are **composable with host-native work, never exclusive**. The host is
108
108
  - `/w:spec-refine` — starts `spec-refine-loop` to refine the spec until it is `ready-for-plan`: the blocking functional decisions closed, the architecture/implementation ones declared for PLAN.
109
109
  - `/w:plan-new` — starts `plan-new-loop` to derive an executable plan from the ready spec.
110
110
  - `/w:plan-refine` — starts `plan-refine-loop` to turn the plan, in place, into an executable sequence of functional states (auxiliary, **not mandatory**); it is also the return path when execution hits a structural deviation.
111
- - `/w:plan-exec` — starts `plan-exec-loop` to execute the planned states and maintain the plan: it validates each phase before closing it, and never silently redesigns what it was given.
111
+ - `/w:plan-exec` — executes planned states in live-inferred isolated/continuous batches; continuous units validate, review and commit only at batch close.
112
112
  - `/w:quick` — starts `quick-loop` (shortcut, no `docs/`; escalates live to SPEC when the objective exceeds a quick).
113
113
  - `/w:export-scripts` · `/w:export-manuals` · `/w:export-diagrams` · `/w:export-reports` — promote artifacts to `docs/`.
114
114
 
@@ -143,16 +143,16 @@ Common: Layer 1, explicit (user-invoked, never by a loop) · single-pass, read-o
143
143
 
144
144
  ### Capability skills + `.workflow/skills.toml`
145
145
 
146
- A loop does **not** compose a concrete skill; it composes a **capability by its role** (e.g. `ui-design`). Which skill fulfills the role is decided by config, never by the loop. Swapping implementations = one config line.
146
+ A loop does **not** compose a concrete skill; it composes a **capability by its role** (e.g. `design`). Which skill fulfills the role is decided by config, never by the loop. Swapping implementations = one config line.
147
147
 
148
148
  ```toml
149
149
  [skills]
150
- ui-design = "ui-spec" # built-in default
150
+ design = "design" # built-in default
151
151
  sql = "sql"
152
152
  git = "git"
153
153
  research = "research"
154
154
  # diagrams = "off" # ← capability disabled
155
- # ui-design = "acme/figma-spec" # ← third-party skill (via skills.sh)
155
+ # design = "acme/figma-spec" # ← third-party skill (via skills.sh)
156
156
  ```
157
157
 
158
158
  **Resolution cascade**: built-in default → `~/.workflow/skills.toml` (global, machine) → `.workflow/skills.toml` (workspace). Workspace overrides global; global overrides default. Unbound role → built-in default. `off` → disabled (the loop continues without it; if it was needed, it says so or asks).
@@ -161,13 +161,15 @@ Role catalog and defaults:
161
161
 
162
162
  | Role | Default | Tier | Composed by |
163
163
  |---|---|---|---|
164
- | `ui-design` | `ui-spec` | must | `spec-refine-loop` (UI) · `plan-new-loop` / `plan-refine-loop` (design SPECs) |
164
+ | `design` | `design` | must | `spec-refine-loop` (UI) · `plan-new-loop` / `plan-refine-loop` · `plan-exec-loop` (reads, never redesigns) |
165
165
  | `sql` | `sql` | must | research · `plan-exec-loop` · `quick-loop` · `export-scripts` |
166
166
  | `git` | `git` | must | `plan-exec-loop` · `quick-loop` |
167
167
  | `research` | `research` | should | every loop (inline capability) |
168
168
  | `diagrams` | `diagrams` | should | `export-diagrams` |
169
169
  | `overview` | `w` | should | anyone (orientation) |
170
170
 
171
+ > † **The composing loops land references, not design.** `spec-refine` keeps `## Design references` and the plan loops promote the closure they implement and pin exact roots. The retired names `ui-design` and `ui-spec` resolve to nothing — no alias, no dual-read, no migration. See [roles/README.md](roles/README.md).
172
+ >
171
173
  > **Ambient conventions (not roles):** code/testing/writing standards and `creating-tools` are standalone skills the host auto-discovers by `description` — Workline neither binds nor depends on them. Full doctrine: [roles/README.md](roles/README.md).
172
174
 
173
175
  The **loop chassis** is NOT bound: it is the common engine of the 5 loops ([`loops/CHASSIS.md`](loops/CHASSIS.md), a referenced doc), not a pluggable capability.
@@ -199,8 +201,8 @@ One language per plane — never mix them:
199
201
  ### The 6 hard invariants
200
202
 
201
203
  1. **No auto-export** — loops never graduate/export to `docs/`. Only `export-*` does, explicitly.
202
- 2. **Each flow touches only its `docs/` folders** — SPEC→`specs` · PLAN→`plans` · QUICK→none · rest→`export-*`. (`docs/tools` and `docs/research` belong to no flow: `docs/tools` is written by the ambient skill `creating-tools`; `docs/research` by `/w:persist` or direct no-flow authoring.)
203
- 3. **The spec and the plan are documents** (`docs/`), not session artifacts. *(Not to be confused with the **design SPECs** `NNN-SPEC-<SLUG>.md`: **per-screen** UI design artifacts that PLAN sessions produce via the `ui-design` capability when the plan includes UI — see `artifacts/artifacts-design/`they are not the requirement-spec.)*
204
+ 2. **Each flow touches only its `docs/` folders** — SPEC→`specs` · PLAN→`plans` · QUICK→none · rest→`export-*`, **plus `docs/designs` for whichever loop composes the `design` capability** (spec-refine and the plan loops publish the package; `plan-exec` only reads it). (`docs/tools` and `docs/research` belong to no flow: `docs/tools` is written by the ambient skill `creating-tools`; `docs/research` by `/w:persist` or direct no-flow authoring.)
205
+ 3. **The spec and the plan are documents** (`docs/`), not session artifacts. *(Not to be confused with the **UI Design Package** the `design` capability produces under `docs/designs/NNN-design-<slug>/`: a durable dossier a spec **references** by baseline and digest — see [`roles/design/ROLE.md`](roles/design/ROLE.md)it is not the requirement-spec.)*
204
206
  4. **DB scripts-only** — the AI never executes DML/DDL; migrations stay in `SCRIPTS.sql` and the user applies them. Only read-only reads via MCP.
205
207
  5. **Safe git** — expected branch verified before editing; proposed commits per source; never `push`/`--amend`/`--no-verify`.
206
208
  6. **Loop chassis** — the 5 loops run the same **common engine**; each loop is an heir adding only its deltas, nothing of the engine is re-declared. Detail: `loops/CHASSIS.md`.
@@ -35,7 +35,7 @@ Sessions are created by the loops as needed — **one session per run**. The ses
35
35
 
36
36
  > **Inline research (any session):** research is **not** a session type. When any session (`refine`/`exec`/`quick`) needs to investigate, it produces research artifacts **inline**: `ANALYSIS-FILE` (optional scratchpad), `CONCLUSIONS`, and read-only `SCRIPTS.sql` (if DB). These are written into the active session — there is no separate research session.
37
37
 
38
- > **Inline design (PLAN sessions):** when the plan **includes UI**, `plan-new-loop`/`plan-refine-loop` compose the **`ui-design`** capability and produce **design SPECs** `NNN-SPEC-<SLUG>.md`, one **per screen** (`001-SPEC-MODAL-EXPORT.md`, `002-SPEC-ADMIN-DASHBOARD.md`), numbering local to the session inside their own session. The plan-doc **references** them (UI Tasks) and `plan-exec-loop` reads them as the design reference. They are **not** the requirement-spec (invariant 3): they are process artifacts. See [`artifacts-design/`](artifacts-design/).
38
+ > **Design is NOT a session artifact.** When a spec or a plan involves UI, the composed [`design`](../roles/design/ROLE.md) capability publishes a **UI Design Package** under `docs/designs/NNN-design-<slug>/` a durable dossier the spec references by baseline and digest and the plan pins by exact root. Nothing about it lives in a session. The per-screen design SPEC (`NNN-SPEC-<SLUG>.md`) that PLAN sessions used to carry is **retired and unsupported**: no loop produces or reads one, there is no importer or conversion, and presenting one as input or as a gate's evidence is rejected — the result has to be recreated from current sources. Documents already written stay exactly where they are, byte for byte.
39
39
 
40
40
  > **PLAN note (rich plan):** the plan-doc (`docs/plans/PPP-plan.md`) absorbs inline the `TECHNICAL-NOTE` level (`Solution` — summary + AS-IS → TO-BE delta + Final behavior block —, `Impacted`, `Validations`…) **and** the phased `Tasks` (`### Fn` blocks). Therefore exec sessions do **not** carry a `TECHNICAL-NOTE` or own `TASKS` artifact: the technical detail and progress live in the plan-doc (living). `TASKS` remains as an optional artifact for sessions that need their own internal breakdown.
41
41
 
@@ -53,7 +53,6 @@ Sessions are created by the loops as needed — **one session per run**. The ses
53
53
  |---|---|---|
54
54
  | [`artifacts-core/`](artifacts-core/) | common to any session | `SESSION` · `TASKS` · `CHECKPOINT` · `BACKLOG` · `SCRIPTS.sql` |
55
55
  | [`artifacts-research/`](artifacts-research/) | inline research (any session) | `ANALYSIS-FILE` · `CONCLUSIONS` |
56
- | [`artifacts-design/`](artifacts-design/) | inline design (PLAN sessions with UI) | `NNN-SPEC-<SLUG>.md` (design SPEC, one per screen) |
57
56
  | [`artifacts-exec/`](artifacts-exec/) | `exec` / `quick` session | `DECISION` · `TECHNICAL-NOTE` (schema reference; absorbed by the plan-doc) |
58
57
 
59
58
  ---
@@ -61,6 +60,6 @@ Sessions are created by the loops as needed — **one session per run**. The ses
61
60
  ## Invariants (hard rules — canonical list: [`../SKILL.md`](../SKILL.md) § *The 6 hard invariants*)
62
61
 
63
62
  1. **No auto-export**: only `export-*` promotes to `docs/`, explicitly.
64
- 2. **Each flow touches only its `docs/` folders**: SPEC→`specs` · PLAN→`plans` · QUICK→none.
65
- 3. **Spec and plan are documents**, never session artifacts. *(Design SPECs `NNN-SPEC-<SLUG>.md` are a different thing: per-screen UI artifacts of PLAN sessions — [`artifacts-design/`](artifacts-design/).)*
63
+ 2. **Each flow touches only its `docs/` folders**: SPEC→`specs` · PLAN→`plans` · QUICK→none — plus `docs/designs` for whichever loop composes `design`.
64
+ 3. **Spec and plan are documents**, never session artifacts. *(Neither is the **UI Design Package** under `docs/designs/`: a durable dossier the spec references, not the requirement-spec.)*
66
65
  4. **DB scripts-only**: never execute DML/DDL; migrations (type B) stay in `SCRIPTS.sql` and ship via `export-scripts`; only read-only queries (type A) run via MCP.
@@ -13,10 +13,10 @@
13
13
  ## Completed
14
14
  What already happened: finished phases/tasks/gaps with their outcome (ref: plan-doc `docs/plans/PPP-plan.md`, the spec's gaps, or `TASKS.md` if the session created its own split). Fold the key context a resume needs (settled decisions, discoveries) into these bullets.
15
15
 
16
- > **Implemented is not validated (exec sessions).** A phase lands here only once the plan-doc's `> Estado: validada` was flipped. Work that is written but not yet proven stays in `Pending / Next` with its validation pending — a full set of ticked tasks never promotes a phase into this section. Each closed phase records the **functional state reached** and, **only when the change carries one**, the **simulation boundary in force** — that, not the list of files touched, is what a resume actually needs.
16
+ > **Implemented is not validated (exec sessions).** A phase lands here only once the plan-doc's `> Estado: validada` was flipped. Work that is written but not yet proven stays in `Pending / Next` with its validation pending — a full set of ticked tasks never promotes a phase into this section. Continuous-batch phases move together only after their combined validation/review. Each closed phase records the **functional state reached** and, **only when the change carries one**, the **simulation boundary in force** — that, not the list of files touched, is what a resume actually needs.
17
17
 
18
18
  ## Pending / Next
19
- The intent: what remains and what comes immediately next (seeded BEFORE executing — artifact-first). A resume starts here. In exec: the next functional state being pursued, plus any blocker or deferral that keeps a phase out of `validada`. A phase left `bloqueada` states here **what is missing to validate it** — applying the migration, an environment, a third party — so the next run knows what to execute before flipping the state.
19
+ The intent: what remains and what comes immediately next (seeded BEFORE executing — artifact-first). A resume starts here. In exec, record the effective batch (`id` · `continuous|isolated` · phases), any declared-vs-live regrouping and explicit conditional commit authorization, then the next functional state. A phase left `bloqueada` states here **what is missing to validate it** — applying the migration, an environment, a third party — so the next run knows what to execute before flipping the state.
20
20
 
21
21
  ## Open questions
22
22
  Live doubts not yet resolved — the section exists only while there are any (rule 1). Deferred ones move to the session's `BACKLOG` or the flow doc's `## Open questions`.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when a plan is ready to implement — the real work: code edits, proposed SQL scripts, created tools. Starts or resumes plan-exec-loop over docs/plans/PPP-plan-<slug>.md, phase by phase, validating each before closing it. Git-safe (proposes commits, never push/--amend).
2
+ description: Use when a plan is ready to implement. Starts/resumes plan-exec-loop over docs/plans/PPP-plan-<slug>.md, re-inferring continuous batches and deferring their validation, review and single-per-source commits to batch close.
3
3
  argument-hint: <docs/plans/PPP-plan-<slug>.md>
4
4
  allowed-tools:
5
5
  [
@@ -12,19 +12,25 @@ allowed-tools:
12
12
 
13
13
  # plan-exec — trampoline to the execution loop
14
14
 
15
- Starts or resumes `plan-exec-loop` (Layer 2), which executes the real work phase by phase — each phase a **verifiable state of the system**, not a batch of technical chores. The plan is a living document the loop keeps updated: each `### Fn` carries its own `> Estado:` line (`pendiente` | `en ejecución` | `bloqueada` | `validada`) next to its task checkboxes.
15
+ Starts or resumes `plan-exec-loop` (Layer 2). Phases remain verifiable states; effective batches are
16
+ execution units. The loop re-infers them from live state using
17
+ [`PLAN-EXECUTION-BATCHES`](../modules/PLAN-EXECUTION-BATCHES.md), then updates each phase's
18
+ checkboxes and `> Estado:` line in the living plan.
16
19
 
17
20
  > **Hard floor — applies even if you read nothing beyond this file:**
18
21
  >
19
22
  > 1. **Session first** — create/resume the run's session before touching code: `aw session-create --type exec --name <slug>-plan-exec --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next`; `## Open questions` only while live doubts exist).
20
- > 2. **Git/DB** — verify each source's expected branch before editing (`aw check-branch`); commits are **proposed**, never executed without approval; **never** `push`/`--amend`/`--no-verify`; never execute DML/DDL (SQL goes to the session's `SCRIPTS.sql`).
23
+ > 2. **Git/DB** — branch-check before a batch; exactly one commit per affected source after its
24
+ > checks/review. Use one final approval unless the user explicitly pre-authorized green commits.
25
+ > Never `push`/`--amend`/`--no-verify`; DML/DDL stays in `SCRIPTS.sql`.
21
26
  > 3. **Ask, don't invent** — user-dependent decisions go through questions with a recommended option first (≤3 content questions + the `flow` control `Compactar`/`Cerrar`).
22
27
  > 4. **Language** — everything user-facing (questions, option labels, reports) goes in the **user's language**.
23
28
 
24
29
  ## Run the loop
25
30
 
26
31
  1. `aw context-plan --command plan-exec --root "${CLAUDE_PLUGIN_ROOT}/skills/w"` — read exactly the documents it lists, in order.
27
- 2. Follow the loop manual end to end, taking `$ARGUMENTS` as input: it checks executability on entry, executes phase by phase (git-safe, DB scripts-only), keeps the plan alive and reports.
32
+ 2. Follow it end to end: check executability, infer live batches, execute each without internal
33
+ validation pauses, then validate/review/commit at its close.
28
34
 
29
35
  > `plan-exec-loop` is **not** a skill invocable by name — it is this command's operating manual. The command **is** the entry; the loop is its body. It is **resumable**: an existing CHECKPOINT continues from there.
30
36
 
@@ -40,4 +46,4 @@ Starts or resumes `plan-exec-loop` (Layer 2), which executes the real work phase
40
46
  - `db` — the plan touches a database → [`../modules/EXEC-DB-POLICY.md`](../modules/EXEC-DB-POLICY.md)
41
47
  - `probe` — a task is a PoC → [`../modules/EXEC-PROBE-TASKS.md`](../modules/EXEC-PROBE-TASKS.md)
42
48
  - `simulation` — **only when the change carries temporary behavior**, its boundary is declared and its retirement identified → [`../modules/SIMULATION-LIFECYCLE.md`](../modules/SIMULATION-LIFECYCLE.md)
43
- - `ui` — the plan references design SPECs → [`../modules/PLAN-DESIGN-SPECS.md`](../modules/PLAN-DESIGN-SPECS.md)
49
+ - `ui` — the plan pins design references → [`../modules/DESIGN-REFERENCES.md`](../modules/DESIGN-REFERENCES.md). Before implementing a task that pins one, `aw designs --plan <plan-doc>` decides: absent, altered, revoked or an applicable closure short of `handoff` **block** naming the artifact and the fix; superseded-but-intact only warns. `plan-exec` never redesigns.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when a spec is ready to become an executable plan — not to refine one (plan-refine) nor execute one (plan-exec). Starts plan-new-loop from docs/specs/NNN-spec-<slug>.md, turning the "what" into the "how". Also adopts an externally-built plan. May split into sibling plans.
2
+ description: Use when a spec is ready to become an executable plan. Starts plan-new-loop from docs/specs/NNN-spec-<slug>.md, turning the "what" into functional phases and inferred execution batches. Also adopts an external plan and may split siblings.
3
3
  argument-hint: <docs/specs/NNN-spec-<slug>.md | prompt>
4
4
  allowed-tools:
5
5
  [
@@ -32,11 +32,15 @@ SPEC → PLAN bridge. Turns the "what" (refined spec) into the "how" (plan). Del
32
32
 
33
33
  The plan is born with `### Fn` phases that each leave a **verifiable state of the system** — each with its `> Estado:` line, its primary evidence and its exit condition — never a list of files, classes or layers. The blocks beyond those are **conditional**: a phase with no temporary behavior gets no `Límite de simulación`, and one with nothing excluded gets no `Diferido` — a heading is never written empty to satisfy a template. The plan itself is born `> Estado: open`; only `plan-exec` closes it.
34
34
 
35
+ It also writes the complete `## Execution batches` partition from
36
+ [`PLAN-EXECUTION-BATCHES`](../modules/PLAN-EXECUTION-BATCHES.md): maximal eligible ranges are
37
+ `continuous`; the rest are one-phase `isolated` units. This is inferred, not asked.
38
+
35
39
  ## More context
36
40
 
37
41
  `aw context-plan --command plan-new --signal <s> --root "${CLAUDE_PLUGIN_ROOT}/skills/w"` returns the extra documents a case needs; read exactly what it lists:
38
42
 
39
43
  - `input` — the argument is not plainly a `ready-for-plan` spec → [`../modules/PLAN-INPUT.md`](../modules/PLAN-INPUT.md)
40
44
  - `split` — the spec may need more than one plan → [`../modules/PLAN-SPLIT-GATE.md`](../modules/PLAN-SPLIT-GATE.md)
41
- - `ui` — the plan includes UI, so it composes `ui-design` → [`../modules/PLAN-DESIGN-SPECS.md`](../modules/PLAN-DESIGN-SPECS.md)
45
+ - `ui` — the plan includes UI: promote the closure, pin the roots → [`../modules/DESIGN-REFERENCES.md`](../modules/DESIGN-REFERENCES.md)
42
46
  - `probe` — the plan rests on a runnable unknown → [`../modules/PLAN-PROBE-TASKS.md`](../modules/PLAN-PROBE-TASKS.md)
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when a plan must become executable before running it — new requirements, scope tweaks, phases shaped as file lists, or a structural deviation returned by plan-exec. Starts plan-refine-loop, which re-shapes docs/plans/PPP-plan-<slug>.md in place into verifiable functional states.
2
+ description: Use when a plan must become executable before running it. Starts plan-refine-loop, which re-shapes docs/plans/PPP-plan-<slug>.md in place into verifiable functional states and re-infers its execution batches.
3
3
  argument-hint: <docs/plans/PPP-plan-<slug>.md>
4
4
  allowed-tools:
5
5
  [
@@ -28,7 +28,10 @@ allowed-tools:
28
28
 
29
29
  > `plan-refine-loop` is **not** a skill invocable by name — it is this command's operating manual. The command **is** the entry; the loop is its body.
30
30
 
31
- **Expected output: an executable plan.** The loop converges on its **executability gate** — each phase a verifiable state with its evidence, its exit condition and, **only when the change carries temporary behavior**, its simulation boundary — so `plan-exec` implements it without inventing contracts, observable states, order or evidence.
31
+ **Expected output: an executable plan.** Each phase has evidence and an exit condition;
32
+ **only when the change carries temporary behavior**, it declares that boundary. The complete partition follows
33
+ [`PLAN-EXECUTION-BATCHES`](../modules/PLAN-EXECUTION-BATCHES.md), so execution need not invent or
34
+ ask about units.
32
35
 
33
36
  ## More context
34
37
 
@@ -38,4 +41,4 @@ allowed-tools:
38
41
  - `resume` — a prior refinement of this plan may exist → [`../modules/PLAN-REFINE-KEYS.md`](../modules/PLAN-REFINE-KEYS.md)
39
42
  - `replan` — work already executed has to be re-planned around → [`../modules/REPLANNING.md`](../modules/REPLANNING.md)
40
43
  - `simulation` — the change carries temporary behavior, so **only when** it does, its boundary is declared → [`../modules/SIMULATION-LIFECYCLE.md`](../modules/SIMULATION-LIFECYCLE.md)
41
- - `ui` — the refine touches UI → [`../modules/PLAN-REFINE-DESIGN-SPECS.md`](../modules/PLAN-REFINE-DESIGN-SPECS.md)
44
+ - `ui` — the refine touches UI, so it revises only the artifacts it affects → [`../modules/DESIGN-REFERENCES.md`](../modules/DESIGN-REFERENCES.md)
@@ -30,8 +30,8 @@ Delegates to `quick-loop` (Layer 2). Creates a light session (traceability + res
30
30
 
31
31
  ## Two things this command never does
32
32
 
33
- - **It never touches `docs/`** and it exports nothing.
34
- - **It never re-derives what the conversation already settled.** Analysis already established here is *input*, seeded into the session with `## Origin` = adopted.
33
+ - **It never writes `docs/`** and it exports nothing. It may READ a design package; changing one escalates.
34
+ - **It never re-derives what the conversation already settled** that analysis is *input* (`## Origin` = adopted).
35
35
 
36
36
  ## More context
37
37
 
@@ -76,7 +76,7 @@ Assumed facts.
76
76
  Pending doubts. ← the spec-refine-loop closes them.
77
77
  ```
78
78
 
79
- > **`Open questions` goes last** — the refined spec **inserts before `Open questions`** `## UI spec` (if there is UI) + `## Decisions`, and may add `## Affected capabilities` / `## Behavioral changes` right after `Context` when the change touches behavior that already exists (refined schema in the [`spec-refine-loop`](../loops/spec-refine-loop/LOOP.md); the refine drops `Open questions` when it empties). Draft and refined spec share the same skeleton and order.
79
+ > **`Open questions` goes last** — the refined spec **inserts before `Open questions`** `## Design references` (if there is UI) + `## Decisions`, and may add `## Affected capabilities` / `## Behavioral changes` right after `Context` when the change touches behavior that already exists (refined schema in the [`spec-refine-loop`](../loops/spec-refine-loop/LOOP.md); the refine drops `Open questions` when it empties). Draft and refined spec share the same skeleton and order.
80
80
 
81
81
  **Filling notes:**
82
82
 
@@ -88,7 +88,7 @@ Pending doubts. ← the spec-refine-loop closes them.
88
88
  - **The code found never widens `Scope`** and never becomes a requirement: **acceptance criteria derive from the user's intent**. The reconnaissance may lend vocabulary, name existing actors and boundaries, and avoid obvious contradictions. It must not invent behavior nobody asked for, turn a current technical decision into a user requirement, or impose an implementation as a criterion.
89
89
  - **Acceptance criteria = static testable criteria** (the "what"): `plan-exec` validates them, but progress is tracked in the PLAN (its Tasks), never by ticking these `- [ ]`; the spec never mutates by execution, only by a re-refine.
90
90
  - **Scenarios = behavior made concrete** (uppercase GIVEN/WHEN/THEN/AND): draft them only when the prompt already describes behavior — deriving the rest is spec-refine work. A scenario earns its place only when it adds GIVEN setup or edge semantics the criterion does not capture — **never restate a criterion 1:1**.
91
- - If **UI** is involved, mention it in `Requirement`/`Context`; `## UI spec` is authored in `spec-refine` (via the `ui-design` capability). "UI unspecified" is a first-class refinement gap.
91
+ - If **UI** is involved, **record the need and stop there**: mention it in `Requirement`/`Context`. This command creates **no design package** and writes no `## Design references` — the design is composed in `spec-refine` (via the [`design`](../roles/design/ROLE.md) capability, which publishes the package the spec then references). Minting a package from a draft would pin an identity before the requirement is even closed. "UI unspecified" is a first-class refinement gap.
92
92
  - The **gaps** the loop detects = weak sections of the schema (vague Requirement, Scope without `Out`, untestable criteria, open questions, undeclared assumptions, contradictions) **+ UI unspecified** when the requirement involves UI.
93
93
  - Equivalent alternative: the user writes the draft by hand. Both paths produce the same file.
94
94
 
@@ -35,5 +35,6 @@ Delegates to `spec-refine-loop` (Layer 2), which iterates, closes the blocking g
35
35
  `aw context-plan --command spec-refine --signal <s> --root "${CLAUDE_PLUGIN_ROOT}/skills/w"` returns the extra documents a case needs; read exactly what it lists:
36
36
 
37
37
  - `shape` — the loop's change-shape gate fired and you must tell `split` from `replace` → [`../modules/SPEC-CHANGE-SHAPE.md`](../modules/SPEC-CHANGE-SHAPE.md)
38
+ - `ui` — the requirement involves UI, so the spec references a design package instead of containing one → [`../modules/DESIGN-REFERENCES.md`](../modules/DESIGN-REFERENCES.md)
38
39
  - `resume` — a prior refinement of this spec may exist → [`../modules/SPEC-REFINE-KEYS.md`](../modules/SPEC-REFINE-KEYS.md)
39
40
  - `web` — the solution space looks unexplored and the loop opens its ideation step → [`../modules/IDEATION-GATE.md`](../modules/IDEATION-GATE.md)
@@ -53,6 +53,10 @@
53
53
  "signal": "db",
54
54
  "requires": "external-data"
55
55
  },
56
+ {
57
+ "path": "modules/DESIGN-REFERENCES.md",
58
+ "signal": "ui"
59
+ },
56
60
  {
57
61
  "path": "modules/COMPACTION.md",
58
62
  "signal": "compaction",
@@ -100,6 +104,10 @@
100
104
  "path": "modules/SPEC-REFINE-KEYS.md",
101
105
  "signal": "resume"
102
106
  },
107
+ {
108
+ "path": "modules/DESIGN-REFERENCES.md",
109
+ "signal": "ui"
110
+ },
103
111
  {
104
112
  "path": "modules/IDEATION-GATE.md",
105
113
  "signal": "web",
@@ -130,7 +138,12 @@
130
138
  ]
131
139
  },
132
140
  "plan-new": {
133
- "core": ["commands/plan-new.md", "loops/plan-new-loop/LOOP.md", "loops/CHASSIS.md"],
141
+ "core": [
142
+ "commands/plan-new.md",
143
+ "loops/plan-new-loop/LOOP.md",
144
+ "modules/PLAN-EXECUTION-BATCHES.md",
145
+ "loops/CHASSIS.md"
146
+ ],
134
147
  "modules": [
135
148
  {
136
149
  "path": "modules/PLAN-MODE.md",
@@ -149,7 +162,7 @@
149
162
  "signal": "split"
150
163
  },
151
164
  {
152
- "path": "modules/PLAN-DESIGN-SPECS.md",
165
+ "path": "modules/DESIGN-REFERENCES.md",
153
166
  "signal": "ui"
154
167
  },
155
168
  {
@@ -185,6 +198,7 @@
185
198
  "commands/plan-refine.md",
186
199
  "loops/plan-refine-loop/LOOP.md",
187
200
  "loops/plan-new-loop/LOOP.md",
201
+ "modules/PLAN-EXECUTION-BATCHES.md",
188
202
  "loops/CHASSIS.md"
189
203
  ],
190
204
  "modules": [
@@ -213,11 +227,7 @@
213
227
  "signal": "split"
214
228
  },
215
229
  {
216
- "path": "modules/PLAN-REFINE-DESIGN-SPECS.md",
217
- "signal": "ui"
218
- },
219
- {
220
- "path": "modules/PLAN-DESIGN-SPECS.md",
230
+ "path": "modules/DESIGN-REFERENCES.md",
221
231
  "signal": "ui"
222
232
  },
223
233
  {
@@ -260,6 +270,7 @@
260
270
  "core": [
261
271
  "commands/plan-exec.md",
262
272
  "loops/plan-exec-loop/LOOP.md",
273
+ "modules/PLAN-EXECUTION-BATCHES.md",
263
274
  "loops/CHASSIS.md",
264
275
  "loops/CODE-POLICIES.md"
265
276
  ],
@@ -296,7 +307,7 @@
296
307
  "signal": "simulation"
297
308
  },
298
309
  {
299
- "path": "modules/PLAN-DESIGN-SPECS.md",
310
+ "path": "modules/DESIGN-REFERENCES.md",
300
311
  "signal": "ui"
301
312
  },
302
313
  {
@@ -72,7 +72,7 @@ The common cycle — each heir instantiates it in its `## Sequence` with its own
72
72
  1. `detect_gaps(work)`, minus the *exhausted* gaps (see *Research*).
73
73
  2. If `∅` → **convergence gate** (see *Convergence / exit*).
74
74
  3. If there are gaps: take a batch (≤3) and **seed** `CHECKPOINT.Pending/Next` (*artifact-first*).
75
- 4. Resolve each gap with its **resolver** per the *ask-vs-research rule*: human (structured-choice) · inline research · a probe (PoC) · a composed capability (e.g. `ui-design`).
75
+ 4. Resolve each gap with its **resolver** per the *ask-vs-research rule*: human (structured-choice) · inline research · a probe (PoC) · a composed capability (e.g. `design`).
76
76
  5. **Integrate**, update `CHECKPOINT` → repeat.
77
77
 
78
78
  ## Internal sessions (managed) — one session per run
@@ -134,7 +134,7 @@ Resume **keys off the `CHECKPOINT`** of the run's session, not the existence of
134
134
 
135
135
  ## docs/ boundary — no auto-export (hard rule)
136
136
 
137
- A loop writes into `docs/` **only** its own flow's doc (spec-refine: `docs/specs` · the three plan flows: `docs/plans` · quick: **none** — it never touches `docs/`). No loop **graduates/promotes artifacts** into `docs/`: migrations → `docs/scripts`, manuals → `docs/manuals`, diagrams → `docs/diagrams` are done by the separate **`export-*`** skills, as an explicit later step; artifacts stay in their sessions until then. A task that creates a tool/utility has it documented in `docs/tools` by the ambient `creating-tools` skill (auto-discovered; Workline does not bind it).
137
+ A loop writes into `docs/` **only** its own flow's doc (spec-refine: `docs/specs` · the three plan flows: `docs/plans` · quick: **none** — it never touches `docs/`) plus, when it composes a capability whose own deliverable is a `docs/` category, that category — today only the **UI Design Package** under `docs/designs` (`design`). **Published, never graduated**: the test is the origin, not the folder. No loop **graduates/promotes artifacts** into `docs/`: migrations → `docs/scripts`, manuals → `docs/manuals`, diagrams → `docs/diagrams` are done by the separate **`export-*`** skills, as an explicit later step; artifacts stay in their sessions until then. A task that creates a tool/utility has it documented in `docs/tools` by the ambient `creating-tools` skill (auto-discovered; Workline does not bind it).
138
138
 
139
139
  ## Conditional modules
140
140
 
@@ -1,17 +1,31 @@
1
1
  # CODE-POLICIES — policies for code-editing loops
2
2
 
3
- They apply to **`plan-exec-loop`** (per plan phase) and **`quick-loop`** (the single task; **proportional** gate): each orders this doc read from its `## Inherits`, **together with the chassis** ([`CHASSIS.md`](CHASSIS.md)). The document loops (spec-refine, plan-new, plan-refine) edit no code and do **not** load this doc — that is why it lives apart from the chassis. These policies materialize the **DB scripts-only** and **safe git** invariants — which also stay summarized **inline** (1-2 lines) in each code-editing loop's `LOOP.md`, because advisory hosts do not follow Reads; the full normative text lives here.
3
+ They apply to **`plan-exec-loop`** (per effective batch) and **`quick-loop`** (the single task;
4
+ **proportional** gate): each reads this doc with the chassis. Document loops do not edit code and
5
+ do not load it. These policies own the DB scripts-only, safe Git and closing-review invariants;
6
+ code loops keep only a short inline floor for advisory hosts.
4
7
 
5
8
  ## Safe git — verified branch + proposed commits
6
9
 
7
- - **Before editing** a source's files: verify current branch = that source's expected branch (`aw check-branch --source <alias>`; see the `git` role). On mismatch → **pause and resolve with the human**; never `stash`/`reset --hard`/`checkout -- .`/`clean` without per-source confirmation.
8
- - **Proposed commits** (propose-then-execute, approve before): **after the closing review gate passes** (below), propose commits **per source** — in plan-exec at each phase close (or on `Cerrar`); in quick, **a single commit** at the end if there were code changes. Never `push`/`--amend`/`--no-verify`. Nothing reaches a proposed commit without review.
9
- - **Rejected commit**: the changes **stay in the working tree** (never reverted). Re-proposing / editing the message is allowed. Record in `CHECKPOINT` + `BACKLOG` that the phase/task remained **uncommitted** (resumable).
10
- - **Between-phase precondition** (plan-exec): `branch-check` validates branch *identity*, **not** working-tree *cleanliness*. Before starting the next phase, each source's working tree must be **clean** (committed) or explicitly **acknowledged** as "uncommitted changes from phase N" — so two phases never co-mingle in one commit.
10
+ - **Before editing** an execution unit's sources, verify every current branch (`aw check-branch
11
+ --source <alias>`). On mismatch, pause; never destructively clean or switch without confirmation.
12
+ - **Proposed commits:** only after the closing review gate. In plan-exec create exactly one commit
13
+ per affected source at effective-batch close; in quick, one at task close. Never
14
+ `push`/`--amend`/`--no-verify`.
15
+ - **Authorization:** default to one consolidated approval for a green batch's source commits. An
16
+ explicit user pre-authorization conditional on all checks passing is recorded before editing and
17
+ removes that final question. A failed or unrun check never authorizes a commit.
18
+ - **Rejected commit:** changes stay. Record the execution unit as uncommitted in `CHECKPOINT` and
19
+ `BACKLOG`.
20
+ - **Between-unit precondition:** each working tree is clean or explicitly acknowledged. A
21
+ `continuous` batch is the narrow exception that intentionally co-mingles its internal phases in
22
+ one reviewed commit; no batch may co-mingle with another.
11
23
 
12
24
  ## Closing review gate (conventions, pre-commit)
13
25
 
14
- After validation (of the phase in plan-exec; of the task in quick, proportional) and **before proposing its commits** (also on an early `Cerrar`, before proposing the pending commits), the diff passes a **closing review gate**:
26
+ After validation and before commits, the whole execution-unit diff passes a **closing review
27
+ gate**: an effective batch in plan-exec, or the proportional task in quick. Early `Cerrar` uses the
28
+ same gate before any pending commit.
15
29
 
16
30
  - **Independent re-read** of the diff (subagent or clean re-read — the engine's *independent verification*: it does not assume the implementation is correct; *only command output counts*).
17
31
  - **Apply the installed ambient conventions** relevant to the touched stack (code/stack standards, security, diff review, the workspace's own families) — the host **auto-discovers them by `description`**. Workline **names and binds no** concrete conventions skill: **it creates the moment; the installed skills fill it** (that is why review is **not a role** — see [`../roles/README.md`](../roles/README.md)). With no convention skills installed → minimal generic checklist: SOLID/early-return, clear names, DRY, no silenced errors, no secrets/PII, parametrized SQL, no dead code, + the plan's `Validations` (if any).
@@ -20,7 +34,8 @@ After validation (of the phase in plan-exec; of the task in quick, proportional)
20
34
  - **Temporary simulation check** (only when the change carries one): stubs, fakes and in-memory adapters are **explicit and named as such** (`Stub…` / `Fake…`), they sit at the boundary the plan declares, and no configuration can select them in a production runtime. A simulation still active on the main path with no declared removal is a finding, not a detail.
21
35
  - **Tooling check** (`docs/tools`): did the run create **reusable auxiliary tooling** (support scripts/CLIs/generators/reusable configs — not product code, not session probes)? → the host applies the **ambient `creating-tools` skill** (auto-discovered by its `description`; Workline does not bind it) so the tool gets its home under `docs/tools/<slug>/` (README + run/output structure per that skill's contract + its index row). Host without such a skill → the loop still **never writes `docs/tools` itself**: **declare the gap** — the homeless tool goes to the plan's `Open questions` + `BACKLOG` (in quick, `BACKLOG`) — never silent.
22
36
  - **Findings**: **fix** them in the working tree and **re-run validation** (the gate does not replace the tests: it re-verifies after fixing), or **defer them justified** (→ the plan's `Open questions` + `BACKLOG`; in quick, `BACKLOG`); the non-obvious → `DECISION`. Gate integrity (see [`CHASSIS.md`](CHASSIS.md) § *Verification-first*): never weaken a check or lower a convention to pass.
23
- - **Artifact-first + verification-first**: `CHECKPOINT.Next = "review <phase/task>"` before the pass; `SESSION.Success criteria` includes from the start "the diff passed the review gate before its commits".
37
+ - **Artifact-first + verification-first**: seed `CHECKPOINT.Next = "review <batch/task>"`; Success
38
+ criteria require the whole diff to pass before commits.
24
39
 
25
40
  Only with the gate green are the commits proposed.
26
41
 
@@ -47,7 +47,7 @@ The **5 loops** are heirs: they use `## Inherits` (a one-line reference to [`CHA
47
47
 
48
48
  ## Chassis / heirs
49
49
 
50
- The **engine lives in [`CHASSIS.md`](CHASSIS.md)** (a referenced doc, not a skill); the 5 loops — including `spec-refine-loop` — are **heirs** of that engine. The canonical heirs list and their deltas live in the chassis itself (§ *Heirs*). The chassis is **not a bindable capability**: it is the loop engine; what is pluggable are the **capabilities** a loop composes (e.g. `ui-design`, `sql`, `git`), resolved via `.workflow/skills.toml`.
50
+ The **engine lives in [`CHASSIS.md`](CHASSIS.md)** (a referenced doc, not a skill); the 5 loops — including `spec-refine-loop` — are **heirs** of that engine. The canonical heirs list and their deltas live in the chassis itself (§ *Heirs*). The chassis is **not a bindable capability**: it is the loop engine; what is pluggable are the **capabilities** a loop composes (e.g. `design`, `sql`, `git`), resolved via `.workflow/skills.toml`.
51
51
 
52
52
  ## Composed capabilities (roles)
53
53