@tacuchi/agent-workflow-cli 15.2.0 → 16.1.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 (43) hide show
  1. package/dist/application/templates/session.js +1 -1
  2. package/package.json +1 -1
  3. package/skills/w/README.md +14 -14
  4. package/skills/w/SKILL.md +94 -82
  5. package/skills/w/artifacts/README.md +1 -1
  6. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +15 -13
  7. package/skills/w/artifacts/artifacts-core/SESSION.md +1 -1
  8. package/skills/w/artifacts/artifacts-core/TASKS.md +1 -1
  9. package/skills/w/artifacts/artifacts-research/CONCLUSIONS.md +1 -1
  10. package/skills/w/commands/README.md +22 -22
  11. package/skills/w/commands/export-diagrams.md +9 -9
  12. package/skills/w/commands/export-manuals.md +9 -9
  13. package/skills/w/commands/export-reports.md +9 -9
  14. package/skills/w/commands/export-scripts.md +9 -9
  15. package/skills/w/commands/fix-git.md +12 -12
  16. package/skills/w/commands/plan-exec.md +19 -19
  17. package/skills/w/commands/plan-new.md +18 -18
  18. package/skills/w/commands/plan-refine.md +22 -22
  19. package/skills/w/commands/quick.md +16 -16
  20. package/skills/w/commands/spec-new.md +35 -34
  21. package/skills/w/commands/spec-refine.md +16 -16
  22. package/skills/w/commands/status.md +18 -16
  23. package/skills/w/commands/workspace-init.md +14 -14
  24. package/skills/w/exports/README.md +5 -5
  25. package/skills/w/exports/export-diagrams/SKILL.md +58 -58
  26. package/skills/w/exports/export-manuals/SKILL.md +61 -61
  27. package/skills/w/exports/export-reports/SKILL.md +51 -51
  28. package/skills/w/exports/export-scripts/SKILL.md +60 -60
  29. package/skills/w/harness/SKILL.md +48 -47
  30. package/skills/w/loops/CHASSIS.md +103 -98
  31. package/skills/w/loops/CODE-POLICIES.md +21 -21
  32. package/skills/w/loops/README.md +30 -29
  33. package/skills/w/loops/plan-exec-loop/SKILL.md +77 -77
  34. package/skills/w/loops/plan-new-loop/SKILL.md +80 -80
  35. package/skills/w/loops/plan-refine-loop/SKILL.md +62 -62
  36. package/skills/w/loops/quick-loop/SKILL.md +79 -79
  37. package/skills/w/loops/spec-refine-loop/SKILL.md +93 -94
  38. package/skills/w/roles/README.md +2 -2
  39. package/skills/w/roles/diagrams/SKILL.md +50 -47
  40. package/skills/w/roles/git/SKILL.md +58 -58
  41. package/skills/w/roles/research/SKILL.md +65 -62
  42. package/skills/w/roles/sql/SKILL.md +59 -55
  43. package/skills/w/roles/ui-spec/SKILL.md +60 -74
@@ -1,134 +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 (loops/CHASSIS.md + CODE-POLICIES.md).
7
- Deltas: session única reanudable, git seguro (rama verificada, commits
8
- propuestos por fuente, nunca push/--amend/--no-verify), BD solo-scripts
9
- (nunca ejecuta DML/DDL), validación por fase y final, gate de revisión de
10
- cierre pre-commit, sin auto-export. Compone git y sql. Lo arranca
11
- /w:plan-exec. Invocar para implementar un plan 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.
12
12
  ---
13
13
 
14
14
  # plan-exec-loop
15
15
 
16
- > **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.
17
17
 
18
18
  ## Flow
19
19
  PLAN
20
20
 
21
21
  ## Layer
22
- 2 — la IA lo corre entero.
22
+ 2 — the AI runs it end to end.
23
23
 
24
24
  ## Started by
25
- `/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).
26
26
 
27
27
  ## Reads
28
- `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)).
29
29
 
30
30
  ## Writes
