@tacuchi/agent-workflow-cli 15.1.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/skills/w/README.md +14 -14
  3. package/skills/w/SKILL.md +96 -75
  4. package/skills/w/artifacts/README.md +6 -6
  5. package/skills/w/artifacts/artifacts-core/SESSION.md +1 -7
  6. package/skills/w/artifacts/artifacts-core/TASKS.md +1 -1
  7. package/skills/w/artifacts/artifacts-exec/TECHNICAL-NOTE.md +9 -54
  8. package/skills/w/artifacts/artifacts-research/CONCLUSIONS.md +1 -1
  9. package/skills/w/commands/README.md +22 -22
  10. package/skills/w/commands/export-diagrams.md +9 -9
  11. package/skills/w/commands/export-manuals.md +9 -9
  12. package/skills/w/commands/export-reports.md +9 -9
  13. package/skills/w/commands/export-scripts.md +9 -9
  14. package/skills/w/commands/fix-git.md +12 -12
  15. package/skills/w/commands/plan-exec.md +19 -19
  16. package/skills/w/commands/plan-new.md +18 -18
  17. package/skills/w/commands/plan-refine.md +22 -22
  18. package/skills/w/commands/quick.md +16 -16
  19. package/skills/w/commands/spec-new.md +35 -34
  20. package/skills/w/commands/spec-refine.md +16 -16
  21. package/skills/w/commands/status.md +18 -16
  22. package/skills/w/commands/workspace-init.md +14 -14
  23. package/skills/w/exports/README.md +5 -5
  24. package/skills/w/exports/export-diagrams/SKILL.md +58 -58
  25. package/skills/w/exports/export-manuals/SKILL.md +61 -61
  26. package/skills/w/exports/export-reports/SKILL.md +51 -51
  27. package/skills/w/exports/export-scripts/SKILL.md +60 -60
  28. package/skills/w/harness/SKILL.md +48 -47
  29. package/skills/w/loops/CHASSIS.md +104 -97
  30. package/skills/w/loops/CODE-POLICIES.md +21 -21
  31. package/skills/w/loops/README.md +30 -29
  32. package/skills/w/loops/plan-exec-loop/SKILL.md +77 -80
  33. package/skills/w/loops/plan-new-loop/SKILL.md +88 -58
  34. package/skills/w/loops/plan-refine-loop/SKILL.md +69 -45
  35. package/skills/w/loops/quick-loop/SKILL.md +79 -79
  36. package/skills/w/loops/spec-refine-loop/SKILL.md +93 -97
  37. package/skills/w/roles/README.md +2 -2
  38. package/skills/w/roles/diagrams/SKILL.md +50 -47
  39. package/skills/w/roles/git/SKILL.md +58 -58
  40. package/skills/w/roles/research/SKILL.md +65 -62
  41. package/skills/w/roles/sql/SKILL.md +59 -55
  42. package/skills/w/roles/ui-spec/SKILL.md +60 -74
@@ -1,34 +1,34 @@
1
- # CODE-POLICIES — políticas de loops que editan código
1
+ # CODE-POLICIES — policies for code-editing loops
2
2
 
3
- Aplican a **`plan-exec-loop`** (por fase del plan) y **`quick-loop`** (la única tarea; gate en versión **proporcional**): cada uno lo manda leer desde su `## Inherits`, **junto con el chasis** ([`CHASSIS.md`](CHASSIS.md)). Los loops de documento (spec-refine, plan-new, plan-refine) no editan código y **no cargan este doc**por eso vive aparte del chasis. Estas políticas materializan los invariantes **BD solo-scripts** y **git seguro** — que además quedan resumidos **inline** (1-2 líneas) en el `SKILL.md` de cada loop que edita código, porque los hosts advisory no siguen Reads; el texto normativo completo vive acá.
3
+ They apply to **`plan-exec-loop`** (per plan phase) and **`quick-loop`** (the single task; **proportional** gate): each orders this doc read from its `## Inherits`, **together with the chassis** ([`CHASSIS.md`](CHASSIS.md)). The document loops (spec-refine, plan-new, plan-refine) edit no code and do **not** load this doc — that is why it lives apart from the chassis. These policies materialize the **DB scripts-only** and **safe git** invariants which also stay summarized **inline** (1-2 lines) in each code-editing loop's `SKILL.md`, because advisory hosts do not follow Reads; the full normative text lives here.
4
4
 
5
- ## Git segurorama verificada + commits propuestos
5
+ ## Safe gitverified branch + proposed commits
6
6
 
7
- - **Antes de editar** archivos de una fuente: verifica rama actual = rama esperada de esa fuente (`aw check-branch --source <alias>`; ver rol `git`). Si no coincide → **pausa y resuelve con el humano**; nunca `stash`/`reset --hard`/`checkout -- .`/`clean` sin confirmación por fuente.
8
- - **Commits propuestos** (propose-then-execute, aprobar antes): **tras pasar el gate de revisión de cierre** (abajo), propone commits **por fuente** — en plan-exec al cerrar cada fase (o al `Cerrar`); en quick, **un solo commit** al final si hubo cambios de código. Nunca `push`/`--amend`/`--no-verify`. Nada llega a un commit propuesto sin revisar.
9
- - **Commit rechazado**: los cambios **quedan en el working tree** (no se revierten). Se permite reproponer / editar mensaje. Se registra en `CHECKPOINT` + `BACKLOG` que la fase/tarea quedó **sin commitear** (reanudable).
10
- - **Precondición entre fases** (plan-exec): `branch-check` valida *identidad* de rama, **no** *limpieza* del working tree. Antes de iniciar la siguiente fase, el working tree de cada fuente debe estar **limpio** (committeado) o explícitamente **reconocido** como "cambios sin commitear de la fase N" — para no co-mezclar dos fases en un mismo commit.
7
+ - **Before editing** a source's files: verify current branch = that source's expected branch (`aw check-branch --source <alias>`; see the `git` role). On mismatch → **pause and resolve with the human**; never `stash`/`reset --hard`/`checkout -- .`/`clean` without per-source confirmation.
8
+ - **Proposed commits** (propose-then-execute, approve before): **after the closing review gate passes** (below), propose commits **per source** — in plan-exec at each phase close (or on `Cerrar`); in quick, **a single commit** at the end if there were code changes. Never `push`/`--amend`/`--no-verify`. Nothing reaches a proposed commit without review.
9
+ - **Rejected commit**: the changes **stay in the working tree** (never reverted). Re-proposing / editing the message is allowed. Record in `CHECKPOINT` + `BACKLOG` that the phase/task remained **uncommitted** (resumable).
10
+ - **Between-phase precondition** (plan-exec): `branch-check` validates branch *identity*, **not** working-tree *cleanliness*. Before starting the next phase, each source's working tree must be **clean** (committed) or explicitly **acknowledged** as "uncommitted changes from phase N" — so two phases never co-mingle in one commit.
11
11
 
