Skip to content

fix: read live effort level from stdin JSON (effort.level)#42

Merged
daniel3303 merged 1 commit into
daniel3303:mainfrom
MIT0101:fix/live-effort-level
May 11, 2026
Merged

fix: read live effort level from stdin JSON (effort.level)#42
daniel3303 merged 1 commit into
daniel3303:mainfrom
MIT0101:fix/live-effort-level

Conversation

@MIT0101
Copy link
Copy Markdown
Contributor

@MIT0101 MIT0101 commented Apr 28, 2026

Problem

The statusline currently resolves the reasoning-effort label from two
sources only:

  1. CLAUDE_CODE_EFFORT_LEVEL environment variable.
  2. effortLevel in settings.json.

Neither is updated when the user changes effort with the in-session
/effort <level> slash command. After running /effort max, the
statusline keeps rendering the previously persisted value (e.g.
xhigh) until the next process restart and settings.json edit.

Fix

Claude Code already pipes the live effort to the statusline command
under effort.level in the stdin JSON (see the official statusline
schema: https://code.claude.com/docs/en/statusline.md#available-data).

Prefer that field on both the Bash and PowerShell entrypoints, then
fall back through the existing chain so behaviour is unchanged when the
field is absent (older Claude Code versions or models without an
effort parameter):

stdin .effort.level
  → CLAUDE_CODE_EFFORT_LEVEL
  → settings.json effortLevel
  → "medium"

Changes

  • statusline.sh — read .effort.level via jq before consulting env
    and settings.
  • statusline.ps1 — same priority order using $data.effort.level.

No new dependencies; both scripts already use jq / ConvertFrom-Json
for other fields.

Verification

PowerShell, on Windows 11:

$json = '{"model":{"display_name":"Opus"},"cwd":"C:/x","effort":{"level":"max"},"context_window":{"context_window_size":200000,"current_usage":{"input_tokens":1000}}}'
$json | powershell -NoProfile -ExecutionPolicy Bypass -File statusline.ps1
# … effort: max …  (red, as expected)

Removing effort from the JSON falls back to settings.json's
effortLevel (verified: still renders xhigh).

The Bash variant mirrors the PowerShell logic line-for-line and uses
the same jq invocation pattern as the rest of the file.

@daniel3303 daniel3303 merged commit bea52b5 into daniel3303:main May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants