[FEATURE]: Background Tasks Manager
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
โจ Key Features
๐ง Core Task Manager (packages/opencode/src/task/)
- TaskManager with full lifecycle operations:
- โ create() - Spawn new background processes
- ๐ list() - Get all running tasks
- ๐ get() - Retrieve specific task info
- โก kill() - Terminate processes
- ๐ read() - Read task output (full or partial)
- ๐ tail() - Stream recent output
- โจ๏ธ input() - Send input to running processes
- ๐ adopt() - Migrate foreground processes to background
- Persistence Layer (.opencode/tasks/{taskId}.json):
- ๐พ Tasks survive session restarts
- ๐ Auto-reconnect to running processes by PID
- ๐ State tracking and recovery
- Event Bus System:
- ๐ task:created - New task spawned
- ๐ task:output - Output received
- โ๏ธ task:completed - Task finished
- โ task:killed - Task terminated
๐ค Process Query Tool (packages/opencode/src/tool/process-query.ts)
New LLM tool that enables Claude to:
- ๐ List all background tasks
- โ Check task status
- ๐ Read full or partial output
- ๐ Search for patterns in task logs
- ๐ฏ Resolve tasks by ID, "last" keyword, or description match
๐จ User Interface Components
Background Tasks Modal (ctrl+p > "Background tasks"):
- ๐ View all running background tasks
- ๐ Real-time output streaming
- โก Kill tasks directly from UI
- ๐ Auto-refresh with live updates
Process Controls:
- ๐ต [bg] button - Migrate running processes to background
- ๐ด [kill] button - Terminate running processes
- ๐ฎ Available for both Bash commands and shell commands (! prefix)
๐ ๏ธ Enhanced Bash Tool
- โ run_in_background parameter for spawning background tasks
- ๐ Foreground process registry for tracking
- ๐ฏ Support for process migration while running
- ๐งน Optimized latency with fire-and-forget persistence
๐ Implementation Stats
- Files Changed: 20 files
- Lines Added: ~4,878 lines
- Test Coverage: 46 comprehensive tests
- 29 tests for TaskManager core
- 17 tests for foreground process management
๐ฌ Demo
(https://x.com/avillagran/status/2013709707563708491/video/1)
๐ Technical Details
Architecture:
- Task Layer - Process management and lifecycle
- Persistence Layer - State storage and recovery
- Transport Layer - RPC handlers for TUI communication
- UI Layer - React components for user interaction
Key Design Decisions:
- ๐ Fire-and-forget persistence to minimize migration latency
- ๐ PID-based reconnection for session recovery
- ๐ฏ Unified interface for both foreground and background processes
- ๐ Clean logging using Log utility instead of console
๐งช Testing
Comprehensive test suite covering:
- โ Task creation and lifecycle
- โ Output streaming and reading
- โ Process termination
- โ Session recovery
- โ Foreground to background migration
- โ Error handling and edge cases
๐ Use Cases
- ๐๏ธ Long-running builds (webpack, vite, etc.)
- ๐งช Test watchers and development servers
- ๐ฆ Package installations
- ๐ Log monitoring and analysis
- ๐ค Any command that needs to run while working on other tasks
This issue might be a duplicate of existing issues. Please check:
- #9462: Support background tool execution
Feel free to ignore if none of these address your specific case.
anthropic claude code just created https://code.claude.com/docs/en/interactive-mode#task-list and this may be a new model for how to proceed. Not sure if this is the same intent but worth a look.
Agree, oh-my-opencode implemented it as part of plugin. As it is framework-level feature, it should be supported directly by official codebase.
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
Came across this โ I have a skill that solves the dev server side of things: https://github.com/workdocyeye/server-manager
start-server runs the command in background via cmd /c redirection, keeps track of ports/PIDs in a JSON file, and you can tail/grep the logs afterward. Tested on Next.js, Streamlit, Flask, and a few Go servers on Windows.
Not the full task manager described here, but enough to keep dev servers from blocking the terminal while you work on other things.