@tacuchi/agent-workflow-cli 20.15.0 → 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.
- package/dist/application/history-table.js +106 -13
- package/dist/application/history-table.js.map +1 -1
- package/dist/application/history-update-service.js +5 -9
- package/dist/application/history-update-service.js.map +1 -1
- package/dist/application/session-resolver.js +16 -1
- package/dist/application/session-resolver.js.map +1 -1
- package/dist/application/status-service.js +1 -2
- package/dist/application/status-service.js.map +1 -1
- package/dist/application/templates/session.js +13 -5
- package/dist/application/templates/session.js.map +1 -1
- package/dist/cli/commands/history-update.js +3 -4
- package/dist/cli/commands/history-update.js.map +1 -1
- package/package.json +1 -1
- package/skills/w/SKILL.md +1 -1
- package/skills/w/artifacts/README.md +2 -2
- package/skills/w/artifacts/artifacts-core/BACKLOG.md +1 -4
- package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
- package/skills/w/artifacts/artifacts-core/SESSION.md +2 -5
- package/skills/w/commands/export-diagrams.md +2 -2
- package/skills/w/commands/export-manuals.md +1 -1
- package/skills/w/commands/plan-exec.md +1 -1
- package/skills/w/commands/plan-new.md +4 -4
- package/skills/w/commands/plan-refine.md +4 -4
- package/skills/w/commands/quick.md +1 -1
- package/skills/w/commands/spec-new.md +2 -2
- package/skills/w/commands/spec-refine.md +3 -3
- package/skills/w/exports/README.md +2 -2
- package/skills/w/exports/export-diagrams/EXPORT.md +5 -5
- package/skills/w/exports/export-manuals/EXPORT.md +4 -4
- package/skills/w/loops/CHASSIS.md +3 -3
- package/skills/w/loops/plan-exec-loop/LOOP.md +8 -6
- package/skills/w/loops/plan-new-loop/LOOP.md +22 -21
- package/skills/w/loops/plan-refine-loop/LOOP.md +13 -15
- package/skills/w/loops/spec-refine-loop/LOOP.md +19 -18
|
@@ -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
|
|
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
|
|
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
|
|
53
|
-
4. **Already refined / re-refine on demand** (no open CHECKPOINT but the plan **already has**
|
|
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
|
|
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`
|
|
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
|
|
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
|
|
40
|
-
4. **Already refined / re-refine on demand** (no open CHECKPOINT but the spec **already has**
|
|
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
|
|
29
|
-
| [`export-diagrams`](export-diagrams/EXPORT.md) | `diagrams` | source code of the sources + plan-doc (
|
|
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 (
|
|
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;
|
|
53
|
+
- `aw session-artifacts --code <NNN> --dump objetivo` — locates the session and its plan-doc reference; the AS-IS → TO-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
|
|
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
|
|
124
|
+
- Input: plan-doc `## Solution` (AS-IS → TO-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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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`
|
|
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
|
|
|
@@ -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 `
|
|
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
|
|
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]
|
|
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
|
|
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 +
|
|
7
|
-
research, planning gap taxonomy, and per-screen 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`
|
|
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
|
-
##
|
|
59
|
-
|
|
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
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
70
|
-
##
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
8
|
-
|
|
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
|
|
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*: `
|
|
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
|
|
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**
|
|
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`
|
|
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
|
|
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
|
|
|
@@ -5,8 +5,8 @@ description: >-
|
|
|
5
5
|
until it is unambiguous. Heir of the chassis (loops/CHASSIS.md). Deltas:
|
|
6
6
|
spec gap taxonomy, analyze gate, ideation gate (consented brainstorming,
|
|
7
7
|
optional web-research), ## UI spec section via the ui-design
|
|
8
|
-
capability, and adds Refinement decisions
|
|
9
|
-
|
|
8
|
+
capability, and adds Refinement decisions — the refined mark plan-new
|
|
9
|
+
detects. Started by /w:spec-refine (or the live escalation
|
|
10
10
|
from quick-loop); resumable via CHECKPOINT and re-runnable on demand.
|
|
11
11
|
Invoke to refine/disambiguate a specification before planning.
|
|
12
12
|
---
|
|
@@ -34,7 +34,7 @@ It is also started by the **live escalation from `quick-loop`** (entry gate or m
|
|
|
34
34
|
- `docs/specs/NNN-spec*.md` (glob — locates the spec by number; also catches the legacy `NNN-spec.md`), **or** the exact path passed as the command argument. **Always the spec itself**: this loop edits it in place; there is no separate "refined" file.
|
|
35
35
|
|
|
36
36
|
## Writes
|
|
37
|
-
Updates `docs/specs/NNN-spec-<slug>.md` **in place** (when the user picks `Guardar especificación refinada`): completes sections and **adds** `## Refinement decisions
|
|
37
|
+
Updates `docs/specs/NNN-spec-<slug>.md` **in place** (when the user picks `Guardar especificación refinada`): completes sections and **adds** `## Refinement decisions`, closing `Open questions` as they get resolved. Since it overwrites an existing doc, it asks the user's **confirmation**.
|
|
38
38
|
|
|
39
39
|
> **Boundary invariant:** this loop writes **only** into `docs/specs`. It never graduates/exports other artifacts to `docs/` — that is separate `export-*` work (chassis § *docs/ boundary*).
|
|
40
40
|
|
|
@@ -62,7 +62,7 @@ Other transversal capabilities the engine always uses: `research` (**inline**
|
|
|
62
62
|
|
|
63
63
|
## Deliverable schema (the spec, edited in place)
|
|
64
64
|
|
|
65
|
-
The spec is completed **in place**: the draft's sections get **completed** +
|
|
65
|
+
The spec is completed **in place**: the draft's sections get **completed** + one new one is **added** (`Refinement decisions`). NO separate file is created.
|
|
66
66
|
|
|
67
67
|
```markdown
|
|
68
68
|
# Spec NNN — <slug>
|
|
@@ -74,23 +74,24 @@ The spec is completed **in place**: the draft's sections get **completed** + two
|
|
|
74
74
|
## Context (complete)
|
|
75
75
|
## Scope (clear In / Out)
|
|
76
76
|
## Acceptance criteria (testable, - [ ]; EARS style; behavioral ones expand in ## Scenarios)
|
|
77
|
-
## Scenarios (opt. — GIVEN/WHEN/THEN/AND blocks; each traces to ≥1 criterion
|
|
77
|
+
## Scenarios (opt. — GIVEN/WHEN/THEN/AND blocks; each traces to ≥1 criterion.
|
|
78
|
+
Only when it adds GIVEN setup or edge semantics the criterion
|
|
79
|
+
does not capture — NEVER a 1:1 restatement of a criterion)
|
|
78
80
|
## Assumptions (declared)
|
|
79
81
|
|
|
80
82
|
## UI spec (opt. — if UI is involved; via the ui-design capability / ui-spec skill)
|
|
81
83
|
Structured Markdown description (screens → regions/components). See [`ui-spec`](../../roles/ui-spec/ROLE.md).
|
|
82
84
|
|
|
83
|
-
## Refinement decisions ← NEW (ADDED)
|
|
85
|
+
## Refinement decisions ← NEW (ADDED) — the run's single trace
|
|
84
86
|
What was defined while refining and why. Includes what inline research
|
|
85
|
-
resolved (ref. the session's CONCLUSIONS)
|
|
87
|
+
resolved (ref. the session's CONCLUSIONS), the ideation verdicts (§ Ideation
|
|
88
|
+
gate) and every doubt asked to the human, as entries
|
|
89
|
+
`Q: <question> → <chosen answer> — <rationale>`.
|
|
86
90
|
|
|
87
|
-
##
|
|
88
|
-
Every doubt asked to the human + the chosen answer.
|
|
89
|
-
|
|
90
|
-
## Open questions (ideally "None"; whatever remains is deferred)
|
|
91
|
+
## Open questions (whatever remains is deferred; OMIT the section when empty)
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
> **Refined mark (contract with PLAN):** the presence of `## Refinement decisions`
|
|
94
|
+
> **Refined mark (contract with PLAN):** the presence of `## Refinement decisions` distinguishes a refined spec from a draft — plan-new detects it this way, NOT by filename; without that section plan-new soft-suggests spec-refine. *(Legacy specs also carry `## Q&A traceability` — they still count as refined; new runs never write it.)*
|
|
94
95
|
|
|
95
96
|
> **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.
|
|
96
97
|
|
|
@@ -104,7 +105,7 @@ Every doubt asked to the human + the chosen answer.
|
|
|
104
105
|
| Incomplete context | systems/components unidentified | **research** |
|
|
105
106
|
| Blurry scope | `Out` missing, or In/Out overlap | **human** |
|
|
106
107
|
| Untestable criteria | acceptance not verifiable | **human** (derive + confirm — often as a `### Scenario`) |
|
|
107
|
-
| Scenario missing | behavioral criterion
|
|
108
|
+
| Scenario missing | behavioral criterion whose behavior is NOT captured by its WHEN/THEN (needs GIVEN setup or edge semantics; a criterion a scenario would only restate 1:1 is not a gap) | the AI drafts GIVEN/WHEN/THEN + **human** confirms |
|
|
108
109
|
| Open questions pending | explicit doubts | by nature |
|
|
109
110
|
| Hidden assumptions | the spec assumes unstated things | **research** validates / **human** confirms |
|
|
110
111
|
| Internal contradiction | sections contradict each other | **human** |
|
|
@@ -154,7 +155,7 @@ spec-refine-loop(spec):
|
|
|
154
155
|
switch(flow):
|
|
155
156
|
Compactar → write CHECKPOINT (refine_session) ; compact(harness) ; continue
|
|
156
157
|
Cerrar → goto finalize
|
|
157
|
-
work = integrate(work, ans) # → Q
|
|
158
|
+
work = integrate(work, ans) # → Refinement decisions (Q: entries) / Open questions
|
|
158
159
|
ideation offer accepted → run the round NOW, then its verdicts as a NEW ≤3+flow batch (§ Ideation gate) → integrate
|
|
159
160
|
ideation offer declined → mark that gap exhausted # anti re-fire; on-demand entry stays open
|
|
160
161
|
# no material gaps → analyze gate = Success criteria green (read-only) before offering Guardar:
|
|
@@ -162,7 +163,7 @@ spec-refine-loop(spec):
|
|
|
162
163
|
if issues: gaps += issues ; continue # findings come back into the loop as gaps
|
|
163
164
|
ans = structured_choice(content: [Guardar refinada, Preguntar algo más],
|
|
164
165
|
flow: [Compactar, Cerrar])
|
|
165
|
-
Guardar → edit_in_place_with_confirm(spec) # completes sections + inserts UI spec/Refinement decisions
|
|
166
|
+
Guardar → edit_in_place_with_confirm(spec) # completes sections + inserts UI spec/Refinement decisions ; goto finalize
|
|
166
167
|
Preguntar algo más → continue
|
|
167
168
|
flow Compactar/Cerrar → handle the same way
|
|
168
169
|
finalize:
|
|
@@ -175,12 +176,12 @@ finalize:
|
|
|
175
176
|
|
|
176
177
|
Full mechanism (3 cases, `Compactar`, re-run on demand with `--reopen`) in the chassis (§ *Compact / resume*). SPEC keys:
|
|
177
178
|
|
|
178
|
-
- The **prior-work mark** is the presence of `## Refinement decisions`
|
|
179
|
+
- The **prior-work mark** is the presence of `## Refinement decisions` in the spec (the *refined mark*, see *Deliverable schema*; legacy specs may also carry `## Q&A traceability`).
|
|
179
180
|
- Re-refining on demand is a **first-class operation** while the flow stays in SPEC (new requirements, scope changes, after re-reading the spec): it always reads the **spec itself**, incremental re-refinement; on `Guardar`, edits in place with confirmation.
|
|
180
181
|
|
|
181
182
|
## Convergence / exit
|
|
182
183
|
|
|
183
|
-
- **No material gaps** → **analyze gate** (read-only) = **`Success criteria` green** (*verification-first*; the SPEC instance of the chassis convergence gate): every acceptance criterion traces to the `Requirement`, no internal contradictions, coherent `Scope` In/Out, `Open questions` closed or explicitly deferred. **Minimality** — no gold-plating: every criterion and scope item earns its place (chassis § *Minimality*); speculative scope is cut or deferred. Scenarios must trace to ≥1 criterion — and
|
|
184
|
+
- **No material gaps** → **analyze gate** (read-only) = **`Success criteria` green** (*verification-first*; the SPEC instance of the chassis convergence gate): every acceptance criterion traces to the `Requirement`, no internal contradictions, coherent `Scope` In/Out, `Open questions` closed or explicitly deferred. **Minimality** — no gold-plating: every criterion and scope item earns its place (chassis § *Minimality*); speculative scope is cut or deferred. Scenarios must trace to ≥1 criterion — and add GIVEN setup or edge semantics beyond it (a 1:1 restatement of a criterion is gold-plating: cut it) — without contradicting `Scope`. Whatever fails **comes back as a gap**; if it passes → offer `Guardar especificación refinada`.
|
|
184
185
|
- `Guardar` → `edit_in_place_with_confirm(spec)` and `finalize`.
|
|
185
186
|
- `Cerrar` → the chassis `finalize` (always persists `CHECKPOINT`; `BACKLOG` **only if** something is deferred — here: close reason + deferred `Open questions`).
|
|
186
187
|
|
|
@@ -188,6 +189,6 @@ Full mechanism (3 cases, `Compactar`, re-run on demand with `--reopen`) in the c
|
|
|
188
189
|
|
|
189
190
|
- Resolved via **inline research** → the spec's `## Refinement decisions` (+ ref to the session's `CONCLUSIONS`).
|
|
190
191
|
- Resolved via **ideation** → per verdict (§ *Ideation gate*): `Adoptar` → the spec's sections + `## Refinement decisions` · `Descartar` → there · `Aparcar` → `## Open questions`.
|
|
191
|
-
- Resolved via **human** → the
|
|
192
|
+
- Resolved via **human** → the same `## Refinement decisions`, as a `Q: <question> → <chosen answer> — <rationale>` entry.
|
|
192
193
|
- Resolved via the **`ui-design` capability** (UI gap) → the spec's `## UI spec` section.
|
|
193
194
|
- **Inconclusive or unresolved research** → the spec's `## Open questions` (deferred) + the refine session's `BACKLOG.md` (only if something is deferred).
|