-
-
Notifications
You must be signed in to change notification settings - Fork 836
fix(opencode-plugin): capture and pass messages to summarize #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(opencode-plugin): capture and pass messages to summarize #498
Conversation
This commit introduces a new plugin for OpenCode that connects to the claude-mem worker service. It implements: - `session.created` hook to inject memory context. - `tool.execute.after` hook to capture observations. - `mem-search` tool for memory retrieval. - `session.idle` hook for summarization. The plugin resides in `opencode-plugin/` and includes its own build and test configuration.
…46602792139 Port claude-mem to OpenCode plugin
This commit adds a Gemini CLI extension that proxies memory capabilities to the claude-mem worker. It includes: - An MCP server implementation using `@modelcontextprotocol/sdk`. - `mem-search` tool exposed to Gemini. - Manifest and context files (`gemini-extension.json`, `GEMINI.md`). - Build configuration for ESM compatibility. The extension connects to the local worker on port 37777.
…in-226549446602792139 Add Gemini CLI extension for Claude-Mem
- Track all user messages per session via sessionUserMessages Map - Capture assistant responses from message.updated events - Pass last user/assistant messages to summarize (was empty strings) - Add context injection via chat.message hook - Add session idle detection with 60s delay before summarization - Strip [Claude-Mem Context] tags before saving prompts - Add comprehensive logging to /tmp/claude-mem-opencode.log
ade8992 to
e080986
Compare
|
Can we figure out a way to have it follow a similar structure to the cursor hooks I just added? I want a unified clean way of porting things to other platforms |
|
@lgandecki please message me on our discord :) https://discord.com/invite/J4wttp9vDu |
|
I think creating a plugin for OpenCode is the best approach because OpenCode doesn't support hooks. They use plugins to listen for events https://opencode.ai/docs/plugins/ |
info
I took https://github.com/robertpelloni/claude-mem/ that from what I see was 100% vibecoded and not tested, and had some obvious omissions. I spent today massaging it to work. At first I tried to make it work directly with oh-my-opencode through their compability layer ( code-yeongyu/oh-my-opencode#341 ) , but turns out there are limitations in whats possible, and building a custom-plugin might be better idea anyway.. Things seem to be working now.
Not sure if this is the right place for this code anyway, maybe it should be a separate repository with a separate npm deployment. I asked AI to create a PR and it did it to this original repo, not the fork with the plugin..
Anyway, feel free to close it.
Everything below was AI generated
Summary
Changes
sessionUserMessagesandsessionAssistantMessagesMaps to collect conversation historymessage.updatedeventschat.messagehook (prepends to first message)[Claude-Mem Context]tags before saving prompts to avoid recursive contextTesting
cd opencode-plugin && npm run buildLogs
Debug logs written to
/tmp/claude-mem-opencode.log