Skip to content

Latest commit

 

History

History
202 lines (142 loc) · 4.34 KB

File metadata and controls

202 lines (142 loc) · 4.34 KB

OpenCode Integration Guide

RAM supports OpenCode transcript indexing and MCP server integration.

Prerequisites

  • OpenCode installed and configured
  • RAM installed (cargo install ramem or from source)

One-command setup

ram setup

This single command:

  1. Indexes your existing OpenCode transcripts
  2. Writes the MCP server entry to ~/.config/opencode/opencode.json
  3. Verifies the configuration

Then restart OpenCode to activate.

Manual setup (if you prefer to edit config files yourself)

Add to ~/.config/opencode/opencode.json (or opencode.json in your project root):

{
  "mcp": {
    "ramem": {
      "type": "local",
      "command": ["/usr/local/bin/ram", "serve"],
      "enabled": true
    }
  }
}

Use which ram to find the correct path.

Transcript Format

OpenCode transcripts are expected to follow a JSONL format similar to Claude Code. The parser extracts:

  • User messages
  • Assistant responses
  • Tool calls and results
  • Session metadata (timestamp, project context)

Verification

Test Indexing

# Check status
ram status

# Search indexed content
ram search "opencode"

# View recent memories
ram search "" --limit 10 --output json

Test CLI Workflow

# Start indexing with watcher
ram index --watch

# In another terminal, work with OpenCode
# ...

# Search for context
ram search "how did we implement X"

# Memorize important decisions
ram memorize "Decision: Use pattern X for Y" --tags decision

Available CLI Commands

Since MCP integration may not be available, use these CLI commands:

Search

ram search "query" [--limit N] [--scope S] [--output json|text]

Memorize

ram memorize "content" --tags tag1,tag2 [--importance 0.8]

Status

ram status [--output json|text]

Index

ram index [--path /custom/path] [--watch]

Configuration

RAM configuration file: ~/.config/ram/config.toml

[embedding]
backend = "fastembed"
model = "AllMiniLML6V2"

[search]
rrf_k = 60
decay_half_life_days = 7.0

[index]
transcript_paths = [
    "~/.opencode/transcripts",  # Add OpenCode path
    "~/.claude/projects"
]

Transcript Location

OpenCode transcript locations (check OpenCode docs for current paths):

~/.opencode/transcripts/           # Typical location
~/.config/opencode/sessions/       # Alternative location

Use ram config show to see configured paths.

Troubleshooting

Transcripts not found

  1. Check OpenCode transcript location in OpenCode settings
  2. Add custom path: ram config set index.transcript_paths '["/your/path"]'
  3. Verify files exist: ls -la /path/to/transcripts
  4. Re-index: ram init --force

Parser errors

  1. Check transcript format matches expected JSONL structure
  2. View parser logs: ram index --path /path/to/transcript --verbose
  3. Report format issues on GitHub with sample transcript (redacted)

No search results

  1. Verify indexing completed: ram status
  2. Check chunk count is non-zero
  3. Try broad query: ram search ""
  4. Check scope filter: ram search "query" --scope global

Limitations

  • MCP support: Depends on OpenCode's MCP implementation status
  • Hooks: No automatic session hooks without MCP integration
  • Real-time indexing: Requires manual --watch flag or periodic re-indexing

Example Workflow (CLI-based)

# Terminal 1: Start watcher
ram index --watch

# Terminal 2: Work with OpenCode
# ... coding session ...

# Terminal 3: Search context
ram search "how did we handle errors"

# Memorize important decisions
ram memorize "Convention: Use error type X for Y" --tags convention,error-handling

# Check what's indexed
ram status

MCP Integration (Future)

If OpenCode adds MCP support, RAM will provide these tools:

  • search_memory - Hybrid search
  • memorize - Explicit memory storage
  • forget_memory - Remove memories
  • get_memory - Retrieve by ID
  • list_recent_memories - Recent entries
  • update_memory - Update tags/importance
  • memory_status - Database stats

Check RAM releases for updates on OpenCode MCP integration.

Next Steps