π§ Under Construction: This project is actively being developed. APIs, schemas, and features may change without notice.
A bitemporal, graph-backed memory system for AI coding agents.
Engram captures, persists, and visualizes the complete reasoning trace of AI coding assistants like Claude Code, Codex CLI, and others. Every thought, tool call, file edit, and decision is preserved in a knowledge graph with full temporal historyβenabling replay, search, and deep analysis of how AI agents solve problems.
engram_preview.webm
When you use an AI coding assistant, valuable context disappears the moment your session ends. Engram changes that.
What if you could:
- Watch an AI's reasoning unfold in real-time as it works
- Search across all your past AI sessions semantically
- Time-travel to any point in a session and see the exact file state
- Understand why an AI made a particular decision by tracing its thought process
- Build institutional knowledge from how AI agents solve problems in your codebase
Engram makes this possible by treating AI agent sessions as first-class dataβstreaming events through a processing pipeline, persisting them to a graph database, and exposing them through a beautiful real-time interface called the Neural Observatory.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLI AGENTS β
β Claude Code β’ Codex CLI β’ Grok β’ Cline β’ OpenCode β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β HTTP POST /api/ingest
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INGESTION SERVICE β
β β’ Provider-specific parsing (8 formats) β
β β’ Thinking block extraction (<thinking>...</thinking>) β
β β’ Diff extraction (search/replace blocks) β
β β’ PII redaction (emails, API keys, SSN, credit cards) β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β Kafka: parsed_events
βΌ
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββ
β MEMORY SERVICE β β CONTROL SERVICE β β SEARCH SERVICE β
β β β β β β
β β’ FalkorDB graphβ β β’ Session mgmt β β β’ Qdrant vectorsβ
β β’ Turn aggregationβ β β’ Context assembly β β β’ Hybrid search β
β β’ Redis pub/sub β β β’ MCP orchestration β β β’ Reranking β
β β’ Bitemporal β β β’ Decision engine β β β’ 4 model tiers β
ββββββββββ¬βββββββββ βββββββββββββββββββββββ ββββββββββ¬βββββββββ
β β
β Redis pub/sub β
βΌ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NEURAL OBSERVATORY β
β (Next.js + WebSocket Streaming) β
β β
β βββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β
β β Session β β Knowledge Graph β β Thought Stream β β
β β Browser β β (Force-directed) β β (Timeline + Replay) β β
β βββββββββββββββ βββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Events flow through the system in real-time via Kafka (Redpanda) and Redis pub/sub. The Neural Observatory connects via WebSocket and displays updates as they happenβno polling, no refresh needed.
Agent types β Ingestion β Kafka β Memory β Redis β WebSocket β Browser
Search isn't just keyword matching. Engram uses a sophisticated multi-stage retrieval pipeline:
- Dense vectors (e5-small) for semantic similarity
- Sparse vectors (BM25/SPLADE) for keyword matching
- RRF fusion combines both strategies
- Cross-encoder reranking with 4 model tiers:
| Tier | Model | Latency | Use Case |
|---|---|---|---|
fast |
MiniLM-L-6-v2 | ~50ms | Quick queries |
accurate |
BGE-reranker-base | ~150ms | Complex queries |
code |
Jina-reranker-v2 | ~150ms | Code-specific |
llm |
Grok-4 (listwise) | ~2s | Premium tier |
Every node in Engram's knowledge graph has two time dimensions:
- Valid Time (VT): When the event actually occurred
- Transaction Time (TT): When we recorded it
This enables powerful temporal queries: "What did the AI think at 2pm?" or "Show me the file state before that edit."
Engram ingests events from multiple AI agent formats:
| Provider | CLI Tool | Format |
|---|---|---|
claude_code |
Claude Code | stream-json |
codex |
Codex CLI | custom |
anthropic |
Anthropic API | SSE |
openai |
OpenAI API | SSE |
xai |
Grok | SSE |
gemini |
Google Gemini | JSON |
cline |
Cline Extension | custom |
opencode |
OpenCode | custom |
- Node.js v24+
- npm v11+
- Docker & Docker Compose
# Clone and install
git clone https://github.com/ccheney/engram.git
cd engram
npm install
# Start infrastructure (Redpanda, FalkorDB, Qdrant)
npm run infra:up
# Start all services in dev mode
npm run dev- Neural Observatory: http://localhost:5000
- Redpanda Console: http://localhost:8080
- Qdrant Dashboard: http://localhost:6333/dashboard
# Run the traffic generator to create test sessions
npx tsx scripts/traffic-gen.tsengram/
βββ apps/
β βββ ingestion/ # Event parsing & normalization
β βββ memory/ # Graph persistence & pub/sub
β βββ search/ # Vector search & reranking
β βββ control/ # Session orchestration
β βββ execution/ # VFS & time travel
β βββ interface/ # Neural Observatory (Next.js)
βββ packages/
β βββ events/ # Event schemas (Zod)
β βββ ingestion-core/ # Provider parsers & extractors
β βββ memory-core/ # Graph models & pruning
β βββ search-core/ # Embedders & rerankers
β βββ execution-core/ # Replay & rehydration
β βββ storage/ # DB clients (Kafka, Redis, FalkorDB, Qdrant)
β βββ vfs/ # Virtual file system
β βββ logger/ # Pino-based structured logging
βββ scripts/
β βββ traffic-gen.ts # Traffic simulation for testing
βββ docker-compose.dev.yml # Local infrastructure
| Document | Description |
|---|---|
| Tech Stack | Detailed architecture, data flow, and technology choices |
| Neural Observatory | Frontend documentation |
Receives raw events from CLI agents, parses them using provider-specific handlers, extracts thinking blocks and diffs, redacts PII, and publishes normalized events to Kafka.
Kafka Group: ingestion-group
Topics: raw_events β parsed_events
Persists parsed events to FalkorDB graph, aggregates streaming events into Turn nodes, publishes real-time updates to Redis, and exposes graph queries via MCP tools.
Kafka Group: memory-group
Topics: parsed_events β memory.node_created
Indexes graph nodes into Qdrant vectors, provides hybrid dense+sparse search with RRF fusion, and applies cross-encoder reranking with configurable model tiers.
Kafka Group: search-group
Topics: memory.node_created
Manages active sessions, assembles context from history and search results, and orchestrates MCP tool calls to execution services.
Kafka Group: control-group
Topics: parsed_events
Provides virtual file system operations, time travel to any point in session history, and deterministic replay of tool executions.
Real-time web interface for visualizing agent sessions. Features session browser, interactive knowledge graph, thought stream timeline, and semantic search.
Engram uses Kafka consumer groups to parallelize processing and ensure exactly-once delivery:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β raw_events ββββββΆβ parsed_events ββββββΆβ memory.node_ β
β β β β β created β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
β β β
βΌ βΌ βΌ
ingestion-group memory-group search-group
control-group
Each service publishes heartbeats to Redis every 10 seconds. The Neural Observatory displays consumer health in real-timeβgreen means all consumers are processing, amber means some are down.
| Command | Description |
|---|---|
npm run dev |
Start all services in development mode |
npm run build |
Build all apps and packages |
npm run test |
Run test suites |
npm run typecheck |
TypeScript type checking |
npm run lint |
Biome linting |
npm run format |
Biome formatting |
npm run infra:up |
Start Docker infrastructure |
npm run infra:down |
Stop Docker infrastructure |
Engram runs on three databases, all containerized for local development:
| Service | Port | Purpose |
|---|---|---|
| Redpanda | 19092 | Kafka-compatible event streaming |
| FalkorDB | 6379 | Graph database (Redis-compatible) + Redis pub/sub |
| Qdrant | 6333 | Vector database for semantic search |
# Start infrastructure
npm run infra:up
# View logs
docker-compose -f docker-compose.dev.yml logs -f
# Stop infrastructure
npm run infra:downAGPL-3.0 license