# Opencode

> Use the opencode CLI to ask another model a question - for a second opinion, a blind review, or a multi-turn design discussion with a specific model (Sol, Grok, Laguna, Nemotron, etc). Use when the user asks to consult, ask, or brainstorm with another model/agent, to run something by a named model, or to get multiple models to review something. Covers the non-obvious CLI mechanics that cause silent failures.

- Skill: `50bytesofjohn/opencode` (Agent Skill)
- Install (CLI): `npx skillmds@latest add 50bytesofjohn/opencode`
- Raw SKILL.md: https://api.skillmd.com/api/skills/50bytesofjohn/opencode/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: MIT
- Author: 50BytesOfJohn (https://skillmd.com/u/50bytesofjohn)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/50bytesofjohn/opencode

---


# opencode

`opencode --help`, `opencode run --help` and `opencode models [provider]` cover the basics. Below
is only what they don't tell you.

## Put the message first

`-f` is a greedy array flag and will eat the positional message.

```bash
opencode run "$(cat prompt.txt)" -m openai/gpt-5.6-sol --variant high -f brief.md
```

## Pass the prompt through a file

Any real prompt contains backticks, `?`, `{}` or quotes that the shell will mangle or expand.
Write it to a file and use `"$(cat …)"`.

## Run it in the background

A reasoning model on a long prompt regularly exceeds 10 minutes, which is the Bash tool cap.

```bash
opencode run "$(cat q.txt)" -m xai/grok-4.5 > out.txt 2>&1
```

with `run_in_background: true`, then wait on the process:

```bash
while pgrep -f "opencode run" >/dev/null; do sleep 10; done
```

## Confirm the model actually received attached files

`-f` on a path outside the project directory can trigger an `external_directory` permission
prompt that is auto-rejected. The model then answers **without the file** and its response looks
superficially fine. Either keep attachments inside the project directory, or concatenate the
file into the prompt itself:

```bash
cat brief.md question.txt > prompt.txt
```

## Sessions

`--continue` resumes the last session, for multi-turn discussion where the model keeps its
context. Omit it and pass a fresh `--title` when running several models on the same question and
their independence matters.

