another claude code statusline
1# klaus
2
3another status line for [claude code](https://docs.anthropic.com/en/docs/claude-code)
4
5## install
6
7```bash
8git clone https://tangled.org/shwilliam.net/klaus
9cd klaus
10./install.sh
11```
12
13restart claude code after installing
14
15## uninstall
16
17```bash
18./uninstall.sh
19```
20
21## themes
22
23defaults to dark theme
24
25```bash
26export KLAUS_THEME=light
27```
28
29or set it in your shell profile
30
31## rate limits
32
33shows 5h session and 7d weekly usage via the anthropic oauth api (requires macos keychain access and pro/max plan with oauth login)
34
35cached for 60s by default
36
37```bash
38export KLAUS_USAGE_CACHE_TTL=120
39```
40
41## testing
42
43pipe mock json to test output
44
45```bash
46echo '{"model":{"display_name":"Opus 420"},"context_window":{"used_percentage":34,"total_input_tokens":12000,"total_output_tokens":3000},"cost":{"total_lines_added":48,"total_lines_removed":12},"workspace":{"current_dir":"/tmp/test"}}' | ./klaus.sh
47```
48
49## available data fields
50
51from statusline json
52
53| field | path |
54| ------------- | ------------------------------------ |
55| model name | `model.display_name` |
56| working dir | `workspace.current_dir` |
57| context % | `context_window.used_percentage` |
58| input tokens | `context_window.total_input_tokens` |
59| output tokens | `context_window.total_output_tokens` |
60| lines added | `cost.total_lines_added` |
61| lines removed | `cost.total_lines_removed` |
62| agent name | `agent.name` |
63
64from oauth api
65
66| field | source |
67| ---------- | ----------------------- |
68| 5h usage % | `five_hour.utilization` |
69| 7d usage % | `seven_day.utilization` |
70
71## requirements
72
73- bash
74- [jq](https://jqlang.github.io/jq/)
75- curl
76- git (for branch/repo info)
77- macos keychain (for rate limit data)