opencode-background-agents  by kdcokenny

Asynchronous background agents for OpenCode enhance research and context persistence

Created 4 months ago
263 stars

Top 96.8% on SourcePulse

GitHubView on GitHub
Project Summary

This plugin introduces asynchronous background delegation for research tasks within OpenCode, solving the problem of context window limitations and information loss due to compaction. It targets OpenCode users who perform extensive research or complex tasks, enabling them to continue working without interruption while delegating demanding operations. The primary benefit is the persistence of research results, ensuring that valuable information is retained across sessions and compaction events, thereby improving AI recall and user productivity.

How It Works

This plugin enables asynchronous delegation of research tasks within OpenCode, addressing context window limitations. Users initiate tasks via the delegate tool, allowing them to continue coding or brainstorming. Results are automatically persisted to disk as tagged markdown files (~/.local/share/opencode/delegations/) and are retrievable via delegation_read(id). This mechanism ensures that research survives context compaction, session restarts, and crashes, providing a persistent knowledge base for the AI. The plugin mirrors Claude Code-style background-agent lifecycle behavior, including stable delegation IDs and explicit state transitions.

Quick Start & Requirements

  • Primary Install: ocx add kdco/background-agents --from https://registry.kdco.dev
  • Optional Full Experience: ocx add kdco/workspace --from https://registry.kdco.dev
  • Prerequisites: OCX must be installed. Manual installation requires unique-names-generator.
  • Links: OCX Repository (for OCX installation and plugin source)

Highlighted Details

  • Persistent Results: Research is saved to disk as markdown, surviving context compaction and session restarts.
  • Intelligent Retrieval: Delegations are auto-tagged with titles and summaries, enabling the AI to scan and retrieve relevant past work.
  • Asynchronous Workflow: Employs a "waiter model" for fire-and-forget task delegation, preventing blocking.
  • Lifecycle Parity: Mimics Claude Code's background agent lifecycle, ensuring stable IDs and state management.

Maintenance & Community

This facade is maintained from the main OCX monorepo. For issues and pull requests, refer to the OCX repository.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The MIT license is permissive, allowing for commercial use and integration with closed-source projects.

Limitations & Caveats

  • Read-Only Sub-Agents Only: The delegate tool is restricted to read-only sub-agents. Write-capable agents must use the native task tool due to the inability to track background session changes within OpenCode's undo/branching system.
  • Timeout: Delegations have a 15-minute timeout.
  • Upstream Parity: This plugin provides lifecycle parity, not full runtime-internal parity with Claude/OpenCode's core task execution, notification priority, or write-capable background execution with native undo support.
Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
0
Star History
49 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.