Skip to main content
Back

Engram Gives AI Coding Agents a Brain That Survives Session Resets

Engram gives AI coding agents a persistent, searchable memory layer that survives session resets — no cloud, no dependencies, just a single Go binary.

Pro

Repo, Full Access
  • Persistent agent memory: Engram gives AI coding agents a memory layer that survives session resets, stored locally in SQLite with FTS5 full-text search.
  • Zero dependencies: Ships as a single Go binary — no Docker, Node.js, or Python required; installs via Homebrew in one command.
  • Agent-agnostic via MCP: Works with Claude Code, Gemini CLI, Codex, Cursor, Windsurf, VS Code, and any MCP-compatible tool from one shared memory store.
  • Conflict detection (beta): Two-stage pipeline uses FTS5 to find similar memories, then an LLM judge to detect semantic conflicts like contradictory architecture decisions.
  • Cross-machine sync: Memories sync via git as compressed chunks; optional self-hosted cloud replication available for teams via Docker.
  • MIT-licensed, 6k stars: Free and open source — github.com/Gentleman-Programming/engram.

Engram is an open-source persistent memory system for AI coding agents. It has crossed 6,000 GitHub stars and 636 forks, and the problem it solves is one that nearly every developer using AI assistants runs into daily: your AI coding agent forgets everything when the session ends. Engram gives it a brain.

The amnesia problem that bigger context windows don't fix

AI coding agents forget project context because they operate on stateless inference with session-scoped memory, requiring developers to re-establish architecture, conventions, and dependencies at every session boundary. The instinct is to throw more tokens at the problem, but bigger context windows do not solve AI agent memory. They shift forgetting into in-window degradation and higher token spend.

The workaround most teams settle on is a manually maintained CLAUDE.md or .cursorrules file. AI coding agents lose context because model weights are frozen, context windows rebuild from scratch, and most tools do not write cross-session memory by default. Manual files like AGENTS.md help, but they drift and consume tokens. Engram replaces that manual process with a structured, queryable memory store that agents read and write automatically.

One binary, zero dependencies

Engram is a persistent memory system for AI coding agents, shipped as a single Go binary with zero dependencies. It uses SQLite with FTS5 full-text search for storage, exposing 20 MCP tools for save, search, session management, and conflict detection. FTS5 is SQLite's built-in full-text search engine , it indexes every memory so agents can retrieve relevant context with keyword queries, not just exact lookups.

The installation is a single command on macOS:

brew install gentleman-programming/tap/engram

Then wire it to your agent of choice:

# Claude Code
claude plugin marketplace add Gentleman-Programming/engram && claude plugin install engram
# Gemini CLI
engram setup gemini-cli
# Cursor / Windsurf / VS Code
engram setup cursor

For most agents , Claude Code, Gemini CLI, Codex, VS Code, Cursor, Windsurf , you don't need to run anything manually. Your agent launches engram mcp automatically as a short-lived stdio subprocess whenever it starts a session. No Node.js, no Python, no Docker. One binary, one SQLite file.

Engram TUI dashboard showing sessions, observations, and navigation options

How memory actually flows

The core loop is simple. After completing significant work , a bug fix, an architecture decision, a tricky integration , the agent calls mem_save with structured fields: what was done, why, where in the codebase, and what was learned. Engram writes that to SQLite with FTS5 indexing. At the start of the next session, the agent calls mem_context or mem_search to pull back the relevant context before doing anything else.

In practice, the model calls Engram tools such as mem_context, mem_search, and mem_review, then folds the retrieved memories into its response. This is especially useful for long-running projects where work happens in bursts. You might come back to a feature days or weeks later, with a different model or a different tool, and still recover the important context quickly.

The full MCP surface covers 20 tools across five categories:

  • Save & Update: mem_save, mem_update, mem_delete, mem_suggest_topic_key
  • Search & Retrieve: mem_search, mem_context, mem_timeline, mem_get_observation
  • Session Lifecycle: mem_session_start, mem_session_end, mem_session_summary
  • Conflict Surfacing: mem_judge, mem_compare
  • Utilities: mem_stats, mem_capture_passive, mem_doctor, and more

The conflict detection angle

One of the more interesting features in active beta is memory conflict surfacing. The result of naive memory accumulation after a few weeks: contradictory facts at similar confidence scores. The agent remembers both "user prefers dark mode" and "user prefers light mode" and doesn't know which is current. It remembers five different attempts at the same problem with no signal about which one worked.

Engram's answer is a two-stage conflict pipeline. FTS5 first finds lexically similar memory pairs , memories that share key terms like "database" or "architecture." Then, optionally, an LLM judge (your existing Claude Code or OpenCode subscription) determines whether those pairs actually conflict semantically, labeling them as supersedes or conflicts_with. The scan command looks like:

export ENGRAM_AGENT_CLI=claude
engram conflicts scan --project my-project --semantic --apply --max-semantic 5

The LLM judging step costs nothing extra if you're already on a Claude Pro or Max subscription, since it routes through your existing CLI.

Engram TUI search interface showing results for 'opencode' with metadata and navigation

Agent-agnostic by design

Without MCP, every coding assistant would need its own private memory plugin. That fragments the knowledge base. Claude Code might remember one thing, Codex another, and your IDE assistant nothing at all. Engram sidesteps this entirely by running as a shared MCP server. By exposing persistent memory through the Model Context Protocol, Engram gives coding agents a shared, durable memory layer that survives across sessions, tools, and context-window resets.

It's agent-agnostic , works with Claude Code, Gemini CLI, Codex, Cursor, Windsurf, OpenCode, and any MCP-compatible tool. The list has grown to include Kiro, Qwen Code, Kilo Code, and Antigravity CLI as well. One memory store, any agent.

Cross-machine sync and teams

Memories can be synced across machines via git, treating the SQLite database as a versioned artifact. For teams, optional cloud replication keeps multiple developers' agent memories in sync. The git sync works by exporting memories as compressed chunks , no merge conflicts, no bloated files. Cloud replication is always opt-in; the local SQLite file remains the source of truth.

There's also a terminal UI for browsing and searching memories directly:

engram tui

A terminal-based interface lets developers browse, search, and manage memories directly. The TUI uses the Catppuccin Mocha color scheme and supports filtering by type, date, and agent source. Navigation is vim-style (j/k to move, / to search, c to copy to clipboard).

Limitations worth knowing

A few constraints are worth understanding before adopting Engram. The MCP transport is stdio only , there's no network MCP endpoint, which means Docker-hosted agents can't reach it over TCP without mounting the binary into the container. The HTTP REST API (engram serve) currently binds to 127.0.0.1 only, so it's not reachable from inside a container without additional networking configuration.

Memory quality also depends on the agent actually calling mem_save at the right moments. If the agent skips saves during long sessions or after context compaction, gaps will appear. The docs recommend adding a Memory Protocol snippet to your CLAUDE.md or .cursorrules as a reliability boost for heavy use , essentially a system-level instruction that survives compaction and reminds the agent to save proactively.

Engram is MIT-licensed and free. The Engram Cloud component for team replication is self-hostable via Docker. There's no hosted SaaS tier announced yet. The agent setup docs cover per-agent configuration in detail, and the full reference documents all 20 MCP tools with parameters.