Pre-alpha research kernel · v0.3.0a0

Memory that keeps the evidence attached.

EviCortex is a local-first Python engine for long-running LLM applications. It preserves exact observations, derives temporal and associative views, then compiles only the evidence a query needs under a hard estimated-token budget.

  • Python 3.12
  • SQLite + FTS5
  • Standard-library core
  • MIT licensed
Query path deterministic by default
conversation document tool result
01
Evidence ledger exact content · provenance · event time
durable
episodicordered events
temporalversioned claims
associativelinks + entities
03 Context capsule
≤ 300 estimated tokens
Derived memory can be lossy. The source evidence stays addressable and verifiable.

A three-plane design

Separate what must endure from what can evolve.

Flat chunk indexes often mix source storage, retrieval strategy, and prompt assembly. EviCortex gives each concern a distinct contract.

  1. 01

    Source of truth

    Evidence ledger

    Append exact observations with a stable ID, content digest, namespace, provenance, occurrence time, and recording time.

    • Original payload remains expandable
    • Content digests + optional idempotency
    • History survives later corrections
    “Genome” · a software metaphor
  2. 02

    Derived projections

    Rebuildable views

    Project evidence into episodic, lexical, semantic, temporal, entity, and graph views without promoting derivations to ground truth.

    • Versioned claims retain support
    • Provider identity and spans are durable
    • Deterministic indexes can be rebuilt
    “Engram” · useful, revisable indexes
  3. 03

    Query-time product

    Context compiler

    Filter by namespace before ranking, fuse retrieval channels, resolve temporal conflicts, diversify, and pack a bounded capsule.

    • Hard estimated-token budget compliance
    • Per-result score traces
    • Stable IDs for progressive disclosure
    “Transcript” · task-specific evidence
Evidence fidelityIndexes never silently rewrite source material.
Temporal truthCurrent claims do not erase the past.
Bounded contextCapsules never exceed the estimator’s requested budget.
Traceable retrievalEvery selection keeps its score contributions.
Read the architecture and invariants

Evidence, not adjectives

What the repository can say today.

These are controlled local checkpoints. Each result is paired with the comparator, workload, and tradeoff that gives the number meaning.

Prototype A 3 seeds · 1,000 events

40.6%fewer estimated context tokens

EviCortex retrieved every required source in the synthetic sweep and fixed the mechanical FTS5 chunk baseline’s update failure.

Evidence recall
100%
Storage ratio
1.502×
Retrieval p95
1.538×

The baseline is lexical and mechanical—not dense, hybrid, or production RAG. Storage and median retrieval were materially higher.

Inspect the result
Phase C semantic smoke 3 synthetic questions

199.0mean estimated context tokens

A pinned BGE encoder ran offline end to end. Both EviCortex and the hybrid retrieved all answerable gold sessions at rank 1.

Hybrid tokens
211.7
Recall all @1
100% / 100%
Abstention
0% / 0%

This verifies wiring only. It is not official LongMemEval, has no reader, and is far too small for a quality claim.

Inspect the smoke test

Run it locally

From checkout to temporal recall.

The deterministic core requires Python 3.12 and has no runtime dependencies outside the standard library.

01 · install from source
# Clone and enter the repository
git clone https://github.com/Varun-SV/EviCortex.git
cd EviCortex

# Create a Python 3.12 environment
python -m venv .venv

# Activate it, then install the local package
python -m pip install -e .
python examples/quickstart.py

Optional dense-encoder support is isolated in the local-transformers extra.

02 · remember and recall memory.py
from evicortex import ClaimInput, EviCortex

with EviCortex.open("memory.db") as memory:
    memory.remember(
        namespace="assistant/user-1",
        content="Ada prefers the dark theme.",
        source="conversation/42",
        claims=[ClaimInput(
            "user:ada", "prefers_theme", "dark"
        )],
    )
    capsule = memory.recall(
        namespace="assistant/user-1",
        query="Which theme does Ada prefer?",
        budget_tokens=300,
    )
    print(capsule.to_prompt())

Prototype A is an embedded library. A host application must authenticate callers and authorize namespaces; the local SQLite file is not encrypted.

Build on inspectable memory

Keep the source. Test the retrieval. Budget the context.

EviCortex is open for researchers and builders who want memory claims to be falsifiable, reproducible, and linked back to evidence.