Setup
Prerequisites
- Rust 1.70+ (
rustup default stable-msvcon Windows;rustup default stableon macOS). - Node.js 24, as
.nvmrcandengines.nodeboth say. The range is enforced rather than advised —.npmrcsetsengine-strict=true, sonpm installon another major exitsEBADENGINEinstead of warning and carrying on. - npm is pinned by
packageManagerinpackage.json. Runcorepack enable npmand npm shims itself to that exact version; plaincorepack enablecovers yarn and pnpm only, so without the explicit form the pin is silently ignored. Run it again after every Node upgrade — the upgrade replaces the Node install and takes the shim with it, after whichnpm -vquietly answers with the bundled npm whilepackage.jsonstill reads correctly. Comparingnpm -vagainst the field is the only check that sees it. - Platform toolchain:
- Windows: Microsoft C++ Build Tools (Visual Studio Installer → “Desktop development with C++”) and WebView2 (preinstalled on Windows 10 1803+; the installer fetches it if missing on older machines).
- macOS: Xcode Command Line Tools (
xcode-select --install). WKWebView ships with the OS — nothing to install.
Install
git clone git@github.com:AnotherSava/claude-code-dashboard.git
cd claude-code-dashboard
npm install
Run from source
npm run tauri dev
Compiles the Rust backend, starts Vite, and launches the native window. Frontend edits hot-reload; Rust edits trigger a rebuild on save.
The dev server’s port is not written into the repo. Instead scripts/dev.mjs settles it at launch and hands the same number to Vite and to the Tauri CLI, so the server and the webview cannot disagree about the address. It prints which of three sources answered:
PORTfrom the environment, if you set one. This outranks the other two.- A ports registry outside the checkout, where the maintainer’s machine has one installed.
- The OS, which names a free port. This is what a fresh clone gets, and it means
npm run tauri devworks with nothing else set up. The number changes every run, and because it is claimed about a second after it is picked, something else can take it in between — Vite then stops withPort <n> is already in useinstead of moving elsewhere, so re-run and a different number is chosen.
A registry that is installed but unreadable stops the run instead of falling back, since a port nothing allocated would collide with whatever that registry has recorded.
To fix the number yourself:
PORT=1420 npm run tauri dev # bash / zsh
$env:PORT="1420"; npm run tauri dev # PowerShell
set PORT=1420 # cmd.exe, then: npm run tauri dev
The devUrl committed in src-tauri/tauri.conf.json is replaced on every dev run through --config and is not the port — it is only read by something that bypasses npm run tauri.
Running npm run dev on its own starts Vite with no port settled, so it refuses rather than binding Vite’s own default at an address nothing else was told. It is the beforeDevCommand the Tauri CLI invokes, not an entry point of its own.
Commands
npm run tauri dev— dev build with HMR.npm run tauri build— release build; bundles land insrc-tauri/target/release/bundle/(nsis/on Windows,dmg/on macOS).npm run check— TypeScript + Svelte check (no build).npm run tauri icon <path/to/1024.png>— regenerate the Windows / macOS icon set from a source PNG.cargo test --manifest-path src-tauri/Cargo.toml --lib— Rust unit tests (state machine, transcript parser, merge policy, Claude adapter, label policy).RUSTFLAGS="-D warnings" cargo check --manifest-path src-tauri/Cargo.toml --all-targets— compile every target, in both configurations, with warnings as errors. The test run above sees only the test cfg, and--lib --testsnever performs the bin’s plain build, so this is the only command that catches an item insrc/main.rsthat is live undercfg(test)and dead without it.bash .claude/commit-checks.sh— everything CI will run, in CI’s order, in under half a minute on a warm cargo cache, plus the checks that read files under~/.claude/and so cannot run on a runner at all: the conventions checker, and an assertion that the shared scripts the screenshot capture shells out to still resolve — by path, and on Windows also by the function and parameter names the captures call. Without a~/.claudetree those checks print NOT COVERED instead of failing, so the gate runs in a clone that has no dotfiles. It ends with a notice rather than a check: the wire-shape arm exits 0 whatever it finds, and warns when the change set adds a serialized field tohttp_server.rsorsync.rs, becausepeer_relay.py, the capture scripts and the other machine’s dashboard go on reading the old shape until this machine deploys. Run it before committing.
The dev profile carries line tables rather than full DWARF ([profile.dev] in src-tauri/Cargo.toml, with dependencies at debug = 0), and that profile is what cargo check, cargo test --lib and rust-analyzer all build. A backtrace still names its files and lines; what goes is variable and type inspection in a debugger, which nothing here depends on. Full DWARF was 82.8% of the bytes of every object file in the graph and had taken target/debug to 38 GB.
Architecture
The app pairs a Rust backend (Tauri v2) with a Svelte 5 + Vite frontend rendered in the system webview (WebView2 on Windows, WKWebView on macOS). The Rust side owns all state and external I/O; the frontend is a pure view that subscribes to Tauri events and issues invoke-style commands for window control. External tools integrate via an embedded axum HTTP server on 127.0.0.1:9077, bypassing the frontend entirely.
The source-of-truth AgentSession state lives behind a Mutex in Rust. Hook events reach it through state::apply_set, which enforces the sticky-label rules, the working-time accumulator and the task boundary in one place whatever the origin. The other writers each own one narrow transition and never choose a label: the transcript watcher’s promotion to working and its Esc-cancel revert, the WAIT backstop, the liveness reaper’s member drop and row removal, the hand-over that settles a row to done when its main session leaves, a restart’s restore, and a subagent’s permission prompt. Sessions running on another device arrive pre-enriched over sync and live in a separate map; commands::resolved_snapshot is the one place the two sets combine.
Project structure
Under the repo root claude-code-dashboard/:
src/— Svelte frontend (Vite)App.svelte— top-level layout, subscribes to Tauri eventsHistoryApp.svelte— root component of the history windowAboutApp.svelte— root component of the About window (Help → About)IntensityApp.svelte— root component of the Work intensity windowmain.ts— mount entry pointlib/types.ts— shared TS types and display helpersapi.ts— invoke / listen wrapperscomponents/SessionList.svelte— list container, empty-stateSessionItem.svelte— per-row rendering (status badge, timer, tokens, label)SetupPanel.svelte— onboarding panel: bundled hook snippet, copy-to-clipboard, hide affordanceLimitBar.svelte— header 5h / 7d usage bar (segmented fill, percent + timer caps)
src-tauri/Cargo.toml— Rust deps: tauri, axum, notify, tracing, serde, reqwest, chrono, opentauri.conf.json— NSIS + DMG bundle targets, WebView2 bootstrapper, window configcapabilities/default.json— capability-based permissions for the main windowsrc/main.rs— entry; calls lib::run()lib.rs— Builder: plugins, state, commands, setup hookstate.rs— AgentSession struct, apply_set sticky-label machineconfig.rs— Config struct, load/save, ConfigState wrapperconfig_watcher.rs— notify watcher for config.json hot-reloadcommands.rs— Tauri commands + event emitterssetup.rs— embedded Python hook + settings.json snippet builder for onboardinghttp_server.rs— the loopback axum server:/api/event,/api/agents,/api/message,/api/window,/api/session-clean,/api/project/rename,/api/session/open,/api/session/command,/api/session/tabs,/api/dev-serversync.rs— multi-device session sync: source- and token-gated listener, metadata push, receiver-driven pullstailnet.rs— asking Tailscale which machine a connection came from, instead of trusting its envelope, and removing the tailnet front of a dev server that has stoppedsubprocess.rs— running a helper program to a deadline, with no console window on Windowspeer_message.rs— relaying one message to an agent on another machine, and the honesty rules around itsession_launcher.rs— starting a terminal session for a project that has none, for a relayed message or for the local picker (integrations/pick-local-session.py, throughPOST /api/session/open); it names no terminal, asking the platform’sterminals::TerminalAdapterto launch the session (agterm’s adapter on macOS, its workspace placement included), so a launcher for another terminal is that terminal’s adapter implementinglaunchsession_command.rs— which local sessionPOST /api/session/commandtypes an allowlisted built-in command (/clear,/exit) into, found by the same title join the idle close uses, and every refusal before the terminal is touched; the typing is the adapter’stype_commanddev_servers.rs— announced dev servers, checked until they stop answering, when their tailnet front is removed, and shown on the agterm session they were started from, or on the other machine’s⇄tab for their row through the sync push, indev_servers.jsonworkspace_memory.rs— the agterm window and workspace each project’s agent was last seen in, so a started session opens there, inagterm_workspaces.jsonsession_restore.rs— giving a live session its row back after a restartalive_stamp.rs— the previous run’s last heartbeat, which tellssession_restorea session started while the dashboard was downproject_rename.rs— carrying a project’s history, anchors and name over to the id its renamed folder derives, and announcing the rename to peerslog_watcher.rs— per-session transcript tailing + infer_state + assistant text upsertmembership.rs— which live sessions belong to a row and which one (its main) drives itliveness.rs— process-liveness primitives, and the process table with each process’s parentliveness_reaper.rs— drops row members whose Claude process exited without aSessionEnd, and removes a row once its last member is gone; its process table also records each agent’s descendants forsession_leftovers.rssession_leftovers.rs— stops what a session left running once its row’s last member is gone: the dev servers announced for the row with their tailnet fronts, and each agent’s descendants as the reaper’s last process table showed themwaiting_settle.rs— settles awaitingrow todoneonce its killed background task can no longer reportidle_close.rs— closes a session, and the terminal tab it runs in where one on this machine shows it, once it has sat clean pastidle_close_mssubagent_gate.rs— the subagent permission-prompt overlay, and finding the gated call’s result that releases itprompt_origin.rs— what a row shows for a task another agent begannonce_store.rs— per-session marker nonces for the instruction-adherence canarytray.rs— TrayIconBuilder, menu handlers, autostarttray_badge.rs— the usage badge drawn onto the tray icon, and the context-usage alert over itnotifications.rs— 1s-tick reconciler + Notifier traittelegram.rs— reqwest-based Telegram Bot API clientidle.rs— system-wide input-idle milliseconds, for the AFK half of the notification rulesidle_awake.rs— holds off idle sleep while a local agent is working (macOS)lid_awake.rs— holds off sleep with the lid closed, for a bounded window (macOS)usage_limits.rs— Anthropic OAuth usage poller + refresh (5h / 7d buckets)usage_cache.rs— the last good reading and the endpoint’s retry deadline, inusage_cache.jsonusage_history.rs— appends each successful usage poll tousage_history.jsonltoken_history.rs— one record per Claude API response intoken_history.jsonl, and the Work intensity chart built from themtoken_scan.rs— 60s scan of Claude Code’s own transcripts, which is what fills that fileremote_tokens.rs— per-device remote token records underremote_tokens/remote_usage.rs— per-device remote usage samples underremote_usage/prompt_history.rs— per-session dialog persistence toprompt_history.jsonremote_history.rs— per-device remote-session dialog persistence underremote_history/json_store.rs— loading and atomically saving the JSON files every store keeps in the app data directory,config.jsonexceptedchat_id_registry.rs— persistedsession_id → chat_idlock insession_chat_ids.jsoncustom_names.rs— user-assigned display names persisted tocustom_names.jsonterminal_title.rs— mirrors session status onto terminal tab titlessession_registry.rs— finds a row’s terminal in Claude Code’s live session list, by cwdattention.rs— which finished sessions you have actually looked at, and the stamp that dims themagterm.rs— transport for agterm’sagtermctlcontrol socket (macOS)terminals/— one adapter per terminal behind theTerminalAdapterseam, so nothing downstream names a terminalmod.rs— the trait, the shared vocabulary, and the pure verdicts over it (person_verdict,departure_stamp,read_front)agterm.rs/agterm_facts.rs— agterm’s adapter, which also starts sessions and types/clearand/exitinto them, and the facts it reads from agterm and the system (macOS)agterm_wire.rs— agterm’ssession contextprotocol (the argv a write takes, the targets its tree reports, and the release that first served the verb), thesession infoline naming a session’s dev servers, itssession closeargv withclose_refusal, the rule that refuses a close, thesession textandsession typeargv a typed command takes withcomposer_text,typing_refusalandagent_gone, andplacement, which picks the workspace a started session opens in (macOS)agwinterm.rs/agwinterm_state.rs/agwinterm_wire.rs— agwinterm’s control pipe, its per-window state files, and its protocol, includingtyping_pane, the rules that refuse any typed command,close_pane, which adds the ones that refuse a close, andcomposer_text(Windows)tmux.rs/tmux_wire.rs— the WSL tmux server holding remote sessions, an adapter that closes and starts them: it offersidle_closethe sessions no terminal on this machine is showing and types/exitinto one, or a commandPOST /api/session/commandasks for, and starts a detached session through the claude repo’scc-session.shwhereremote_session_scriptis set (Windows)composer.rs— where Claude Code’s composer sits on a screen of text, and the allowlistedCommand(/clear,/exit) typed into it bytype_command, shared by every close and byPOST /api/session/command, and the wait for the agent to leave after/exitthat comes before a tab is closedwindows.rs/wt_tabs.rs— Windows Terminal and the Windows console, and the UI Automation read of what a tab really holdscomposite.rs— presents several terminals on one platform as one adapterlabels.rs— writes each row’s task into a terminal’s own per-session context linestale_check.rs— catches a tab that has stopped following its sessionsnapshot_watch.rs/window_files.rs— the directory watch and per-window bookkeeping two adapters share
auto_resize.rs— Up/Down content-fit window + vertical resize lock (Win32 hit-test subclass / macOS height pin) + dark class brushlabel_policy.rs— shared (label, original_prompt) decision used by adaptersadapters.rs— adapter dispatch for /api/event payloadsadapters/claude.rs— Claude Code lifecycle classifier + chat-id derivationlogging.rs— tracing subscriber → widget.jsonl + FrontendLogger for IPC log lines
scripts/dev.mjs— frontsnpm run tauri; settles the dev server’s port and hands it to both Vite and the Tauri CLIintegrations/claude_hook.py— thin Claude Code hook that forwards the stdin payload to /api/eventintegrations/pick-local-session.py— agterm-chord picker that opens a local project’s session throughPOST /api/session/open, or raises its existing tabintegrations/open-dev-server.py— agterm-chord helper that opens the newest dev server the session shows as an overlay throughGET /api/dev-server, atlocalhostor at the other machine’s published tailnet address, or hides and shows the session’s page overlaydocs/— this site.github/workflows/build.yml— CI: check +cargo check --all-targetswith warnings denied + cargo test + frontend build on push/PR (Windows + macOS matrix)release.yml— CI: build NSIS + DMG installers on tag push (Windows + macOS matrix)notify-tap.yml— CI: on a published release, tells theAnotherSava/homebrew-taprepo to bump its cask to the new version
Where state lives at runtime
- In-memory —
AppState(local and remote sessions) andConfigState(config) viatauri::State, alongside the other managed stores the frontend and the HTTP routes read. - On disk —
config.json,widget.jsonl,prompt_history.json,session_chat_ids.json,custom_names.json,agterm_workspaces.json,alive_stamp.json,project_renames.json,dev_servers.json,usage_history.jsonl,usage_cache.json,token_history.jsonl,token_scan_cursor.json, and theremote_history/,remote_usage/andremote_tokens/directories underapp_data_dir():- Windows:
%APPDATA%\com.anothersava.claude-code-dashboard\ - macOS:
~/Library/Application Support/com.anothersava.claude-code-dashboard/
- Windows:
Architecture reference
- Classification — how the Claude adapter turns a raw lifecycle payload into the
(chat_id, status, label)tuple the widget renders. - Sticky labels — the state machine that keeps a meaningful caption next to a session row across approval cycles, cancellations, and continuation prompts.
- Data flow — end-to-end paths from a Python hook POST or a transcript file change to a rendered pixel.
- HTTP API —
POST /api/eventenvelope shape, how to write a new adapter for a non-Claude agent, and the read-onlyGET /api/agentsroster of every tracked session across devices.
Testing
Rust tests live inline in #[cfg(test)] modules next to the code they cover — most modules carry one. The ones worth knowing where to look for:
state::tests— sticky-label machine, working-time accumulator, error transitions, the subagent-prompt overlay.label_policy::tests— the(label, original_prompt)decision extracted fromapply_set.log_watcher::tests— the transcript parser (infer_state,split_complete), the promote-to-working-only merge policy, and the[Request interrupted by user]cancel marker.sync::tests— the receive-sideingest(namespacing, dialog seeding, the attended verdict), the pulled-dialog merge, and the source/token guard that fronts every sync route.adapters::claude::tests—classify/classify_stop,derive_chat_id,clean_prompt,is_a_question/question_reason/evidence_snippet, and the outerdispatch.terminals::*::tests— the verdicts over the adapter seam’s vocabulary, which are pure and so are tested once for every terminal rather than per platform.
CI runs Rust tests on every push and PR (build.yml) and again before bundling on every tag push (release.yml), so a broken state machine can’t ship a release.