agentleFS
nors1993nors1993/Research-Skills/skills/opencode-integration/SKILL.md

opencode-integration

Skill9 starsChanged 6 months agoMITView on GitHub

Use OpenCode as a coding subagent via ACP protocol. Write and debug code through OpenCode's free models (minimax-m2.5-free, etc.), query its session database, and verify which model actually ran.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use delegate_task with ACP transport:

    line 18
  2. Very specific:

    Version: check with opencode --version

    line 34
  3. Very specific:

    Run a trivial task via delegate_task with ACP to confirm end-to-end connectivity

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenCode Integration

OpenCode is an AI coding CLI installed via npm. It supports ACP (Agent Client Protocol) and can be invoked as a subagent through Hermes delegate_task.

Trigger

  • User asks to use OpenCode, connect to OpenCode, or write code with OpenCode
  • User mentions opencode CLI
  • Task involves delegating coding work to a local agent

Invocation via ACP

Use delegate_task with ACP transport:

delegate_task(
  goal="<task description>",
  acp_command="opencode",
  acp_args=["acp"],
  toolsets=["terminal", "file"]
)

OpenCode will run as a subagent in its own process, using its locally configured model, and return results.

OpenCode Details

  • Install path: ~/.npm-global/bin/opencode
  • Version: check with opencode --version
  • Help: opencode --help

Available Free Models

opencode/big-pickle
opencode/minimax-m2.5-free          ← default
opencode/nemotron-3-super-free
opencode/ring-2.6-1t-free

List models: opencode models

CRITICAL PITFALL: Model Tracking

The delegate_task return object includes a model field — this is Hermes's own model (e.g., deepseek-v4-pro), NOT the model OpenCode actually used.

To find the actual model OpenCode used, query its SQLite database:

import sqlite3, json
db = sqlite3.connect(os.path.expanduser("~/.local/share/opencode/opencode.db"))
rows = db.execute("SELECT data FROM message ORDER BY time_created DESC LIMIT 5").fetchall()
for r in rows:
    d = json.loads(r[0])
    if d.get("role") == "assistant":
        print(f"provider: {d['providerID']}, model: {d['modelID']}")

Or from the terminal via Python one-liner:

python3 -c "
import sqlite3, json
db = sqlite3.connect('$HOME/.local/share/opencode/opencode.db')
rows = db.execute(\"SELECT data FROM message WHERE data LIKE '%modelID%' ORDER BY time_created DESC LIMIT 3\").fetchall()
for r in rows:
    d = json.loads(r[0])
    if 'modelID' in d:
        print(f\"{d.get('role','?')}: provider={d.get('providerID','?')}, model={d['modelID']}\")
"

Database Schema

  • Database path: ~/.local/share/opencode/opencode.db
  • Key tables: session, message, part, project, todo
  • message table: id, session_id, time_created, time_updated, data (JSON)
  • data JSON fields (assistant messages): role, modelID, providerID, mode, agent, tokens, cost, finish
  • session table: includes model column (often null; the real model is in message data)

Token / Cost

OpenCode's free models have cost: 0. Tokens are logged in the message data.tokens JSON.

Verify OpenCode is Working

  1. opencode --version — should return version number
  2. opencode models — should list available models
  3. Run a trivial task via delegate_task with ACP to confirm end-to-end connectivity

Common Commands Reference

CommandPurpose
opencode --versionVersion check
opencode --helpHelp
opencode modelsList available models
opencode acpStart ACP server (used by delegate_task)
opencode agent listList configured agents
opencode db pathPrint database path
opencode sessionSession management

Reference Files

  • references/opencode-db.md — Database schema, query recipes, message JSON structure

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.