caprock

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0

README

Caprock

See, steer, and orchestrate every Claude Code session on your machine.

release license CI platform

brew install dspv/tap/caprock
caprock up        # opens localhost:4173

No brew? Grab a binary from Releases.

Live activity and cost, right now

What each session is doing, and what it's costing — live.

What it is

Claude Code runs in your terminal. Caprock is the window into it. One local binary. Your data never leaves your machine.

Why

  • See it — live activity, tokens, cost, and loop alerts per session.
  • Steer it — spawn, pause, and kill sessions from the dashboard.
  • Trust it — orchestrate agents that finish only when the tests pass.
  • Local-first — loopback only, no servers, no telemetry, no account.

Every session on your machine, at a glance:

Every session at a glance

Where the money goes — by model, by project, over time:

Cost breakdown

How it works

  • Observe — watches every claude session via hooks + transcripts.
  • Control — run and drive sessions from the browser.
  • Orchestrate — a verified multi-agent team; a task is done only when green.

Nothing to change in your workflow — it starts by watching the sessions you already run.

Get involved

A team version (shared dashboards, multi-user orchestration) is on the roadmap. Star to follow along.

More

Docs · Changelog · Releasing · Apache-2.0

Building with an AI agent? Start at CLAUDE.md.

Directories

Path Synopsis
cmd
caprock command
caprock is the mission-control CLI and daemon: `caprock up` starts the local daemon (hook receiver + transcript ingest + API + dashboard), `caprock down` stops it, `caprock status` reports, `caprock hooks install|uninstall|status` manage the shim in ~/.claude/settings.json.
caprock is the mission-control CLI and daemon: `caprock up` starts the local daemon (hook receiver + transcript ingest + API + dashboard), `caprock down` stops it, `caprock status` reports, `caprock hooks install|uninstall|status` manage the shim in ~/.claude/settings.json.
caprock-hook command
caprock-hook is the shim Claude Code runs on every hook event.
caprock-hook is the shim Claude Code runs on every hook event.
internal
agents
Package agents spawns and controls Claude Code sessions Caprock owns: a real `claude` process in a PTY, its output buffered for the terminal view and its exit recorded.
Package agents spawns and controls Claude Code sessions Caprock owns: a real `claude` process in a PTY, its output buffered for the terminal view and its exit recorded.
api
Package api serves the loopback HTTP surface: REST queries under /v1, the /v1/live WebSocket, the hook receiver, and the embedded dashboard at /.
Package api serves the loopback HTTP surface: REST queries under /v1, the /v1/live WebSocket, the hook receiver, and the embedded dashboard at /.
board
Package board is the Phase 2 task board: it bridges the hive's task files and mailboxes to the SQLite mirror and the API.
Package board is the Phase 2 task board: it bridges the hive's task files and mailboxes to the SQLite mirror and the API.
bus
Package bus is the in-process fan-out for live frames: every stored event, session change, or alert is published once and delivered to every subscriber (WebSocket clients, the loop detector, tests).
Package bus is the in-process fan-out for live frames: every stored event, session change, or alert is published once and delivered to every subscriber (WebSocket clients, the loop detector, tests).
config
Package config resolves Caprock's data directory and the small on-disk files that live in it: config.json (user settings) and runtime.json (per-run port + token, read by the hook shim).
Package config resolves Caprock's data directory and the small on-disk files that live in it: config.json (user settings) and runtime.json (per-run port + token, read by the hook shim).
cost
Package cost turns token usage into dollars using the versioned pricing table, and computes the cache-savings math ported from Caprock-python (_savings.py).
Package cost turns token usage into dollars using the versioned pricing table, and computes the cache-savings math ported from Caprock-python (_savings.py).
daemon
Package daemon wires every component into the running `caprock up` process: store, pricing, recorder, hookd, ingest, loop detector, API/WS server, the idle sweeper, and the runtime.json lifecycle.
Package daemon wires every component into the running `caprock up` process: store, pricing, recorder, hookd, ingest, loop detector, API/WS server, the idle sweeper, and the runtime.json lifecycle.
event
Package event defines the single normalized event type that every part of Caprock consumes — the UI, stats, the loop detector, the orchestrator, and any future avatar skin.
Package event defines the single normalized event type that every part of Caprock consumes — the UI, stats, the loop detector, the orchestrator, and any future avatar skin.
gitdiff
Package gitdiff produces the live diff for a session's working directory by shelling out to git.
Package gitdiff produces the live diff for a session's working directory by shelling out to git.
hive
Package hive owns the on-disk orchestration state (Phase 2): one directory per registered project workspace holding agents, tasks, approvals, mailboxes and an append-only ledger.
Package hive owns the on-disk orchestration state (Phase 2): one directory per registered project workspace holding agents, tasks, approvals, mailboxes and an append-only ledger.
hookd
Package hookd receives Claude Code hook payloads from the caprock-hook shim on POST /v1/hook, normalizes them into events, and hands them to the recorder.
Package hookd receives Claude Code hook payloads from the caprock-hook shim on POST /v1/hook, normalizes them into events, and hands them to the recorder.
hooks
Package hooks installs and removes the caprock-hook shim in Claude Code's user-level settings.json, non-destructively.
Package hooks installs and removes the caprock-hook shim in Claude Code's user-level settings.json, non-destructively.
ingest
Package ingest discovers Claude Code transcript files (~/.claude/projects/**), tails them, and turns their JSONL lines into normalized events.
Package ingest discovers Claude Code transcript files (~/.claude/projects/**), tails them, and turns their JSONL lines into normalized events.
loop
Package loop implements the loop detector: ≥ K tool.pre events with the same tool and normalized-similar input within T minutes ⇒ one alert per episode.
Package loop implements the loop detector: ≥ K tool.pre events with the same tool and normalized-similar input within T minutes ⇒ one alert per episode.
narrate
Package narrate turns tool events into the human-readable phrases the Now screen shows ("editing main.go", "running go test — 2nd attempt") and derives a session's health badge and plan progress.
Package narrate turns tool events into the human-readable phrases the Now screen shows ("editing main.go", "running go test — 2nd attempt") and derives a session's health badge and plan progress.
orchestrator
Package orchestrator manages the Phase 2 orchestrator + worker lifecycle: it spawns Claude Code sessions with the hive-aware system prompt, runs the mailbox router on a tick, and registers agents in the hive.
Package orchestrator manages the Phase 2 orchestrator + worker lifecycle: it spawns Claude Code sessions with the hive-aware system prompt, runs the mailbox router on a tick, and registers agents in the hive.
ptyman
Package ptyman owns pseudo-terminal sessions: spawn a process attached to a PTY (ConPTY on Windows), stream its bytes, write input, resize, signal, kill.
Package ptyman owns pseudo-terminal sessions: spawn a process attached to a PTY (ConPTY on Windows), stream its bytes, write input, resize, signal, kill.
rollup
Package rollup is the single write path for events: it stores the event, upserts the session, prices assistant turns, and maintains session_stats / daily_stats / session_files in one transaction, then publishes live frames.
Package rollup is the single write path for events: it stores the event, upserts the session, prices assistant turns, and maintains session_stats / daily_stats / session_files in one transaction, then publishes live frames.
shim
Package shim is the hook shim logic shared by the caprock-hook binary and the hidden `caprock hook` fallback command.
Package shim is the hook shim logic shared by the caprock-hook binary and the hidden `caprock hook` fallback command.
statusline
Package statusline is the `caprock statusline` command's logic: Claude Code invokes it (statusLine.command in settings.json) on every assistant message, piping a JSON status object on stdin.
Package statusline is the `caprock statusline` command's logic: Claude Code invokes it (statusLine.command in settings.json) on every assistant message, piping a JSON status object on stdin.
store
Package store owns the SQLite database: opening, migrating, and every query.
Package store owns the SQLite database: opening, migrating, and every query.
version
Package version exposes the build-time version string stamped via -ldflags.
Package version exposes the build-time version string stamped via -ldflags.
Package pricing embeds the versioned model pricing table.
Package pricing embeds the versioned model pricing table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL