@sabaiway/agent-workflow-engine 1.17.0 → 2.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,40 @@
2
2
 
3
3
  All notable changes to the methodology engine. Versions are this **package's** npm versions;
4
4
  they are distinct from the **deployment-lineage** stamp written into a project's `docs/ai/`
5
- (which tracks the shared `agent-workflow` lineage, head `2.0.0`).
5
+ (which tracks the shared `agent-workflow` lineage, head `3.0.0`).
6
+
7
+ ## 2.1.0 — the plan names the layout it is about to create (AD-091)
8
+
9
+ The authoring canon now asks for the layout while the plan is still text: every Step that creates a
10
+ file names that file and the single responsibility it carries — and where the project declares a
11
+ source-size cap, the planned layout fits it.
12
+
13
+ - **`procedures.md` plan-authoring, Draft (step 2)** — every Step that CREATES a file names that file
14
+ and the single responsibility it carries, and **where the project declares a source-size cap**, the
15
+ planned layout fits it. The conditional is canon, not decoration: a project that declares no
16
+ practice must never be handed an invented limit.
17
+ - **`planning.md` §8 self-review checklist** — the matching line, so the draft is re-checked against
18
+ it before the plan is finalized. The line carries the canon's own rationale for asking at plan
19
+ time: "a gate that refuses an oversized file after it is written only pays for a rewrite".
20
+ - The rung lives in **plan-authoring only** — plan-execution grows no rival copy of it. Both canon
21
+ pins are enforced by the existing canon suites, including the conditional form.
22
+
23
+ ## 2.0.0 — strip-the-kit: the planning canon teaches the computed loop (AD-059)
24
+
25
+ > ### ⚠ BREAKING — the §9 "Computed instrument" canon is rewritten
26
+ >
27
+ > The review-ledger/fold-completeness vocabulary is gone from the methodology. The loop the canon
28
+ > now teaches: red-proof BEFORE a fix (`core-evidence red-proof`) · explicit per-backend degrade
29
+ > records · stage → reviews on the STAGED tree → `run-gates --final` (the ONE receipt) →
30
+ > `commit-guard --check` at the commit boundary — **no ledger records it**; the round
31
+ > tally/classification discipline stays dialogue-level.
32
+
33
+ - `planning.md` §9 rewritten to the D3 loop; `procedures.md` step 5 mirrors it; the
34
+ `orchestration.md` writer-economy clause reworded (the ledger-triad example died with the
35
+ machinery).
36
+ - The agent-rules LENS reworded in its canonical home; the OUTGOING pre-strip body is appended to
37
+ `agent-rules-lens-priors.md` verbatim (the AD-041 vintage contract — priors are append-only
38
+ history).
6
39
 
7
40
  ## 1.17.0 — Prompt-economy canon gains a writer-batch clause + two sandbox-lane sentences (REPORT-FACTS train D5/D6, AD-054)
8
41
 
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: agent-workflow-engine
3
3
  description: Canonical home of the agent-workflow planning methodology — the Plan→Phase→Step→Substep vocabulary, plan lifecycle, queue.md series index, mandatory Cleanup phase, the bounded methodology slot fragment, the orchestration-recipe vocabulary (Solo / Reviewed / Council / Delegated), and the activity-procedures canon (plan-authoring / plan-execution, with typed recipe slots). A published, installable npm package (available:true) that *provides* the methodology text; it mutates nothing. The composition root (agent-workflow-kit) reads this canon LIVE from the installed engine and injects the bounded slots from it — one source of truth, no bundled mirror; `npx @sabaiway/agent-workflow-kit@latest init` installs the engine.
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '1.17.0'
6
+ version: '2.1.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-engine
package/bin/install.mjs CHANGED
@@ -14,7 +14,7 @@
14
14
  // not a project deploy and not a model-invoked skill — there is nothing to "run"
15
15
  // inside an agent.
16
16
  //
17
- // No telemetry, no phone-home. Dependency-free, Node >= 18.
17
+ // No telemetry, no phone-home. Dependency-free, Node >= 22.
18
18
 
19
19
  import { readFile, mkdir, readdir, copyFile, lstat, readlink, symlink } from 'node:fs/promises';
20
20
  import { existsSync, lstatSync, realpathSync } from 'node:fs';
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-engine",
5
5
  "kind": "methodology-engine",
6
- "version": "1.17.0",
6
+ "version": "2.1.0",
7
7
  "available": true,
8
8
  "provides": ["plan"],
9
9
  "roles": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-engine",