31
- - `docs/plans/PPP-plan-<slug>.md` (**read/update**, living doc: estado de fases/tareas, `Open questions`).
32
- - Artefactos de la plan-exec session en `.workflow/sessions/` (`SCRIPTS.sql`, `DECISION`, `ANALYSIS-FILE`/`CONCLUSIONS`, …).
33
- - **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*).
34
34
 
35
- ## Boundary — sin auto-export (hard rule)
35
+ ## Boundary — no auto-export (hard rule)
36
36
 
37
- 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-*`.
38
38
 
39
39
  ## Inherits
40
40
 
41
- Leé **[`../CHASSIS.md`](../CHASSIS.md)** — el **motor completo** del loop — **y** **[`../CODE-POLICIES.md`](../CODE-POLICIES.md)** — las *Políticas de loops que editan código* — **siempre antes** de estos deltas. *(Si `../` no resuelve: mismos nombres junto a este archivoregla global de layout, chasis § Resolución de referencias.)*
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 file — global layout rule, chassis § Reference resolution.)*
42
42
 
43
43
  ## Composes
44
44
 
45
- `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.
46
46
 
47
- > **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).
48
48
 
49
49
  ## Internal sessions (managed)
50
50
 
51
- - **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.
52
52
 
53
- > **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.
54
54
 
55
- > **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.
56
56
 
57
57
  ## Delta 1 — One session per run; per-phase progress in the plan-doc
58
58
 
59
- - Recorre las `Phases` del plan en orden (respeta deps) **dentro de la única session del run** (no hay session-por-fase).
60
- - 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.
61
- - 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).
62
- - 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.
63
- - 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)`).
64
- - 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.
65
65
 
66
- ## Delta 2 — Git policy: **rama segura + commits propuestos**
66
+ ## Delta 2 — Git policy: **safe branch + proposed commits**
67
67
 
68
- 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`.
69
69
 
70
- ## Delta 3 — DB policy: **la IA nunca ejecuta DML**
70
+ ## Delta 3 — DB policy: **the AI never executes DML**
71
71
 
72
- 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.
73
73
 
74
74
  ## Delta 4 — Validation
75
75
 
76
- - Tras ejecutar (por fase y al final): corre tests/checks contra `Validations` + `Final behavior` + acceptance/success criteria del spec.
77
- - Validación que **corre y falla** → vuelve a la tarea (gap); no avanza.
78
- - **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.)
79
79
 
80
- > 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).
81
81
 
82
- ## Delta 5 — Gate de revisión de cierre (convenciones, pre-commit)
82
+ ## Delta 5 — Closing review gate (conventions, pre-commit)
83
83
 
84
- 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.
85
85
 
86
- ## Delta 6 — Completitud / cierre
86
+ ## Delta 6 — Completion / close
87
87
 
88
- - 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"**.
89
- - Todas las fases done → *structured-choice* final (contenido: `Marcar plan done` / `Preguntar algo más`; flow: `Compactar`/`Cerrar`).
90
- - **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-*`.
91
91
 
92
92
  ## Sequence
93
93
 
94
94
  ```
95
95
  plan-exec-loop(PPP-plan-<slug>.md):
96
- 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
97
97
  plan = read(PPP-plan-<slug>.md)
98
- para cada Phase en plan (en orden, respeta deps):
99
- si Phase done (todas sus Tasks - [x] en el plan): skip # resume vía checkbox del plan-doc
100
- seed CHECKPOINT.Next = Phase N (Pending = sus Tasks) # ANTES de iniciar la fase: sembrar intención (artifact-first)
101
- para cada Task de la Phase:
102
- si Task - [x] en el plan: skip # resume intra-fase por checkbox
103
- verificar rama esperada por fuente (branch-check)
104
- si no coincide pausar + resolver con humano
105
- ejecutar Task:
106
- editar código en las fuentes (cambio mínimo)
107
- si crea herramienta/utilidadla skill ambiente creating-tools la documenta en docs/tools
108
- si consulta BD read-only → SCRIPTS.sql + ejecutar read-only
109
- si cambio BD (DDL/DML) → redactar en SCRIPTS.sql (artefacto session, NO ejecutar)
110
- si decisión no obvia → DECISION (etiquetado por fase/tarea, en el ÚNICO DECISION)
111
- si duda/gap → research inline ó structured-choice # chasis
112
- marcar Task - [x] + estado EN EL PLAN # DESPUÉS de completar la Task (el plan-doc es la fuente de verdad por tarea)
113
- validación de la fase:
114
- la que corre y falla volver a la tarea
115
- la dependiente de migración no aplicadadiferir (Open questions + BACKLOG)
116
- gate de revisión de cierre (pre-commit): # Delta 5: CHECKPOINT.Next = "review fase N"
117
- re-lectura INDEPENDIENTE del diff de la fase + convenciones ambientes instaladas
118
- hallazgoscorregir (y re-validar la fase) ó diferir justificado (Open questions + BACKLOG)
119
- update CHECKPOINT (Completed += Phase N, Next = Phase N+1) # DESPUÉS: Pending→Completed + Next = fase siguiente (ver ciclo artifact-first)
120
- proponer commit(s) por fuente (aprobar antes) # nunca push/amend/--no-verify; solo tras el gate en verde
121
- si rechazadocambios quedan; registrar "fase sin commitear"
122
- precondición siguiente fase: working tree limpio o reconocido
123
- validación final (lo que se pueda; lo dependiente de SQL queda como handoff)
124
- structured_choice(contenido: [Marcar plan done, Preguntar algo más], flow: [Compactar, Cerrar])
125
- marcar plan done (o "done — SQL pendiente de aplicar")
126
- # NO export: los artefactos quedan en la session; un export-* los promueve aparte
127
- 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
128
128
  ```
129
129
 
130
130
  ## Convergence / exit
131
131
 
132
- - 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`.
133
- - `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.
134
- - 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.
@@ -1,138 +1,138 @@
1
1
  ---
2
2
  name: plan-new-loop
3
3
  description: >-
4
- Genera un plan de implementación rico (docs/plans/PPP-plan-<slug>.md) a
5
- partir de un spec. Heir del chasis (loops/CHASSIS.md). Deltas: el plan
6
- absorbe el nivel TECHNICAL-NOTE + Phases/Tasks con estado vivo, research de
7
- mapeo código/impacto, gap taxonomy de planificación, y design SPECs por
8
- pantalla vía ui-design si el plan incluye UI. Si el spec no está refinado
9
- sugiere spec-refine antes. Lo arranca /w:plan-new; reanudable. Invocar
10
- cuando un spec deba convertirse en un plan ejecutable.
4
+ Generates a rich implementation plan (docs/plans/PPP-plan-<slug>.md) from a
5
+ spec. Heir of the chassis (loops/CHASSIS.md). Deltas: the plan absorbs the
6
+ TECHNICAL-NOTE level + Phases/Tasks with live state, code/impact-mapping
7
+ research, planning gap taxonomy, and per-screen design SPECs via ui-design
8
+ when the plan includes UI. If the spec is not refined it suggests
9
+ spec-refine first. Started by /w:plan-new; resumable. Invoke when a spec
10
+ must become an executable plan.
11
11
  ---
12
12
 
13
13
  # plan-new-loop
14
14
 
15
- > **Heir** del chasis comúnaquí **solo** los deltas de PLAN-new. El motor no se repite.
15
+ > **Heir** of the common chassis — **only** the PLAN-new deltas live here. The engine is never repeated.
16
16
 
17
17
  ## Flow
18
18
  PLAN
19
19
 
20
20
  ## Layer
21
- 2 — la IA lo corre entero.
21
+ 2 — the AI runs it end to end.
22
22
 
23
23
  ## Started by
24
- `/w:plan-new` — **reanudable** (mismo mecanismo del chasis, keyado off CHECKPOINT).
24
+ `/w:plan-new` — **resumable** (same chassis mechanism, keyed off CHECKPOINT).
25
25
 
26
26
  ## Reads
27
- `docs/specs/NNN-spec-*.md` (glob — localiza el spec por número; o la ruta exacta del argumento del comando). **Refinado vs borrador** se distingue por la **presencia** de `## Refinement decisions` / `## Q&A traceability` en el spec: si faltan → **soft-suggest** correr `/w:spec-refine` primero (planificar sobre un spec sólido produce mejores planes), pero el usuario puede proceder.
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`; **sobrescribe con confirmación** si existe). Solo escribe `docs/plans` — nunca otras carpetas `docs/` ni auto-export. Si el plan **incluye UI**, además produce **design SPECs** (`NNN-SPEC-<SLUG>.md`) como artefactos **de su sesión** (ver *Delta 4* — no son `docs/`, no hay auto-export).
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).
31
31
 
32
- > **slug**: kebab-case corto derivado del Requirement del spec solo `[a-z0-9-]`, ≤ ~5 palabras / ≤ 40 chars. `aw next-number docs/plans` devuelve JSON (campo `next` = `PPP`); el loop arma el nombre completo. Para localizar planes, glob `docs/plans/PPP-plan-*.md`.
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
 
34
34
  ## Inherits
35
35
 
36
- Leé **[`../CHASSIS.md`](../CHASSIS.md)** — el **motor completo** del loop — **siempre antes** de estos deltas. *(Si `../` no resuelve: `CHASSIS.md` junto a este archivoregla global de layout, chasis § Resolución de referencias.)*
36
+ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **always before** these deltas. *(If `../` does not resolve: `CHASSIS.md` next to this file — global layout rule, chassis § Reference resolution.)*
37
37
 
38
- ## Internal sessions — instancia PLAN-new
38
+ ## Internal sessions — PLAN-new instance
39
39
 
40
- Doctrina completa en el chasis (§ *Internal sessions* + *Numeración*). La instancia de este loop:
40
+ Full doctrine in the chassis (§ *Internal sessions* + *Numbering*). This loop's instance:
41
41
 
42
42
  | Session | When | Artifacts | Role |
43
43
  |---|---|---|---|
44
- | **plan session** `NNN-<slug>-plan-new/` | al arrancar el loop (o se reanuda) | `SESSION.md` · `CHECKPOINT.md` (· `BACKLOG.md` solo si difiere) | Dueña del run. Type = `refine`; descriptor `<slug>-plan-new` (el `<slug>` sale del spec de entrada). |
44
+ | **plan session** `NNN-<slug>-plan-new/` | when the loop starts (or resumes) | `SESSION.md` · `CHECKPOINT.md` (· `BACKLOG.md` only if something is deferred) | Owns the run. Type = `refine`; descriptor `<slug>-plan-new` (the `<slug>` comes from the input spec). |
45
45
 
46
- ## Delta 1 — Deliverable: PLAN RICO (`PPP-plan-<slug>.md`)
46
+ ## Delta 1 — Deliverable: the RICH PLAN (`PPP-plan-<slug>.md`)
47
47
 
48
- El plan absorbe el nivel `TECHNICAL-NOTE` **inline** (decisión del usuario) + roadmap:
48
+ The plan absorbs the `TECHNICAL-NOTE` level **inline** (user decision) + the roadmap:
49
49
 
50
50
  ```markdown
51
51
  # Plan PPP — <slug>
52
52
 
53
- > Derivado de docs/specs/NNN-spec-<slug>.md · generado por plan-new-loop
54
-
55
- ## Origin spec fuente (o prompt, si se bootstrapeó vía spec-new)
56
- ## Summary el cómo, en 1–2 frases (core)
57
- ## Solution explicación técnica/funcional de cómo se implementará (core)
58
- ## Impacted FE · BE · BD (esquemas/tablas/funciones) · APIs · integr. (core)
59
- ## Dependencies docs / fuentes / bases / sesiones (opt.)
60
- ## Current state (AS-IS) wiring actual (interfaces y métodos), resumido (opt.)
61
- ## Target state (TO-BE) wiring objetivo (opt.)
62
- ## Final behavior cómo se comporta el flujo al final (alineado con criterios del spec) (core)
63
- ## Phases fases agrupadoras (complejidad XS–S) (core)
64
- ## Tasks tareas por fase (≤XS), con deps y estado vivo (- [ ]) (core)
65
- ## Validations validaciones / restricciones / lógica de negocio (core)
66
- ## Risks / impact riesgos e impactos técnicos (opt.)
67
- ## Assumptions supuestos (opt.)
68
- ## Estimated time sizing XS–XL (desarrollo + pruebas internas) (opt.)
69
- ## Open questions pendientes (core)
53
+ > Derived from docs/specs/NNN-spec-<slug>.md · generated by plan-new-loop
54
+
55
+ ## Origin source spec (or prompt, if bootstrapped via spec-new)
56
+ ## Summary the how, in 1–2 sentences (core)
57
+ ## Solution technical/functional explanation of the implementation (core)
58
+ ## Impacted FE · BE · DB (schemas/tables/functions) · APIs · integr. (core)
59
+ ## Dependencies docs / sources / databases / sessions (opt.)
60
+ ## Current state (AS-IS) current wiring (interfaces and methods), brief (opt.)
61
+ ## Target state (TO-BE) target wiring (opt.)
62
+ ## Final behavior how the flow behaves at the end (aligned with the spec criteria) (core)
63
+ ## Phases grouping phases (complexity XS–S) (core)
64
+ ## Tasks tasks per phase (≤XS), with deps and live state (- [ ]) (core)
65
+ ## Validations validations / constraints / business logic (core)
66
+ ## Risks / impact technical risks and impacts (opt.)
67
+ ## Assumptions assumptions (opt.)
68
+ ## Estimated time XS–XL sizing (development + internal testing) (opt.)
69
+ ## Open questions pending (core)
70
70
  ```
71
71
 
72
- > **Escala con complejidad:** las `(core)` van **siempre**; las `(opt.)` solo si el plan lo ameritaun plan chico puede omitir `Dependencies`, AS-IS/TO-BE, `Risks`, `Assumptions`, `Estimated time`. Conciso > exhaustivo.
72
+ > **Scales with complexity:** the `(core)` sections go **always**; the `(opt.)` ones only when the plan warrants thema small plan may omit `Dependencies`, AS-IS/TO-BE, `Risks`, `Assumptions`, `Estimated time`. Concise > exhaustive.
73
73
 
74
- > **Implicación de catálogo:** `TECHNICAL-NOTE` deja de ser artefacto de session y se vuelve **secciones del plan-doc**. Reconciliado en [`plan-exec-loop`](../plan-exec-loop/SKILL.md): la única plan-exec session **no** lleva `TECHNICAL-NOTE` ni `TASKS` propios; el detalle técnico y el progreso viven inline en el plan-doc (living).
74
+ > **Catalog implication:** `TECHNICAL-NOTE` stops being a session artifact and becomes **sections of the plan-doc**. Reconciled in [`plan-exec-loop`](../plan-exec-loop/SKILL.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).
75
75
 
76
- ## Delta 2 — Gap taxonomy (de "plan")
76
+ ## Delta 2 — Gap taxonomy (of "plan")
77
77
 
78
- Reemplaza la gap taxonomy de spec por una orientada a planificación:
78
+ Replaces the spec gap taxonomy with a planning-oriented one:
79
79
 
80
80
  | Gap | Signal | Resolved by |
81
81
  |---|---|---|
82
- | Approach/Solution sin definir | el cómo es vago | research / humano |
83
- | Componentes sin identificar | impacto FE/BE/BD desconocido | **research** (mapea el código) |
84
- | Wiring AS-IS desconocido | no se sabe el estado actual | **research** |
85
- | Fase muy grande | complejidad > S | humano (re-partir) |
86
- | Tarea no atómica | complejidad > XS | la IA re-parte |
87
- | Deps faltantes | orden no claro | research / humano |
88
- | Criterios del spec sin cubrir | tareas no trazan a acceptance criteria | la IA deriva + humano confirma |
89
- | Riesgos sin atender | riesgos técnicos sin mitigar/declarar | humano |
90
- | UI sin design SPEC *(si aplica)* | el plan incluye UI (FE/pantallas en `Impacted`, `## UI spec` en el spec, o tareas UI) sin `NNN-SPEC-*.md` en la sesión | **capacidad `ui-design`** |
82
+ | Approach/Solution undefined | the how is vague | research / human |
83
+ | Components unidentified | FE/BE/DB impact unknown | **research** (maps the code) |
84
+ | AS-IS wiring unknown | current state unknown | **research** |
85
+ | Phase too large | complexity > S | human (re-split) |
86
+ | Task not atomic | complexity > XS | the AI re-splits |
87
+ | Missing deps | order unclear | research / human |
88
+ | Spec criteria uncovered | tasks don't trace to acceptance criteria | the AI derives + human confirms |
89
+ | Unaddressed risks | technical risks unmitigated/undeclared | human |
90
+ | UI without design SPEC *(if it applies)* | the plan includes UI (FE/screens in `Impacted`, `## UI spec` in the spec, or UI tasks) without `NNN-SPEC-*.md` in the session | **`ui-design` capability** |
91
91
 
