Skill metadata
Reference: full SKILL.md
The following is the complete skill definition that Mibyan loads when this skill is triggered. This is what the agent sees as instructions when the skill is active.
OpenCode CLI
Use OpenCode as an autonomous coding worker orchestrated by Mibyan terminal/process tools. OpenCode is a provider-agnostic, open-source AI coding agent with a TUI and CLI.When to Use
- User explicitly asks to use OpenCode
- You want an external coding agent to implement/refactor/review code
- You need long-running coding sessions with progress checks
- You want parallel task execution in isolated workdirs/worktrees
Prerequisites
- OpenCode installed:
npm i -g opencode-ai@latestorbrew install anomalyco/tap/opencode - Auth configured:
opencode auth loginor set provider env vars (OPENROUTER_API_KEY, etc.) - Verify:
opencode auth listshould show at least one provider - Git repository for code tasks (recommended)
pty=truefor interactive TUI sessions
Binary Resolution (Important)
Shell environments may resolve different OpenCode binaries. If behavior differs between your terminal and Mibyan, check:One-Shot Tasks
Useopencode run for bounded, non-interactive tasks:
-f:
--thinking:
Interactive Sessions (Background)
For iterative work requiring multiple exchanges, start the TUI in background:/exit — it is not a valid OpenCode command and will open an agent selector dialog instead. Use Ctrl+C (\x03) or process(action="kill") to exit.
TUI Keybindings
Resuming Sessions
After exiting, OpenCode prints a session ID. Resume with:Common Flags
Procedure
- Verify tool readiness:
terminal(command="opencode --version")terminal(command="opencode auth list")
- For bounded tasks, use
opencode run '...'(no pty needed). - For iterative tasks, start
opencodewithbackground=true, pty=true. - Monitor long tasks with
process(action="poll"|"log"). - If OpenCode asks for input, respond via
process(action="submit", ...). - Exit with
process(action="write", data="\x03")orprocess(action="kill"). - Summarize file changes, test results, and next steps back to user.
PR Review Workflow
OpenCode has a built-in PR command:Parallel Work Pattern
Use separate workdirs/worktrees to avoid collisions:Session & Cost Management
List past sessions:Pitfalls
- Interactive
opencode(TUI) sessions requirepty=true. Theopencode runcommand does NOT need pty. /exitis NOT a valid command — it opens an agent selector. Use Ctrl+C to exit the TUI.- PATH mismatch can select the wrong OpenCode binary/model config.
- If OpenCode appears stuck, inspect logs before killing:
process(action="log", session_id="<id>")
- Avoid sharing one working directory across parallel OpenCode sessions.
- Enter may need to be pressed twice to submit in the TUI (once to finalize text, once to send).
Verification
Smoke test:- Output includes
OPENCODE_SMOKE_OK - Command exits without provider/model errors
- For code tasks: expected files changed and tests pass
Rules
- Prefer
opencode runfor one-shot automation — it’s simpler and doesn’t need pty. - Use interactive background mode only when iteration is needed.
- Always scope OpenCode sessions to a single repo/workdir.
- For long tasks, provide progress updates from
processlogs. - Report concrete outcomes (files changed, tests, remaining risks).
- Exit interactive sessions with Ctrl+C or kill, never
/exit.

