Skip to content
Architectural Directory · 01–09 Subsystems

Memoryengineeredforautonomousreasoning.

Contexta decomposes durable memory into three synchronized planes: zero-trust ingestion, self-healing truth maintenance, and sub-50ms hybrid recall.

Empirical Milestone Verification

Contexta is the first sovereign memory platform that runs 100% offline and scores more than 75% on the comprehensive LoCoMo benchmark (78.60%) using an ultra-compact 1B parameter model (gemma3:1b).

< 42ms P99 Hybrid Recall
82.2% Token Reduction
0.00% Contradiction Rate
100% Sovereign Offline
01/Memory Architecture

Tri-Modal Memory Layer

Vector search understands synonyms and intent, but fails on exact identifiers like port numbers, UUIDs, and technical variables. Contexta binds every memory across three synchronized representations in a single pass.

Contexta 3D Isometric Memory Core Art
Isometric Architecture Visual · Subsystem 01

Quantum Neural Memory Core

1-bit dithered isometric schematic visualizing Contexta's tri-modal binding plane: continuous 1024-D vector space intersecting with lexical tokens and entity relational edges.

Tri-Modal Memory Representation
INPUT:"Alice is deploying the staging cluster on us-east-1 with PostgreSQL and pgvector on port 5432."
deployslocated_inusesextensionportAliceEntity: PersonStaging ClusterEntity: Infraus-east-1Entity: RegionPostgreSQLEntity: DatabasepgvectorEntity: Extension:5432Attribute
Enables multi-hop associative recall across distant sessions.PostgreSQL Graph Schema + Typed Edges
1024-D Vectors

Captures conceptual analogies and conversational intent using local Qwen3 embeddings.

Lexical TSVECTOR

Enforces exact matches for code identifiers, database ports, IP addresses, and UUIDs.

Knowledge Graph

Traverses typed entity relationships up to 2 hops for multi-session associative recall.

02/Recall Engine

Hybrid Retrieval & Neural Reranking

Instead of choosing between slow cloud roundtrips or inaccurate single-vector searches, Contexta generates candidates concurrently across three channels, fuses them via Reciprocal Rank Fusion, and cross-scores with a local neural reranker.

Hybrid Retrieval Pipeline & Reranking Simulator
P99 Latency: 31.4msReciprocal Rank Fusion
Select Agent Prompt:
Tri-Channel Candidate GenerationNeural Cross-Encoder Scoring (Qwen3-Reranker-0.6B)
# 1Staging cluster uses PostgreSQL with pgvector listening on port 5432.
97.8% salience
Vector81%
Lexical BM2599%
Graph Hop94%
# 2Alice configured us-east-1 firewall to allow ingress on 5432 from internal VPC.
89.2% salience
Vector74%
Lexical BM2596%
Graph Hop88%
Every retrieval triggers read-age salience updates (`touch_accessed`).100% Offline-First Model Server
Sub-50ms Recall Guarantee:

HNSW vector scan + BM25 GIN lookup + recursive CTE graph traversal execute in parallel against PostgreSQL. Candidates are reranked locally in under 42ms.

03/Zero-Trust Ingestion

Sanitized Ingestion & Secret Redaction

Developers and agents regularly paste environment variables, bearer tokens, and private credentials into prompts. Contexta scrubs secrets deterministically before any text is vectorized or committed to disk.

Zero-Trust Ingestion Redaction Playground
Automated Credential Masking (Zero Secrets Enter Memory)
Try Sample:
Raw Incoming Observation Turn:Editable
Sanitized Memory Fact:Zero Leakage
User: Connect to postgresql://admin:[REDACTED_PASSWORD]@ssw0rd9982!@staging.db.internal:5432/memento using OpenAI key [REDACTED_API_KEY] and JWT Bearer [REDACTED_BEARER_TOKEN]
Runs synchronously at ingestion gateway before vectorization or LLM reflection.Deterministic Regex Sanitization
Automatic Pattern Masking:

Scans for OpenAI keys, GitHub PATs, AWS credentials, JWT tokens, and Luhn-validated credit cards. Masked records are stamped [REDACTED] and logged for audit.

04/Truth Engine

Bi-Temporal Truth Maintenance

When users update facts, standard memory engines keep both versions, causing the agent to hallucinate or argue with itself. Contexta maintains a clean timeline: older facts are superseded, never deleted.

Contexta Bi-Temporal Truth Engine Art
Bi-Temporal Chrono-Plane · Subsystem 04

Intersecting Historical & Valid-Time Manifolds

1-bit dithered projection illustrating the bi-temporal state lattice: superseded historical facts are archived with valid_to timestamps while active truth manifolds stay pristine.

Bi-Temporal Truth Engine & Contradiction Resolution
INVALIDATED (SUPERSEDED)Turn 1 · March 15, 2024

"Caroline lives in San Francisco and works at Stripe."

valid_from: 2024-03-15T10:00:00Z
valid_to: 2024-06-22T14:15:00Z (invalidated)
superseded_by: mem_caroline_02
CURRENT ACTIVE TRUTHTurn 2 · June 22, 2024

"Caroline moved into her new apartment in Lincoln Park, Chicago for medical residency."

valid_from: 2024-06-22T14:15:00Z
valid_to: NULL (Active)
lineage_previous_id: mem_caroline_01
Agent queries ask: "Where does Caroline live?" $\rightarrow$ Returns Chicago with 100% confidence. Stale San Francisco record is filtered out from active retrieval automatically.
Non-destructive updates preserve full audit compliance without vector pollution.PostgreSQL Bi-Temporal Engine
Temporal Invalidation:

