Manual Script Deployment
Manual Script Deployment
If you prefer not to use the automated installation command, you can manually set up the statusline script by following these steps. This approach is recommended if you want to store the script in a custom location or audit the code before execution.
1. Save the Generated Script
Once you have finished configuring your statusline in the editor:
- Navigate to the Output panel at the bottom of the editor.
- Click Copy script to copy the full Bash source code to your clipboard.
- Create a new file on your system (standard location is
~/.claude/statusline.sh) and paste the content.
# Create the directory if it doesn't exist
mkdir -p ~/.claude
# Paste your clipboard content into the file
nano ~/.claude/statusline.sh
2. Set Permissions
The script must be executable for Claude Code to run it during terminal sessions.
chmod +x ~/.claude/statusline.sh
3. Verify Dependencies
The generated script relies on a few standard utilities to process data and display colors correctly. Ensure these are installed on your system:
- jq: Used to parse the JSON data provided by Claude Code.
- python3: Used for high-precision time calculations and rate limit countdowns.
- Platform-specific helpers (only required if using "Rate 5h" or "Rate Week" blocks):
- Linux:
libsecret-tools - Windows:
CredentialManagerPowerShell module - macOS: Uses the native
securityframework (no extra install needed).
- Linux:
4. Configure Claude Code Settings
Finally, you must tell Claude Code to use your new script. Open your Claude Code settings file:
File path: ~/.claude/settings.json
Add or update the "statusline" key to point to your script's absolute path:
{
"statusline": "~/.claude/statusline.sh"
}
How the Script Operates
The generated script acts as a middleware between Claude Code and your terminal. Every time Claude Code prepares a prompt, it sends a JSON object to the script's standard input (stdin).
The script performs the following actions:
- Parses Stdin: Extracts model names, context usage, and working directory using
jq. - Fetches Usage Data: If rate limit blocks are enabled, it retrieves your Anthropic API usage. To ensure the terminal remains snappy, it caches this data in
~/.claude/.usage-cache.jsonfor 2 minutes. - Calculates Time: Uses Python to determine the exact time remaining until your rate limits reset.
- Outputs ANSI: Prints a single line of text formatted with ANSI 256-color codes based on your editor choices.
Testing Your Script
You can test the script manually by feeding it a mock JSON object to see how it renders:
echo '{"model":{"display_name":"Claude 3.7 Sonnet"}, "context_window":{"used_percentage": 45}}' | ~/.claude/statusline.sh