Skip to content

About

Local-first, auditable memory for AI agents and knowledge-intensive software

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,168 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SPDX-License-Identifier: AGPL-3.0-or-later Commercial license available © Concepts 1996–2026 Miroslav Šotek. All rights reserved. © Code 2020–2026 Miroslav Šotek. All rights reserved. ORCID: 0009-0009-3560-0851 Contact: www.anulum.li | [email protected]

Remanentia

CI CodeQL Docs OpenSSF Scorecard OpenSSF Best Practices Version Tests Coverage Gate License: AGPL v3 Python 3.15+ Rust Ruff Bandit Pre-commit MCP CITATION.cff REUSE

Remanentia

Persistent AI memory with SNN-orchestrated consolidation, entity graphs, and deep contextual recall.

Active Development — Remanentia is under intensive development. The core memory engine, BM25+embedding hybrid retrieval, SNN-orchestrated consolidation, temporal reasoning, and the MCP server are functional, tested, and deployable. Canonical test and coverage numbers live only in VALIDATION.md (do not copy counts into this README — they drift). The repository keeps a 100% product-module coverage gate in CI via pyproject.toml. Rust acceleration spans 17 crates, with Python fallbacks for retrieval and consolidation. LongMemEval, full-S setting (realistic ~50-session haystacks, retrieval actually exercised; this is what published leaderboards measure): 56.6% overall (3-run mean from recorded gpt-4o-mini runs, spread 2.2). The older 72.2%/~71% figures are the oracle setting (gold sessions only, retrieval bypassed) and are not comparable to leaderboards — see Benchmarks for both. Figures are 3-run means, not single runs. APIs may evolve as this work progresses.

BM25+embedding hybrid retrieval with RRF | 11 typed entity relation types | temporal reasoning with date arithmetic | async consolidation | thread-safe MCP server

remanentia.com | GitHub


Integration Positioning

Remanentia is a standalone, local-first memory engine for projects that need auditable recall over notes, source code, research documents, and structured findings. It can run as a repository-local CLI, an MCP server, or an HTTP API.

Cross-project retrieval is an integration pattern, not a packaging assumption: deployments may add additional source roots for external repositories or shared archives, but the public package does not require a private monorepo layout.


What It Does

Remanentia indexes your project's existing files — session logs, code, research documents, reasoning traces — into a unified BM25 index with query intelligence. Ask a question, get the relevant paragraph with an extracted answer.

No vector database. No cloud service. No LLM in the retrieval path.

Quick Start

# Install from PyPI
pip install remanentia

# Or install from source
pip install -e .

# Create directory structure
remanentia init

# Add your reasoning traces to reasoning_traces/
# Then consolidate into semantic memories
remanentia consolidate --force

# Search
remanentia search "what did we decide about authentication"
remanentia recall "STDP learning rule" --format context

# System status
remanentia status

Complete result custody

Both HTTP servers retain complete binary result packets through POST /memory/results/v1 and provide authorized original-byte readback. The ACK attests byte custody; consumers independently validate admission and executor effects. See the operator and client guide.

Retrieval Pipeline

Query
  |
  v
BM25 (real TF + inverted index) .............. first-pass retrieval
  |
  v
Bi-encoder rerank (MiniLM-L6-v2) ............. semantic similarity
  |
  v
Reciprocal Rank Fusion ........................ scale-invariant score fusion
  |
  v
Cross-encoder rerank (MiniLM-L-6-v2) ......... fine-grained re-scoring
  |
  v
Entity graph boost ............................ 11 typed relation types
  |
  v
Temporal graph + date arithmetic .............. TReMu code execution
  |
  v
Answer extraction ............................. query-proximity scoring
  |
  v
Knowledge store (multi-hop graph search) ...... Zettelkasten + prospective queries

Memory Types

