@tacuchi/agent-workflow-cli 15.2.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.
- package/package.json +1 -1
- package/skills/w/README.md +14 -14
- package/skills/w/SKILL.md +94 -82
- package/skills/w/artifacts/artifacts-core/TASKS.md +1 -1
- package/skills/w/artifacts/artifacts-research/CONCLUSIONS.md +1 -1
- package/skills/w/commands/README.md +22 -22
- package/skills/w/commands/export-diagrams.md +9 -9
- package/skills/w/commands/export-manuals.md +9 -9
- package/skills/w/commands/export-reports.md +9 -9
- package/skills/w/commands/export-scripts.md +9 -9
- package/skills/w/commands/fix-git.md +12 -12
- package/skills/w/commands/plan-exec.md +19 -19
- package/skills/w/commands/plan-new.md +18 -18
- package/skills/w/commands/plan-refine.md +22 -22
- package/skills/w/commands/quick.md +16 -16
- package/skills/w/commands/spec-new.md +35 -34
- package/skills/w/commands/spec-refine.md +16 -16
- package/skills/w/commands/status.md +18 -16
- package/skills/w/commands/workspace-init.md +14 -14
- package/skills/w/exports/README.md +5 -5
- package/skills/w/exports/export-diagrams/SKILL.md +58 -58
- package/skills/w/exports/export-manuals/SKILL.md +61 -61
- package/skills/w/exports/export-reports/SKILL.md +51 -51
- package/skills/w/exports/export-scripts/SKILL.md +60 -60
- package/skills/w/harness/SKILL.md +48 -47
- package/skills/w/loops/CHASSIS.md +101 -98
- package/skills/w/loops/CODE-POLICIES.md +21 -21
- package/skills/w/loops/README.md +30 -29
- package/skills/w/loops/plan-exec-loop/SKILL.md +77 -77
- package/skills/w/loops/plan-new-loop/SKILL.md +80 -80
- package/skills/w/loops/plan-refine-loop/SKILL.md +62 -62
- package/skills/w/loops/quick-loop/SKILL.md +79 -79
- package/skills/w/loops/spec-refine-loop/SKILL.md +93 -94
- package/skills/w/roles/README.md +2 -2
- package/skills/w/roles/diagrams/SKILL.md +50 -47
- package/skills/w/roles/git/SKILL.md +58 -58
- package/skills/w/roles/research/SKILL.md +65 -62
- package/skills/w/roles/sql/SKILL.md +59 -55
- package/skills/w/roles/ui-spec/SKILL.md +60 -74
|
@@ -1,163 +1,166 @@
|
|
|
1
|
-
# CHASSIS —
|
|
1
|
+
# CHASSIS — the loop engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document is the **common engine** of the agent-workflow loops: the doctrine every loop runs underneath its deltas. **It is not a skill** — it is a referenced document: every loop orders it read from its `## Inherits`, **always, before its deltas**. If you edit the engine, edit it **here** — heirs never repeat it, they only reference it.
|
|
4
4
|
|
|
5
|
-
## Heirs (
|
|
5
|
+
## Heirs (canonical list)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The **5 loops** run this engine; each adds only its deltas:
|
|
8
8
|
|
|
9
|
-
- [`spec-refine-loop`](spec-refine-loop/SKILL.md) —
|
|
10
|
-
- [`plan-new-loop`](plan-new-loop/SKILL.md) —
|
|
11
|
-
- [`plan-refine-loop`](plan-refine-loop/SKILL.md) —
|
|
12
|
-
- [`plan-exec-loop`](plan-exec-loop/SKILL.md) — **
|
|
13
|
-
- [`quick-loop`](quick-loop/SKILL.md) —
|
|
9
|
+
- [`spec-refine-loop`](spec-refine-loop/SKILL.md) — refines the **spec** in place; deltas: spec gap taxonomy, analyze gate, `## UI spec` via the `ui-design` capability.
|
|
10
|
+
- [`plan-new-loop`](plan-new-loop/SKILL.md) — generates the **plan** from the spec; deltas: rich plan + plan gap taxonomy (+ per-screen design SPECs when the plan includes UI).
|
|
11
|
+
- [`plan-refine-loop`](plan-refine-loop/SKILL.md) — refines the **plan** in place (auxiliary, not mandatory); reuses the gap taxonomy + coherence gate of `plan-new-loop`. It is to `plan-new` what `spec-refine` is to `spec-new`.
|
|
12
|
+
- [`plan-exec-loop`](plan-exec-loop/SKILL.md) — **executes** the plan: code/DB/git, a single session per run, per-phase progress in the plan-doc, no auto-export. Applies the policies in [`CODE-POLICIES.md`](CODE-POLICIES.md).
|
|
13
|
+
- [`quick-loop`](quick-loop/SKILL.md) — the engine with **minimal ceremony** (the prompt *is* the objective); also applies [`CODE-POLICIES.md`](CODE-POLICIES.md) (proportional gate).
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Persistent objective
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
A loop **is a persistent objective**: it exists to fulfill the `SESSION.Objective` declared at start, and **it is not finished until the convergence gate confirms the objective was met**. Gap-driven iteration is the *method*; the artifacts are the *record*; the persistent objective is the *frame* that governs them.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This is **harness-agnostic doctrine**, not a host dependency: "don't stop until convergence" is sustained by the loop itself (its `repeat:` + the convergence gate), not by a host hook — and it **leaves a durable record** (artifact-first) that survives compaction and resume. *(Rationale and the `/goal` analogy: see the design, `workflow-loops/chassis.md`.)*
|
|
20
20
|
|
|
21
|
-
>
|
|
21
|
+
> Each heir instantiates the frame: `spec-refine` pursues the spec; `plan-new`/`plan-refine` pursue the plan up to their gate; `plan-exec` pursues the plan up to its final validation; `quick-loop` is the most direct embodiment (the prompt *is* the objective).
|
|
22
22
|
|
|
23
|
-
> **
|
|
23
|
+
> **Inter-turn continuity.** The same `CHECKPOINT`+resume also governs the **next prompt**: the objective persists **across turns**, not only within a run. The canonical rules (command = new work line · re-run = `create_or_resume` · bare prompt = continue the most recent session · reopening closed sessions · consented escalation) live in [`../SKILL.md`](../SKILL.md) § *Operating context* — **single source**; this engine executes them via *Compact / resume* (case 3).
|
|
24
24
|
|
|
25
25
|
## Verification-first
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The persistent objective needs a **checkable done-condition** — otherwise the loop cannot know when it is done (or chases a target it invented). That condition is **seeded BEFORE executing**, never improvised at the end: it is **generalized TDD**. Together with artifact-first (next section) these are the **two seeds** of every gap/phase: *how will I know it worked* + *what am I about to do*.
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**Where it lives:** in `SESSION.Success criteria` (see [`../artifacts/artifacts-core/SESSION.md`](../artifacts/artifacts-core/SESSION.md)) — a `[ ]` checklist of **falsifiable** criteria (that *can* fail). `CHECKPOINT.Pending/Completed` tracks the **red→green** progress. Two forms, by deliverable:
|
|
30
30
|
|
|
31
|
-
| Deliverable |
|
|
31
|
+
| Deliverable | Criterion = | Cycle |
|
|
32
32
|
|---|---|---|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| spec / plan | **
|
|
36
|
-
|
|
|
33
|
+
| code / script / fix / feature | **runnable tests** (unit, build, lint, bug repro) | literal TDD: red → green → refactor |
|
|
34
|
+
| DB migration (not executable; invariant 4) | **rubric**: `SCRIPTS.sql` valid + reviewed (never executed) | rubric |
|
|
35
|
+
| spec / plan | **rubric** = the document's acceptance criteria (referenced, not duplicated) | rubric |
|
|
36
|
+
| analysis / design | **rubric falsifiable by inspection** (e.g. "every affected site with `file:line`"; "each decision: rationale + ≥1 alternative") | rubric |
|
|
37
37
|
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
38
|
+
- **Form and weight scale** (quick's minimal ceremony preserved): a chore = "existing tests/build stay green" (one line); a feature = real acceptance tests. The rule is "**always declare the check before**", not "always write new tests".
|
|
39
|
+
- **Subjective deliverable** (analysis/design): the AI **proposes** the rubric and the **human ratifies** it (structured-choice) before pursuing it.
|
|
40
|
+
- **Unresolvable criterion** (no evidence, DB unavailable): closes as `inconclusive` and the loop **degrades** (asks the human, or defers to `Open questions`/`BACKLOG`) — **never iterates against a fake target**.
|
|
41
41
|
|
|
42
|
-
>
|
|
42
|
+
> The **convergence gate** (section *Convergence / exit*) is, operationally, **"all `Success criteria` green"**. The per-heir gates (analyze gate; plan coherence — plan-new and plan-refine; final validation; proportional spot validation) are **instances** of it, with the criteria seeded at start.
|
|
43
43
|
|
|
44
|
-
**
|
|
44
|
+
**Gate integrity (anti-gaming + independent verification).** The gate only counts if it is not gamed to pass. The loop does **not**:
|
|
45
45
|
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
46
|
+
- modify the check or loosen a `Success criterion` to force green;
|
|
47
|
+
- weaken, delete or skip tests/validations;
|
|
48
|
+
- use trivial or tautological asserts that always pass (the expected value comes from an independent source, never from the output itself);
|
|
49
|
+
- patch the test instead of fixing the cause (prefer fixing production code).
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Facing a real blocker it **stops and reports it** (→ `Open questions`/`BACKLOG`) instead of gaming the metric. The verdict counts **only the check's output, never the implementer's self-declaration**: when the deliverable warrants it, the final verification is an **independent** pass (subagent or clean re-read) that does not assume the implementation is correct — *only command output counts*.
|
|
52
52
|
|
|
53
|
-
## Artifacts as a live log —
|
|
53
|
+
## Artifacts as a live log — the artifact-first cycle
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
The loop works **artifact-first**: the artifact is **seeded before** executing and **updated after**, not only on close. Every gap/phase/task runs the **3-beat** cycle:
|
|
56
56
|
|
|
57
|
-
1. **
|
|
58
|
-
2. **
|
|
59
|
-
3. **
|
|
57
|
+
1. **BEFORE — seed the intent.** Before executing, record in the artifact what is **about to** be done: `CHECKPOINT.Pending`/`Next` = the imminent work (`SESSION.Objective` already fixed the run's what).
|
|
58
|
+
2. **EXECUTE.** Resolve the gap / run the phase / edit the code.
|
|
59
|
+
3. **AFTER — bring to actual state.** `CHECKPOINT.Pending → Completed`; `DECISION` records the non-obvious **as it is decided**; `BACKLOG` **only if** something is deferred/follow-up (`session-close` no longer fabricates an empty BACKLOG).
|
|
60
60
|
|
|
61
|
-
>
|
|
61
|
+
> The artifact expresses the **intent** (Pending/Next, before) and then the **result** (Completed/DECISION, after), at **every** gap/phase boundary — not only on `Compactar`/`Cerrar`. Session artifacts are the run's live log; the spec/plan is the **guiding base**.
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Gap-driven convergent engine
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
The common cycle — each heir instantiates it in its `## Sequence` with its own gap taxonomy:
|
|
66
66
|
|
|
67
|
-
1. `detect_gaps(work)`,
|
|
68
|
-
2.
|
|
69
|
-
3.
|
|
70
|
-
4.
|
|
71
|
-
5. **
|
|
67
|
+
1. `detect_gaps(work)`, minus the *exhausted* gaps (see *Research*).
|
|
68
|
+
2. If `∅` → **convergence gate** (see *Convergence / exit*).
|
|
69
|
+
3. If there are gaps: take a batch (≤3) and **seed** `CHECKPOINT.Pending/Next` (*artifact-first*).
|
|
70
|
+
4. Resolve each gap with its **resolver** per the *ask-vs-research rule*: human (structured-choice) · inline research · a composed capability (e.g. `ui-design`).
|
|
71
|
+
5. **Integrate**, update `CHECKPOINT` → repeat.
|
|
72
72
|
|
|
73
|
-
## Internal sessions (managed) —
|
|
73
|
+
## Internal sessions (managed) — one session per run
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
The loop creates and manages its session under `.workflow/sessions/`. **The user never creates it.** **A single session per run**, owning the run: it keeps progress live (`CHECKPOINT`) and enables resume. Artifacts: `SESSION.md` · `CHECKPOINT.md` (· `BACKLOG.md` only if something is deferred; code-editing loops add `DECISION` and `SCRIPTS.sql`). Each heir declares its descriptor and `Type` in its own `## Internal sessions`.
|
|
76
76
|
|
|
77
|
-
> **
|
|
77
|
+
> **INLINE research** — investigation is **not** a separate session: it is an activity **inside the current session** that writes its artifacts (`ANALYSIS-FILE`/`CONCLUSIONS`, + read-only `SCRIPTS.sql` if it queries DB) **into the run's own session folder**. See *Research: autonomy, scope & failure*.
|
|
78
78
|
|
|
79
|
-
>
|
|
79
|
+
> The flow's input document (spec/plan) **never** goes inside a session; it lives in `docs/`.
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### Session numbering (hard rule)
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
The **CLI owns the number**: `aw session-create` prepends a **global, sequential** `NNN` by scanning **all** sessions under `.workflow/sessions/` (any type). The caller passes **only the descriptor** via `--name` — **never** a number. Numbering neither restarts per type nor collides, and every folder is **self-describing**: `NNN-<slug>-<flow>` (e.g. `002-correo-otp-spec-refine`, `003-correo-otp-plan-new`, `004-correo-otp-plan-exec`, `005-validacion-correo-quick`).
|
|
84
84
|
|
|
85
|
-
> `<run>` =
|
|
85
|
+
> `<run>` = the session's **descriptor** (no number), always shaped **`<slug>-<flow>`**: `<slug>-spec-refine`, `<slug>-plan-new`, `<slug>-plan-refine`, `<slug>-plan-exec`, `<slug>-quick`. The `<slug>` is **descriptive** and comes from the flow's input doc — `docs/specs/NNN-spec-<slug>.md` for spec-refine/plan-new; `docs/plans/PPP-plan-<slug>.md` for plan-refine/plan-exec; the prompt for quick — so the folder says at a glance what it is about, not just which flow created it. Research being **inline** in this same session, there are no child `*-research-*` sessions to number (compat: old ones are historical).
|
|
86
86
|
>
|
|
87
|
-
> **Resume**:
|
|
87
|
+
> **Resume**: locate the existing session by **scanning** `.workflow/sessions/` for descriptor + `## Origin` (which spec/plan), **not** by reconstructing the number (global, not derivable from the artifact). `aw session-resume --code <NNN | folder>` resolves both forms.
|
|
88
88
|
|
|
89
89
|
**CLI**:
|
|
90
|
-
- `aw session-create --type <type> --name <slug>-<flow>` → crea `NNN-<slug>-<flow>` / `aw session-resume --code <…>` (detecta `CHECKPOINT`).
|
|
91
|
-
- `aw checkpoint-write` / `aw checkpoint-read` para el resume.
|
|
92
|
-
- `aw session-close` al cerrar (con razón); `aw session-artifacts` para inspeccionar.
|
|
93
|
-
- **Reabrir para continuar** (contexto operativo, fila 2): `aw session-resume --code <NNN> --reopen` reactiva una sesión **cerrada** (quita `.closed` → activa) para seguir trabajando en ella; sin `--reopen`, el resume es read-only. Para detectar cuál es la más reciente cerrada: `aw resume-summary --include-recent-closed` (o `aw sessions --state all`).
|
|
94
90
|
|
|
95
|
-
|
|
91
|
+
- `aw session-create --type <type> --name <slug>-<flow>` → creates `NNN-<slug>-<flow>` / `aw session-resume --code <…>` (detects `CHECKPOINT`).
|
|
92
|
+
- `aw checkpoint-write` / `aw checkpoint-read` for resume.
|
|
93
|
+
- `aw session-close` on close (with reason); `aw session-artifacts` to inspect.
|
|
94
|
+
- **Reopen to continue** (operating context, row 2): `aw session-resume --code <NNN> --reopen` reactivates a **closed** session (removes `.closed` → active) to keep working in it; without `--reopen`, resume is read-only. To detect the most recent closed one: `aw resume-summary --include-recent-closed` (or `aw sessions --state all`).
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
## Ask-vs-research rule (the discriminator)
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
For every gap, a single question picks the resolver:
|
|
99
|
+
|
|
100
|
+
> *"Can I answer this by reading the repo/data?"* → **research** (autonomous).
|
|
101
|
+
> *"Does it depend on what the user wants?"* → **ask the human** (structured-choice).
|
|
101
102
|
|
|
102
103
|
## Research: autonomy, scope & failure
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
Investigation is **inline**: an activity **inside the run's current session**, never a separate session. It writes its artifacts (`ANALYSIS-FILE` → `CONCLUSIONS`, + read-only `SCRIPTS.sql` if it queries DB) into the **session's own folder**.
|
|
105
106
|
|
|
106
|
-
- **
|
|
107
|
-
- **
|
|
108
|
-
- **
|
|
109
|
-
1. **
|
|
110
|
-
2.
|
|
111
|
-
3.
|
|
112
|
-
- **
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
107
|
+
- **Autonomous**: the AI investigates inline and reports **without asking permission**. The human learns of it at integration time (in the flow's decision record — e.g. `## Refinement decisions` in the refine loops, `DECISION` in the code-editing ones) and keeps control via the `flow` control.
|
|
108
|
+
- **Scope**: workspace + associated repos (sources) + DB MCPs.
|
|
109
|
+
- **DB rule** (the single exception to autonomy):
|
|
110
|
+
1. **MCP choice**: if the gap needs DB and there is **>1 candidate MCP with no configured default**, the AI asks which one to use. That question goes through the **same structured-choice** as a **content question** (counts inside the ≤3 + `flow` limit), **before** running queries. A single MCP or a default → no question.
|
|
111
|
+
2. Write the queries **first** into the session's `SCRIPTS.sql`.
|
|
112
|
+
3. Execute them **read-only** via MCP (respect `sql-mutation-guard`: never DML/DDL).
|
|
113
|
+
- **Inconclusive research** (DB unavailable, insufficient evidence, unresolvable factual gap):
|
|
114
|
+
- The investigation closes with status **`inconclusive`** in `CONCLUSIONS` and reports why.
|
|
115
|
+
- The loop **degrades** the gap: to a **human question** (next batch → the flow's Q&A record: `Q&A traceability` in refine loops, `DECISION` in code-editing ones) or, failing that, **defers** it to the flow doc's `## Open questions` (spec/plan) — or the session's `BACKLOG` when the flow has no doc (quick).
|
|
116
|
+
- The gap is marked **"already tried via research"** (`attempts[gap]++`, `MAX` cap) so `detect_gaps` does **not** re-fire it in a loop → guarantees convergence.
|
|
116
117
|
|
|
117
118
|
## Structured-choice (design & batching)
|
|
118
119
|
|
|
119
|
-
**
|
|
120
|
+
**Canonical rule (single source — the rest of the corpus only references it):** *structured-choice* = **≤3 content questions + 1 `flow` control**, always. Per-harness binding in [`../harness/SKILL.md`](../harness/SKILL.md) (Claude Code: `AskUserQuestion`, max 4 questions/call; without structured choice it degrades to **numbered markdown**).
|
|
121
|
+
|
|
122
|
+
- Since the `flow` control is **always** present → **≤3 content questions + 1 `flow` control**.
|
|
123
|
+
- **`flow` control** (lifecycle, always present): `Compactar` | `Cerrar`. Answering only the content questions (not touching `flow`) = keep iterating.
|
|
124
|
+
- **Content questions** can be:
|
|
125
|
+
- human doubts (non-factual gaps);
|
|
126
|
+
- MCP choice (DB rule) — before running queries;
|
|
127
|
+
- at **convergence**, the loop's own closing action — **each heir defines it in its *Convergence / exit*** (e.g. `Guardar especificación refinada` · `Cerrar tarea`) — | `Preguntar algo más`.
|
|
128
|
+
- **Batching**: group up to 3 human gaps in one call. With more than 3 pending, prioritize (the ones that unblock other gaps first) and defer the rest to the next round.
|
|
129
|
+
- **Recommended answer per question**: every content question **always** carries the AI's recommended answer — as the first option (marked *recommended*) in `AskUserQuestion`, or flagged in the numbered-markdown fallback. Never ask "cold": the human ratifies or corrects a proposal, never starts from zero. The AI recommends based on what it researched (ask-vs-research rule), never on an empty default.
|
|
120
130
|
|
|
121
|
-
|
|
122
|
-
- **control `flow`** (ciclo de vida, siempre presente): `Compactar` | `Cerrar`. Responder solo las preguntas de contenido (sin tocar `flow`) = seguir iterando.
|
|
123
|
-
- **Preguntas de contenido** posibles:
|
|
124
|
-
- dudas-de-humano (gaps no factuales);
|
|
125
|
-
- elección de MCP (regla BD) — antes de ejecutar queries;
|
|
126
|
-
- en **convergencia**, la acción de cierre propia del loop — **cada heir la define en su *Convergence / exit*** (p. ej. `Guardar especificación refinada` · `Cerrar tarea`) — | `Preguntar algo más`.
|
|
127
|
-
- **Batching**: agrupar hasta 3 gaps de humano en una sola llamada. Si hay más de 3 pendientes, priorizar (los que desbloquean otros gaps primero) y diferir el resto a la próxima vuelta.
|
|
128
|
-
- **Respuesta recomendada por pregunta**: cada pregunta de contenido lleva **siempre** la respuesta que la IA recomienda — como primera opción (marcada *recomendada*) en `AskUserQuestion`, o señalada en el markdown numerado al degradar. Nunca se pregunta "a secas": el humano ratifica o corrige una propuesta, no parte de cero. La IA recomienda en base a lo investigado (regla ask-vs-research), no por defecto vacío.
|
|
131
|
+
> **Label language:** the literal option labels (`Compactar`, `Cerrar`, `Guardar plan`, …) are **canonical product strings** — present them **verbatim**; they are user-facing, authored in the product's user language (Spanish). All other user-facing output follows [`../SKILL.md`](../SKILL.md) § *Language policy*.
|
|
129
132
|
|
|
130
133
|
## Compact / resume
|
|
131
134
|
|
|
132
|
-
|
|
135
|
+
Resume **keys off the `CHECKPOINT`** of the run's session, not the existence of a separate file. Three cases when the flow's command runs over an input:
|
|
133
136
|
|
|
134
|
-
1. **
|
|
135
|
-
2. **
|
|
136
|
-
3. **
|
|
137
|
+
1. **In progress** (a `CHECKPOINT.md` exists in the session) → resume from the recorded progress (resolved gaps, Q&A, `attempts`, in-flight inline research).
|
|
138
|
+
2. **No progress** (no CHECKPOINT and the input doc does **not** have the flow's prior-work mark) → start from zero reading the input doc.
|
|
139
|
+
3. **Already converged / re-run on demand** (no open CHECKPOINT but the doc **already has** the mark) → **first-class operation**: while the flow stays in its stage, re-running the command over the same input **as many times as needed** is supported. `create_or_resume` finds the existing session — typically **closed** after convergence — by descriptor + `## Origin` and **reopens** it (see *Internal sessions*: detection via `aw sessions --state all` / `aw resume-summary --include-recent-closed`, reopening via `aw session-resume --code <NNN> --reopen`); incremental work reading the **doc itself**.
|
|
137
140
|
|
|
138
|
-
>
|
|
141
|
+
> Each heir defines its **prior-work mark**: in the refine loops, the presence of `## Refinement decisions` + `## Q&A traceability` in the doc; in plan-exec, the plan-doc's `- [x]` checkboxes; quick has no doc (resume by CHECKPOINT only).
|
|
139
142
|
|
|
140
|
-
> **`Compactar`** (
|
|
143
|
+
> **`Compactar`** (the `flow` control, across all 3 cases) → write `CHECKPOINT.md` in the session (in-flight progress, remaining gaps, Q&A, `attempts`) → trigger the harness **compaction** (Claude Code: `/compact`; see [`../harness/SKILL.md`](../harness/SKILL.md)) → resume by reading the checkpoint.
|
|
141
144
|
|
|
142
145
|
## Convergence / exit
|
|
143
146
|
|
|
144
|
-
- **
|
|
145
|
-
- `Cerrar` (
|
|
147
|
+
- **No material gaps** → **convergence gate** (read-only) = **`Success criteria` green** (*verification-first*). Whatever fails **comes back as a gap**; if it passes → the loop offers its closing action. The heirs are **instances** of the same gate: `spec-refine` = analyze gate, `plan-new` and `plan-refine` = plan coherence, `plan-exec` = final validation, `quick` = proportional spot validation.
|
|
148
|
+
- `Cerrar` (the `flow` control, at any time) → `finalize`. **`finalize` always persists `CHECKPOINT.md`** (resumable) and, **only if something was deferred/follow-up**, writes `BACKLOG.md` (close reason + the deferred items); closes the session and reports. Progress survives even without a prior `Compactar`.
|
|
146
149
|
|
|
147
|
-
## docs/ boundary —
|
|
150
|
+
## docs/ boundary — no auto-export (hard rule)
|
|
148
151
|
|
|
149
|
-
|
|
152
|
+
A loop writes into `docs/` **only** its own flow's doc (spec-refine: `docs/specs` · plan-new/plan-refine/plan-exec: `docs/plans` · quick: **none** — it never touches `docs/`). No loop **graduates/promotes artifacts** into `docs/`: everything else (migrations → `docs/scripts`, manuals → `docs/manuals`, diagrams → `docs/diagrams`, …) is done by the separate **`export-*`** skills, as an explicit later step. Artifacts stay in their sessions until then. If a task creates a tool/utility, the ambient skill `creating-tools` documents it in `docs/tools` (auto-discovered by its `description`; the workflow is **indifferent** — it does not bind it).
|
|
150
153
|
|
|
151
|
-
##
|
|
154
|
+
## Code-editing loop policies → CODE-POLICIES.md
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
The loops that **edit code** (`plan-exec-loop`, `quick-loop`) additionally run the policies in [`CODE-POLICIES.md`](CODE-POLICIES.md) — **safe git** (verified branch + proposed commits) · **DB scripts-only** · **closing review gate** (proportional in quick). They order it read from their `## Inherits` **together with this chassis**; the document loops (spec-refine, plan-new, plan-refine) do **not** load it — that is why it lives in a separate doc.
|
|
154
157
|
|
|
155
|
-
##
|
|
158
|
+
## Reference resolution (global layout rule) — and what the chassis is NOT
|
|
156
159
|
|
|
157
|
-
|
|
160
|
+
Applies to **every** relative reference in the doctrine — never repeated per link:
|
|
158
161
|
|
|
159
|
-
1. **
|
|
160
|
-
2. **
|
|
161
|
-
3.
|
|
162
|
+
1. **Normal install** (the `w/` tree): the relative path resolves as-is (`../CHASSIS.md`, `../../commands/spec-new.md`).
|
|
163
|
+
2. **Flattened install** (e.g. Warp/Oz): the shared `.md` files (`CHASSIS.md`, `CODE-POLICIES.md`) sit **next to the loop's `SKILL.md`**; another loop is a **sibling** skill `w-<loop>/` (e.g. `../spec-refine-loop/SKILL.md` → `../w-spec-refine-loop/SKILL.md`).
|
|
164
|
+
3. A reference that does not resolve = **optional deep-dive** — this engine's doctrine is self-contained.
|
|
162
165
|
|
|
163
|
-
|
|
166
|
+
The chassis **is not a skill** (no frontmatter; never invoked nor bound via `.workflow/skills.toml`): it enters the context only because a loop orders it read from its `## Inherits`. It does not define flow, deliverable or gap taxonomy — that belongs to each heir.
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# CODE-POLICIES —
|
|
1
|
+
# CODE-POLICIES — policies for code-editing loops
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
##
|
|
5
|
+
## Safe git — verified branch + proposed commits
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
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
|
-
##
|
|
12
|
+
## DB scripts-only — the AI never executes DML/DDL
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Distinguished by **execution**, not by file (see the [`SCRIPTS.sql`](../artifacts/artifacts-core/SCRIPTS.sql) schema):
|
|
15
15
|
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
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
|
-
>
|
|
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
|
-
##
|
|
21
|
+
## Closing review gate (conventions, pre-commit)
|
|
22
22
|
|
|
23
|
-
|
|
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
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **Artifact-first + verification-first**: `CHECKPOINT.Next = "review <
|
|
25
|
+
- **Independent re-read** of the diff (subagent or clean re-read — the 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 installed → minimal 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
|
-
|
|
30
|
+
Only with the gate green are the commits proposed.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Location
|
|
33
33
|
|
|
34
|
-
|
|
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*).
|
package/skills/w/loops/README.md
CHANGED
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
# w/loops — Loop map (Layer 2)
|
|
2
2
|
|
|
3
|
-
>
|
|
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
|
-
>
|
|
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
|
-
|
|
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
|
-
|
|
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` (
|
|
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,
|
|
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);
|
|
23
|
-
| [`quick-loop`](quick-loop/SKILL.md) | QUICK | `/w:quick` | — (prompt) |
|
|
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
|
|
25
|
+
> `/w:spec-new` has no loop (single-pass). Hence **6 commands / 5 loops**.
|
|
26
26
|
|
|
27
|
-
### `docs/` boundary (
|
|
27
|
+
### `docs/` boundary (hard rule)
|
|
28
28
|
|
|
29
|
-
|
|
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` |
|
|
36
|
-
| `## Layer` |
|
|
37
|
-
| `## Started by` |
|
|
38
|
-
| `## Reads` |
|
|
39
|
-
| `## Writes` |
|
|
40
|
-
| `## Internal sessions` | Sessions
|
|
41
|
-
| `## Sequence` |
|
|
42
|
-
| `## Convergence / exit` |
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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` (
|
|
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` |
|
|
60
|
-
| `overview` | `workflow` |
|
|
59
|
+
| `research` | `research` | every loop (inline research) |
|
|
60
|
+
| `overview` | `workflow` | anyone (orientation) |
|
|
61
61
|
|
|
62
|
-
> **
|
|
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`
|
|
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) —
|
|
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,
|
|
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)
|