Claude Code
First-class integration with Claude Code via hooks.
Claude Code Integration
Claude Code is a first-class citizen in Dashcam. The integration uses Claude Code's native hooks system — SessionStart, PreToolUse, PostToolUse, Stop, and subagent hooks — to capture every meaningful event without touching Claude Code's internals or slowing it down by a single millisecond.
How It Works
Claude Code supports custom hooks that fire shell commands at specific lifecycle points. Dashcam installs lightweight curl commands into these hooks that POST event data to the daemon's HTTP endpoints. Each hook is fire-and-forget: the command uses --max-time 1 to timeout after one second and || true to never fail, regardless of whether the daemon is running.
Claude Code Dashcam Daemon
│ │
├── SessionStart ──curl POST──────▶ /hook/session-start
│ │ 202 Accepted
├── PreToolUse ────curl POST──────▶ /hook/pre-tool-use
│ │ 202 Accepted
├── PostToolUse ───curl POST──────▶ /hook/post-tool-use
│ │ 202 Accepted
│ ├── trigger screenshot?
│ ├── update session stats
│ └── broadcast via WebSocket
├── Stop ──────────curl POST──────▶ /hook/stop
│ │ 202 AcceptedThe daemon responds with 202 Accepted immediately and processes the event asynchronously. Claude Code never waits.
Hook Events
SessionStart
Fires when a new Claude Code session begins. Dashcam uses this to create a session record, associate it with the current window, and activate live tracking.
Data captured:
- Session ID
- Project path (working directory)
- Model in use (Opus, Sonnet, Haiku)
- Timestamp
PreToolUse
Fires before Claude Code executes a tool (Write, Edit, Bash, etc.). Dashcam records the intent — what the agent is about to do — which is valuable for understanding the reasoning chain even when a tool fails.
Data captured:
- Session ID
- Tool name
- Tool input (file path, content, command)
- Timestamp
PostToolUse
Fires after a tool execution completes. This is the richest event — it contains the outcome, duration, and success status. PostToolUse on Write or Edit tools triggers screenshot evaluation.
Data captured:
- Session ID
- Tool name
- Tool output (result, stdout/stderr)
- Duration in milliseconds
- Success/failure status
- Timestamp
Stop
Fires when the session ends, whether by user request, task completion, or error. Dashcam captures the stop reason and a session summary, then marks the session as completed.
Data captured:
- Session ID
- Stop reason
- Session summary
- Timestamp
Installed Hook Commands
When you run dashcam init, the following hooks are merged into your ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"type": "command",
"command": "curl -sf -X POST http://localhost:57580/hook/session-start -H 'Content-Type: application/json' -d '$ARGUMENTS' --max-time 1 2>/dev/null || true"
}
],
"PreToolUse": [
{
"type": "command",
"command": "curl -sf -X POST http://localhost:57580/hook/pre-tool-use -H 'Content-Type: application/json' -d '$ARGUMENTS' --max-time 1 2>/dev/null || true"
}
],
"PostToolUse": [
{
"type": "command",
"command": "curl -sf -X POST http://localhost:57580/hook/post-tool-use -H 'Content-Type: application/json' -d '$ARGUMENTS' --max-time 1 2>/dev/null || true"
}
],
"Stop": [
{
"type": "command",
"command": "curl -sf -X POST http://localhost:57580/hook/stop -H 'Content-Type: application/json' -d '$ARGUMENTS' --max-time 1 2>/dev/null || true"
}
]
}
}dashcam init merges hooks into your existing settings — it never overwrites other hooks you may have configured. dashcam uninstall removes only the Dashcam hooks.
Subagent Tracking
When Claude Code spawns subagents (task-specific child agents), Dashcam tracks them via the SubagentStart and SubagentStop hooks. Each subagent gets its own swim lane in the timeline, so you can see parallel work happening within a single session.
Data captured on SubagentStart:
- Parent session ID
- Subagent ID
- Agent type
- Timestamp
Data captured on SubagentStop:
- Session ID
- Subagent ID
- Timestamp
Subagent swim lanes appear nested under the parent session's lane, visually communicating the hierarchical relationship.
Worktree Awareness
When Claude Code creates git worktrees (common in multi-agent setups), Dashcam detects these via worktree-create and worktree-remove hook events. Each worktree is associated with its branch name and path, allowing the Code panel to show diffs from the correct working tree.
Zero Performance Impact
Every hook command is designed for zero interference with Claude Code:
--max-time 1— The curl command times out after 1 second, even if the daemon is slow or unresponsive2>/dev/null— stderr is silenced so error messages never appear in the Claude Code terminal|| true— The command always exits with code 0, so Claude Code never sees a hook failure- Fire-and-forget — The daemon responds with
202 Acceptedbefore processing, so the HTTP round-trip is measured in single-digit milliseconds on localhost
If the Dashcam daemon is not running, every hook silently no-ops. Claude Code does not know and does not care. Start the daemon whenever you want visibility; stop it whenever you do not.