-
Notifications
You must be signed in to change notification settings - Fork 10k
Description
Feature Request: Support Long-Running Bash Processes in the Background (Async Execution)
Summary
Claude Code includes a feature that allows developers to run bash commands in the background without blocking the agent/chat interface. This enables long-running tasks (e.g., builds, servers, data processing) to continue running while the developer interacts with the AI for other tasks.
I propose adding similar functionality to OpenCode.
Motivation
Currently, when a bash command is run in OpenCode via the bash tool, the session is blocked until the command completes. This makes workflows involving:
- Development servers
- Continuous monitoring scripts
- Large builds or data processing jobs
…slow and cumbersome, since you can’t continue using the AI assistant while those commands are still running.
Background execution would:
- Keep the AI assistant responsive
- Allow parallel workstreams
- Reduce the need to switch out of OpenCode to manage long-running jobs in a separate shell
Reference: Claude Code’s Implementation
Claude Code provides Background Commands with a simple shortcut (Ctrl+b) to run bash processes asynchronously.
Reference: Claude Code FAQ – Background Commands
“Background commands allow you to run bash processes in the background using
Ctrl+b, enabling Claude to continue working on other tasks while long-running processes execute. Great for development servers and monitoring.”
Proposed Design Ideas
- Syntax Option: Add a
background: trueparameter to thebashtool. - Shortcut Key: Similar to Claude Code, provide a hotkey to run the currently typed bash command as a background job.
- Job Management: Include a simple job list/kill command to view or stop background processes.
- Output Handling: Stream or store background process logs for later inspection.
Workarounds Today
- Using
&ornohupinside the bash tool sometimes works, but behavior is inconsistent and often tied to the session lifecycle. - Running tasks outside of OpenCode in a multiplexer (
tmux,screen)—but this defeats the purpose of integrated AI-assisted workflows.
Impact
Implementing this feature would make OpenCode far more usable for developers with mixed workloads and align it with modern AI coding assistants’ capabilities.
Related links: