@sabaiway/agent-workflow-memory 1.12.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 +65 -1
- package/README.md +6 -5
- package/SKILL.md +69 -45
- package/bin/install.mjs +32 -0
- package/capability.json +1 -1
- package/migrations/README.md +1 -1
- package/migrations/legacy-stamp-takeover.md +3 -3
- package/package.json +1 -1
- package/references/scripts/archive-decisions.mjs +705 -320
- package/references/scripts/archive-decisions.test.mjs +652 -312
- package/references/scripts/check-docs-size.mjs +35 -5
- package/references/scripts/check-docs-size.test.mjs +55 -0
- package/references/templates/AGENTS.md +2 -1
- package/references/templates/adr/log.md +25 -0
- package/references/templates/adr-record.md +72 -0
- package/references/templates/autonomy.json +3 -0
- package/references/templates/decisions.md +7 -18
- package/scripts/stamp-takeover.mjs +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the memory substrate. Versions are this **package's** npm versions;
|
|
4
4
|
they are distinct from the **deployment-lineage** stamp written into a project's
|
|
5
|
-
`docs/ai/.memory-version` (which tracks the shared `agent-workflow` lineage, head `
|
|
5
|
+
`docs/ai/.memory-version` (which tracks the shared `agent-workflow` lineage, head `2.0.0`).
|
|
6
|
+
|
|
7
|
+
## 2.1.0 — Autonomy template seed (AD-044 Plan 4)
|
|
8
|
+
|
|
9
|
+
A **feature** release (ships with kit 1.45.0 / engine 1.15.0; the deployment lineage head stays
|
|
10
|
+
`2.0.0` — the seed is ensure-if-missing, stamp-independent). `references/templates/autonomy.json`
|
|
11
|
+
— the sparse, defaults-equivalent autonomy-policy seed (`_README` only): resolving it equals
|
|
12
|
+
resolving no file at all, TEST-PINNED, so the seed can never drift from the computed defaults
|
|
13
|
+
(commit/push/publish `ask`; network/credentials/fs-outside-repo `deny`; absent activities floor at
|
|
14
|
+
`prompt`); it is STRUCTURALLY a seed (meta keys only) — an explicit policy declaring the same
|
|
15
|
+
values reads as a real declaration on every kit surface. Lifecycle follows gates.json: bootstrap
|
|
16
|
+
seeds it, upgrade ensures-if-missing (byte-preserving), hand-editable; the kit mirrors it via the
|
|
17
|
+
template manifest. Tarball sentinel 43→44. Deliberately NOT a delegated-bootstrap required asset
|
|
18
|
+
(the AD-044 Plan-3 no-gate decision holds).
|
|
19
|
+
|
|
20
|
+
## 2.0.0 — One-file-per-ADR store: the 3-tier decisions cascade retired (AD-051)
|
|
21
|
+
|
|
22
|
+
A **MAJOR** release (BREAKING; co-released with the workflow kit 1.42.0). The deployment-lineage
|
|
23
|
+
head bumps `1.3.0` → `2.0.0` — the first structural `docs/ai` change (a new `docs/ai/adr/` tree;
|
|
24
|
+
the WARM/COLD decisions-archive monolith tiers retired). **Nothing auto-migrates:** an existing
|
|
25
|
+
deployment keeps working on its old layout, old rotator included, until it opts in (below).
|
|
26
|
+
|
|
27
|
+
**Breaking.**
|
|
28
|
+
- `references/scripts/archive-decisions.mjs` is REPURPOSED in place (same path, same pre-commit
|
|
29
|
+
hook slot, same `decisions-rotation` gate id): instead of rotating HOT `decisions.md` → WARM
|
|
30
|
+
`history/decisions-archive.md` → a single COLD monolith whose cap was raised release after
|
|
31
|
+
release, the rotator now EXPLODES the oldest ADRs beyond the HOT cap into one immutable MADR
|
|
32
|
+
record per ADR at `docs/ai/adr/AD-NNN-slug.md` (body verbatim; inline 6-field frontmatter +
|
|
33
|
+
`status`/`date`/`supersedes`/`supersededBy` lifecycle keys; slug frozen at creation). A record
|
|
34
|
+
is O(1) forever — no archive cap is ever raised again, and there is no COLD tier to exhaust.
|
|
35
|
+
- A default or `--check` run that finds a legacy `history/decisions-archive*.md` monolith fails
|
|
36
|
+
LOUD ("run `--migrate` first") — the new rotator never half-explodes an un-migrated tree and
|
|
37
|
+
never reports green over one.
|
|
38
|
+
- The ADR id grammar widens to `AD-\d{3,}` with NUMERIC ordering everywhere (AD-200 precedes
|
|
39
|
+
AD-1000 — never lexical).
|
|
40
|
+
|
|
41
|
+
**Migration (opt-in, never automatic).**
|
|
42
|
+
- The one-time `--migrate` (dry-run by default; `--migrate --apply` to write) explodes the
|
|
43
|
+
monolith tiers into `adr/` records under a fail-loud conservation check: the full ADR corpus —
|
|
44
|
+
the union HOT ∪ monolith tiers ∪ any already-written `adr/` records (the crash-resumable core;
|
|
45
|
+
a same-id BODY CONFLICT across sources is refused) — must repartition EXACTLY into retained-HOT
|
|
46
|
+
∪ written records, nothing lost, added, double-counted, or edited. Before any destructive write
|
|
47
|
+
it stores a durable timestamped snapshot of `decisions.md` + both monoliths into the GIT DIR
|
|
48
|
+
(a stated out-of-tree fallback on a non-git deployment; fails loud if neither is writable).
|
|
49
|
+
`docs/ai` is commonly git-ignored, so git history alone can NOT recover a deleted monolith —
|
|
50
|
+
the snapshot is the recovery path. The apply is idempotent and crash-resumable; removal never
|
|
51
|
+
precedes conservation + the snapshot.
|
|
52
|
+
- On an upgrade crossing this major, `bin/install.mjs` prints a GENERIC one-time advisory: run
|
|
53
|
+
your workflow toolkit's ADR-store migration command in each already-deployed project (it
|
|
54
|
+
snapshots, refreshes the enforcement scripts, and migrates in one consent-gated step). This
|
|
55
|
+
installer targets the global skill dir and never touches a project itself.
|
|
56
|
+
|
|
57
|
+
**New.**
|
|
58
|
+
- `docs/ai/adr/log.md` — the ON-DEMAND active-set navigator: currently-governing heads
|
|
59
|
+
(supersession COMPUTED corpus-wide from the two-way `supersedes`/`supersededBy` chain — a new
|
|
60
|
+
superseding ADR needs no predecessor-file edit) + a recent window; a superseded record drops out
|
|
61
|
+
of the list but stays reachable by filename, grep, and the chain. `--write-navigator`
|
|
62
|
+
regenerates it AND re-triggers the docs-index regen. No committed full O(n) ledger.
|
|
63
|
+
- `references/scripts/check-docs-size.mjs` — `docs/ai/adr/` collapses to ONE aggregate `index.md`
|
|
64
|
+
row (`adr/ — N records (AD-001 … AD-NNN)`), while every record body stays individually
|
|
65
|
+
cap-checked; `docs/ai/index.md` stays bounded at O(1) as records accumulate.
|
|
66
|
+
- Seeded templates: the new-scheme `decisions.md` HOT-window seed, the `adr-record.md` MADR
|
|
67
|
+
authoring reference (a skill-side reference — never copied into a project's `docs/ai/`), and a
|
|
68
|
+
seed `adr/log.md` byte-equal to the generator over the seeded HOT — a fresh bootstrap is
|
|
69
|
+
`--check`-green on its first commit.
|
|
6
70
|
|
|
7
71
|
## 1.12.0 — Verification-profile template + the docs-index-on-rotation regen (BUGFREE-3, AD-049)
|
|
8
72
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ future agent — including a fresh session of yourself — can reconstruct proje
|
|
|
7
7
|
~60 seconds, find the current task, and avoid repeating past mistakes.
|
|
8
8
|
|
|
9
9
|
This is the **memory layer** of the `agent-workflow` family.
|
|
10
|
-
It owns the substrate only — `docs/ai/`, the entry point, caps /
|
|
10
|
+
It owns the substrate only — `docs/ai/`, the entry point, caps / rolling changelog archive / the one-file-per-ADR store / index gate,
|
|
11
11
|
the Node enforcement scripts, the pre-commit hook, the templates, and the three setup
|
|
12
12
|
contracts (visibility / conversational language / agent attribution). It deliberately **knows
|
|
13
13
|
nobody else** in the `agent-workflow` family: the **workflow methodology** (plan → execute →
|
|
@@ -33,18 +33,19 @@ Open your agent inside a project and run the skill:
|
|
|
33
33
|
- **`/agent-workflow-memory`** — bootstrap a new or empty project. Asks the three setup
|
|
34
34
|
questions (visibility, conversational language, agent attribution), then writes `docs/ai/`,
|
|
35
35
|
`AGENTS.md`, the enforcement scripts + pre-commit hook, and stamps
|
|
36
|
-
`docs/ai/.memory-version`. The
|
|
37
|
-
**orchestration** pointers, filled later by the family composition root) are
|
|
36
|
+
`docs/ai/.memory-version`. The three pointer slots in `AGENTS.md` (the **methodology**,
|
|
37
|
+
**orchestration** and **autonomy** pointers, filled later by the family composition root) are
|
|
38
|
+
left **empty**.
|
|
38
39
|
- **`/agent-workflow-memory upgrade`** — migrate an existing deployment to the skill's current
|
|
39
40
|
version. Reads `docs/ai/.memory-version`, runs only newer migrations in semver order, and
|
|
40
|
-
**preserves** anything already in
|
|
41
|
+
**preserves** anything already in every pointer slot (extract-and-reinsert — it never
|
|
41
42
|
regenerates `AGENTS.md` wholesale).
|
|
42
43
|
|
|
43
44
|
## Stamps & lineage
|
|
44
45
|
|
|
45
46
|
Two independent axes: this package's **npm version** vs the **deployment-lineage** stamp the
|
|
46
47
|
substrate writes into a project. They are not the same number. `.memory-version` tracks the
|
|
47
|
-
shared `agent-workflow` deployment lineage (head `
|
|
48
|
+
shared `agent-workflow` deployment lineage (head `2.0.0` today), **not** this package's
|
|
48
49
|
version. A project bootstrapped by the kit's fallback carries a `.workflow-version`; when this
|
|
49
50
|
substrate is later installed, `migrations/legacy-stamp-takeover.md` copies that value verbatim
|
|
50
51
|
into `.memory-version` and never deletes the legacy stamp. See `migrations/README.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: '1.
|
|
6
|
+
version: '2.1.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-memory
|
|
@@ -14,18 +14,19 @@ reconstruct project context in ~60 seconds, find the current task, and avoid rep
|
|
|
14
14
|
mistakes.
|
|
15
15
|
|
|
16
16
|
The substrate is **stack-agnostic memory** — `docs/ai/` structure, entry-point doc, session
|
|
17
|
-
protocols, frontmatter caps,
|
|
17
|
+
protocols, frontmatter caps, one-file-per-ADR archive, index-freshness gate. Enforcement ships as **Node
|
|
18
18
|
`.mjs` scripts** (the reference implementation; non-Node stacks follow the same policy
|
|
19
19
|
manually).
|
|
20
20
|
|
|
21
21
|
This skill is the **memory layer** of the `agent-workflow` family. It **knows nobody else** in
|
|
22
22
|
the family. In particular it does **not** own the **workflow methodology** (plan → execute →
|
|
23
|
-
review vocabulary, lifecycle, `docs/plans/queue.md`, mandatory Cleanup, plan-then-execute) **
|
|
24
|
-
orchestration recipes** — those are injected into **
|
|
25
|
-
(`workflow:methodology` + `workflow:orchestration`
|
|
23
|
+
review vocabulary, lifecycle, `docs/plans/queue.md`, mandatory Cleanup, plan-then-execute), **the
|
|
24
|
+
orchestration recipes, or the autonomy-policy contract** — those are injected into **three delimited
|
|
25
|
+
pointer slots** in `AGENTS.md` (`workflow:methodology` + `workflow:orchestration` +
|
|
26
|
+
`workflow:autonomy`) by the family **composition root**, never by this
|
|
26
27
|
skill. (This substrate does not name or depend on any specific sibling — it only honours the slot
|
|
27
|
-
contract.) This skill only ever ships **
|
|
28
|
-
in them on upgrade.
|
|
28
|
+
contract.) This skill only ever ships **all three** slots **empty** and **preserves** whatever is
|
|
29
|
+
already in them on upgrade.
|
|
29
30
|
|
|
30
31
|
The substrate **artifacts** (this skill, the templates, the deployed `docs/ai/` files) stay in
|
|
31
32
|
their **source language** — for cross-agent and cross-team portability. That is separate from the
|
|
@@ -36,20 +37,22 @@ contents).
|
|
|
36
37
|
|
|
37
38
|
## Ownership table
|
|
38
39
|
|
|
39
|
-
What this substrate owns vs what it only points at. The methodology + orchestration
|
|
40
|
-
**
|
|
40
|
+
What this substrate owns vs what it only points at. The methodology + orchestration + autonomy
|
|
41
|
+
pointers are the **three empty slots** the composition root fills — never author that text here.
|
|
41
42
|
|
|
42
43
|
| Concern | Owner | In the deployed `AGENTS.md` |
|
|
43
44
|
|---|---|---|
|
|
44
45
|
| Entry point, Memory Map, session protocols (Start / During / Complete) | **memory** (this skill) | authored from templates |
|
|
45
|
-
| `docs/ai/` files, frontmatter caps,
|
|
46
|
+
| `docs/ai/` files, frontmatter caps, one-file-per-ADR archive, index-freshness gate | **memory** | `docs/ai/*` + scripts + hook |
|
|
46
47
|
| Visibility / conversational-language / agent-attribution contracts | **memory** | the three `AGENTS.md` blocks |
|
|
47
48
|
| Deployment-lineage stamp | **memory** | `docs/ai/.memory-version` |
|
|
48
49
|
| Plan→Phase→Step vocabulary, lifecycle, `queue.md`, mandatory Cleanup | **methodology** (not this skill) | the empty `workflow:methodology` slot — filled by the composition root |
|
|
49
50
|
| Orchestration recipes (Solo / Reviewed / Council / Delegated) | **methodology engine** (not this skill) | the empty `workflow:orchestration` slot — filled by the composition root |
|
|
51
|
+
| Autonomy-policy read contract (`docs/ai/autonomy.json`) | **methodology engine** (not this skill) | the empty `workflow:autonomy` slot — filled by the composition root |
|
|
50
52
|
| Per-project recipe **CONFIG** (which recipe each activity/slot uses) | **memory** seeds an *editable default* | `docs/ai/orchestration.json` (agent-writable via the composition root's `set-recipe` writer, or hand-edited; the recipe **canon** + the slot **vocabulary** live in the engine / composition root, never here) |
|
|
51
53
|
| Per-project **gate declaration** (which verification commands must be green) | **memory** seeds an *editable default* | `docs/ai/gates.json` (hand-editable; an empty list as shipped — the project declares its own commands; the **runner** lives in the composition root, never here) |
|
|
52
54
|
| Per-project **verification profile** (optional; the fold-completeness language-independence contract) | **memory** seeds an *editable default* | `docs/ai/verification-profile.json` (hand-editable; the seeded default reproduces the composition root's default V8 + node:test behaviour — delete it for exactly that; declares coverage source / single-test format / optional SARIF path; the **runner** lives in the composition root, never here) |
|
|
55
|
+
| Per-project **autonomy policy** (red-lines + per-activity autonomy level) | **memory** seeds an *editable default* | `docs/ai/autonomy.json` (hand-editable, or agent-writable via the composition root's `set-autonomy` writer; the seed is SPARSE — the onboarding note only, defaults-equivalent, so deploying it never changes behavior; the policy **canon** + the render live in the engine / composition root, never here) |
|
|
53
56
|
|
|
54
57
|
---
|
|
55
58
|
|
|
@@ -97,17 +100,22 @@ bootstrapping over a live system, but the user makes the final call.
|
|
|
97
100
|
5. **Entry-point doc.** If `AGENTS.md` / `CLAUDE.md` already exist (recon), do **not**
|
|
98
101
|
overwrite — show the user and ask whether to merge or replace. Otherwise create `AGENTS.md`
|
|
99
102
|
from `${CLAUDE_SKILL_DIR}/references/templates/AGENTS.md` and symlink `CLAUDE.md -> AGENTS.md`
|
|
100
|
-
(`ln -s AGENTS.md CLAUDE.md`). **Leave
|
|
101
|
-
`workflow:orchestration`) exactly as shipped — empty.** Filling them is the
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
(`ln -s AGENTS.md CLAUDE.md`). **Leave ALL THREE pointer slots (`workflow:methodology` +
|
|
104
|
+
`workflow:orchestration` + `workflow:autonomy`) exactly as shipped — empty.** Filling them is the
|
|
105
|
+
composition root's job.
|
|
106
|
+
6. **Deploy `docs/ai/`.** Create the files + `pages/` + the seed `adr/` store from
|
|
107
|
+
`${CLAUDE_SKILL_DIR}/references/templates/` (every non-`AGENTS.md`, non-`adr-record.md` template —
|
|
108
|
+
the latter is a skill-home authoring reference, never deployed). This deploys the HOT ADR window
|
|
109
|
+
`docs/ai/decisions.md` **and** the seed navigator `docs/ai/adr/log.md` (its `adr/` subdir copies
|
|
110
|
+
in wholesale), plus the four seeded, **user-editable** strict-JSON configs:
|
|
111
|
+
`docs/ai/orchestration.json` — the per-project recipe defaults the composition root's `procedures`
|
|
112
|
+
advisor reads — `docs/ai/gates.json` — the project's gate declaration, an empty list to fill with
|
|
113
|
+
its own verification commands, consumed by the composition root's gate runner —
|
|
114
|
+
`docs/ai/verification-profile.json` — the OPTIONAL fold-completeness verification profile (the
|
|
115
|
+
language-independence contract; the seeded default reproduces the composition root's default V8 +
|
|
116
|
+
node:test behaviour, delete it for exactly that) — and `docs/ai/autonomy.json` — the per-project
|
|
117
|
+
autonomy policy, seeded SPARSE (the onboarding note only, defaults-equivalent — behavior changes
|
|
118
|
+
only when the user declares levels). Keep each `.md` file's frontmatter.
|
|
111
119
|
7. **Fill templates** per the table below.
|
|
112
120
|
8. **Install enforcement (Node projects).** Copy `${CLAUDE_SKILL_DIR}/references/scripts/*.mjs`
|
|
113
121
|
(+ `*.test.mjs`) into the project's `scripts/`. **No Node runtime** → skip this + the hook;
|
|
@@ -120,7 +128,7 @@ bootstrapping over a live system, but the user makes the final call.
|
|
|
120
128
|
append-only (never duplicate an existing line), then **verify `git status` shows them ignored**.
|
|
121
129
|
Never the machine-global excludes; never edit `package.json`.
|
|
122
130
|
10. **Stamp the deployment lineage.** Write the **deployment-lineage head** into
|
|
123
|
-
`docs/ai/.memory-version` (one semver line). The lineage head is **`
|
|
131
|
+
`docs/ai/.memory-version` (one semver line). The lineage head is **`2.0.0`** (the
|
|
124
132
|
`LINEAGE_HEAD` constant in `scripts/stamp-takeover.mjs`) — the shared `agent-workflow`
|
|
125
133
|
lineage, a **separate axis** from this package's npm version (the two may even coincide by
|
|
126
134
|
accident; see *Stamp = lineage head, not package version*). Use the atomic writer in
|
|
@@ -134,7 +142,7 @@ bootstrapping over a live system, but the user makes the final call.
|
|
|
134
142
|
> upgrade**, do the write steps (bootstrap 1–10 / upgrade 1–7: write `docs/ai/` + `AGENTS.md` +
|
|
135
143
|
> `.memory-version`, **including seeding / stamp-independently ensuring `docs/ai/orchestration.json`**)
|
|
136
144
|
> but **do NOT** run **any** commit gate and **do NOT** ask to commit — the
|
|
137
|
-
> composition root owns the **single** commit gate, raised after it injects the
|
|
145
|
+
> composition root owns the **single** commit gate, raised after it injects the three pointer slots.
|
|
138
146
|
> The three setup answers and the target dir are passed in by the composition root; you perform no
|
|
139
147
|
> commit and no slot injection. **Standalone** invocation keeps its own commit gate (bootstrap step
|
|
140
148
|
> 11 / upgrade step 7).
|
|
@@ -146,7 +154,8 @@ Fill strategy:
|
|
|
146
154
|
| `current_state.md`, `architecture.md`, `env_commands.md`, `technical_specification.md`, `pages/index.md` | Fill with **real** recon data. |
|
|
147
155
|
| `tech_reference.md` | Carry over real configs/patterns found in deps. |
|
|
148
156
|
| `active_plan.md`, `handover.md` | TODO seed. |
|
|
149
|
-
| `decisions.md` |
|
|
157
|
+
| `decisions.md` | The HOT ADR window — seed `AD-001` (adopting this memory system), newest at the bottom. |
|
|
158
|
+
| `adr/log.md` | The seed navigator — deployed as-is (the generator over the seeded HOT); regenerated by `archive-decisions.mjs`, never hand-edited. |
|
|
150
159
|
| `known_issues.md`, `changelog.md`, `pages/shared-patterns.md` | Empty template / first bootstrap entry. |
|
|
151
160
|
|
|
152
161
|
### Mode: upgrade
|
|
@@ -158,7 +167,7 @@ Fill strategy:
|
|
|
158
167
|
`scripts/stamp-takeover.mjs` decides the action per state; the Markdown migration is the
|
|
159
168
|
no-Node manual fallback. If **no** stamp exists at all, offer a conservative re-bootstrap.
|
|
160
169
|
2. **Never-downgrade gate FIRST, then the stamp-independent hidden-mode reconcile (D14).** Compare the
|
|
161
|
-
stamp to the **deployment-lineage head** (`LINEAGE_HEAD`, `
|
|
170
|
+
stamp to the **deployment-lineage head** (`LINEAGE_HEAD`, `2.0.0`). **Greater than the head, or
|
|
162
171
|
unparseable → STOP and report immediately, before ANY write** (never downgrade or guess, and never
|
|
163
172
|
touch `.git/info/exclude`). This STOP is one of the only two places the number is shown (see
|
|
164
173
|
*Version disclosure* below): tell the user **the `docs/ai` structure version** their deployment
|
|
@@ -175,8 +184,9 @@ Fill strategy:
|
|
|
175
184
|
**untracked AND not ignored** → **AMBIGUOUS** → **ASK** the user before writing. This visibility check
|
|
176
185
|
runs on **every** in-range upgrade, even at head — it is not gated by the stamp delta, but it is gated
|
|
177
186
|
**behind** the never-downgrade STOP above. **Also stamp-independent (same gate, before the equal-head
|
|
178
|
-
short-circuit): ensure the
|
|
179
|
-
`docs/ai/gates.json`,
|
|
187
|
+
short-circuit): ensure the FOUR seeded `.json` configs** — for `docs/ai/orchestration.json`,
|
|
188
|
+
`docs/ai/gates.json`, `docs/ai/verification-profile.json`, AND `docs/ai/autonomy.json`,
|
|
189
|
+
**create the file from its
|
|
180
190
|
`${CLAUDE_SKILL_DIR}/references/templates/` template if missing**, **preserve it byte-for-byte
|
|
181
191
|
if it already exists** (a user may have edited it; never clobber it). The shipped
|
|
182
192
|
`orchestration.json` template's `_README` already frames that config as agent-writable (set it
|
|
@@ -184,17 +194,29 @@ Fill strategy:
|
|
|
184
194
|
declaration (what to verify — consumed by the composition root's gate runner);
|
|
185
195
|
`verification-profile.json` is the OPTIONAL fold-completeness verification profile — the seeded
|
|
186
196
|
default reproduces the composition root's default V8 + node:test behaviour, so a project deletes
|
|
187
|
-
it to fall back to exactly that, or edits it for another language/runner.
|
|
197
|
+
it to fall back to exactly that, or edits it for another language/runner; `autonomy.json` is the
|
|
198
|
+
per-project autonomy policy, seeded SPARSE (the onboarding note only, defaults-equivalent —
|
|
199
|
+
agent-writable via the composition root's `set-autonomy` writer, hand-editing supported). (Refreshing the
|
|
188
200
|
orchestration `_README` note in place on an existing file is the **composition root's** job on
|
|
189
201
|
its own reconcile — this substrate is standalone and only seeds-or-preserves; it owns no
|
|
190
202
|
cross-package refresh helper. The gates declaration gets no note-refresh at all — authored
|
|
191
|
-
content, seed-or-preserve only.) This is why an equal-head (`
|
|
203
|
+
content, seed-or-preserve only.) This is why an equal-head (`2.0.0`) deployment still gains the
|
|
192
204
|
config seeds **without a lineage-head bump or a migration file** (the
|
|
193
205
|
stamp-independent-reconcile precedent — like the pointer slots + the hidden-mode footprint).
|
|
194
|
-
**Same gate, also stamp-independent: ensure the ADR-
|
|
206
|
+
**Same gate, also stamp-independent: ensure the ADR-store enforcement pair** — copy
|
|
195
207
|
`archive-decisions.mjs` + `archive-decisions.test.mjs` from
|
|
196
208
|
`${CLAUDE_SKILL_DIR}/references/scripts/` into the project's `scripts/` **if missing**
|
|
197
|
-
(preserve an existing file byte-for-byte; skip on a No-Node project).
|
|
209
|
+
(preserve an existing file byte-for-byte; skip on a No-Node project). **Legacy-monolith
|
|
210
|
+
gate:** if a retired `docs/ai/history/decisions-archive*.md` monolith is still on disk, do
|
|
211
|
+
**NOT** copy the pair as a silent ensure — the new-scheme rotator must **never sit beside
|
|
212
|
+
un-migrated monoliths** (its default/`--check` runs refuse such a tree). Instead ASK the
|
|
213
|
+
user; with their explicit consent copy the pair AND run the one-time conservation-checked
|
|
214
|
+
migration in the same step (`node scripts/archive-decisions.mjs --migrate` preview, then
|
|
215
|
+
`--migrate --apply` — it writes a durable pre-delete snapshot first); if the preview or the
|
|
216
|
+
apply FAILS, remove the just-copied pair (the pair was copied only because it was missing, so
|
|
217
|
+
removal restores the exact pre-ensure state) and report — the forbidden state (the new-scheme
|
|
218
|
+
rotator beside un-migrated monoliths) must never persist; without consent leave
|
|
219
|
+
the tree untouched and report the pending migration. The deployed pre-commit
|
|
198
220
|
hook gains its `archive-decisions.mjs --check` line only when the hook is next refreshed via
|
|
199
221
|
`node scripts/install-git-hooks.mjs`; an old hook without the line stays consistent-safe (the
|
|
200
222
|
decisions gate is simply not enforced yet — never a broken hook). **Then**, if the stamp **equals** the head → the substrate is
|
|
@@ -219,12 +241,13 @@ Fill strategy:
|
|
|
219
241
|
(`migrations/1.1.0-communication-language.md`); pre-1.2.0 with no *Attribution* block, ask +
|
|
220
242
|
insert defaulting to `off` (`migrations/1.2.0-agent-attribution.md`). (An answer already
|
|
221
243
|
collected by the step-4 batched prompt is carried in — never re-asked here.)
|
|
222
|
-
6. **Preserve
|
|
223
|
-
`workflow:orchestration` markers, **never regenerate the file
|
|
224
|
-
between each pair and reinsert them unchanged. If a pair is
|
|
225
|
-
gracefully **no-op** on that slot (adding a slot to
|
|
226
|
-
root's reconcile, not this substrate's job). On any
|
|
227
|
-
nested, or duplicate pair), **no-op with an error** —
|
|
244
|
+
6. **Preserve ALL pointer slots.** If `AGENTS.md` has the `workflow:methodology`,
|
|
245
|
+
`workflow:orchestration` and/or `workflow:autonomy` markers, **never regenerate the file
|
|
246
|
+
wholesale** — extract any bytes between each pair and reinsert them unchanged. If a pair is
|
|
247
|
+
absent (a legacy `AGENTS.md`), gracefully **no-op** on that slot (adding a slot to
|
|
248
|
+
already-deployed files is the composition root's reconcile, not this substrate's job). On any
|
|
249
|
+
malformed marker state (single, reversed, nested, or duplicate pair), **no-op with an error** —
|
|
250
|
+
never edit.
|
|
228
251
|
7. **Re-stamp** `docs/ai/.memory-version` to the lineage head (atomic write — mechanics unchanged).
|
|
229
252
|
Report changes **in plain human terms** (which parts of the deployment are now different);
|
|
230
253
|
**omit the raw structure number**, and do not recite the two-axes note here (it belongs to
|
|
@@ -264,11 +287,11 @@ memory substrate has none, so it relies on the STOP + the explicit ask — never
|
|
|
264
287
|
- **Source vs target directory.** Templates/scripts are read from the skill's own dir; the
|
|
265
288
|
**working directory is the target project** — never write substrate files back into the skill.
|
|
266
289
|
- **Stamp = lineage head, not package version.** `.memory-version` carries the **deployment-lineage
|
|
267
|
-
head** (`
|
|
290
|
+
head** (`2.0.0`, the shared `agent-workflow` lineage) — a **separate axis** from this package's npm
|
|
268
291
|
version (the two may even coincide by accident). They move independently.
|
|
269
|
-
- **
|
|
270
|
-
text into them; on upgrade, preserve their content byte-for-byte. The
|
|
271
|
-
writer.
|
|
292
|
+
- **All three pointer slots ship empty and stay the user's.** Never author methodology,
|
|
293
|
+
orchestration or autonomy text into them; on upgrade, preserve their content byte-for-byte. The
|
|
294
|
+
composition root is their only writer.
|
|
272
295
|
- **The `Co-Authored-By` trailer is added by the harness, not by prose.** When attribution is
|
|
273
296
|
`off` + Claude Code, also set `"includeCoAuthoredBy": false` in `.claude/settings.json`.
|
|
274
297
|
- **Hidden mode is project-local, never machine-global.** Memory's hide writes to the repo's
|
|
@@ -294,11 +317,12 @@ The three setup choices each have a full contract in
|
|
|
294
317
|
## References
|
|
295
318
|
|
|
296
319
|
- [`references/contracts.md`](references/contracts.md) — the three setup contracts in full.
|
|
297
|
-
- [`references/templates/`](references/templates/) — stack-agnostic `AGENTS.md` (with the
|
|
298
|
-
pointer slots — methodology + orchestration), `agent_rules.md`, the seeded user-editable
|
|
299
|
-
`orchestration.json`
|
|
320
|
+
- [`references/templates/`](references/templates/) — stack-agnostic `AGENTS.md` (with the three empty
|
|
321
|
+
pointer slots — methodology + orchestration + autonomy), `agent_rules.md`, the seeded user-editable
|
|
322
|
+
`orchestration.json` + `autonomy.json` configs, the `adr-record.md` ADR authoring reference + the
|
|
323
|
+
seed `adr/log.md` navigator, and all `docs/ai/` files to deploy.
|
|
300
324
|
- [`references/scripts/`](references/scripts/) — the Node enforcement scripts (caps + staleness +
|
|
301
|
-
index-freshness gate,
|
|
325
|
+
index-freshness gate, one-file-per-ADR archive, hook installer) and their unit tests.
|
|
302
326
|
- [`scripts/stamp-takeover.mjs`](scripts/stamp-takeover.mjs) — the upgrade-time lineage state
|
|
303
327
|
machine (`LINEAGE_HEAD`, atomic stamp writes) + tests.
|
|
304
328
|
- [`migrations/`](migrations/) — per-version upgrade steps, incl. `legacy-stamp-takeover.md`;
|
package/bin/install.mjs
CHANGED
|
@@ -71,6 +71,36 @@ const compareSemver = (a, b) => {
|
|
|
71
71
|
return firstDiff ?? 0;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
// The memory major that retired the 3-tier ADR cascade for the one-file-per-ADR store (AD-051).
|
|
75
|
+
const ADR_STORE_MAJOR = 2;
|
|
76
|
+
|
|
77
|
+
// A GENERIC, project-agnostic advisory is printed exactly once — when this runner crosses UP through
|
|
78
|
+
// the ADR-store major (installed below it → runner at or above it). The memory installer targets the
|
|
79
|
+
// GLOBAL skill dir and knows nothing about any project (the knows-nobody DAG), so it can never DETECT
|
|
80
|
+
// an old-layout deployment and must NEVER name a sibling package or a kit command — the kit's
|
|
81
|
+
// project-dir-aware surfaces (status / upgrade / the migration mode) own detection + the concrete
|
|
82
|
+
// command. A fresh install (installed === null) advises nothing (no prior deployment to migrate).
|
|
83
|
+
export const shouldAdviseAdrMigration = (installedVersion, runnerVersion) => {
|
|
84
|
+
const from = parseSemver(installedVersion);
|
|
85
|
+
const to = parseSemver(runnerVersion);
|
|
86
|
+
if (!from || !to) return false;
|
|
87
|
+
return from[0] < ADR_STORE_MAJOR && to[0] >= ADR_STORE_MAJOR;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// The advisory text is GENERIC and names NO sibling package or kit command (the knows-nobody DAG);
|
|
91
|
+
// the kit's project-aware surfaces own old-layout detection + the concrete migration command.
|
|
92
|
+
const ADR_MIGRATION_ADVISORY =
|
|
93
|
+
`[agent-workflow-memory] note: this major retired the 3-tier ADR archive for a one-file-per-ADR store.\n` +
|
|
94
|
+
` A project you already deployed on the OLDER decisions-archive layout must be migrated before its\n` +
|
|
95
|
+
` ADR rotation works again — run your workflow toolkit's ADR-store migration command in that project\n` +
|
|
96
|
+
` (its status/upgrade points you at it). New deployments already seed the new store.`;
|
|
97
|
+
|
|
98
|
+
// Print the advisory exactly on a major-crossing update (AD-051). Pure over an injectable log so the
|
|
99
|
+
// crossing path is unit-testable in-process (main runs only as a subprocess).
|
|
100
|
+
export const maybeAdviseAdrMigration = (installedVersion, runnerVersion, log = console.log) => {
|
|
101
|
+
if (shouldAdviseAdrMigration(installedVersion, runnerVersion)) log(ADR_MIGRATION_ADVISORY);
|
|
102
|
+
};
|
|
103
|
+
|
|
74
104
|
// Extract the version that is a DIRECT child of the top-level `metadata:` key — never a top-level or
|
|
75
105
|
// deeper-nested decoy `version:` (mirrors the manifest validator + the kit installer). Pure walk.
|
|
76
106
|
const metadataVersion = (frontmatter) => {
|
|
@@ -256,6 +286,8 @@ const main = async () => {
|
|
|
256
286
|
: 'installed';
|
|
257
287
|
console.log(`[agent-workflow-memory] ${verb} v${version} -> ${tildify(target)}`);
|
|
258
288
|
|
|
289
|
+
maybeAdviseAdrMigration(installedVersion, version); // generic major-crossing ADR-store advisory (AD-051)
|
|
290
|
+
|
|
259
291
|
// Same-version re-run: state observable facts only. The copy DID run (repair-on-rerun is a feature —
|
|
260
292
|
// it restores locally modified/deleted files), and whether npx served a cached build is NOT
|
|
261
293
|
// observable here (no network), so the note never claims it; the @latest hint is conditional.
|
package/capability.json
CHANGED
package/migrations/README.md
CHANGED
|
@@ -13,7 +13,7 @@ releases add files/templates, which `upgrade` reconciles without a migration.
|
|
|
13
13
|
`.memory-version` verbatim — see that migration.
|
|
14
14
|
2. Select every migration whose `<version>` is **strictly newer** than the stamp.
|
|
15
15
|
3. Apply them in **ascending semver order**.
|
|
16
|
-
4. Re-stamp `docs/ai/.memory-version` to the deployment-lineage head (`
|
|
16
|
+
4. Re-stamp `docs/ai/.memory-version` to the deployment-lineage head (`2.0.0` today — the shared
|
|
17
17
|
lineage sequence, **not** this package's npm version). The legacy `.workflow-version`, if present,
|
|
18
18
|
is never deleted.
|
|
19
19
|
|
|
@@ -13,13 +13,13 @@ any other migration.
|
|
|
13
13
|
|
|
14
14
|
The deployment stamp moved from `.workflow-version` (owned by the kit) to `.memory-version`
|
|
15
15
|
(owned by this substrate). They track the **same** shared deployment-lineage sequence — never
|
|
16
|
-
their package versions. The current lineage head is **`
|
|
16
|
+
their package versions. The current lineage head is **`2.0.0`** (`LINEAGE_HEAD`). This migration
|
|
17
17
|
adopts an existing legacy stamp into the new file **without** changing the lineage value and
|
|
18
18
|
**without** deleting the legacy stamp (both may coexist; each tool migrates from its own stamp).
|
|
19
19
|
|
|
20
20
|
## State table (idempotent)
|
|
21
21
|
|
|
22
|
-
Look at `docs/ai/` and act by row. `V` is the legacy stamp's value; `head` = `
|
|
22
|
+
Look at `docs/ai/` and act by row. `V` is the legacy stamp's value; `head` = `2.0.0`.
|
|
23
23
|
|
|
24
24
|
| `docs/ai/` state | Action |
|
|
25
25
|
|---|---|
|
|
@@ -42,7 +42,7 @@ Look at `docs/ai/` and act by row. `V` is the legacy stamp's value; `head` = `1.
|
|
|
42
42
|
done
|
|
43
43
|
```
|
|
44
44
|
2. **Validate** each value that exists: it must be `MAJOR.MINOR.PATCH`, non-empty, and **not** greater
|
|
45
|
-
than `
|
|
45
|
+
than `2.0.0`. If any present stamp is empty, unparseable, or in the future → **STOP and report**;
|
|
46
46
|
do nothing else.
|
|
47
47
|
3. **Apply** the matching row above. For the "only `.workflow-version=V`" row, copy verbatim and
|
|
48
48
|
write **atomically** — create an exclusive randomized temp in `docs/ai/` (so a planted temp-name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-memory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|