1. Executive Summary
Resonant Archive is two programs for people who use Claude Code every
day. The first is chronicle, a Claude Code mod that writes every row of
a session to a redacted mirror on disk, steers compaction to keep
identifiers and decisions, keeps the recent stretch word for word, and
offers a recall tool. The second is a Python archive over
PostgreSQL with pgvector that imports that mirror, Claude Code
transcripts and exported chats, and serves hybrid search over MCP.
Notable: with memories on, the model writes a first-person memory of
every 15,000 to 25,000 tokens in a forked call, and the mod signs it
with a key it keeps outside the mirror. At a manual compaction those
memories replace the older context with no summariser call, but only
when they form a gap-free signed chain from the session's first row and
each end is found once in the context
(claude-code/chronicle/hooks/register.ts:2272-2405).
Anything short of that proof falls back to a steered summary.
Weak: the proof is of coverage, not of fidelity; what a memory says
is what the model wrote. The archive imports memories without checking
the signature, and around and drill read a
conversation by id without its source. No command deletes one
message.
One mark, negative_eval (section 9).
How it relates to the other two Nekyia Labs reports.
It shares no code with Resonant or Resonant Mind, and no file in the tree
names either; the package docstring calls it "Part of the Resonant
ecosystem" (resonant_archive/__init__.py:3). Resonant keeps
a companion's own messages in SQLite with MiniLM vectors inside a
TypeScript Agent SDK app; Resonant Mind is a Cloudflare Worker over
Neon. Resonant Archive is a separate product: a Python package and a
Claude Code mod, whose 0.1.0 entry describes it as revived from an
internal tool (CHANGELOG.md:108). The idea it shares with
Resonant, a searchable archive of every message, is built here on
different code and a different store.
Licence. Apache-2.0 in LICENSE,
copyright 2025-2026 Nekyia Labs (LICENSE:189), and in
pyproject.toml and the plugin manifest, with no rider;
contributions are taken under the same licence
(CONTRIBUTING.md:110). Releases before 2.0.0 were under the
Codependent AI Source-Available License (CHANGELOG.md:139),
so the history before that tag is not Apache-2.0.
SECURITY.md asks for vulnerabilities to go through GitHub's
private reporting, not a public issue.
2. Mental Model
There are two stores and one rule between them. The mirror is the
record: every user prompt, assistant reply, tool call and tool result of
the main loop is redacted and appended to
<root>/<day>/<session>.jsonl as Claude
Code stores it. Nothing rewrites it. The archive is a searchable copy
that the person fills by running an import.
A memory is the model's own account of one stretch. It never becomes a belief with a status; it becomes eligible to stand in for the stretch it covers. The rule is that it may do so only when the mod can show, from the mirror, that the memories it holds are signed by its own key, start at row 0 of the session, follow each other with no hole or overlap, and end at a reply found exactly once in the context being compacted. Every refusal returns a reason as a string, and the split compaction runs instead.
Diagram source
%% caption: the mirror keeps every row; signed memories replace the older context only on a proved gap-free chain, and the archive copy is searched with hidden and live rows left out
flowchart TD
CC["Claude Code row<br/>appended"] --> RED["redact; withhold<br/>secret tool results"]
RED --> MIR["mirror day/sid.jsonl<br/>append only"]
MIR --> ACC{"15-25k tokens<br/>at a turn end?"}
ACC -- "memories on" --> FORK["forked model call<br/>writes a memory"]
FORK --> SIGN["HMAC, key in<br/>the mod's store"]
SIGN --> MEMF["sid.memories.jsonl"]
CMP["manual /compact<br/>or /squish"] --> PROOF{"signed chain from<br/>row 0, no hole,<br/>end found once?"}
MEMF --> PROOF
PROOF -- "yes" --> ASM["memories block<br/>plus raw tail,<br/>no summariser"]
PROOF -- "no" --> SPLIT["steered summary<br/>of the older part<br/>plus raw tail"]
MIR --> IMP["import: redact again,<br/>upsert by id"]
IMP --> PG["Postgres messages,<br/>anchors, memories"]
PG --> SRCH{"search: FTS, vector,<br/>anchors, RRF"}
SRCH -- "hidden or live<br/>source rows" --> OUT["left out"]
SRCH --> AG["agent via MCP<br/>or recall"]3. Architecture
The mod is one module registered through
hooks/hooks.json
(claude-code/chronicle/hooks/hooks.json), loaded with
--plugin-dir or CLAUDE_CODE_PLUGIN_DIRS. It
hooks session.append to mirror, turn.complete
to seal memory chunks, session.compact to plan the
compaction, tool.call to answer recall,
command.run for /squish and
prompt.submit to append the context meter
(claude-code/chronicle/hooks/register.ts:2601-2817). On
Linux and macOS it shells out to sh, cat and
ripgrep; on Windows it appends through PowerShell and reads through the
engine's file API (:325-335).
The archive is a Python package with a CLI: init brings
up PostgreSQL 17 with pgvector in Docker on loopback and creates a
SELECT-only archive_reader role; import,
embed, serve, recall,
mcp and doctor do the rest. The two halves
meet only through the mirror format and the recall contract
(docs/DESIGN.md:21-25).
Deployment and ergonomics
The mod works alone, with no database. The archive needs PostgreSQL
15 or higher with vector and pg_trgm, and a
550 MB embedding model fetched once and checked against pinned SHA-256
sums. Search works on words as soon as an import finishes;
embed adds vectors and is resumable.
4. Essential Implementation Paths
- Mirror.
mirror()builds a row from the stored message,blockTextredacts text, tool inputs and results, replaces a secret-bearing call's result with a withheld marker and caps results at 2,000 characters, andflushappends per day and session underumask 077(claude-code/chronicle/hooks/register.ts:833-861,:894-935,:264-303). - Form a memory.
memoryTurnEndseals a chunk on an answered turn once it passes the minimum, andformMemoryforks the model, redacts and caps the answer, signs the row and appends it (:1810-1847,:1869-1950). - Assemble.
memoryEvidencereads the memories file, drops any row whosemacdoes not verify, and reads the mirror's row order;planAssemblybuilds the chain and locates its end (:2425-2513,:2301-2405). - Import.
store_unitstages rows, skips an id owned by another source or importer, and upserts (resonant_archive/pipeline.py:254-323). - Search.
Searcher.searchruns the three signals under one filter and fuses them (resonant_archive/search/engine.py:181-231). - Rebuild.
_finish_rebuilddeletes rows that a re-read unit did not produce (resonant_archive/pipeline.py:452-511).
5. Memory Data Model
messages holds a deterministic id, a free
source label, a conversation id unique within the source, a
timestamp, a speaker from six values, a context tag, the text, a
hidden flag for tool rows and harness input, tags and a
sequence number. Beside those sit a generated tsvector, a
768-dimension embedding with its status and the hash of the text it was
computed from, and, from migrations 0002 and 0003, the importer and unit
that wrote it
(resonant_archive/migrations/0001_init.sql:19-41,
resonant_archive/migrations/0002_importer.sql:7-8,
resonant_archive/migrations/0003_unit_key.sql:7-8).
anchors holds exact tokens — paths, URLs, hashes,
versions, identifiers, quoted phrases — pulled from visible rows at
import (0001_init.sql:68-74). memories holds
the chronicle memory's text, session, level, ordinal, the time it was
written and the time span and row ids it covers (:79-96).
sources records the content hash of every imported unit so
an unchanged one is skipped (:6-17).
In the mod, a memory row also carries the first and last row
snippets, a hash of the final reply and the signature over every field
assembly relies on
(claude-code/chronicle/hooks/register.ts:1781-1786,
:1896-1908).
6. Retrieval Mechanics
Search runs full text with the language-neutral simple
configuration, phrase matches first; HNSW cosine with a relaxed
iterative scan, falling back to an exact scan when filters starve the
index; and anchor matches, exact then by path or URL prefix
(resonant_archive/search/sql.py:91-143). Reciprocal rank
fusion with k=60 merges them, and full text weighs half on a question of
more than four unquoted words
(resonant_archive/search/core.py:159-178).
One filter applies to all three: hidden rows stay out unless asked
for, recall echoes stay out always, and rows of the
claude-code source from the last six hours stay out because
that conversation is in context
(resonant_archive/search/sql.py:28-57,
resonant_archive/search/core.py:87-89). The answer footer
counts what that excluded. The rule names one source, so a mirror
imported mid-session under chronicle is not covered by
it.
around reads neighbours by sequence,
associate finds nearest rows in other conversations with at
most two per conversation, overview counts a date range and
lists memories in it, and drill returns the rows a memory
covers (resonant_archive/search/engine.py:247-318).
around, drill and the conversation extent
select on conv_id alone
(resonant_archive/search/sql.py:169-188,
:222-231). The Claude Code importer and the mirror importer
both set conv_id to the session id
(resonant_archive/importers/claude_code.py:198,
:208,
resonant_archive/importers/chronicle_mirror.py:113,
:174), under different sources. If both sources carry a
session under one id, a slice interleaves the two copies.
overview lists memories in range whatever source filter was
passed (resonant_archive/search/engine.py:270-274).
7. Write Mechanics
Mirroring does not block the turn: rows are buffered and flushed at
256 KB or on a timer, and a row that would pass a 5 MB buffer cap is
dropped and counted in a mirror_dropped event
(claude-code/chronicle/hooks/register.ts:57-58,
:236-240, :271-275). A failed append is
requeued.
Memory formation runs after the turn has answered, in a forked call
over the session's cached transcript, so it does not block the agent
either. A chunk waits in a queue of at most three; a failed formation is
retried after 1, 2 and 4 minutes, and a chunk that cannot be formed
leaves a memory_failed or memory_skipped note
so the chain shows where it stops (:1613-1617,
:1931-1943). A memory is unsigned, and unusable for
assembly, when the key cannot be read (:1909-1913).
The archive is written only by an import someone runs. Redaction runs
again on every stored string before any cut, rows are truncated at
20,000 characters and tool rows at 2,000
(resonant_archive/pipeline.py:38-39), duplicates in a
conversation are dropped, and the upsert keeps the embedding only when
the text is unchanged (:194-223). An id owned by another
source or importer is skipped and counted, not overwritten
(:240-243, :274-279). Until embed
runs, a row is found by words and anchors only, and the footer says how
many are pending. No background pass rewrites the archive.
Operational cost
One extra model call per 15,000 to 25,000 tokens with memories on, on a cached prefix; none on the archive's write path. Embedding is local ONNX on the CPU.
8. Agent Integration
The agent reaches the mirror and the archive through the mod's
recall tool, whose source is
session (ripgrep over the mirror) or archive
(the recall command run with no shell, one argument per element)
(claude-code/chronicle/hooks/register.ts:2601-2614,
:1470-1525). The MCP server registers search,
around, overview, associate,
stats, two deprecated aliases, and drill when
memories exist, all reads, over the read-only role with a 10-second
statement timeout (resonant_archive/mcp_server.py:119-178,
resonant_archive/search/engine.py:27-40).
Nothing is injected on its own. Context reaches the model through the
compaction the mod shapes, the memories block it assembles, and what the
agent chooses to recall. The skill file covers importing as well as
searching, and lists the import command an agent can run
from a shell, which writes with the owner's connection
(skills/resonant-archive.md:3, :51).
9. Reliability, Safety, and Trust
A proof of coverage, not of content
The assembly checks are thorough about where a memory sits. It needs
a session_fresh mark before the first row, so a mirror that
began mid-session never passes as whole; no compaction before this one;
a first memory whose opening snippet is found among the first six
messages; and a final reply found once, on a turn boundary, with the
next mirror row after it
(claude-code/chronicle/hooks/register.ts:2345-2392). The
signature keeps a memory line pulled in from elsewhere out of context
(:1730-1732, :2455). None of it checks what
the memory says. A forked model wrote it, and once assembled it replaces
the rows it covers with no comparison against them.
The archive drops the signature
The mirror importer loads every memory line into
memories, and docs/MIRROR-FORMAT.md:46 states
that the signature is ignored because it protects the mod, not the
archive
(resonant_archive/importers/chronicle_mirror.py:123-140).
overview and drill serve those memories to any
agent with the MCP server.
Redaction and the read-only role
Both halves redact before storage, by pattern, and withhold the
result of a tool call that reads a secret-bearing source; the docs call
it a safety net. The MCP server and recall use a role that
can only SELECT, and doctor warns when that role can
write.
Deletion
There is no verb to delete one message. A rebuild removes only rows
that a fully re-read unit did not produce, refuses on any skipped file,
failed unit or id collision, and asks first
(resonant_archive/pipeline.py:452-511).
docs/PRIVACY.md:108-112 describes deleting everything. The
mirror, being the source the archive imports from, has no deletion path
in the mod.
Marks
negative_eval— present. A populated hybrid query asserts the live source's recent row absent beside two expected hits, and a tool row absent by default and present withhidden.tombstone— withheld. Nothing records a rejected value; a message removed by rebuild returns if the source holds it again.trust_state— withheld.hiddenseparates tool rows from conversation, not belief; the signature check is computed per read and stored as no state.bitemporal— withheld. A message has when it was said and when it was imported, and a memory the span it covers and when it was written; neither is a validity interval.scope_enforced— withheld. One person, one archive;sourceis a filter the caller chooses.audit_log— withheld, a near miss. The mirror is append-only and records memory formation, skips and failures as events, but the database the agent searches is overwritten by upsert and pruned by rebuild with no record.human_review— withheld. Memories reach context when the chain checks, and no one approves them; the rebuild prompt confirms a deletion, not a memory.
10. Tests, Evals, and Benchmarks
The Python suite holds 391 pytest functions. CI runs them on Python
3.11 and 3.12 against a pgvector PostgreSQL 17 service pinned by digest,
and on Windows without a database
(.github/workflows/ci.yml:21-57). The search integration
module skips itself, with a message, when no PostgreSQL can be started
(tests/search/test_integration.py:32-41). The mod's 129
tests run under claude plugin test with a fake engine. I
ran none of them.
The negative case is populated. The fixture holds a live-source row
from one hour before whose text and vector match
castle geese, and the test asserts the note n1
first, n2 in the top three and the live row absent, with
one row counted as excluded
(tests/search/test_integration.py:86-97,
tests/search/pgfixture.py:110-123). The hidden-row case
pairs an empty default result with exactly the tool row when
hidden is set (:172-175).
The assembly rules are tested as pure functions: refusal without a
fresh mark, after a compaction, on a mismatched forward edge and on a
reply that appears twice, and the chain stopping at a hole or overlap
(claude-code/chronicle/tests/memories.test.ts:45-79). A
formed memory is asserted redacted and signed (:151-169).
No case asserts that memoryEvidence drops a memory whose
signature fails. Rebuild is tested against purged files, other
importers' rows and units that lost lines
(tests/test_pipeline.py:115-367).
No paper describes Resonant Archive.
11. For Your Own Build
Steal
- Prove coverage before replacing context. A memory chain from the first row, no holes, ends located exactly once, and a reason string for every refusal makes a lossy step safe to attempt.
- Sign what you will inject. A key held outside the files the memory lives in stops a pulled or copied line from reaching context.
- Keep the source the summary replaces. The mirror
makes every compaction recoverable through
recallanddrill. - Refuse a destructive rebuild on any incomplete read.
Avoid
- Do not let a second reader drop the first reader's check. An archive that serves unsigned memories undoes the reason for signing them.
- Do not key a conversation slice on an id two importers share. Select on the source too.
- Do not leave deletion to the source files. One message should be removable without editing a transcript and rebuilding.
Fit
Fits one person who lives in Claude Code and wants long sessions to survive compaction with the detail recoverable, on one machine, with a local PostgreSQL. The mod alone needs no database and is the cheaper half to adopt.
Walk away if memory must be shared between people, corrected fact by fact, or reviewed before it reaches context, or if a single message must be erasable on request.
12. Open Questions
- Whether the archive's
overviewanddrillare meant to serve memories whose signature was never checked. - Whether
aroundanddrillshould select on source when a session is imported both from its transcript and from the mirror. - Whether the mirror's
sidand the transcript'ssessionIdare always the same string; the mod takes it from the engine's session id, which I did not trace.
Appendix: File Index
- Mod:
claude-code/chronicle/hooks/register.ts,claude-code/chronicle/hooks/hooks.json,claude-code/chronicle/README.md - Schema:
resonant_archive/migrations/0001_init.sql,resonant_archive/migrations/0002_importer.sql,resonant_archive/migrations/0003_unit_key.sql,docs/SCHEMA.md - Import:
resonant_archive/pipeline.py,resonant_archive/importers/chronicle_mirror.py,resonant_archive/importers/claude_code.py,resonant_archive/redact.py - Search:
resonant_archive/search/sql.py,resonant_archive/search/engine.py,resonant_archive/search/core.py,resonant_archive/mcp_server.py - Docs:
docs/DESIGN.md,docs/COMPACTION.md,docs/MIRROR-FORMAT.md,docs/RECALL-CONTRACT.md,docs/PRIVACY.md - Tests:
tests/search/test_integration.py,tests/search/pgfixture.py,tests/test_pipeline.py,claude-code/chronicle/tests/memories.test.ts
Recorded searches
Run from the repository root at the pinned commit with
/usr/bin/git grep.
- No reference to the other two projects.
git grep -n -i -E 'resonant-mind|resonant mind|mind_|mind cloud'returns nothing;git grep -n -i 'resonant ecosystem'returnsresonant_archive/__init__.py:3. - The archive does not check the signature.
git grep -n -w -E 'mac|hmac' -- resonant_archivereturns nothing; the same pattern overdocsreturnsdocs/MIRROR-FORMAT.md:46. - The only deletes of messages and memories are the
rebuild's.
git grep -n -E 'DELETE FROM (messages|memories)|"DELETE "' -- resonant_archivereturnsresonant_archive/pipeline.py:504and:506. - No scope key in the schema.
git grep -n -i -E 'user_id|tenant|project_id|agent_id|owner' -- resonant_archive/migrationsreturns nothing;git grep -n -i -E 'source +text' -- resonant_archive/migrationsreturns0001_init.sql:21,:54and:81. - Slices select on conversation id alone.
git grep -n -F 'where conv_id = %' -- resonant_archive/search/sql.pyreturns:172,:174,:180,:184,:187and:229. - No test of a failed signature.
git grep -n -E 'signature|failed their|\.mac' -- claude-code/chronicle/testsreturns onlymemories.test.ts:167, which asserts a signature is written. - No paper.
CITATION.cffis absent;git grep -n -i -E 'arxiv|doi\.org|bibtex'returns nothing.
History
2026-12-03 — 5394bc5d….
First reading, from the 2026-12-03 triage shortlist, at the head of
main. Screened: three auto-run surfaces in a nested Claude
Code plugin
(claude-code/chronicle/.claude-plugin/plugin.json, its
hooks/ directory and hooks/hooks.json); two
build-time execution points (tests/conftest.py,
tests/embed/conftest.py); one floating surface
(pyproject.toml); nothing inside the cooldown. Nothing was
installed, built or run, and none of the 391 pytest functions or 129 mod
tests was run. One mark (section 9).