Package Exports
- contextbricks-universal
- contextbricks-universal/scripts/statusline.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (contextbricks-universal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ContextBricks Universal
Cross-platform statusline for Claude Code CLI with real-time context brick visualization.
Works on Windows, Linux, and macOS — pure Node.js, no bash or jq required.
[Sonnet 4.5] claude-skills:main *↑2 | +145/-23
[5f2ce67] Remove auth-js skill
[■■■■■■■■■■■■■□□□□□□□□□□□□□□□□□] 43% | 113k free | 0h12m | $0.87
5h:64% ~23m | 7d:57% ~1d23h | sonnet:9% ~3d23hFeatures
- Real-time context tracking — brick visualization of context window usage
- Rate limit tracking — 5-hour and 7-day utilization with reset timers (Max/Pro subscribers)
- Official percentage fields (Claude Code 2.1.6+) with fallback calculation (2.0.70+)
- Git integration — repo, branch, commit hash, message, dirty/ahead/behind indicators
- Session metrics — model name, lines changed, duration, cost (hidden for Max subscribers)
- Environment config —
CONTEXTBRICKS_SHOW_DIR,CONTEXTBRICKS_BRICKS,CONTEXTBRICKS_SHOW_LIMITS
Installation
Quick Install (Recommended)
npm install -g contextbricks-universal
contextbricks installOr one-liner via npx (installs and runs automatically):
npx contextbricks-universalNode.js is the only requirement (already present if you use Claude Code).
From GitHub (without npm)
npm install -g github:thebtf/contextbricks-universal
contextbricks installFrom Source
git clone https://github.com/thebtf/contextbricks-universal.git
cd contextbricks-universal
node bin/cli.js installWhat the Installer Does
- Copies
statusline.jsto~/.claude/statusline.js - Updates
~/.claude/settings.jsonwith thestatusLinecommand - Backs up existing configuration before any changes
Display Layout
Line 1 — Model + Git + Changes
[Sonnet 4.5] claude-skills:main *↑2 | +145/-23Line 2 — Commit Details
[5f2ce67] Remove auth-js skillLine 3 — Context Bricks
[■■■■■■■■■■■■■□□□□□□□□□□□□□□□□□] 43% | 113k free | 0h12m | $0.87Line 4 — Rate Limits (Max/Pro subscribers)
5h:64% ~23m | 7d:57% ~1d23h | sonnet:9% ~3d23h| Symbol | Meaning |
|---|---|
■ (cyan) |
Used context |
□ (dim) |
Free space |
* |
Uncommitted changes |
↑3 |
Ahead of remote by 3 |
↓2 |
Behind remote by 2 |
5h:X% |
5-hour rolling limit utilization |
7d:X% |
7-day overall limit utilization |
sonnet:X% |
7-day Sonnet sub-limit (if applicable) |
opus:X% |
7-day Opus sub-limit (if applicable) |
~22m / ~1d23h |
Time until limit resets (exact by default) |
Configuration
| Environment Variable | Default | Description |
|---|---|---|
CONTEXTBRICKS_SHOW_DIR |
1 |
Show current subdirectory (0 to hide) |
CONTEXTBRICKS_BRICKS |
30 |
Number of bricks in the visualization |
CONTEXTBRICKS_SHOW_LIMITS |
1 |
Show rate limit utilization (0 to hide) |
CONTEXTBRICKS_RESET_EXACT |
1 |
Exact reset times ~1d23h (0 for approximate ~1d) |
How It Works
Context Tracking (Claude Code 2.1.6+)
Uses pre-calculated percentage fields:
{
"context_window": {
"context_window_size": 200000,
"used_percentage": 43.5,
"remaining_percentage": 56.5
}
}Fallback (Claude Code 2.0.70+)
Calculates from current_usage token counts when percentage fields are unavailable.
Settings
The installer configures ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "node ~/.claude/statusline.js",
"padding": 0
}
}Rate Limit Tracking
Line 4 shows your current utilization of Claude's rate limits — useful for Max and Pro subscribers to avoid hitting caps.
How It Works
- Reads your OAuth token from Claude Code credentials (
~/.claude/.credentials.json, or macOS keychain) - Fetches usage data from
api.anthropic.com/api/oauth/usage - Caches the response for 5 minutes (
~/.claude/.usage-cache.json) - Displays utilization percentages with color coding:
- Green (0-49%) — plenty of capacity
- Yellow (50-79%) — approaching limit
- Red (80-100%) — near or at limit
Requirements
- Active Claude Max or Pro subscription with OAuth credentials
- API-only users will not see Line 4 (gracefully skipped)
Privacy
- Your OAuth token is never logged or exposed in command arguments
- Token is passed to the HTTPS subprocess via environment variable
- Cache file (
~/.claude/.usage-cache.json) is stored locally
Troubleshooting
| Issue | Solution |
|---|---|
| Line 4 not showing | Verify ~/.claude/.credentials.json exists with claudeAiOauth.accessToken |
| Stale data | Delete ~/.claude/.usage-cache.json to force refresh |
| Want to hide Line 4 | Set CONTEXTBRICKS_SHOW_LIMITS=0 |
Testing
contextbricks testRequirements
- Node.js >= 14
- git (optional, for git info display)
No bash, jq, bc, sed, cut, or any other Unix tools required.
Bash vs Node.js
| Bash (v3.5) | Node.js (v4.x) | |
|---|---|---|
| Platform | Linux/macOS only | Windows + Linux + macOS |
| Dependencies | bash, jq, git, bc, sed, cut | Node.js only (git optional) |
| JSON parsing | External jq |
Native JSON.parse() |
| Install | Shell scripts | npm i -g contextbricks-universal |
| Output | Identical | Identical |
Uninstallation
contextbricks uninstallOr manually:
- Delete
~/.claude/statusline.js - Remove the
statusLinesection from~/.claude/settings.json - Restart Claude Code
Acknowledgements
This project is a cross-platform Node.js rewrite of ContextBricks created by Jeremy Dawes (jezweb.com.au). The original bash implementation provided the foundation for the statusline format, brick visualization, and git integration.
Also inspired by ccstatusline.
License
MIT — Copyright (c) 2025 Jeremy Dawes (Jezweb)