92
92
  ## Delta 3 — What research investigates here
93
93
 
94
- El research **inline** del chasis se especializa: mapear **código/impacto** — componentes FE/BE/BD afectados, wiring AS-IS, dependencias. Alimenta las secciones `Solution`, `Impacted`, `Current state (AS-IS)`. La regla BD del chasis aplica igual (queries read-only a `SCRIPTS.sql`, MCP elegido vía pregunta de contenido si >1 sin default).
94
+ The chassis' **inline** research specializes: mapping **code/impact** — affected FE/BE/DB components, AS-IS wiring, dependencies. It feeds the `Solution`, `Impacted`, `Current state (AS-IS)` sections. The chassis DB rule applies unchanged (read-only queries into `SCRIPTS.sql`, MCP chosen via a content question when >1 without default).
95
95
 
96
- ## Delta 4 — Design SPECs (si el plan incluye UI)
96
+ ## Delta 4 — Design SPECs (when the plan includes UI)
97
97
 
98
- El gap **UI sin design SPEC** se resuelve **componiendo** la capacidad **`ui-design`** (default built-in [`ui-spec`](../../roles/ui-spec/SKILL.md); rebindeable vía `.workflow/skills.toml`; `off` → degrada a humano / `Open questions`):
98
+ The **UI without design SPEC** gap is resolved by **composing** the **`ui-design`** capability (built-in default [`ui-spec`](../../roles/ui-spec/SKILL.md); rebindable via `.workflow/skills.toml`; `off` → degrades to human / `Open questions`):
99
99
 
100
- - Autora **un design SPEC por pantalla** como artefacto de la sesión: `NNN-SPEC-<SLUG>.md` (numeración local a la sesiónver [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)).
101
- - **Deriva** de la sección `## UI spec` del spec si existe (la parte por pantalla y la eleva a detalle ejecutable); si no, autora desde el `Requirement` (design-system/tema/ambigüedades vía *structured-choice*, cuenta en el batch).
102
- - Las **Tasks UI del plan referencian** la ruta de su SPEC esa referencia es la **fuente de verdad** — y `plan-exec-loop` los lee como referencia de diseño.
103
- - Es el mismo tercer modo de resolución de gap del chasis (junto a *research* y *humano*).
100
+ - It authors **one design SPEC per screen** as a session artifact: `NNN-SPEC-<SLUG>.md` (numbering local to the sessionsee [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)).
101
+ - It **derives** from the spec's `## UI spec` section when present (splits it per screen and raises it to executable detail); otherwise it authors from the `Requirement` (design system/theme/ambiguities via *structured-choice*, counts in the batch).
102
+ - The plan's **UI Tasks reference** their SPEC's paththat reference is the **source of truth** — and `plan-exec-loop` reads them as the design reference.
103
+ - It is the same third gap-resolution mode of the chassis (next to *research* and *human*).
104
104
 
105
105
  ## Sequence
106
106
 
