The memory layer your agents can actually trust.
Contexta is open-source memory infrastructure for AI agents. The whole chain — ingest through retrieve — runs on your own hardware, with no cloud API keys.
1.0 Pipeline
The pipeline is the product.
Contexta is not a vector store with a prompt bolted on. Every observation walks the same nine stages, and each one is a place where a naive memory layer quietly goes wrong.
- 01Ingest
Observations and tool logs
- 02Redact
Fail-closed secret scrub
- 03Extract
Discrete facts, typed
- 04Dedup
Near-duplicate merge
- 05Score
Salience and confidence
- 06Graph
Typed entity edges
- 07Reconcile
Supersede contradictions
- 08Embed
1024-d local vectors
- 09Retrieve
Fused, reranked, current
Prefers PostgreSQL 16 on port 5432
Prefers Cloudflare D1 with edge replication
- 1.1 Ingest
- Turns, tool logs, and session events land in a durable outbox. Workers claim rows with SKIP LOCKED.
- 1.2 Redact
- A fail-closed stage scrubs API keys, JWTs, bearer tokens, and passwords before extraction runs.
- 1.3 Extract
- Raw text becomes discrete, typed facts with confidence and explicit temporal precision.
- 1.4 Dedup
- Near-duplicate extractions are merged before they become rows, so nothing restates a fact already held.
- 1.5 Score
- Importance and confidence are computed per fact, and a low-value extraction is dropped before it costs a vector.
- 1.6 Graph
- Entities and typed edges are resolved and written, so a fact can be reached through the people and things around it.
- 1.7 Reconcile
- A contradiction invalidates the old fact and records lineage. It never appends a second vector.
- 1.8 Embed
- A local Qwen3 embedding model turns the current fact into a 1024-dimension vector on your own hardware.
- 1.9 Retrieve
- Dense, lexical, and graph evidence fuse and rerank into current, tenant-scoped context.
Anagent'smemoryisonlyworthhavingifitistrue,current,andauditable.Mostmemorylayersappend,sothemomentauserchangestheirmind,bothversionscomebackandtheagentargueswithitself.
Amemorythatcontradictsanoldoneisinvalidated,notduplicated.Contextaclosesthestalerecordwithvalid_to,linkslineagethroughsuperseded_by_id,anddropsitfromactiveretrievalwithoutdestroyingthehistory.
Andnoneofitleavesyourmachine.EmbeddingsandrerankingrunonlocalQwen3models,sothereisnoAPIkeytoleakandnotraffictointercept.
2.0 Purpose-built
Purpose-built for memory. Not adapted from a search index.
Search infrastructure optimises for finding documents. Memory infrastructure has to decide what is still true, who is allowed to ask, and why a particular fact came back. Those are different problems, and they deserve different machinery.
Truth, not append
A contradicted memory is closed out and linked to its replacement. A partial unique index guarantees at most one current fact per slot, so contradictions cannot pile up in the vector store.
Scoped by construction
Every repository derives from a tenant-scoped base, so organization isolation is inherited rather than remembered. There is no query in the codebase that can forget it.
Explainable on retrieval
Every hit carries its provenance: originating session, extraction confidence, temporal basis, and the full supersession chain that produced the fact you were handed.
3.0 Retrieval
Three channels, one ordering.
Vector search misses the port number. Keyword search misses the intent. Graph traversal misses nothing, but only if it is bounded. Contexta runs all three, fuses the candidate pools, and reranks what survives.
| mem_88b | 0.942 |
| mem_41a | 0.918 |
| mem_77c | 0.901 |
| mem_12d | 0.884 |
| mem_88b | 9.41 |
| mem_12d | 8.06 |
| mem_41a | 7.55 |
| mem_63f | 6.20 |
| mem_88b | 0.97 |
| mem_77c | 0.93 |
| mem_41a | 0.88 |
| mem_90e | 0.74 |
Prefers Cloudflare D1 with edge replication
- rrf
- 0.0328
- reranker
- 0.97
- valid_to
- null
- 3.1 Dense vector
- Cosine similarity over pgvector HNSW, tuned so a filtered query cannot collapse the graph.
- 3.2 Lexical
- A real GIN tsvector predicate for ports, identifiers, and exact tokens a vector misses.
- 3.3 Graph
- Typed, multi-hop traversal as a single capped recursive CTE over entity edges.
- 3.4 Fusion
- Reciprocal Rank Fusion merges the three candidate pools into one ordering, with k = 60.
- 3.5 Rerank
- A local cross-encoder scores the fused set, then read-age decay is applied on every hit.
Cascade mode goes further: lexical and graph evidence are gathered first, and the dense channel is only consulted when that primary evidence is judged insufficient. Freshness scoring honours temporal precision, so a fact the extractor only knows approximately is not scored as though it were exact.
4.0 Sovereignty
Runs on your hardware. Not ours.
Sovereignty is a default, not a setting you have to find. The first install makes no external calls at all; going online is a deliberate, documented choice you make yourself.
Fully offline
Contexta boots with no external credentials. Embedding and reranking run against local Qwen3 models on your own hardware, and the database never leaves the machine it is on.
- Embedding
- Qwen3-Embedding-0.6B · 1024-d
- Reranking
- Qwen3-Reranker-0.6B
- Outbound calls
- none
Bring your own key
Online extraction is strictly opt-in through a compose profile or an explicit environment variable. You supply the provider key, the traffic goes directly to that provider, and nothing is resold in between.
- Providers
- OpenAI · Anthropic · DeepSeek
- Activation
- CONTEXTA_ENGINE_MODE=online
- Outbound calls
- to your provider only
5.0 Surfaces
Three surfaces, one engine.
A human needs somewhere to look, an agent needs two calls, and traffic needs a front door that can be attacked safely. Only the front door is stateless by design.
Operator console
A memory inspector, entity graph viewer, API key manager, and live observation ingest. This is the surface a human uses to find out what the agent actually believes and why.
- Per-memory lineage view
- Entity graph exploration
- Key issuance and revocation
Agent SDKs
Two calls carry the whole surface: observe() records a turn, context() returns the facts worth putting in a prompt. The client libraries stay deliberately thin so the engine stays the interesting part.
- Automatic redaction on observe
- Token-budgeted context packing
- Sync and async clients
Stateless edge
TLS termination on port 8443 with Redis-backed API-key verification and rate limiting. It holds no storage and no staging tables, so there is never a second copy of your memory to keep in sync.
- Redis-backed key verification
- Per-key rate limiting
- No persistent state
6.0 Changelog
All release notes →v1.5.1
The release that made the stack honest about itself. Ollama now runs inside Compose with automatic model provisioning, extraction reads long conversations in chunks instead of truncating them, the console was rebuilt around a single-operator flow, and a new-user walkthrough run against a wiped volume found two defects the existing suite had walked past — one of them a port published to the whole network under a comment that claimed the opposite.
Read the v1.5.1 notes- Warm extraction
- 1.23 → 11.33 tok/s
- Chunked recall
- 13/90 → 70/90
- Backend tests
- 392 → 409
- New-user walkthrough
- 22/22
- Docs topics
- 8 → 20
- Mojibake files
- 49 → 0
Added
- Chunked extraction, defaulting to 10 sentences or 1,600 characters per chunk, with merge, dedupe, truncated-JSON salvage and per-chunk failure isolation. One bad chunk no longer costs you the rest of the message.
- Real-server recall over a 90-fact conversation went from 13/90 to 70/90, and a standalone 30-fact set from 24/30 to 30/30.
Changed
- Rebuilt light-first around a Notion-style shell and a single token system, replacing the page-by-page styling.
- The entity graph gained force-directed layout, search, relationship filters, edge labels, neighbourhood focus, pan and zoom, a table view and a deterministic fallback for large graphs.
Fixed
- The MCP container authenticated one tenant once at startup, from CONTEXTA_MCP_API_KEY, and then served that tenant to every caller that could open the port — but the port was bound to 0.0.0.0 and the Compose comment claimed it "authenticates every caller". The port is now bound to 127.0.0.1 and the comment describes what the code actually does. Put a reverse proxy with per-client auth in front of it before exposing MCP beyond the host.
- A stale or revoked MCP key now reports which of the two problems it is, instead of a bare "unknown or revoked".
Performance
- Ollama is a service in the stack now, with a named model volume and a one-shot provisioner, so the extractor no longer depends on something installed on the host.
- The image's default thread allocation fragments the pool across speculative sequences, which on a small box left a single extraction request using a fraction of the cores. Setting OLLAMA_NUM_PARALLEL=2, a 30-minute keep-alive and a single loaded model took warm throughput from 1.23 to 11.33 tokens per second — faster than the host Ollama it replaced, so running it in the stack costs nothing.
Removed
Three releases are on the record. v1.5 also carries upgrade guidance for the entity uniqueness constraint, the closed relationship type set, and the dropped billing schema.
7.0 Questions
Frequently asked.
The six things people ask before they run it locally.
Contexta is open-source memory infrastructure for AI agents. It is not a chat log and not a bare vector store: it runs a fixed pipeline — ingest, redact, extract, dedup, score, graph, reconcile truth, embed, retrieve — and exposes memory to your agent through two calls, observe() and context().
Give your agents a memory they can trust.
The whole pipeline runs on your hardware, with no cloud keys and no data leaving the machine. Apache 2.0 for personal and self-hosted use.