opencode

Orchestrate OpenCode CLI coding agents for autonomous implementation, review, and crash recovery.

1|Updated Mar 15, 2025
One-click install
npx skills add https://github.com/adikpb/dotfiles --skill opencode-adikpb
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: opencode
Source: https://github.com/adikpb/dotfiles/tree/main/.hermes/skills/autonomous-ai-agents/opencode
Command: npx skills add https://github.com/adikpb/dotfiles --skill opencode-adikpb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Delegating coding work to an external AI agent CLI involves fragile interactive sessions, permission stalls, orphaned background subagents, and silent rate-limit hangs. This Skill provides validated procedures for running OpenCode reliably in one-shot and interactive modes, plus recovery patterns when runs crash or stall. ## Core Features & Use Cases - One-shot and interactive execution: Run bounded tasks with opencode run or drive the TUI in background with pty sessions, progress polling, and clean Ctrl+C exits. - Multi-agent orchestration and recovery: Resume crashed orchestrator sessions via persistent serve + attach, extract orphaned lane evidence from the SQLite store, and prevent run abandonment with a validated hard-constraint prompt block. - Rate-limit and stall diagnosis: Detect free-tier rate-limit hangs from log signatures and resume with committed hashes and in-flight file state instead of restarting. - Use Case: Dispatch an approved multi-step refactor as a single background opencode run --auto that commits per step, passes CI gates, opens a PR, and survives a mid-run rate-limit stall via the documented resume pattern. ## Quick Start Ask the agent to use OpenCode to run a bounded coding task in your project directory, for example implementing a feature with tests via a one-shot opencode run command.

Frequently Asked Questions about opencode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run OpenCode for a one-shot coding task?▼

Use `opencode run 'your task'` in the project directory; it executes non-interactively and exits when done, with no pty required. Add `-f` to attach context files, `--model` to force a model, and `--auto` to auto-approve permission prompts that would otherwise abort the run.

How do I run OpenCode interactively in the background?▼

Start `opencode` with background=true and pty=true, then send prompts with process submit and monitor with poll or log. Exit with Ctrl+C (write data "\x03") or kill the process; `/exit` is not a valid command and opens an agent selector instead.

Why does opencode run exit successfully but produce no deliverable?▼

The run exits when the parent turn completes, so a dispatcher prompt that spawns background lanes returns exit code 0 while lanes still work and their reports never arrive. Prevent this with a hard-constraint prompt block forbidding subagents, or recover lane evidence from the SQLite store at ~/.local/share/opencode/opencode.db.

Why does my OpenCode run hang silently for hours?▼

On free-tier providers, a `Rate limit exceeded` stream error leaves headless runs waiting forever for a response that never arrives. Confirm via the last log line and absence of new commits, then kill the process and resume with a prompt listing committed hashes and in-flight files.

Can I run multiple OpenCode sessions in parallel?▼

Yes, but each session must use a separate working directory or git worktree to avoid collisions. Launch each with its own workdir in background mode and track them with the process list action.

What are the prerequisites for using OpenCode CLI?▼

Install via `npm i -g opencode-ai@latest` or Homebrew, then configure a provider with `opencode auth login` or environment variables like OPENROUTER_API_KEY. Verify with `opencode auth list`, and use a git repository for code tasks.