OpenCode

Integrate Rekall with OpenCode for memory-augmented coding. Persistent context survives across sessions so your AI pair-programmer never starts from scratch.

Overview

OpenCode is a terminal-based AI coding assistant that supports MCP servers. By connecting Rekall, OpenCode gains the ability to store and retrieve memories about your projects, coding conventions, past decisions, and team knowledge.

The integration works through the standard MCP protocol, giving OpenCode access to all 40+ Rekall tools for memory management, search, entities, workflows, execution tracking, and preference learning.

terminal

Terminal-Native

Works in your terminal alongside your existing CLI workflow. No GUI required.

sync

Cross-Tool Sync

Memories created in OpenCode are available in Claude Desktop, Cursor, and all other integrations.

Installation

Install the Rekall MCP server globally:

Terminal
npm install -g @rekall/mcp-server

Verify the installation:

Terminal
rekall-mcp --version
# @rekall/mcp-server v1.x.x

MCP Configuration

Configure Rekall as an MCP server in your OpenCode configuration file. OpenCode reads MCP server definitions from its config:

opencode.json
{
"mcpServers": {
"rekall": {
"command": "rekall-mcp",
"args": ["--stdio"],
"env": {
"REKALL_API_KEY": "your-api-key-here",
"REKALL_CONTEXT": "my-project"
}
}
}
}

Config file location

The OpenCode configuration file is typically at ~/.config/opencode/opencode.json or in your project root as opencode.json. Check the OpenCode documentation for the latest config path.

You can also set the API key as an environment variable in your shell profile:

Shell profile
# Add to ~/.zshrc, ~/.bashrc, or equivalent
export REKALL_API_KEY="your-api-key-here"

Using Memory in OpenCode

Once configured, OpenCode's AI assistant has access to all Rekall memory tools. You can interact with memory naturally through conversation.

Storing Memories

Ask OpenCode to remember information and it will create the appropriate memory type:

Storing memories
> Remember that this project uses pnpm workspaces with
three packages: api, web, and shared.
OpenCode: Stored as a semantic memory. I'll remember your
monorepo structure: pnpm workspaces with api, web, and
shared packages.
> Remember: to run tests, use "pnpm test" from the root,
or "pnpm --filter api test" for a specific package.
OpenCode: Stored as a procedural memory. I've captured the
test commands for your monorepo.

Recalling Memories

OpenCode automatically searches memory when relevant context might help answer your question. You can also explicitly ask it to recall:

Recalling memories
> How do I run tests for just the API package?
OpenCode: [Searches memory] Based on your project setup, run:
pnpm --filter api test
Your project uses pnpm workspaces, so --filter targets a
specific package.
> What do you know about this project's architecture?
OpenCode: [Retrieves memories] Here's what I know:
- Monorepo with pnpm workspaces (api, web, shared packages)
- Tests run via "pnpm test" from root
- [any other stored memories...]

Managing Context

Switch between project contexts to keep memories organized:

Context management
> Switch context to the backend-api project
OpenCode: Switched memory context to "backend-api". All new
memories will be scoped to this project, and searches will
prioritize this context.
> What context am I in?
OpenCode: You're currently in the "backend-api" project context.
Agent: opencode | Hive: none

Configuration Options

Additional configuration can be provided through a .rekallrc file in your project root:

.rekallrc
{
"context": "my-project",
"agentId": "opencode",
"baseUrl": "https://api.rekall.ai",
"autoCapture": {
"decisions": true,
"patterns": true,
"errors": false
}
}
OptionDefaultDescription
contextautoMemory context name (auto-detects from folder name)
agentIdopencodeAgent identity for memory ownership
baseUrlhttps://api.rekall.aiRekall API base URL for self-hosted instances
autoCaptureenabledAutomatically capture coding decisions and patterns

Next Steps

Rekall
rekall