Inspiration

An AI agent is only as reliable as what it can remember. Most agent "memory" is just the context window — it vanishes when the session ends — or a bolt-on vector store that drifts out of sync with the agent's real data. We wanted memory that behaves like memory: it ranks what matters, strengthens what's used, and forgets what isn't — on infrastructure that survives real-world scale.

What it does

Perseus Vault is an agentic memory core that gives an agent what a context window can't:

  • Store — text + JSONB metadata; Amazon Bedrock (Titan V2) embeds it; committed to CockroachDB in one transaction with an append-only event record.
  • Recall (ranked) — a candidate pool from CockroachDB's distributed vector index, re-ranked by salience × (0.60·similarity + 0.25·recency + 0.15·frequency).
  • Reinforce — recalled memories gain salience, so useful knowledge strengthens with use.
  • Decay — a scheduled pass ages salience and archives neglected memories (nothing hard-deleted; the event log keeps history).
  • Inspect — the CockroachDB MCP Server exposes the same cluster for natural-language querying, vector search, and monitoring.

How we built it

  • Memory engine (vault_core.py): provider-agnostic store / recall / reinforce / decay.
  • Data model (db_schema.py): relational + event-sourced — agents, memories (VECTOR + C-SPANN cosine index, JSONB + inverted index, salience/decay), memory_events (append-only, FK-linked). Multi-region survivability SQL included.
  • Embeddings: Amazon Bedrock Titan V2 (bedrock_agent.py); OpenAI fallback (agent.py).
  • Serving: AWS Lambda container (lambda_handler.py) + Flask for local dev — /remember, /recall, /decay, /health.
  • CockroachDB MCP Server: mcp_config.json wires the official server to the same cluster; verify_mcp.py preflights it.
  • Maintenance: decay.py, schedulable via Amazon EventBridge → Lambda.

Why CockroachDB + AWS

  • One consistent source of truth — structured state and vector memory in the same distributed, transactional DB; no dual-write drift.
  • Distributed vector indexing — native VECTOR + C-SPANN ANN index scales similarity search horizontally.
  • Survivability — multi-region locality (REGIONAL BY ROW, SURVIVE REGION FAILURE).
  • AWS-native — Bedrock embeddings, Lambda makes "memory survives stateless invocations" provable, EventBridge schedules decay.
  • Agent-operable — the CockroachDB MCP Server enables natural-language access to the store.

Challenges we ran into

  • Making cross-session persistence demonstrable — solved by running fully stateless on Lambda so only CockroachDB carries state.
  • Ranking beyond nearest-neighbor without a second system — an in-query candidate pool + composite re-rank over columns CockroachDB already tracks.
  • Keeping decay non-destructive and auditable — an archive flag + event log instead of hard deletes.

What's next

  • Semantic consolidation of related memories; adaptive per-agent ranking weights; streaming decay via CockroachDB changefeeds (CDC).

Built With

Share this project:

Updates