Repository navigation
Releases
v0.10.1
Totem v0.10.1
Fixes
memory_graphnow filters by entity before applying the result limit, so a file or symbol outside the first page still resolves.
Tests
- 211 Python tests pass.
- 35 dsh-totem tests pass.
Install
pipx install --force "totem-mcp[embeddings]==0.10.1"v0.10.0
Totem v0.10.0
TL;DR
Totem now has the full memory operating loop: read-side file memory, linked sessions, quality reporting, typed memory classes, an entity graph with bi-temporal edges, hierarchical rollups, heat and decay, workflow memory, Markdown interchange, and a maintenance cycle. Schema v12 migrates existing databases in place.
P0: read path and signal
- Whole-file reads check the cached TLDR first and return the TLDR, language, and symbol outline when the content hash matches.
force: truereads the body. - Session summaries link to the file-state records they touched with a
touchesrelation. memory_qualityandtotem qualityreport signal ratio, classes, provenance, stale evidence, conflicts, duplicates, relations, checks, feedback, embeddings, entities, and digest composition.- Conflict detection requires a shared subject plus opposing claims. Shared evidence alone is not a conflict.
P1: memory structure
- Memory classes: operational, episodic, procedural, core, and semantic.
- Entity graph: files, symbols, components, rules, pull requests, and packages are linked to memories.
- Bi-temporal relations: recorded time, validity windows, and source episode on every edge.
- Hierarchical rollups: file TLDRs feed module summaries and a project map.
- Heat and decay: recency, importance, and access produce a heat score; old low-importance operational and episodic memories can be archived.
memory_profilestores always-on core profile blocks in the user database.
P2: lifecycle and portability
memory_workflowstores reusable procedures with preconditions, verification, and failure modes.memory_induce_workflowdrafts a procedure from a session summary.memory_maintenanceandtotem maintainrun entity backfill, revalidation, rollup, decay, and consolidation.totem export-markdownandtotem import-markdownpreserve statements, details, evidence, and wikilink relations.- A five-case LongMemEval-style suite covers extraction, multi-session reasoning, temporal reasoning, knowledge updates, and abstention.
Schema v12
access_countandlast_accessed_aton memory items.recorded_at,valid_from,valid_to, andsource_episodeon relations.memory_entitiesandmemory_entity_linkstables.
The TrustSight corpus migrated in place and was rolled up into 18 module summaries plus a project map.
Tests
- 211 Python tests pass.
- 35 dsh-totem tests pass.
- 61 MCP tools and 39 CLI commands.
Install
pipx install --force "totem-mcp[embeddings]==0.10.0"v0.9.3
Totem v0.9.3
TL;DR
File memory now serves cached TLDRs before a whole-file read, session summaries link to the files they touched, and totem quality reports whether the corpus is durable knowledge or activity noise. Conflict detection is stricter: shared evidence alone is no longer a contradiction.
Read-side file memory
- A whole-file read checks the file-state TLDR first.
- When the content hash matches, the agent gets the TLDR, language, and symbol outline instead of the file body.
- Pass
force: trueto read the full body. - The response reports
lineCount, so the model knows the size of the skipped file.
Session links
memory_session_summarylinks each summary to the file-state records it touched with atouchesrelation.- Path activation can now find the session that explains a file change.
Quality report
- New
memory_quality_toolandtotem quality. - Reports signal ratio, type mix, provenance coverage, stale evidence, conflicts, duplicate titles, relations, checks, feedback, embeddings, and digest composition.
Conflict precision
- Overlapping evidence alone no longer creates a conflict.
- A conflict requires a shared subject plus opposing claims: negation, a changed number, or high statement similarity.
- The four false conflicts in the TrustSight corpus were resolved as distinct claims.
Tests
- 197 Python tests pass.
- 35 dsh-totem tests pass.
Install
pipx install --force "totem-mcp[embeddings]==0.9.3"totem v0.9.2
TL;DR
totem v0.9.2 adds file-state memory. Reads and writes now produce one deterministic TLDR per file, keyed by content hash, instead of an append-only activity log. A new session summary captures what changed and why in one record. dsh-totem consumes both, and the first-step digest filters file state so decisions and gotchas are no longer buried by Patched <file> rows. 192 Python tests pass.
File-state TLDR
memory_file_contextreads one file, stores its current state, and returnsfresh,changed,tldr,symbols, andblobHash.- An unchanged file returns
fresh: truewithout writing a new row. - A changed file updates the same record in place.
- Summaries are deterministic and local: Python AST, Markdown headings, JSON/YAML keys, JavaScript exports, and shell functions. No model call and no network.
- Evidence paths are project-relative and carry a whole-file blob hash.
Session summaries
memory_session_summarycreates or updates one summary per session.- It records the changed paths, the work description, and the commit when available.
- Repeated turns update the same record instead of appending one record per turn.
Search and digest hygiene
- File-state TLDRs are excluded from generic
memory_searchby default. include_file_stateis available when file state is the target.- The dsh-totem first-step digest filters file-state rows and keeps decisions, gotchas, contracts, architecture, observations, and tasks.
dsh-totem integration
- Reads call
memory_file_context; they no longer storeRead <name>markers. - Writes update the file-state TLDR; they no longer append
Patched <name>fallbacks. - Symbol memories from the distiller are still created when available.
- Turn end creates one session summary from the changed paths and assistant text.
Backfill
totem files backfillpreviews legacy file-change conversion.totem files backfill --applyconverts records whose source file still exists.--prune-missingdeletes legacy file records whose source file is gone.
Tests
- 192 Python tests pass.
- 32 dsh-totem tests pass.
Install
pip install 'totem-mcp[embeddings]==0.9.2'totem v0.9.1
TL;DR
totem v0.9.1 fixes one temporal validity edge case found during full manual testing. include_expired now re-admits only claims whose validity window has ended; claims whose valid_from is still in the future stay out of context and search until as_of reaches them. 182 Python tests pass.
Fixes
- Future-dated claims:
include_expiredno longer releases claims that have not started yet. - Temporal state: candidates now distinguish
current,future, andexpiredinstead of collapsing both non-current states into one flag. - Regression coverage: a new test asserts future exclusion with
include_expired, inclusion at a lateras_of, and normal expired handling.
Manual verification
A disposable environment in /tmp exercised:
- fresh schema v11 and migration from a real 0.8.0 database;
- create, get, update, search, context, list, recent, tasks, commands, timeline;
- check-backed verification, audit, revalidation, conflict resolution, and GC;
- temporal filtering, path activation, budget caps, abstention, and user DB scope;
- feedback, reranker training, and near-duplicate consolidation;
- export format v2, import, replace import, and check preservation;
- CLI commands, MCP server tools, hardening limits, and concurrent creates;
- static Model2Vec embeddings and the hash fallback without the optional package.
Tests
- 182 Python tests pass.
Install
pip install 'totem-mcp[embeddings]==0.9.1'totem v0.9.0
TL;DR
totem v0.9.0 rebuilds retrieval around corpus-wide candidates. Context and search now fuse lexical, dense, path, symbol, tag, and relation signals instead of starting from tag-filtered rows. It adds temporal validity, feedback-driven reranking, abstention, near-duplicate consolidation, and richer evaluation. 181 Python tests pass.
Retrieval
- Corpus-wide candidates: context and search build candidates from the whole database with FTS (full query and per term), dense vectors, evidence paths, symbols, tags, and a two-hop relation expansion.
- Tags are a boost: tags no longer gate
engineering_context; an untagged memory can surface when the task, code path, or a relation makes it relevant. - Persisted embeddings: static Model2Vec vectors are stored in
memory_embeddingsand refreshed by content hash. The dependency-free hash encoder remains the fallback and stays in memory. - Hybrid search:
memory_searchreturns fused scores and the reasons each result entered.
Temporal validity
valid_fromandvalid_toare available on create, update, and import.- Context and search accept
as_ofandinclude_expired; expired claims are excluded by default and demoted when included. - Validity windows are validated, so
valid_tomust be later thanvalid_from.
Feedback and learned ranking
memory_feedbackrecordsuseful,wrong,irrelevant,verified, orstalesignals with an optional query, tags, and weight.memory_train_modelsfits a linear reranker over candidate and trust features, and fits the conformal calibrator when feedback has both classes.- Trained weights are stored in
metawith the commit and example count that produced them. The learned path stays advisory. - Staleness checks are cached per retrieval, so repeated evidence paths are not re-read during one context build.
Search and abstention
- Context returns
abstained: truewith an empty body when no memory clears the score threshold (TOTEM_ABSTAIN_SCORE, default0.12). - Critical classes, path matches, and stale knowledge still surface, so low scores cannot hide a known hazard.
memory_searchkeeps explicit tag filters when tags are supplied, while context treats tags as a signal.
Consolidation
memory_consolidateclusters near-duplicates by cosine similarity.- Dry-run is the default;
--applymarks duplicates superseded, records a relation to the canonical memory, and appends history. - Opposite-polarity clusters are flagged as contradiction candidates.
Evaluation and portability
- Eval cases support
single,multi,temporal,update, andabstention. - Reports add nDCG and abstention accuracy alongside recall, MRR, and p95 latency.
- Export format is now v2 and includes recorded checks; v1 exports remain importable.
Schema
- Schema v11 adds
memory_embeddings,memory_feedback, and the validity columns. - Migration 006 adds the objects and postconditions; existing databases upgrade in place.
Tests
- 181 Python tests pass.
Install
pip install 'totem-mcp[embeddings]==0.9.0'or without the optional encoder:
pip install totem-mcp==0.9.0The npm package is published by CI.
totem v0.8.0: auditable memory (hash chain, recorded checks, hardened tools)
TL;DR
totem v0.8.0 makes memory claims auditable. History is hash-chained, verification consumes an observed check record instead of a free-text claim, and evidence paths are contained to the project root. Every MCP tool is bounded by output caps, rate limits, and deadlines. Ranking gains a deterministic dense leg fused with FTS, MMR diversification, a linear reranker, and calibrated trust that stays advisory until it beats the deterministic rule on held-out history. 156 tests pass.
Evidence and trust
- Tamper-evident history: every
memory_historyrow carriesprev_hash,hash, and astate_hashsnapshot of the item.totem auditrecomputes the chain and exits non-zero on mismatch. - Recorded checks:
memory_check_record/totem checkstores command, cwd, exit code, output hash, evidence hash, commit, and run time. - Evidence-derived verification:
memory_verify(check_id=...)requires the check to exist, belong to the item, have exited 0, and match the current evidence digest. Assertion-only verification still works but is marked and surfaced with a warning. - Path containment: evidence is resolved with
realpathandcommonpathunder the project root; absolute escapes,..traversal, and symlink escapes are rejected at registration and at staleness reads. - Write capture:
register_file_writerecords the git-observed changed files and a bounded content digest, so a claimed write that changed nothing is visible. - Schema v10: checks table plus history chain columns; the migration runs with a postcondition and backfills the chain.
MCP hardening
- Bounded output with a
truncatedenvelope, per-tool token buckets, argument size caps, wall-clock deadlines, and fail-soft JSON errors. - 42 tools;
totem_manifest_toolreturns a stable SHA-256 of the surface.
Advisory models
- Platt scaling and split conformal prediction over claim features, with an honest shared-sample mode below 40 rows.
rule_trustdeterministic baseline;totem models validatepromotes a calibrated head only on a temporal held-out slice with a better Brier score and coverage within tolerance.- Deterministic signed-hash TF-IDF encoder, reciprocal-rank fusion with FTS, MMR diversification, and a trainable linear reranker.
- N=1 prior-experience recall exposed as
closestId. totem evalreports recall@k, MRR, and p95 latency, plus a gate that rejects a recall or MRR regression beyond tolerance or a latency overrun.
CLI
New totem audit, totem check, totem eval, and totem models validate; totem verify --check-id consumes a recorded check.
Tests
156 Python tests pass, including property-based path and fusion checks.
Install
npm install @emiliano-go/totem
npx @emiliano-go/totemPyPI release is handled by CI.
totem v0.7.0: verification lifecycle (verify, retract, GC, concurrency)
TL;DR
totem v0.7.0 adds a full verification lifecycle: memories can be verified against a real verification record (with commit and timestamp), verification is retracted automatically when the underlying evidence changes, verified memories are surfaced and boosted in context, and enforcement can require verification before trusted claims are used. It also adds a safe GC purge with dry-run, fixes a first-bootstrap race in concurrency, and hardens writes to be multiprocess-safe with unique evidence locators. All 122 commits are now GPG-signed.
Verification lifecycle
- Record:
verified_atandverified_commitare stored on a memory when it is verified, so verification points at a specific state of the evidence. - Gate: the enforcement verify gate now requires a real verification record; asserted_by is treated as provenance, not verification.
- Retract: verification is retracted automatically when the evidence changes, so stale claims do not stay marked as verified.
- Surface and boost: context surfaces verified memories and boosts their relevance ranking.
- Bug verification: bugs join the set of verifiable items, with GC exemption and portability across export or import.
Garbage collection
- Safe lifecycle purge with
dry-run: preview what would be collected before anything is deleted.
Concurrency and correctness
- Bootstrap race: fixed a stale-snapshot race on first bootstrap in multiprocess use.
- Writes: multiprocess-safe writes with unique evidence locators, backed by real concurrency tests.
- Context cap:
max_item_charscaps a single item so one memory cannot dominate the token budget.
Docs
- Architecture diagram in the README "How it works" section, plus refreshed tool and CLI counts.
Tests
- 114 Python tests pass.
Install
npm install @emiliano-go/totem
npx @emiliano-go/totemPyPI release is handled by CI.
totem v0.6.0: hardening (evidence, atomic writes, hard budget, CI)
TL;DR
totem v0.6.0 is a hardening release. It fixes a false-negative staleness detector in evidence, makes every semantic mutation atomic, turns the context token budget into a hard bound, enforces update and import validation plus the memory lifecycle, constrains relations, makes migrations crash-safe, and adds CI and release gates, typed errors, restorable imports, resource limits, indexed hot paths, audit actors, idempotency, and a configurable enforcement policy. No new memory types.
Correctness
- Evidence: symbol evidence is now identity plus content (a normalized body hash). A symbol whose body materially changed is stale; moved-but-unchanged is fresh; legacy rows without
symbolHashkeep presence-only behaviour. This closes a false negative where a changed implementation stayed fresh. - Transactions: low-level DB helpers no longer commit. Every semantic mutation (create, update, delete, relate, import, conflict resolve) runs in one transaction and rolls back on failure, so the knowledge graph cannot be left partially applied.
- Validation:
memory_updatereconstructs and revalidates the item, and memory lifecycle transitions are enforced (illegal transitions rejected). Create, update, and import now apply the same schema invariants. - Context budget:
token_budgetis a hard upper bound. Every section is capped, emergency sections report how many were omitted, andengineering_contextreturnsbudget,estimatedTokens, and per-section omitted counts. - Relations:
UNIQUE(from_id, to_id, kind), lookup indexes, self, dangling, and cycle rejection, plus idempotent duplicates.
Operational
- Migrations:
BEGIN IMMEDIATElock, one transaction per migration, postcondition verification, and no schema-version stamp on failure. A failed migration rolls back and retries cleanly. - Hook state: atomic temp plus fsync plus rename, a private
0700directory with0600files, and a TTL sweep. - Enforcement policy:
TOTEM_ENFORCEMENTisoff,warn,normal, orstrict. Strict fails closed; fail-open events are logged to the hook state directory. - Typed errors: MCP tools return
{error: {code, message}}with codes (NOT_FOUND, INVALID_ARGUMENT, SCHEMA_ERROR, CONFLICT, STALE, DB_UNAVAILABLE, MIGRATION_FAILED, INTERNAL). - Imports:
memory_importgainsnormal,strict, andreplacemodes,--dry-run, validation before mutation, and a complete report. - Resource limits: caps on title, statement, details, tags, metadata, evidence, import size, and token budget.
Scale, relevance, audit
- Indexed hot paths: a
statement_normalizedcolumn and a locator table remove whole-corpus scans from density dedup and file registration. - Conflict relevance: context only surfaces conflicts touching considered memories or the critical classes (invariants, constraints, contracts).
- Scope and explainability: task scope boosts only when it matches the current task; context returns a
whymap for each included memory. - Audit actors: history records actor, session, source, commit, and request id; relations and conflict resolutions are recorded.
- Idempotency: writes accept an
operation_id; a replay returns the stored result instead of re-executing.
Deployment
- Totem is a single-user, local memory layer with no tenancy. The boundary is documented in the README and the
dbmodule docstring; run one instance and one user DB per OS user.
CI and tests
- New
.github/workflows/ci.yml: pytest on Python 3.13 and 3.14, CLI smoke, MCP server startup, build artifacts, and an npm package job. Publishing workflows now depend on CI. - 89 Python tests pass.
Install
npm install @emiliano-go/totem
npx @emiliano-go/totemPyPI release is handled by CI.
totem v0.5.1: pinned MCP versioning, hook batching, Kimi auto-wiring
Installer (bin/totem.js)
- MCP server is registered as
uvx totem-mcp==<npm package version>(pinned to the release) and pre-warmed duringnpx totem, so agent startups use the cached uvx environment and never hit the network. Falls back to thetotem-mcpPATH binary when uvx is unavailable or the pin cannot be resolved. Supersedes the 0.5.0 "PATH binary so local installs take effect immediately" behavior for released versions. - Installer now upgrades stale installs: compares
totem --versionagainst the package version and runspipx upgrade/uv tool upgrade/pip install --upgradeon mismatch (previously it only checked presence, so installs never moved off old versions). - Registers the totem MCP server in Kimi Code's user-level
~/.kimi-code/mcp.jsonso totem is available in every project (project-level.mcp.jsonstill overrides). - Wires the enforcement hooks into Kimi Code's
~/.kimi-code/config.toml(PreToolUse/PostToolUse/UserPromptSubmit→totem-hook.py pre|post|clear). Idempotent, TOML-safe append; strips legacy per-script totem hook entries. - Fixed: crash with a raw stack trace when the CLI was installed but its bin dir was not on PATH (
execSync("totem --version")was uncaught); now prints a clear error and exits 1.
Enforcement hooks
- Memory gates cost ONE
totem searchsubprocess per tool call: terms are batched into a single FTS5ORquery capped at 5, instead of one subprocess per word (a miss spawned one cold Python process per word, which flooded the process table under parallel tool calls). - Non-blocking per-session
flockon all hooks: concurrent invocations fail open instead of stacking subprocesses. - Legacy
totem-enforce.py/totem-store-read.py: same batching/lock fixes applied.