107
107
  ```
108
108
  plan-new-loop(spec):
109
- input = glob(docs/specs/NNN-spec-*.md) | ruta del argumento
110
- si el spec NO tiene ## Refinement decisions + ## Q&A traceability:
111
- soft-suggest /w:spec-refine (el usuario puede proceder igual)
112
- session = create_or_resume("<slug>-plan-new") # CLI antepone NNN global
113
- seed SESSION.Success criteria = checklist del coherence gate # verification-first, ANTES
114
- work = esqueleto del plan (Delta 1) derivado del spec (+ avance del checkpoint si reanuda)
115
- repeat: # motor del chasis
116
- gaps = detect_gaps(work) (taxonomy Delta 2) menos los agotados
109
+ input = glob(docs/specs/NNN-spec-*.md) | argument path
110
+ if the spec does NOT have ## Refinement decisions + ## Q&A traceability:
111
+ soft-suggest /w:spec-refine (the user may proceed anyway)
112
+ session = create_or_resume("<slug>-plan-new") # CLI prepends global NNN
113
+ seed SESSION.Success criteria = coherence-gate checklist # verification-first, BEFORE
114
+ work = plan skeleton (Delta 1) derived from the spec (+ checkpoint progress if resuming)
115
+ repeat: # chassis engine
116
+ gaps = detect_gaps(work) (Delta 2 taxonomy) minus the exhausted ones
117
117
  if gaps == ∅: break
118
- batch ≤3 → sembrar CHECKPOINT.Pending/Next → resolver cada gap:
119
- research (mapea código/impacto — Delta 3) · humano (structured-choice) · ui-design (Delta 4)
120
- integrar + update CHECKPOINT # ciclo artifact-first
121
- coherence gate (read-only) = Success criteria en verde:
122
- - cada acceptance criterion del spec traza a una fase/tarea
123
- - Final behavior cubre los criterios
124
- - fases XS–S · tareas XS · deps sin ciclos · Impacted consistente con Solution
125
- - (UI) cada pantalla/tarea UI traza a su design SPEC y no contradice ## UI spec
126
- lo que falle vuelve como gap
127
- structured_choice(contenido: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
128
- Guardar → write docs/plans/PPP-plan-<slug>.md (con confirmación si existe)
129
- finalize: CHECKPOINT persiste (+ BACKLOG solo si difiere) + cerrar session + reportar
118
+ batch ≤3 → seed CHECKPOINT.Pending/Next → resolve each gap:
119
+ research (maps code/impact — Delta 3) · human (structured-choice) · ui-design (Delta 4)
120
+ integrate + update CHECKPOINT # artifact-first cycle
121
+ coherence gate (read-only) = Success criteria green:
122
+ - every spec acceptance criterion traces to a phase/task
123
+ - Final behavior covers the criteria
124
+ - phases XS–S · tasks XS · deps without cycles · Impacted consistent with Solution
125
+ - (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
126
+ whatever failscomes back as a gap
127
+ structured_choice(content: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
128
+ Guardar → write docs/plans/PPP-plan-<slug>.md (confirmation if it exists)
129
+ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
130
130
  ```
131
131
 
132
132
  ## Convergence / exit
133
133
 
134
- - **Sin gaps materiales** → **coherence gate** (checklist del *Sequence*; la instancia PLAN-new del convergence gate del chasis). La trazabilidad criterio→tarea es una **invariante chequeada**, no una sección aparte.
135
- - Pasa → `Guardar plan` (escribe con confirmación si existe) → `finalize`.
136
- - `Cerrar` en cualquier momento → `finalize` (persiste `CHECKPOINT`; `BACKLOG` solo si difiere; cierra la session, reporta).
134
+ - **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.
135
+ - Passes → `Guardar plan` (writes with confirmation if it exists) → `finalize`.
136
+ - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
137
137
 
138
- > **Después de generar:** el plan puede ir directo a `plan-exec`, osi surgen cambios antes de ejecutar (nuevos requerimientos, ajustes de alcance)pasar por [`plan-refine-loop`](../plan-refine-loop/SKILL.md) (`/w:plan-refine`, auxiliar y **no obligatorio**), que lo refina in place.
138
+ > **After generating:** the plan can go straight to `plan-exec`, orif changes arise before executing (new requirements, scope adjustments)pass through [`plan-refine-loop`](../plan-refine-loop/SKILL.md) (`/w:plan-refine`, auxiliary and **not mandatory**), which refines it in place.