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-Native
Works in your terminal alongside your existing CLI workflow. No GUI required.
Cross-Tool Sync
Memories created in OpenCode are available in Claude Desktop, Cursor, and all other integrations.
Installation
Install the Rekall MCP server globally:
npm install -g @rekall/mcp-server
Verify the installation:
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:
{"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:
# Add to ~/.zshrc, ~/.bashrc, or equivalentexport 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:
> Remember that this project uses pnpm workspaces withthree packages: api, web, and shared.OpenCode: Stored as a semantic memory. I'll remember yourmonorepo structure: pnpm workspaces with api, web, andshared 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 thetest 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:
> How do I run tests for just the API package?OpenCode: [Searches memory] Based on your project setup, run:pnpm --filter api testYour project uses pnpm workspaces, so --filter targets aspecific 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:
> Switch context to the backend-api projectOpenCode: Switched memory context to "backend-api". All newmemories will be scoped to this project, and searches willprioritize 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:
{"context": "my-project","agentId": "opencode","baseUrl": "https://api.rekall.ai","autoCapture": {"decisions": true,"patterns": true,"errors": false}}
| Option | Default | Description |
|---|---|---|
context | auto | Memory context name (auto-detects from folder name) |
agentId | opencode | Agent identity for memory ownership |
baseUrl | https://api.rekall.ai | Rekall API base URL for self-hosted instances |
autoCapture | enabled | Automatically capture coding decisions and patterns |
