opencode
Skill22 starsChanged 9 days agoMITView on GitHub
Deep-dive reference for delegating implementation work to the OpenCode CLI. Provider-agnostic — pick it when the user wants a specific non-Anthropic, non-OpenAI model (local Ollama, Bedrock, Vertex, Azure). Covers binary resolution, one-shot mode, provider selection, and common pitfalls.
- Reads credentials
- Installs packages
34 other projects use a version of this.
Adopted by
Most recently taken up by
- delorenj/skillstheir own version, first seen Nov 7, 2026
- Fahrnetic/engineering-agent-skill-workflowtheir own version, first seen Oct 15, 2026
- Stuko0/alice-agenttheir own version, first seen Oct 13, 2026
- NazmusSayad/skillstheir own version, first seen Oct 13, 2026
- AtlasOmnia/hermes-custom-packtheir own version, first seen Oct 13, 2026
- nobodyohm-web/Thottheir own version, first seen Oct 13, 2026
Used with
Projects with it also use touchdesigner-mcp, minecraft-modpack-server and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
john-data-chenSkilltouchdesigner-mcp
Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.
Also in 7 projects that use this
math-incSkillminecraft-modpack-server
Set up a modded Minecraft server from a CurseForge/Modrinth server pack zip. Covers NeoForge/Forge install, Java version, JVM tuning, firewall, LAN config, backups, and launch scripts.
Also in 5 projects that use this
math-incSkillpokemon-player
Play Pokemon games autonomously via headless emulation. Starts a game server, reads structured game state from RAM, makes strategic decisions, and sends button inputs — all from the terminal.
Also in 5 projects that use this
john-data-chenSkillteams-meeting-pipeline
Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.
Also in 8 projects that use this
Tommy-ywSkillsongwriting-and-ai-music
Songwriting craft, AI music generation prompts (Suno focus), parody/adaptation techniques, phonetic tricks, and lessons learned. These are tools and ideas, not rules. Break any of them when the art calls for it.
Also in 10 projects that use this
mae616Skillp5js
p5.js(クリエイティブコーディング)のProcessing由来「コードでスケッチ」思想を軸に、setup/drawループ・座標系・インタラクション・パフォーマンス最適化を整理する。p5.js、Processing、クリエイティブコーディング、ジェネラティブアート、インタラクティブ表現、ビジュアルプログラミング、Canvas描画、パーティクル、フラクタル、ノイズ表現に関する相談で必ず使うこと。ユーザーが「コードでアート」「動くビジュアル」「インタラクティブな描画」と言った場合にも適用する。
Also in 10 projects that use this
- +2 more from math-inc
Other versions34 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 34
- math-inc/OpenGauss★ 1.3ksame name
- Tommy-yw/RunbookHermes★ 546same name
- aivrar/portable-hermes-agent★ 239same name
- RedWoodOG/Hermes-Desktop★ 177same name
- AtlasOmnia/donna-starter★ 136same name
- AtlasOmnia/hermes-custom-pack★ 75same name
- wundercorp/loki★ 28same name
- maystudios/claude-skills★ 21same name
- delorenj/skills★ 17same name
- pcx-wave/opencode-skill★ 17same name
24 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dependency-analyzerSkill
- docsSkill
- handoffSkill
- openai-reviewerSkill
- plugin-homeSkill
- schema-validatorSkill
- security-auditSkill
- session-auditSkill
- test-validatorSkill
- claude-codeSkill
- codexSkill
- chartsSkill
- export-csvSkill
- export-excelSkill
- make-chartSkill
- make-html-reportSkill
- make-pdfSkill
- a2a-communicateSkill
- a2a-handle-inboundSkill
- codebase-inspectionSkill
- ethos-skill-authoringSkill
- native-mcpSkill
- github-authSkill
- github-code-reviewSkill
- github-issuesSkill
- github-pr-workflowSkill
- github-repo-managementSkill
- birth-ritualSkill
- get-to-know-youSkill
- xurlSkill
- arxivSkill
- grounded-citationsSkill
- research-paper-writingSkill
- reddit-researchSkill
- code-reviewSkill
- coding-agentSkill
- planSkill
- requesting-code-reviewSkill
- spikeSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- tddSkill
- writing-plansSkill
- no-ai-slopSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 11 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 32 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Do not use: when Claude Code or Codex would suffice.
- Distinctive: line 48
If the command is not found, check common installation locations:
- Distinctive: line 64
If none of these resolve, the CLI is not installed.
- Distinctive: line 70
After resolving the binary, verify the version:
- Very specific: line 148
If that fails, process_stop (SIGTERM).
- Distinctive: line 149
If that fails, SIGKILL.
- Very specific: line 151
Always use run mode for delegation to avoid this entirely.
- Distinctive: line 155
Before delegating real work, verify the CLI and provider are functional:
- Distinctive: line 163
Check that the provider is reachable (network, auth).
- Distinctive: line 164
Check that the model exists on the provider.
- Very specific: line 165
Check opencode --version for a supported version.
- Distinctive: line 167
Run the smoke test once per session, not per delegation.
- Very specific: line 171
When available (version-dependent), use --format json for structured output:
- Very specific: line 189
Not all OpenCode versions support --format json.
- Very specific: line 198
Always attempt JSON first and fall back gracefully.
- Very specific: line 208
If --cwd is not supported by the installed version, set the working directory via process_start's cwd parameter instead.
- Distinctive: line 247
Before spawning an OpenCode delegation, verify:
- Distinctive: line 268
Use this table to choose the right CLI for the task.
- Very specific: line 276
Fall back gracefully on
--format json: Not all versions support it — parse plain text as a fallback.
“Common” is measured: kept by at least 6 in 10 of the 32 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenCode — Deep-Dive Delegation Reference
Comprehensive reference for spawning and managing the OpenCode CLI (opencode) as a delegated coding agent under ethos process control. OpenCode is provider-agnostic — it connects to any LLM backend (Ollama, AWS Bedrock, Google Vertex, Azure OpenAI, OpenRouter, and more).
When to use
- Provider-agnostic delegation — the user wants a specific model that neither Claude Code nor Codex exposes (local Ollama, a Bedrock-hosted model, an enterprise Azure deployment, a Google Vertex model).
- Cost-controlled environments — where the choice of provider matters for billing, data residency, or compliance reasons.
- Local models — when the user wants to run a local LLM (via Ollama) for privacy or offline work.
- Multi-provider comparison — delegate the same task to multiple providers via OpenCode and compare results.
Do not use when Claude Code or Codex would suffice. Those CLIs have tighter integration with their respective APIs and less surface area for configuration errors. OpenCode's strength is flexibility, not depth — use it when flexibility is what you need.
Binary resolution and PATH caveat
OpenCode may not be in $PATH depending on how it was installed. Always verify before delegating:
which opencode || command -v opencodeIf the command is not found, check common installation locations:
# npm global install
ls ~/.local/bin/opencode 2>/dev/null
# npm local install (project-local)
ls ./node_modules/.bin/opencode 2>/dev/null
# Go install
ls ~/go/bin/opencode 2>/dev/null
# Homebrew
ls /opt/homebrew/bin/opencode 2>/dev/nullIf none of these resolve, the CLI is not installed. Print the install instructions:
OpenCode is not installed. Install with
npm i -g opencode-ai(or see https://opencode.ai for alternative install methods) and authenticate withopencode login.
Version check
After resolving the binary, verify the version:
opencode --versionSome features (like --format json) are version-dependent. Document the minimum version you tested against when adding new invocation patterns.
One-shot invocation — the core pattern
opencode run "<task description>"run mode executes the task and exits. This is the canonical pattern for delegation from process_start. Do not use interactive mode — it opens a TUI that cannot be driven programmatically.
Minimal delegation
process_start({
command: 'opencode run "Add error handling to the database connection pool in src/db/pool.ts"',
name: 'delegated-opencode-db-error-handling',
cwd: '/path/to/project'
})With provider and model
process_start({
command: 'opencode run "Refactor the auth middleware to support JWT rotation" --model ollama/llama3',
name: 'delegated-opencode-auth-refactor',
cwd: '/path/to/project'
})Provider and model selection
OpenCode's key differentiator is provider flexibility. The --model flag uses a provider/model syntax:
Provider examples
| Provider | Syntax | Auth required |
| Ollama (local) | --model ollama/llama3 | None (local) |
| AWS Bedrock | --model bedrock/anthropic.claude-v2 | AWS credentials |
| Google Vertex | --model vertex/gemini-pro | GCP credentials |
| Azure OpenAI | --model azure/gpt-4 | Azure credentials |
| OpenRouter | --model openrouter/anthropic/claude-3.5-sonnet | OPENROUTER_API_KEY |
| Together | --model together/meta-llama/Llama-3-70b | TOGETHER_API_KEY |
Provider selection guidelines
- Local/private: Ollama — no data leaves the machine. Best for sensitive codebases or offline work.
- Enterprise AWS: Bedrock — uses existing AWS IAM roles. Best for teams already on AWS.
- Enterprise GCP: Vertex — uses existing GCP service accounts. Best for teams already on GCP.
- Enterprise Azure: Azure OpenAI — uses existing Azure AD. Best for teams on Azure.
- Cost optimization: OpenRouter or Together — access many models with a single API key, often at lower cost.
Authentication per provider
Each provider has its own auth flow. Run opencode login and follow the interactive setup, or set the provider-specific environment variable before spawning:
# Ollama — no auth needed (local)
# Bedrock — standard AWS credential chain (AWS_PROFILE, AWS_ACCESS_KEY_ID, etc.)
# Vertex — standard GCP credential chain (GOOGLE_APPLICATION_CREDENTIALS, gcloud auth)
# Azure — standard Azure credential chain (AZURE_OPENAI_API_KEY, az login)
# OpenRouter — OPENROUTER_API_KEYThe /exit trap
In interactive mode (the TUI), /exit is the only way to quit cleanly. Ctrl+C may leave the process dangling with orphaned child processes.
This does not apply to run mode — one-shot invocations exit cleanly on their own. But if someone accidentally spawns OpenCode in interactive mode (by omitting run), the only reliable cleanup is:
- Send
/exitvia the PTY. - If that fails,
process_stop(SIGTERM). - If that fails, SIGKILL.
Always use run mode for delegation to avoid this entirely.
Smoke test
Before delegating real work, verify the CLI and provider are functional:
opencode run "echo hello"This should produce a response within a few seconds. If it hangs, errors, or produces no output:
- Check that the provider is reachable (network, auth).
- Check that the model exists on the provider.
- Check
opencode --versionfor a supported version.
Run the smoke test once per session, not per delegation.
Structured output with --format json
When available (version-dependent), use --format json for structured output:
opencode run "<task>" --format jsonExpected JSON shape (when supported):
{
"result": "The response text — what was done.",
"model": "ollama/llama3",
"duration_ms": 12400
}Fallback for plain text
Not all OpenCode versions support --format json. The fallback parsing strategy:
1. Check if --format json is supported: opencode run "test" --format json 2>&1
2. If it errors with "unknown flag", fall back to plain text mode.
3. In plain text mode, capture raw stdout as the result.
4. Use the exit code as the success/failure indicator.Always attempt JSON first and fall back gracefully. Do not hard-fail on a missing --format flag.
Working directory
Set the project root explicitly with --cwd:
opencode run "<task>" --cwd /absolute/path/to/projectIf --cwd is not supported by the installed version, set the working directory via process_start's cwd parameter instead. Both achieve the same result — process_start.cwd is the more reliable option since it works regardless of OpenCode version.
Session continuation
Resume the last session for the current directory:
opencode run "<follow-up task>" --continue--continue carries over the conversation history from the previous invocation in the same directory. Use it for multi-step delegations where context should accumulate (e.g., "now add tests for what you just changed").
Caveat: session continuation is directory-scoped. If you use worktrees, each worktree has its own session history. This is usually the desired behavior — parallel delegations in different worktrees should not share context.
Error recovery
Common failures
| Symptom | Cause | Recovery |
| "command not found" | Binary not in PATH | Check install locations (see Binary Resolution above) |
| Connection refused (Ollama) | Ollama server not running | Start it: ollama serve |
| Auth error (cloud providers) | Credentials expired or missing | Re-authenticate: opencode login or set the provider env var |
| Model not found | Model name typo or model not pulled | For Ollama: ollama pull <model>. For cloud: verify model ID in provider docs |
| Timeout | Model too slow or network issue | Retry; for Ollama, check that the model fits in available RAM |
| Garbled output | Encoding issue with local model | Try a different model; some local models produce malformed output |
Recovery pattern
1. Capture exit code and stderr from process_logs.
2. Match stderr against known failure patterns.
3. For transient errors (timeout, rate limit): retry up to 2 times with a 30-second backoff.
4. For permanent errors (auth, model not found): surface to the user with specific remediation.
5. For local model issues (Ollama): check RAM, model compatibility, and suggest alternatives.Delegation checklist
Before spawning an OpenCode delegation, verify:
which opencodesucceeds — the CLI is installed.- Smoke test passes —
opencode run "echo hello"produces output. - The target provider is reachable and authenticated.
- The target model exists on the provider.
--cwdorprocess_start.cwdpoints to the correct project root.- A
process_startname is chosen (descriptive slug). - The user has authorized the delegation.
Comparison with other CLIs
| Dimension | Claude Code | Codex | OpenCode |
| Provider | Anthropic only | OpenAI only | Any |
| Structured output | --output-format json (rich) | None (plain text) | --format json (if supported) |
| Tool scoping | --allowedTools | None | None |
| Git requirement | No | Yes | No |
| PTY requirement | No | Yes | No |
| Best for | Deep reasoning, large refactors | Fast iteration, batch ops | Provider flexibility, local models |
Use this table to choose the right CLI for the task. OpenCode is the fallback when the other two do not support the required provider or model.
Hard rules
- Always use
runmode. Interactive TUI mode cannot be driven fromprocess_start. - Always smoke-test first. Provider misconfigurations fail silently or with opaque errors.
- Always verify the binary is in PATH. OpenCode installs vary — do not assume it is available.
- Never delegate without the process tool. Without
process_start, the orchestrator blocks for the full duration and the user cannot kill the delegation. - Fall back gracefully on
--format json. Not all versions support it — parse plain text as a fallback.
Adapted from NousResearch/hermes-agent (MIT)
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
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.

