Back to portfolio
SERVICE · port 5009 · live

Memory Archive

The central brain for every agent across the system. PostgreSQL-backed memories + instructions + sessions register + a knowledge graph of nodes and edges. Exposed as 30+ MCP tools so any Claude session — anywhere — can pull live context, capture new memories, and route work to specialized review agents.

How it works, end-to-end

From a session start to a stored learning. Particles flow both ways — the graph isn't a one-way pipe, it's a feedback loop.

Why this exists

Every Claude session in this repo starts cold. Without a brain, every session re-asks the same questions: which port is which, what was decided last week, what's the live state of the deploy pipeline, who owns this service. Memory Archive answers all of that before the model writes a token.

It is not a vector store wearing a marketing hat. It's a four-tier system: memories (curated, importance-weighted, decay-aware), instructions (rules that age well), sessions (auditable agent register), and a knowledge graph (services, agents, decisions, learnings as first-class nodes with explicit edges).

The four pillars

Each tier is opinionated about what it stores, how it ages, and who's allowed to write.

Memories
capture · search · decay
Importance-weighted entries with type tags (LEARNING / DECISION / PATTERN). Hybrid search combines pgvector embeddings with keyword filters. Decay job demotes stale low-importance items so the active context stays relevant.
capture_memory hybrid_search list_memories update_memory apply_decay
Instructions
rules that age well
Standing corrections, conventions, and explicit don'ts. Loaded into every session via the entry hook. Quality rules govern how instructions are written so they don't rot.
get_instructions capture_memory (instruction type)
Sessions register
agent audit · 48h window
Every Claude session writes session_id, cwd, agent_key, and hook_fired bool. Cheap insurance that the context-loading discipline is working — you can't tell me a session was rule-following if there's no row.
session_register session_start session_end
Knowledge Graph
nodes · edges · traverse
Services, agents, decisions, learnings, instructions, and even memories themselves are first-class nodes. Edges encode owns, depends-on, produces, relates-to. Agents query the KG to answer cross-service questions instead of grepping.
kg_register_node kg_add_edge kg_query kg_search kg_traverse kg_context

Knowledge Graph — what's in the soup

Schematic only — the real graph lives at /context-graph.html with live D3.

Specialized review agents — exposed as MCP tools

Each is a standalone Opus 4.7 agent. Called like any other tool. Returns structured verdicts.

Architecture Agent
Returns Blast radius / Contracts at risk / Required sign-offs / Citations. Caught a cross-service import boundary violation in live testing.
architecture_review
Database Agent
APPROVE / APPROVE_WITH_CONDITIONS / BLOCK / NEED_INFO on schema diffs. Blocked a no-backfill DROP COLUMN that would have broken a discotheque reader.
database_review
Security Agent
Scans diffs for OWASP-class smells, secrets, and over-broad permissions. Verdict-driven, not lecture-driven.
security_review
FinOps Agent
Reads the cost ledger; flags cost regressions per service per model. Powers the monthly Anthropic spend review.
finops_review
Observability Agent
Checks log volume + error-rate trends; flags new silent failures. Detects services that "look healthy" but stopped writing logs.
observability_review
Reliability Agent
SLO drift, retry storms, deploy-throughput health. Pairs with the launchd job health-check outputs.
reliability_review
UX Agent
Audits pages for clarity, contrast, hierarchy. Notices the things a developer stops seeing after the 50th look.
ux_review
Documentation Agent
Drafts CLAUDE.md and AGENT_OF_RECORD.md from real source code. Cited sources, explicit TODOs — never invents.
documentation_draft
Continuous Learning Agent
Weekly scanner. Three deterministic detectors (stale memories, stale-but-important, unused instructions). Auto-edits low-importance items; routes the rest to a proposals dashboard with Slack approve/deny.
keeper_consult

Pipelines & mesh

MA isn't passive storage — it actively brokers work between services and agents.

1
Pipeline registry
Multi-step pipelines (e.g. "after a PR merges → run architecture review → store decision → notify Morning Brief") declared via pipeline_upsert; executed by pipeline_bridge_run.
2
Service mesh
Every service registers itself (service_route, service_get, services_list) so cross-service calls are discoverable from a single source.
3
Inter-agent messaging
Agents send each other structured messages (send_to_agent, poll_messages, ack_message). Simple, durable, observable.
4
CI / version recovery
ci_scan + ci_stats mine PR history; version_recovery_mine + version_recovery_context reconstruct intent for any past commit so a session can pick up exactly where another agent left off.

Live snapshot

Numbers fetched at page load when the API is reachable; placeholders otherwise.

memories indexed
active instructions
KG nodes
KG edges

More of the system

Memory Archive is the brain — but the body is just as interesting. See how Career Bot uses it, how the deployment pipeline is wired around it, or watch the live system topology.