3
- "version": "1.17.0",
3
+ "version": "2.1.0",
4
4
  "description": "Canonical home of the agent-workflow planning methodology — the Plan→Phase→Step vocabulary, plan lifecycle, queue.md series index, and mandatory Cleanup phase, consumed by the kit (composition root). The methodology engine of the agent-workflow family.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -40,7 +40,7 @@
40
40
  "references/"
41
41
  ],
42
42
  "engines": {
43
- "node": ">=18"
43
+ "node": ">=22"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
@@ -110,3 +110,20 @@ Apply these when authoring a plan, reviewing, folding a finding, or editing code
110
110
  - **Recipe fidelity.** Council runs every backend the recipe names, **every round**; silently dropping a ready backend for quota/convenience is a forbidden downgrade — an unavailable backend is a LOUD, stated degrade, never a quiet drop.
111
111
  - **ExitPlanMode ≠ execute.** A harness "approved — start coding" prompt authorizes the PLAN only; this methodology overrides it. Continue into execution only as a DELIBERATE transition after the plan + cold-start prompt exist, never an implicit slide.
112
112
  - **Cost lanes.** Route every step to the **cheapest adequate executor** — L0 deterministic script (the batched gate matrix over `gates.json`, the rotation `--check`s) · L1 cheap subagent (extraction/drafting only; the orchestrator verifies) · L2 subscription bridge · L3 frontier judgment. A step with **no named guardrail does not move down** a lane, and the **red lines never move down** (council review models · real code · ADR/handover/changelog-entry wording · persuasive copy · go/no-go · the approval asks). Own-error repair: salvage recorded state first (L0/L1, batched), never frontier re-derivation. **Prompt economy:** read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator's own shell form is ONE plain pipeline per call (a `;`/`&&` chain or env-prefixed invocation never matches a prefix allow rule); a fan-out launcher that gates per call yields to the agent-spawn lane — capability-gated: without restricted-tool vehicles (generic full-tool spawning does not count), read-only research stays in the orchestrator's own context, never a vehicle mandate a host cannot satisfy. Judgment, code, synthesis stay at the frontier lane (a task that genuinely runs/writes keeps a full-tool subagent); honest limit: no deterministic gate classifies a dispatch — canon at the point of use + placed vehicles + the retro loop.
113
+
114
+
115
+ <!-- prior: 2026-07-17 (strip-the-kit) → pre-strip outgoing — the fragment as of the strip landing (the writer-economy clause still named the ledger-triad batched write) -->
116
+ ### 2.x. Planning, review & process-fidelity invariants
117
+ Apply these when authoring a plan, reviewing, folding a finding, or editing code — the layer read **before any code change**. (Full canon: the project's planning / workflow-methodology + orchestration canon. This section is rendered from that canon and refreshed on upgrade; a custom edit is preserved verbatim, but flagged.)
118
+ - **Fold by code, not prose.** Before folding a code-touching finding into a plan or change, read the cited `file:line` and cite it — a prose fold drifts from the code and seeds the next bug.
119
+ - **Right altitude.** Pin intent + invariants + acceptance criteria (named tests); leave fine code-mechanics to Execute, where prose cannot diverge from reality.
120
+ - **No code-mechanics in the plan.** A Step still carries its exact paths + commands (the plan-structure / self-review canon) — checked syntax: the plan's own Verification runs them against an explicit expected outcome or gate; the only other syntax a plan may carry is a literal fixture/schema fragment a named test copies or validates. Un-run, logic-bearing syntax — control-flow, a regex, a glob, a grammar, an algorithm body, a mini-DSL — never lives in plan prose, however plausible or shell-verified it looks: a fold or draft that wants one is the trigger to write the test instead.
121
+ - **Test-as-spec.** Fold a code-touching finding into a red→green TEST, not a prose paragraph — the gate is the only deterministic checker; a paragraph cannot self-check.
122
+ - **Characterize-first.** Before editing UNCOVERED code, pin its current behavior in a green test, then edit — any unintended change goes red. Never edit what has no checker; first give it one. Keep edits atomic/reversible; prefer SUBTRACTIVE folds.
123
+ - **Fold minimally — prose has no checker.** An ephemeral, gitignored plan is prose with no executable checker; fold **minimally, in ONE place** and run a **self-consistency** read across the plan before every re-review — a fold that drifts several prose spots is what turns a 2-round review into churn.
124
+ - **Heavy review at the diff.** Plan-review settles architecture only (≤2 rounds, stop at the pre-existing→fold-induced crossover); the exhaustive per-Step review runs against real compiling code + the full suite, where a regression fails a gate immediately. **Backend divergence** (one backend grounded-ships while another keeps revising mechanics) IS that crossover — resolve at altitude, don't exhaust the strictest backend; route an all-mechanics/CI or prose-only artifact to a **thin plan + diff-review**.
125
+ - **Convergence bar.** A review loop is CLEAN only when one round returns **0 blockers + 0 majors** from EVERY backend the recipe names (nits + a ship verdict is the stop). Folding ≠ convergence — re-review after folding.
126
+ - **Per-round emission.** Every review round emits **{round N · finding-origin tally · per-backend verdict}** so the crossover is a computed, visible signal, not a remembered rule.
127
+ - **Recipe fidelity.** Council runs every backend the recipe names, **every round**; silently dropping a ready backend for quota/convenience is a forbidden downgrade — an unavailable backend is a LOUD, stated degrade, never a quiet drop.
128
+ - **ExitPlanMode ≠ execute.** A harness "approved — start coding" prompt authorizes the PLAN only; this methodology overrides it. Continue into execution only as a DELIBERATE transition after the plan + cold-start prompt exist, never an implicit slide.
129
+ - **Cost lanes.** Route every step to the **cheapest adequate executor** — L0 deterministic script (the batched gate matrix over `gates.json`, the rotation `--check`s) · L1 cheap subagent (extraction/drafting only; the orchestrator verifies) · L2 subscription bridge · L3 frontier judgment. A step with **no named guardrail does not move down** a lane, and the **red lines never move down** (council review models · real code · ADR/handover/changelog-entry wording · persuasive copy · go/no-go · the approval asks). Own-error repair: salvage recorded state first (L0/L1, batched), never frontier re-derivation. **Prompt economy:** read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator's own shell form is ONE plain pipeline per call (a `;`/`&&` chain or env-prefixed invocation never matches a prefix allow rule); a fan-out launcher that gates per call yields to the agent-spawn lane — capability-gated: without restricted-tool vehicles (generic full-tool spawning does not count), read-only research stays in the orchestrator's own context, never a vehicle mandate a host cannot satisfy. Judgment, code, synthesis stay at the frontier lane (a task that genuinely runs/writes keeps a full-tool subagent); honest limit: no deterministic gate classifies a dispatch — canon at the point of use + placed vehicles + the retro loop. **Writer economy:** a stage's repeated WRITER commands batch into ONE invocation — the review-ledger triad rides one batched write, other stage writers combine via one launcher per stage; never one writer call at a time (each write is its own prompt).
@@ -11,4 +11,4 @@ Apply these when authoring a plan, reviewing, folding a finding, or editing code
11
11
  - **Per-round emission.** Every review round emits **{round N · finding-origin tally · per-backend verdict}** so the crossover is a computed, visible signal, not a remembered rule.
12
12
  - **Recipe fidelity.** Council runs every backend the recipe names, **every round**; silently dropping a ready backend for quota/convenience is a forbidden downgrade — an unavailable backend is a LOUD, stated degrade, never a quiet drop.
13
13
  - **ExitPlanMode ≠ execute.** A harness "approved — start coding" prompt authorizes the PLAN only; this methodology overrides it. Continue into execution only as a DELIBERATE transition after the plan + cold-start prompt exist, never an implicit slide.
14
- - **Cost lanes.** Route every step to the **cheapest adequate executor** — L0 deterministic script (the batched gate matrix over `gates.json`, the rotation `--check`s) · L1 cheap subagent (extraction/drafting only; the orchestrator verifies) · L2 subscription bridge · L3 frontier judgment. A step with **no named guardrail does not move down** a lane, and the **red lines never move down** (council review models · real code · ADR/handover/changelog-entry wording · persuasive copy · go/no-go · the approval asks). Own-error repair: salvage recorded state first (L0/L1, batched), never frontier re-derivation. **Prompt economy:** read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator's own shell form is ONE plain pipeline per call (a `;`/`&&` chain or env-prefixed invocation never matches a prefix allow rule); a fan-out launcher that gates per call yields to the agent-spawn lane — capability-gated: without restricted-tool vehicles (generic full-tool spawning does not count), read-only research stays in the orchestrator's own context, never a vehicle mandate a host cannot satisfy. Judgment, code, synthesis stay at the frontier lane (a task that genuinely runs/writes keeps a full-tool subagent); honest limit: no deterministic gate classifies a dispatch — canon at the point of use + placed vehicles + the retro loop. **Writer economy:** a stage's repeated WRITER commands batch into ONE invocation the review-ledger triad rides one batched write, other stage writers combine via one launcher per stage; never one writer call at a time (each write is its own prompt).
14
+ - **Cost lanes.** Route every step to the **cheapest adequate executor** — L0 deterministic script (the batched gate matrix over `gates.json`, the rotation `--check`s) · L1 cheap subagent (extraction/drafting only; the orchestrator verifies) · L2 subscription bridge · L3 frontier judgment. A step with **no named guardrail does not move down** a lane, and the **red lines never move down** (council review models · real code · ADR/handover/changelog-entry wording · persuasive copy · go/no-go · the approval asks). Own-error repair: salvage recorded state first (L0/L1, batched), never frontier re-derivation. **Prompt economy:** read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator's own shell form is ONE plain pipeline per call (a `;`/`&&` chain or env-prefixed invocation never matches a prefix allow rule); a fan-out launcher that gates per call yields to the agent-spawn lane — capability-gated: without restricted-tool vehicles (generic full-tool spawning does not count), read-only research stays in the orchestrator's own context, never a vehicle mandate a host cannot satisfy. Judgment, code, synthesis stay at the frontier lane (a task that genuinely runs/writes keeps a full-tool subagent); honest limit: no deterministic gate classifies a dispatch — canon at the point of use + placed vehicles + the retro loop. **Writer economy:** a stage's repeated WRITER commands batch evidence declarations ride consecutive plain invocations of ONE allow-listed tool, other stage writers combine via one launcher per stage; never an unbatched writer scatter (each gated write is its own prompt).
@@ -144,16 +144,16 @@ zero-prompt bar prefer the agent-spawn lane with placed vehicles. This clause is
144
144
  vehicles, use them; WITHOUT restricted-tool vehicles — whether or not generic full-tool spawning
145
145
  exists — read-only research stays in the orchestrator's own context —
146
146
  never a vehicle mandate a host cannot satisfy. **(d)** a stage that fires repeated WRITER commands
147
- batches them — the review-ledger triad (records / classifications / overrides) rides ONE batched
148
- write, and the remaining stage writers combine via one launcher per stage; never
149
- one writer call at a time (each write is its own prompt). The clause narrows
147
+ batches them — a stage's evidence declarations (red-proofs, degrades) ride consecutive plain
148
+ writer invocations of ONE allow-listed tool, and the remaining stage writers combine via one
149
+ launcher per stage; never an unbatched writer scatter (each gated write is its own prompt). The clause narrows
150
150
  TOOLS for read-only work only — judgment, code, and synthesis stay at the frontier lane, and a
151
151
  task that genuinely needs to run or write keeps a full-tool subagent. **Honest limit:**
152
152
  no deterministic gate classifies a dispatch — enforcement is this canon at the point of use,
153
153
  the placed vehicles, and the retro loop.
154
154
 
155
155
  **Sandbox lanes.** Under an OS sandbox the lanes split once more by **surface class**: the L0
156
- surfaces are **sandbox-safe** (gate/ledger/state/fold checks, git reads, plain no-network tests);
156
+ surfaces are **sandbox-safe** (gate/state/coverage checks, git reads, plain no-network tests);
157
157
  the bridge wrappers are **genuinely unsandboxed** (they need network); npm-cache-touching commands
158
158
  are **COMMAND-SHAPE dependent** — first try the sandbox-safe shape (cache under `$TMPDIR`,
159
159
  offline/notifier off) before moving anything out. Two driving rules: **move ONLY the failing
@@ -104,6 +104,7 @@ A harness "approved — you can now start coding" prompt (e.g. Claude Code's **E
104
104
  ## 8. Self-review checklist (before finalizing a Plan)
105
105
 
106
106
  - Every Step has exact file paths and exact commands.
107
+ - Every Step that CREATES a file names that file and its single responsibility; where the project declares a source-size cap, the planned layout fits it (no declared cap → no invented limit). Deciding the layout here is the cheap lever — a gate that refuses an oversized file after it is written only pays for a rewrite.
107
108
  - Every recommendation that used to live outside the Plan is now a Step (§5).
108
109
  - Vocabulary is strict (§1); the Plan ends with **Phase N: Cleanup** (§4).
109
110
  - If part of a series: `queue.md` is initialised / updated (§3).
@@ -133,7 +134,7 @@ These disciplines keep a plan converging instead of churning, and keep a fold or
133
134
 
134
135
  **Convergence heuristic.** When a review round keeps finding code-mechanism issues on a stable architecture, STOP refining prose — either raise the spec to invariant + acceptance altitude, or hand the mechanics to Execute. Do not re-litigate code mechanics in the plan.
135
136
 
136
- **Computed instrument (plan-execution).** The **review-ledger** computes the crossover-stop for the plan-execution (code) loop: each round and each triage classification **fixable-bug** (a fold pinned by a red→green test) / **inherent-layer-residual** (raised to an acceptance criterion) / **escalate** (a maintainer decision) is recorded, and the stop decision is READ from the ledger, never remembered; its `--check` is the loop's gate (the exit contract lives in the tool's own header — point, don't restate). The same per-round tally + classification discipline governs plan-authoring review; the ledger itself is plan-execution-scoped.
137
+ **Computed instrument (plan-execution).** The plan-execution (code) loop's stop is READ from the four deterministic checks + the ship receipts, never remembered: declare each bugfix red BEFORE the fix (`core-evidence red-proof` an observed N/N red with content custody); an unavailable review backend gets an explicit `core-evidence degrade` record, never a silent skip; then stage everything, run the configured reviews on the STAGED tree, and mint the ONE receipt with `run-gates --final` (coverage of every changed executable line + red-proof verification ride the final run); `commit-guard --check` gates the commit against that receipt — any later edit re-stales it (the exit contracts live in each tool's own header — point, don't restate); `core-evidence summary` renders the loop state statelessly. The per-round finding-origin tally + triage classification discipline **fixable-bug** (a fold pinned by a red→green test) / **inherent-layer-residual** (raised to an acceptance criterion) / **escalate** (a maintainer decision) — stays the dialogue-level discipline for BOTH activities; no ledger records it.
137
138
 
138
139
  ## 10. Autonomy at the plan checkpoints
139
140
 
@@ -50,9 +50,16 @@ Produce a self-contained, cold-readable plan, reviewed to the configured depth b
50
50
 
51
51
  1. **Research** — gather the exact files, contracts, and constraints the plan will touch.
52
52
  2. **Draft** — write the plan to the document structure defined in [`planning.md`](planning.md) §7,
53
- with exact paths and commands per Step. Bind to that structure; do not restate it here.
53
+ with exact paths and commands per Step. Bind to that structure; do not restate it here. Name the
54
+ LAYOUT as you draft: every Step that CREATES a file names that file and the single responsibility
55
+ it carries, and — **when the project declares a source-size cap** (the composition root's
56
+ `procedures` advisor prints the declared practice; a project that declares none carries no limit
57
+ to invent) — the planned layout fits that cap. Scope fixed before any code exists is what keeps a
58
+ module small; a size gate is only the backstop.
54
59
  3. **Self-review** — run the [`planning.md`](planning.md) §8 checklist (exact paths/commands, strict
55
- vocabulary, every out-of-plan recommendation folded into a Step, `queue.md` updated for a series).
60
+ vocabulary, every created file named with its single responsibility (fitting the declared cap
61
+ where there is one), every out-of-plan recommendation folded into a Step, `queue.md` updated for a
62
+ series).
56
63
  Apply the [`planning.md`](planning.md) §9 lens — fold by code (read and cite the `file:line`), and
57
64
  hold the right altitude.
58
65
  4. **review {recipe}** — review the draft at the depth the resolved `review` recipe selects: Solo
@@ -116,9 +123,10 @@ Execute an approved plan Step by Step; each Step is one logical commit.
116
123
  **{round N · finding-origin tally · per-backend verdict}**; when backends diverge, that is the
117
124
  crossover — resolve at altitude, not by exhausting the strictest backend. Classify survivors at the
118
125
  cap the same way (**fixable-bug / inherent-layer-residual / escalate**). This loop's computed
119
- instrument is the **review-ledger**: record each round + triage, read the stop from its `--status`
120
- render (it replaces the hand-composed tally), and wire `review-ledger --check` as the gate the
121
- exit contract lives in the tool's own header, never restated here.
126
+ instruments: `core-evidence red-proof` declares each bugfix red BEFORE the fix; `core-evidence
127
+ degrade` records an unavailable backend explicitly; the reviews run on the STAGED tree and
128
+ `run-gates --final` mints the ONE receipt `commit-guard --check` gates the commit against — the
129
+ exit contracts live in each tool's own header, never restated here.
122
130
  6. **Gates** — run the project's verification gate (tests + checks) to green before committing.
123
131
  7. **Commit boundary** — the orchestrator makes the single commit for the Step; a backend never
124
132
  commits. The project's commit-approval policy (e.g. ask first) lives in the project's own rules.