12
- ## BD solo-scriptsla IA nunca ejecuta DML/DDL
12
+ ## DB scripts-onlythe AI never executes DML/DDL
13
13
 
14
- Distinción por **ejecución**, no por archivo (ver el esquema [`SCRIPTS.sql`](../artifacts/artifacts-core/SCRIPTS.sql)):
14
+ Distinguished by **execution**, not by file (see the [`SCRIPTS.sql`](../artifacts/artifacts-core/SCRIPTS.sql) schema):
15
15
 
16
- - **Consultas read-only** (diagnóstico/validación) → `SCRIPTS.sql` (artefacto de la session); la IA **sí** las ejecuta read-only vía MCP (`sql-mutation-guard`).
17
- - **Migraciones DDL/DML** (cambios de esquema/datos) → la IA las **redacta en `SCRIPTS.sql`** (artefacto de la session) pero **NUNCA las ejecuta**.
16
+ - **Read-only queries** (diagnosis/validation) → `SCRIPTS.sql` (session artifact); the AI **does** execute them read-only via MCP (`sql-mutation-guard`).
17
+ - **DDL/DML migrations** (schema/data changes) → the AI **drafts them in `SCRIPTS.sql`** (session artifact) but **NEVER executes them**.
18
18
 
19
- > El SQL mutante **queda en la session**, no se mueve a `docs/`. Su promoción a `docs/scripts/` (forward + rollback) la hace un `export-*` **aparte**, no el loop.
19
+ > Mutating SQL **stays in the session**; it is never moved to `docs/`. Its promotion to `docs/scripts/` (forward + rollback) is done by a separate `export-*`, never by the loop.
20
20
 
21
- ## Gate de revisión de cierre (convenciones, pre-commit)
21
+ ## Closing review gate (conventions, pre-commit)
22
22
 
23
- Tras la validación (de la fase en plan-exec; de la tarea en quick, proporcional) y **antes de proponer sus commits** (también en un `Cerrar` anticipado, antes de proponer los commits pendientes), el diff pasa un **gate de revisión de cierre**:
23
+ After validation (of the phase in plan-exec; of the task in quick, proportional) and **before proposing its commits** (also on an early `Cerrar`, before proposing the pending commits), the diff passes a **closing review gate**:
24
24
 
25
- - **Re-lectura independiente** del diff (subagente o re-lectura limpia la *verificación independiente* del motor: no asume correcta la implementación; *only command output counts*).
26
- - **Aplica las convenciones ambientes instaladas** relevantes al stack tocado (estándares de código/stack, seguridad, revisión de diffs, familias propias del workspace) — el host las **auto-descubre por su `description`**. El workflow **no nombra ni bindea** skills concretas: **crea el momento; las skills instaladas lo llenan** (por eso la revisión **no es un rol** — ver [`../roles/README.md`](../roles/README.md)). Sin skills de convenciones instaladaschecklist genérico mínimo: SOLID/early-return, nombres claros, DRY, errores no silenciados, sin secrets/PII, SQL parametrizado, sin código muerto, + las `Validations` del plan (si las hay).
27
- - **Hallazgos**: se **corrigen** en el working tree y se **re-corre la validación** (el gate no reemplaza los tests: los re-verifica tras corregir), o se **difieren justificados** (→ `Open questions` del plan + `BACKLOG`; en quick, `BACKLOG`); lo no obvio → `DECISION`. Integridad del gate (ver [`CHASSIS.md`](CHASSIS.md) § *Verification-first*): nunca se debilita un check ni se baja una convención para pasar.
28
- - **Artifact-first + verification-first**: `CHECKPOINT.Next = "review <fase/tarea>"` antes de la pasada; `SESSION.Success criteria` incluye desde el inicio "el diff pasó el gate de revisión antes de sus commits".
25
+ - **Independent re-read** of the diff (subagent or clean re-readthe engine's *independent verification*: it does not assume the implementation is correct; *only command output counts*).
26
+ - **Apply the installed ambient conventions** relevant to the touched stack (code/stack standards, security, diff review, the workspace's own families) — the host **auto-discovers them by `description`**. The workflow **names and binds no** concrete skill: **it creates the moment; the installed skills fill it** (that is why review is **not a role** — see [`../roles/README.md`](../roles/README.md)). With no convention skills installedminimal generic checklist: SOLID/early-return, clear names, DRY, no silenced errors, no secrets/PII, parametrized SQL, no dead code, + the plan's `Validations` (if any).
27
+ - **Findings**: **fix** them in the working tree and **re-run validation** (the gate does not replace the tests: it re-verifies after fixing), or **defer them justified** (→ the plan's `Open questions` + `BACKLOG`; in quick, `BACKLOG`); the non-obvious → `DECISION`. Gate integrity (see [`CHASSIS.md`](CHASSIS.md) § *Verification-first*): never weaken a check or lower a convention to pass.
28
+ - **Artifact-first + verification-first**: `CHECKPOINT.Next = "review <phase/task>"` before the pass; `SESSION.Success criteria` includes from the start "the diff passed the review gate before its commits".
29
29
 
30
- Recién con el gate en verde se proponen los commits.
30
+ Only with the gate green are the commits proposed.
31
31
 
32
- ## Localización
32
+ ## Location
33
33
 
34
- Igual que el chasis: los loops que editan código lo referencian como `../CODE-POLICIES.md` (instalación normal, árbol `w/loops/`); en instalaciones **aplanadas** (p. ej. Warp/Oz) puede estar como `CODE-POLICIES.md` **junto al `SKILL.md` del loop**.
34
+ Same as the chassis: code-editing loops reference it as `../CODE-POLICIES.md` (normal install, `w/loops/` tree); in **flattened** installs it may sit as `CODE-POLICIES.md` **next to the loop's `SKILL.md`** (chassis § *Reference resolution*).
@@ -1,73 +1,74 @@
1
1
  # w/loops — Loop map (Layer 2)
2
2
 
3
- > Los **loops** son las piezas que la **IA corre enteras** para producir entregables y orquestar el trabajo. Los arranca un comando `/w:…` (Capa 1) y, a partir de ahí, **los conduce la IA**, no el usuario.
3
+ > **Loops** are the pieces the **AI runs whole** to produce deliverables and orchestrate the work. A `/w:…` command (Layer 1) starts them and, from there, **the AI drives them**, not the user.
4
4
  >
5
- > Hermanos: `../commands/` (Capa 1, comandos `/w:…`) · `.workflow/sessions/` (Capa 3, sessions + artefactos internos) · la familia `export-*` (única vía artefacto→`docs/`) · las **capacidades** componibles (roles bindeados en `.workflow/skills.toml`).
5
+ > Siblings: `../commands/` (Layer 1, `/w:…` commands) · `.workflow/sessions/` (Layer 3, sessions + internal artifacts) · the `export-*` family (the only artifact→`docs/` path) · the composable **capabilities** (roles bound in `.workflow/skills.toml`).
6
6
 
7
7
  ---
8
8
 
9
9
  ## What a loop is
10
10
 
11
- Un loop es una **skill** que le enseña a la IA *cómo iterar* hasta producir un entregable. **No es invocable por nombre** como skill suelta (no se registra como tal; en Claude Code, la invocación por nombre es el tool `Skill` — su binding, no un universal): es el cuerpo de su comando `/w:…`, que lo **carga leyendo `<loop>/SKILL.md`** y lo ejecuta inline.
11
+ A loop is a **skill** that teaches the AI *how to iterate* until it produces a deliverable. **It is not invocable by name** as a standalone skill (it is not registered as such; in Claude Code, by-name invocation is the `Skill` tool its binding, not a universal): it is the body of its `/w:…` command, which **loads it by reading `<loop>/SKILL.md`** and executes it inline.
12
12
 
13
- Los 5 loops corren el mismo **motor común**, cuyo canon vive en [`CHASSIS.md`](CHASSIS.md): objetivo persistente + verification-first, gap-driven convergente, session única por run con research inline, structured-choice + control `flow` (`Compactar`/`Cerrar`, siempre presente), compact/resume, artefactos como log vivo, convergence gate y el boundary de `docs/`. Cada loop es un **heir**: su `## Inherits` manda leer el chasis antes de sus deltas — nada del motor se repite acá.
13
+ The 5 loops run the same **common engine**, whose canon lives in [`CHASSIS.md`](CHASSIS.md): persistent objective + verification-first, gap-driven convergent, single session per run with inline research, structured-choice + `flow` control (`Compactar`/`Cerrar`, always present), compact/resume, artifacts as a live log, convergence gate and the `docs/` boundary. Each loop is an **heir**: its `## Inherits` orders the chassis read before its deltas — nothing of the engine is repeated here.
14
14
 
15
15
  ## Loops and their flow
16
16
 
17
17
  | Loop (`name:`) | Flow | Started by | Reads | Writes |
18
18
  |---|---|---|---|---|
19
- | [`spec-refine-loop`](spec-refine-loop/SKILL.md) | SPEC | `/w:spec-refine` | `docs/specs/NNN-spec*.md` (el spec mismo) | `docs/specs/NNN-spec-<slug>.md` (in place) |
19
+ | [`spec-refine-loop`](spec-refine-loop/SKILL.md) | SPEC | `/w:spec-refine` | `docs/specs/NNN-spec*.md` (the spec itself) | `docs/specs/NNN-spec-<slug>.md` (in place) |
20
20
  | [`plan-new-loop`](plan-new-loop/SKILL.md) | PLAN | `/w:plan-new` | `docs/specs/NNN-spec-*.md` | `docs/plans/PPP-plan-<slug>.md` |
21
- | [`plan-refine-loop`](plan-refine-loop/SKILL.md) | PLAN | `/w:plan-refine` *(aux, opcional)* | `docs/plans/PPP-plan-*.md` (el plan mismo) | `docs/plans/PPP-plan-<slug>.md` (in place) |
22
- | [`plan-exec-loop`](plan-exec-loop/SKILL.md) | PLAN | `/w:plan-exec` | `docs/plans/PPP-plan-*.md` | `docs/plans/PPP-plan-<slug>.md` (update); resto vía `export-*` |
23
- | [`quick-loop`](quick-loop/SKILL.md) | QUICK | `/w:quick` | — (prompt) | edita código + session ligera; **no** `docs/` |
21
+ | [`plan-refine-loop`](plan-refine-loop/SKILL.md) | PLAN | `/w:plan-refine` *(aux, optional)* | `docs/plans/PPP-plan-*.md` (the plan itself) | `docs/plans/PPP-plan-<slug>.md` (in place) |
22
+ | [`plan-exec-loop`](plan-exec-loop/SKILL.md) | PLAN | `/w:plan-exec` | `docs/plans/PPP-plan-*.md` | `docs/plans/PPP-plan-<slug>.md` (update); the rest via `export-*` |
23
+ | [`quick-loop`](quick-loop/SKILL.md) | QUICK | `/w:quick` | — (prompt) | edits code + light session; **no** `docs/` |
24
24
 
25
- > `/w:spec-new` no tiene loop (es single-pass). Por eso hay **6 comandos / 5 loops**.
25
+ > `/w:spec-new` has no loop (single-pass). Hence **6 commands / 5 loops**.
26
26
 
27
- ### `docs/` boundary (regla dura)
27
+ ### `docs/` boundary (hard rule)
28
28
 
29
- Cada loop escribe **solo** el doc de su propio flujo (SPEC→`docs/specs` · PLAN→`docs/plans` · QUICK→ninguno) y **nunca** gradúa otros artefactos a `docs/` — esa promoción la hacen las skills `export-*`, aparte y explícitas. Canon: [`CHASSIS.md`](CHASSIS.md) § *docs/ boundary*.
29
+ Every loop writes **only** its own flow's doc (SPEC→`docs/specs` · PLAN→`docs/plans` · QUICK→none) and **never** graduates other artifacts to `docs/` — that promotion belongs to the separate, explicit `export-*` skills. Canon: [`CHASSIS.md`](CHASSIS.md) § *docs/ boundary*.
30
30
 
31
31
  ## Schema of each loop file
32
32
 
33
33
  | Field | Description |
34
34
  |---|---|
35
- | `## Flow` | A qué flujo pertenece (SPEC · PLAN · QUICK) |
36
- | `## Layer` | Siempre 2 (la IA lo corre entero) |
37
- | `## Started by` | Comando `/w:…` que lo arranca (reanudable) |
38
- | `## Reads` | Documento(s) de entrada |
39
- | `## Writes` | Documento(s) de salida (`generate` / `read-update`) |
40
- | `## Internal sessions` | Sessions que crea y sus artefactos |
41
- | `## Sequence` | Pseudocódigo del loop |
42
- | `## Convergence / exit` | Cuándo para |
35
+ | `## Flow` | Which flow it belongs to (SPEC · PLAN · QUICK) |
36
+ | `## Layer` | Always 2 (the AI runs it whole) |
37
+ | `## Started by` | The `/w:…` command that starts it (resumable) |
38
+ | `## Reads` | Input document(s) |
39
+ | `## Writes` | Output document(s) (`generate` / `read-update`) |
40
+ | `## Internal sessions` | Sessions it creates and their artifacts |
41
+ | `## Sequence` | The loop's pseudocode |
42
+ | `## Convergence / exit` | When it stops |
43
43
 
44
- Los **5 loops** son heirs: usan `## Inherits` (referencia de 1 línea a [`CHASSIS.md`](CHASSIS.md), que se lee **siempre antes** de los deltas) + sus secciones propias. Las secciones del motor viven en el chasis, no en ningún loop.
44
+ The **5 loops** are heirs: they use `## Inherits` (a one-line reference to [`CHASSIS.md`](CHASSIS.md), read **always before** the deltas) + their own sections. The engine's sections live in the chassis, in no loop.
45
45
 
46
46
  ## Chassis / heirs
47
47
 
48
- El **motor vive en [`CHASSIS.md`](CHASSIS.md)** (doc referenciado, no una skill); los 5 loops —incluido `spec-refine-loop`— son **heirs** de ese motor. La lista canónica de heirs y sus deltas está en el propio chasis (§ *Heirs*). El chasis **no es una capacidad bindeable**: es el motor de los loops; lo enchufable son las **capacidades** que un loop compone (ej. `ui-design`, `sql`, `git`), resueltas por `.workflow/skills.toml`.
48
+ The **engine lives in [`CHASSIS.md`](CHASSIS.md)** (a referenced doc, not a skill); the 5 loops — including `spec-refine-loop` are **heirs** of that engine. The canonical heirs list and their deltas live in the chassis itself (§ *Heirs*). The chassis is **not a bindable capability**: it is the loop engine; what is pluggable are the **capabilities** a loop composes (e.g. `ui-design`, `sql`, `git`), resolved via `.workflow/skills.toml`.
49
49
 
50
50
  ## Composed capabilities (roles)
51
51
 
52
- Los loops componen **capacidades por su rol**, no skills concretas; la skill que cumple el rol la resuelve `.workflow/skills.toml` (`built-in default → ~/.workflow/skills.toml → .workflow/skills.toml`).
52
+ Loops compose **capabilities by role**, never concrete skills; the skill fulfilling the role is resolved by `.workflow/skills.toml` (`built-in default → ~/.workflow/skills.toml → .workflow/skills.toml`).
53
53
 
54
54
  | Role | Default built-in | Composed by |
55
55
  |---|---|---|
56
- | `ui-design` | `ui-spec` | `spec-refine-loop` (cuando hay UI) · `plan-new-loop` / `plan-refine-loop` (design SPECs `NNN-SPEC-<SLUG>.md`) |
56
+ | `ui-design` | `ui-spec` | `spec-refine-loop` (when there is UI) · `plan-new-loop` / `plan-refine-loop` (design SPECs `NNN-SPEC-<SLUG>.md`) |
57
57
  | `sql` | `sql` | research · `plan-exec-loop` · `quick-loop` |
58
58
  | `git` | `git` | `plan-exec-loop` · `quick-loop` |
59
- | `research` | `research` | todos los loops (research inline) |
60
- | `overview` | `workflow` | cualquiera (orientación) |
59
+ | `research` | `research` | every loop (inline research) |
60
+ | `overview` | `workflow` | anyone (orientation) |
61
61
 
62
- > **Convenciones ambientes (no roles):** estándares de código/testing/redacción y `creating-tools` son skills standalone que el host auto-descubre por su `description` — el workflow no las bindea ni depende de ellas. Doctrina completa: [../roles/README.md](../roles/README.md).
62
+ > **Ambient conventions (not roles):** code/testing/writing standards and `creating-tools` are standalone skills the host auto-discovers by `description` — the workflow neither binds nor depends on them. Full doctrine: [../roles/README.md](../roles/README.md).
63
63
 
64
- `off` en config → capacidad desactivada: el loop sigue sin ella; si era necesaria, lo dice o pregunta al humano.
64
+ `off` in config → capability disabled: the loop continues without it; if it was needed, it says so or asks the human.
65
65
 
66
66
  ## Index
67
67
 
68
- - [`CHASSIS.md`](CHASSIS.md) — el motor común de los 5 loops (doc referenciado; no es una skill)
68
+ - [`CHASSIS.md`](CHASSIS.md) — the common engine of the 5 loops (referenced doc; not a skill)
69
+ - [`CODE-POLICIES.md`](CODE-POLICIES.md) — the code-editing loop policies (loaded only by plan-exec and quick)
69
70
  - [`spec-refine-loop/SKILL.md`](spec-refine-loop/SKILL.md)
70
71
  - [`plan-new-loop/SKILL.md`](plan-new-loop/SKILL.md)
71
- - [`plan-refine-loop/SKILL.md`](plan-refine-loop/SKILL.md) — aux, opcional (refina el plan in place)
72
+ - [`plan-refine-loop/SKILL.md`](plan-refine-loop/SKILL.md) — aux, optional (refines the plan in place)
72
73
  - [`plan-exec-loop/SKILL.md`](plan-exec-loop/SKILL.md)
73
74
  - [`quick-loop/SKILL.md`](quick-loop/SKILL.md)
@@ -1,137 +1,134 @@
1
1
  ---
2
2
  name: plan-exec-loop
3
3
  description: >-
4
- Ejecuta un plan de implementación (docs/plans/PPP-plan-<slug>.md) como
5
- living doc: lo lee y actualiza fase a fase mientras edita el código real,
6
- gestiona BD y git. Heir del chasis común de los loops (loops/CHASSIS.md
7
- motor gap-driven, research inline, structured-choice, artefactos como log
8
- vivo, y las políticas de loops que editan código); sus deltas viven en el
9
- cuerpo: session única reanudable, git seguro (rama verificada,
10
- commits propuestos por fuente, nunca push/--amend/--no-verify), BD solo-
11
- scripts (la IA nunca ejecuta DML/DDL), validación por fase y final, gate de
12
- revisión de cierre pre-commit, y sin auto-export (solo escribe docs/plans).
13
- Compone git y sql. Lo arranca /w:plan-exec. Invocar para implementar un plan
14
- ya generado.
4
+ Executes an implementation plan (docs/plans/PPP-plan-<slug>.md) as a living
5
+ doc: reads and updates it phase by phase while editing the real code and
6
+ managing DB and git. Heir of the chassis (loops/CHASSIS.md +
7
+ CODE-POLICIES.md). Deltas: single resumable session, safe git (verified
8
+ branch, per-source proposed commits, never push/--amend/--no-verify), DB
9
+ scripts-only (never executes DML/DDL), per-phase and final validation,
10
+ pre-commit closing review gate, no auto-export. Composes git and sql.
11
+ Started by /w:plan-exec. Invoke to implement an already generated plan.
15
12
  ---
16
13
 
17
14
  # plan-exec-loop
18
15
 
19
- > **Heir** del chasis comúnaquí los **deltas de ejecución**: el trabajo real (código, BD, git). El motor vive en el chasis y las *Políticas de loops que editan código* en `CODE-POLICIES.md` — no se repiten.
16
+ > **Heir** of the common chassis the **execution deltas** live here: the real work (code, DB, git). The engine lives in the chassis and the *code-editing loop policies* in `CODE-POLICIES.md` — never repeated.
20
17
 
21
18
  ## Flow
22
19
  PLAN
23
20
 
24
21
  ## Layer
25
- 2 — la IA lo corre entero.
22
+ 2 — the AI runs it end to end.
26
23
 
27
24
  ## Started by
28
- `/w:plan-exec` — **reanudable** (mismo mecanismo del chasis; aquí el resume keya off el checkbox del plan-doc + CHECKPOINT, ver Delta 1).
25
+ `/w:plan-exec` — **resumable** (same chassis mechanism; here resume keys off the plan-doc checkboxes + CHECKPOINT, see Delta 1).
29
26
 
30
27
  ## Reads
31
- `docs/plans/PPP-plan-<slug>.md` (localizar vía glob `docs/plans/PPP-plan-*.md` o la ruta exacta del argumento del comando). Corre **cualquier** plan, haya pasado o no por [`plan-refine-loop`](../plan-refine-loop/SKILL.md) — plan-refine es auxiliar y no obligatorio; no hay gate que lo exija. Si el plan incluye UI, también los **design SPECs** (`NNN-SPEC-<SLUG>.md`) que sus Tasks referencianartefactos de la sesión de plan-new/plan-refine, leídos **read-only** como referencia de diseño al implementar (ver [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)).
28
+ `docs/plans/PPP-plan-<slug>.md` (locate via the `docs/plans/PPP-plan-*.md` glob or the exact path from the command argument). It runs **any** plan, whether or not it passed through [`plan-refine-loop`](../plan-refine-loop/SKILL.md) — plan-refine is auxiliary, not mandatory; no gate requires it. If the plan includes UI, it also reads the **design SPECs** (`NNN-SPEC-<SLUG>.md`) its Tasks referenceartifacts of the plan-new/plan-refine session, read **read-only** as the design reference while implementing (see [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)).
32
29
 
33
30
  ## Writes
34
- - `docs/plans/PPP-plan-<slug>.md` (**read/update**, living doc: estado de fases/tareas, `Open questions`).
35
- - Artefactos de la plan-exec session en `.workflow/sessions/` (`SCRIPTS.sql`, `DECISION`, `ANALYSIS-FILE`/`CONCLUSIONS`, …).
36
- - **NO** escribe en otras carpetas `docs/` ni **gradúa/exporta** otros artefactos automáticamente (ver *Boundary*).
31
+ - `docs/plans/PPP-plan-<slug>.md` (**read/update**, living doc: phase/task state, `Open questions`).
32
+ - Artifacts of the plan-exec session under `.workflow/sessions/` (`SCRIPTS.sql`, `DECISION`, `ANALYSIS-FILE`/`CONCLUSIONS`, …).
33
+ - It does **NOT** write other `docs/` folders nor **graduate/export** artifacts automatically (see *Boundary*).
37
34
 
38
- ## Boundary — sin auto-export (hard rule)
35
+ ## Boundary — no auto-export (hard rule)
39
36
 
40
- Regla completa en el chasis (§ *docs/ boundary — sin auto-export*). Acá: la única carpeta `docs/` que este loop escribe es **`docs/plans`** (el plan, living); todo lo demás queda en la session hasta un `export-*` explícito y posterior.
37
+ Full rule in the chassis (§ *docs/ boundary — no auto-export*). Here: the only `docs/` folder this loop writes is **`docs/plans`** (the plan, living); everything else stays in the session until an explicit, later `export-*`.
41
38
 
42
39
  ## Inherits
43
40
 
44
- Leé **[`../CHASSIS.md`](../CHASSIS.md)** (instalación normal) **o** `CHASSIS.md` junto a este archivo (instalación aplanada) el motor completo del loop (objetivo persistente + verification-first, gap-driven, session única + research inline, structured-choice + control `flow`, compact/resume, artefactos como log vivo, numeración, convergence gate, docs/ boundary) — **y** **[`../CODE-POLICIES.md`](../CODE-POLICIES.md)** (o `CODE-POLICIES.md` junto a este archivo) las *Políticas de loops que editan código* (git seguro · BD solo-scripts · gate de revisión de cierre)**siempre antes** de estos deltas.
41
+ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **and** **[`../CODE-POLICIES.md`](../CODE-POLICIES.md)** the *code-editing loop policies***always before** these deltas. *(If `../` does not resolve: same names next to this fileglobal layout rule, chassis § Reference resolution.)*
45
42
 
46
43
  ## Composes
47
44
 
48
- `git` (rama segura + commits propuestos) · `sql` (regla BD). Ambas resueltas por `.workflow/skills.toml`; `off` → el loop sigue sin la capacidad y, si era necesaria, lo dice o pregunta.
45
+ `git` (safe branch + proposed commits) · `sql` (DB rule). Both resolved via `.workflow/skills.toml`; `off` → the loop continues without the capability and, if it was needed, says so or asks.
49
46
 
50
- > **Convenciones ambientes (no roles):** estándares de código/testing/redacción y `creating-tools` son skills standalone que el host auto-descubre por su `description` — el workflow no las bindea ni depende de ellas. Doctrina completa: [../../roles/README.md](../../roles/README.md).
47
+ > **Ambient conventions (not roles):** code/testing/writing standards and `creating-tools` are standalone skills the host auto-discovers by `description` — the workflow neither binds nor depends on them. Full doctrine: [../../roles/README.md](../../roles/README.md).
51
48
 
52
49
  ## Internal sessions (managed)
53
50
 
54
- - **plan-exec session** descriptor `<slug>-plan-exec` → `NNN-<slug>-plan-exec` (el `<slug>` sale del plan-doc de entrada `docs/plans/PPP-plan-<slug>.md`): **una sola session por run** (Type = `exec`). Dueña del run; posee `SESSION` + `CHECKPOINT` + `DECISION` + `SCRIPTS.sql` (+ `BACKLOG` solo si difiere). La investigación es **inline** dentro de esta session: produce `ANALYSIS-FILE`/`CONCLUSIONS` (+ `SCRIPTS.sql` read-only si consulta BD) en su propia carpeta.
51
+ - **plan-exec session** descriptor `<slug>-plan-exec` → `NNN-<slug>-plan-exec` (the `<slug>` comes from the input plan-doc `docs/plans/PPP-plan-<slug>.md`): **a single session per run** (Type = `exec`). Owns the run; holds `SESSION` + `CHECKPOINT` + `DECISION` + `SCRIPTS.sql` (+ `BACKLOG` only if something is deferred). Research is **inline** inside this session: it produces `ANALYSIS-FILE`/`CONCLUSIONS` (+ read-only `SCRIPTS.sql` if it queries DB) in its own folder.
55
52
 
56
- > **Numeración**: el caller pasa solo el descriptor; el CLI antepone el `NNN` global y secuencial sobre `.workflow/sessions/` (ver chasis). No reinicia por tipo.
53
+ > **Numbering**: the caller passes only the descriptor; the CLI prepends the global sequential `NNN` over `.workflow/sessions/` (see chassis). It never restarts per type.
57
54
 
58
- > **Compat (legacy):** workspaces viejos pueden tener sessions `plan-exec-phase-*` (una por fase) y `*-research-*` — son históricas y se dejan tal cual; los runs nuevos usan una sola session.
55
+ > **Compat (legacy):** old workspaces may hold `plan-exec-phase-*` sessions (one per phase) and `*-research-*` ones historical, left as-is; new runs use a single session.
59
56
 
60
57
  ## Delta 1 — One session per run; per-phase progress in the plan-doc
61
58
 
62
- - Recorre las `Phases` del plan en orden (respeta deps) **dentro de la única session del run** (no hay session-por-fase).
63
- - El **avance por fase vive en el plan-doc** (`- [x]`) y en el `CHECKPOINT` único (Completed/Pending/Next): **artifact-first** — `CHECKPOINT.Next` se fija a la fase inminente **antes** de iniciarla; el checkbox `- [x]` del plan-doc se voltea **después** de completar la tarea.
64
- - Ejecuta las `Tasks` de la fase; **salta** las ya marcadas `- [x]` en el plan (el plan-doc es la fuente de verdad por tarea). Marca `- [x]` + estado **en el plan** (living doc; no en un `TASKS` aparte).
65
- - En **cada límite de fase**: valida, corre el **gate de revisión de cierre** (Delta 5), actualiza el `CHECKPOINT` (Completed += Phase N, Next = Phase N+1) y propone commits.
66
- - Registra `DECISION` solo lo **no obvio**, **a medida que se toma** (los `DECISION` por fase se acumulan en el ÚNICO `DECISION`, etiquetados por fase/tareaej. `Origin: T2 (F1)`).
67
- - El motor **gap-driven** del chasis aplica acá **dentro de una tarea**: ante una decisión/duda no obvia research inline ó structured-choice.
59
+ - Walks the plan's `Phases` in order (respecting deps) **inside the run's single session** (no session-per-phase).
60
+ - **Per-phase progress lives in the plan-doc** (`- [x]`) and in the single `CHECKPOINT` (Completed/Pending/Next): **artifact-first** — `CHECKPOINT.Next` is set to the imminent phase **before** starting it; the plan-doc's `- [x]` checkbox is flipped **after** completing the task.
61
+ - Executes the phase's `Tasks`; **skips** the ones already `- [x]` in the plan (the plan-doc is the per-task source of truth). Marks `- [x]` + state **in the plan** (living doc; never in a separate `TASKS`).
62
+ - 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
+ - Records in `DECISION` only the **non-obvious**, **as it is decided** (per-phase decisions accumulate in the SINGLE `DECISION`, tagged by phase/taske.g. `Origin: T2 (F1)`).
64
+ - The chassis **gap-driven** engine applies here **inside a task**: facing a non-obvious decision/doubt inline research OR structured-choice.
68
65
 
69
- ## Delta 2 — Git policy: **rama segura + commits propuestos**
66
+ ## Delta 2 — Git policy: **safe branch + proposed commits**
70
67
 
71
- Política completa en [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *Git seguro*: branch-check antes de editar, commit rechazado los cambios quedan + se registra —, precondición de working tree entre fases). **Inline:** antes de editar, verificar rama esperada por fuente (`aw check-branch --source <alias>`; si no coincide pausar y resolver con el humano); al cerrar cada fase y **tras el gate de revisión** (Delta 5), **commits propuestos por fuente** (aprobar antes) — nunca `push`/`--amend`/`--no-verify`.
68
+ Full policy in [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *Safe git*: branch-check before editing, rejected commit — changes stay + get recorded —, working-tree precondition between phases). **Inline:** before editing, verify each source's expected branch (`aw check-branch --source <alias>`; on mismatchpause and resolve with the human); at each phase close and **after the review gate** (Delta 5), **proposed commits per source** (approve first) — never `push`/`--amend`/`--no-verify`.
72
69
 
73
- ## Delta 3 — DB policy: **la IA nunca ejecuta DML**
70
+ ## Delta 3 — DB policy: **the AI never executes DML**
74
71
 
75
- Política completa en [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *BD solo-scripts*). **Inline:** consultas read-only → `SCRIPTS.sql` de la session y se ejecutan vía MCP (`sql-mutation-guard`); migraciones DDL/DML → la IA las **redacta en `SCRIPTS.sql` pero NUNCA las ejecuta** — su promoción a `docs/scripts/` la hace un `export-*` aparte, no este loop.
72
+ Full policy in [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *DB scripts-only*). **Inline:** read-only queries the session's `SCRIPTS.sql`, executed via MCP (`sql-mutation-guard`); DDL/DML migrations the AI **drafts them in `SCRIPTS.sql` but NEVER executes them** — their promotion to `docs/scripts/` is done by a separate `export-*`, never this loop.
76
73
 
77
74
  ## Delta 4 — Validation
78
75
 
79
- - Tras ejecutar (por fase y al final): corre tests/checks contra `Validations` + `Final behavior` + acceptance/success criteria del spec.
80
- - Validación que **corre y falla** → vuelve a la tarea (gap); no avanza.
81
- - **Validación dependiente de una migración no aplicada**: como la IA no ejecuta el DML, **no puede correr read-only** → se **difiere** (handoff a DBA), **no bloquea el avance**. Se registra en `Open questions` del plan + `BACKLOG`, marcando "verificación pendiente tras aplicar SQL". (Reusa el patrón degradar/diferir + límite `MAX` del chasis evita el bucle "vuelve a la tarea".)
76
+ - After executing (per phase and at the end): run tests/checks against `Validations` + `Final behavior` + the spec's acceptance/success criteria.
77
+ - A validation that **runs and fails** → back to the task (gap); no advancing.
78
+ - **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` capavoids the "back to the task" loop.)
82
79
 
83
- > La **validación final** es el **convergence gate** de PLAN-exec = **`Success criteria` en verde** (*verification-first*; análogo al *analyze gate* de SPEC y al *coherence gate* de `plan-new`): el plan no se marca *done* hasta que pasa o queda explícitamente diferida (handoff de SQL). Para código son **tests ejecutables** (TDD); para migraciones BD no ejecutables, **rúbrica** (SCRIPTS.sql válido + revisado).
80
+ > The **final validation** is PLAN-exec's **convergence gate** = **`Success criteria` green** (*verification-first*; analogous to SPEC's *analyze gate* and plan-new's *coherence gate*): the plan is not marked *done* until it passes or is explicitly deferred (SQL handoff). For code these are **runnable tests** (TDD); for non-executable DB migrations, a **rubric** (SCRIPTS.sql valid + reviewed).
84
81
 
85
- ## Delta 5 — Gate de revisión de cierre (convenciones, pre-commit)
82
+ ## Delta 5 — Closing review gate (conventions, pre-commit)
86
83
 
87
- Gate completo en [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *Gate de revisión de cierre*): re-lectura **independiente** del diff + convenciones ambientes instaladas; hallazgoscorregir (re-validando la fase) o diferir justificado. Acá solo el cableado exec: corre **entre la validación de la fase (Delta 4) y sus commits (Delta 2)**; recién con el gate en verde se proponen los commits de la fase.
84
+ Full gate in [`../CODE-POLICIES.md`](../CODE-POLICIES.md) (§ *Closing review gate*): **independent** diff re-read + installed ambient conventions; findingsfix (re-validating the phase) or defer justified. Here only the exec wiring: it runs **between the phase validation (Delta 4) and its commits (Delta 2)**; only with the gate green are the phase's commits proposed.
88
85
 
89
- ## Delta 6 — Completitud / cierre
86
+ ## Delta 6 — Completion / close
90
87
 
91
- - Una fase cierra **done** cuando sus tareas están `- [x]` y su validación pasó **o** quedó diferida (handoff de SQL). Estado posible: **"done — SQL pendiente de aplicar"**.
92
- - Todas las fases done → *structured-choice* final (contenido: `Marcar plan done` / `Preguntar algo más`; flow: `Compactar`/`Cerrar`).
93
- - **Sin export automático**: los artefactos (`SCRIPTS.sql`, `DECISION`, …) quedan en la session. Promoverlos a `docs/` (scripts, manuals, …) es un paso aparte vía `export-*`.
88
+ - 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
+ - All phases done → final *structured-choice* (content: `Marcar plan done` / `Preguntar algo más`; flow: `Compactar`/`Cerrar`).
90
+ - **No automatic export**: the artifacts (`SCRIPTS.sql`, `DECISION`, …) stay in the session. Promoting them to `docs/` (scripts, manuals, …) is a separate step via `export-*`.
94
91
 
95
92
  ## Sequence
96
93
 
97
94
  ```
98
95
  plan-exec-loop(PPP-plan-<slug>.md):
99
- session = create_or_resume("<slug>-plan-exec") # <slug> del plan-doc; UNA sola session por run; CLI antepone NNN global; CHECKPOINT, resume
96
+ session = create_or_resume("<slug>-plan-exec") # <slug> from the plan-doc; ONE session per run; CLI prepends global NNN; CHECKPOINT, resume
100
97
  plan = read(PPP-plan-<slug>.md)
101
- para cada Phase en plan (en orden, respeta deps):
102
- si Phase done (todas sus Tasks - [x] en el plan): skip # resume vía checkbox del plan-doc
103
- seed CHECKPOINT.Next = Phase N (Pending = sus Tasks) # ANTES de iniciar la fase: sembrar intención (artifact-first)
104
- para cada Task de la Phase:
105
- si Task - [x] en el plan: skip # resume intra-fase por checkbox
106
- verificar rama esperada por fuente (branch-check)
107
- si no coincide pausar + resolver con humano
108
- ejecutar Task:
109
- editar código en las fuentes (cambio mínimo)
110
- si crea herramienta/utilidadla skill ambiente creating-tools la documenta en docs/tools
111
- si consulta BD read-only → SCRIPTS.sql + ejecutar read-only
112
- si cambio BD (DDL/DML) → redactar en SCRIPTS.sql (artefacto session, NO ejecutar)
113
- si decisión no obvia → DECISION (etiquetado por fase/tarea, en el ÚNICO DECISION)
114
- si duda/gap → research inline ó structured-choice # chasis
115
- marcar Task - [x] + estado EN EL PLAN # DESPUÉS de completar la Task (el plan-doc es la fuente de verdad por tarea)
116
- validación de la fase:
117
- la que corre y falla volver a la tarea
118
- la dependiente de migración no aplicadadiferir (Open questions + BACKLOG)
119
- gate de revisión de cierre (pre-commit): # Delta 5: CHECKPOINT.Next = "review fase N"
120
- re-lectura INDEPENDIENTE del diff de la fase + convenciones ambientes instaladas
121
- hallazgoscorregir (y re-validar la fase) ó diferir justificado (Open questions + BACKLOG)
122
- update CHECKPOINT (Completed += Phase N, Next = Phase N+1) # DESPUÉS: Pending→Completed + Next = fase siguiente (ver ciclo artifact-first)
123
- proponer commit(s) por fuente (aprobar antes) # nunca push/amend/--no-verify; solo tras el gate en verde
124
- si rechazadocambios quedan; registrar "fase sin commitear"
125
- precondición siguiente fase: working tree limpio o reconocido
126
- validación final (lo que se pueda; lo dependiente de SQL queda como handoff)
127
- structured_choice(contenido: [Marcar plan done, Preguntar algo más], flow: [Compactar, Cerrar])
128
- marcar plan done (o "done — SQL pendiente de aplicar")
129
- # NO export: los artefactos quedan en la session; un export-* los promueve aparte
130
- finalize: CHECKPOINT (+ BACKLOG si difiere) + cerrar session + reportar
98
+ for each Phase in plan (in order, respecting deps):
99
+ if Phase done (all its Tasks - [x] in the plan): skip # resume via plan-doc checkboxes
100
+ seed CHECKPOINT.Next = Phase N (Pending = its Tasks) # BEFORE starting the phase: seed the intent (artifact-first)
101
+ for each Task of the Phase:
102
+ if Task - [x] in the plan: skip # intra-phase resume by checkbox
103
+ verify each source's expected branch (branch-check)
104
+ on mismatchpause + resolve with the human
105
+ execute Task:
106
+ edit code in the sources (minimal change)
107
+ if it creates a tool/utilitythe ambient creating-tools skill documents it in docs/tools
108
+ if read-only DB query → SCRIPTS.sql + execute read-only
109
+ if DB change (DDL/DML) → draft in SCRIPTS.sql (session artifact, DO NOT execute)
110
+ if non-obvious decision → DECISION (tagged by phase/task, in the SINGLE DECISION)
111
+ if doubt/gap → inline research OR structured-choice # chassis
112
+ mark Task - [x] + state IN THE PLAN # AFTER completing the Task (the plan-doc is the per-task source of truth)
113
+ phase validation:
114
+ what runs and failsback to the task
115
+ what depends on an unapplied migrationdefer (Open questions + BACKLOG)
116
+ closing review gate (pre-commit): # Delta 5: CHECKPOINT.Next = "review phase N"
117
+ INDEPENDENT re-read of the phase diff + installed ambient conventions
118
+ findingsfix (and re-validate the phase) OR defer justified (Open questions + BACKLOG)
119
+ update CHECKPOINT (Completed += Phase N, Next = Phase N+1) # AFTER: Pending→Completed + Next = next phase (see artifact-first cycle)
120
+ propose commit(s) per source (approve first) # never push/amend/--no-verify; only after the gate is green
121
+ if rejectedchanges stay; record "phase uncommitted"
122
+ next-phase precondition: working tree clean or acknowledged
123
+ final validation (whatever can run; the SQL-dependent part stays as a handoff)
124
+ structured_choice(content: [Marcar plan done, Preguntar algo más], flow: [Compactar, Cerrar])
125
+ mark plan done (or "done — SQL pending application")
126
+ # NO export: artifacts stay in the session; a separate export-* promotes them
127
+ finalize: CHECKPOINT (+ BACKLOG if something is deferred) + close session + report
131
128
  ```
132
129
 
133
130
  ## Convergence / exit
134
131
 
135
- - Plan completo + validación OK (o diferida con handoff) + **cada fase pasó su gate de revisión de cierre** antes de commitear → `Marcar plan done`.
136
- - `Cerrar` (control `flow`, en cualquier momento) → `finalize` persiste `CHECKPOINT` (y `BACKLOG` solo si quedó algo sin ejecutar / sin commitear / sin aplicar), cierra la session, reporta.
137
- - La promoción de artefactos a `docs/` (vía `export-*`) es **siempre** un paso posterior y explícito, fuera de este loop.
132
+ - Plan complete + validation OK (or deferred with a handoff) + **every phase passed its closing review gate** before committing → `Marcar plan done`.
133
+ - `Cerrar` (`flow` control, at any time) → `finalize` persists `CHECKPOINT` (and `BACKLOG` only if something remained unexecuted / uncommitted / unapplied), closes the session, reports.
134
+ - Promoting artifacts to `docs/` (via `export-*`) is **always** a later, explicit step outside this loop.