@sabaiway/agent-workflow-memory 8.1.3 → 8.1.5
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 +18 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/scripts/migrate-gates.mjs +6 -2
- package/references/scripts/migrate-gates.test.mjs +4 -0
- package/references/templates/SPEC_TEMPLATE.md +2 -1
- package/references/templates/agent_rules.md +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to the memory substrate. Versions are this **package's** npm
|
|
|
4
4
|
they are distinct from the **deployment-lineage** stamp written into a project's
|
|
5
5
|
`docs/ai/.memory-version` (which tracks the shared `agent-workflow` lineage, head `4.0.0`).
|
|
6
6
|
|
|
7
|
+
## 8.1.5 — the gate migration names the `lcovProducer` marker (AD-175)
|
|
8
|
+
|
|
9
|
+
`references/scripts/migrate-gates.mjs`: the four hints that print the paste-ready suite cmd (the
|
|
10
|
+
customized `unit-tests` recovery, the INERT row of a vendored checker, and the withheld-checker and inert-checker
|
|
11
|
+
warnings) also name the other producer form: `add "lcovProducer": true to that gate in docs/ai/gates.json`, for a suite cmd
|
|
12
|
+
that already writes the lcov in a form the migration cannot recognise. The guarded `coverage-producer canon` and
|
|
13
|
+
`checker-claim canon` regions are unchanged and stay byte-identical to the kit's. PATCH: no migration result changes.
|
|
14
|
+
|
|
15
|
+
## 8.1.4 — the templates carry the four-session story flow (AD-170)
|
|
16
|
+
|
|
17
|
+
`references/templates/agent_rules.md`: §2.6 is the engine 5.12.0 lens render (the Finding scope, Spec-first, Fold
|
|
18
|
+
minimally and Heavy review bullets name the spec review) and §2.7 Story sessions states four sessions (spec and plan,
|
|
19
|
+
tests, code, then diff review, release and record) and gives a bridge executor only work that writes new tests or
|
|
20
|
+
code; both regions stay byte-identical to the kit's copies; §2.7's one source is the kit's template, §2.6's the
|
|
21
|
+
engine's `references/agent-rules-lens.md`.
|
|
22
|
+
`references/templates/SPEC_TEMPLATE.md`: a draft spec exists at the spec review of the session that writes its plan.
|
|
23
|
+
No script changed. PATCH: only a new bootstrap's text changes.
|
|
24
|
+
|
|
7
25
|
## 8.1.3 — the ADR navigator stamps a cap it honours (AD-167)
|
|
8
26
|
|
|
9
27
|
`references/scripts/archive-decisions.mjs`: `--write-navigator` stamped `maxLines: 200` into `docs/ai/adr/log.md`
|
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: agent-workflow-memory
|
|
|
3
3
|
description: Deploy or upgrade a portable AI-agent memory substrate in any project — an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) and a structured `docs/ai/` context store with cap/archive/index enforcement. Use when the user wants to bootstrap `docs/ai/`, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-memory` / `/agent-workflow-memory upgrade`. Triggers on "set up the memory system", "deploy the AI memory here", "bootstrap docs/ai", "upgrade the memory substrate". This is the substrate only — the workflow methodology (plan→execute→review, queue, Cleanup) is owned elsewhere and injected into AGENTS.md by the family composition root.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
metadata:
|
|
6
|
-
version: '8.1.
|
|
6
|
+
version: '8.1.5'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-memory
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-memory",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.5",
|
|
4
4
|
"description": "Portable, cross-agent memory substrate for AI coding agents — an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement, deployable standalone or as part of the agent-workflow family. The memory layer of the agent-workflow family.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -461,12 +461,14 @@ export const resultingGates = (plan) => {
|
|
|
461
461
|
return [...kept, ...moved, ...added]; // move/add go LAST — the checker ends up the last declared gate
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
+
const MARKER_LANE = 'or, if your suite cmd already writes that lcov in a form this check cannot recognise, add "lcovProducer": true to that gate in docs/ai/gates.json';
|
|
465
|
+
|
|
464
466
|
// The per-entry customized recovery: a unit-tests-class entry gets the FULL canonical flag set
|
|
465
467
|
// (the intent is known — the cmd shape just cannot be verified); anything else gets the
|
|
466
468
|
// dead-tool recovery.
|
|
467
469
|
const customizedRecovery = (gate) =>
|
|
468
470
|
gate.id === 'unit-tests'
|
|
469
|
-
? `declare the canonical suite gate by hand so the coverage contract is verifiable: node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths
|
|
471
|
+
? `declare the canonical suite gate by hand so the coverage contract is verifiable: node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths> — ${MARKER_LANE}`
|
|
470
472
|
: 'remove the entry, or repoint it at a living check — the review-ledger / fold-completeness tools no longer exist.';
|
|
471
473
|
|
|
472
474
|
const warningLines = ({ customized, finalCapable, hasReviewState = finalCapable, hasProducer = false, checkerWithheld = false, canonicalCheckerInert = false, duplicateCheckers = 0, externalCoreChecks = [], reviewStateCandidate }) => {
|
|
@@ -495,7 +497,7 @@ const warningLines = ({ customized, finalCapable, hasReviewState = finalCapable,
|
|
|
495
497
|
} else if (inert && hasProducer) {
|
|
496
498
|
lines.push(' it is also INERT as declared: a gate DOES produce the lcov, but it runs AFTER this entry, so this checker reads nothing (or stale bytes) and passes while verifying nothing — a checker belongs LAST, after its producer.');
|
|
497
499
|
} else if (inert) {
|
|
498
|
-
lines.push(` it is also INERT as declared: no declared gate PRODUCES the lcov it reads, so it passes while verifying nothing — declare the suite gate: node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths
|
|
500
|
+
lines.push(` it is also INERT as declared: no declared gate PRODUCES the lcov it reads, so it passes while verifying nothing — declare the suite gate: node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths> — ${MARKER_LANE}`);
|
|
499
501
|
}
|
|
500
502
|
}
|
|
501
503
|
if (externalCoreChecks.length) {
|
|
@@ -506,12 +508,14 @@ const warningLines = ({ customized, finalCapable, hasReviewState = finalCapable,
|
|
|
506
508
|
if (checkerWithheld) {
|
|
507
509
|
lines.push(' WARNING: the canonical coverage-check gate was NOT added — no declared gate would PRODUCE the lcov it reads, and a checker with no producer passes while verifying nothing. Declare the suite gate first, then re-run this migration:');
|
|
508
510
|
lines.push(` node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths>`);
|
|
511
|
+
lines.push(` ${MARKER_LANE}, then re-run this migration`);
|
|
509
512
|
}
|
|
510
513
|
// The CANONICAL checker's inertness only. An external row's is said on the row itself above, with
|
|
511
514
|
// the edit that fits that row — this block would otherwise add a second, contradictory one.
|
|
512
515
|
if (canonicalCheckerInert) {
|
|
513
516
|
lines.push(' WARNING: the DECLARED coverage-check gate is INERT — no declared gate PRODUCES the lcov it reads, so it passes while verifying nothing. Nothing is removed for you; declare the suite gate:');
|
|
514
517
|
lines.push(` node --test ${UNIT_TESTS_COVERAGE_FLAGS} <your test paths>`);
|
|
518
|
+
lines.push(` ${MARKER_LANE}`);
|
|
515
519
|
}
|
|
516
520
|
if (duplicateCheckers > 1) {
|
|
517
521
|
lines.push(` WARNING: ${duplicateCheckers} declared gates are the canonical coverage checker — run-gates --final accepts EXACTLY ONE, so the result is NOT final-run-capable. Nothing is removed for you; keep a single checker and delete the rest by hand.`);
|
|
@@ -122,6 +122,7 @@ describe('migrate-gates — the pure migration plan', () => {
|
|
|
122
122
|
const preview = formatPreview(analysis, 'APPLY');
|
|
123
123
|
assert.match(preview, /CUSTOMIZED \(untouched\): unit-tests/);
|
|
124
124
|
assert.match(preview, /declare the canonical suite gate by hand/, 'the paste-ready recovery rides along');
|
|
125
|
+
assert.match(preview, /recovery \(apply by hand[^\n]*"lcovProducer": true/, 'the recovery names the marker as the other lane');
|
|
125
126
|
});
|
|
126
127
|
|
|
127
128
|
it('adds the coverage-check gate LAST with the RESOLVED quoted path; never a second one', () => {
|
|
@@ -143,6 +144,7 @@ describe('migrate-gates — the pure migration plan', () => {
|
|
|
143
144
|
const preview = formatPreview(analysis, 'APPLY');
|
|
144
145
|
assert.match(preview, /coverage-check/, 'the withheld checker is named');
|
|
145
146
|
assert.match(preview, /produce/i, 'the preview says WHY — no gate produces the lcov it would read');
|
|
147
|
+
assert.match(preview, /WARNING: the canonical coverage-check gate was NOT added[^\n]*\n[^\n]*\n[^\n]*"lcovProducer": true/, 'the withheld block names the marker as the other lane');
|
|
146
148
|
});
|
|
147
149
|
|
|
148
150
|
it('an ALREADY-declared checker over no producer is reported INERT, is never removed, and is not final-run-capable', () => {
|
|
@@ -154,6 +156,7 @@ describe('migrate-gates — the pure migration plan', () => {
|
|
|
154
156
|
const preview = formatPreview(analysis, 'APPLY');
|
|
155
157
|
assert.match(preview, /INERT/, 'the inert pair is named');
|
|
156
158
|
assert.match(preview, /--experimental-test-coverage/, 'the paste-ready suite cmd is carried');
|
|
159
|
+
assert.match(preview, /WARNING: the DECLARED coverage-check gate is INERT[^\n]*\n[^\n]*\n[^\n]*"lcovProducer": true/, 'the inert block names the marker as the other lane');
|
|
157
160
|
assert.doesNotMatch(preview, /already final-run-capable/);
|
|
158
161
|
});
|
|
159
162
|
|
|
@@ -352,6 +355,7 @@ describe('migrate-gates — a VENDORED core check is the tool, from a copy --kit
|
|
|
352
355
|
const absent = formatPreview(buildMigrationPlan([INSTALLED_REVIEW_STATE, vendored], KIT_TOOLS, PROJECT), 'APPLY');
|
|
353
356
|
assert.match(absent, /no declared gate PRODUCES the lcov/, 'with nothing producing, the old sentence still holds');
|
|
354
357
|
assert.match(absent, /declare the suite gate/);
|
|
358
|
+
assert.match(absent, /no declared gate PRODUCES the lcov[^\n]*"lcovProducer": true/, 'the INERT row names the marker as the other lane');
|
|
355
359
|
});
|
|
356
360
|
|
|
357
361
|
it('a mixed declaration renders ONE edit, never a removal and a reorder at once', () => {
|
|
@@ -21,7 +21,8 @@ revision: 1
|
|
|
21
21
|
## Contract
|
|
22
22
|
|
|
23
23
|
What the feature accepts and returns, stated as invariants a test can pin. A `draft` spec is authored
|
|
24
|
-
|
|
24
|
+
in the session that writes the plan landing the feature and exists at its spec review; approval of
|
|
25
|
+
that plan confirms the
|
|
25
26
|
contract (no separate stop). It becomes `live` on the plan's landing row; `revision` increments by one
|
|
26
27
|
per live contract change; `retired` on the removal row — never backwards.
|
|
27
28
|
|
|
@@ -80,15 +80,15 @@ Apply this as part of §2 before any user-facing summary:
|
|
|
80
80
|
### 2.6. Planning, review & process-fidelity invariants
|
|
81
81
|
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.)
|
|
82
82
|
- **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.
|
|
83
|
-
- **Finding scope (plan-execution) — name the invariant BEFORE the edit.** During EXECUTION only — a plan under authoring
|
|
83
|
+
- **Finding scope (plan-execution) — name the invariant BEFORE the edit.** During EXECUTION only — a spec and its plan under authoring have no shipped behaviour to call a live defect in, so the spec review carries none of this. Every finding names the invariant its fix would enforce, and where that invariant already lives decides the disposition: already an acceptance criterion of the phase → **fold here**; it would have to be ADDED → ship the **narrow fix** for the found site (red first, then green) and queue ONLY the generalization — a deferral row carries the invariant, the origin `file:line`, the narrow fix, its proof and a residual exposure declared NOT live; no correct narrow fix → **blocking**: the phase does not close, and it is **never queued**. Two bars declared before each round: a finding counts only if it changes a **WRITE/REMOVE decision** or is a false statement in shipped text; a repeat finding in one subarea **routes to SUBTRACTION**, not a fourth patch.
|
|
84
84
|
- **Right altitude.** Pin intent + invariants + acceptance criteria (named tests); leave fine code-mechanics to Execute, where prose cannot diverge from reality.
|
|
85
|
-
- **Spec-first.** A plan names its GOVERNING spec(s) — zero, one or many, one per touched spec-covered slice (the feature spec under `docs/ai/specs/`; page-only coverage governs as an ADOPTION SHIM, with Out of scope + Revision stated inline in the plan). A ZERO names the adoption state it relies on — `not adopted` (no store) or `adopting` (a store with no live contract), either with a recorded decline, or `nothing spec-covered touched` (a store with live contracts) — a bare zero is never a licence; the store's own state is what `status` and the upgrade advisor report. Each cited spec's Out of scope bounds that slice's work and the plan's non-goals restate it per slice — no global union; a cross-spec conflict is resolved by a spec revision BEFORE approval, never by silent precedence. A NEW feature's draft spec exists AT
|
|
85
|
+
- **Spec-first.** A plan names its GOVERNING spec(s) — zero, one or many, one per touched spec-covered slice (the feature spec under `docs/ai/specs/`; page-only coverage governs as an ADOPTION SHIM, with Out of scope + Revision stated inline in the plan). A ZERO names the adoption state it relies on — `not adopted` (no store) or `adopting` (a store with no live contract), either with a recorded decline, or `nothing spec-covered touched` (a store with live contracts) — a bare zero is never a licence; the store's own state is what `status` and the upgrade advisor report. Each cited spec's Out of scope bounds that slice's work and the plan's non-goals restate it per slice — no global union; a cross-spec conflict is resolved by a spec revision BEFORE approval, never by silent precedence. A NEW feature's draft spec exists AT the spec review (a `create` row); a change to a governed contract rides the plan as its proposed revision (a `modify` row); approval confirms plan and contract atomically, and the revision lands with the code. Scenario bindings are per scenario: a new scenario is `unbound` until its test lands in the same plan, and a status never regresses for an extension.
|
|
86
86
|
- **No code-mechanics in the plan.** A ledger row carries its path and anchor, and Verification carries the exact commands (the plan-shape 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.
|
|
87
87
|
- **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.
|
|
88
88
|
- **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.
|
|
89
89
|
- **State table BEFORE the guard — enumerate by PROOF, never by exclusion.** The subtraction rule above fires on a repeat finding, which is a LATE signal: by then the review has paid for each miss. The EARLY signal is structural — a decision whose input has **several independent state dimensions** (is it tracked? do the bytes still match the source? does the neighbouring file exist?). Write the table first, admit the write with **ONE conjunction of proven facts**, and funnel every other cell into a single refusal; the table is then the table-driven test. An exclusion list (`if (bad1) return; if (bad2) return;`) fails **OPEN** on the first state nobody enumerated — and "unreadable" is a state, distinct from "absent". A reviewer cannot save you here: it judges the patch in front of it and can only name the NEXT missing state, one round at a time.
|
|
90
|
-
- **Fold minimally — prose has no checker.**
|
|
91
|
-
- **Heavy review at the diff.**
|
|
90
|
+
- **Fold minimally — prose has no checker.** A spec under the spec review, like the ephemeral plan beside it, is prose with no executable checker; fold **minimally, in ONE place** and run a **self-consistency** read across the spec before every re-review — a fold that drifts several prose spots is what turns a 2-round review into churn.
|
|
91
|
+
- **Heavy review at the diff.** The spec review settles the contract and reads the plan's ledger in the same rounds (≤2 rounds, stop at the pre-existing→fold-induced crossover); the plan has no rounds of its own and is checked by its shape gate, that reading and the approval; the exhaustive review runs against the staged diff of 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**.
|
|
92
92
|
- **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.
|
|
93
93
|
- **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.
|
|
94
94
|
- **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.
|
|
@@ -96,7 +96,7 @@ Apply these when authoring a plan, reviewing, folding a finding, or editing code
|
|
|
96
96
|
- **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).
|
|
97
97
|
|
|
98
98
|
### 2.7. Story sessions
|
|
99
|
-
A story — one row of an epic's ledger, carried by one plan — runs as
|
|
99
|
+
A story — one row of an epic's ledger, carried by one plan — runs as four sessions, each step in them giving one checked result: **spec and plan** (every contract the story creates or revises and the plan's ledger beside them, checked by the spec gate, the plan-shape gate and one review of at most two rounds that reads both, then the plan's approval), **tests** (only tests, each new one failing for the reason its scenario or acceptance bullet states, or on the absence of a name the plan adds, imported inside the test; no code and no prototype), **code** (code until the tests and the pre-review gates pass; a wrong test is changed only back to what its scenario states), and **diff review, release and record** (every committable output, tracked records included, staged first, the review of the staged diff in at most two rounds, the final gates and the release where the story ships one, then the plan's Phase: Cleanup). Tests and code never share a session. A storyless plan runs the same four. **Exception — a split:** moving code and its existing cases into modules, with no new logic and no new case, is one session: a short spec (the Module list), the split, the diff review, the release, Cleanup. A bridge executor gets a task only when it writes new tests or code, from one prompt of the orchestrator; a file the orchestrator already wrote is laid down by the orchestrator, never relayed through a bridge.
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|