Skip to documentation
Documentation
Documentation
OverviewInstallationQuickstartConfigurationTroubleshootingFAQ

Usage

Terminal interfaceCLIDashboardAnalytics

Collaborate

ArtifactsSession sharingSession links and Full contactAsks privacy fact sheetFeedbackBlueprintsAgent identitiesMCP server

Configure

AgentsSkillsRulesCommandsInheritancePlaybooksExperimentsHooksCapture modesTeam

Workspaces

WorkspacesSet up a workspaceFix a ticket end to endShip a feature with approvalHand off work and set agent settings

API Reference

API OverviewAuthenticationSessions APIResources APIOrganizations APIProjects APIPlaybooks APIExperiments API
Need a hand?Find an answer in troubleshooting.
Loading docs…
CREWKIT / DOCUMENTATION

Hooks

Real-time event interception from Claude Code sessions.

The hook system intercepts events from Claude Code in real time. crewkit uses hooks to collect telemetry, track subagent tasks, and enforce conventions.


How hooks work

  1. crewkit generates a hook settings JSON file when starting a session
  2. Claude Code is launched with these settings, which register crewkit as a hook handler
  3. When events occur, Claude Code invokes crewkit's hook handler with the event data
  4. Events are forwarded to the main crewkit process for processing and API delivery

Events are batched and sent to the crewkit API for storage and analysis.


Event types

crewkit handles 12 event types — 10 standard Claude Code hooks plus 2 custom crewkit hooks.

Standard hooks

EventWhen it firesWhat crewkit does
SessionStartSession beginsInitialize telemetry
SessionEndSession endsFinalize metrics, trigger analysis
UserPromptSubmitUser submits a promptTrack turn count, convention checking
PreToolUseBefore a tool runsCan modify or deny tool execution
PostToolUseAfter a tool succeedsTrack tool usage patterns
PermissionRequestPermission dialog shownTrack permission patterns
StopMain agent finishesCapture completion state
SubagentStopSubagent finishesExtract subagent stats from JSONL
PreCompactBefore context compactionTrack compaction events
NotificationSystem notificationTrack notifications

Custom crewkit hooks

EventWhen it firesWhat crewkit does
SubagentStartTask tool spawns a subagentTrack subagent creation
SubagentStopSubagent completesExtract stats: tokens, cost, duration, model

Subagent stats

When a subagent (Task) completes, crewkit extracts stats from its JSONL transcript:

  • Agent type — Which agent was used
  • Duration — How long the task ran
  • Tokens — Input, output, cache read, cache creation
  • Model — Which Claude model was used
  • Turns — Assistant and user turns
  • Tool usage — Tool uses and results count

This data powers the per-agent analytics in the dashboard.


Event sanitization

Events are sanitized on your machine before being sent to the API, and again by the API before they are stored. How much each event keeps depends on your organization's capture mode: minimal, structured (the default) or full. Capture modes lists what each mode sends, stores and analyses.


Convention handlers

Hooks can detect convention violations in real time. When a tool use violates a playbook convention (e.g., using RSpec when the convention says MiniTest), the hook system logs a challenge.

Convention handler dispatch is being rolled out progressively.


Next steps

  • Playbooks
  • Analytics
  • Configuration

Related

What the hook stream turns into for a Claude Code team is described on the Claude Code integration page.

Experiments

A/B test agent configurations to find what works best.

Capture modes

What crewkit collects in each capture mode — what leaves the developer's machine, what is stored, and what feeds analysis.

On this page

How hooks workEvent typesStandard hooksCustom crewkit hooksSubagent statsEvent sanitizationConvention handlersNext steps