Type Storage Example
Episodic reasoning_traces/*.md Raw session decisions
Semantic memory/semantic/**/*.md Consolidated facts with YAML frontmatter
Procedural skills/*.json Extracted skills and workflows
Graph memory/graph/*.jsonl Entity-entity relations with evidence

Components

File Role
memory_index.py Unified BM25 + embedding index, all scoring and ranking
memory_sources.py Neutral default source roots plus JSON/env source configuration
store_paths.py Canonical memory-store paths shared by ingest and freshness monitoring
store_manifest.py Store-selection manifest for reconsolidation and freshness operations
store_sources.py Selected-store MemoryIndex source config for backfill indexing
memory_recall.py Deep recall: retrieval + graph + temporal context
recall_calibration.py Recall abstention calibration from correctness-labelled ledger outcomes
compiled_memory.py Typed fact-card compiler for durable seed and operational facts
mcp_server.py Thread-safe MCP server (stdio JSON-RPC), async consolidation
consolidation_engine.py Episodic -> semantic compression, typed relation extraction
knowledge_store.py Zettelkasten atomic notes, prospective triggers, graph search
temporal_graph.py Temporal event graph, relative date resolution, TReMu
entity_extractor.py Optional GLiNER NER + regex fallback, 11 typed relation types
llm_backend.py Pluggable LLM backend: Auto, Local, hosted, Null
answer_extractor.py Query-proximity answer extraction, LLM fallback
answer_normalizer.py Hedging strip, yes/no polarity, semantic similarity
observer.py Filesystem watcher -> incremental index updates
reflector.py Periodic cluster summarisation + gap detection
arcane_retriever.py Fact retrieval with deterministic weighted RRF and source context
fact_decomposer.py Source facts, mutable snapshot lookup and calendar validity
claim_axes.py Shared finding evidence/status/admission/freshness vocabulary
claim_schema.py Deterministic JSON Schema export for shared claim-axis consumers
finding_ingest.py Hub-backed finding admission, cursoring, and Markdown persistence
feed_ingest.py SYNAPSE feed.ndjson ingest for explicit findings and decisions
feed_normalization.py Controlled project, actor, sequence, and timestamp vocabulary for feed ingest
finding_envelope.py Signed finding envelopes with recall-gate, validity, void, and lineage closure checks
cli.py Command-line interface
api.py FastAPI REST server
api_server.py Lightweight HTTP API for cross-service integration

Prerequisites

  • Python 3.15+
  • numpy, defusedxml, jsonschema (installed automatically)
  • Optional: sentence-transformers (embedding rerank), torch (GPU), fastapi (REST API)
  • Hosted inference requires an explicit job, named account and spending authorization.
  • Optional local inference through llama.cpp, Ollama or another operator-approved endpoint

CLI

pip install -e ".[all]"     # everything
pip install -e ".[bus]"     # SYNAPSE bus and feed integration
pip install -e ".[api]"     # REST API only
pip install -e ".[seal]"    # signed finding envelopes
pip install -e ".[bench]"   # offline benchmark dataset and client dependencies
remanentia-feed-ingest  # consume explicit Finding:/Decision: rows from ~/synapse/feed.ndjson
remanentia-recall-calibration --json  # report calibrated recall abstention evidence
remanentia-store-manifest --write --json  # record the selected memory-store manifest
remanentia-store-sources --write --json   # write MemoryIndex sources for that store
python tools/install_user_services.py --base /path/to/store --stimuli-dir /path/to/snn_stimuli

Search Pipeline

Query → Classification (8 intent types)
  ↓
BM25 scoring (inverted index, real TF-IDF)
  ↓
Bi-encoder rerank (MiniLM-L6-v2, optional)
  ↓
Cross-encoder rerank (ms-marco-MiniLM, optional)
  ↓
Answer extraction (dates, numbers, versions, names)
  ↓
Results with snippets + extracted answers

Benchmarks

LongMemEval (upstream inputs, committed reports)

500 questions across 6 categories. GPT-4o-mini generation + judge. Per-run history is tracked in benchmarks/longmemeval_history.jsonl.

Full-S input and per-question result files named data/longmemeval_full_s_seed*.jsonl stay local and are gitignored. Obtain the evaluation dataset from the upstream LongMemEval distribution under its own terms. Committed aggregate reports retain the local source filename so each snapshot can be checked against the original run.

LongMemEval has two settings, and the distinction matters: the oracle setting gives the reader only the gold sessions (~2 per question), so retrieval is not exercised; the full-S setting gives ~50 sessions per question (~2 of them gold), so the system must actually retrieve. Published leaderboard numbers (e.g. Hindsight 91.4 %) are full-S. The realistic, comparable number for Remanentia is the full-S figure below.

Full-S (realistic retrieval setting) — headline

~50 sessions/question, Arcane retrieved-context reader (top-10 retrieved sessions). 3-run mean on the 2026-06 gpt-4o-mini, cross-encoder rerank on (ledger round full-S):

Category Full-S 3-run mean
knowledge-update 79.5%
single-session-user 73.8%
single-session-assistant 71.4%
single-session-preference 58.9%
multi-session 42.1%
temporal-reasoning 41.8%
Overall 56.6% (runs 57.6 / 55.4 / 56.8, spread 2.2)

This is the number to compare against full-S leaderboards. The hard categories (multi-session, temporal) carry most of the gap: retrieval recall@10 is high (~88 % / ~79 %), so the remaining loss there is synthesis over the retrieved context, not a retrieval miss; single-session losses are retrieval misses on the legacy BM25 path. Full-S Arcane benchmark hypotheses now include a retrieval_diagnostics object with selected session indices, answer-session recall, session-cap misses, and character-budget misses. Use that metadata to separate retrieval misses from reader synthesis failures before updating public scores. After judging, run:

remanentia-full-s-diagnostics data/longmemeval_hypotheses.results.jsonl

The report groups failures as synthesis failures, ranking misses, session-cap misses, character-budget misses, or missing diagnostic data.

Generate the auditable score/runtime/token evidence report from any judged result file:

remanentia-benchmark-report data/longmemeval_hypotheses.results.jsonl \
  --benchmark longmemeval \
  --output benchmarks/longmemeval_oracle_snapshot_report.json

New --evaluate rows include judge prompt hashes, prompt-token estimates, exact API usage when returned by the provider, and judge-call latency. Older committed rows still produce score reports, with unavailable runtime/token fields left empty.

Generate the reproducibility manifest for committed benchmark artefacts:

remanentia-benchmark-manifest \
  --report benchmarks/longmemeval_oracle_snapshot_report.json \
  --report benchmarks/locomo_snapshot_report.json \
  --artifact benchmarks/efficiency_frontier_report.json \
  --output benchmarks/reproducibility_manifest.json

The manifest records report/source hashes, command strings, score summaries, Python runtime metadata and the selected Git revision. It does not read environment variables or credential stores; supplied text and resolved file paths remain visible. The recording guide explains the source-checkout history recorder, report denominators, unchanged output schema and declaration-only headline gate. Historical results and raw notes retain their original bytes.

Generate the accuracy/token/latency frontier report from committed evidence:

remanentia-efficiency-frontier \
  --report benchmarks/longmemeval_oracle_snapshot_report.json \
  --report benchmarks/locomo_snapshot_report.json \
  --baseline benchmarks/efficiency_baselines.json \
  --output benchmarks/efficiency_frontier_report.json

The frontier report never infers missing runtime or token measurements; unknown fields stay null until a benchmark artefact records them.

Oracle setting (gold sessions only — retrieval NOT exercised)

The figures below are the oracle setting: the haystack is exactly the gold sessions, fed to the reader in full. They measure synthesis, not retrieval, and are not comparable to full-S leaderboards. Kept for historical continuity.

Committed snapshot — R11, April 2026 (single run, data/longmemeval_hypotheses.results.jsonl):

Category Score
single-session-preference 90.0% (27/30)
single-session-assistant 87.5% (49/56)
single-session-user 85.7% (60/70)
knowledge-update 84.6% (66/78)
temporal-reasoning 65.4% (87/133)
multi-session 54.1% (72/133)
Overall 72.2% (361/500)

Current model, default config (cross-encoder rerank on), 3-run mean on the 2026-06 gpt-4o-mini: ~71.2% overall, ~60.2% temporal-reasoning, ~89% knowledge-update, ~53% multi-session. The ~1pp overall and ~5pp temporal gap vs the April snapshot is gpt-4o-mini drift between model snapshots — the same code reproduces 60% temporal on the current model, so it is not a pipeline regression. Quote ≥3-run means; single-run swings of ±10 questions are noise.

Temporal-reasoning improved from 45.9% (R8) to 65.4% (R11, 2026-04-11), a +19.5pp / +26 question gain — the 65% target has been achieved. Four rounds shipped pipeline improvements:

  • R9 (+14 temporal): session-anchored date resolution, explicit duration arithmetic via TReMu pre-computation, chronological session ordering
  • R10 (+2 temporal): intraday HH:MM tiebreak + qtype-aware sort
  • R11 (+10 temporal): fuzzy inclusive/exclusive durations, question_date anchoring in LLM prompt + TReMu, multi-event bigram/proximity tuning, narrow multi-hop chain resolution

Single-run LLM-judge noise is ±~10 questions per 500-run; per-round 3-run means are now recorded in benchmarks/longmemeval_history.jsonl. Cross-encoder reranking is on by default — set REMANENTIA_ARCANE_CE_DISABLE=1 to skip it for latency-sensitive live/MCP use (it is worth ~8–9 questions on this benchmark).

Hindsight (SOTA with GPT-4 extraction) reports 91.4% on the full-S setting — compare it to Remanentia's full-S 56.6 %, not the oracle number above. Closing that gap on full-S is the active work (retrieval recall on single-session, cross-session synthesis on multi-session/temporal).

The cross-session reader now receives deterministic aggregation hints before LLM synthesis when the retrieved context is unambiguous: COMPUTED TOTAL: for same-unit sums and COMPUTED COUNT: for explicit distinct-item count questions such as "How many different doctors...". Ambiguous generic "how many" questions remain on the normal reader path.

An experimental ENTITY SUMMARY reader hint also exists for the broader synthesis-failure class — a deterministic, deduplicated, chronologically-ordered consolidation of the retrieved facts about each entity the question names (latest dated statement marked (most recent)), built only from already-retrieved facts (no extra model call). It is off by default: a 2-seed full-S ablation found no reliable accuracy effect (the per-seed swings were larger than the difference). Opt in with REMANENTIA_SYNTHESIS_ENABLE=1 to experiment.

LOCOMO

1,651 / 1,986 = 83.1 % on the LOCOMO multi-session QA dataset (BM25 + cross-encoder rerank + 4-stage answer extraction + LLM synthesis). Results committed at paper/locomo_results.json, with the derived evidence report at benchmarks/locomo_snapshot_report.json.

Category Correct / Total Accuracy
Multi-hop 285 / 321 88.8 %
Temporal 60 / 96 62.5 %
Single-hop 207 / 282 73.4 %
Adversarial 731 / 841 86.9 %
Open-domain 368 / 446 82.5 %
Overall 1 651 / 1 986 83.1 %

The LOCOMO dataset is distributed separately and must be obtained by the reproducer; the preprocessed question order is pinned in bench_locomo.py. Run with python bench_locomo.py --llm to reproduce. See docs/benchmarks/LOCOMO.md for the full methodology and the pre-LLM 74.7 % baseline.

Accuracy is necessary but not sufficient. Remanentia also measures the axes leaderboards omit — sovereign no-egress accuracy, write-discipline, calibrated abstention, fleet-fed recall, and lineage-of-belief auditability — each as a tested metric module. See docs/benchmarks/SOVEREIGN_MEMORY_EVALUATION.md for the definitions, how each is measured, and the honest current status.

Trained components — honest status

The temporal-training programme produced five components with mixed outcomes. We publish a model card for each so downstream users can decide what to rely on; the rule-based date normaliser is the only one with a committed, measured benchmark impact. Full cards live at docs/models/README.md.

Component Status Note
C1 Embedding fine-tune UNCERTAIN 3 464 triplets, no retrieval A/B committed
C2 Cross-encoder fine-tune UNCERTAIN AP 84.57 % on own split; real-world eval pending (P2-13)
C3 Temporal relation classifier NON-FUNCTIONAL F1-macro 0.178 vs 0.167 random baseline — model did not learn the task, not wired into any default code path
C4 Date normaliser (rule engine) PROVEN 12 regex patterns drove temporal-reasoning +14.3 pp on LongMemEval
C4 Date normaliser (ML) weak / unused 24.8 % exact / 65.7 % relaxed — redundant vs rules
C5 Fact-validity model RETIRED The original checkpoint is undistributed. Fact decomposition uses lexical rules in standard installations.

Source: training/HONEST_ASSESSMENT.md.

MCP Integration

For Cursor or any MCP-compatible tool:

{
  "mcpServers": {
    "remanentia": {
      "command": "python",
      "args": ["path/to/mcp_server.py"]
    }
  }
}

Tools:

  • remanentia_recall — search with full context
  • remanentia_status — system status
  • remanentia_graph — entity relationship query

Set REMANENTIA_BASE before process startup to point ingest, retrieval, consolidation, note/temporal persistence, observation, reflection, CLI/API graph commands, worker state, freshness checks, remanentia init, and remanentia status at a custom memory store. remanentia init creates that store layout, while remanentia status reads its traces, semantic memory, graph files, state files, and freshness report from the same resolved root. Set REMANENTIA_STIMULI_DIR when the stimuli firehose lives outside that store. The user-service installer accepts the same selection as --base and --stimuli-dir; generated API, vector-worker, and freshness-watchdog units all export those paths, and the watchdog writes the freshness report under the selected store.

CLI

remanentia search "query"                    # search (alias for recall)
remanentia recall "query" --format context   # LLM-injectable context
remanentia recall "query" --format json      # machine-readable
remanentia consolidate                       # consolidate new traces
remanentia consolidate --force               # reconsolidate all
remanentia status                            # system stats for REMANENTIA_BASE
remanentia store-manifest --write --json     # record selected store paths/counts
remanentia store-sources --write --json      # write selected MemoryIndex source config
remanentia graph --top 15                    # entity relationships
remanentia entities                          # list all entities
remanentia init                              # create directory structure

REST API

remanentia serve --host 127.0.0.1 --port 8001

curl http://localhost:8001/health

For a fail-closed authenticated server:

remanentia serve --require-auth --token-file /run/secrets/remanentia_api_token

Container deployment:

mkdir -p secrets
printf '%s\n' '<replace-with-a-random-token>' > secrets/remanentia_api_token
docker compose up --build

OpenAPI schema export:

remanentia openapi --output docs/openapi/remanentia_openapi.json
curl -X POST http://localhost:8001/recall \
  -H "Content-Type: application/json" \
  -d '{"query": "STDP learning", "top_k": 3}'

curl http://localhost:8001/status
curl http://localhost:8001/entities
curl http://localhost:8001/graph?top=10

Python API

from memory_index import MemoryIndex

idx = MemoryIndex()
idx.build(use_gpu_embeddings=False)
results = idx.search("what did we decide about auth", top_k=5)

for r in results:
    print(f"{r.name} (score={r.score})")
    if r.answer:
        print(f"  Answer: {r.answer}")
    print(f"  {r.snippet[:100]}")

Rust Acceleration

The knowledge-store and PII-redactor wheels include checked Python types for their public and inner modules. See native type contracts for the build commands, direct-call limits and installed-wheel gate.

16 PyO3 crates built with maturin. Python fallback preserved in every module. The listed extensions accelerate their owning extraction, lookup and numeric paths; Python retains orchestration and extension-absent implementations.

Crate Peak speedup Wired into
remanentia_retrieve (new) 26.7× retrieve.py, memory_index.py (13 functions)
remanentia_consolidation 76.1× consolidation_engine.py (cluster_traces)
arcane_stdp Historical measurement snn_plasticity.py (homeostatic_scaling)
remanentia_consolidation 12.6× reflector.py (cluster_notes)
remanentia_answer_extractor 11.4× answer_extractor
remanentia_fact_decomposer Public shared-host comparison Mutable fact index and lexical extraction
remanentia_entity_extractor Historical regex: 8.5×; current relation comparison entity_extractor
remanentia_search 3–5× memory_index (BM25, Rayon)
remanentia_knowledge_store 3.5–4.6× knowledge_store
remanentia_temporal 2.3× temporal_graph (score_temporal_query)
remanentia_answer_normalizer Public shared-host comparison answer_normalizer
remanentia_skill_extractor ~1× skill_extractor
remanentia_active_retrieval ~1× active_retrieval

Full regex pipeline: 0.60ms (Rust) vs 9.07ms (Python) on 470K chars = 14.1× on large workloads.

Details: PERFORMANCE_TUNING.md

Research (Negative Results)

SNN-based retrieval was the original design. After 70+ experiments across 4 learning rules (STDP, BCPNN, Hebbian, E/I balanced), we proved it adds zero discriminative signal. Root cause: 384-dim embeddings hash-encoded into 20K-neuron patterns are too correlated for local learning rules. The current system uses BM25 + optional neural reranking because that's what works.

Full analysis: paper/remanentia_paper_draft.md

Tests

Use the development setup in CONTRIBUTING.md, then run:

.venv/bin/python -m pytest tests/ -q

Current local full-suite baseline: see VALIDATION.md (single canonical count; last recorded full gate 2,905 passed / 11 skipped on 2026-06-29). The CI coverage job is configured with --cov-fail-under=100; refresh the coverage report before publishing exact module-level coverage counts.

License

AGPL-3.0-or-later | Commercial license available

The AGPL path is USD 0 when its terms fit the deployment. A REMANENTIA commercial self-hosted licence is USD 299/month or USD 2,990/year. Implementation starts at USD 12,000 and managed operations start at USD 999/month; both are separately scoped services, not bundled into the software licence. No commercial right or service begins until it is recorded in an accepted order. See the canonical product-family pricing at https://www.remanentia.com/pricing.html.

The permanent commercial use limitation forms part of separately agreed commercial customer licences and order forms referring to this version. It covers text and data mining and machine learning, binds every Licensee and survives the contract term and Change Date. The addendum grants no licence by itself; the AGPL licence and rights remain unchanged. Order forms preserve the complete original text, version and SHA-256. The installed distribution includes it at share/remanentia/COMMERCIAL-TERMS.md.

Author

Miroslav Šotek (Anulum) | ORCID: 0009-0009-3560-0851


ANULUM      Fortis Studio
Developed by ANULUM / Fortis Studio

Text and data mining reservation

The rightsholder, Miroslav Šotek (ANULUM), expressly reserves the use of the works in this repository for text and data mining, including the collection of this content for, and its use in, training, fine-tuning or evaluating machine learning and artificial intelligence models, in accordance with Article 4(3) of Directive (EU) 2019/790 and the national provisions transposing it.

No permission for such use has been granted beyond what the licence in LICENSE grants. This reservation does not change that licence: uses the licence permits remain permitted on its terms, including its attribution and share-alike conditions.

Reservation made on 2026-10-19. Requests for permission: contact the rightsholder through the contact listed in this repository.

About

Local-first, auditable memory for AI agents and knowledge-intensive software

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages