Inspiration

John CEO is a private AI coworker: each customer gets a dedicated workspace where conversations, files, and connections never mix with anyone else's. John helps on Slack (for teams) and Telegram (for solo operators) - drafting replies, checking calendars, and closing loops in the apps you already use.

The hard part is not the chat. It is memory: John should remember that you prefer bullet-point updates, that your Q3 priority is the Berlin launch, and what you decided in last Tuesday's thread - without you repeating yourself every session.

Most agent memory demos use in-process maps or a separate vector database that drifts from operational state. We built John CEO Agentic Memory to prove that durable, queryable, transactionally consistent memory belongs in the database layer: CockroachDB native VECTOR columns, distributed vector indexes, and serverless AWS execution - not a bolt-on sidecar.

This project is our CockroachDB x AWS hackathon entry and an open-source slice of the memory architecture we are building for John CEO.

What it does

John CEO Agentic Memory is an open-source Model Context Protocol server that gives agents (including John) four memory tools:

Tool Purpose
memory_write Persist a preference, fact, event, or task with Bedrock-derived summary, tags, salience, and a 1024-d embedding
memory_search Semantic top-k recall through CockroachDB's vector index
memory_recall_context Pack the most important memories into a token budget for prompt injection
memory_forget Consolidate near-duplicates and decay stale low-salience memories

Every write runs in one transaction: memory row + session state stay in sync. Multi-tenant deployments filter by user_id with token-bound ACL - the same isolation model John CEO needs when every customer has their own private workspace.

Live MCP demo: https://l4ohjmgz52.execute-api.eu-central-1.amazonaws.com/

Product: https://john.ceo

How we built it

We extracted the memory layer as a standalone MIT module so judges can run it without our proprietary app - while the story stays anchored to a real product need.

Write path (agents like John):

  • MCP client -> API Gateway -> AWS Lambda (Node 20)
  • Amazon Bedrock: Titan Text Embeddings V2 (1024-d) + Amazon Nova Lite (analyze/consolidate)
  • CockroachDB Cloud: memories table with VECTOR(1024) and VECTOR INDEX (user_id, status, embedding vector_cosine_ops)
  • Auth via AWS Secrets Manager (Bearer token + bound userId)

Audit path (operators):

  • Cursor / Claude Code -> CockroachDB Cloud Managed MCP (https://cockroachlabs.cloud/mcp) read-only
  • Inspect schema, sample rows, and query plans without the application write token

Provisioning: scripts/ccloud-bootstrap.sh uses the ccloud CLI to create the database, apply schema.sql, and grant least-privilege DML to the app user.

CockroachDB Agent Skills from cockroachlabs/cockroachdb-skills directly shaped the code: retry backoff/jitter, idempotent session counters, statistics-aware index validation, and privilege hardening ([docs/skills-used.md](https://github.com/John-CEO-HQ/cockroachdb-x-aws-hackathon/blob/main/docs/skills-used.md)).

Evidence and benchmarks: [docs/RESULTS.md](https://github.com/John-CEO-HQ/cockroachdb-x-aws-hackathon/blob/main/docs/RESULTS.md)

Challenges we ran into

  1. Vector index silently unused. With the default vector_l2_ops opclass, cosine queries (<=>) fell back to a full table scan. Fix: declare vector_cosine_ops explicitly. Verified with EXPLAIN on 1000+ rows.

  2. Recency filters break ANN. Adding a non-prefix predicate like created_at_ms >= x disqualifies the vector index (CockroachDB SQLSTATE 42809 when hinted). Fix: apply recencyDays in application code after vector retrieval.

  3. Empty tables lie. On an unseeded cluster, the optimizer chose brute-force top-k even with a valid index. Fix: seed representative data (npm run seed:demo) and run ANALYZE before demoing EXPLAIN.

  4. Idempotency under retry. CockroachDB serialization failures (40001) require replaying whole transactions. A naive memory_count + 1 increment double-counted on upsert and on retry. Fix: derive memory_count with COUNT(*) in the same transaction.

  5. Serverless wiring. Lambda reserved env keys, Function URL public-access blocks on some accounts, and Bedrock model availability in eu-central-1 (Nova Lite works; Anthropic models need a separate use-case form). We ship API Gateway as the public demo URL.

Accomplishments that we're proud of

  • Built real infrastructure for a production product problem (John CEO's long-term memory), not a disconnected toy demo.
  • End-to-end live demo with real Bedrock embeddings and CockroachDB persistence (not fake mode).
  • EXPLAIN proof that idx_memories_user_embedding is used: vector search with prefix spans on user_id + status ([docs/evidence/explain-vector-search.txt](https://github.com/John-CEO-HQ/cockroachdb-x-aws-hackathon/blob/main/docs/evidence/explain-vector-search.txt)).
  • Automated integration test gated on SEED_INTEGRATION=1 that asserts the plan contains vector search.
  • Two CockroachDB tools in one story: Distributed Vector Indexing (write path) + Managed MCP (read-only audit path).
  • Open-source MIT module judges can run locally while learning about John CEO at https://john.ceo

What we learned

  • Vector indexes are not "set and forget": opclass, prefix columns, and table statistics all change whether ANN actually runs.
  • Keeping embeddings and operational rows in one CockroachDB table avoids the consistency gap of a separate vector DB.
  • Managed MCP is a strong operator story: agents write through your app; humans audit through Cockroach's hosted endpoint with read-only defaults.
  • CockroachDB Agent Skills are most valuable when they produce traceable code changes (retry logic, grants, schema), not vague inspiration.

What's next for John CEO Agentic Memory

  • Wire this memory layer into John CEO's production agent loop at https://john.ceo (per-customer private workspace isolation).
  • Publish the MIT repo and a <3 min demo video for judges.
  • Optional: Anthropic Bedrock use-case form to A/B Nova Lite vs Claude for summarization.
  • Hardening: rate limits, per-tenant quotas, and CI running smoke-lambda.sh + test:lambda on schedule.
  • Deeper forgetting policies (importance-weighted decay) and hybrid metadata filters beyond user_id + status where the index contract allows.

Built With

Share this project:

Updates

Submission history