Set Up Claude Code's Status Line¶
| Category | Claude Code |
| Status | โ Completed |
| Repo | nextwork-set-up-claude-codes-status-line |
| Original NextWork guide | nextwork.ai |
Learning project
Practice work following a NextWork guide, separate from my production projects.
๐ NextWork learning project. This is a practice project I built while working through NextWork's Set Up Claude Code's Status Line guide. It is part of my Learning portfolio and is fully separate from my production projects.
Category: Learning โบ Claude Code
Status: โ
Completed
Overview¶
Claude Code can run a command after each turn and show its output under the prompt. It pipes the session as JSON on stdin. statusline.js turns that into model โ folder โ โ branch โ ctx 62% โ $0.42, with the context percentage green below 50%, yellow below 80%, and red with a /compact hint above that.
Summary¶
The status-line script, with color-coded context warnings (secret mission), and a safe installer are built and tested with fixtures. I installed it and saw it live at the bottom of a real interactive Claude Code session (model โ folder โ branch โ ctx % โ cost), and saved the exact JSON Claude Code piped to it as a test fixture.
The checks behind this are in docs/verification.txt.
Skills & tools¶
Claude Code, Node.js, CLI tooling, ANSI colors, Testing with fixtures
What I built¶
statusline.js: the renderer (stdin JSON โ one line).settings.example.json: thestatusLinesetting.install.sh: backs up and merges into ~/.claude/settings.json.tests/: 5 tests with 4 fixtures.demo.sh: renders every fixture.docs/live-statusline-capture.md: a terminal capture of the status line inside a live Claude Code session.tests/fixtures/real-session-2.1.335.json: the real JSON Claude Code 2.1.335 sent to the script, which the verification renders again.
How to run¶
node --test tests/*.test.js
bash demo.sh
bash install.sh # then restart Claude Code
Verification¶
I ran the verification command on 2026-12-02. The full output is in docs/verification.txt.
node --test tests/*.test.js && bash demo.sh && node statusline.js < tests/fixtures/real-session-2.1.335.json | grep -q 'ctx 1%' && echo 'OK real Claude Code session JSON renders'
Notes¶
Model substitution: the guide uses Claude Code with a Claude subscription. I don't have a Claude account, so I ran the real Claude Code CLI (v2.1.335) headlessly and pointed it at a substitute model, either a local Ollama model or a free OpenRouter model, through the Anthropic-compatible API (ANTHROPIC_BASE_URL). Claude Code's skills, hooks, settings, and tools behave the same; only the model answering is different. The live capture is in docs/live-statusline-capture.md.
Original project: https://nextwork.ai/projects/1b123e21-a5f0-5730-a342-17d9b54d1a83 ยท Part of my NextWork Learning portfolio (hub).
Verification output¶
From docs/verification.txt:
$ node --test tests/*.test.js && bash demo.sh && node statusline.js < tests/fixtures/real-session-2.1.335.json | grep -q 'ctx 1%' && echo 'OK real Claude Code session JSON renders'
โ low context is green, shows model, folder, cost (0.951917ms)
โ medium context is yellow (0.171479ms)
โ high context is red with a warning (0.137692ms)
โ percent computed from token usage when used_percentage is absent (0.182963ms)
โ works as a stdin command and survives junk input (46.279559ms)
โน tests 5
โน suites 0
โน pass 5
โน fail 0
โน cancelled 0
โน skipped 0
โน todo 0
โน duration_ms 108.384565
tests/fixtures/high.json: Sonnet โ my-app โ ctx 91% โ consider /compact โ $3.75
tests/fixtures/low.json: Opus โ my-app โ ctx 12% โ $0.42
tests/fixtures/mid.json: Sonnet โ my-app โ ctx 62% โ $1.20
tests/fixtures/real-session-2.1.335.json: qwen2.5:3b โ sldemo โ โ feature/statusline-demo โ ctx 1% โ $0.05
tests/fixtures/tokens.json: Haiku โ my-app โ ctx 45% โ $0.42
OK real Claude Code session JSON renders
[exit code 0]