opencode-claude-memory
Health Warn
- License Γ’β¬β License: MIT
- Description Γ’β¬β Repository has a description
- Active repo Γ’β¬β Last push 0 days ago
- Low visibility Γ’β¬β Only 5 GitHub stars
Code Warn
- process.env Γ’β¬β Environment variable access in src/paths.ts
Permissions Pass
- Permissions Γ’β¬β No dangerous permissions requested
No AI report is available for this listing yet.
π Claude Code-compatible memory for OpenCode β zero config, local-first, no migration.
π§ Claude Code-compatible memory for OpenCode
Make OpenCode and Claude Code share the same memory β zero config, local-first, and no migration required.
Claude Code writes memory β OpenCode reads it. OpenCode writes memory β Claude Code reads it.
Quick Start β’ Why this exists β’ What makes this different β’ How it works β’ Who this is for β’ FAQ
β¨ At a glance
- Claude Code-compatible memory
Uses Claude Codeβs existing memory paths, file format, and taxonomy. - Zero config
Install + enable plugin, then keep usingopencodeas usual. - Local-first, no migration
Memory stays as local Markdown files in the same directory Claude Code already uses.
π Quick Start
1. Install
npm install -g opencode-claude-memory
opencode-memory install # one-time: installs shell hook
This installs:
- The plugin β memory tools + system prompt injection
- The
opencode-memoryCLI β wraps opencode with post-session memory extraction - A shell hook β defines an
opencode()function in your.zshrc/.bashrcthat delegates toopencode-memory
2. Configure
// opencode.json
{
"plugin": ["opencode-claude-memory"]
}
3. Use
opencode
Thatβs it. Memory extraction runs in the background after each session.
To uninstall:
opencode-memory uninstall # removes shell hook from .zshrc/.bashrc
npm uninstall -g opencode-claude-memory
This removes the shell hook, the CLI, and the plugin. Your saved memories in ~/.claude/projects/ are not deleted.
π‘ Why this exists
If you use both Claude Code and OpenCode on the same repository, memory often ends up in separate silos.
This project solves that by making OpenCode read and write memory in Claude Codeβs existing structure, so your context carries over naturally between both tools.
π§© What makes this different
Most memory plugins introduce a new storage model or migration step.
This one is a compatibility layer, not a new memory system:
- same memory directory conventions as Claude Code
- same Markdown + frontmatter format
- same memory taxonomy (
user,feedback,project,reference) - same project/worktree resolution behavior
The outcome: shared context across Claude Code and OpenCode without maintaining two memory systems.
βοΈ How it works
graph LR
A[You run opencode] --> B[Shell hook calls opencode-memory]
B --> C[opencode-memory finds real binary]
C --> D[Runs opencode normally]
D --> E[You exit]
E --> F[Fork session + extract memories]
F --> G[Memories saved to ~/.claude/projects/]
The shell hook defines an opencode() function that delegates to opencode-memory:
- Shell function intercepts
opencodecommand (higher priority than PATH) opencode-memoryfinds the realopencodebinary in PATH- Runs it with all your arguments
- After you exit, forks the session with a memory extraction prompt
- Extraction runs in the background β you're never blocked
Compatibility details
The implementation ports core logic from Claude Code for path hashing, git-root/worktree handling, memory format, and memory prompting behavior, so both tools can operate on the same files safely.
π₯ Who this is for
- You use both Claude Code and OpenCode.
- You want one shared memory context across both tools.
- You prefer file-based, local-first memory you can inspect in Git/worktrees.
- You donβt want migration overhead or lock-in.
β FAQ
Is this a new memory system?
No. It is a compatibility layer that lets OpenCode use Claude Code-compatible memory layout and conventions.
Do I need to migrate existing memory?
No migration required. If you already have Claude Code memory files, OpenCode can work with them directly.
Where is data stored?
In local files under Claude-style project memory directories (for example, under ~/.claude/projects/<project>/memory/).
Why file-based memory?
File-based memory is transparent, local-first, easy to inspect/diff/back up, and works naturally with existing developer workflows.
Can I disable auto extraction?
Yes. Set OPENCODE_MEMORY_EXTRACT=0.
π§ Configuration
Environment variables
OPENCODE_MEMORY_EXTRACT(default1): set0to disable auto-extractionOPENCODE_MEMORY_FOREGROUND(default0): set1to run extraction in foregroundOPENCODE_MEMORY_MODEL: override model used for extractionOPENCODE_MEMORY_AGENT: override agent used for extraction
Logs
Extraction logs are written to $TMPDIR/opencode-memory-logs/extract-*.log.
Concurrency safety
A file lock prevents multiple extractions from running simultaneously on the same project. Stale locks are cleaned up automatically.
π Memory format
Each memory is a Markdown file with YAML frontmatter:
---
name: User prefers terse responses
description: User wants concise answers without trailing summaries
type: feedback
---
Skip post-action summaries. User reads diffs directly.
**Why:** User explicitly requested terse output style.
**How to apply:** Don't summarize changes at the end of responses.
Supported memory types:
userfeedbackprojectreference
π§ Tools reference
memory_save: save/update a memorymemory_delete: delete a memory by filenamememory_list: list memory metadatamemory_search: search by keywordmemory_read: read full memory content
π License
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found