[DOCS] `claude agents --json` docs omit `--all` flag, new `id` and `state` fields, and which session states the JSON output includes

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened Jun 9, 2026 · closed Jul 1, 2026

Documentation Type

Incorrect/outdated documentation

Documentation Location

https://code.claude.com/docs/en/agent-view#manage-sessions-from-the-shell

Section/Topic

"Manage sessions from the shell" — the claude agents --json row in the commands table, and the cross-reference to it from the claude agents entry in the cli-reference commands table.

Current Documentation

In docs/code.claude.com/docs/en/agent-view.md line 446, the claude agents --json row in the "Manage sessions from the shell" table says:

claude agents --json | Print live sessions as a JSON array and exit. Each entry has pid, cwd, kind, and startedAt, plus sessionId, name, and status when set. When status is waiting, waitingFor says what the session is blocked on, such as permission prompt or input needed. Combine with --cwd <path> to filter

In docs/code.claude.com/docs/en/cli-reference.md line 27, the claude agents row in the subcommands table says:

claude agents | Open agent view to monitor and dispatch parallel background sessions. Use --cwd <path> to show only sessions started under that directory, or --json to print live sessions as a JSON array for scripting. Pass --permission-mode, --model, --effort, or --agent to set defaults for dispatched sessions. Accepts --settings, --add-dir, --plugin-dir, and --mcp-config like the top-level claude command. Opening agent view requires an interactive terminal | claude agents --json

What's Wrong or Missing?

A. The --all flag is undocumented for claude agents --json

The changelog for v2.1.169 adds --all to claude agents --json so the JSON output can include completed sessions, not just live ones. Neither the claude agents --json row in the "Manage sessions from the shell" table in agent-view.md nor the claude agents row in the cli-reference.md subcommand table mentions --all. The only --all flag the page mentions is on claude respawn (line 451) and claude project purge (line 35 of cli-reference.md), which are unrelated commands.

B. The new id and state fields are missing from the documented JSON schema

The doc lists the entry fields as pid, cwd, kind, startedAt, and conditionally sessionId, name, and status. The v2.1.169 changelog adds id and state as new top-level fields. Neither name appears in the table row, so a script author reading the docs cannot know the new fields exist or what they hold. The doc also does not say what relationship the new id field has to the existing sessionId field (e.g. whether id is a short identifier and sessionId is the longer UUID, or whether one supersedes the other).

C. The set of states included in the JSON output is not stated

The v2.1.169 changelog fixes claude agents --json to stop omitting blocked and just-dispatched background sessions, and the --all flag extends it further to include completed sessions. The current doc says "Print live sessions" but does not enumerate which session states the JSON output covers by default versus which require --all, and does not call out that blocked and just-dispatched sessions are now included at all. The Read session state table earlier in the page (lines 109-117) lists six states — Working, Needs input, Idle, Completed, Failed, Stopped — but the claude agents --json row does not say which of those appear in the array.

D. The cli-reference cross-reference still reads "print live sessions"

In cli-reference.md line 27 the claude agents row says --json "print[s] live sessions as a JSON array for scripting". This wording is now stale in v2.1.169 because the default set is wider than the word "live" suggests and --all further widens it. A user who reads only the cli-reference and never clicks through to agent-view.md will be unaware of --all and of the blocked/just-dispatched/completed coverage.

Suggested Improvement

A. Add --all to the documented flags

Before (agent-view.md line 446):

claude agents --json | Print live sessions as a JSON array and exit. Each entry has pid, cwd, kind, and startedAt, plus sessionId, name, and status when set. When status is waiting, waitingFor says what the session is blocked on, such as permission prompt or input needed. Combine with --cwd <path> to filter

After:

claude agents --json | Print sessions as a JSON array and exit. Each entry has id, state, pid, cwd, kind, and startedAt, plus sessionId, name, and status when set. When status is waiting, waitingFor says what the session is blocked on, such as permission prompt or input needed. By default the array includes working, needs-input, idle, blocked, and just-dispatched sessions; pass --all to also include completed, failed, and stopped sessions. Combine with --cwd <path> to filter

B. Document the new id and state fields

State that id is the short session identifier (the same value that claude attach, claude logs, and claude stop accept) and that state is one of the six values from the "Read session state" table (working, needs_input, idle, completed, failed, stopped).

C. Enumerate the included states

Spell out which states the JSON output includes by default and which --all adds, using the state names from the existing "Read session state" table further up the same page.

D. Update the cli-reference row

Before (cli-reference.md line 27):

Use --cwd <path> to show only sessions started under that directory, or --json to print live sessions as a JSON array for scripting.

After:

