setup-statusline
Skill2 starsChanged 6 months agoMITView on GitHub
Add pipeline state display to the user's configured Claude Code status line script. Reads the actual statusLine command from settings.json, adapts to the script's language and conventions. Idempotent - safe to run multiple times.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- ww-w-ai/super-token-savertheir own version, first seen Aug 25, 2026
- ThomasLangbroek/frugaltheir own version, first seen Jul 9, 2026
- UnicodeDigital/claude-skillstheir own version, first seen Jun 16, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- ThomasLangbroek/frugal★ 36same name
- ww-w-ai/super-token-saver★ 34same name
- UnicodeDigital/claude-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 3 are distinctive, and 13 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Check these settings files in precedence order (first match wins): .claude/settings.local.json, .claude/settings.json, …
- Very specific: line 13
Look for the exact key statusLine (not statusLine2 or any other variant - only statusLine works in Claude Code)
- Very specific: line 15
If no statusLine key is found, proceed to step 2 to create one
- Very specific: line 16
If statusLine is found but the script file does not exist, tell the user the configured script is missing and they should restore it …
- Very specific: line 18
If statusLine was not found in any settings file, create it:
- Very specific: line 19
Write the default script to ~/.claude/statusline.sh (see "Default script" below)
- Very specific: line 21
Add statusLine to ~/.claude/settings.json (global user settings):
- Very specific: line 32
Check if the script file already contains the marker # pipeline-status-block-start.
- Distinctive: line 34
Read the script carefully to understand its conventions:
- Very specific: line 41
Read session_id and workspace.project_dir from the stdin JSON the statusLine command receives
- Very specific: line 42
Read <project_dir>/.pipeline/sessions/<session_id>.json first (holds the session state directly).
- Very specific: line 43
When mode is "pipeline", output: [pipeline-name] ✅ prev-step → 🔄 current-step
- Distinctive: line 128
Always check the per-session file first.
- Very specific: line 175
Only the exact key statusLine is recognized - other keys like statusLine2 are silently ignored
- Very specific: line 176
Always write statusLine to ~/.claude/settings.json (global), not a project settings file
- Distinctive: line 179
If appending a block is impractical (e.g.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
pipeline:setup-statusline
Modifies the user's configured status line script to display pipeline state (pipeline name, previous step, current step, retry count) when a pipeline is active.
What to do
- Find the configured status line script:
- Check these settings files in precedence order (first match wins):
.claude/settings.local.json,.claude/settings.json,~/.claude/settings.local.json,~/.claude/settings.json - Look for the exact key
statusLine(notstatusLine2or any other variant - onlystatusLineworks in Claude Code) - Extract the script file path from
statusLine.command- it may be a plain path (~/.claude/statusline.sh) or a command with a runtime (node ~/.claude/statusline.js) - If no
statusLinekey is found, proceed to step 2 to create one - If
statusLineis found but the script file does not exist, tell the user the configured script is missing and they should restore it manually, then stop
- Check these settings files in precedence order (first match wins):
- If
statusLinewas not found in any settings file, create it:- Write the default script to
~/.claude/statusline.sh(see "Default script" below) - Make it executable:
chmod +x ~/.claude/statusline.sh - Add
statusLineto~/.claude/settings.json(global user settings):{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } } - Tell the user what was created before continuing
- Write the default script to
- Check if the script file already contains the marker
# pipeline-status-block-start. If it does, tell the user it's already set up and stop. - Read the script carefully to understand its conventions:
- How it reads stdin (e.g.
input=$(cat),RAW=$(cat), directjqfrom process substitution) - What language it uses (bash, node, python, etc.)
- What color or formatting variables it defines
- How it reads stdin (e.g.
- Append a pipeline state block at the end of the file, adapted to the script's language and conventions. The block must:
- Be wrapped in
# pipeline-status-block-start/# pipeline-status-block-endmarkers - Read
session_idandworkspace.project_dirfrom the stdin JSON the statusLine command receives - Read
<project_dir>/.pipeline/sessions/<session_id>.jsonfirst (holds the session state directly); if that file doesn't exist, fall back to<project_dir>/.pipeline/state.json, keyed bysession_id - When
modeis"pipeline", output:[pipeline-name] ✅ prev-step → 🔄 current-step - Append a retry count
(×N)in a distinct color whenvisit_counts[current_step] > 0 - Be completely silent when no pipeline is active
- Be wrapped in
- Confirm to the user that the block was added and what file was modified.
Default script
Full-featured two-line display: model/dir/git on line 1, context bar/cost/duration/rate limits on line 2.
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
DURATION_MS=$(echo "$input" | jq -r '.cost.total_duration_ms // 0')
CYAN='\033[36m'; GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; RESET='\033[0m'
if [ "$PCT" -ge 90 ]; then BAR_COLOR="$RED"
elif [ "$PCT" -ge 70 ]; then BAR_COLOR="$YELLOW"
else BAR_COLOR="$GREEN"; fi
FILLED=$((PCT / 10)); EMPTY=$((10 - FILLED))
printf -v FILL "%${FILLED}s"; printf -v PAD "%${EMPTY}s"
BAR="${FILL// /█}${PAD// /░}"
MINS=$((DURATION_MS / 60000)); SECS=$(((DURATION_MS % 60000) / 1000))
BRANCH=""
git rev-parse --git-dir > /dev/null 2>&1 && BRANCH=" | 🌿 $(git branch --show-current 2>/dev/null)"
STAGED=$(git diff --cached --numstat 2>/dev/null | wc -l | tr -d ' ')
MODIFIED=$(git diff --numstat 2>/dev/null | wc -l | tr -d ' ')
GIT_COUNTS=""
[ "${STAGED:-0}" -gt 0 ] && GIT_COUNTS=" ${GREEN}+${STAGED}${RESET}"
[ "${MODIFIED:-0}" -gt 0 ] && GIT_COUNTS="${GIT_COUNTS}${YELLOW}~${MODIFIED}${RESET}"
echo -e "${CYAN}[$MODEL]${RESET} 📁 ${DIR##*/}${BRANCH}${GIT_COUNTS}"
COST_FMT=$(printf '$%.2f' "$COST")
FIVE_H=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
WEEK=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
RATE=""
[ -n "$FIVE_H" ] && RATE=" | 5h: $(printf '%.0f' "$FIVE_H")%"
[ -n "$WEEK" ] && RATE="${RATE} 7d: $(printf '%.0f' "$WEEK")%"
echo -e "${BAR_COLOR}${BAR}${RESET} ${PCT}% | ${YELLOW}${COST_FMT}${RESET} | ⏱️ ${MINS}m ${SECS}s${RATE}"State file structure
Primary source - one file per session at .pipeline/sessions/<session_id>.json, holding the session state directly (no outer key):
{
"mode": "pipeline",
"pipeline": ".pipeline/pipeline.yaml",
"current_step": "fix",
"completed_steps": ["plan", "implement", "verify"],
"visit_counts": { "fix": 2 },
"shared_state": {}
}Legacy fallback - if .pipeline/sessions/<session_id>.json does not exist, read .pipeline/state.json, keyed by session ID, and index into it with the session ID:
{
"<session_id>": {
"mode": "pipeline",
"pipeline": ".pipeline/pipeline.yaml",
"current_step": "fix",
"completed_steps": ["plan", "implement", "verify"],
"visit_counts": { "fix": 2 },
"shared_state": {}
}
}pipeline- relative path to the YAML file; strip directory and.yamlextension for the display namecompleted_steps[-1]- the previous step (last completed)visit_counts[current_step]- number of prior completions of the current step;> 0means it's a retry- Always check the per-session file first; only read the legacy file when the per-session file is absent
Pipeline block reference implementation (bash)
Guide for bash scripts. Adapt variable names, color vars, and stdin-reading to match the actual script.
Reads the per-session file first (.pipeline/sessions/<session_id>.json, current format); falls back to the legacy keyed file (.pipeline/state.json) only if the per-session file is absent - mirroring hooks/pipeline_utils.js's getSessionState().
# pipeline-status-block-start
SESSION_ID=$(echo "$input" | jq -r '.session_id // ""')
PROJECT_DIR=$(echo "$input" | jq -r '.workspace.project_dir // ""')
if [ -n "$SESSION_ID" ] && [ -n "$PROJECT_DIR" ]; then
_SESSION_STATE="$PROJECT_DIR/.pipeline/sessions/${SESSION_ID}.json"
_LEGACY_STATE="$PROJECT_DIR/.pipeline/state.json"
if [ -f "$_SESSION_STATE" ]; then
_STATE_JSON=$(cat "$_SESSION_STATE" 2>/dev/null)
elif [ -f "$_LEGACY_STATE" ]; then
_STATE_JSON=$(jq -c --arg s "$SESSION_ID" '.[$s] // empty' "$_LEGACY_STATE" 2>/dev/null)
else
_STATE_JSON=""
fi
if [ -n "$_STATE_JSON" ]; then
_MODE=$(echo "$_STATE_JSON" | jq -r '.mode // ""' 2>/dev/null)
if [ "$_MODE" = "pipeline" ]; then
_PL=$(echo "$_STATE_JSON" | jq -r '.pipeline // ""' 2>/dev/null)
_CUR=$(echo "$_STATE_JSON" | jq -r '.current_step // ""' 2>/dev/null)
_PREV=$(echo "$_STATE_JSON" | jq -r '.completed_steps[-1] // ""' 2>/dev/null)
_VISITS=$(echo "$_STATE_JSON" | jq -r --arg c "$_CUR" '.visit_counts[$c] // 0' 2>/dev/null)
_NAME="${_PL##*/}"; _NAME="${_NAME%.yaml}"
_RETRY=""
if [ "${_VISITS:-0}" -gt 0 ]; then _RETRY=" ${RED}(×${_VISITS})${RESET}"; fi
_PREV_PART=""
if [ -n "$_PREV" ]; then _PREV_PART="${GREEN}✅ ${_PREV}${RESET} → "; fi
printf '%b\n' "${CYAN}[${_NAME}]${RESET} ${_PREV_PART}${YELLOW}🔄 ${_CUR}${RESET}${_RETRY}"
fi
fi
fi
# pipeline-status-block-endReference
Full statusLine documentation (available fields, examples, troubleshooting): https://code.claude.com/docs/en/statusline
Notes
- Only the exact key
statusLineis recognized - other keys likestatusLine2are silently ignored - Always write
statusLineto~/.claude/settings.json(global), not a project settings file - Prefix all pipeline block internal variables with
_to avoid collisions with the host script - The pipeline block must produce no output when no pipeline is active
- If appending a block is impractical (e.g. a compiled binary), tell the user and stop
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

