SuperAPI AI Directory

codemem

Persistent coding memory across sessions, machines and teammates, with memory search, optional sync, project sharing and automatic capture.

Open website

About this tool

Purpose

codemem is a lightweight persistent coding memory companion for OpenCode, Claude Code, Codex, and Pi coding agents. It solves the problem that code remains but the reasoning process is usually lost, by capturing decisions, dead ends, and repository-specific pitfalls, and automatically bringing relevant context into subsequent prompts.

Main capabilities

  • Automatic context injection: Relevant memories reach the agent without the agent actively searching; unchanged memories already in the OpenCode context are not repeated.
  • Optional sync and sharing: Peer-to-peer sync can carry selected project memories across machines; project knowledge can be shared with teammates or teams when helpful.
  • Local-first storage: Memories are stored locally as SQLite; observer processing uses the configured model provider and may incur costs or consume plan usage.
  • Hybrid retrieval: FTS5 BM25 lexical search + sqlite-vec semantic search, merged and reranked.
  • OpenCode 1 and 2 automatic injection: The plugin injects context into every prompt with no manual steps; the OpenCode 2 integration is beta.
  • Claude Code plugin support: Installable from the codemem marketplace source.
  • Multi-agent: OpenCode, Claude Code, Codex, and Pi share one project-scoped store.
  • Pi coding agent: Session capture, automatic recall, and 14 native memory tools; no MCP required.
  • Built-in viewer: Browse memories, sessions, and observer output in a local web UI.
  • Remote MCP access: Advanced single-user self-hosting can expose an OAuth-protected Streamable HTTP MCP endpoint to configured remote clients; the local viewer should remain private.

Usage

Prerequisites

Requires Node.js 24.15+ and npm (or pnpm). Native database support covers macOS x64/arm64, Linux x64/arm64 (glibc 2.34+ or musl), and Windows x64. 32-bit targets are not supported, including Linux armv7.

Linux users need to set this in the shell and in the environment that starts OpenCode, Claude Code, Codex, or Pi before installing the package for the first time: ONNXRUNTIME_NODE_INSTALL=skip. This avoids downloading unused ONNX Runtime GPU providers while retaining CPU inference. The npx launcher managed by setup cannot set this itself.

Codemem requires OpenCode 1.18.29 or newer. One installed @codemem/opencode-plugin package serves both host generations: OpenCode 1 calls its server() entry, and OpenCode 2 calls its setup() entry. OpenCode 2 support is verified against the exact stable versions @opencode/cli@2.0.24 and @opencode/plugin@2.0.24 . Codemem marks its OpenCode 2 integration as beta until it has gone through a full release cycle.

OpenCode plugin installation

After installing the OpenCode plugin and MCP configuration, restart OpenCode. npx uses a downloaded or cached package to configure the OpenCode host and does not create a persistent codemem CLI installation. The configured plugin manages backend execution independently on both host generations, so automatic capture and context injection require no global installation. Setup intentionally writes the singular plugin key. OpenCode 1 requires that key, and OpenCode 2 converts it to its native plugins configuration, so one configuration entry works on both host generations. Keep one Codemem entry; if OpenCode loads Codemem twice for a project, the first registration takes effect and subsequent copies skip their hooks with a warning.

Try verifying recall

After completing a task, check whether its decisions appear in the local viewer http://localhost:38888. Start a new OpenCode session in the same project, ask about that decision without providing the answer. Verify whether the answer is consistent with the stored decision and the original task evidence. If the capture is still pending or the recall is empty, check the local state.

Observer access and external model costs

The observer is the model that turns session activity into memories. In settings, choose an OpenCode account, API key, or local Claude/Codex session. Explicit connections never fall back to other accounts; existing automatic settings keep the current rules until you change them. Local storage does not mean local-only processing: captured context is sent to the configured model, and calls may incur costs or consume plan usage.

CLI installation

To use codemem in PATH for manual commands and semantic retrieval, install the CLI globally. The CLI installs a matching embedding runtime by default. If you need a smaller keyword-only installation, use npm install -g codemem --omit=optional and set it in each Codemem process CODEMEM_EMBEDDING_DISABLED=1. This flag is required because npm also omits the optional platform package for sqlite-vec; the CLI then remains functional under FTS5.

npm-compatible managers (such as pnpm or mise's npm:codemem backend) can also provide a persistent CLI. Make sure codemem is in PATH, then run codemem setup --opencode-only.

Claude Code installation (marketplace installation)

In Claude Code, add the codemem marketplace source and install the plugin, then restart Claude Code. The plugin bundles its MCP configuration and capture/context injection hooks, and uses the TS CLI (codemem mcp) to start MCP. There is no need to run the codemem setup --claude-only command in advance or install the global CLI. The prerequisites and observer access requirements above still apply.

When to use it

codemem is suitable for development scenarios that need to maintain continuity of coding decisions and context across multiple sessions, multiple machines, or multiple team members, especially for teams using OpenCode, Claude Code, Codex, or Pi coding agents. It is also suitable for developers who want local-first memory storage while optionally enabling peer-to-peer sync and project knowledge sharing.

Limitations

  • Observer processing sends captured context to the configured model, and calls may incur costs or consume plan usage.
  • The semantic runtime is fixed to CPU inference on all platforms. ONNX Runtime 1.24.3 does not provide a macOS x64 binary, so when semantic runtime initialization fails, Intel Macs continue to use FTS5 keyword retrieval.
  • 32-bit targets are not supported, including Linux armv7.
  • The OpenCode 2 integration is currently in beta.
  • Remote MCP access is only for advanced single-user self-hosting, and the local viewer should remain private.
  • Memories contain synthetic project memories, not real session data.
  • Specific information about charges and pricing is not currently provided.