@tacuchi/agent-workflow-cli 20.12.0 → 20.14.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 +2 -2
- package/package.json +1 -1
- package/skills/w/SKILL.md +2 -0
- package/skills/w/commands/plan-new.md +1 -1
- package/skills/w/commands/plan-refine.md +1 -1
- package/skills/w/commands/spec-new.md +18 -6
- package/skills/w/harness/HARNESS.md +4 -0
- package/skills/w/loops/plan-new-loop/LOOP.md +21 -3
- package/skills/w/loops/plan-refine-loop/LOOP.md +18 -4
- package/skills/w/loops/spec-refine-loop/LOOP.md +18 -2
package/README.md
CHANGED
|
@@ -15,8 +15,8 @@ npm install -g @tacuchi/agent-workflow-cli
|
|
|
15
15
|
Workline has three layers plus a permanent `docs/` zone:
|
|
16
16
|
|
|
17
17
|
- **Layer 1 · Commands** (`/w:*`) — the only thing the user invokes:
|
|
18
|
-
- **SPEC** — `/w:spec-new` (single-pass draft) → `/w:spec-refine` (gap-driven loop) → `docs/specs/`.
|
|
19
|
-
- **PLAN** — `/w:plan-new` → (`/w:plan-refine` — aux, optional) → `/w:plan-exec` → `docs/plans
|
|
18
|
+
- **SPEC** — `/w:spec-new` (single-pass draft; may split into sibling specs) → `/w:spec-refine` (gap-driven loop) → `docs/specs/`.
|
|
19
|
+
- **PLAN** — `/w:plan-new` → (`/w:plan-refine` — aux, optional) → `/w:plan-exec` → `docs/plans/` (the plan loops may split into sibling plans).
|
|
20
20
|
- **QUICK** — `/w:quick` — lightweight shortcut; escalates live to SPEC when the goal outgrows a quick.
|
|
21
21
|
- **EXPORTS** — `/w:export-scripts` · `export-manuals` · `export-diagrams` · `export-reports` (the only path that promotes artifacts to `docs/`).
|
|
22
22
|
- **Bootstrap** — `/w:workspace-init` turns any folder into a workspace (1+ sources; no project/hub distinction).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tacuchi/agent-workflow-cli",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.14.0",
|
|
4
4
|
"description": "Runtime CLI for Workline — the stages + loops + artifacts system for agent work. Bundles the universal `w` skill set under `skills/w/` (slash commands `/w:*`: spec-new/spec-refine, plan-new/plan-exec, quick, persist, workspace-init, export-*); `self install --target <host>` copies SKILL + commands + hooks into the host. Pluggable capability skills via `.workflow/skills.toml`. Multi-empresa parametrization via `profile.json` cascade. Namespace auto-detected from any `.<ns>/sessions/` dir in CWD; default `workflow`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/skills/w/SKILL.md
CHANGED
|
@@ -67,6 +67,8 @@ Typical chain: prompt → `spec-new` generates `docs/specs/NNN-spec-<slug>.md`
|
|
|
67
67
|
|
|
68
68
|
QUICK can **escalate live to SPEC** when the objective exceeds a quick (entry size gate) or the task grows mid-loop: with consent via structured-choice, the work line moves to the SPEC flow (draft via the `spec-new` procedure + `spec-refine-loop` directly); escalation to PLAN stays **deferred** (seed + pointer). See `loops/quick-loop/LOOP.md` § *QUICK delta*.
|
|
69
69
|
|
|
70
|
+
Both authoring entry points can **split** with consent: `spec-new` may split a multi-part prompt into **sibling specs** (its split gate — one structured-choice before writing anything), and the plan loops may split a plan into independently deliverable **sibling plans** (`plan-new-loop` § *Split gate (multi-plan)*; plan-refine adds the in-place semantics). Siblings cross-reference **by path**; a split stays inside the same work line — it is not an escalation.
|
|
71
|
+
|
|
70
72
|
### Operating context — where everything lands
|
|
71
73
|
|
|
72
74
|
Before any loop, the AI resolves its **operating context** on **every prompt** with two detections: **workspace?** (`.<ns>/sessions/` exists) + **session to continue?** (an active one, or a recent one this prompt continues). That decides the behavior and **where artifacts land** (SQL, scripts, decisions, …):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use when a spec is ready to become an executable plan — not to refine an existing plan (plan-refine) nor execute one (plan-exec). Starts or resumes the planning loop (plan-new-loop) from a spec. Turns the "what" (spec) into the "how" (plan). Ideal input: an already refined docs/specs/NNN-spec-<slug>.md. Also adopts an externally-built plan (host plan mode, hand-written, another agent) as the plan-doc — mode 4 of its input resolution.
|
|
2
|
+
description: Use when a spec is ready to become an executable plan — not to refine an existing plan (plan-refine) nor execute one (plan-exec). Starts or resumes the planning loop (plan-new-loop) from a spec. Turns the "what" (spec) into the "how" (plan). Ideal input: an already refined docs/specs/NNN-spec-<slug>.md. Also adopts an externally-built plan (host plan mode, hand-written, another agent) as the plan-doc — mode 4 of its input resolution. May split into sibling plans (split gate).
|
|
3
3
|
argument-hint: <docs/specs/NNN-spec-<slug>.md | prompt>
|
|
4
4
|
allowed-tools:
|
|
5
5
|
[
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use when an existing plan needs changes before executing — new requirements, scope tweaks — not to generate one (plan-new) nor execute it (plan-exec). Starts or resumes the plan refinement loop (plan-refine-loop). An auxiliary, NOT mandatory step of the PLAN flow — refines an existing plan in place. Input: a docs/plans/PPP-plan-<slug>.md — generated by plan-new, hand-written, or adopted from a host planner (plan-new mode 4 / persist).
|
|
2
|
+
description: Use when an existing plan needs changes before executing — new requirements, scope tweaks — not to generate one (plan-new) nor execute it (plan-exec). Starts or resumes the plan refinement loop (plan-refine-loop). An auxiliary, NOT mandatory step of the PLAN flow — refines an existing plan in place. Input: a docs/plans/PPP-plan-<slug>.md — generated by plan-new, hand-written, or adopted from a host planner (plan-new mode 4 / persist). May extract tranches into sibling plans.
|
|
3
3
|
argument-hint: <docs/plans/PPP-plan-<slug>.md>
|
|
4
4
|
allowed-tools:
|
|
5
5
|
[
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use when the user wants to capture a NEW requirement, idea or wish as a spec — not to refine an existing draft (that's spec-refine). Generates a specification draft (docs/specs/NNN-spec-<slug>.md) from a prompt, in a single pass. Step 1 of the SPEC flow; starts no loop.
|
|
2
|
+
description: Use when the user wants to capture a NEW requirement, idea or wish as a spec — not to refine an existing draft (that's spec-refine). Generates a specification draft (docs/specs/NNN-spec-<slug>.md) from a prompt, in a single pass. Can split a multi-part prompt into several sibling specs (split gate). Step 1 of the SPEC flow; starts no loop.
|
|
3
3
|
argument-hint: <prompt with the requirement or idea>
|
|
4
4
|
allowed-tools:
|
|
5
5
|
[
|
|
@@ -15,7 +15,7 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
|
|
|
15
15
|
|
|
16
16
|
> ## ⛔ Single-pass — NO RESEARCH (hard rule)
|
|
17
17
|
>
|
|
18
|
-
> This command **only paraphrases** the user's input into the draft schema. It is **one sequential pass**: read `$ARGUMENTS` → fill the sections → write the file. Nothing else. It must take **seconds, not minutes**.
|
|
18
|
+
> This command **only paraphrases** the user's input into the draft schema. It is **one sequential pass**: read `$ARGUMENTS` → (split gate: at most ONE structured-choice — see § *Split gate (multi-spec)*) → fill the sections → write the file(s). Nothing else. It must take **seconds, not minutes**.
|
|
19
19
|
>
|
|
20
20
|
> **FORBIDDEN**, no exceptions: launching sub-agents/workflows (`Task`/`Agent`/`Workflow`), research sessions, web searches, or deep code investigation — **even if the harness is in a maximum-effort/depth mode** (e.g. ultracode/max-effort in Claude Code).
|
|
21
21
|
>
|
|
@@ -23,10 +23,21 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
|
|
|
23
23
|
>
|
|
24
24
|
> Deep investigation (closing gaps, mapping code, querying DB, autonomous research) is **`spec-refine`** work, not this command's.
|
|
25
25
|
|
|
26
|
+
With a raw user prompt, first run the **§ Split gate (multi-spec)** assessment (below): the split offer, if any, happens **before writing anything**. Then:
|
|
27
|
+
|
|
26
28
|
1. Run `aw next-number docs/specs` (the only shell tool needed): it returns JSON — use the `next` field as `NNN`. This command builds the slug.
|
|
27
29
|
2. Derive the `<slug>`: short kebab-case from the Requirement — only `[a-z0-9-]`, ≤ ~5 words / ≤ 40 chars.
|
|
28
|
-
3. Create `docs/specs/NNN-spec-<slug>.md` paraphrasing `$ARGUMENTS` into the draft schema (below). Repo reading: optional and minimal (e.g. one file the user cited) — never a sweep or research.
|
|
29
|
-
4. Show the generated file and the suggested next step (`/w:spec-refine docs/specs/NNN-spec-<slug>.md`).
|
|
30
|
+
3. Create `docs/specs/NNN-spec-<slug>.md` paraphrasing `$ARGUMENTS` into the draft schema (below). Repo reading: optional and minimal (e.g. one file the user cited) — never a sweep or research. On an accepted split: repeat steps 1-3 per part, minting immediately before each write.
|
|
31
|
+
4. Show the generated file(s) and the suggested next step (`/w:spec-refine docs/specs/NNN-spec-<slug>.md`).
|
|
32
|
+
|
|
33
|
+
## Split gate (multi-spec)
|
|
34
|
+
|
|
35
|
+
Right after reading `$ARGUMENTS` and **before writing anything**, assess whether the prompt bundles **several independent requirements**. The gate fires **only on clear signals** (≥2 of: independent deliverables/goals · explicit enumeration of distinct features · different requested moments or order · unrelated subsystems); borderline → **one spec, no question**. It applies only to a **raw user prompt** (direct invocation, or the `plan-new` mode-3 handoff); it **never fires** on the reuse entries below — the quick escalation and the `persist` adoption arrive already scoped to one objective.
|
|
36
|
+
|
|
37
|
+
- **The offer** — the command's **only** interaction: **one** structured-choice (1 content question + the `flow` control; `Cerrar` = abort, nothing is written yet). The question body shows the proposed cut in the **user's language**: per part, a name + slug, a 1-line scope and the suggested order. Labels: `Dividir en varias specs` (recommended when the signals hold) | `Una sola spec`. A free-form answer adjusts the cut (merge/rename/drop parts); if one part remains, proceed as a single spec.
|
|
38
|
+
- **On acceptance** — still single-pass, still **NO RESEARCH** (the cut is paraphrase of the prompt, never investigation): per part, mint with `aw next-number docs/specs` **immediately before each write**, then write that draft. Numbers come out consecutive, so every sibling path is known after the first mint.
|
|
39
|
+
- **Sibling contract**: each `## Origin` records the shared prompt + `split (part i/N)` + the **siblings by path** + the suggested order; each `## Scope` Out points to the sibling that owns the excluded part. Cross-reference by path, never by bare number.
|
|
40
|
+
- **Report**: list the N files and suggest the next step per spec (`/w:spec-refine` on the first — each sibling refines and plans at its own moment).
|
|
30
41
|
|
|
31
42
|
## Draft schema (`NNN-spec-<slug>.md`)
|
|
32
43
|
|
|
@@ -35,7 +46,8 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
|
|
|
35
46
|
|
|
36
47
|
## Origin (opt.)
|
|
37
48
|
Original prompt / prior doc / reference that originated the spec
|
|
38
|
-
(e.g. "adopted from host conversation" when it captures an analysis already established there
|
|
49
|
+
(e.g. "adopted from host conversation" when it captures an analysis already established there;
|
|
50
|
+
or "split (part i/N)" + sibling spec paths + suggested order — § Split gate (multi-spec)).
|
|
39
51
|
|
|
40
52
|
## Requirement
|
|
41
53
|
The what + why (brief). In the user's language.
|
|
@@ -87,7 +99,7 @@ Pending doubts. ← the spec-refine-loop closes them.
|
|
|
87
99
|
|
|
88
100
|
## Plan mode
|
|
89
101
|
|
|
90
|
-
Resolves `NNN` by reading `docs/specs/`, describes the draft it would generate without writing
|
|
102
|
+
Resolves `NNN` by reading `docs/specs/`, describes the draft(s) it would generate — split gate included: it reports the proposed cut — without writing any file.
|
|
91
103
|
|
|
92
104
|
## Resources
|
|
93
105
|
|
|
@@ -39,6 +39,7 @@ The capabilities the harness layer depends on, with their universal fallback (wh
|
|
|
39
39
|
| **subagent-dispatch** | *(optional)* parallelize research breadth | **inline sequential** research in the same session (the default anyway) |
|
|
40
40
|
| **persistent-context** | the `WORKSPACE` block + conventions always present | the repo's context file (standard **`AGENTS.md`**; `CLAUDE.md` on Claude Code) |
|
|
41
41
|
| **host-memory** | *(optional)* recover state/pending work from the host's accessible history — a **second source** after the workline signals | recent **git** / **`docs/`** signals + (in `/resume`) **ask the user**; plus Workline's own `.workflow/CHECKPOINT` via `aw resume-summary` |
|
|
42
|
+
| **web-research** | *(optional)* search/fetch external online evidence inside a consented ideation round (spec-refine § *Ideation gate*) | **offline ideation** (own knowledge + workspace + repos) — the loop **declares** the web was unavailable |
|
|
42
43
|
| **external-data** | read-only DB reads or other sources for research/validation | **MCP** (widely supported); without it, the gap degrades to a human question |
|
|
43
44
|
| **dry-run / preview** | preview what a command would do without writing | the command **describes** the change instead of applying it (e.g. `spec-new` lists the draft without creating the file) |
|
|
44
45
|
|
|
@@ -57,6 +58,7 @@ Concrete mechanism per harness (**Jul-2026**, verified against official docs; `~
|
|
|
57
58
|
| subagent-dispatch | `Task` (parallel) | `SubagentStart` / agents | agents (`.gemini/agents`) | `.opencode/agent/*.md` | ~ | ~ (cloud agents) | inline |
|
|
58
59
|
| persistent-context | `CLAUDE.md` (does **not** read AGENTS.md → symlink) | `AGENTS.md` | `GEMINI.md` + `AGENTS.md` | `AGENTS.md` | `CRUSH.md` + `AGENTS.md` | `AGENTS.md` (auto) | `AGENTS.md` |
|
|
59
60
|
| **host-memory** | `MEMORY.md` (cheap) + transcripts/`--resume` (deep) | `AGENTS.md` (static → fallback) | `GEMINI.md`+`AGENTS.md` (static → fallback) | `AGENTS.md` (static → fallback) | `CRUSH.md`+`AGENTS.md` (static → fallback) | rules / history (~) | git/`docs/` + ask |
|
|
61
|
+
| **web-research** | `WebSearch` / `WebFetch` | `web_search` (opt-in config) | `google_web_search` + `web_fetch` | `webfetch` (~) | ~ | ~ (agent web access) | — (offline + declare) |
|
|
60
62
|
| external-data (MCP) | `.mcp.json` | `.codex/config.toml` `[mcp_servers]` | `settings.json` `mcpServers` | `opencode.json` `mcp` | `crush.json` `mcp` | `.warp/.mcp.json` (+auto-discovers `.mcp.json`) · Oz: `--mcp` flag | — |
|
|
61
63
|
| **enforcement (deny tool)** | `PreToolUse` → `permissionDecision:deny` / exit 2 | `PreToolUse` (**≈same protocol**) | `BeforeTool` → `decision:deny` / exit 2 | plugin `tool.execute.before` (`throw`) | `allowed_tools` (+ preliminary hooks) | allow/deny lists (**coarse**) | doctrine (git-safe #5) |
|
|
62
64
|
| plugin / dist | `.claude-plugin` + marketplace | `.codex-plugin` + `/plugins` marketplace | Extension `gemini-extension.json` | JS/TS plugin (npm) | MCP + skills + config | Warp Drive | — |
|
|
@@ -69,6 +71,8 @@ Concrete mechanism per harness (**Jul-2026**, verified against official docs; `~
|
|
|
69
71
|
|
|
70
72
|
> **host-memory (tiers & consumers).** Two tiers: *cheap* (structured, bounded — on Claude Code the auto-memory `MEMORY.md` + `CLAUDE.md`) and *deep* (transcript / `--resume` search, expensive). Consumers: **`/status`** reads only the *cheap* tier, **opportunistically and additively** (a `CONTEXTO DEL HOST` section when available; it **never asks** — a read-only dashboard — and silently omits the section on degrade); **`/resume`** **composes `/status`** and escalates a host-only finding **to a proposal only when the workline level does not explain the pending work** (the spec's fixed order governs the proposals, not the summary), optionally using the *deep* tier or asking as fallback. It is *enhancement*, never a `must`.
|
|
71
73
|
|
|
74
|
+
> **web-research (consumer & consent).** Single consumer today: `spec-refine-loop` § *Ideation gate* (the SPEC flow's divergent gate). Consent is **bundled into accepting that gate's offer** — one accepted offer authorizes that round's searches; never free browsing outside a consented round. It is *enhancement*, never a `must`: on degrade the loop ideates **offline and declares it** (unlike host-memory's silent omit — the user consented expecting the web, so silence would mislead).
|
|
75
|
+
|
|
72
76
|
## Leverage installed skills
|
|
73
77
|
|
|
74
78
|
"Leverage whatever skills the harness has installed" resolves through the **same** `.workflow/skills.toml` binding: a role can point at a skill **installed on the host** (third-party, via skills.sh) instead of the built-in. Rule:
|
|
@@ -27,7 +27,7 @@ PLAN
|
|
|
27
27
|
`docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` / `## Q&A traceability` in the spec: if missing → **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), but the user may proceed.
|
|
28
28
|
|
|
29
29
|
## Writes
|
|
30
|
-
`docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists). 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).
|
|
30
|
+
`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).
|
|
31
31
|
|
|
32
32
|
> **slug**: short kebab-case derived from the spec's Requirement — only `[a-z0-9-]`, ≤ ~5 words / ≤ 40 chars. `aw next-number docs/plans` returns JSON (field `next` = `PPP`); the loop builds the full name. To locate plans, glob `docs/plans/PPP-plan-*.md`.
|
|
33
33
|
|
|
@@ -85,6 +85,7 @@ Replaces the spec gap taxonomy with a planning-oriented one:
|
|
|
85
85
|
| Components unidentified | FE/BE/DB impact unknown | **research** (maps the code) |
|
|
86
86
|
| AS-IS wiring unknown | current state unknown | **research** |
|
|
87
87
|
| Phase too large | complexity > S | human (re-split) |
|
|
88
|
+
| Plan splittable | independently deliverable tranches — different moments/priorities, no shared deps/risk | **human consents** → split (see *Split gate (multi-plan)*) |
|
|
88
89
|
| Task not atomic | complexity > XS | the AI re-splits |
|
|
89
90
|
| 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) |
|
|
90
91
|
| Missing deps | order unclear | research / human |
|
|
@@ -114,6 +115,17 @@ Chassis § *Proof of concept (probe)*, instantiated for planning. Two placements
|
|
|
114
115
|
- **Plan-shaping unknown** (the `Solution` itself depends on the answer) → run the probe **inline now**; the verdict (`CONCLUSIONS`) feeds `Solution` / `Risks / impact`.
|
|
115
116
|
- **Execution-time risk** (a task will build on a risky, runnable assumption) → encode an explicit **probe task**, placed **early** — before the tasks that depend on its verdict; the matching `Risks / impact` entry references it.
|
|
116
117
|
|
|
118
|
+
## Split gate (multi-plan)
|
|
119
|
+
|
|
120
|
+
Resolves the **Plan splittable** gap (Delta 2) — the canonical definition for **both** plan loops (`plan-refine-loop` references it, never redefines it). It fires **only on clear signals** (≥2 of: tranches independently executable/deliverable · no shared deps/risk between tranches · different requested moments/priorities · the plan far exceeds S-complexity phases · the user asked for staging); borderline → **one plan, no question**. It can be assessed during decomposition or at the coherence gate, always **before** `Guardar`.
|
|
121
|
+
|
|
122
|
+
- **The offer** enters the batch as a **content question** (counts in the ≤3): the body shows the proposed cut in the **user's language** — per sibling, a name + slug, a 1-line scope, the phase mapping and the order. Labels: `Dividir en varios planes` (recommended when the signals hold) | `Un solo plan`. Declining marks the gap **exhausted** (no re-offer this run); a free-form answer adjusts the cut. The accepted cut is seeded into `CHECKPOINT` — a resume does **not** re-ask.
|
|
123
|
+
- **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
|
+
- **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
|
+
- **Sibling contract**: each `## Origin` records the shared source spec + `split (part i/N)` + the **siblings by path** + the order; `## Dependencies` (the existing optional section) carries the inter-plan order — **acyclic and advisory** (`plan-exec` does not enforce it; it only orients what to attack first).
|
|
126
|
+
- **Coherence gate, re-framed**: every spec acceptance criterion traces to **exactly one** sibling — a **complete, disjoint partition**; each sibling's `Final behavior` covers its subset; the union covers the spec. Spec-less plans anchor the partition to their own `Final behavior` / `Validations`.
|
|
127
|
+
- **Closing action** on the split branch: `Guardar planes` (the single-plan branch keeps `Guardar plan`).
|
|
128
|
+
|
|
117
129
|
## Sequence
|
|
118
130
|
|
|
119
131
|
```
|
|
@@ -132,13 +144,18 @@ plan-new-loop(spec):
|
|
|
132
144
|
integrate + update CHECKPOINT # artifact-first cycle
|
|
133
145
|
coherence gate (read-only) = Success criteria green:
|
|
134
146
|
- every spec acceptance criterion traces to a phase/task
|
|
147
|
+
(split: each criterion → exactly one sibling — complete, disjoint partition)
|
|
135
148
|
- Final behavior covers the criteria
|
|
136
149
|
- phases XS–S · tasks XS · deps without cycles · Impacted consistent with Solution
|
|
137
150
|
- minimality (chassis § *Minimality*): the Solution is the lightest that meets Final behavior; no phase/task/abstraction the criteria don't require
|
|
138
151
|
- (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
|
|
139
152
|
whatever fails → comes back as a gap
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
if split accepted (§ Split gate (multi-plan)): work = the N sibling plans (same session; cut in CHECKPOINT)
|
|
154
|
+
structured_choice(content: [Guardar planes, Preguntar algo más], flow: [Compactar, Cerrar])
|
|
155
|
+
Guardar planes → per sibling: aw next-number docs/plans → write (confirmation if it exists)
|
|
156
|
+
else:
|
|
157
|
+
structured_choice(content: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
|
|
158
|
+
Guardar → write docs/plans/PPP-plan-<slug>.md (confirmation if it exists)
|
|
142
159
|
finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
|
|
143
160
|
```
|
|
144
161
|
|
|
@@ -146,6 +163,7 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
|
|
|
146
163
|
|
|
147
164
|
- **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.
|
|
148
165
|
- Passes → `Guardar plan` (writes with confirmation if it exists) → `finalize`.
|
|
166
|
+
- **Split branch**: `Guardar planes` writes the N siblings sequentially (mint before each write) → `finalize` — one session, one HISTORY row.
|
|
149
167
|
- `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
|
|
150
168
|
|
|
151
169
|
> **After generating:** the plan can go straight to `plan-exec`, or — if changes arise before executing (new requirements, scope adjustments) — pass through [`plan-refine-loop`](../plan-refine-loop/LOOP.md) (`/w:plan-refine`, auxiliary and **not mandatory**), which refines it in place.
|
|
@@ -32,7 +32,7 @@ PLAN
|
|
|
32
32
|
`docs/plans/PPP-plan-*.md` (glob — locates the plan by number; or the exact path from the command argument). **Always the plan itself**: this loop edits it in place; there is no separate "refined" file. Provenance is irrelevant — generated by `plan-new`, **hand-written, or adopted** from a host planner (`plan-new` mode 4 / `persist`); existence is the only requirement.
|
|
33
33
|
|
|
34
34
|
## Writes
|
|
35
|
-
Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions` + `## Q&A traceability`. Since it overwrites an existing doc, it asks the user's **confirmation**. It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the refine **touches UI**, it also produces/updates **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its own session** (see *Delta 4* — they are not `docs/`, no auto-export).
|
|
35
|
+
Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions` + `## Q&A traceability`. Since it overwrites an existing doc, it asks the user's **confirmation**. On an accepted split (§ *Split gate — refine semantics*) it also **creates** the extracted sibling plans (newly minted `docs/plans` files). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the refine **touches UI**, it also produces/updates **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its own session** (see *Delta 4* — they are not `docs/`, no auto-export).
|
|
36
36
|
|
|
37
37
|
## Inherits
|
|
38
38
|
|
|
@@ -66,7 +66,7 @@ Every doubt asked to the human + the chosen answer.
|
|
|
66
66
|
|
|
67
67
|
## Delta 2 — Gap taxonomy (of "plan")
|
|
68
68
|
|
|
69
|
-
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, phase too large, task not atomic, missing deps, spec criteria uncovered, unaddressed risks, UI without design SPEC. **Focus difference:** plan-new **builds** the plan from scratch; plan-refine **detects what changed** against the written plan (or against the spec, if the spec was re-refined) and closes **those** gaps — typically fewer and more localized. One extra re-refine gap:
|
|
69
|
+
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, phase too large, task not atomic, missing deps, spec criteria uncovered, unaddressed risks, plan splittable, UI without design SPEC. **Focus difference:** plan-new **builds** the plan from scratch; plan-refine **detects what changed** against the written plan (or against the spec, if the spec was re-refined) and closes **those** gaps — typically fewer and more localized. One extra re-refine gap:
|
|
70
70
|
|
|
71
71
|
| Gap | Signal | Resolved by |
|
|
72
72
|
|---|---|---|
|
|
@@ -84,6 +84,15 @@ Same as plan-new (maps code/impact: FE/BE/DB components, AS-IS wiring, deps), bu
|
|
|
84
84
|
|
|
85
85
|
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.
|
|
86
86
|
|
|
87
|
+
## Split gate — refine semantics
|
|
88
|
+
|
|
89
|
+
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:
|
|
90
|
+
|
|
91
|
+
- The original plan **keeps its number/path**: it is rewritten **reduced** to its remaining tranche (in place, with confirmation). The extracted tranches become newly minted sibling plans (`aw next-number docs/plans` immediately before each write); their `## Origin` records "split from `docs/plans/PPP-plan-<slug>.md`" + the source spec + the siblings by path.
|
|
92
|
+
- The gate also fires on **partially executed** plans. **Completed tasks (`- [x]`) never move to a sibling** — execution history stays anchored to the original path (plan-exec sessions' `## Origin` keep resolving); only pending work is extracted.
|
|
93
|
+
- The split is recorded in `## Refinement decisions` (what moved where + why); original + siblings together keep the **complete, disjoint partition** of the spec criteria (spec-less: the Delta 2 degradation applies).
|
|
94
|
+
- **Closing action** on the split branch: `Guardar planes` (edit the original reduced + write the extracted siblings); the normal branch keeps `Guardar plan refinado`.
|
|
95
|
+
|
|
87
96
|
## Compact / resume — PLAN-refine keys
|
|
88
97
|
|
|
89
98
|
Full mechanism (3 cases, `Compactar`, re-run with `--reopen`) in the chassis (§ *Compact / resume*). PLAN-refine keys: prior-work mark = `## Refinement decisions` + `## Q&A traceability` **in the plan**; re-refine on demand is **first-class** as many times as needed while the flow stays in PLAN.
|
|
@@ -110,8 +119,12 @@ plan-refine-loop(plan):
|
|
|
110
119
|
# spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior/Validations (see Delta 2)
|
|
111
120
|
- re-refine's own check: the plan is REALIGNED with what changed
|
|
112
121
|
whatever fails → comes back as a gap
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
if split accepted (plan-new-loop § Split gate (multi-plan)): work = original reduced + extracted siblings
|
|
123
|
+
structured_choice(content: [Guardar planes, Preguntar algo más], flow: [Compactar, Cerrar])
|
|
124
|
+
Guardar planes → edit original reduced (confirmation) + write extracted siblings + record in Refinement decisions
|
|
125
|
+
else:
|
|
126
|
+
structured_choice(content: [Guardar plan refinado, Preguntar algo más], flow: [Compactar, Cerrar])
|
|
127
|
+
Guardar → edit in place (with confirmation) + insert/update Refinement decisions + Q&A traceability
|
|
115
128
|
finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
|
|
116
129
|
```
|
|
117
130
|
|
|
@@ -119,4 +132,5 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
|
|
|
119
132
|
|
|
120
133
|
- **No material gaps** → **coherence gate** (the *Sequence* checklist; plan-new's gate + the re-refine's own realignment check).
|
|
121
134
|
- Passes → `Guardar plan refinado` (edits in place with confirmation) → `finalize`.
|
|
135
|
+
- **Split branch**: `Guardar planes` edits the original reduced and writes the extracted siblings → `finalize`.
|
|
122
136
|
- `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
|
|
@@ -3,7 +3,8 @@ name: spec-refine-loop
|
|
|
3
3
|
description: >-
|
|
4
4
|
Refines a draft spec (docs/specs/NNN-spec-<slug>.md) by editing it IN PLACE
|
|
5
5
|
until it is unambiguous. Heir of the chassis (loops/CHASSIS.md). Deltas:
|
|
6
|
-
spec gap taxonomy, analyze gate,
|
|
6
|
+
spec gap taxonomy, analyze gate, ideation gate (consented brainstorming,
|
|
7
|
+
optional web-research), ## UI spec section via the ui-design
|
|
7
8
|
capability, and adds Refinement decisions + Q&A traceability — the refined
|
|
8
9
|
mark plan-new detects. Started by /w:spec-refine (or the live escalation
|
|
9
10
|
from quick-loop); resumable via CHECKPOINT and re-runnable on demand.
|
|
@@ -81,7 +82,7 @@ Structured Markdown description (screens → regions/components). See [`ui-spec`
|
|
|
81
82
|
|
|
82
83
|
## Refinement decisions ← NEW (ADDED)
|
|
83
84
|
What was defined while refining and why. Includes what inline research
|
|
84
|
-
resolved (
|
|
85
|
+
resolved (ref. the session's CONCLUSIONS) and the ideation verdicts (§ Ideation gate).
|
|
85
86
|
|
|
86
87
|
## Q&A traceability ← NEW (ADDED)
|
|
87
88
|
Every doubt asked to the human + the chosen answer.
|
|
@@ -108,8 +109,18 @@ Every doubt asked to the human + the chosen answer.
|
|
|
108
109
|
| Hidden assumptions | the spec assumes unstated things | **research** validates / **human** confirms |
|
|
109
110
|
| Internal contradiction | sections contradict each other | **human** |
|
|
110
111
|
| Over-specified requirement | scope/criteria gold-plated — beyond the actual need (chassis § *Minimality*) | **human** (AI proposes the cut, human ratifies) |
|
|
112
|
+
| Unexplored solution space | the spec settles on the first conceivable approach — no alternatives weighed nor adopted from the conversation | **human consents** → **ideation** (see *Ideation gate*) |
|
|
111
113
|
| UI unspecified *(if it applies)* | the requirement involves UI but `## UI spec` is missing | **`ui-design` capability** |
|
|
112
114
|
|
|
115
|
+
## Ideation gate (creativity)
|
|
116
|
+
|
|
117
|
+
The loop's one **divergent** gate: every other resolver closes a gap; this one widens the option space before the spec hardens around its first idea. It resolves **Unexplored solution space** in two consented steps:
|
|
118
|
+
|
|
119
|
+
1. **Offer & consent.** The gap enters the batch as a content question — `Explorar ideas` vs `Seguir sin ideación` — carrying the AI's recommendation like any other. Declining marks the gap **exhausted** (never re-offered this run); an explicit user request for ideas at any point counts as an accepted offer (on-demand entry). Alternatives already weighed in the conversation are *adopted context* — the gap does not fire.
|
|
120
|
+
2. **Ideation round** (one per consent). Propose fresh ideas and **combinations** (the user's + found ones). If the host exposes **web-research** ([`../../harness/HARNESS.md`](../../harness/HARNESS.md)), the accepted offer also authorizes that round's web searches — no per-search consent; findings + sources land in the session's `CONCLUSIONS`, like inline research. Without the capability, ideate offline (own knowledge + workspace + repos) and **declare it** — never silently.
|
|
121
|
+
|
|
122
|
+
**Verdicts (back to convergence).** Present the top ≤3 ideas via the same structured-choice, each with a recommended verdict: `Adoptar` → integrate into `Requirement`/`Scope`/criteria + trace in `## Refinement decisions` (idea, rationale, source/URL when web-found) · `Descartar` → one line + reason there · `Aparcar` → `## Open questions`. Ideas beyond the top 3 stay summarized in `CONCLUSIONS`. Divergence is bounded by *Minimality* (chassis): nothing enters the spec without an explicit `Adoptar`; the analyze gate keeps pruning gold-plating. This gate exists **only** in this loop — `spec-new` stays single-pass (no research, no web) and the plan/quick loops inherit none of it.
|
|
123
|
+
|
|
113
124
|
## Sequence
|
|
114
125
|
|
|
115
126
|
```
|
|
@@ -128,6 +139,8 @@ spec-refine-loop(spec):
|
|
|
128
139
|
if gap = UI (requirement involves UI, ## UI spec missing):
|
|
129
140
|
compose ui-design → author ## UI spec # design-system/theme via structured-choice (counts in the batch)
|
|
130
141
|
work = integrate(work, ui) # → ## UI spec
|
|
142
|
+
else if gap = Unexplored solution space (creativity):
|
|
143
|
+
pending_human.push("ideation offer") # offer with AI recommendation: `Explorar ideas` | `Seguir sin ideación`
|
|
131
144
|
else if factual(gap) and attempts[gap] < MAX:
|
|
132
145
|
if it needs DB and >1 MCP without default → queue "MCP choice" in pending_human
|
|
133
146
|
res = research_inline(gap) # in the current session: ANALYSIS-FILE → CONCLUSIONS (+read-only SCRIPTS.sql)
|
|
@@ -142,6 +155,8 @@ spec-refine-loop(spec):
|
|
|
142
155
|
Compactar → write CHECKPOINT (refine_session) ; compact(harness) ; continue
|
|
143
156
|
Cerrar → goto finalize
|
|
144
157
|
work = integrate(work, ans) # → Q&A traceability / Open questions
|
|
158
|
+
ideation offer accepted → run the round NOW, then its verdicts as a NEW ≤3+flow batch (§ Ideation gate) → integrate
|
|
159
|
+
ideation offer declined → mark that gap exhausted # anti re-fire; on-demand entry stays open
|
|
145
160
|
# no material gaps → analyze gate = Success criteria green (read-only) before offering Guardar:
|
|
146
161
|
issues = analyze(work) # criteria trace to the Requirement · no contradictions · coherent Scope · Open questions closed/deferred · scenarios↔criteria · no gold-plating (minimality)
|
|
147
162
|
if issues: gaps += issues ; continue # findings come back into the loop as gaps
|
|
@@ -172,6 +187,7 @@ Full mechanism (3 cases, `Compactar`, re-run on demand with `--reopen`) in the c
|
|
|
172
187
|
## Integration (where each resolution lands)
|
|
173
188
|
|
|
174
189
|
- Resolved via **inline research** → the spec's `## Refinement decisions` (+ ref to the session's `CONCLUSIONS`).
|
|
190
|
+
- Resolved via **ideation** → per verdict (§ *Ideation gate*): `Adoptar` → the spec's sections + `## Refinement decisions` · `Descartar` → there · `Aparcar` → `## Open questions`.
|
|
175
191
|
- Resolved via **human** → the spec's `## Q&A traceability`.
|
|
176
192
|
- Resolved via the **`ui-design` capability** (UI gap) → the spec's `## UI spec` section.
|
|
177
193
|
- **Inconclusive or unresolved research** → the spec's `## Open questions` (deferred) + the refine session's `BACKLOG.md` (only if something is deferred).
|