Files
claude-code/automation/statusline.sh
OpenCode Test ae6f056698 feat: add status line with agent display + fix pa-mode keybind
Status line shows: [agent-name] Model | X% context
- Added statusline.sh script that reads CLAUDE_AGENT env var
- Configured settings.json to use the status line script

Fixed pa-mode keybind issue (terminal closing immediately):
- Changed from detached session + attach to exec tmux -A
- Using exec replaces shell process, keeping terminal open
- Added CLAUDE_AGENT env var export for status line

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 10:55:16 -08:00

24 lines
722 B
Bash
Executable File

#!/usr/bin/env bash
# Claude Code Status Line - displays agent, model, and context usage
input=$(cat)
AGENT="${CLAUDE_AGENT:-}"
MODEL=$(echo "$input" | jq -r '.model.display_name // "?"')
# Calculate context percentage
CONTEXT_PCT="?"
usage=$(echo "$input" | jq '.context_window.current_usage // empty')
if [ -n "$usage" ]; then
current=$(echo "$usage" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens')
size=$(echo "$input" | jq '.context_window.context_window_size')
if [ "$size" -gt 0 ] 2>/dev/null; then
CONTEXT_PCT=$((current * 100 / size))
fi
fi
if [ -n "$AGENT" ]; then
echo "[$AGENT] $MODEL | ${CONTEXT_PCT}% context"
else
echo "$MODEL | ${CONTEXT_PCT}% context"
fi