Use --cwd <path> to show only sessions started under that directory, or --json to print sessions as a JSON array for scripting. Combine --json with --all to include completed, failed, and stopped sessions in the output. See agent view for the JSON schema and state coverage.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/agent-view#manage-sessions-from-the-shell | 446 | claude agents --json row in the "Manage sessions from the shell" table — missing --all, missing id and state fields, missing state-coverage list |
| https://code.claude.com/docs/en/cli-reference | 27 | claude agents subcommand row — calls output "live sessions" and does not mention --all or the new fields |

Total scope: 2 pages affected

Version: This gap was introduced in v2.1.169. The fix added --all to claude agents --json, made blocked and just-dispatched sessions part of the default output, and added the id and state fields to each JSON entry.

Cross-reference: The "Read session state" table in the same agent-view.md page (around line 109) is the existing source of truth for the six session states (Working, Needs input, Idle, Completed, Failed, Stopped) and can be cross-referenced by the updated claude agents --json row rather than restated.

View original on GitHub ↗

3 Comments

github-actions[bot] · 4 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/65182

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

coygeek · 3 months ago

Issue #66384 Verification

Title: [DOCS] claude agents --json docs omit --all flag, new id and state fields, and which session states the JSON output includes
Issue Date: 2026-06-09
Verification Date: 2026-07-01
Status: RESOLVED

---

Issue Summary

This issue reports that the claude agents --json row in the "Manage sessions from the shell" table on the agent-view page, and the cross-reference to it from the claude agents row on the cli-reference page, fail to document the --all flag added in v2.1.169, the new id and state fields added to each JSON entry in v2.1.169, and which session states the JSON output covers by default versus with --all.

---

Verification Results

Claim A: The --all flag is undocumented for claude agents --json

Status: RESOLVED

At https://code.claude.com/docs/en/agent-view#manage-sessions-from-the-shell, line 458, the claude agents --json row now reads in part:

Add --all to also include completed background sessions.

The --all flag is documented in the claude agents --json row itself. The cli-reference row at https://code.claude.com/docs/en/cli-reference, line 28, also mentions it parenthetically:

--json --all also includes completed background sessions

Verdict: The --all flag is now documented on both pages.

Claim B: The new id and state fields are missing from the documented JSON schema

Status: RESOLVED

At https://code.claude.com/docs/en/agent-view#manage-sessions-from-the-shell, line 458, the claude agents --json row now reads in part:

Background entries also have id, usable with claude attach/logs/stop, and state: one of working, blocked, done, failed, or stopped.

Both new fields are documented, the relationship between id and claude attach/logs/stop is spelled out, and the possible state values are enumerated.

Verdict: The id and state fields are documented with their semantics.

Claim C: The set of states included in the JSON output is not stated

Status: RESOLVED

At https://code.claude.com/docs/en/agent-view#manage-sessions-from-the-shell, line 458, the claude agents --json row now reads in part:

Print active sessions as a JSON array and exit: every live session, plus background sessions that are still working or blocked even when their process has exited. Add --all to also include completed background sessions.

The default coverage (live + working/blocked background) and the --all extension (completed background) are spelled out, and the enum for state lists the five values (working, blocked, done, failed, stopped) that an entry can take.

Verdict: The included-state coverage is documented. Note: the state enum uses programmatic values (working, blocked, done, failed, stopped) rather than the UI labels in the "Read session state" table (Working, Needs input, Idle, Completed, Failed, Stopped), which is a minor divergence but the issue did not request the UI labels be cross-referenced.

Claim D: The cli-reference cross-reference still reads "print live sessions"

Status: RESOLVED

At https://code.claude.com/docs/en/cli-reference, line 28, the claude agents row now reads in part:

--json to print active sessions as a JSON array for scripting (--json --all also includes completed background sessions).

The wording changed from "live sessions" to "active sessions" and now references --all. A user who reads only the cli-reference will know about --all and about the broader coverage.

Verdict: The cli-reference row is updated to reflect the v2.1.169 behavior.

---

Current State

| Claim | Status |
|-------|--------|
| A: --all flag undocumented | RESOLVED |
| B: id and state fields missing | RESOLVED |
| C: Included states not stated | RESOLVED |
| D: cli-reference cross-reference stale | RESOLVED |

---

Suggested Fix

N/A — issue has been resolved.

---

References

---

Conclusion & Recommendation

Primary Concern: The agent-view and cli-reference docs for claude agents --json failed to document the v2.1.169 additions: --all, the new id and state fields, and the state coverage.

Resolution Status: RESOLVED

Recommendation: CLOSE

Both pages now document --all, the id and state fields, the state enum, the default coverage (live + working/blocked), and the --all extension (completed). The cli-reference cross-reference is also updated.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.