Skip to main content

Deterministic, auditable, self-consolidating memory for AI agents

Project description

PrismCortex

Deterministic, auditable, self-consolidating memory for AI agents.

Most agent "memory" is an append-only chat log that you stuff back into the context window until it overflows. PrismCortex does what a brain does instead: it digests each turn into a knowledge graph, consolidates uncertain facts in the background (like sleep), and demotes the LLM from thinker to renderer — it only paints the facts you hand it. Change the memory and only the affected answers change; everything is traceable to the exact facts and source events behind it.

It's the orchestration layer over five shipped Insight ITS packages — PrismLang, PrismRAG, PrismResonance, PrismLib, and Chorus Fabric — behind one tiny API.

from prismcortex import reference_memory

mem = reference_memory(cache_path=".prismcortex_cache/demo.json")

mem.digest("My production deploy budget is $40,000.")
print(mem.recall("What's my deploy budget?").answer)        # → "$40,000"

mem.digest("Correction: my deploy budget is now $55,000.")  # fast-tracked (ALERT)
print(mem.recall("What's my deploy budget?").answer)        # → "$55,000"
# …and the $40,000 fact is still on record, time-stamped, for audit/time-travel.

Why it's different

Append-only RAG PrismCortex
Storage every chat turn graph topology (the gist)
Updates append + hope retrieval ranks it bitemporal: invalidate old, add new, keep history
Determinism none (logs + LLM both drift) content-addressed render cache, replay-identical
Cost re-extract context every call salience-gated writes, cached reads
Audit grep the logs every answer → exact facts + source events

What you get that a vector store can't

Capability What it does
Explainability (/explain) Every answer returns its evidence trail — the exact facts, their source events, and confidence. A vector store returns memories; only a provenance graph returns evidence.
Confidence + freshness Each recall reports how reinforced its facts are (0–1) and when they were last confirmed.
Time-travel / audit Corrections invalidate but retain the old fact as a queryable bitemporal record (a paid feature in Mem0 OSS).
Bounded memory sleep() prunes the coldest facts to a cap — the active set plateaus instead of growing forever; pruned facts are kept for audit.
~12× smaller index 128-dim vectors vs the 1536–3072-dim default elsewhere; plus entity-dedup.
Sovereign Self-hosted, your data, offline-keyed — no third-party SaaS.

These are validated in benchmarks/ (incl. a fair head-to-head vs Mem0 in vs_mem0.py).

Determinism, honestly

We do not claim "temperature 0 → identical output" — that's false for any shared API model (batching + floating-point non-associativity flip near-tied tokens). Instead:

  • Content-addressed rendering. The cache key is a hash of the exact retrieved subgraph + query + template + pinned model snapshot. The model is invoked at most once per unique (query, memory-version); its answer is frozen and replayed byte-for-byte. A changed fact changes the key, so a stale answer is unreachable — invalidation and determinism are the same mechanism.
  • Extractive facts. Numbers, names, ids, and dates are substituted from the graph, not generated, and a verification pass rejects fabricated values — so the facts are deterministic even on the first render; only prose phrasing can vary (then it's frozen).

Scope: replay-determinism, pinned model snapshot, snapshot sources (not live feeds). First-render token determinism requires the self-hosted sovereign tier. See DESIGN.md §2.

Architecture (one engine, five swappable ports)

digest(text) ─▶ salience gate ─▶ extract gist ─▶ delta in RAM
                                                   ├─ certain / urgent ─▶ commit  (version++)
                                                   └─ uncertain ───────▶ staging buffer
                                                                              │ sleep()
                                                                       consolidate ─▶ commit (version++)

recall(query) ─▶ retrieve subgraph @version ─▶ content-address ─▶ cache hit? replay
                                                                  miss? render once → freeze
Port Reference adapter Production (pip install prismcortex[prism])
Gist projection hashing-trick embeddings prismlang
Graph store (bitemporal) in-memory prismrag-patch
Weight / salience / sleep in-process prismresonance
Render cache (durable) JSON file prismlib (cache-as-failover)
Mesh broadcast in-process prismlib cluster / Chorus
Extraction + rendering real Gemini (prismcortex[gemini])

Install & test

pip install -e .                      # core
pip install -e ".[gemini]"            # + real Gemini extraction/rendering

pytest tests/test_graph_engine.py     # deterministic substrate — no API key
GEMINI_API_KEY=... pytest             # full end-to-end with real Gemini

Licensing

Open-core (MIT). The core (digest/recall, bitemporal graph, determinism cache) is free. Commercial modules (audit console, consolidation-at-scale, multi-agent mesh, the sovereign determinism tier) are gated by an offline signed license key — no phone-home, works air-gapped. See DESIGN.md §7.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prismcortex-0.2.1.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prismcortex-0.2.1-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

Details for the file prismcortex-0.2.1.tar.gz.

File metadata

  • Download URL: prismcortex-0.2.1.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for prismcortex-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8f02ce2374c7b709013faf8926cfdfcb1562b989264b78c4260e23b12f3a0a59
MD5 a66237c69cfd0d9674c378f3735462f2
BLAKE2b-256 548fbb77fc957b89ebbaaa6b8dacd43498ec3e3f9505f006211209f160c4e9c4

See more details on using hashes here.

File details

Details for the file prismcortex-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: prismcortex-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 49.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for prismcortex-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8873bfabab8e50f1bbc5474c2e81e298ddc41d1778a87118162fe5470b9dd047
MD5 631a3ac20d381cb0b4ad61acfb97ac0c
BLAKE2b-256 a1c29340ed946af68670abb0e60515367fb040a626c634e920f493cc2b036807

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page