No API to list or stop background tasks started via run_in_background

Resolved 💬 2 comments Opened Mar 18, 2026 by R-Mitsuno Closed Mar 18, 2026

Problem

When using the Bash tool with run_in_background: true, the agent has no way to:

  1. List currently running background tasks
  2. Stop a specific background task by ID

The TaskStop tool exists but only works if the agent already knows the task ID. There is no TaskListBackground or equivalent tool to discover running background tasks.

Reproduction

  1. Start a long-running process in the background:

``
Bash(command: "./scripts/dev.sh", run_in_background: true)
`
→ Returns task ID (e.g.,
bdx9k9dkj`)

  1. In a later conversation turn (or after context compression), the agent loses track of the task ID.
  1. The user asks: "Stop the background process and restart it."
  1. The agent has no way to discover the running background task. TaskList only returns the TODO-style task list, not background shell processes.

Current workaround

The user must manually use the CLI UI (↓ to manage) to stop background tasks, which defeats the purpose of autonomous agent operation.

Expected behavior

One of:

  • A tool like TaskListBackground that returns all running background shell/agent tasks with their IDs, commands, and status
  • Or extend the existing TaskList tool to include background processes
  • Or extend TaskOutput to accept no arguments and return all background tasks

Environment

  • Claude Code CLI
  • macOS (Darwin 24.1.0)
  • Observed with Bash run_in_background tasks

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