Background Agents
Background Agents
Background Agents brings Claude Code-style async delegation to OpenCode. Fire off research tasks, continue brainstorming or coding, and retrieve results when you need them. Results are saved to disk as markdown so they survive context compaction.
Key Features
| Feature | Description |
|---|---|
| Keep working | Research runs in the background while you keep coding |
| Survive compaction | Results saved to disk as markdown files |
| Fire and forget | ”Waiter model” — notification arrives when results are ready |
| Stable delegation IDs | Reused across state, artifact paths, notifications, and retrieval |
| Terminal-state protection | Late progress events cannot regress terminal status |
How It Works
1. Delegate → "Research OAuth2 PKCE best practices"
2. Continue → Keep coding, brainstorming, reviewing
3. Notified → <task-notification> arrives on terminal state
4. Retrieve → AI calls delegation_read() to get the result
Results are persisted to ~/.local/share/opencode/delegations/ as markdown files.
Installation
Via KDCO Registry (recommended)
ocx add kdco/background-agents --from https://registry.kdco.dev
Or install the full workspace bundle:
ocx add kdco/workspace --from https://registry.kdco.dev
Manual
Copy source files from src/ to .opencode/plugin/background-agents.ts. Requires manually installing the unique-names-generator dependency.
Tools
| Tool | Purpose |
|---|---|
delegate(prompt, agent) | Launch a background task |
delegation_read(id) | Retrieve a specific result |
delegation_list() | List all delegations with titles and summaries |
Limitations
- Read-only sub-agents only (
edit=deny,write=deny,bash deny) — write-capable sub-agents must use the nativetasktool - 15-minute delegation timeout
- Plugin-compatible lifecycle parity, not runtime-internal parity
Links
- GitHub Repository — Source code and issues
- OCX Monorepo — Contributions and development
- Awesome OpenCode — Browse more plugins