anomalyco / anomalyco/opencode

Proposal: background subagents, monitors, cron, worktree isolation

Open
#49,842 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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.

Fork (branch better): https://github.com/KapilSareen/opencode-extended

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposal and the separated commits in the linked fork's better branch. Compare the listed background, monitor, cron, sleep, isolation, abort, and TUI changes with upstream dev, then inspect the integration tests. Done would require an agreed upstream scope and shape for these proposed features.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
ai, devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.