claude-code - 💡(How to fix) Fix [DOCS] Agent view docs omit shell-command background session launch syntax

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

This is separate from generic background task documentation because the new feature is specifically about creating a background session from a shell command and then managing it through the agent view lifecycle.

Fix Action

Fix / Workaround

"Dispatch new agents" and "From your shell" for shell-command background sessions

The agent view page currently documents prompt-based dispatch from agent view:

The current docs cover ordinary prompt-based background sessions, regular interactive ! shell mode, and background Bash tasks inside a session, but they do not explain this new agent-view/shell entry point. Users reading the agent view page would not know that ! in agent view dispatches a shell command as a background session rather than a normal Claude prompt, or that --bg --exec exists for scripts.

Code Example

claude --bg --exec 'npm test'
RAW_BUFFERClick to expand / collapse

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/agent-view

Section/Topic

"Dispatch new agents" and "From your shell" for shell-command background sessions

Current Documentation

The agent view page currently documents prompt-based dispatch from agent view:

Type a prompt in the input at the bottom of agent view and press Enter to start a new background session. The session is named automatically from the prompt; rename it later with Ctrl+R.

The same table lists prompt prefixes such as subagent names, @<repo>, /<command>, and pull request references, but does not list ! <command> as an agent-view input form.

The shell launch section documents --bg only with a prompt:

Pass --bg to start a session that goes straight to the background:

claude --bg "investigate the flaky SettingsChangeDetector test"

The CLI reference likewise documents --bg without --exec:

--bg | Start the session as a background agent and return immediately. Prints the session ID and management commands. Combine with --agent to run a specific subagent

What's Wrong or Missing?

Claude Code v2.1.154 added a user-facing way to start shell-command background sessions:

  • In claude agents, type ! <command> to run a shell command as a background session that can be attached to and detached from.
  • From the shell, use claude --bg --exec '<command>' for the same kind of command-backed background session.

The current docs cover ordinary prompt-based background sessions, regular interactive ! shell mode, and background Bash tasks inside a session, but they do not explain this new agent-view/shell entry point. Users reading the agent view page would not know that ! in agent view dispatches a shell command as a background session rather than a normal Claude prompt, or that --bg --exec exists for scripts.

This is separate from generic background task documentation because the new feature is specifically about creating a background session from a shell command and then managing it through the agent view lifecycle.

Suggested Improvement

Add ! <command> to the "From agent view" prefix table, for example:

! <command> | Run a shell command as a background session. The command appears in agent view so you can monitor it, attach to inspect output, and detach while it keeps running.

Add a shell example near the existing claude --bg examples:

claude --bg --exec 'npm test'

Clarify whether command-backed background sessions support the same management commands as other background sessions, such as claude attach <id>, claude logs <id>, and claude stop <id>.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

PageLine(s)Context
https://code.claude.com/docs/en/agent-view231-260Documents prompt-based dispatch and supported prefixes, but not ! <command>
https://code.claude.com/docs/en/agent-view283-310Shows claude --bg "<prompt>", --agent, and --name examples, but not --bg --exec
https://code.claude.com/docs/en/cli-reference27, 59Documents claude agents and --bg, but not the shell-command execution form
https://code.claude.com/docs/en/interactive-mode269-286Documents ! shell mode for a regular interactive session, without connecting it to agent view background sessions

Total scope: 4 page sections affected

Version context: Claude Code v2.1.154 release entry: claude agents: type ! <command> to run a shell command as a background session you can attach to and detach from. Also available as claude --bg --exec '<command>'.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING