Skip to content

Commit fb86dad

Browse files
authored
Merge pull request #29 from Accenture/agent-memory-v4.41.0
chore(agent-memory): upgrade 4.40.1 → 4.41.0 — [undeclared-reference]: a fact edited without being declared
2 parents 6ca6dc8 + c869dd8 commit fb86dad

14 files changed

Lines changed: 762 additions & 14 deletions

File tree

‎.agent/schema.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ What the next agent needs to know.
232232
- Referenced: <continuity fact ids this session relied on / reinforced>
233233
- Created: <new fact ids added this session (born tier: working)>
234234
- Reactivated: <fact ids pulled back from the archive>
235+
- Closed: <thread ids completed this session — the close record is the completion event (or list them under Referenced with a (closed) note)>
235236
- Superseded: <old-id → new-id, or old-id (invalidated) — facts made false this session; see DECAY.md §9>
236237
```
237238

‎.agent/version.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
> Mode B can detect drift and upgrade in place (see the tool's `UPGRADE.md`).
55
> `version` gates the upgrade ladder — don't hand-edit it unless you mean to.
66
7-
- **version:** 4.40.1
7+
- **version:** 4.41.0
88
- **enabled_with:** 4.38.0
9-
- **last_upgraded:** 2026-09-17
9+
- **last_upgraded:** 2026-09-18
1010
- **mode:** A

‎.githooks/README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ The dispatcher contract itself is covered by `tests/test_githook_dispatchers.sh`
7777
you understand those implications: a committed, human-audited **`.agent/secret-scan-ignore`**
7878
(shell-glob per line, `#` comments; exempts config files only, never `memory/`). The tool has
7979
not seeded that file since v4.40.1 — a team that needs the hatch creates it deliberately, and
80-
the guard says so each time it exempts a file. Runs on python3 or node, whichever exists —
80+
the guard says so each time it exempts a file. (v4.41.0) The fragment also runs the advisory
81+
`[undeclared-reference]` check: a memory fact edited in the commit must be declared in a session log
82+
staged with it — otherwise `refresh-metadata` reads the edit as non-use; never blocks, silent when no
83+
log is staged. Runs on python3 or node, whichever exists —
8184
with neither, it skips with a note. Why it exists: the ritual rule covers agents at write time
8285
and the CI floor covers pushes, but by push time the remote already has the secret and redaction
8386
is not un-leaking (rotation is) — this is the **one placement that prevents instead of detects**

‎.githooks/pre-commit.d/50-agent-memory-secret-guard‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
# not seeded that file since v4.40.1; a team that needs the hatch creates it deliberately. Activated by the same `git config core.hooksPath
3434
# .githooks` as post-commit (init.sh — no new setup). The tool runs nothing itself — git
3535
# invokes this in your env at your opt-in (`no-build-step-agent-run`). Bash 3.2-compatible.
36+
#
37+
# (v4.41.0) A second, ADVISORY check rides along: a memory fact edited in this commit must be declared
38+
# in a session log staged with it — otherwise refresh-metadata reads the edit as non-use and the fact
39+
# decays while in active use (field report: two Blueprint gaps a human had just closed at the closure
40+
# gate were proposed for sweeping hours later). It intersects the staged diff with the staged logs —
41+
# footer-only lines, condensed closed records, verbatim moves and deletions never count. Never
42+
# blocks; silent when no session log is staged (a tooling-only commit is legitimate).
3643

3744
[ -f memory/continuity.md ] || exit 0 # only act in an agent-memory repo
3845
git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1 && exit 0 # skip merge commits
@@ -78,6 +85,16 @@ else
7885
exit 0
7986
fi
8087

88+
# [undeclared-reference] (v4.41.0, advisory): fact edits staged without a declaring session log.
89+
if [ -n "$staged_mem" ]; then
90+
undeclared="$("$RUNTIME" "$SCRIPT" --staged 2>/dev/null | grep -F '[undeclared-reference]' || true)"
91+
if [ -n "$undeclared" ]; then
92+
echo "agent-memory pre-commit (advisory): memory facts edited in this commit are not declared in the staged session log —" >&2
93+
printf '%s\n' "$undeclared" >&2
94+
echo " -> add each id to the log's '## Memory References' (an edit or a closure is a use; inspecting alone is not). Commit proceeds." >&2
95+
fi
96+
fi
97+
8198
# Mirror the staged blobs (index content, not the worktree) into a temp tree so the linter's
8299
# report paths match the real repo paths; the hook consumes only [secret-material] lines
83100
# (script-owned result — the same pattern as the forge CI wrappers).

‎.github/workflows/agent-memory.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,23 @@ jobs:
8585
else
8686
echo "config secret scan: ok"
8787
fi
88+
89+
- name: undeclared-reference check (advisory, v4.41.0)
90+
run: |
91+
# Push-time sibling of the pre-commit advisory: a memory fact edited in this push/PR must be
92+
# declared in a session log added or changed in the same range — otherwise refresh-metadata
93+
# reads the edit as non-use and the fact decays while in active use. Silent when the range
94+
# adds no session log. Catches --no-verify bypasses and clones without local hooks.
95+
[ -f agent-skills/memory-lint/scripts/memory-lint.py ] || { echo "memory-lint not installed; skipping."; exit 0; }
96+
base="${{ github.event.pull_request.base.sha }}"
97+
[ -n "$base" ] || base="${{ github.event.before }}"
98+
case "$base" in ''|0000000000000000000000000000000000000000) base="$(git rev-parse --verify --quiet HEAD~1 2>/dev/null || echo '')";; esac
99+
[ -n "$base" ] || { echo "no base ref; skipping undeclared-reference check"; exit 0; }
100+
git cat-file -e "$base^{commit}" 2>/dev/null || { echo "base $base not in the checkout; skipping."; exit 0; }
101+
out="$(python3 agent-skills/memory-lint/scripts/memory-lint.py --range "$base" HEAD 2>/dev/null | grep -F '[undeclared-reference]' || true)"
102+
if [ -n "$out" ]; then
103+
printf '%s\n' "$out"
104+
echo "::warning title=agent-memory undeclared reference::a memory fact was edited without being declared in a staged session log (see log above) — add the id to '## Memory References'"
105+
else
106+
echo "undeclared-reference check: ok"
107+
fi

‎DECAY.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ Every session log carries a `## Memory References` section:
7575
- **Referenced** — ids the session relied on or reinforced.
7676
- **Created** — new facts added this session (born `tier: working`).
7777
- **Reactivated** — ids pulled back from the archive.
78+
- **Closed** — threads completed this session (v4.41.0): list them under `Referenced` with a
79+
`(closed)` note or on a `Closed:` line. The close record is the completion event that starts
80+
the sweep clock; an edit or a closure is a use, inspecting alone is not.
81+
82+
The pre-commit `memory-lint` advisory `[undeclared-reference]` (v4.41.0) warns when a change
83+
edits a fact's body without declaring the id in a session log staged with it — the diff is the
84+
only place that omission is visible, because the footers and this log then agree with each other
85+
while both are wrong.
7886

7987
So, for any id:
8088
- `uses` = number of session logs whose `## Memory References` name it.
@@ -163,9 +171,10 @@ its completion is older than `archive_window` sessions (see `REVIEW.md`).
163171
> for closure, decided by a human**: the review lists every stalled thread in one closure gate
164172
> (`REVIEW.md` step 8); the owner closes each (a 3–6-line close record; anything undelivered is
165173
> recorded as *deliberately dropped*, never silently lost) or re-affirms it by naming it under
166-
> that session's `## Memory References` — the only thing that resets the count. The pin is
167-
> untouched throughout, and the tool never closes a thread on its own. (Field report:
168-
> mercury-composable, 2026-09-16.)
174+
> that session's `## Memory References` — the only thing that resets the count. A closure is
175+
> declared the same way: the close record is the completion event (an edit or a closure is a
176+
> use; inspecting alone is not). The pin is untouched throughout, and the tool never closes a
177+
> thread on its own. (Field reports: mercury-composable, 2026-09-16 and 2026-09-17.)
169178
>
170179
> **One lifecycle per record.** A commitment tracked *inside* another record inherits that
171180
> record's lifecycle, not its own: a "still open" sub-list inside a thread has no signal of

‎REVIEW.md‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ stalled thread as `[thread-stale]`, so the condition cannot hide.
106106
is lost — the full narrative lives in the thread's origin session log (immutable),
107107
and `[closed-thread-bloat]` is the advisory that measures this. A condensed thread
108108
later archives as its stub; retrieval follows `origin:` to the full record.
109+
**Completion age is the closing reference** (v4.41.0). A thread's close record is the completion
110+
event: the session that closes it declares the id under `## Memory References`, and
111+
`sessions_since_last_used` then measures completion age for this sweep. An `[overdue]` on a
112+
thread closed *within* the window is therefore a missed declaration, not decay — check the
113+
closing commit, declare the id retroactively in this session's log, and let the counter reset
114+
rather than sweeping a record a human just wrote (the pre-commit `[undeclared-reference]`
115+
advisory catches the omission at commit time).
109116
6. **Verify archival (required — guards against a miscounted `sessions_since_last_used`).**
110117
Archival is the costliest error, and "sessions since last used" is the easiest count to get wrong.
111118
A *"use"* is an id under a session's `## Memory References` (§2 / `DECAY.md` §2) — **not** a passing
@@ -151,7 +158,10 @@ stalled thread as `[thread-stale]`, so the condition cannot hide.
151158
undelivered is recorded as *deliberately dropped*, never silently lost — a `(blueprint)`
152159
gap closing this way is an altitude decision, `DECAY.md` §12), or **re-affirm** it (name it
153160
under *this* session's `## Memory References` with the reason it stays open — the only thing
154-
that resets its count; re-affirmation is the exception, not the default). The review
161+
that resets its count; re-affirmation is the exception, not the default). **Declare every
162+
disposition:** a closed thread is named under this session's `## Memory References` too — its
163+
close record is the completion event that starts the sweep clock (list it as closed); only
164+
*inspecting* a stalled thread without a decision is not a use. The review
155165
**never closes a thread itself** — a stalled thread is a signal for closure, and the
156166
decision is the owner's (`never-pick-a-winner`). Check the gate off once every listed
157167
thread is dispositioned; the sweep archives it later like any completed thread. If nothing
@@ -169,8 +179,11 @@ stalled thread as `[thread-stale]`, so the condition cannot hide.
169179
so archived ids belong there. *(Learned the hard way: a review summary that listed its archived ids
170180
under `## Memory References` threw 13 spurious `over-archived` ERRORs.)*
171181
**Inspecting a stalled thread as gate evidence is not a use either** — list a stalled thread
172-
here only when the human **re-affirmed** it (that entry *is* the reset, `DECAY.md` §6); the
173-
gate thread you raised is listed as Created.
182+
here when the human **acted** on it: re-affirmed (that entry *is* the reset, `DECAY.md` §6) or
183+
**closed** (the close record is the completion event — list it as closed); a thread merely read
184+
and left as it was is not listed. The gate thread you raised is listed as Created. (v4.41.0
185+
corrected the v4.40.0 wording, which named only re-affirmation and led a field session to leave
186+
two closures undeclared — `[undeclared-reference]` now catches that at commit time.)
174187

175188
**Contradiction backstop.** The review reads every fact anyway, so give them a quick
176189
contradiction scan — the write-time check (`DECAY.md` §10) may have missed one, or two

‎agent-skills/memory-lint/SKILL.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ script, so the riskiest operation is verified against observable evidence.
3232
python3 agent-skills/memory-lint/scripts/memory-lint.py # Python 3 (>= 3.8)
3333
node agent-skills/memory-lint/scripts/memory-lint.mjs # Node (>= 18)
3434
```
35-
Flags: `--strict` (also fail on warnings), `--root PATH` (point at a specific repo), and
35+
Flags: `--strict` (also fail on warnings), `--root PATH` (point at a specific repo),
36+
`--staged` / `--range BASE [HEAD]` (v4.41.0 — the `[undeclared-reference]` check over the staged
37+
index or a commit range; advisory exit 0, used by the pre-commit fragment and the CI floors), and
3638
`--scan-files FILE...` (v4.34.0 — a standalone **credential-class** `[secret-material]` scan of
3739
arbitrary config files: token shapes, credential-key assignments, Authorization headers, private
3840
keys — no PII classes, since config files legitimately carry contact emails and paths; exit 1 on
@@ -94,6 +96,15 @@ script, so the riskiest operation is verified against observable evidence.
9496
never closes a thread itself, and inspecting a stalled thread is not a use. (Field report,
9597
mercury-composable 2026-09-16: a pinned thread's "still open" items had all shipped, unnoticed
9698
for 184 sessions — pinned had come to mean unexamined.)
99+
- *advisory* — **`[undeclared-reference]`** (v4.41.0, `--staged` / `--range` only): a memory fact whose
100+
body changes in a commit must be declared in a session log staged with it — otherwise
101+
`refresh-metadata` reads the edit as non-use and the fact decays while in active use (field
102+
report: two Blueprint gaps a human had just closed were proposed for sweeping hours later; the
103+
footers and the reference log agreed, so only the diff could see it). Counted: edits, closures
104+
(`- [ ]` → `- [x]`) and new blocks in `continuity.md`, `open-threads/*.md` and `vision.md`. Not
105+
counted: footer-only lines (a metadata refresh), condensing an already-closed record (declaring it
106+
would defer its sweep), a verbatim move, a deleted block (archival). Silent when the change stages
107+
no session log. Remedy: add the id to `## Memory References`.
97108
- *advisory* — **`[secret-material]`**: credential or PII shapes in any committed memory surface —
98109
`memory/*.md`, `memory/sessions/`, **and** `memory/archive/` (where pasted output lives): known
99110
token formats (AWS / GitHub / GitLab / Slack / Google keys, private-key blocks, JWTs),

0 commit comments

Comments
 (0)