Local-first 🧠memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.
Variant 1: TS-core authority, dumb provider
- Approach: Keep
provider.pya pure pass-through: surface theinterruptedkwarg as an explicit field on the bridge payload and forward both themessageslist and thesession-transcript.jsonlpath, but make no capture decisions in Python. All new behaviour — interrupted-end reconciliation, resume de-dup, and the post-compaction survival audit — lands as new/extended modules undersrc/core/brain(a newpost-compact-audit.tsmirroringpre-compact-extract.ts, plusinterruptedhandling insidesession-lifecycle.ts). One CLI verb gains the flag; the deterministic core owns all logic and all dedupe. - Trade-offs:
- Pro: Single deterministic, unit-testable locus; honours "core is LLM-free" and keeps the Python shim trivial and fail-soft by construction.
- Pro: Survival audit sits naturally beside the symmetric
extractPreCompactRecords, sharing the continuity store and[KIND, sessionId, contentHash]key. - Con: Widens the bridge payload contract and pushes interrupted-transcript bytes across the boundary even when the flag is absent (mitigated by an off-by-default field).
- Con: Larger TS surface to land in one PR; three concerns touch the same lifecycle file.
- Complexity: medium
- Risk: low
Variant 2: Minimal seam-reuse, three independent diffs
- Approach: Treat the three tasks as three small additive diffs against existing seams, introducing no new abstraction.
interruptedbecomes an optionalNormalizedPayloadfield consumed by the existing SessionEnd branch, reusingresolveSessionLineagefor resume detection and the existing dedupe key to suppress re-capture; the/exittask is a verification-plus-deletion of the local poll workaround inprovider.py; the survival audit is a new post-compaction CLI verb that reusespre-compress-pack.tsread primitives andreadPinnedContextplus the bounded drift log. Each ships behind its own absent-by-default field/flag. - Trade-offs:
- Pro: Smallest possible diff per task; byte-identical when flags/fields absent, matching repo conventions exactly.
- Pro: Maximally reuses named existing substrates (dedupe key, lineage, symmetric pre-compact pass) the grounding calls out, lowering double-count and regression risk.
- Pro: Each task is independently reviewable and revertible within the shared branch.
- Con: No unifying model means interrupted-end, clean-end, and audit paths stay three parallel code paths — some duplicated idempotency reasoning.
- Con: The honest-surfacing of an un-honourable
interruptedflag is handled ad hoc per path rather than centrally.
- Complexity: small
- Risk: low
Variant 3: Unified continuity-event pipeline with idempotency ledger
- Approach: Introduce a single
SessionContinuityEventabstraction that normalizes interrupted-end, clean-end, and post-compaction-survival into one typed event flowing through one capture pipeline backed by an explicit append-only idempotency ledger (superseding the per-call dedupe key). Bothprovider.pyhooks and a new post-compact verb emit into this pipeline; the ledger guarantees no double-count across interrupt→resume and no duplicate continuity records, and records un-honouredinterruptedflags as honest ledger entries. - Trade-offs:
- Pro: One place to reason about idempotency, honesty surfacing, and fail-soft behaviour across all three tasks; strongest future extensibility.
- Pro: Cleanest conceptual model — interrupted capture and audit re-assertion become uniform events.
- Con: Largest blast radius; replacing the proven
[KIND, sessionId, contentHash]dedupe with a new ledger risks regressions in already-shipped capture paths and breaks "additive where possible." - Con: Hard to keep byte-identical for unchanged installs when a core store is replaced; heavier review and migration burden in a single release.
- Complexity: large
- Risk: high
Recommended: Variant 2
The release scope explicitly catalogues the substrates each task needs — the [KIND, sessionId, contentHash] dedupe key, resume-aware resolveSessionLineage, and the symmetric extractPreCompactRecords pass — so the lowest-risk path is three tight additive diffs that reuse them, fully honouring off-by-default/byte-identical, fail-soft, and KISS. It avoids both Variant 3's risky core-store replacement and Variant 1's premature TS consolidation, while leaving Variant 1's post-compact-audit.ts placement available as a later refactor if the parallel paths prove worth unifying.