Inspiration

Every production AI system today relies on two fundamental layers: memory (to maintain multi-turn context) and retrieval (RAG over external documents). Yet almost every implementation suffers from the same hidden failure modes:

  1. Amnesia & Stateless Drift: Chat systems lose context across turns or store conversational history in brittle key-value caches decoupled from knowledge retrievals.
  2. License Contamination at the Door: Non-commercial (e.g., CC-BY-NC) or restricted code and papers quietly enter commercial knowledge bases without validation.
  3. Ghost Answers with Zero Audit Trail: When an AI produces a high-stakes decision, there is no immutable receipt proving which exact documents, license terms, and conversational turns produced it.
  4. No Point-in-Time Verification: Organizations cannot answer: "What exact documents were in our AI's index at 14:22 last Tuesday before a takedown request?"

With the EU AI Act (Articles 12, 13, & 53) now in force, this is no longer just a technical inconvenience—it carries fines up to €15M or 3% of global turnover.

We built ORIGIN to prove that agentic memory and regulatory provenance shouldn't be an afterthought. By building directly on CockroachDB's distributed ACID architecture and hardware vector indexing, combined with AWS serverless and storage infrastructure, ORIGIN provides an immutable, time-travelable memory and provenance engine for mission-critical AI workflows.


What it does

ORIGIN implements Five Specialized Agentic Memory Tiers on CockroachDB:

  • 🧠 1. Working Memory: Multi-turn session state (sessions, session_turns) with recency weighting and hardware-accelerated vector similarity recall over past turns.
  • 🛡️ 2. Semantic Memory: Learned, reinforced license rulings (license_determinations) that automatically increase in strength on reuse, preserving human-in-the-loop corrections via superseded_by chains.
  • 📜 3. Episodic Memory: Records past AI Q&A answers, exact document snippets, and immutable attribution receipts committed atomically in the database.
  • ⏳ 4. Temporal Memory: Bitemporal point-in-time rewind using native CockroachDB MVCC AS OF SYSTEM TIME queries cross-checked against application timestamps (admitted_at / removed_at).
  • 🔄 5. Task State Memory: Durable multi-step agent execution state (agent_tasks) with step-level persistence and instant crash resumption.

Core Provenance Guarantees:

  • The Single-Transaction Guarantee: The user prompt turn, agent response, generated answer, and exact document citations commit atomically in one single SQL transaction. An answer and its provenance receipt cannot suffer partial writes or drift apart.
  • Bouncer at the Door: Evaluates incoming documents against a strict permitted-use policy matrix before index creation. Incompatible licenses block the build immediately and quote the exact violating clause.
  • Blast-Radius Takedown Audit: When a document is soft-deleted due to a copyright takedown or right-to-be-forgotten request, ORIGIN instantly identifies every past answer that relied on it and flags downstream records for remediation.

How we built it

ORIGIN is architected across a distributed, high-performance CockroachDB and AWS stack:

  • CockroachDB Cloud (CCL v26.2.5):

    • Distributed Vector Indexing: 1024-dimensional embeddings stored with explicit vector_cosine_ops for fast hardware-accelerated cosine similarity search (<=>).
    • Serializable ACID Transactions: Automatic conflict retry handling (40001 serialization errors) ensuring atomic commits across session turns and attribution graphs.
    • MVCC Snapshot Isolation: Point-in-time time-travel queries (AS OF SYSTEM TIME) enabling instant historical corpus reconstruction.
    • CockroachDB Agent Skills & MCP Server: Applied 34 architectural skills across 6 domain packages and connected development agents via Cloud Managed MCP (https://cockroachlabs.cloud/mcp).
    • ccloud CLI Control Plane: Runtime cluster inspection via /api/v1/cluster monitoring live gateway topology and table zone configurations.
  • Amazon Web Services (AWS):

    • AWS Lambda & API Gateway (eu-central-1): Serverless public API and dashboard running a containerized Mangum ASGI handler with sub-200ms warm p50 response times.
    • Amazon S3: Encrypted, immutable document object storage (origin-provenance-248557779236).
    • Amazon SageMaker & Bedrock: Drop-in inference providers for real-time model text generation and semantic policy embeddings.
    • DataHub Integration: Automatic ingestion of lineage graphs and verbatim license strings into the enterprise metadata catalog.

Challenges we ran into

  1. CREATE VECTOR INDEX Operator Class Default: During development on CockroachDB v26.2.5, we discovered that CREATE VECTOR INDEX defaults to vector_l2_ops (L2 distance). Queries running cosine similarity (<=>) silently bypassed the vector index and performed full table scans. We fixed this across our schemas by explicitly configuring vector_cosine_ops.
  2. MVCC System Range Horizon vs Table TTL: Configuring gc.ttlseconds = 604800 (7 days) extends table row retention, but resolving table descriptors reads system catalog ranges with shorter default TTLs (~4-5 hours). We engineered a dual-validation algorithm (verify_integrity) that cross-checks MVCC storage against application bitemporal timestamps to gracefully handle deep historical queries.
  3. Lambda Container Packaging for ARM vs x86: ManyLinux C-extension wheels (psycopg[binary]) built on Windows required strict multi-arch Docker cross-compilation with --provenance=false --sbom=false flags to prevent OCI manifest errors on AWS Lambda.

Accomplishments that we're proud of

  • 93.3% Memory Hit Rate: Validated on our live cluster—93.3% of license determinations are recalled and answered directly from memory without invoking external models.
  • Sub-200ms Latency: Live benchmarked at 172ms p50 end-to-end response time across AWS Lambda and CockroachDB Cloud.
  • 100% Chaos Resilience: Simulated network partitions mid-ingestion (origin chaos ingest), proving that CockroachDB transactions rollback completely with 0 corrupted or orphaned records.
  • 274 Passing Automated Tests: Full test suite verifying memory recall, takedown cascades, vector search, and schema integrity.

What we learned

  • The true power of building agentic systems on CockroachDB lies in transactional atomicity. By binding memory and attribution receipts into the same commit cycle as the generation output, you eliminate state drift entirely.
  • Regulatory compliance under the EU AI Act does not require slow, bulky workflows—when built into the database layer via MVCC and vector search, it operates as a real-time, sub-second automated guardrail.

What's next for ORIGIN

  • Multimodal Provenance: Expanding the Bouncer Gate and vector indexing to audio, video, and code repositories.
  • Autonomous TDM Opt-Out Parsing: Direct real-time evaluation of robots.txt, ai.txt, and TDM Reservation Protocol headers during web ingestion.
  • Multi-Region Cross-Cluster Replication: Deploying CockroachDB multi-region survival zones to ensure localized data sovereignty compliance under GDPR and international AI regulations.

Built With

Share this project:

Updates

Submission history