claude-code - 💡(How to fix) Fix [FEATURE] Surface pending-approval state in session JSONL (or via API) so external tools can detect blocked sessions

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

I'm a senior engineer working across several backend services. I have 4 Claude Code sessions running in 4 tmux windows because each task is independent and Claude does most of the busywork:

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When running multiple Claude Code CLI sessions across terminal windows (different repos / parallel tasks), there's no machine-readable way to tell which sessions are blocked waiting on user approval vs idle vs actively running a tool.

The session JSONL files at ~/.claude/projects/<project>/<session-id>.jsonl are an obvious source of truth, but they only record completed message turns. A tool-use block written before the user has approved looks identical to one currently executing — both show "last entry is assistant message with tool_use, no matching tool_result."

To monitor N sessions today, I have to either tab through each terminal manually, or write fragile heuristics combining JSONL inspection with ps / CPU usage to guess which sessions are paused on an approval prompt.

Proposed Solution

Emit lightweight state events to the session JSONL whenever the session enters a state external observers care about. At minimum:

permission_prompt_started — when a tool requires approval permission_prompt_resolved — approved, denied, or auto-allowed (with the verdict) tool_started / tool_completed — frame the in-progress window

Alternative Solutions

expose this via a small local IPC surface (Unix socket / file in ~/.claude/state/) that lists all currently active sessions and their state.

Priority

High - Significant impact on productivity

Feature Category

Developer tools/SDK

Use Case Example

Scenario: Friday afternoon, mid-sprint, 4 parallel tasks

I'm a senior engineer working across several backend services. I have 4 Claude Code sessions running in 4 tmux windows because each task is independent and Claude does most of the busywork:

Window 1 — service-1: implementing TICKET-100 (a cache fix). Session is mid-Bash running make test, takes ~3 min. Window 2 — service-2: refactoring legacy fallback logic. Claude just finished editing 3 files and is about to run make build. Window 3 — service-3: investigating an alert from this morning, Claude is grepping logs and reading code. Window 4 — service-4: updating documentation, Claude has drafted a project-doc change. Around 14:50 I tab to window 4, approve the doc write, then context-switch to a chat thread about a sprint demo. I forget about the other windows.

The problem:

At 15:05 I come back. I have to manually:

Ctrl+B 1 → check window 1: still running tests, fine. Ctrl+B 2 → window 2: paused at 14:51 on a permission prompt to run make build. Sat idle 14 minutes because make build isn't auto-allowed in that repo. Ctrl+B 3 → window 3: actively writing a Bash grep, fine. Ctrl+B 4 → done, ready for next prompt. I just lost 14 minutes of throughput on window 2 because nothing told me it was waiting.

What I want instead:

A tiny script in window 0 (a status pane) that reads ~/.claude/projects/*.jsonl events and shows:

[15:05:32] sessions: ✅ service-1 running tool=Bash (2m 14s elapsed) ⏸️ service-2 AWAITING APPROVAL tool=Bash "make build" (14m 31s) ✅ service-3 running tool=Grep (4s elapsed) 💤 service-4 idle last activity 9m ago The ⏸️ AWAITING APPROVAL line lights up red. I tab over and approve. Cost: 2 seconds, not 14 minutes.

Why JSONL events would solve this:

Today my script can detect last entry is tool_use, no matching tool_result, but that state is identical for "Bash command running" and "waiting for user." With a permission_prompt_started event written when the prompt appears (and permission_prompt_resolved when it clears), the script becomes trivially correct. No heuristics, no ps tree inspection, no false positives on long-running tools.

This is a daily reality for anyone using Claude Code in parallel — and parallelism is exactly the workflow encouraged by the Agent tool and the --resume UX. The signal already exists internally; just needs to be written to the transcript.

Additional Context

[15:05:32] sessions: ✅ service-1 running tool=Bash (2m 14s elapsed) ⏸️ service-2 AWAITING APPROVAL tool=Bash "make build" (14m 31s) ✅ service-3 running tool=Grep (4s elapsed) 💤 service-4 idle last activity 9m ago The ⏸️ AWAITING APPROVAL line lights up red. I tab over and approve. Cost: 2 seconds, not 14 minutes.

Example: Pixel Agents UI plugin for vs code: https://www.reddit.com/r/vibecoding/comments/1rbs3dq/i_built_a_vs_code_extension_that_turns_your/

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