The statusline
The statusline is a small script that prints a line of information at each Claude Code interaction. It helps you stay aware of context usage (important — Claude's memory fills up over a long session) and which model you're using.
Step 1: Create the statusline script
mkdir -p ~/.claude
Open the file:
code ~/.claude/statusline.sh
Paste this:
#!/bin/bash
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name // "Claude"')
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // "."')
context=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
folder="${cwd##*/}"
if git -C "$cwd" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
branch=$(git -C "$cwd" branch --show-current 2>/dev/null)
staged=$(git -C "$cwd" diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ')
unstaged=$(git -C "$cwd" diff --name-only 2>/dev/null | wc -l | tr -d ' ')
echo "[$model] $folder:$branch | staged:$staged unstaged:$unstaged | ${context}% ctx"
else
echo "[$model] $folder | ${context}% ctx"
fi
Make it executable:
chmod +x ~/.claude/statusline.sh
Step 2: Connect it to Claude Code
Open your Claude settings file:
code ~/.claude/settings.json
Add (or create the file with) this content:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 1
}
}
Restart Claude Code (claude in your terminal). You should see a status line at the bottom of each response.
You can use /statusline instead
Inside Claude Code, run /statusline to generate and configure a statusline interactively. Claude will ask what you want to show and set it up for you.
Step 3: Add sound notifications
Hooks let you run commands at key moments in Claude's workflow. Add notification sounds so you know when Claude needs you or when it's done:
Edit ~/.claude/settings.json to add a hooks section:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 1
},
"hooks": {
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude needs your attention\" with title \"Claude Code\"' && afplay /System/Library/Sounds/Glass.aiff"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "afplay /System/Library/Sounds/Hero.aiff"
}
]
}
]
}
}
Now you'll hear a glass sound when Claude needs input and a hero sound when it finishes a task.
Context usage
When the statusline shows context approaching 80-90%, Claude's memory is filling up. At that point, start a new session (/clear or restart claude) to reset it. Old sessions get slow and Claude starts forgetting earlier parts of the conversation.
Verify hooks are set up
Inside Claude Code, run:
/hooks
This opens a read-only view of your configured hooks so you can confirm they're set up correctly.