You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team, I built a set of agent-orchestration features in my fork for my own work. Sharing in case it helps someone. Happy to split into PRs if anything looks interesting upstream, no pressure either way.
I checked each item against current upstream dev before posting; none of these exist there (upstream still injects background results via a fresh prompt(), has no background/monitor/sleep/cron/notify_parent tools, no per-agent isolation flag, bare cancel on abort, and hides completed tool blocks including diffs).
What is in it:
Non-blocking background subagents: completion notices are written durably and picked up mid-drain instead of going through a fresh prompt() (fixes model-reset, cache-bust and parked-injection races), plus a timeout that upgrades stuck foreground tasks to background instead of hanging the parent.
background tool (status with spend/tokens/recent activity, send, kill, list, tail, detach, by task_id or spawn name) and notify_parent so running children can push milestones to their parent.
monitor tool/service: watch a process, stream matching lines into a session, process-group kill. Plus cron scheduling and sleep keep-alive with early wake on new input.
Per-agent automatic worktree isolation (default on, falls back outside git): subagents run in detached linked worktrees, removed when clean. (Upstream worktrees exist as a manual feature; this adds the per-agent flag and lifecycle.)
ESC drains queued input instead of stranding it (programmatic aborts/kills still stay dead).
Completed diffs stay visible in the TUI when tool details are hidden.
Everything is in separated commits with integration tests. Let me know if any of it would help upstream and how you would like it shaped. Thanks for opencode!
The monitor part is the one I would use immediately. I built opencode-perk for V1 because I wanted a running job to send progress back to an idle agent, without blocking the conversation or waiting for the job to finish. A CI watcher, for example, should be able to report a failing step while the run is still going, and I should still be able to talk to the agent in the same session. Claude Code’s Monitor tool captures the workflow well.
V2 already owns background shell jobs, so I’d rather see progress events attached to those jobs than another job runner. Perk used an append-only drip stream with quiet-gap coalescing; stdout lines might be simpler here. I’m likely to prototype a V2 monitor plugin in the meantime to learn what works. The earlier #33806 looks like useful prior art.
Thanks for sharing this, and for checking it against dev first!
In short, you're proposing a set of agent-orchestration features from your fork:
non-blocking background subagents with durable completion notices
background and notify_parent tools
monitor, cron and sleep tools
automatic per-agent worktree isolation
ESC draining queued input instead of stranding it
completed diffs staying visible when tool details are hidden
The maintainers will look at the proposal and decide which parts, if any, fit upstream. It's a large bundle, so if it comes to PRs, small separate ones per feature will be much easier to review. The tool-only pieces like monitor, cron and sleep might also work as an OpenCode plugin in the meantime. I can't promise anything about direction or timing, but thanks for writing it up so clearly.
We embed OpenCode 2.2.5 through the SDK and built monitor and notify_parent as an Effect plugin. That works, but here are the gaps we hit, in case they help scope this:
Monitor. We send output through steering. I mostly used @rndmcnlly's approach, with a few changes to batching, flushing, and stop conditions.
Background commands that end look like ones that don't. Currently, tasks that finish (a build) and tasks that run indefinitely (a dev server) have the same shape. There is no way to tell them apart, and same rules apply to both of them. For example, I may terminate a sandbox if a dev server is the only remaining task, but not when a build task is running. I would say there should be a background: 'daemon' mode. Maybe monitor tool can also be folded in like background: 'monitor'.
Warming doesn't know about pending wake-ups. It runs for a fixed time after the last request and skips child sessions. A session idling on a monitor or a background subagent goes cold. Our own warmer reuses the built-in keep-alive prompt word for word, so the built-in warming doesn't count our requests as activity. That's brittle. Maybe there should be a built-in helper for warming a session, or the background tasks and subagents should warm the main session regularly by default during their lifetime.
Subagents can't report progress. Our notify_parent sends the parent a <subagent state="running"> message in the shape of the completion notice. Worth having built in?
Need a feature to automatically move a task to background. When a task runs for too long, we move it to background automatically so that the agent can work on other things in parallel. I think it's worth having this as a built-in, with default warm up as mentioned in 3.
A subagent is reported finished too early. When sessions.background moves a subagent's long tool call to the background, the subagent goes idle, and its parent gets state="completed" while the subagent's shell is still running.
Editing a built-in tool's description doesn't reach the model.ctx.tool.transform with editor.update("shell", t => { t.description += "…" }) changes the registry; ctx.tool.list() shows the edit when the request is made. The tool definitions in that request still have the original description.
Activity
rndmcnlly commentedon Sep 23, 2026
The
monitorpart is the one I would use immediately. I built opencode-perk for V1 because I wanted a running job to send progress back to an idle agent, without blocking the conversation or waiting for the job to finish. A CI watcher, for example, should be able to report a failing step while the run is still going, and I should still be able to talk to the agent in the same session. Claude Code’s Monitor tool captures the workflow well.V2 already owns background shell jobs, so I’d rather see progress events attached to those jobs than another job runner. Perk used an append-only drip stream with quiet-gap coalescing; stdout lines might be simpler here. I’m likely to prototype a V2 monitor plugin in the meantime to learn what works. The earlier #33806 looks like useful prior art.
KapilSareen commentedon Sep 26, 2026
I kinda needed the background tasks without waiting on V2, so thought about sharing here so somebody could benefit if they're looking for it
opencodejr commentedon Oct 28, 2026
Thanks for sharing this, and for checking it against
devfirst!In short, you're proposing a set of agent-orchestration features from your fork:
backgroundandnotify_parenttoolsmonitor,cronandsleeptoolsThe maintainers will look at the proposal and decide which parts, if any, fit upstream. It's a large bundle, so if it comes to PRs, small separate ones per feature will be much easier to review. The tool-only pieces like
monitor,cronandsleepmight also work as an OpenCode plugin in the meantime. I can't promise anything about direction or timing, but thanks for writing it up so clearly.gkurt commentedon Nov 3, 2026
We embed OpenCode 2.2.5 through the SDK and built
monitorandnotify_parentas an Effect plugin. That works, but here are the gaps we hit, in case they help scope this:background: 'daemon'mode. Maybe monitor tool can also be folded in likebackground: 'monitor'.notify_parentsends the parent a<subagent state="running">message in the shape of the completion notice. Worth having built in?sessions.backgroundmoves a subagent's long tool call to the background, the subagent goes idle, and its parent getsstate="completed"while the subagent's shell is still running.ctx.tool.transformwitheditor.update("shell", t => { t.description += "…" })changes the registry;ctx.tool.list()shows the edit when the request is made. The tool definitions in that request still have the original description.Happy to send small PRs if you agree.
neriousy commentedon Nov 12, 2026
Thanks for the suggestion. This isn't something we plan to build, so closing to keep the tracker focused.
gkurt commentedon Nov 13, 2026
@neriousy Are you not planning to fix the bugs too, or only the proposed feature?