-
-
Crash recovery function
-
Audit trail function
-
Day 1 Noise
-
Structure of Palimpsest
-
Episodic memory function
-
The palimpsest: a reconciled memory layered over the belief it superseded — old layer archived but still queryable.
-
Crash recovery — killed mid-run, the agent resumes from its CockroachDB checkpoint at story 3 with no paid tokens re-spent.
-
Logo of Palimpsest
Inspiration
Every AI agent forgets. Kill the process and everything it learned — user preferences, hard-won context, half-finished work — is gone. Teams treat agent memory as a cache, but memory is production state: it deserves the same durability, consistency, and auditability as any other data a business runs on. A palimpsest is a manuscript scraped clean and written over, with the earlier writing still visible beneath — exactly how agent memory should behave: new knowledge layers over old, and history is never destroyed.
What it does
Palimpsest gives any MCP-capable agent (Claude Code, LangGraph, a custom loop) persistent memory backed by CockroachDB:
- Episodic → semantic lifecycle — agents record what happens as they work; a nightly job (AWS Lambda + EventBridge code path) distills episodes into long-term, domain-level facts via Amazon Bedrock.
- Two-stage semantic retrieval — a SQL prefix filter (per-agent isolation) plus cosine ANN on CockroachDB's distributed vector index, in one query plan.
- History-preserving reconciliation — when a new fact contradicts an old one, Palimpsest writes a reconciled layer linked by a
supersedeschain and archives the old layer. Beliefs are auditable forever; nothing is overwritten. - Forgetting curve — memory heat = usage × recency decay; cold memories leave the retrieval index (archived, never deleted), as a single set-based SQL update.
- Crash-safe checkpoints — agents snapshot task state per step; after a crash they resume exactly where they died. Paid tokens are never spent twice.
- Full audit trail — every memory operation is logged.
The live demo is a news-briefing agent: on day one (no memory) it flags everything as important — noise. You give feedback, consolidation runs overnight, and on day two it triages precisely, citing the exact memories behind each decision. Then we kill it mid-run and watch it recover from its CockroachDB checkpoint.
How we built it
- CockroachDB Cloud (Basic) stores everything: a
memoriestable with aVECTOR(1024)column and a prefix-filtered cosine vector index(owner_id, embedding vector_cosine_ops), pluscheckpointsandaudit_logtables. TLS isverify-full. - CockroachDB Cloud managed MCP server — the developing agent introspects the memory store (schemas, indexes, live analytics) through Cockroach Labs' hosted MCP endpoint over read-only OAuth.
- Agent Skills — we distilled the schema patterns into a new skill,
designing-agent-memory-schemas, and contributed it upstream tocockroachlabs/cockroachdb-skills(PR #17). - Amazon Bedrock — Titan Text Embeddings V2 for all embeddings; Nova (switchable to Claude via one env var) for consolidation and arbitration.
- AWS Lambda + EventBridge — the nightly consolidation handler; the demo's "Nightly consolidation" button runs the identical code path.
- MCP server (Python, FastMCP over stdio) exposing six tools:
memory_write,memory_retrieve,memory_reflect(provenance layers),memory_consolidate,checkpoint_save,checkpoint_load. - Demo panel: FastAPI + a single-file frontend, deployed as a Vercel serverless function.
Challenges we ran into
- Consolidation quality is a retrieval problem. Our first consolidation prompt abstracted away the concrete terms ("advanced techniques"), and retrieval lost its signal; the fix was distilling facts at domain level while keeping the supporting example — measurably better day-two triage.
- New-account entitlements. Our fresh AWS account had no Anthropic-model access on Bedrock, so we built a provider-switchable LLM layer and shipped on Nova — one env var swaps Claude in.
- Serverless packaging. Getting psycopg + a static frontend into a Vercel Python function took explicit
includeFilesand a lean requirements split; TLS needed the certifi CA bundle on every platform.
Accomplishments we're proud of
- A real memory lifecycle — not a RAG demo: consolidation, temporal reconciliation with lineage, decay, checkpoints, audit.
- The kill-and-recover moment works live, in production, on the hosted demo.
- Every SQL statement in our upstream skill contribution was executed and verified against a live CockroachDB Cloud cluster.
- End-to-end tests run against the real cluster and real Bedrock — no mocks anywhere in the project.
What we learned
Treating memory as production state changes the design: once memory lives in a survivable distributed SQL database, crash recovery, multi-agent isolation, auditability, and even "what did this agent believe last Tuesday?" become SQL queries instead of research problems.
What's next
Hybrid retrieval (vector + keyword), memory sharing across agent teams with RBAC, a LangGraph adapter, and row-level TTL policies for regulated deployments.
Built With
- amazon-bedrock
- amazon-nova
- aws-lambda
- cockroachdb
- cockroachdb-cloud-mcp
- eventbridge
- fastapi
- mcp
- psycopg
- python
- titan-embeddings
- vector-search
- vercel
Log in or sign up for Devpost to join the conversation.