@tacuchi/agent-workflow-cli 20.14.2 → 20.16.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 (35) hide show
  1. package/dist/application/history-table.js +106 -13
  2. package/dist/application/history-table.js.map +1 -1
  3. package/dist/application/history-update-service.js +5 -9
  4. package/dist/application/history-update-service.js.map +1 -1
  5. package/dist/application/session-resolver.js +16 -1
  6. package/dist/application/session-resolver.js.map +1 -1
  7. package/dist/application/status-service.js +1 -2
  8. package/dist/application/status-service.js.map +1 -1
  9. package/dist/application/templates/session.js +13 -5
  10. package/dist/application/templates/session.js.map +1 -1
  11. package/dist/cli/commands/history-update.js +3 -4
  12. package/dist/cli/commands/history-update.js.map +1 -1
  13. package/package.json +1 -1
  14. package/skills/w/SKILL.md +3 -1
  15. package/skills/w/artifacts/README.md +2 -2
  16. package/skills/w/artifacts/artifacts-core/BACKLOG.md +1 -4
  17. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
  18. package/skills/w/artifacts/artifacts-core/SESSION.md +2 -5
  19. package/skills/w/commands/export-diagrams.md +2 -2
  20. package/skills/w/commands/export-manuals.md +1 -1
  21. package/skills/w/commands/plan-exec.md +1 -1
  22. package/skills/w/commands/plan-new.md +4 -4
  23. package/skills/w/commands/plan-refine.md +4 -4
  24. package/skills/w/commands/quick.md +1 -1
  25. package/skills/w/commands/spec-new.md +2 -2
  26. package/skills/w/commands/spec-refine.md +3 -3
  27. package/skills/w/exports/README.md +2 -2
  28. package/skills/w/exports/export-diagrams/EXPORT.md +5 -5
  29. package/skills/w/exports/export-manuals/EXPORT.md +4 -4
  30. package/skills/w/loops/CHASSIS.md +3 -3
  31. package/skills/w/loops/CODE-POLICIES.md +2 -1
  32. package/skills/w/loops/plan-exec-loop/LOOP.md +8 -6
  33. package/skills/w/loops/plan-new-loop/LOOP.md +22 -21
  34. package/skills/w/loops/plan-refine-loop/LOOP.md +13 -15
  35. package/skills/w/loops/spec-refine-loop/LOOP.md +19 -18
@@ -16,7 +16,7 @@ SPEC → PLAN bridge. Turns the "what" (refined spec) into the "how" (plan). Del
16
16
 
17
17
  > **Hard floor — applies even if you read nothing beyond this file:**
18
18
  >
19
- > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-plan-new --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next` · `## Open questions`).
19
+ > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-plan-new --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next`; `## Open questions` only while live doubts exist).
20
20
  > 2. **Ask, don't invent** — user-dependent decisions go through questions with a recommended option first (≤3 content questions + the `flow` control `Compactar`/`Cerrar`).
21
21
  > 3. **Write boundary** — this flow writes only `docs/plans/…` (with confirmation if it exists); nothing else lands in `docs/`.
22
22
  > 4. **Language** — everything user-facing (questions, option labels, the plan's content) goes in the **user's language**.
@@ -25,14 +25,14 @@ SPEC → PLAN bridge. Turns the "what" (refined spec) into the "how" (plan). Del
25
25
 
26
26
  The skill evaluates `$ARGUMENTS` (specs live in place — `docs/specs/NNN-spec-<slug>.md`; locate via the `docs/specs/NNN-spec-*.md` glob or the exact path):
27
27
 
28
- 1. **Refined spec** (`docs/specs/NNN-spec-<slug>.md` that **already has** `## Refinement decisions` / `## Q&A traceability`) → ideal. Proceed straight to `plan-new-loop`.
29
- 2. **Draft spec** (same file, but **without** those two sections) → **soft-suggest** running `/w:spec-refine` first; planning over a solid spec produces better plans (the user may proceed anyway).
28
+ 1. **Refined spec** (`docs/specs/NNN-spec-<slug>.md` that **already has** `## Refinement decisions`) → ideal. Proceed straight to `plan-new-loop`.
29
+ 2. **Draft spec** (same file, but **without** that section) → **soft-suggest** running `/w:spec-refine` first; planning over a solid spec produces better plans (the user may proceed anyway).
30
30
  3. **prompt** (no spec referenced) → propose using the SPEC flow; **by default launch `/w:spec-new`** with that prompt to create the draft, and continue the natural flow from there.
31
31
  4. **External plan content** — the argument/conversation carries an **already-built plan** (host plan mode output, hand-written, another agent's) → **adopt it**. Single pass, **NO RESEARCH**: materialize as `docs/plans/PPP-plan-<slug>.md` (`aw next-number docs/plans`), normalized to the rich-plan schema (`../loops/plan-new-loop/LOOP.md` § *Delta 1*) with only what the source provides. `## Origin` = "adopted from <source>" + attribution (host · model · date). Then offer `/w:plan-refine` (closes schema gaps) or `/w:plan-exec`. Anti-duplicate: a plan whose `## Origin` matches this objective → recommend resuming it, never a second one. Adoption **never regenerates over** an existing plan-doc.
32
32
 
33
33
  > **Mode 3 vs 4:** a prompt that *describes a wish* → SPEC (mode 3); content that *already is a plan* → adopt (mode 4). Doctrine: `../loops/CHASSIS.md` § *Adopted context*.
34
34
 
35
- > **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` / `## Q&A traceability` in the spec, never by the filename (there is no `-refined` anymore).
35
+ > **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` in the spec, never by the filename (there is no `-refined` anymore). Legacy specs may also carry `## Q&A traceability` — they count as refined the same way.
36
36
 
37
37
  ## Run the loop
38
38
 
@@ -18,14 +18,14 @@ This command does not refine the plan itself: it delegates to `plan-refine-loop`
18
18
 
19
19
  > **Hard floor — applies even if you read nothing beyond this file:**
20
20
  >
21
- > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-plan-refine --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next` · `## Open questions`).
21
+ > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-plan-refine --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next`; `## Open questions` only while live doubts exist).
22
22
  > 2. **Ask, don't invent** — user-dependent decisions go through questions with a recommended option first (≤3 content questions + the `flow` control `Compactar`/`Cerrar`).
23
23
  > 3. **Write boundary** — this flow edits only `docs/plans/…` (in place, with confirmation); nothing else lands in `docs/`.
24
24
  > 4. **Language** — everything user-facing (questions, option labels, the plan's content) goes in the **user's language**.
25
25
 
26
26
  > **Not mandatory.** `plan-exec` runs **any** plan, refined or not — no gate requires passing through here. Use it only when the plan needs adjustments before executing.
27
27
  >
28
- > **Spec-less plans (hand-written / adopted).** A plan with no source spec is legitimate input. The coherence gate **degrades gracefully**: criteria trace to the plan's own `## Final behavior` / acceptance criteria instead of spec criteria — the "spec criteria uncovered" gap does not apply (see `../loops/plan-refine-loop/LOOP.md`).
28
+ > **Spec-less plans (hand-written / adopted).** A plan with no source spec is legitimate input. The coherence gate **degrades gracefully**: criteria trace to the plan's own Final behavior block (in `## Solution`) / acceptance criteria instead of spec criteria — the "spec criteria uncovered" gap does not apply (see `../loops/plan-refine-loop/LOOP.md`).
29
29
 
30
30
  ## Input resolution
31
31
 
@@ -49,8 +49,8 @@ The skill detects prior state before starting, **keying off the `CHECKPOINT`** (
49
49
 
50
50
  1. Find the plan's refinement session under `.workflow/sessions/` (descriptor `<slug>-plan-refine` + `## Origin`) and its `CHECKPOINT.md`.
51
51
  2. **In progress** (a CHECKPOINT exists) → continue from the recorded progress (resolved gaps, Q&A).
52
- 3. **No progress** (no CHECKPOINT and the plan does **not** have `## Refinement decisions`/`## Q&A traceability`) → start from zero reading the plan (`PPP-plan-*.md`).
53
- 4. **Already refined / re-refine on demand** (no open CHECKPOINT but the plan **already has** the 2 sections) → **first-class operation**: while the flow stays in PLAN you can re-run `/w:plan-refine` over the same plan **as many times as needed** (new requirements, scope changes, re-reads). The loop does `create_or_resume` — it locates the existing refine session (even closed) and **reopens** it instead of duplicating — and re-refines reading the **plan itself**; on `Guardar`, edits in place with confirmation.
52
+ 3. **No progress** (no CHECKPOINT and the plan does **not** have `## Refinement decisions`) → start from zero reading the plan (`PPP-plan-*.md`).
53
+ 4. **Already refined / re-refine on demand** (no open CHECKPOINT but the plan **already has** that section) → **first-class operation**: while the flow stays in PLAN you can re-run `/w:plan-refine` over the same plan **as many times as needed** (new requirements, scope changes, re-reads). The loop does `create_or_resume` — it locates the existing refine session (even closed) and **reopens** it instead of duplicating — and re-refines reading the **plan itself**; on `Guardar`, edits in place with confirmation.
54
54
 
55
55
  ## UI → design SPECs
56
56
 
@@ -17,7 +17,7 @@ For scoped, direct tasks that do not justify going through SPEC or PLAN. Creates
17
17
  > **Hard floor — applies even if you read nothing beyond this file:**
18
18
  >
19
19
  > 1. **Size gate BEFORE any session** — if the objective exceeds a quick (≥2 clear signals: needs architecture · ≥2 sources · several deliverables · large feature/refactor · ambiguous requirements), ask first with these verbatim options: `Cambiar a SPEC` *(recommended)* · `Seguir en quick` · `Recortar alcance`. If it escalates, create **no** quick session.
20
- > 2. **Session first** — otherwise, before touching code, create/resume the run's session: `aw session-create --type quick --name <slug>-quick --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next` · `## Open questions`).
20
+ > 2. **Session first** — otherwise, before touching code, create/resume the run's session: `aw session-create --type quick --name <slug>-quick --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next`; `## Open questions` only while live doubts exist).
21
21
  > 3. **Git/DB** — commits are **proposed**, never executed without approval; **never** `push`/`--amend`/`--no-verify`; never execute DML/DDL (SQL goes to the session's `SCRIPTS.sql`).
22
22
  > 4. **Language** — everything user-facing (questions, option labels, reports) goes in the **user's language**.
23
23
 
@@ -80,7 +80,7 @@ Assumed facts.
80
80
  Pending doubts. ← the spec-refine-loop closes them.
81
81
  ```
82
82
 
83
- > **`Open questions` goes last** — the refined spec **inserts before `Open questions`** `## UI spec` (if there is UI) + `## Refinement decisions` + `## Q&A traceability` (refined schema in the [`spec-refine-loop`](../loops/spec-refine-loop/LOOP.md)). Same skeleton: the draft and the refined spec share the order.
83
+ > **`Open questions` goes last** — the refined spec **inserts before `Open questions`** `## UI spec` (if there is UI) + `## Refinement decisions` (refined schema in the [`spec-refine-loop`](../loops/spec-refine-loop/LOOP.md); the refine drops `Open questions` when it empties). Same skeleton: the draft and the refined spec share the order.
84
84
 
85
85
  **Filling notes:**
86
86
 
@@ -88,7 +88,7 @@ Pending doubts. ← the spec-refine-loop closes them.
88
88
  - No `Type` field — `plan-new` infers the how.
89
89
  - `Scope` always carries `Out` (what stays out).
90
90
  - **Acceptance criteria = static testable criteria** (the "what"): `plan-exec` validates them, but progress is tracked in the PLAN (its Tasks), never by ticking these `- [ ]` in the spec; the spec never mutates by execution, only by a re-refine.
91
- - **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, not this command's.
91
+ - **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, not this command's. 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**.
92
92
  - If **UI** is involved, mention it in `Requirement`/`Context`; the `## UI spec` is authored in `spec-refine` (via the `ui-design` capability). "UI unspecified" is a first-class refinement gap.
93
93
  - 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.
94
94
  - Equivalent alternative: the user creates the draft by hand. Both paths produce the same `docs/specs/NNN-spec-<slug>.md`.
@@ -16,7 +16,7 @@ This command does not refine the spec itself: it delegates to `spec-refine-loop`
16
16
 
17
17
  > **Hard floor — applies even if you read nothing beyond this file:**
18
18
  >
19
- > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-spec-refine --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next` · `## Open questions`).
19
+ > 1. **Session first** — create/resume the run's session before working: `aw session-create --type refine --name <slug>-spec-refine --objetivo "<one-line objective>"`; keep its `CHECKPOINT.md` updated (`## Completed` · `## Pending / Next`; `## Open questions` only while live doubts exist).
20
20
  > 2. **Ask, don't invent** — user-dependent decisions go through questions with a recommended option first (≤3 content questions + the `flow` control `Compactar`/`Cerrar`).
21
21
  > 3. **Write boundary** — this flow edits only `docs/specs/…` (in place, with confirmation); nothing else lands in `docs/`.
22
22
  > 4. **Language** — everything user-facing (questions, option labels, the doc's content) goes in the **user's language**.
@@ -36,8 +36,8 @@ The skill detects prior state before starting, **keying off the `CHECKPOINT`** (
36
36
 
37
37
  1. Find the spec's refinement session under `.workflow/sessions/` and its `CHECKPOINT.md`.
38
38
  2. **In progress** (a CHECKPOINT exists) → continue from the recorded progress (resolved gaps, Q&A).
39
- 3. **No progress** (no CHECKPOINT and the spec does **not** have `## Refinement decisions`/`## Q&A traceability`) → start from zero reading the spec (`NNN-spec*.md`).
40
- 4. **Already refined / re-refine on demand** (no open CHECKPOINT but the spec **already has** the 2 sections) → **first-class operation**: while the flow stays in SPEC you can re-run this command over the same spec **as many times as needed** (new requirements, scope changes, re-reads). The loop does `create_or_resume` — it locates the existing refine session (even closed) and **reopens** it instead of duplicating — and re-refines reading the **spec itself**; on `Guardar`, edits in place with confirmation.
39
+ 3. **No progress** (no CHECKPOINT and the spec does **not** have `## Refinement decisions`) → start from zero reading the spec (`NNN-spec*.md`).
40
+ 4. **Already refined / re-refine on demand** (no open CHECKPOINT but the spec **already has** that section) → **first-class operation**: while the flow stays in SPEC you can re-run this command over the same spec **as many times as needed** (new requirements, scope changes, re-reads). The loop does `create_or_resume` — it locates the existing refine session (even closed) and **reopens** it instead of duplicating — and re-refines reading the **spec itself**; on `Guardar`, edits in place with confirmation.
41
41
 
42
42
  > **Compat (legacy):** the `NNN-spec*.md` glob also catches old `NNN-spec.md` / `NNN-spec-refined.md` specs. Re-running spec-refine edits them in place from then on.
43
43
 
@@ -25,8 +25,8 @@
25
25
  | Export | Composes | Reads (artifacts / sessions + corpus) | Writes (its ONLY category) |
26
26
  |---|---|---|---|
27
27
  | [`export-scripts`](export-scripts/EXPORT.md) | `sql` | type-B `SCRIPTS.sql` (DDL/DML migrations) across N sessions + standalone `docs/scripts/*.sql` | `docs/scripts/NNN-export-scripts-<date>/` (numbered forwards + `00-ROLLBACK.sql`) |
28
- | [`export-manuals`](export-manuals/EXPORT.md) | — (prose: ambient conventions) | sessions + `DECISION` + plan-doc (`Solution`, `Final behavior`, `Validations`) + touched code | `docs/manuals/` |
29
- | [`export-diagrams`](export-diagrams/EXPORT.md) | `diagrams` | source code of the sources + plan-doc (`AS-IS` / `TO-BE`, `Impacted`) | `docs/diagrams/` (C4 / mermaid) |
28
+ | [`export-manuals`](export-manuals/EXPORT.md) | — (prose: ambient conventions) | sessions + `DECISION` + plan-doc (`Solution` incl. Final behavior block, `Validations`) + touched code | `docs/manuals/` |
29
+ | [`export-diagrams`](export-diagrams/EXPORT.md) | `diagrams` | source code of the sources + plan-doc (AS-IS TO-BE delta in `Solution`, `Impacted`) | `docs/diagrams/` (C4 / mermaid) |
30
30
  | [`export-reports`](export-reports/EXPORT.md) | — (prose: ambient conventions) | corpus of sessions (spec, `CONCLUSIONS`, `DECISION`) + plan-doc state + `docs/` | `docs/reports/` (executive / functional report) |
31
31
 
32
32
  > **Composition over ownership:** an export that owns a derived artifact does **not** own its authoring logic — it **composes a capability role** from [`../roles/`](../roles/) (resolved through `.workflow/skills.toml`): `export-scripts` composes `sql`; `export-diagrams` composes `diagrams`. Swapping the implementation is a one-line config change; it never touches the export. `export-manuals` and `export-reports` produce **prose**, which follows **ambient writing conventions** (the host auto-applies an installed writing skill if present) — they do **not** compose or bind a `writing` role.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: export-diagrams
3
- description: "Generates the workspace's architecture and flow diagrams in `docs/diagrams/` consolidating the sources' code + the plan-doc (`Current state (AS-IS)` / `Target state (TO-BE)`, `Impacted`) of N sessions. Produces context, containers, components, integrations and data model (when read-only MCP is available). Default `mermaid` (renders on GitHub, `mermaid.ink` link for preview); `c4`/structurizr opt-in via `--engine`. Output in `docs/diagrams/NNN-export-diagrams-YYYY-MM-DD/` (or `.md`). Read-only/report: emits only the diagram source (the reader renders it); never commits nor mutates anything; MCP reads only. Composes the `diagrams` capability. Use for 'system diagram', 'workspace C4', 'architecture/flow map'. User-invoked via `/w:export-diagrams`."
3
+ description: "Generates the workspace's architecture and flow diagrams in `docs/diagrams/` consolidating the sources' code + the plan-doc (the AS-IS TO-BE delta in `## Solution`, `Impacted`) of N sessions. Produces context, containers, components, integrations and data model (when read-only MCP is available). Default `mermaid` (renders on GitHub, `mermaid.ink` link for preview); `c4`/structurizr opt-in via `--engine`. Output in `docs/diagrams/NNN-export-diagrams-YYYY-MM-DD/` (or `.md`). Read-only/report: emits only the diagram source (the reader renders it); never commits nor mutates anything; MCP reads only. Composes the `diagrams` capability. Use for 'system diagram', 'workspace C4', 'architecture/flow map'. User-invoked via `/w:export-diagrams`."
4
4
  ---
5
5
 
6
6
  # export-diagrams — architecture and flow diagrams from code + plan-doc
@@ -26,7 +26,7 @@ The **`diagrams`** capability (built-in default `diagrams`), resolved via `.work
26
26
  ## What it does
27
27
 
28
28
  1. Inspects the workspace sources' code (structure, wiring, integrations, technologies).
29
- 2. Reads the plan-doc from the sessions: `Current state (AS-IS)` / `Target state (TO-BE)` and `Impacted` (what changed and where).
29
+ 2. Reads the plan-doc from the sessions: the AS-IS → TO-BE delta in `## Solution` (legacy plans: separate `Current state (AS-IS)` / `Target state (TO-BE)` sections) and `Impacted` (what changed and where).
30
30
  3. (Optional) With read-only MCP available and a data-model request: queries DB schemas (reads only).
31
31
  4. Resolves the engine (`--engine`) and consolidates the architecture/flows touched by the N sessions.
32
32
  5. Renders the diagrams (composes `diagrams`): context, containers, components, integrations, data model (when it applies).
@@ -50,7 +50,7 @@ In plan mode it **describes**, never writes: the resolved engine, the levels/sec
50
50
  **`agent-workflow` CLI (alias `aw`)** — never read hardcoded paths:
51
51
 
52
52
  - `aw release-data [--since sessionNNN] [--source <alias>]` — enumerates the corpus (ALL sessions; input for the AS-IS/TO-BE delta). `aw sessions` alone lists only ACTIVE sessions — never use it as the corpus.
53
- - `aw session-artifacts --code <NNN> --dump objetivo` — locates the session and its plan-doc reference; `AS-IS`/`TO-BE`/`Impacted` are read from the plan-doc by its path.
53
+ - `aw session-artifacts --code <NNN> --dump objetivo` — locates the session and its plan-doc reference; the AS-ISTO-BE delta and `Impacted` are read from the plan-doc by its path.
54
54
  - `aw next-number docs/diagrams` — deterministic numbering (the CLI handles destination-folder resolution).
55
55
 
56
56
  **Filesystem / code**:
@@ -90,7 +90,7 @@ Per source: basic structure, internal components (modules, services, commands, h
90
90
 
91
91
  ### Step 3 — Read the corpus delta
92
92
 
93
- Per filtered session (`aw session-artifacts --code <NNN> --dump objetivo`): follow the plan-doc reference and read `Current state (AS-IS)` / `Target state (TO-BE)` and `Impacted`. Used to highlight what changed over the current snapshot.
93
+ Per filtered session (`aw session-artifacts --code <NNN> --dump objetivo`): follow the plan-doc reference and read the AS-IS TO-BE delta in `## Solution` (legacy plans: separate AS-IS/TO-BE sections) and `Impacted`. Used to highlight what changed over the current snapshot.
94
94
 
95
95
  ### Step 4 — Inspect MCP (optional)
96
96
 
@@ -121,5 +121,5 @@ Functionally idempotent: each invocation takes the next `NNN`; it never overwrit
121
121
 
122
122
  - Design: `docs/referencias/workflow-exports/export-diagrams.md` · family: [`../README.md`](../README.md).
123
123
  - Composed capability: `diagrams` (built-in default; see `docs/referencias/workflow-roles/`).
124
- - Input: plan-doc `AS-IS`/`TO-BE`/`Impacted` (see `docs/plans`).
124
+ - Input: plan-doc `## Solution` (AS-ISTO-BE delta) + `Impacted` (see `docs/plans`).
125
125
  - Siblings: [`../export-scripts/EXPORT.md`](../export-scripts/EXPORT.md) · [`../export-manuals/EXPORT.md`](../export-manuals/EXPORT.md) · [`../export-reports/EXPORT.md`](../export-reports/EXPORT.md).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: export-manuals
3
- description: "Operations / onboarding manuals (operator/support audience). Synthesizes the workspace's technical manuals into `docs/manuals/` consolidating N sessions (`exec`/`quick`) + `docs/`. Reads each session's `DECISION` and the plan-doc (`Solution`, `Final behavior`, `Validations`) + the touched code in the sources (how what was built operates/works). Two modes: `complement` (default, overwrites `INDEX.md` pointing at the detected manuals) and `regenerate` (produces a `NNN-export-manuals-YYYY-MM-DD/` dossier with 1 manual per topic). Audience: operators / support / onboarding. Read-only/report: it never commits nor mutates sessions. The prose follows the ambient writing conventions (the host auto-applies an installed writing skill when present). Use for 'operations manual', 'how what we shipped works', 'technical onboarding pack', 'manuals index'. User-invoked via `/w:export-manuals`."
3
+ description: "Operations / onboarding manuals (operator/support audience). Synthesizes the workspace's technical manuals into `docs/manuals/` consolidating N sessions (`exec`/`quick`) + `docs/`. Reads each session's `DECISION` and the plan-doc (`Solution` — including its Final behavior block —, `Validations`) + the touched code in the sources (how what was built operates/works). Two modes: `complement` (default, overwrites `INDEX.md` pointing at the detected manuals) and `regenerate` (produces a `NNN-export-manuals-YYYY-MM-DD/` dossier with 1 manual per topic). Audience: operators / support / onboarding. Read-only/report: it never commits nor mutates sessions. The prose follows the ambient writing conventions (the host auto-applies an installed writing skill when present). Use for 'operations manual', 'how what we shipped works', 'technical onboarding pack', 'manuals index'. User-invoked via `/w:export-manuals`."
4
4
  ---
5
5
 
6
6
  # export-manuals — technical manuals from sessions + `docs/`
@@ -26,7 +26,7 @@ The manual's prose follows the **ambient** writing conventions: the host auto-ap
26
26
 
27
27
  ## What it does
28
28
 
29
- 1. Reads the session corpus (`exec`/`quick`): per session, `DECISION` + the plan-doc (`Solution`, `Final behavior`, `Validations`).
29
+ 1. Reads the session corpus (`exec`/`quick`): per session, `DECISION` + the plan-doc (`Solution` — including its Final behavior block; legacy plans: a separate `## Final behavior` section —, `Validations`).
30
30
  2. Inspects the touched code in the sources (how what was built operates/works) — read-only.
31
31
  3. Detects topics (declared in `SESSION` — its `## Objective` —, or inferred by operational keywords).
32
32
  4. Resolves the mode (`complement` or `regenerate`).
@@ -97,13 +97,13 @@ List `docs/manuals/*.md` (excluding `INDEX.md` and `NNN-export-manuals-*/` subdi
97
97
 
98
98
  ### Step 3 — Detect topics
99
99
 
100
- For every filtered corpus session (`aw session-artifacts --code <NNN> --dump objetivo,decisiones`): take the dump's `DECISION` + the plan-doc (`Solution`/`Final behavior`/`Validations`) + the touched code. **Primary** topic: the topic in `SESSION` (its `## Objective`). **Secondary**: inference by operational keywords ("configure", "install", "step by step", "how to …" — in the user's language). Filter by `--topics` when present. List (slug, confidence, origin sessions).
100
+ For every filtered corpus session (`aw session-artifacts --code <NNN> --dump objetivo,decisiones`): take the dump's `DECISION` + the plan-doc (`Solution` with its Final behavior block/`Validations`) + the touched code. **Primary** topic: the topic in `SESSION` (its `## Objective`). **Secondary**: inference by operational keywords ("configure", "install", "step by step", "how to …" — in the user's language). Filter by `--topics` when present. List (slug, confidence, origin sessions).
101
101
 
102
102
  ### Step 4 — Synthesize (prose: ambient conventions)
103
103
 
104
104
  **`complement` mode** — one `INDEX.md`: header + manual count + table (Topic · Slug · Manual present/`[pending]` · Origin sessions) + "Next steps" when there are pending topics.
105
105
 
106
- **`regenerate` mode** — 1 `.md` per topic in the dossier, each with: Purpose · Prerequisites · Numbered steps (how to operate) · Final behavior (from the plan-doc) · Post-use validation · Relevant decisions (`DECISION`) · Troubleshooting · References. Every manual must let the operator complete the task **without** calling the development team. Plus a dossier `README.md` with the index. The prose follows the ambient writing conventions (host).
106
+ **`regenerate` mode** — 1 `.md` per topic in the dossier, each with: Purpose · Prerequisites · Numbered steps (how to operate) · Final behavior (from the plan-doc's `Solution`) · Post-use validation · Relevant decisions (`DECISION`) · Troubleshooting · References. Every manual must let the operator complete the task **without** calling the development team. Plus a dossier `README.md` with the index. The prose follows the ambient writing conventions (host).
107
107
 
108
108
  ### Step 5 — Write or report
109
109
 
@@ -68,7 +68,7 @@ The loop works **artifact-first**: the artifact is **seeded before** executing a
68
68
 
69
69
  > The artifact expresses the **intent** (Pending/Next, before) and then the **result** (Completed/DECISION, after), at **every** gap/phase boundary — not only on `Compactar`/`Cerrar`. Session artifacts are the run's live log; the spec/plan is the **guiding base**.
70
70
 
71
- > **Fixed form (hard rule):** an artifact keeps its template's `##` headings **exactly** and is updated **in place** — appending a **duplicate heading** is a contract violation. When a scaffolded section is filled, its `<!-- … -->` guidance comment is **replaced** by the real content. Canonical headings per artifact: its template under [`../artifacts/`](../artifacts/) (CHECKPOINT contract: `Completed` · `Pending / Next` · `Open questions`).
71
+ > **Fixed form (hard rule):** an artifact keeps its template's `##` headings **exactly** and is updated **in place** — appending a **duplicate heading** is a contract violation. When a scaffolded section is filled, its `<!-- … -->` guidance comment is **replaced** by the real content. Canonical headings per artifact: its template under [`../artifacts/`](../artifacts/) (CHECKPOINT contract: `Completed` · `Pending / Next`; `Open questions` only while live doubts exist).
72
72
 
73
73
  ## Gap-driven convergent engine
74
74
 
@@ -133,7 +133,7 @@ Investigation is **inline**: an activity **inside the run's current session**, n
133
133
  3. Execute them **read-only** via MCP (respect `sql-mutation-guard`: never DML/DDL).
134
134
  - **Inconclusive research** (DB unavailable, insufficient evidence, unresolvable factual gap):
135
135
  - The investigation closes with status **`inconclusive`** in `CONCLUSIONS` and reports why.
136
- - The loop **degrades** the gap: to a **human question** (next batch → the flow's Q&A record: `Q&A traceability` in refine loops, `DECISION` in code-editing ones) or, failing that, **defers** it to the flow doc's `## Open questions` (spec/plan) — or the session's `BACKLOG` when the flow has no doc (quick).
136
+ - The loop **degrades** the gap: to a **human question** (next batch → the flow's Q&A record: a `Q:` entry in `## Refinement decisions` in refine loops, `DECISION` in code-editing ones) or, failing that, **defers** it to the flow doc's `## Open questions` (spec/plan) — or the session's `BACKLOG` when the flow has no doc (quick).
137
137
  - The gap is marked **"already tried via research"** (`attempts[gap]++`, `MAX` cap) so `detect_gaps` does **not** re-fire it in a loop → guarantees convergence.
138
138
 
139
139
  ## Proof of concept (probe)
@@ -169,7 +169,7 @@ Resume **keys off the `CHECKPOINT`** of the run's session, not the existence of
169
169
  2. **No progress** (no CHECKPOINT and the input doc does **not** have the flow's prior-work mark) → start from zero reading the input doc (plus any *adopted context* — settled in-conversation conclusions are input, not something to re-derive).
170
170
  3. **Already converged / re-run on demand** (no open CHECKPOINT but the doc **already has** the mark) → **first-class operation**: while the flow stays in its stage, re-running the command over the same input **as many times as needed** is supported. `create_or_resume` finds the existing session — typically **closed** after convergence — by descriptor + `## Origin` and **reopens** it (see *Internal sessions*: detection via `aw sessions --state all` / `aw resume-summary --include-recent-closed`, reopening via `aw session-resume --code <NNN> --reopen`); incremental work reading the **doc itself**.
171
171
 
172
- > Each heir defines its **prior-work mark**: in the refine loops, the presence of `## Refinement decisions` + `## Q&A traceability` in the doc; in plan-exec, the plan-doc's `- [x]` checkboxes; quick has no doc (resume by CHECKPOINT only).
172
+ > Each heir defines its **prior-work mark**: in the refine loops, the presence of `## Refinement decisions` in the doc (legacy docs may also carry `## Q&A traceability`); in plan-exec, the plan-doc's `- [x]` checkboxes; quick has no doc (resume by CHECKPOINT only).
173
173
 
174
174
  > **`Compactar`** (the `flow` control, across all 3 cases) → write `CHECKPOINT.md` in the session (in-flight progress, remaining gaps, Q&A, `attempts`) → trigger the harness **compaction** (Claude Code: `/compact`; see [`../harness/HARNESS.md`](../harness/HARNESS.md)) → resume by reading the checkpoint.
175
175
 
@@ -23,8 +23,9 @@ Distinguished by **execution**, not by file (see the [`SCRIPTS.sql`](../artifact
23
23
  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**:
24
24
 
25
25
  - **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*).
26
- - **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 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).
26
+ - **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).
27
27
  - **Minimality lens** (floor — holds with **no external skill**; chassis § *Minimality*): re-read the diff for over-building. Flag `delete` (dead/speculative code), `stdlib` (reinvented standard library), `native` (a dep or code doing what the platform already does), `yagni` (one-implementation abstraction, config nobody sets, one-caller layer), `shrink` (same behavior, fewer lines). An installed ambient review skill *raises* this; it never lowers it.
28
+ - **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.
28
29
  - **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.
29
30
  - **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".
30
31
 
@@ -56,9 +56,10 @@ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **a
56
56
 
57
57
  ## Delta 1 — One session per run; per-phase progress in the plan-doc
58
58
 
59
- - Walks the plan's `Phases` in order (respecting deps) **inside the run's single session** (no session-per-phase).
59
+ - Walks the plan's `### Fn` blocks under `## Tasks` in order (respecting deps) **inside the run's single session** (no session-per-phase). *(Legacy plans: a separate `## Phases` table — walk it the same way.)*
60
60
  - **Per-phase progress lives in the plan-doc** (`- [x]`) and in the single `CHECKPOINT` (Completed/Pending/Next): **artifact-first** — `CHECKPOINT.Next` is set to the imminent phase **before** starting it; the plan-doc's `- [x]` checkbox is flipped **after** completing the task.
61
- - Executes the phase's `Tasks`; **skips** the ones already `- [x]` in the plan (the plan-doc is the per-task source of truth). Marks `- [x]` + state **in the plan** (living doc; never in a separate `TASKS`).
61
+ - Executes the phase's tasks; **skips** the ones already `- [x]` in the plan (the plan-doc is the per-task source of truth). Marks `- [x]` **in the plan** (living doc; never in a separate `TASKS`).
62
+ - **Checkbox-only residue (hard rule):** execution writes into the plan-doc **only** three things — checkbox flips (`- [ ]` → `- [x]`), deferrals appended to its `## Open questions` (the declared-gap escape hatch: Delta 4's unapplied migration, Delta 5's deferred findings, Delta 7's failed probe), and, on close, the single status line (Delta 6). Per-phase results, review-gate findings and metrics go to the session's `DECISION`/`CHECKPOINT` — **never** into the plan-doc. Phase blocks are updated **in place — NEVER append a duplicate `### Fn` block** (same contract as CHECKPOINT sections).
62
63
  - At **every phase boundary**: validate, run the **closing review gate** (Delta 5), update the `CHECKPOINT` (Completed += Phase N, Next = Phase N+1) and propose commits.
63
64
  - Records in `DECISION` only the **non-obvious**, **as it is decided** (per-phase decisions accumulate in the SINGLE `DECISION`, tagged by phase/task — e.g. `Origin: T2 (F1)`).
64
65
  - The chassis **gap-driven** engine applies here **inside a task**: facing a non-obvious decision/doubt → inline research, a probe (Delta 7) OR structured-choice.
@@ -73,7 +74,7 @@ Full policy in [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *DB scripts-only
73
74
 
74
75
  ## Delta 4 — Validation
75
76
 
76
- - After executing (per phase and at the end): run tests/checks against `Validations` + `Final behavior` + the spec's acceptance/success criteria (its `## Scenarios`, if present, are ready-made test cases: GIVEN=arrange · WHEN=act · THEN=assert).
77
+ - After executing (per phase and at the end): run tests/checks against `Validations` + the Final behavior block of `## Solution` (legacy plans: the `## Final behavior` section) + the spec's acceptance/success criteria (its `## Scenarios`, if present, are ready-made test cases: GIVEN=arrange · WHEN=act · THEN=assert).
77
78
  - A validation that **runs and fails** → back to the task (gap); no advancing.
78
79
  - **Validation depending on an unapplied migration**: since the AI never executes the DML, it **cannot run it read-only** → it is **deferred** (handoff to a DBA), it does **not block progress**. Recorded in the plan's `Open questions` + `BACKLOG`, marked "verification pending until the SQL is applied". (Reuses the chassis degrade/defer pattern + `MAX` cap → avoids the "back to the task" loop.)
79
80
 
@@ -87,6 +88,7 @@ Full gate in [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *Closing review ga
87
88
 
88
89
  - A phase closes **done** when its tasks are `- [x]` and its validation passed **or** was deferred (SQL handoff). Possible state: **"done — SQL pending application"**.
89
90
  - All phases done → final *structured-choice* (content: `Marcar plan done` / `Preguntar algo más`; flow: `Compactar`/`Cerrar`).
91
+ - **Marking done = ONE line in the plan-doc**, under the title's blockquote: `> Estado: done — YYYY-MM-DD · sesión NNN` (or `done — SQL pendiente de aplicar`), updated in place on a re-run. No per-phase result tables, no ✅ suffixes — that record lives in the session (`DECISION`/`CHECKPOINT`).
90
92
  - **No automatic export**: the artifacts (`SCRIPTS.sql`, `DECISION`, …) stay in the session. Promoting them to `docs/` (scripts, manuals, …) is a separate step via `export-*`.
91
93
 
92
94
  ## Delta 7 — Probe (PoC) tasks
@@ -103,7 +105,7 @@ Chassis § *Proof of concept (probe)*, instantiated for execution — for a plan
103
105
  plan-exec-loop(PPP-plan-<slug>.md):
104
106
  session = create_or_resume("<slug>-plan-exec") # <slug> from the plan-doc; ONE session per run; CLI prepends global NNN; CHECKPOINT, resume
105
107
  plan = read(PPP-plan-<slug>.md)
106
- for each Phase in plan (in order, respecting deps):
108
+ for each Phase (### Fn block in ## Tasks; legacy: ## Phases table) in plan (in order, respecting deps):
107
109
  if Phase done (all its Tasks - [x] in the plan): skip # resume via plan-doc checkboxes
108
110
  seed CHECKPOINT.Next = Phase N (Pending = its Tasks) # BEFORE starting the phase: seed the intent (artifact-first)
109
111
  for each Task of the Phase:
@@ -119,7 +121,7 @@ plan-exec-loop(PPP-plan-<slug>.md):
119
121
  if probe (PoC) task / runnable doubt → seed check → run throwaway code in the
120
122
  session folder → verdict → CONCLUSIONS/DECISION; failed → structured-choice (Delta 7)
121
123
  if doubt/gap → inline research, probe OR structured-choice # chassis
122
- mark Task - [x] + state IN THE PLAN # AFTER completing the Task (the plan-doc is the per-task source of truth)
124
+ mark Task - [x] IN THE PLAN # AFTER completing the Task; checkbox flip ONLY results go to DECISION/CHECKPOINT
123
125
  phase validation:
124
126
  what runs and fails → back to the task
125
127
  what depends on an unapplied migration → defer (Open questions + BACKLOG)
@@ -132,7 +134,7 @@ plan-exec-loop(PPP-plan-<slug>.md):
132
134
  next-phase precondition: working tree clean or acknowledged
133
135
  final validation (whatever can run; the SQL-dependent part stays as a handoff)
134
136
  structured_choice(content: [Marcar plan done, Preguntar algo más], flow: [Compactar, Cerrar])
135
- mark plan done (or "done SQL pending application")
137
+ mark plan done ONE status line under the title blockquote (Delta 6), updated in place
136
138
  # NO export: artifacts stay in the session; a separate export-* promotes them
137
139
  finalize: CHECKPOINT (+ BACKLOG if something is deferred) + close session + report
138
140
  ```
@@ -3,8 +3,9 @@ name: plan-new-loop
3
3
  description: >-
4
4
  Generates a rich implementation plan (docs/plans/PPP-plan-<slug>.md) from a
5
5
  spec. Heir of the chassis (loops/CHASSIS.md). Deltas: the plan absorbs the
6
- TECHNICAL-NOTE level + Phases/Tasks with live state, code/impact-mapping
7
- research, planning gap taxonomy, and per-screen design SPECs via ui-design
6
+ TECHNICAL-NOTE level + phased Tasks (### Fn blocks) with live state,
7
+ code/impact-mapping research, planning gap taxonomy, and per-screen design
8
+ SPECs via ui-design
8
9
  when the plan includes UI. If the spec is not refined it suggests
9
10
  spec-refine first. Started by /w:plan-new; resumable. Invoke when a spec
10
11
  must become an executable plan.
@@ -24,7 +25,7 @@ PLAN
24
25
  `/w:plan-new` — **resumable** (same chassis mechanism, keyed off CHECKPOINT).
25
26
 
26
27
  ## Reads
27
- `docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` / `## Q&A traceability` in the spec: if missing → **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), but the user may proceed.
28
+ `docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` in the spec (legacy specs may also carry `## Q&A traceability`): if missing → **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), but the user may proceed.
28
29
 
29
30
  ## Writes
30
31
  `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).
@@ -55,23 +56,23 @@ The plan absorbs the `TECHNICAL-NOTE` level **inline** (user decision) + the roa
55
56
  > Derived from docs/specs/NNN-spec-<slug>.md · generated by plan-new-loop
56
57
 
57
58
  ## Origin source spec · prompt (bootstrapped via spec-new) · "adopted from <source>" + attribution (external plan — /w:plan-new mode 4 / /w:persist)
58
- ## Summary the how, in 1–2 sentences (core)
59
- ## Solution technical/functional explanation of the implementation (core)
59
+ ## Solution the how (core): 1–2 summary sentences + the AS-IS → TO-BE
60
+ delta (current vs target wiring, brief) + a closing
61
+ "Final behavior" block — how the flow behaves at the end,
62
+ aligned with the spec criteria. One narration, not four.
60
63
  ## Impacted FE · BE · DB (schemas/tables/functions) · APIs · integr. (core)
61
- ## Dependencies docs / sources / databases / sessions (opt.)
62
- ## Current state (AS-IS) current wiring (interfaces and methods), brief (opt.)
63
- ## Target state (TO-BE) target wiring (opt.)
64
- ## Final behavior how the flow behaves at the end (aligned with the spec criteria) (core)
65
- ## Phases grouping phases (complexity XS–S) (core)
66
- ## Tasks tasks per phase (≤XS), with deps and live state (- [ ]) (core)
64
+ ## Dependencies docs / sources / databases / sessions · inter-plan order on a split (opt.)
65
+ ## Tasks (core) `### Fn <name>` blocks — 1-line objective +
66
+ complexity XS–S each holding its `- [ ] Tn.m` tasks
67
+ (≤XS, deps and live state). The `### Fn` headers are the
68
+ ONLY source of phases; there is no separate Phases table.
67
69
  ## Validations validations / constraints / business logic (core)
68
70
  ## Risks / impact technical risks and impacts (opt.)
69
- ## Assumptions assumptions (opt.)
70
- ## Estimated time XS–XL sizing (development + internal testing) (opt.)
71
- ## Open questions pending (core)
71
+ ## Assumptions assumptions — only the delta over the spec, never re-imported (opt.)
72
+ ## Open questions pending core when any exist; OMIT the section when empty
72
73
  ```
73
74
 
74
- > **Scales with complexity:** the `(core)` sections go **always**; the `(opt.)` ones only when the plan warrants them — a small plan may omit `Dependencies`, AS-IS/TO-BE, `Risks`, `Assumptions`, `Estimated time`. Concise > exhaustive.
75
+ > **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.)*
75
76
 
76
77
  > **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
78
 
@@ -97,7 +98,7 @@ Replaces the spec gap taxonomy with a planning-oriented one:
97
98
 
98
99
  ## Delta 3 — What research investigates here
99
100
 
100
- The chassis' **inline** research specializes: mapping **code/impact** — affected FE/BE/DB components, AS-IS wiring, dependencies. It feeds the `Solution`, `Impacted`, `Current state (AS-IS)` sections. The chassis DB rule applies unchanged (read-only queries into `SCRIPTS.sql`, MCP chosen via a content question when >1 without default).
101
+ 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).
101
102
 
102
103
  ## Delta 4 — Design SPECs (when the plan includes UI)
103
104
 
@@ -123,7 +124,7 @@ Resolves the **Plan splittable** gap (Delta 2) — the canonical definition for
123
124
  - **Anti-duplicate** (the `create_or_resume` spirit): if sibling plans whose `## Origin` references this same spec/split already exist, the recommended option becomes resuming them (`/w:plan-refine` / `/w:plan-exec` semantics) — never a second set.
124
125
  - **On acceptance** — same run, same session (one session per run, one HISTORY row): **all N siblings are elaborated complete** in this run — each gets the full Delta 1 schema and is immediately executable (`plan-exec` runs any plan; a seed without `## Tasks` would break that contract). Context pressure is absorbed by self-regulation (chassis § *Compact / resume*). Numbering: `aw next-number docs/plans` **immediately before each write** — numbers come out consecutive, so every sibling path is known after the first mint.
125
126
  - **Sibling contract**: each `## Origin` records the shared source spec + `split (part i/N)` + the **siblings by path** + the order; `## Dependencies` (the existing optional section) carries the inter-plan order — **acyclic and advisory** (`plan-exec` does not enforce it; it only orients what to attack first).
126
- - **Coherence gate, re-framed**: every spec acceptance criterion traces to **exactly one** sibling — a **complete, disjoint partition**; each sibling's `Final behavior` covers its subset; the union covers the spec. Spec-less plans anchor the partition to their own `Final behavior` / `Validations`.
127
+ - **Coherence gate, re-framed**: every spec acceptance criterion traces to **exactly one** sibling — a **complete, disjoint partition**; each sibling's Final behavior block (in `## Solution`) covers its subset; the union covers the spec. Spec-less plans anchor the partition to their own Final behavior block / `Validations`.
127
128
  - **Closing action** on the split branch: `Guardar planes` (the single-plan branch keeps `Guardar plan`).
128
129
 
129
130
  ## Sequence
@@ -131,7 +132,7 @@ Resolves the **Plan splittable** gap (Delta 2) — the canonical definition for
131
132
  ```
132
133
  plan-new-loop(spec):
133
134
  input = glob(docs/specs/NNN-spec-*.md) | argument path
134
- if the spec does NOT have ## Refinement decisions + ## Q&A traceability:
135
+ if the spec does NOT have ## Refinement decisions:
135
136
  soft-suggest /w:spec-refine (the user may proceed anyway)
136
137
  session = create_or_resume("<slug>-plan-new") # CLI prepends global NNN
137
138
  seed SESSION.Success criteria = coherence-gate checklist # verification-first, BEFORE
@@ -145,9 +146,9 @@ plan-new-loop(spec):
145
146
  coherence gate (read-only) = Success criteria green:
146
147
  - every spec acceptance criterion traces to a phase/task
147
148
  (split: each criterion → exactly one sibling — complete, disjoint partition)
148
- - Final behavior covers the criteria
149
- - phases XS–S · tasks XS · deps without cycles · Impacted consistent with Solution
150
- - minimality (chassis § *Minimality*): the Solution is the lightest that meets Final behavior; no phase/task/abstraction the criteria don't require
149
+ - the Final behavior block of ## Solution covers the criteria
150
+ - ### Fn phases XS–S · tasks XS · deps without cycles · Impacted consistent with Solution
151
+ - minimality (chassis § *Minimality*): the Solution is the lightest that meets its Final behavior block; no phase/task/abstraction the criteria don't require
151
152
  - (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
152
153
  whatever fails → comes back as a gap
153
154
  if split accepted (§ Split gate (multi-plan)): work = the N sibling plans (same session; cut in CHECKPOINT)
@@ -4,8 +4,8 @@ description: >-
4
4
  Refines an existing plan (docs/plans/PPP-plan-<slug>.md) by editing it IN
5
5
  PLACE — an auxiliary, NOT mandatory step before plan-exec. Heir of the
6
6
  chassis (loops/CHASSIS.md). Deltas: reuses plan-new-loop's gap taxonomy and
7
- coherence gate, adds Refinement decisions / Q&A traceability (trace, no
8
- gating), and produces/updates design SPECs via ui-design when the refine
7
+ coherence gate, adds Refinement decisions (trace, no gating), and
8
+ produces/updates design SPECs via ui-design when the refine
9
9
  touches UI. Started by /w:plan-refine; resumable and re-runnable on demand.
10
10
  Invoke when an already generated plan must be adjusted before executing it.
11
11
  ---
@@ -32,7 +32,7 @@ PLAN
32
32
  `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.
33
33
 
34
34
  ## Writes
35
- Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions` + `## Q&A traceability`. 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).
35
+ 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).
36
36
 
37
37
  ## Inherits
38
38
 
@@ -48,19 +48,17 @@ Full doctrine in the chassis (§ *Internal sessions* + *Numbering*). This loop's
48
48
 
49
49
  ## Delta 1 — Deliverable: the PLAN, edited in place
50
50
 
51
- The plan uses the **same skeleton** [`plan-new-loop`](../plan-new-loop/LOOP.md) produces (§ *Delta 1 — RICH PLAN*: `Summary`/`Solution`/`Impacted`/`Phases`/`Tasks`/`Validations`/`Final behavior`/… 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** two trace sections:
51
+ 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:
52
52
 
53
53
  ```markdown
54
- ## Refinement decisions ← NEW (ADDED)
54
+ ## Refinement decisions ← NEW (ADDED) — the run's single trace
55
55
  What was adjusted while refining and why (new requirements, scope changes,
56
56
  deps/risks). Includes what inline research resolved (ref to the session's
57
- CONCLUSIONS).
58
-
59
- ## Q&A traceability ← NEW (ADDED)
60
- Every doubt asked to the human + the chosen answer.
57
+ CONCLUSIONS) and every doubt asked to the human, as entries
58
+ `Q: <question> → <chosen answer> — <rationale>`.
61
59
  ```
62
60
 
63
- > **No gating contract** (unlike spec↔plan): the presence of `## Refinement decisions`/`## Q&A traceability` in the plan is **audit trace only** — `plan-exec` neither requires nor checks it (it runs any plan). It serves to (a) distinguish a re-refined plan from a freshly generated one on resume, and (b) record what changed and why.
61
+ > **No gating contract** (unlike spec↔plan): the presence of `## Refinement decisions` in the plan is **audit trace only** — `plan-exec` neither requires nor checks it (it runs any plan). It serves to (a) distinguish a re-refined plan from a freshly generated one on resume, and (b) record what changed and why. *(Legacy plans may also carry `## Q&A traceability`; new runs never write it.)*
64
62
 
65
63
  > The plan **never mutates by execution** (plan-exec tracks that in the plan-doc's Tasks) — only by a (re-)refine.
66
64
 
@@ -72,7 +70,7 @@ Reuses plan-new-loop's gap taxonomy **in full** ([`plan-new-loop`](../plan-new-l
72
70
  |---|---|---|
73
71
  | Plan↔spec drift | the spec was re-refined and the plan fell out of line | **research** (re-reads the spec) / **human** |
74
72
 
75
- > **Spec-less degradation (hand-written / adopted plans).** When the plan has **no source spec** (`## Origin` = adopted / hand-written), the spec-anchored checks **degrade gracefully**: "spec criteria uncovered" and "plan↔spec drift" do **not** apply — criterion→task traceability anchors to the plan's **own** `## Final behavior` / `## Validations` instead. The rest of the taxonomy (atomicity, deps, Impacted↔Solution, UI→SPEC) applies unchanged. Normalizing an adopted plan to the full Delta 1 schema **is** this loop's job (missing `(core)` sections are gaps).
73
+ > **Spec-less degradation (hand-written / adopted plans).** When the plan has **no source spec** (`## Origin` = adopted / hand-written), the spec-anchored checks **degrade gracefully**: "spec criteria uncovered" and "plan↔spec drift" do **not** apply — criterion→task traceability anchors to the plan's **own** Final behavior block (in `## Solution`) / `## Validations` instead. The rest of the taxonomy (atomicity, deps, Impacted↔Solution, UI→SPEC) applies unchanged. Normalizing an adopted plan to the full Delta 1 schema **is** this loop's job (missing `(core)` sections are gaps).
76
74
 
77
75
  > **Adjust the Solution the laziest-that-works way** (chassis § *Minimality*, generative side): reuse what already exists before adding abstractions, layers or dependencies — the coherence gate only *confirms* minimality, and a re-refine is a chance to *remove* over-building, not add it.
78
76
 
@@ -95,7 +93,7 @@ The gate itself — signals, offer, anti-duplicate, sibling contract, partition
95
93
 
96
94
  ## Compact / resume — PLAN-refine keys
97
95
 
98
- Full mechanism (3 cases, `Compactar`, re-run with `--reopen`) in the chassis (§ *Compact / resume*). PLAN-refine keys: prior-work mark = `## Refinement decisions` + `## Q&A traceability` **in the plan**; re-refine on demand is **first-class** as many times as needed while the flow stays in PLAN.
96
+ Full mechanism (3 cases, `Compactar`, re-run with `--reopen`) in the chassis (§ *Compact / resume*). PLAN-refine keys: prior-work mark = `## Refinement decisions` **in the plan** (legacy plans may also carry `## Q&A traceability`); re-refine on demand is **first-class** as many times as needed while the flow stays in PLAN.
99
97
 
100
98
  > **Inter-turn continuity** (chassis, row 2): a flow command opens a "new work line" (new session) — **except re-running the same flow over the same input** (same plan), which does `create_or_resume` (resumes/reopens instead of duplicating).
101
99
 
@@ -115,8 +113,8 @@ plan-refine-loop(plan):
115
113
  ui-design (Delta 4, only new/changed screens)
116
114
  integrate + update CHECKPOINT # artifact-first cycle
117
115
  coherence gate (read-only) = Success criteria green:
118
- - plan-new checklist (criterion→task · Final behavior · XS–S/XS · deps · Impacted↔Solution · UI→current SPEC · minimality)
119
- # spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior/Validations (see Delta 2)
116
+ - plan-new checklist (criterion→task · Final behavior block of Solution · XS–S/XS · deps · Impacted↔Solution · UI→current SPEC · minimality)
117
+ # spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior block/Validations (see Delta 2)
120
118
  - re-refine's own check: the plan is REALIGNED with what changed
121
119
  whatever fails → comes back as a gap
122
120
  if split accepted (plan-new-loop § Split gate (multi-plan)): work = original reduced + extracted siblings
@@ -124,7 +122,7 @@ plan-refine-loop(plan):
124
122
  Guardar planes → edit original reduced (confirmation) + write extracted siblings + record in Refinement decisions
125
123
  else:
126
124
  structured_choice(content: [Guardar plan refinado, Preguntar algo más], flow: [Compactar, Cerrar])
127
- Guardar → edit in place (with confirmation) + insert/update Refinement decisions + Q&A traceability
125
+ Guardar → edit in place (with confirmation) + insert/update Refinement decisions
128
126
  finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
129
127
  ```
130
128