opencode-async

Dispatch and collect long-running OpenCode sessions asynchronously via the HTTP API.

1|Updated Aug 13, 2026
One-click install
npx skills add https://github.com/corv89/hermes-stack --skill opencode-async-corv89
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opencode-async
Source: https://github.com/corv89/hermes-stack/tree/main/skills/opencode-async
Command: npx skills add https://github.com/corv89/hermes-stack --skill opencode-async-corv89

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? The installed oc wrapper and upstream opencode2 CLI are blocking-only, so delegated coding tasks that run longer than the 600-second foreground terminal cap get silently truncated or misreported as failures. This Skill provides a fire-and-forget dispatch plus later collection pattern over the OpenCode server's HTTP API so long-running tasks complete server-side without losing output. ## Core Features & Use Cases - Async dispatch/collect scripts: oc_dispatch.py creates a session (or posts a follow-up turn), sends a prompt file, prints the session id, and exits immediately; oc_collect.py waits with permission auto-approval and SSE/polling, then prints the final reply. - Session-state diagnosis: Distinguishes healthy, done, and zombie sessions using finish, time.completed, pending permissions, and question endpoints, with a redispatch strategy for unrecoverable zombies. - Pitfall guidance: Documents pipe-truncation data loss, foreground timeout capping, exit-code-3 semantics, and provider fallback (zai-coding-plan vs exhausted main plans) via references/http-api.md. - Use Case: Delegate a 30-minute code review to the shared OpenCode server: dispatch the prompt file, capture the ses_... id, then collect the final review in a background terminal with completion notification. ## Quick Start Dispatch my task prompt file to the OpenCode server asynchronously and collect the session's final reply when it finishes.

Frequently Asked Questions about opencode-async

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

FAQPage Schema
How do I run a long OpenCode task without blocking?

Dispatch the prompt with oc_dispatch.py, which creates a session via POST /api/session, sends the prompt, prints the session id, and exits immediately. Then run oc_collect.py with that session id in a background terminal to wait for and print the final reply.

Does the oc CLI support --dispatch or --collect flags?

No. Both the custom oc wrapper and the upstream opencode2 CLI are blocking-only; neither ships --dispatch, --wait, --status, or --collect flags. Async behavior must go through the server's HTTP API using the included dispatch and collect scripts.

Why did my oc command produce an empty reply?

Piping oc output through head, tail, or grep truncates the reply stream irreversibly; the text is only streamed, never stored server-side. Capture output with shell redirection to files in a background terminal instead of pipes.

What does oc exit code 3 mean?

Exit code 3 means the client-side wrapper timed out, but the server-side session is almost certainly still running and doing useful work. Do not report failure; reattach with oc --session <id> or collect the result with oc_collect.py.

How do I recover a stuck or zombie OpenCode session?

A zombie session shows finish=None, null time.completed, no pending permissions or questions, and follow-up prompts add no messages. It is not recoverable; abandon it and dispatch a fresh session whose prompt bakes in everything the stalled session discovered.

What should I do when the model provider returns insufficient balance?

Query GET /api/provider to list configured providers, then switch to a coding-plan variant such as zai-coding-plan, which often has separate billing from the exhausted main plan. Other fallbacks include bailian-personal, bailian-team, and the opencode Zen proxy.