Summary
Add OpenCode (terminal-based AI coding agent) to the list of supported agents in agentMemory.
Why
OpenCode is a popular open-source AI coding agent (Go-based TUI, ~140K GitHub stars) that already supports MCP servers natively via its opencode.json config. It would be a natural fit for agentMemory's persistent memory system.
MCP Server Config Format for OpenCode
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"agentmemory": {
"type": "local",
"command": ["node", "/path/to/mcp-server/server.js", "project-id", "/path/to/workspace"],
"enabled": true
}
}
}
Note: OpenCode uses "type": "local" and "command" as an array (not "command" + "args" separately).
Proposed Changes
-
src/config.ts — Add OpenCode detection (check for opencode.json in workspace or opencode in PATH) and write MCP config to opencode.json instead of VS Code settings.
-
src/interceptor.ts — Add injectOpenCodeRules() method that:
- Creates/updates
AGENTS.md with agentMemory instructions at the project root
- Creates
.opencode/commands/memory-search.md custom command
- Creates
.opencode/commands/memory-write.md custom command
-
src/mcp-server/memory-bank-sync.ts — Add OpenCode agent config:
{
name: 'opencode',
memoryBankPath: '.opencode/memory-bank',
fileMapping: {
'architecture.md': { type: 'architecture', tags: ['design', 'system'] },
'patterns.md': { type: 'pattern', tags: ['patterns', 'design'] },
'decisions.md': { type: 'decision', tags: ['decisions', 'tech'] },
'features.md': { type: 'feature', tags: ['features', 'product'] }
}
}
Also add sync to AGENTS.md since that's what OpenCode reads at session start.
-
Extension activation — OpenCode doesn't use VS Code extensions, so the integration would work via:
- Manual MCP server configuration in
opencode.json
- Or a helper script that auto-configures
opencode.json
OpenCode-Specific Notes
- OpenCode MCP tools are prefixed with the server name:
agentmemory_memory_search, agentmemory_memory_write, etc.
- OpenCode supports both local (stdio) and remote (SSE) MCP servers
- OpenCode reads
AGENTS.md at session start for project context — this is the equivalent of KiloCode's memory bank files
- Custom commands in
.opencode/commands/ support $ARGUMENTS placeholder and frontmatter for description, agent, model
References
This issue is suitable as a task for a coding agent.
I can open a PR if it's welcome.
Summary
Add OpenCode (terminal-based AI coding agent) to the list of supported agents in agentMemory.
Why
OpenCode is a popular open-source AI coding agent (Go-based TUI, ~140K GitHub stars) that already supports MCP servers natively via its
opencode.jsonconfig. It would be a natural fit for agentMemory's persistent memory system.MCP Server Config Format for OpenCode
{ "$schema": "https://opencode.ai/config.json", "mcp": { "agentmemory": { "type": "local", "command": ["node", "/path/to/mcp-server/server.js", "project-id", "/path/to/workspace"], "enabled": true } } }Note: OpenCode uses
"type": "local"and"command"as an array (not"command"+"args"separately).Proposed Changes
src/config.ts— Add OpenCode detection (check foropencode.jsonin workspace oropencodein PATH) and write MCP config toopencode.jsoninstead of VS Code settings.src/interceptor.ts— AddinjectOpenCodeRules()method that:AGENTS.mdwith agentMemory instructions at the project root.opencode/commands/memory-search.mdcustom command.opencode/commands/memory-write.mdcustom commandsrc/mcp-server/memory-bank-sync.ts— Add OpenCode agent config:Also add sync to
AGENTS.mdsince that's what OpenCode reads at session start.Extension activation — OpenCode doesn't use VS Code extensions, so the integration would work via:
opencode.jsonopencode.jsonOpenCode-Specific Notes
agentmemory_memory_search,agentmemory_memory_write, etc.AGENTS.mdat session start for project context — this is the equivalent of KiloCode's memory bank files.opencode/commands/support$ARGUMENTSplaceholder and frontmatter fordescription,agent,modelReferences
This issue is suitable as a task for a coding agent.
I can open a PR if it's welcome.