Claude Code Docs Example

auditedFree

The getting-started example from the official Claude Code status line documentation, verbatim: model name, current folder, and context usage. Requires jq. Source: code.claude.com/docs/en/statusline

by anonymous0 installsofficial-docsexamplejqminimal
Claude Code
>
[Fable 5] ๐Ÿ“ my-project | 26% context
? for shortcutsโตโต accept edits on
Security auditby claude-sonnet-4-5

Reads Claude Code session JSON from stdin, extracts model name, current directory, and context usage percentage using jq, then displays a single formatted line showing the model, folder name, and context percentage. No network connections, no file writes, no file reads beyond stdin, no subprocess execution beyond jq for JSON parsing.

subprocesses

Audits are advisory. This script runs on your machine โ€” read it before installing.

The script โ€” read it before you run it

#!/bin/bash
# Read JSON data that Claude Code sends to stdin
input=$(cat)

# Extract fields using jq
MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
# The "// 0" provides a fallback if the field is null
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)

# Output the status line - ${DIR##*/} extracts just the folder name
echo "[$MODEL] ๐Ÿ“ ${DIR##*/} | ${PCT}% context"

Reviews

no reviews yet