opencode
OpenCode Server Control
Control opencode serve (local or remote) using opencode-cli, a thin wrapper around the
REST API purpose-built for agents. Prefer it over hand-rolled curl+jq — it handles auth, timeouts,
JSON shapes, busy/idle cross-referencing, and error messages consistently. A raw REST reference is
kept at the bottom for the few things the CLI doesn't wrap (fork, shell, file search, worktrees).
Multi-project scoping — read this first
opencode servers scope sessions by project directory. A plain GET /session — and so
opencode-cli sessions / stuck without --directory or --all-projects — only
returns the server's own default project. Sessions in every other project directory are
invisible, not filtered-and-empty. This is the default behavior, not an opt-in filter, and it
silently produces a false "nothing going on" for a supervisor sweeping for stuck work. Confirmed
live on opencode v1.17.9: a bare sessions call returned 32 sessions (one project); --all-projects
against the same server returned 293 sessions across 8 different projects in the same 26h window.