Outdated records are marked with valid_to = now() and linked via superseded_by_id. Active queries filter WHERE valid_to IS NULL, guaranteeing 100% current truth.

05/Token Efficiency

Context Compression & Token Planning

Stop flooding LLMs with 25,000 raw transcript tokens. Contexta extracts discrete facts and packs only the top 3–5 high-priority items into your token budget, slashing API costs by over 80%.

Context Compression & Dynamic Token Budget Planner
84.0% Token Overhead Reduction
Target LLM Context Budget Allocation:4,000 tokens
2,000 (Aggressive Lean)4,500 (LoCoMo Benchmark Optimal)12,000 (Deep Multi-Project)
Naive Chat Context DumpUncompressed
25,000 tokens/turn

Floods the model with raw transcript history. Suffers from "lost-in-the-middle" attention degradation and 4x higher API billing.

Cost per 10k turns: $750.00
Contexta Precision BudgetVerified on LoCoMo
4,000 tokens/turn

Packs discrete, truth-validated memory statements, active task goals, and entity relations into a crisp, deterministic system package.

Cost per 10k turns: $120.00Save $630.00
Injected Memory Budget Breakdown (4,000 tokens):100% Signal
Task State (1000t)
Memory Facts (1800t)
Graph Edges (800t)
Buffer (400t)
Benchmark Verified Efficiency:

LoCoMo benchmark evaluation: Contexta achieved 78.6% reasoning accuracy using an average of 4,457 tokens per query, compared to 25,000+ tokens for raw transcript dumps.

06/Protocol Standard

Native Model Context Protocol (MCP) Server

Plug durable memory directly into Claude Desktop, Cursor, Antigravity, and autonomous agent frameworks with a single line of config. Automatic cross-session memory without custom glue code.

Native Model Context Protocol (MCP) Server Setup
Stdio & SSE Dual Transports Supported
Configuration Path:~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "contexta": {
      "command": "python",
      "args": ["-m", "contexta.mcp"],
      "env": {
        "CONTEXTA_BASE_URL": "http://localhost:8000",
        "CONTEXTA_ORG_ID": "00000000-0000-0000-0000-000000000001"
      }
    }
  }
}
Exposed MCP Tool Capabilities:
contexta_remember

Persists an atomic observation with credential sanitization, importance scoring, and entity resolution.

contexta_recall

Performs sub-50ms hybrid search across dense vectors, BM25 keywords, and the knowledge graph.

contexta_get_context

Builds a tightly budgeted context prompt package ready to inject into the LLM system prompt.

contexta_dream

Triggers a background truth maintenance pass to resolve contradictions and update graph clusters.

contexta_explore_graph

Traverses typed entity relationships and multi-hop connection lineages across past conversations.

07/Background Reflection

Automated Dream Cycles

While observation ingestion is instantaneous, asynchronous workers consolidate memories, prune noise, recalculate read-age decay, and link entities discovered across disjoint chats.

01 · Consolidation

Clusters scattered observations into single authoritative facts, preventing memory sprawl.

02 · Graph Linking

Discovers relationships between entities mentioned across different sessions over weeks.

03 · Read-Age Decay

Continuously re-weights memory salience curves based on real recall frequency and recency.

04 · Gap Discovery

Identifies missing background context and flags ambiguous premises for clarification.

08/Developer Experience

Lightweight Client SDKs & REST Ingress

Ergonomic Python and TypeScript client libraries built around two core calls: observe() to record turns with automatic redaction, and context() to fetch relevant facts in under 50ms.

Universal Client SDKs & REST Ingress
$pip install contexta-ai
import asyncio
from contexta import ContextaClient

async def main():
    client = ContextaClient(
        base_url="http://localhost:8000",
        organization_id="00000000-0000-0000-0000-000000000001"
    )

    # 1. Observe conversation turn (auto credential redaction)
    obs = await client.observe(
        user_id="user_alice_42",
        messages=[
            {"speaker": "user", "text": "I am moving to Seattle next month with my golden retriever."},
            {"speaker": "assistant", "text": "That is exciting! Seattle is a great dog-friendly city."}
        ]
    )

    # 2. Sub-50ms hybrid context recall
    ctx = await client.context(
        user_id="user_alice_42",
        query="What city is Alice relocating to?"
    )
    print("Retrieved facts:", [m.content for m in ctx.memories])

if __name__ == "__main__":
    asyncio.run(main())
Simulated Server Response
{
  "status": "success",
  "observation_id": "obs_4f92d184",
  "retrieved_memories": [
    {
      "content": "Alice is moving to Seattle next month (July 2024).",
      "memory_type": "event",
      "salience": 0.984,
      "latency_ms": 32.1
    },
    {
      "content": "Alice owns a golden retriever.",
      "memory_type": "fact",
      "salience": 0.912,
      "latency_ms": 32.1
    }
  ],
  "token_budget_used": 142
}
09/Enterprise Isolation

Zero-Trust Multi-Tenancy Architecture

Every database interaction inherits from TenantScopedRepository. Queries are cryptographically scoped by organization and user tenancy at the repository base kernel.

TenantScopedRepository

Queries automatically append WHERE organization_id = :tenant_id to all relational and vector lookups.

Pre-Filtered Vectors

HNSW vector indexes and TSVECTOR GIN searches enforce pre-filtering constraints on tenant partition keys.

Zero Billing Bloat

Contexta Core is completely free of credit meters, paywalls, or lockouts. Pure high-performance memory.