Delegate a task to the opencode CLI and return the result
Delegate a task to the opencode CLI with opencode run and return the result.
/cc-opencode:opencode <task description>
Examples:
/cc-opencode:opencode review this codebase/cc-opencode:opencode --model anthropic/claude-sonnet-4 "review this code"/cc-opencode:opencode --continue "follow up on previous task"/cc-opencode:opencode --session abc123 --fork "try an alternative approach"/cc-opencode:opencode --file ./src/main.ts "review this file"Parse {{ARGUMENTS}} into:
message: every non-flag token joined into the task prompt--model / -m: model override, for example anthropic/claude-sonnet-4--continue / : continue the latest opencode session-c--session / -s: continue a specific session ID--fork: fork from the continued session--file / -f: attach one or more files--dir: working directory override. Default to the current working directory--thinking: request thinking block outputIf both --continue and --session are provided, prefer --session.
If no message is provided and neither --continue nor --session is present, stop and ask the user for a task description.
Build an opencode run command with the current working directory passed by default:
opencode run --dir "$(pwd)" [flags] "MESSAGE"
Flag mapping:
| User flag | CLI flag |
|---|---|
--model X | -m X |
--continue | -c |
--session X | -s X |
--fork | --fork |
--file X | -f X |
--dir X | --dir X |
--thinking | --thinking |
When --dir is omitted, pass the current working directory explicitly.
Use the Bash tool to run the command with a timeout of 300000ms.
Before execution:
opencode exists on PATHopencode missing: opencode CLI not found. Install it or check PATH.Task: {{ARGUMENTS}}