feat: Selective background agent termination by task ID

Resolved 💬 3 comments Opened Feb 21, 2026 by Caylub Closed Feb 25, 2026

Problem

Ctrl+F (double-press) kills all background agents simultaneously. There is no way to selectively terminate individual background agents by task ID, leaving users with an all-or-nothing choice when managing concurrent agent work.

Use Case

Running a 36-agent extraction wave (e.g., processing YouTube transcripts, analyzing code across many files). 30 agents complete successfully, but 6 are stuck or spinning. The only option is Ctrl+F which kills everything — including agents that already finished and whose results haven't been read yet, or agents that are still making useful progress.

Other scenarios:

  • Stuck agent cleanup: One agent is looping or waiting on a hung MCP tool. Want to kill just that one.
  • Priority shift: Mid-wave, you realize 3 of the agents are working on the wrong files. Want to stop those 3, not the other 33.
  • Notification suppression: Completed agents re-inject results when you don't need them. Want to dismiss specific completed agents without killing active ones.

Current Behavior

  • Ctrl+F (double-press): Kills all background agents simultaneously. No selectivity.
  • TaskStop tool: Exists but has known limitations — subagents cannot run TaskStop for tasks they initiated (#23154, now closed), and TaskStop itself can trigger CPU freezes (#27415).
  • No /stop-agent slash command exists.
  • No UI for listing running agents with their status and selectively acting on them.

Proposed Solutions (ranked by impact)

1. /stop-agent <task-id> slash command

Terminate a specific background agent by its task ID. The task ID is already visible in TaskOutput results and /tasks output. This is the minimum viable solution.

2. /list-agents slash command with status

Show all running and recently-completed background agents with:

  • Task ID
  • Status (running / completed / failed)
  • Description (from the Task tool's description parameter)
  • Elapsed time

This gives users the information needed to make selective stop decisions.

3. Fix TaskStop for main-session use

Allow the main session to reliably run TaskStop for any task ID, including those spawned by subagents. This enables programmatic agent management without slash commands.

4. Selective kill UI via Ctrl+F

Instead of immediately killing everything, Ctrl+F could open a fuzzy-select list of running agents (similar to how Ctrl+R works for command history). User picks which agents to terminate.

5. Auto-dismiss completed agent notifications

Completed agents that have already had their results read (via TaskOutput) should not re-inject their results on subsequent interactions. Allow suppressing notifications from acknowledged agents.

Environment

  • Claude Code v2.1.49+
  • Platform: Linux (Pop!_OS)
  • Subscription: Max

Related Issues

  • #23154 — Subagents can't run TaskStop (closed, but underlying limitation affects this request)
  • #27415 — 100% CPU freeze on TaskStop (runaway posix_spawn loop)
  • #25147 — Background agents bypass Stop hooks
  • #26041 — Autocompact spiral when background agents return results simultaneously

View original on GitHub ↗

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