{"_id":"@bloodf/opencode-claude-mem","_rev":"4-f883e3e06a7fcfdef6e89609106d81cd","name":"@bloodf/opencode-claude-mem","dist-tags":{"latest":"1.2.0"},"versions":{"0.1.0":{"name":"@bloodf/opencode-claude-mem","version":"0.1.0","keywords":["opencode","claude-mem","memory","plugin","ai"],"author":{"name":"bloodf"},"license":"MIT","_id":"@bloodf/opencode-claude-mem@0.1.0","maintainers":[{"name":"bloodf","email":"heitor.ramon@gmail.com"}],"homepage":"https://github.com/bloodf/opencode-mem#readme","bugs":{"url":"https://github.com/bloodf/opencode-mem/issues"},"dist":{"shasum":"59479046b51207899f79544c01418ca05c267213","tarball":"https://registry.npmjs.org/@bloodf/opencode-claude-mem/-/opencode-claude-mem-0.1.0.tgz","fileCount":43,"integrity":"sha512-qjMFhuN1jUdg3DzHhd44JXLXgv3Ay6qH1crVRSKa8hO2+rbqikySSdDSc+90GrrB49UHHIspSpJkvKQtpbJOoA==","signatures":[{"sig":"MEUCIQD+7Hh0OL0kHdvjIj0K4MofCE//NOvtUf/9DhhgsJonjQIgArigPBzviXkxaBgl3TInWCXgxcwqjrKhV3wj9I7ZU6g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":116243},"main":"./src/index.ts","type":"module","exports":{".":"./src/index.ts"},"gitHead":"ecbcc1c1092a81e97ecb9f29a017ac13fa849433","scripts":{"test":"bun test","check":"bunx tsc --noEmit"},"_npmUser":{"name":"bloodf","email":"heitor.ramon@gmail.com"},"repository":{"url":"git+https://github.com/bloodf/opencode-mem.git","type":"git"},"_npmVersion":"11.5.1","description":"OpenCode plugin adapter for claude-mem persistent memory","directories":{},"_nodeVersion":"24.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.0.0","@opencode-ai/plugin":"latest"},"peerDependencies":{"@opencode-ai/plugin":"*"},"_npmOperationalInternal":{"tmp":"tmp/opencode-claude-mem_0.1.0_1772227629541_0.06450591114058635","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@bloodf/opencode-claude-mem","version":"1.0.0","keywords":["opencode","claude-mem","memory","plugin","ai"],"author":{"name":"bloodf"},"license":"MIT","_id":"@bloodf/opencode-claude-mem@1.0.0","maintainers":[{"name":"bloodf","email":"heitor.ramon@gmail.com"}],"homepage":"https://github.com/bloodf/opencode-mem#readme","bugs":{"url":"https://github.com/bloodf/opencode-mem/issues"},"dist":{"shasum":"8fbd9ff57f46bff0bc13827b0d7600f21cf363ed","tarball":"https://registry.npmjs.org/@bloodf/opencode-claude-mem/-/opencode-claude-mem-1.0.0.tgz","fileCount":47,"integrity":"sha512-phh+Ks9OasXeITJFlAw32eA5DbXPYVhXUj6I02Tifnc/rQjiTG9y25p1KDD6HIapiDCFfz1oRmQKbt8yCaWfsA==","signatures":[{"sig":"MEUCIQDffPTIISOjm9o+ze+y77Vy1edcy51+8NEP8Q9XgdVPAAIgGnrAaBs6mGFvPN0CFI2oRk19XGje92DNWcjO4vk2lXA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":128333},"main":"./src/index.ts","type":"module","exports":{".":"./src/index.ts"},"gitHead":"c9f354a5da856be4e82db74670bc97255834c60c","scripts":{"test":"bun test","check":"bunx tsc --noEmit"},"_npmUser":{"name":"bloodf","email":"heitor.ramon@gmail.com"},"repository":{"url":"git+https://github.com/bloodf/opencode-mem.git","type":"git"},"_npmVersion":"11.5.1","description":"OpenCode plugin adapter for claude-mem persistent memory","directories":{},"_nodeVersion":"24.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.0.0","@opencode-ai/plugin":"latest"},"peerDependencies":{"@opencode-ai/plugin":"*"},"_npmOperationalInternal":{"tmp":"tmp/opencode-claude-mem_1.0.0_1772255267501_0.967943466428548","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@bloodf/opencode-claude-mem","version":"1.1.0","keywords":["opencode","claude-mem","memory","plugin","ai"],"author":{"name":"bloodf"},"license":"MIT","_id":"@bloodf/opencode-claude-mem@1.1.0","maintainers":[{"name":"bloodf","email":"heitor.ramon@gmail.com"}],"homepage":"https://github.com/bloodf/opencode-mem#readme","bugs":{"url":"https://github.com/bloodf/opencode-mem/issues"},"dist":{"shasum":"e3d467be1c9b2cb7f8cb1b1e31b6b69b706a7ebe","tarball":"https://registry.npmjs.org/@bloodf/opencode-claude-mem/-/opencode-claude-mem-1.1.0.tgz","fileCount":107,"integrity":"sha512-AQWEsOEWAE5gIyjeeGz+dLmpPSaCBzQLt185IZ2Afu6iDPL6AlSCkfSXINO1jA3GWY/dYYdMR3b0fWxjeiw4gg==","signatures":[{"sig":"MEUCIQDhLWu1UpS4SK4ZtEtAJFe690Lg9Au7XBedcbyq8UTuGwIgNExKU26ohd+hzAZpBEMgbjExCTkNajP8b5GMtNnYxUY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":133810},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e7c48d5f18ed756aff7a6872646e48e0c2b54ae8","scripts":{"test":"bun test","build":"tsc -p tsconfig.build.json","check":"bunx tsc --noEmit"},"_npmUser":{"name":"bloodf","email":"heitor.ramon@gmail.com"},"repository":{"url":"git+https://github.com/bloodf/opencode-mem.git","type":"git"},"_npmVersion":"11.5.1","description":"OpenCode plugin adapter for claude-mem persistent memory","directories":{},"_nodeVersion":"24.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5.0.0","@opencode-ai/plugin":"latest"},"peerDependencies":{"@opencode-ai/plugin":"*"},"_npmOperationalInternal":{"tmp":"tmp/opencode-claude-mem_1.1.0_1772470212118_0.8272462129396152","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@bloodf/opencode-claude-mem","version":"1.2.0","type":"module","description":"OpenCode plugin adapter for claude-mem persistent memory","types":"./dist/index.d.ts","main":"./dist/index.js","bin":{"opencode-claude-mem":"dist/cli.js"},"exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"keywords":["opencode","claude-mem","memory","plugin","ai"],"scripts":{"build":"tsc -p tsconfig.build.json && bun build src/cli/index.ts --target=node --outfile dist/cli.js","build:cli":"bun build src/cli/index.ts --target=node --outfile dist/cli.js","test":"bun test","check":"bunx tsc --noEmit"},"repository":{"type":"git","url":"git+https://github.com/bloodf/opencode-mem.git"},"homepage":"https://github.com/bloodf/opencode-mem#readme","bugs":{"url":"https://github.com/bloodf/opencode-mem/issues"},"author":{"name":"bloodf"},"license":"MIT","publishConfig":{"access":"public"},"peerDependencies":{"@opencode-ai/plugin":"*"},"devDependencies":{"@clack/prompts":"latest","@opencode-ai/plugin":"latest","@types/bun":"latest","picocolors":"latest","typescript":"^5.0.0"},"_id":"@bloodf/opencode-claude-mem@1.2.0","gitHead":"004c18ac915a52d52010913ee711d753342b7631","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-f8bHwz0q1LzHV1hHBWObCILIG+aihzNp55IKUAIuu2SQuoxMmmp4glZA8mcW6OALTKpjVA4ws+bDsweYIx1cnA==","shasum":"74e6c669ebb72033bca588901eaf8f60f8db1ad9","tarball":"https://registry.npmjs.org/@bloodf/opencode-claude-mem/-/opencode-claude-mem-1.2.0.tgz","fileCount":108,"unpackedSize":196216,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFQRFqFcB9umfNUuHns1Kwi76l0jOkmCp5ONdHCNLHLcAiEApkU3gBXLj7vkHf9FmFEQRHqpUpjUNPoGISjcpa00Vm8="}]},"_npmUser":{"name":"bloodf","email":"heitor.ramon@gmail.com"},"directories":{},"maintainers":[{"name":"bloodf","email":"heitor.ramon@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-claude-mem_1.2.0_1772498667537_0.43626560655427293"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-27T21:27:09.436Z","modified":"2026-03-03T00:44:27.834Z","0.1.0":"2026-02-27T21:27:09.675Z","1.0.0":"2026-02-28T05:07:47.643Z","1.1.0":"2026-03-02T16:50:12.277Z","1.2.0":"2026-03-03T00:44:27.724Z"},"bugs":{"url":"https://github.com/bloodf/opencode-mem/issues"},"author":{"name":"bloodf"},"license":"MIT","homepage":"https://github.com/bloodf/opencode-mem#readme","keywords":["opencode","claude-mem","memory","plugin","ai"],"repository":{"type":"git","url":"git+https://github.com/bloodf/opencode-mem.git"},"description":"OpenCode plugin adapter for claude-mem persistent memory","maintainers":[{"name":"bloodf","email":"heitor.ramon@gmail.com"}],"readme":"<h1 align=\"center\">\n  opencode-claude-mem\n</h1>\n\n<h4 align=\"center\">Persistent memory for <a href=\"https://opencode.ai\" target=\"_blank\">OpenCode</a>, powered by <a href=\"https://github.com/thedotmack/claude-mem\" target=\"_blank\">claude-mem</a>.</h4>\n\n<p align=\"center\">\n  <a href=\"package.json\">\n    <img src=\"https://img.shields.io/badge/version-1.1.0-green.svg\" alt=\"Version\">\n  </a>\n  <a href=\"https://github.com/thedotmack/claude-mem\">\n    <img src=\"https://img.shields.io/badge/powered%20by-claude--mem-blue.svg\" alt=\"Powered by claude-mem\">\n  </a>\n  <a href=\"LICENSE\">\n    <img src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"License\">\n  </a>\n</p>\n\n<p align=\"center\">\n  <a href=\"#quick-start\">Quick Start</a> &bull;\n  <a href=\"#how-it-works\">How It Works</a> &bull;\n  <a href=\"#automatic-setup\">Automatic Setup</a> &bull;\n  <a href=\"#search-tools\">Search Tools</a> &bull;\n  <a href=\"#configuration\">Configuration</a> &bull;\n  <a href=\"#troubleshooting\">Troubleshooting</a>\n</p>\n\n<p align=\"center\">\n  Share persistent memory between Claude Code and OpenCode. This plugin connects to the same claude-mem worker, database, and memory store — context from Claude Code sessions appears in OpenCode, and vice versa. Install the plugin, and everything else happens automatically.\n</p>\n\n> **Note:** This project is not affiliated with the OpenCode team.\n\n---\n\n## Quick Start\n\nAdd one line to your `opencode.json`:\n\n```json\n{\n  \"plugin\": [\"@bloodf/opencode-claude-mem\"]\n}\n```\n\nRestart OpenCode. That's it.\n\nThe plugin automatically installs claude-mem, starts the worker, configures MCP search tools, and copies the mem-search skill. Context from previous sessions will appear in new sessions.\n\n---\n\n## Key Features\n\n- **Shared Memory** — Same worker, database, and memory as Claude Code. Work in either tool seamlessly.\n- **Automatic Setup** — Zero manual configuration. The plugin installs and configures everything on first load.\n- **Context Injection** — Relevant memories are appended to the system prompt every session.\n- **MCP Search** — Query your project history with the 3-layer search workflow (search, timeline, get_observations).\n- **Graceful Degradation** — If the worker is unavailable, the plugin loads without errors. Memory features activate when the worker starts.\n- **Fire-and-Forget** — All memory operations (save, capture, summarize) are non-blocking. The plugin never slows down your session.\n\n---\n\n## How It Works\n\n```\nopencode session\n    |\n    |-- plugin loads\n    |   |-- detect claude-mem\n    |   |-- auto-setup if needed (fire-and-forget)\n    |   '-- connect to worker on port 37777\n    |\n    |-- session.created .............. initSession\n    |-- chat.message ................. capturePrompt\n    |-- tool.execute.after ........... saveObservation\n    |-- system.transform ............. injectContext (memory -> system prompt) + memoryStatus\n    |-- session.compacting ........... injectCompactionContext\n    |-- session.idle ................. sendSummary\n    '-- session.deleted .............. completeSession\n```\n\nThe plugin maps OpenCode lifecycle events to claude-mem hooks. Observations and prompts are captured during your session, summaries are generated at idle, and relevant context is injected into every new session automatically.\n\n**Shared infrastructure:**\n\n| Component | Path |\n|-----------|------|\n| Worker | `http://localhost:37777` |\n| Database | `~/.claude-mem/claude-mem.db` |\n| Settings | `~/.claude-mem/settings.json` |\n| Web Viewer | `http://localhost:37777` |\n\nBoth Claude Code and OpenCode connect to the same worker and database. Memories are shared across tools.\n\n---\n\n## Automatic Setup\n\nWhen the plugin loads for the first time, it runs a 6-step setup sequence. No manual intervention required.\n\n| Step | What happens | When skipped |\n|------|-------------|-------------|\n| **Detect** | Checks if `claude-mem` is in PATH or `~/.claude-mem` exists | -- |\n| **Install** | Runs `npm install -g claude-mem` | Already installed |\n| **Configure MCP** | Adds `claude-mem` entry to `~/.config/opencode/opencode.json` | Entry already exists |\n| **Configure Commands** | Adds 4 slash commands to `~/.config/opencode/opencode.json` | Commands already exist |\n| **Copy Skills** | Copies `mem-search` skill to `~/.config/opencode/skills/` | Skill directory already exists |\n| **Start Worker** | Launches the claude-mem worker process | Worker already running |\nAll steps are **idempotent** (safe to run multiple times) and **independent** (if one fails, the rest still run). Setup runs in the background and never blocks plugin initialization.\n\n### What Gets Configured\n\n| File | Change |\n|------|--------|\n| `~/.config/opencode/opencode.json` | MCP entry added under `mcp.claude-mem` |\n| `~/.config/opencode/opencode.json` | 4 slash commands added under `commands` key |\n| `~/.config/opencode/skills/mem-search/` | Skill files copied from plugin package |\n\n---\n\n## Installation\n\n### npm (recommended)\n\n```bash\nnpm install @bloodf/opencode-claude-mem\n```\n\nThen in `opencode.json`:\n\n```json\n{\n  \"plugin\": [\"@bloodf/opencode-claude-mem\"]\n}\n```\n\n### Interactive Installer (Recommended for new users)\n\n```bash\nnpx @bloodf/opencode-claude-mem install --no-tui\n```\n\nOr for LLM-guided setup, paste this URL into your AI agent:\n\n```\nhttps://raw.githubusercontent.com/bloodf/opencode-claude-mem/main/docs/guide/installation.md\n```\n\n**Optional flags:**\n- `--skip-worker` — Skip worker startup if you manage the worker separately\n- `--port <number>` — Specify a custom worker port (default: 37777)\n\n### Local path\n\n### Copy to plugins directory\n\n```bash\ncp -r node_modules/@bloodf/opencode-claude-mem .opencode/plugins/opencode-claude-mem\n```\n\n### Prerequisites\n\n- [OpenCode](https://opencode.ai) installed\n- npm available in PATH\n\nclaude-mem is installed automatically on first plugin load. If you already have claude-mem installed via Claude Code, the plugin connects to the existing worker and database — no reinstallation needed.\n\n---\n\n## Search Tools\n\nThe plugin configures MCP search tools automatically. These tools follow a **3-layer workflow** that saves ~10x tokens by filtering before fetching full details.\n\n### The 3-Layer Workflow\n\n```\nStep 1: search(query)           ~50-100 tokens/result\n          |\nStep 2: timeline(anchor=ID)     ~200-500 tokens/result\n          |\nStep 3: get_observations([IDs]) full content\n```\n\n### Available MCP Tools\n\n| Tool | Purpose | Key Params |\n|------|---------|-----------|\n| `search` | Search memory index | `query`, `limit`, `project`, `type`, `dateStart`, `dateEnd` |\n| `timeline` | Get context around a result | `anchor` (ID) or `query`, `depth_before`, `depth_after` |\n| `get_observations` | Fetch full details by IDs | `ids` (array, required) |\n| `save_memory` | Save a manual observation | `text` (required), `title`, `project` |\n\n### Example\n\n```\n1. search(query=\"authentication bug\", limit=10)\n2. timeline(anchor=42, depth_before=3, depth_after=3)\n3. get_observations(ids=[42, 43])\n```\n\n### Manual MCP Configuration\n\nMCP is configured automatically. If you need to set it up manually:\n\n```json\n{\n  \"mcp\": {\n    \"claude-mem\": {\n      \"type\": \"local\",\n      \"command\": [\"/path/to/mcp-server.cjs\"],\n      \"enabled\": true\n    }\n  }\n}\n```\n\nThe path to `mcp-server.cjs` is auto-configured during setup. Run the plugin once to configure automatically.\n\n### Manual Skill Setup\n\nThe mem-search skill is copied automatically. To install manually:\n\n```bash\ncp -r node_modules/@bloodf/opencode-claude-mem/skills/mem-search ~/.config/opencode/skills/\n```\n\n## Memory Commands\n\nThe plugin configures 4 slash commands in OpenCode automatically. Commands are auto-configured in `opencode.json` during setup.\n\n| Command | Description |\n|---------|-------------|\n| `/mem-search <query>` | Search persistent memory for past observations and context |\n| `/mem-save <text>` | Save a manual memory entry to the persistent store |\n| `/mem-status` | Show memory connection status and worker health |\n| `/mem-timeline` | Show recent memory timeline entries |\n\n### Usage Examples\n\n```\n/mem-search authentication bug from last week\n/mem-save Decided to use JWT with 24h expiry for auth tokens\n/mem-status\n/mem-timeline\n```\n---\n\n## Configuration\n\nThe plugin auto-detects settings from `~/.claude-mem/settings.json`. No configuration required.\n\n| Setting | Source | Default |\n|---------|--------|---------|\n| Worker port | `~/.claude-mem/settings.json` | `37777` |\n| Data directory | `~/.claude-mem/` | auto |\n| Database | `~/.claude-mem/claude-mem.db` | auto |\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `CLAUDE_MEM_DATA_DIR` | Override the data directory path (useful for testing) |\n\n---\n\n## Troubleshooting\n\n**Plugin loads but no memory appears**\n- Verify the worker is running: `curl http://localhost:37777/health`\n- Check that claude-mem has been used with Claude Code to build up memory\n- If this is a fresh install, memories will start appearing after your first session\n\n**Worker not starting**\n- Check if the worker is already running on a different port\n- Start manually: `claude-mem start`\n- If auto-setup failed: `npm install -g claude-mem`, then restart OpenCode\n\n**Auto-setup failed to install claude-mem**\n- Confirm npm is available: `npm --version`\n- Check for permission issues with global installs — use a version manager like nvm or configure npm's prefix\n- Install manually: `npm install -g claude-mem`\n\n**Auto-setup failed to configure MCP or skills**\n- Check that `~/.config/opencode/` exists and is writable\n- Configure manually using the instructions in [Manual MCP Configuration](#manual-mcp-configuration) and [Manual Skill Setup](#manual-skill-setup)\n- The plugin still works for memory injection even if MCP search setup fails\n\n**Port conflict**\n- Check `~/.claude-mem/settings.json` for the configured port\n- The plugin reads this file automatically\n\n**Sharing memory between Claude Code and OpenCode**\n- Both tools must point to the same worker (default: port 37777)\n- If Claude Code is already running claude-mem, OpenCode connects to the same worker automatically\n- Memories are shared via the SQLite database at `~/.claude-mem/claude-mem.db`\n\n---\n\n## Architecture\n\n```\n                    opencode-claude-mem\n                           |\n                    OpenCode Plugin API\n                           |\n              +------------+------------+\n              |                         |\n         Auto-Setup               Event Hooks\n         (first load)            (every session)\n              |                         |\n    +---------+---------+     +---------+---------+\n    | detect binary     |     | initSession       |\n    | install npm       |     | capturePrompt     |\n    | configure MCP     |     | saveObservation   |\n    | copy skills       |     | injectContext     |\n    | start worker      |     | sendSummary       |\n    +-------------------+     | completeSession   |\n                              +-------------------+\n                                        |\n                                claude-mem worker\n                                  (port 37777)\n                                        |\n                              +-------------------+\n                              | SQLite database   |\n                              | ~/.claude-mem/    |\n                              | claude-mem.db     |\n                              +-------------------+\n```\n\n---\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run tests\nbun test\n\n# Type check\nbunx tsc --noEmit\n```\n\n---\n\n## License\n\nMIT\n\n---\n\n<p align=\"center\">\n  <strong>Powered by <a href=\"https://github.com/thedotmack/claude-mem\">claude-mem</a></strong> &bull; <strong>Built for <a href=\"https://opencode.ai\">OpenCode</a></strong> &bull; <strong>Made with TypeScript</strong>\n</p>\n\n<!-- OMO_INTERNAL_INITIATOR -->","readmeFilename":"README.md"}