Agam adds activation-based memory to Claude Code via knowledge graph
Agam is an open-source tool that builds a SQLite knowledge graph from Claude Code session history and auto-injects relevant context into every new session via a `UserPromptSubmit` hook, giving the model persistent memory without retrieval search.
Score breakdown
Agam offers a pattern for giving Claude Code persistent, session-spanning memory without retrieval-based search, using hooks and a local knowledge graph that stays current automatically in the background.
- 01Agam injects entity context into Claude Code sessions via a `UserPromptSubmit` hook before the model responds.
- 02Knowledge is stored in a SQLite graph at `~/.claude/knowledge/graph.db` with FTS5 full-text search.
- 03Entity types include projects, services, decisions, bugs, and lessons.
Agam is an open-source project by CrypticCortex that sits as an identity and context injection layer on top of Claude Code. Rather than having the model search files on every query, Agam maintains a SQLite knowledge graph (`~/.claude/knowledge/graph.db`) with FTS5 full-text search, storing typed entities such as projects, services, decisions, bugs, and lessons along with their relationships. A `UserPromptSubmit` hook matches entity names in incoming prompts and injects their stored context inline before the model generates a response.
Persistent identity is handled through three files at `~/.claude/agam/` — `AGAM.md`, `THISAI.md`, and `MUGAM.md` — which give Claude Code a stable sense of the user's identity and active work.
Persistent identity is handled through three files at `~/.claude/agam/` — `AGAM.md`, `THISAI.md`, and `MUGAM.md` — which give Claude Code a stable sense of the user's identity and active work. The graph is seeded once via the `agam bootstrap` command, which processes prior Claude Code session transcripts from `~/.claude/projects/`. A `Stop` hook enqueues completed sessions for background processing by a `launchd`-managed watchdog, keeping the graph current over time. All LLM calls Agam makes are routed through an existing `claude-code` devcontainer via `docker exec`, reusing OAuth credentials already authenticated with Claude Code — no separate Anthropic API key is needed. The project currently supports macOS only and requires `uv` and Python 3.11 or newer, with Docker Desktop strongly recommended.
Key facts
- 01Agam injects entity context into Claude Code sessions via a `UserPromptSubmit` hook before the model responds.
- 02Knowledge is stored in a SQLite graph at `~/.claude/knowledge/graph.db` with FTS5 full-text search.
- 03Entity types include projects, services, decisions, bugs, and lessons.
- 04Identity is maintained through three files — `AGAM.md`, `THISAI.md`, `MUGAM.md` — at `~/.claude/agam/`.
- 05The `agam bootstrap` command seeds the graph from existing Claude Code transcripts in `~/.claude/projects/`.
- 06A `launchd`-managed background watchdog processes finished sessions automatically via a `Stop` hook.
- 07No Anthropic API key is required; all LLM calls run inside an existing `claude-code` devcontainer via `docker exec`. macOS only in v1.
Topics
Summary and scoring are generated automatically from the original article. We always link back to the publisher and never republish images or paywalled content. Last processed Jun 8, 2026 · 15:36 UTC. How this works →