@sabaiway/agent-workflow-memory 3.2.0 → 4.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
@@ -4,6 +4,120 @@ 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 `3.0.0`).
6
6
 
7
+ ## 4.1.0 — the ADR rotation carries your inbound links with it (AD-087)
8
+
9
+ Rotating `decisions.md` used to be a link-breaking event: `archive-decisions.mjs` moved ADR
10
+ blocks out of the HOT window into per-record `adr/` files while every `decisions.md#ad-NNN…`
11
+ link elsewhere in your `docs/ai/` kept pointing at a heading that was no longer there — and
12
+ neither `--check` nor `--dry-run` would say a word about it. One deployed project measured 114
13
+ such inbound anchors (23 aimed at the first tier a rotation would move) and had raised its HOT
14
+ cap twice specifically so the rotation never runs. A safety valve nobody dares open is not
15
+ shipped; this release makes the crossing carry its links:
16
+
17
+ - **Rotate and `--migrate --apply` rewrite inbound links.** Every non-fenced
18
+ `decisions.md#ad-NNN…` link under `docs/ai/` whose id is in the moved set is rewritten to the
19
+ record file. The heading-slug fragment is preserved — each record holds the verbatim
20
+ `## AD-NNN — title` block, so the same anchor resolves — and the leading relative prefix
21
+ survives (`adr/` is a sibling of `decisions.md`). Migrate additionally rewrites links into
22
+ the retired monolith archives it deletes, each target computed relative to its linking file.
23
+ - **A conservation invariant guards every rewrite.** The rewrite set is computed and verified
24
+ before the run's first write: every moved-id link rewritten, every other byte identical,
25
+ per-file and total matched-link counts equal before and after — any mismatch exits 1 with
26
+ nothing written.
27
+ - **The write order is pinned crash-safe:** records → inbound rewrites → HOT rewrite / monolith
28
+ removal. Every interrupted intermediate state re-runs to completion; previously a crash after
29
+ the HOT write re-ran as «nothing to rotate» with the orphans permanent.
30
+ - **`--check` now proves reference integrity.** A `decisions.md#ad-NNN…` anchor whose id has
31
+ left the HOT window (stale even when the id exists as an archived record) and an
32
+ `adr/AD-NNN-….md` link naming no existing record file both fail exit 1, every violation
33
+ listed with `file:line`. A tree with matches but no ADR substrate fails too; the early SKIP
34
+ remains only for trees with zero matches.
35
+ - **`--dry-run` prints the rewrite set** (`file:line`, old target → new target) alongside the
36
+ move set and writes nothing; plain `--migrate` prints the same summary, and
37
+ `--migrate --apply --dry-run` refuses loudly instead of silently writing.
38
+ - **Fail-closed edges, each red-tested:** a rewrite-form link targeting a moved id inside the
39
+ ADR corpus itself (HOT preamble or block, a record, a monolith tier) refuses pre-write with
40
+ `file:line` — convert the link (e.g. to `[[AD-NNN]]`) and re-run; a HOT block ABOUT to move
41
+ that itself links a retained id or carries a record-form link refuses pre-write (the verbatim
42
+ move would silently break the link from inside the record); symlinked `.md` files and
43
+ directories in the scan scope refuse loudly; an unparseable scanned file (unclosed fence)
44
+ aborts either write path before any write; a stale two-pass snapshot refuses instead of
45
+ rewriting from old bytes.
46
+
47
+ **Stated limitations:** the scan is line-scoped (a link hand-wrapped across a line break is not
48
+ matched — the same accepted residual as the preamble contract), inline code is not tracked (a
49
+ backtick-wrapped link counts as live), and YAML frontmatter is opaque metadata — a link inside
50
+ it is neither rewritten nor checked, and is preserved byte-exactly on every write. The boundary
51
+ is `docs/ai/` — links in README or agent entry points outside it are neither rewritten nor
52
+ checked.
53
+
54
+ **Upgrading:** the tool itself has nothing to reconfigure — the rewrite is additive, and on a
55
+ healthy tree whose links resolve the new assertions stay green. **Reaching your deployment:** a
56
+ fresh Node-project bootstrap through the memory 4.1.0 skill — or a clean-layout upgrade where
57
+ the pair is entirely absent — copies the fixed pair from this package (a No-Node project skips
58
+ the scripts; a legacy-monolith layout goes through the consented migration ask); a normal
59
+ upgrade of an already-deployed pair preserves it byte-for-byte (local edits are never
60
+ clobbered — drift repair belongs to a lineage migration), so an existing deployment is NOT
61
+ auto-refreshed by this release; a verified drift-safe refresh lane is queued family work. If
62
+ `--check` then reports a `dead ADR anchor` or `dead ADR record link`, those are real orphans it
63
+ found — each line names the file, line and dead target; fix or remove the link, or re-point it
64
+ at an existing `adr/` record (or the `[[AD-NNN]]` form); with the links live, rotation is safe
65
+ to run again, so a cap raised only to avoid it can come back down. Any other `--check` red
66
+ carries its own printed diagnosis.
67
+
68
+ ## 4.0.0 — the archivers stop reporting green on files they did not understand (AD-084)
69
+
70
+ > ### ⚠ BREAKING — the rotation gates fail CLOSED now
71
+ >
72
+ > A `--check` that silently passed over unparseable content now **refuses with `file:line` and a
73
+ > remedy**. If your changelog carries a malformed date heading, an issue claims resolution without
74
+ > a recognisable date, or one section carries both an open `Status:` and a dated `Resolved:` line,
75
+ > the gate goes red — that red is the fix arriving, not a regression. Every refusal message names
76
+ > exactly what to change. Nothing is ever rewritten on a refused input.
77
+
78
+ For years the failure mode of these scripts was a **green lie**: a changelog gate that printed
79
+ `OK` over a file it parsed nothing from (one real deployment passed 36 consecutive sessions
80
+ unparsed), and an issues gate that reported `archivable: 0` while nine resolved sections aged in
81
+ place and the file crept to one line under its cap. This release ends the class, not the instance:
82
+
83
+ - **One shared block tokenizer** (`references/scripts/markdown-blocks.mjs`, NEW): frontmatter,
84
+ fenced regions, heading tokens outside fences; CRLF-safe; an unclosed fence is a loud error.
85
+ All three archivers read through it — a structural test refuses any future raw-line scan.
86
+ - **Fail-closed contract, all three archivers:** every unit-shaped heading either parses or
87
+ refuses naming `file:line`; every verdict names the counts it acted on; a zero-unit outcome is
88
+ a stated decision; every reading mode refuses identically and **writes nothing** on refusal.
89
+ - **ISO dates are first-class:** `## YYYY-MM-DD — title` entry headings parse everywhere the
90
+ legacy dotted form does; each entry re-emits in its **source form, verbatim**. Write ISO; the
91
+ dotted archives keep working untouched.
92
+ - **The issues marker contract:** a resolved issue is recognised by a line-leading
93
+ `- **Resolved:** YYYY-MM-DD …` or `- **Status:** … FIXED (YYYY-MM-DD) …` field — the shapes
94
+ real files use, list prefix optional, emphasis/emoji variants read, both separators, strict
95
+ calendar validation (the old code accepted `2026.02.30` — JS Date silently rolls it into
96
+ March). Strikethrough is cosmetic in BOTH directions: the dated marker decides alone, and an
97
+ explicit open `Status:` keeps a reopened-but-still-struck issue open. A resolution claim
98
+ **without** a recognisable date, a struck heading with an unrecognised status word, and
99
+ contradictory open+resolved state all refuse loudly instead of being skipped forever. The
100
+ exact pre-4.0.0 template example section stays inert, so a pristine legacy deployment never
101
+ reds its own gate.
102
+ - **The issues section model conserves your file:** category headings (`## 🟢 Resolved`), the
103
+ preamble and the canonical closing footer belong to the FILE and survive rotation; an issue
104
+ section contains only its own issue; rewrites are verbatim, guarded by an element-wise
105
+ partition tripwire and a line-accounting conservation test. (Previously the first real
106
+ rotation would have carried the category heading and footer into the archive and deleted them
107
+ from your file.) Stated residual: a **reworded or localized** closing note is not recognised
108
+ as the footer and travels with the last archived issue into the archive — conserved and
109
+ recoverable, never lost.
110
+ - **The templates stopped contradicting the parsers:** the changelog seed teaches ISO on both
111
+ `{{DATE}}` consumers; the known-issues template teaches ONE resolved shape inside a fenced
112
+ sample in the file preamble, so neither a fresh project nor a section inserted under a
113
+ category can ever red or lose the teaching text.
114
+
115
+ **Upgrading:** run your three `--check` gates once. If they refuse, the message names the line
116
+ and the remedy (typically: add the missing resolution date, repair a malformed date heading, or
117
+ delete the stale half of an open+resolved contradiction). The new `markdown-blocks.mjs` rides
118
+ every deploy path — old-layout projects get it companion-seeded by the kit's
119
+ `migrate-adr-store --apply`.
120
+
7
121
  ## 3.2.0 — the ADR rotation can be asked whether a seed is safe, without seeding (AD-083)
8
122
 
9
123
  `archive-decisions.mjs --write-navigator` now honours `--dry-run`. It runs exactly the checks the
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: '3.2.0'
6
+ version: '4.1.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-memory
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-memory",
5
5
  "kind": "memory-substrate",
6
- "version": "3.2.0",
6
+ "version": "4.1.0",
7
7
  "provides": ["context"],
8
8
  "roles": {},
9
9
  "detect": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-memory",
3
- "version": "3.2.0",
3
+ "version": "4.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",