Skip to content

AgileDataGuides/slashcogs

Repository files navigation

SlashCogs

A live assembly-line board of your Claude Code sessions. Every session is a machine on the factory floor: gears spin and the conveyor runs while Claude works, the amber lamp flashes when a session is waiting on you, and finished sessions sit rusting at the end of the line.

All art is original, hand-drawn CSS and SVG. No third-party game assets are used or required.

What it looks like

In the browser Popped out (menu bar → Pop out board)
SlashCogs in a browser tab SlashCogs as a chromeless app-mode window

Illustrations are hand-drawn SVG, like the board itself.

Requirements

  • Node.js 18+ (no npm packages, zero dependencies)
  • Claude Code 2.x installed on the same machine (CLI or desktop app)

Run it

./start.sh

Or double-click start.command in Finder on macOS. Then open http://127.0.0.1:4127 (it opens automatically). Set PORT to change the port.

The board binds to loopback (127.0.0.1) only, so the session data it reads is never exposed to your network. It has no authentication, so do not expose it: only set HOST=0.0.0.0 if you understand that this makes every session on the machine readable by anyone who can reach the port.

How it works

The server reads the standard Claude Code data directories that every install maintains, so it works on anyone's machine with no configuration:

Path What it provides
~/.claude/sessions/<pid>.json Registry of live sessions (pid, sessionId, cwd, name, start time). A session counts as online only if its pid is still alive.
~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl The session transcript. Its mtime and last entries drive status, model, branch, token usage and the last prompt/output snippets.

Set CLAUDE_DIR to point at a non-standard Claude data directory.

Machine states

State Meaning Signal
🟢 WORKING Claude is crafting Transcript written in the last 12 s, or mid tool call
🟡 WAITING Ball is in your court Process alive, last entry is an assistant reply
🔵 IDLE Powered but quiet Process alive, no activity for 5 min
⚪ OFFLINE Session ended Process gone; shown for 24 h after last activity

The ONLINE / WORKING / WAITING / FABLE pills in the HUD double as filters: click one to show only those machines, click it again to clear. Counts keep reporting the whole floor.

The board polls every 2.5 s by default; the POLL control beside the logo switches between 2.5 s / 5 s / 15 s / 1 min (remembered per browser). Only transcript heads and tails are read (first 16 KB, last 128 KB), so polling stays cheap even with very large sessions.

Limit gauges

A rail on the left of the page shows pressure gauges for your Claude subscription rate limits, the same numbers /usage prints inside Claude Code: week (all models) and session (5-hour window) utilisation. Per-model weekly buckets are deliberately not rendered — plans vary, and the all-models week is the one that bites. The gauges sit side by side, together about two machines tall; every fill rises bottom to top, with the reset countdown underneath. Green under 70%, amber from 70%, red pulsing from 90%. On narrow screens the rail becomes a horizontal strip above the floor.

The server reads the OAuth token Claude Code already stores on your machine (macOS Keychain item Claude Code-credentials, or ~/.claude/.credentials.json on Linux) and asks Anthropic's usage endpoint directly, at most once every 3 min (that endpoint is rate-limited per account, and a 429 backs the board off further, honouring retry-after). The token stays inside the server process: /api/limits returns percentages only, and the only outbound call is to api.anthropic.com.

  • First run on macOS: run ./allow-keychain.sh once (or double-click allow-keychain.command). It grants access to the CLI's Keychain item when that exists (click "Always Allow"), and otherwise mints a long-lived token via claude setup-token and stores it in your login Keychain as SlashCogs-limits-token — needed when Claude Code runs inside the desktop app, which keeps its login internal. Until a credential is available the rail shows a single OFF column naming the cause (hover it for the full reason, and the server log carries the same line); the board retries every 2 min and everything else keeps working.
  • CLAUDE_CODE_OAUTH_TOKEN skips credential discovery (for example a token from claude setup-token).
  • SLASHCOGS_LIMITS_FIXTURE=/path/to.json renders a canned usage response instead of calling the network — handy for demos and UI work.

Menu bar gauge (macOS)

The same gauges can live in your Mac's menu bar via SwiftBar (xbar-compatible):

brew install --cask swiftbar
./menubar/install.sh

(or double-click menubar/install.command in Finder). The installer symlinks menubar/slashcogs-limits.5m.sh into SwiftBar's plugin folder, so a git pull updates the menu bar item too. To remove it, use the dropdown's own "Uninstall menu bar gauge" item, or run menubar/uninstall.sh (or double-click menubar/uninstall.command) — the repo, the board, and any stored credential are left untouched.

The menu bar title shows the week gauge (⚙ W 76%), coloured amber from 70% and red from 90%. The dropdown is a mini board: every gauge with its reset countdown, then your live sessions colour-coded by status (click one to open the board), and actions — Open dashboard always sits first: it starts the board when it is not running (detached, logging to ~/Library/Logs/SlashCogs.log) and shows it in its own native window, a WebKit view via osascript, with no browser involved. Where that is unavailable it falls back to Chrome/Brave/Edge app mode, then the default browser. Fix credentials appears when the credential chain breaks, plus links to open the board in a browser and claude.ai's usage page. It refreshes every 5 min: it asks a running board first (sharing its cache) and falls back to asking Anthropic's usage endpoint directly through the same shared limits.js module, so it works with the board closed.

License

Released into the public domain under The Unlicense. Use it for anything, no attribution required.

About

A live assembly-line board of your Claude Code sessions. Every session is a machine on the factory floor.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages