Repository navigation
v0.2.0 — Write audit hook & token accounting
dsh-Immunity-memory 0.2.0
本版新增写入审计 Hook、待确认候选队列与审计 token 账本。
This release adds a write-audit gate for memory mutations, a reviewable candidate queue, and per-run audit token accounting, together with entity keys, provenance, and supersedes.
Highlights
- Write-audit hook (
hook.*, default off): everymemory_write/memory_updateis reviewed by a tool-less isolated subagent against the user's turn, with enforce vs shadow mode, a confidence threshold, and fail-open behavior on timeout, missing services, or audit-storage errors. - Candidate queue: low-confidence and
needs_userdecisions wait in the audit tab. Approving a pending candidate applies the exact reviewed payload; rejecting it leaves the existing memory untouched. - Token accounting: input, output, cache-read, cache-write, and total tokens are recorded per run and aggregated on the audit page, including the session-persistence fallback for real subagent activations.
- Entity keys, provenance, and supersedes: same-key writes update in place,
quotekeeps the user's exact wording,turnrecords where it came from, andsupersedesarchives older versions without injecting them again. - Hardened approval path: concurrent decisions are serialized, a crash-recovered candidate is adopted instead of duplicated, long candidate content survives approval intact, and rejecting an update candidate no longer archives the untouched target.
Upgrade notes
- Existing SQLite databases migrate automatically; no manual step is required.
- The hook stays disabled by default. Enable it in Settings → Write audit, then choose enforce or shadow mode.
ttlDaysis still mandatory for every mutable write and update; this release does not weaken the hard TTL rule.- The technical plugin id is still
dsh-memory-plugin; existing installs and tool names are unchanged.
Verification
node scripts/check.mjspasses: syntax, engine 48, audit 12, tools 14, search 10, SQLite 13, native 6, Go service 12, engine×Go 8, API 21, render 21.- Live reload verified: Go storage engine, 10 memory tools, hook off, pending candidates 0, audit token KPI populated.
- Full changelog: https://github.com/theBeautifulIce/dsh-Immunity-memory/blob/main/CHANGELOG.md
- Compare: v0.1.0...v0.2.0