@tacuchi/agent-workflow-cli 20.17.0 → 20.21.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/README.md +23 -2
- package/dist/application/parsers/phases.js +135 -0
- package/dist/application/parsers/phases.js.map +1 -0
- package/dist/application/status-service.js +66 -2
- package/dist/application/status-service.js.map +1 -1
- package/package.json +1 -1
- package/skills/w/SKILL.md +9 -7
- package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +3 -1
- package/skills/w/artifacts/artifacts-exec/DECISION.md +2 -0
- package/skills/w/commands/README.md +1 -1
- package/skills/w/commands/plan-exec.md +6 -3
- package/skills/w/commands/plan-new.md +7 -3
- package/skills/w/commands/plan-refine.md +5 -2
- package/skills/w/commands/resume.md +8 -6
- package/skills/w/commands/spec-new.md +53 -15
- package/skills/w/commands/spec-refine.md +7 -6
- package/skills/w/commands/status.md +10 -5
- package/skills/w/loops/CHASSIS.md +3 -3
- package/skills/w/loops/CODE-POLICIES.md +2 -0
- package/skills/w/loops/plan-exec-loop/LOOP.md +97 -36
- package/skills/w/loops/plan-new-loop/LOOP.md +63 -11
- package/skills/w/loops/plan-refine-loop/LOOP.md +89 -21
- package/skills/w/loops/quick-loop/LOOP.md +1 -1
- package/skills/w/loops/spec-refine-loop/LOOP.md +140 -60
|
@@ -3,7 +3,8 @@ 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 +
|
|
6
|
+
TECHNICAL-NOTE level + Tasks phased by verifiable functional state
|
|
7
|
+
(### Fn blocks with live state),
|
|
7
8
|
code/impact-mapping research, planning gap taxonomy, and per-screen design
|
|
8
9
|
SPECs via ui-design
|
|
9
10
|
when the plan includes UI. If the spec is not refined it suggests
|
|
@@ -25,7 +26,7 @@ PLAN
|
|
|
25
26
|
`/w:plan-new` — **resumable** (same chassis mechanism, keyed off CHECKPOINT).
|
|
26
27
|
|
|
27
28
|
## Reads
|
|
28
|
-
`docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **
|
|
29
|
+
`docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Ready vs not** is read from the spec's frontmatter `status`: `ready-for-plan` → proceed (legacy compat: a frontmatter-less spec carrying `## Refinement decisions`, or the older `## Q&A traceability`, counts as ready). Otherwise → **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), **never a block**: the user may proceed. Questions the spec left with destination `PLAN` are **input to this loop**, not a reason to send it back.
|
|
29
30
|
|
|
30
31
|
## Writes
|
|
31
32
|
`docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists) — or **several sibling plans** when an accepted split applies (§ *Split gate (multi-plan)*). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the plan **includes UI**, it also produces **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its session** (see *Delta 4* — they are not `docs/`, no auto-export).
|
|
@@ -62,10 +63,12 @@ The plan absorbs the `TECHNICAL-NOTE` level **inline** (user decision) + the roa
|
|
|
62
63
|
aligned with the spec criteria. One narration, not four.
|
|
63
64
|
## Impacted FE · BE · DB (schemas/tables/functions) · APIs · integr. (core)
|
|
64
65
|
## Dependencies docs / sources / databases / sessions · inter-plan order on a split (opt.)
|
|
65
|
-
## Tasks (core) `### Fn — <name>` blocks
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
## Tasks (core) `### Fn — <name>` blocks per the phase contract
|
|
67
|
+
below: each one a verifiable functional state with its
|
|
68
|
+
`> Estado:` line, its evidence and its `- [ ] Tn.m`
|
|
69
|
+
units of purpose — never a list of layers or files.
|
|
70
|
+
The `### Fn` headers are the ONLY source of phases;
|
|
71
|
+
there is no separate Phases table.
|
|
69
72
|
## Validations validations / constraints / business logic (core)
|
|
70
73
|
## Risks / impact technical risks and impacts (opt.)
|
|
71
74
|
## Assumptions assumptions — only the delta over the spec, never re-imported (opt.)
|
|
@@ -76,6 +79,46 @@ The plan absorbs the `TECHNICAL-NOTE` level **inline** (user decision) + the roa
|
|
|
76
79
|
|
|
77
80
|
> **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).
|
|
78
81
|
|
|
82
|
+
## Phase contract (canonical)
|
|
83
|
+
|
|
84
|
+
A `### Fn` block is a **verifiable state of the system**, never a list of layers, files or classes. It answers one question: *what can the system do or demonstrate at the end that it could not at the start?* The contract is defined **once** here — [`plan-refine-loop`](../plan-refine-loop/LOOP.md) and [`plan-exec-loop`](../plan-exec-loop/LOOP.md) reference it and never redefine it.
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
### F1 — <result-oriented name>
|
|
88
|
+
|
|
89
|
+
> Estado: pendiente
|
|
90
|
+
|
|
91
|
+
**Resultado:** <the new verifiable state of the system>
|
|
92
|
+
|
|
93
|
+
**Recorrido afectado:** <consumer → components → current boundary>
|
|
94
|
+
|
|
95
|
+
**Trabajo:**
|
|
96
|
+
- [ ] T1.1 — <coherent unit of work>
|
|
97
|
+
|
|
98
|
+
**Límite de simulación:** antes <where it is> → después <where it lands, or removed>
|
|
99
|
+
|
|
100
|
+
**Validación de fase:** <the primary proof that the promised state was reached>
|
|
101
|
+
|
|
102
|
+
**Condición de salida:** <falsifiable result · contract preserved · simulation, if any, located or removed>
|
|
103
|
+
|
|
104
|
+
**Diferido:** <work consciously reserved for another phase>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Always**: `Resultado` · `Trabajo` · `Validación de fase` · `Condición de salida`.
|
|
108
|
+
- **Conditional**: `Estado inicial` (when it is not obvious) · `Recorrido afectado` (distributed change) · `Límite de simulación` (temporary behavior exists) · `Diferido` · `Dependencias` (the phase cannot run in direct sequence).
|
|
109
|
+
|
|
110
|
+
**Phase state = machine state.** One `> Estado: <value>` line directly under the `### Fn` heading; vocabulary `pendiente` | `en ejecución` | `bloqueada` | `validada`, updated **in place**, never duplicated. It is what `aw status` counts (`phases_validated` / `phases_total`), **alongside — not instead of —** the checkbox progress. A phase reaches `validada` only when its work is done, its `Condición de salida` holds, its validation **ran and passed**, and the closing review gate passed. **Never** because all its checkboxes are ticked. *(Legacy plans carry no line at all: `aw status` reports them as zero phases — checkbox progress only. A missing line among stated blocks reads `pendiente`, and nothing is back-filled.)*
|
|
111
|
+
|
|
112
|
+
**The state line carries its value alone** — no comment, no suffix, no annotation; an annotated value reads as `pendiente`. A blocker's reason lives on its own `> Bloqueo: <reason>` line inside the block, and in `CHECKPOINT`, `## Open questions` and `BACKLOG`.
|
|
113
|
+
|
|
114
|
+
> Position disambiguates the two marks: the plan-level `> Estado: done — …` line lives under the title (plan-exec § *Delta 6*); the phase-level one lives inside its `### Fn` block.
|
|
115
|
+
|
|
116
|
+
**Granularity is semantic, not mechanical.** A phase earns its place when it leaves a demonstrable state, can be reviewed as a unit, and — when the change carries temporary behavior — moves or retires a simulation. A task is a **coherent unit of purpose** and may touch several files. Naming an edit operation — "create class X", "add method Y", "update the import" — describes a **micro step**: internal to execution, recorded in `CHECKPOINT` when a resume needs it, never a plan entry. `XS–S` stays an orientation of risk and scope; it never mandates splitting a semantic task into mechanical operations.
|
|
117
|
+
|
|
118
|
+
## Incremental strategy (reference, never a template)
|
|
119
|
+
|
|
120
|
+
A change spread over consumer, service and data often lands well as: consumer shell → minimal real integration → vertical skeleton → real implementation from the source outwards → hardening → finish. **Reference to adapt, never a mandatory shape.** Backend-only, CLI, batch, library and database-only changes have their own journey, and inserting a layer the project does not have fails the minimality lens. A small change may be **one phase**, when that phase already is a coherent verifiable state.
|
|
121
|
+
|
|
79
122
|
## Delta 2 — Gap taxonomy (of "plan")
|
|
80
123
|
|
|
81
124
|
Replaces the spec gap taxonomy with a planning-oriented one:
|
|
@@ -85,9 +128,13 @@ Replaces the spec gap taxonomy with a planning-oriented one:
|
|
|
85
128
|
| Approach/Solution undefined | the how is vague | research / human |
|
|
86
129
|
| Components unidentified | FE/BE/DB impact unknown | **research** (maps the code) |
|
|
87
130
|
| AS-IS wiring unknown | current state unknown | **research** |
|
|
88
|
-
|
|
|
131
|
+
| Journey unmapped | the observable contract, the participating components or the repo/process boundaries are unknown — the phases cannot be ordered | **research** |
|
|
132
|
+
| Phase without a state | a `### Fn` mixes unrelated functional states, or nothing can be validated until the very end | the AI re-shapes it by state (**human** confirms an order change) |
|
|
89
133
|
| Plan splittable | independently deliverable tranches — different moments/priorities, no shared deps/risk | **human consents** → split (see *Split gate (multi-plan)*) |
|
|
90
|
-
| Task
|
|
134
|
+
| Task named as an edit | the name states an edit operation ("create class X", "add method Y") instead of a purpose | the AI re-states it by purpose |
|
|
135
|
+
| Structural micro-tasks | the plan enumerates files, classes or methods as entries | the AI groups them by purpose |
|
|
136
|
+
| Simulation without lifecycle | temporary behavior exists with no phase that displaces it and no phase that retires it | the AI derives both / **human** |
|
|
137
|
+
| Phase without evidence | the block declares no `Validación de fase` | the AI derives it from the criteria / **human** |
|
|
91
138
|
| Over-engineered solution | approach heavier than the criteria need — needless abstraction/layer/dependency, or a phase/task not required to meet the spec (chassis § *Minimality*) | AI proposes the lighter path + **human** confirms (**probe** if "lighter works" is a runnable doubt) |
|
|
92
139
|
| Missing deps | order unclear | research / human |
|
|
93
140
|
| Spec criteria uncovered | tasks don't trace to acceptance criteria | the AI derives + human confirms |
|
|
@@ -132,8 +179,8 @@ Resolves the **Plan splittable** gap (Delta 2) — the canonical definition for
|
|
|
132
179
|
```
|
|
133
180
|
plan-new-loop(spec):
|
|
134
181
|
input = glob(docs/specs/NNN-spec-*.md) | argument path
|
|
135
|
-
if the spec
|
|
136
|
-
soft-suggest /w:spec-refine
|
|
182
|
+
if the spec is not status: ready-for-plan (nor a legacy mark):
|
|
183
|
+
soft-suggest /w:spec-refine # never blocks — the user may proceed anyway
|
|
137
184
|
session = create_or_resume("<slug>-plan-new") # CLI prepends global NNN
|
|
138
185
|
seed SESSION.Success criteria = coherence-gate checklist # verification-first, BEFORE
|
|
139
186
|
work = plan skeleton (Delta 1) derived from the spec (+ checkpoint progress if resuming)
|
|
@@ -147,7 +194,11 @@ plan-new-loop(spec):
|
|
|
147
194
|
- every spec acceptance criterion traces to a phase/task
|
|
148
195
|
(split: each criterion → exactly one sibling — complete, disjoint partition)
|
|
149
196
|
- the Final behavior block of ## Solution covers the criteria
|
|
150
|
-
- ### Fn
|
|
197
|
+
- every ### Fn leaves a verifiable state with its own exit condition — never a list of layers or files
|
|
198
|
+
- the order allows early integration · deps without cycles · Impacted consistent with Solution
|
|
199
|
+
- the simulation boundary, ONLY when the change carries one, is located, its displacement planned, and one phase owns its retirement
|
|
200
|
+
- every phase declares its primary evidence; per-layer tests are justified, never automatic
|
|
201
|
+
- resumable: a stop between phases leaves a stable state and a legible next intent
|
|
151
202
|
- minimality (chassis § *Minimality*): the Solution is the lightest that meets its Final behavior block; no phase/task/abstraction the criteria don't require
|
|
152
203
|
- (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
|
|
153
204
|
whatever fails → comes back as a gap
|
|
@@ -163,6 +214,7 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
|
|
|
163
214
|
## Convergence / exit
|
|
164
215
|
|
|
165
216
|
- **No material gaps** → **coherence gate** (the *Sequence* checklist; the PLAN-new instance of the chassis convergence gate). Criterion→task traceability is a **checked invariant**, never a separate section.
|
|
217
|
+
- **The gate judges functional states, not size.** A plan converges when every `### Fn` is a verifiable state with its exit condition and its primary evidence — plus its simulation boundary located, **only when the change carries one**; a phase that only enumerates layers or files comes back as a gap, however small it is.
|
|
166
218
|
- Passes → `Guardar plan` (writes with confirmation if it exists) → `finalize`.
|
|
167
219
|
- **Split branch**: `Guardar planes` writes the N siblings sequentially (mint before each write) → `finalize` — one session, one HISTORY row.
|
|
168
220
|
- `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plan-refine-loop
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
Turns an existing plan (docs/plans/PPP-plan-<slug>.md) into an EXECUTABLE
|
|
5
|
+
sequence of functional states, editing it IN PLACE. Heir of the chassis
|
|
6
|
+
(loops/CHASSIS.md). Deltas: functional journey map, phases re-shaped by
|
|
7
|
+
verifiable state (contract in plan-new-loop), simulation lifecycle,
|
|
8
|
+
evidence by behavior, executability gate, replanning of partially executed
|
|
9
|
+
plans, and design SPECs via ui-design on UI changes. Started by
|
|
10
|
+
/w:plan-refine — also the return path when plan-exec stops on a structural
|
|
11
|
+
deviation; resumable and re-runnable on demand.
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
# plan-refine-loop
|
|
@@ -22,11 +23,19 @@ PLAN
|
|
|
22
23
|
## Layer
|
|
23
24
|
2 — the AI runs it end to end.
|
|
24
25
|
|
|
26
|
+
## Objective — an executable sequence of functional states
|
|
27
|
+
|
|
28
|
+
This loop turns a plan into a sequence of **verifiable states of the system**. Exit condition:
|
|
29
|
+
|
|
30
|
+
> `plan-exec` can implement every phase **without inventing** contracts, observable states, structural order, simulation boundary or exit evidence.
|
|
31
|
+
|
|
32
|
+
The phase contract is defined **once** in [`plan-new-loop`](../plan-new-loop/LOOP.md) § *Phase contract (canonical)* — this loop **applies** it and never redefines it: a `### Fn` block is a state the system reaches, with its `> Estado:` line, its work, its evidence and its exit condition.
|
|
33
|
+
|
|
25
34
|
## Auxiliary / NOT mandatory
|
|
26
|
-
`plan-exec` runs **any** plan, refined or not — there is **no** gate requiring plan-refine. This loop exists to incorporate changes (new requirements, scope adjustments, deps/risks spotted on re-read) **before** executing, without regenerating
|
|
35
|
+
`plan-exec` runs **any** plan that is already executable, refined or not — there is **no** gate requiring plan-refine. This loop exists to incorporate changes (new requirements, scope adjustments, deps/risks spotted on re-read) **before** executing, and to give an unexecutable plan the shape its execution needs, without regenerating it from scratch.
|
|
27
36
|
|
|
28
37
|
## Started by
|
|
29
|
-
`/w:plan-refine` — **resumable** (same chassis mechanism, keyed off CHECKPOINT) and **re-runnable on demand** (see *Compact / resume*).
|
|
38
|
+
`/w:plan-refine` — **resumable** (same chassis mechanism, keyed off CHECKPOINT) and **re-runnable on demand** (see *Compact / resume*). Second path: **the return from execution** — `plan-exec` derives here when its entry check finds a structural gap it cannot normalize, or when it stops mid-run on a structural deviation (§ *Replanning executed work*).
|
|
30
39
|
|
|
31
40
|
## Reads
|
|
32
41
|
`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.
|
|
@@ -52,25 +61,27 @@ The plan uses the **same skeleton** [`plan-new-loop`](../plan-new-loop/LOOP.md)
|
|
|
52
61
|
|
|
53
62
|
```markdown
|
|
54
63
|
## Refinement decisions ← NEW (ADDED) — the run's single trace
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
`Q: <question> → <chosen answer> — <rationale
|
|
64
|
+
MATERIAL changes only: contracts, journey, shape or order of the phases,
|
|
65
|
+
movement of the simulation boundary, risks that altered the plan, and work
|
|
66
|
+
already executed that conditions the replanning. A doubt that changed one of
|
|
67
|
+
those goes as `Q: <question> → <chosen answer> — <rationale>` (ref to the
|
|
68
|
+
session's CONCLUSIONS for what research resolved). A micro-decision, or a
|
|
69
|
+
question that changed nothing, is NOT transcribed.
|
|
59
70
|
```
|
|
60
71
|
|
|
61
72
|
> **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.)*
|
|
62
73
|
|
|
63
|
-
>
|
|
74
|
+
> **Execution updates progress; refinement changes structure.** `plan-exec` updates the plan's operational state in place — task checkboxes, the phase `> Estado:` line with its `> Bloqueo:` line while blocked, declared deferrals and the final plan status line. It does **not** redesign contracts, phase shape or order, participating components, evidence or simulation boundaries: those structural changes are this loop's, and a change of functional behavior belongs to `spec-refine`.
|
|
64
75
|
|
|
65
76
|
## Delta 2 — Gap taxonomy (of "plan")
|
|
66
77
|
|
|
67
|
-
Reuses plan-new-loop's gap taxonomy **in full** ([`plan-new-loop`](../plan-new-loop/LOOP.md) § *Delta 2*): vague Approach/Solution, components unidentified, AS-IS wiring unknown,
|
|
78
|
+
Reuses plan-new-loop's gap taxonomy **in full** ([`plan-new-loop`](../plan-new-loop/LOOP.md) § *Delta 2*), semantic rows included: journey unmapped, phase without a state, task named as an edit, structural micro-tasks, simulation without lifecycle, phase without evidence, plus the shared ones (vague Approach/Solution, components unidentified, AS-IS wiring unknown, over-engineered solution, missing deps, spec criteria uncovered, unaddressed risks, splittable plan, UI without design SPEC). **Focus difference:** plan-new **builds** the plan from scratch; plan-refine re-shapes what is already written — what changed against the plan (or against the spec, if the spec was re-refined) and what still keeps the plan from being executable. One extra re-refine gap:
|
|
68
79
|
|
|
69
80
|
| Gap | Signal | Resolved by |
|
|
70
81
|
|---|---|---|
|
|
71
82
|
| Plan↔spec drift | the spec was re-refined and the plan fell out of line | **research** (re-reads the spec) / **human** |
|
|
72
83
|
|
|
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 (
|
|
84
|
+
> **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 (phase shape, simulation, evidence, 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).
|
|
74
85
|
|
|
75
86
|
> **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.
|
|
76
87
|
|
|
@@ -82,6 +93,57 @@ Same as plan-new (maps code/impact: FE/BE/DB components, AS-IS wiring, deps), bu
|
|
|
82
93
|
|
|
83
94
|
Same mechanism as [`plan-new-loop`](../plan-new-loop/LOOP.md) (§ *Delta 4*: the **`ui-design`** capability → per-screen `NNN-SPEC-<SLUG>.md`, see [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)), **scoped to the delta**: only the screens **new or changed** by the refine get a design SPEC. The updated SPEC is written in **plan-refine's own session** (each loop manages ITS session's artifacts — it never edits plan-new's) and the plan **re-points** the UI Task reference to the current SPEC. Untouched screens keep their original SPEC.
|
|
84
95
|
|
|
96
|
+
## Functional journey map
|
|
97
|
+
|
|
98
|
+
Before re-shaping phases, the plan must answer what execution would otherwise have to invent. The answers land **inside the existing sections** (`## Solution`, `## Impacted`, the `### Fn` blocks) — this loop adds no plan section beyond its trace:
|
|
99
|
+
|
|
100
|
+
- **Observable contract** — who starts the operation, what inputs it provides, what successful result and what errors or states it observes, which contracts are created or changed, and what must stay compatible.
|
|
101
|
+
- **Technical journey** — participating components and their approximate order, boundaries between repos or processes, where persistence and external integrations sit, what already exists and what must be wired.
|
|
102
|
+
- **Incremental strategy** — the first demonstrable journey and, **only when the change carries temporary behavior**, where a safe simulation can live, how it is displaced and which phase retires it (reference shapes: [`plan-new-loop`](../plan-new-loop/LOOP.md) § *Incremental strategy*).
|
|
103
|
+
- **Evidence** — the primary proof of each phase, which rules deserve an isolated test, which integrations need a real one, and what cannot be validated because of operational constraints (that one goes to `## Open questions`).
|
|
104
|
+
|
|
105
|
+
> **Bounded research** (Delta 3, sharpened): investigate **only** what is needed to order the phases — journey, boundaries, existing contracts, where the simulation can live, risks that change the plan's design. What `plan-exec` resolves locally is **not** pre-investigated here.
|
|
106
|
+
|
|
107
|
+
## Simulation lifecycle
|
|
108
|
+
|
|
109
|
+
**This section applies only when the journey introduces temporary behavior** — a stub, fake, in-memory adapter, controlled fixture or temporary response. None in the change → no `Límite de simulación`, and no artificial phase invented to retire one. When there is, it is planned, never improvised: every simulation declares **purpose · location · the contract it stands for · the phase where it appears · the phase where it moves or disappears · what prevents its accidental selection in a production runtime · the minimum proof needed while it exists**.
|
|
110
|
+
|
|
111
|
+
- **Explicit over hidden**: `Stub…` / `Fake…`, in-memory adapter, temporary provider or controlled fixture — never a hardcode buried inside production code.
|
|
112
|
+
- **Displacement rule**: each affected phase writes its `Límite de simulación` as normalized prose — `antes <where it is>` → `después <where it lands, or removed>` — never as an implicit assumption.
|
|
113
|
+
- **Removal gate**: the change is not complete while a main-path simulation stays active, a configuration can still select it, the plan does not explain why it remains, or its removal was never validated. Test doubles isolated from the production runtime may stay.
|
|
114
|
+
|
|
115
|
+
## Evidence by behavior
|
|
116
|
+
|
|
117
|
+
Each phase carries proof of behavior, not of structure. Three levels, **chosen** — never descended automatically:
|
|
118
|
+
|
|
119
|
+
1. **Primary phase proof** — demonstrates the state the phase promised: component interaction, endpoint smoke, a vertical run down to the stub, persistence integration, or the end-to-end happy path.
|
|
120
|
+
2. **Focused proofs** — where a layer owns rules, a relevant transformation, error handling, persistence, transactions, temporal logic or an external integration.
|
|
121
|
+
3. **Risk proofs** — security, concurrency, idempotency, retries, known regressions, plausible high-impact failures.
|
|
122
|
+
|
|
123
|
+
The primary proof lives **inside its `### Fn` block** (`Validación de fase`); `## Validations` keeps the cross-cutting rules and constraints. A simulation gets only the minimum proof that demonstrates the wiring — no suite is built around what the next phase retires.
|
|
124
|
+
|
|
125
|
+
> **Necessity gate** (design criterion, not a record to keep): what behavior does the test demonstrate, what unique failure would it catch, is that already demonstrated elsewhere, does it target a stable boundary or an internal detail, does the layer own logic or risk, is it still worth keeping once the simulation is gone? No clear answer → it is not planned. Whatever slips through and only mirrors structure is flagged `overtest` by execution's closing review gate.
|
|
126
|
+
|
|
127
|
+
## Executability gate
|
|
128
|
+
|
|
129
|
+
This loop's instance of the chassis convergence gate — the same one `plan-exec` verifies on entry. Whatever fails comes back as a gap:
|
|
130
|
+
|
|
131
|
+
- **Contract** — relevant inputs, outputs and observable states identified; the final behavior matches the spec; no functional criterion invented here.
|
|
132
|
+
- **Journey** — main components identified, order reasonable, repo/process boundaries visible, the described architecture the one the project actually has.
|
|
133
|
+
- **Phases** — each leaves a verifiable state with its exit condition, none is a list of layers or files, the order allows early integration, deferrals are explicit.
|
|
134
|
+
- **Simulation** *(only when the change carries one)* — initial boundary identified, every displacement foreseen, one phase owns the retirement, nothing can stay active by accident. No temporary behavior → the check does not apply, and no empty `Límite de simulación` is required.
|
|
135
|
+
- **Evidence** — every phase declares its primary proof, per-layer tests are justified, the same scenario is not duplicated by default, declared risks have evidence or an explicit deferral.
|
|
136
|
+
- **Resumability** — tasks legible enough for a `CHECKPOINT`, intermediate states stable, pending work distinguishable from work already `validada`.
|
|
137
|
+
|
|
138
|
+
## Replanning executed work
|
|
139
|
+
|
|
140
|
+
A partially executed plan is replanned **forward**, never rewritten backwards:
|
|
141
|
+
|
|
142
|
+
- Phases already `validada` **stay as they are**, and their result becomes the initial state of what follows. Completed tasks are not re-written as if they had never happened.
|
|
143
|
+
- Only pending work is re-designed. A `validada` phase that the new shape invalidates gets a **compensating correction** as a new phase — never a silent edit of the closed one.
|
|
144
|
+
- **Return from `plan-exec`** (structural deviation — [`plan-exec-loop`](../plan-exec-loop/LOOP.md) § *Deviation gate*): the deviation enters as a **material gap** of this run. Changed input or output, observable state, public contract, participating components, phase order, simulation boundary or integration strategy — all land in `## Refinement decisions` with what execution already proved.
|
|
145
|
+
- **Legacy plans** (no phase state, micro-task shape) are migrated to the phase contract when this round touches them: completed tasks preserved, micro-tasks grouped by purpose, results and exit conditions derived from the spec and from the plan itself. Functional evidence that neither backs is **not invented** — it becomes an `## Open questions` entry.
|
|
146
|
+
|
|
85
147
|
## Split gate — refine semantics
|
|
86
148
|
|
|
87
149
|
The gate itself — signals, offer, anti-duplicate, sibling contract, partition — is defined **once** in [`plan-new-loop`](../plan-new-loop/LOOP.md) § *Split gate (multi-plan)* (this flow's guaranteed load already includes that file); this loop only adds the **in-place semantics** of splitting an existing plan:
|
|
@@ -103,8 +165,11 @@ Full mechanism (3 cases, `Compactar`, re-run with `--reopen`) in the chassis (§
|
|
|
103
165
|
plan-refine-loop(plan):
|
|
104
166
|
input = glob(docs/plans/PPP-plan-*.md) | argument path # always the plan itself (in place)
|
|
105
167
|
session = create_or_resume("<slug>-plan-refine") # reopens if it exists (see Compact / resume)
|
|
106
|
-
seed SESSION.Success criteria =
|
|
107
|
-
work = read(plan) (+ the spec if realignment is needed; + checkpoint
|
|
168
|
+
seed SESSION.Success criteria = executability-gate checklist # verification-first, BEFORE
|
|
169
|
+
work = read(plan) (+ the spec if realignment is needed; + checkpoint/exec history if resuming or returning from plan-exec)
|
|
170
|
+
journey = map(observable contract, technical journey, incremental strategy, evidence) # bounded research
|
|
171
|
+
work = phases grouped by verifiable state (phase contract) + simulation lifecycle if any + primary proof each
|
|
172
|
+
keep validated phases and their completed tasks; redesign ONLY pending work
|
|
108
173
|
repeat: # chassis engine
|
|
109
174
|
gaps = detect_gaps(work) (plan-new taxonomy + plan↔spec drift) minus the exhausted ones
|
|
110
175
|
if gaps == ∅: break
|
|
@@ -112,8 +177,9 @@ plan-refine-loop(plan):
|
|
|
112
177
|
research (scoped to the delta — Delta 3) · human (structured-choice) · probe (chassis) ·
|
|
113
178
|
ui-design (Delta 4, only new/changed screens)
|
|
114
179
|
integrate + update CHECKPOINT # artifact-first cycle
|
|
115
|
-
|
|
116
|
-
-
|
|
180
|
+
executability gate (read-only) = Success criteria green:
|
|
181
|
+
- contract · journey · phases · simulation · evidence · resumability (§ Executability gate)
|
|
182
|
+
- plan-new checklist (criterion→task · Final behavior block of Solution · deps · Impacted↔Solution · UI→current SPEC · minimality)
|
|
117
183
|
# spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior block/Validations (see Delta 2)
|
|
118
184
|
- re-refine's own check: the plan is REALIGNED with what changed
|
|
119
185
|
whatever fails → comes back as a gap
|
|
@@ -128,7 +194,9 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
|
|
|
128
194
|
|
|
129
195
|
## Convergence / exit
|
|
130
196
|
|
|
131
|
-
- **No material gaps** → **
|
|
197
|
+
- **No material gaps** → **executability gate** (the *Sequence* checklist: contract · journey · phases · simulation · evidence · resumability, plus plan-new's coherence checks and the re-refine's own realignment check).
|
|
132
198
|
- Passes → `Guardar plan refinado` (edits in place with confirmation) → `finalize`.
|
|
133
199
|
- **Split branch**: `Guardar planes` edits the original reduced and writes the extracted siblings → `finalize`.
|
|
134
200
|
- `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
|
|
201
|
+
|
|
202
|
+
> **After refining:** the plan goes to `plan-exec`, which re-checks this same gate on entry — a plan saved here should never bounce back for its structure.
|
|
@@ -58,7 +58,7 @@ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **a
|
|
|
58
58
|
- **`Recortar alcance`** → the AI proposes the **sub-task that DOES fit** a quick; the loop continues with it (`SESSION.Objective` = the sub-task; the original prompt goes into the session's `## Origin`) and the rest is deferred to `BACKLOG` ("trimmed at the gate — may warrant its own spec, `/w:spec-new`").
|
|
59
59
|
- **Anti-duplicate** (the `create_or_resume` spirit): if a spec whose `## Origin` references this same objective already exists (or an equivalent `*-spec-refine` session), the recommended option becomes **resuming that spec** (`/w:spec-refine` semantics) — never a second draft.
|
|
60
60
|
- **Live transition to SPEC** (shared by the gate and mid-loop escalation). On acceptance, the work line **moves to the SPEC flow**: the explicit consent in the structured-choice **equals invoking the destination command** (*consented exception* — rule 3 of the *Continuity rule*, [`../../SKILL.md`](../../SKILL.md) § *Operating context*). On the SPEC side:
|
|
61
|
-
1. **Materialize the draft** via the [`../../commands/spec-new.md`](../../commands/spec-new.md) procedure: `aw next-number docs/specs`, slug, schema, single-pass **NO RESEARCH
|
|
61
|
+
1. **Materialize the draft** via the [`../../commands/spec-new.md`](../../commands/spec-new.md) procedure: `aw next-number docs/specs`, slug, schema, single-pass **NO RESEARCH** — its bounded reconnaissance does **not** re-fire (this run's context arrives adopted). `## Origin` = "escalated from `/w:quick`" + the original prompt (+ the origin quick session if it exists). The draft is born `status: draft`: only the SPEC gate promotes it to `ready-for-plan`.
|
|
62
62
|
2. **Load and execute** [`../spec-refine-loop/LOOP.md`](../spec-refine-loop/LOOP.md) — over that spec (trampoline pattern).
|
|
63
63
|
3. The run's session is that loop's **normal** `NNN-<slug>-spec-refine` (the CLI numbers it; its `## Origin` records the escalation). **Invariant 2 intact**: quick, while it is quick, never writes `docs/` — the draft is written by the SPEC flow, post-consent.
|
|
64
64
|
- **Mid-loop escalation + handoff**: if the task grows (same gate signals) → propose moving up to **SPEC/PLAN** (structured-choice, recommendation first). If the user accepts:
|