caprock

module
v0.3.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

Mission control for Claude Code. A local, open-source daemon + dashboard that shows what every claude session on your machine is really doing and costing — live activity, plan progress, diffs, token burn, cost, loop alerts — and, in later phases, lets you spawn, control, and orchestrate sessions with verification before anything is called "done".

docs license

Status: all three phases shipped (2026-08-19). v0.1.0 (Observe), v0.2.0 (Control), and v0.3.0 (Orchestrate) are tagged and published on the macOS/Linux/Windows CI matrix — a live dashboard, spawn/control of claude sessions from the UI, a tasks board on disk, mailboxes, the Stop-loop autonomy engine, an orchestrator agent that spawns and coordinates workers, verification-before-done, and approvals. The Phase 2 tag gate passed: a real orchestrator drove a task to green verification unattended, with hooks. Progress is tracked honestly in .ai/14-build-status.md.


Why

  • Dead-air waiting. You give Claude a task and stare at a scrolling terminal. There is nothing useful to watch.
  • Token anxiety. One looping session can drain a daily budget in minutes, and per-task cost is invisible until it's too late.
  • Trust gap. How does an orchestrator know a worker is actually done? Nobody leaves agents unattended without verification.
  • Platform gap. The incumbent (an Electron + node-pty app) breaks on Windows and only sees agents it spawned.

Caprock answers each of these with a single static Go binary — macOS / Linux / Windows from day one — that works in observe-only mode on sessions you start yourself, before it ever asks you to change your workflow. Full reasoning: .ai/01-product.md.

What it does

caprock up            # starts the loopback daemon, installs the hook shim (with consent), opens localhost:4173
claude                # in any terminal, any project — Caprock sees it
caprock status        # daemon, hooks, ingest, pricing table in force
caprock down          # stops the daemon; keeps every byte of your data

Build from source (Go 1.26, Node 22): make ui && make build → ./bin/caprock, ./bin/caprock-hook.

Screen Shows Phase
Now Per-session narration, plan progress, live burn, health, loop banner 0
Session Detail Event timeline, live git diff (Phase 0); live terminal (Phase 1) 0 → 1
Cost & Burn $/hr now, today totals, model mix, cache hit-rate, per-project 0
History Lifetime stats: cost per project/day/model, tool distribution 1
Tasks Kanban over tasks/*.md; Stop-loop autonomy; approvals queue 2

Local-first: loopback only, no servers, no telemetry, all data in SQLite on your disk. Free for solo use, permanently.

Progress

Coarse on purpose. Same numbers as .ai/14-build-status.md.

Track Progress
Documentation (.ai/) █████████░ 90%
Phase 0 — Observe (T0–T10) ██████████ 100%
Phase 1 — Control (T11–T16) ██████████ 100%
Phase 2 — Orchestrate (T17–T25) ██████████ 100%

Repository

.ai/           source of truth for humans and agents — read 00-index.md first
cmd/ internal/ Go daemon, CLI, hook shim              (Phase 0+)
ui/            React + Vite dashboard, embedded via go:embed
pricing/       versioned model pricing table
testdata/      transcript fixtures, hook payloads, fake claude
scripts/       docs tooling (table aligner, link checker)
docs/          human-facing docs, spec-migration audit

Developing with an AI agent? Start at CLAUDE.md. Toolchain, CI, and release mechanics: .ai/10-infrastructure.md.

Install

Homebrew (macOS / Linux):

brew install --cask dspv/tap/caprock
caprock up                             # http://127.0.0.1:4173

Or grab caprock + caprock-hook for your OS/arch from GitHub Releases. Or build from source (Go 1.26, Node 22):

git clone git@github.com:dspv/caprock.git && cd caprock
make ui && make build      # → ./bin/caprock, ./bin/caprock-hook
./bin/caprock up           # http://127.0.0.1:4173

Cross-platform binaries (darwin/linux/windows × amd64/arm64, plus a macOS universal binary) and the Homebrew cask are produced by goreleaser on a v* tag — see .goreleaser.yaml. Full change log: CHANGELOG.md.

Contributing

Issues and PRs welcome. Rules that apply to every change are in .ai/06-engineering-rules.md: English everywhere, Conventional Commits, one task per PR with its acceptance criteria as a checklist, and no task is done with a red Windows CI job. Run make check before pushing.

Heritage

Caprock started as a free Python stats utility for Claude Code (pip install caprock, still on PyPI, now frozen). This repo is its successor — same name, same honesty about numbers, new Go core. See .ai/01-product.md § Relationship to Caprock-python.

License

Apache-2.0 — see LICENSE.

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.
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