Skip to main content
hook CX Codex

ccam-analytics — Claude Code hook: session completion telemetry

ccam-analytics is a Claude Code hook that streams session events to Agent Monitor for telemetry tracking. It triggers whenever a main session or subagent stops.

MIT ★ 1,198 updated 2026-10-23

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-analytics@claude-code-agent-monitor-plugins
Open on GitHub

What ccam-analytics does

The hook captures execution completion events and forwards runtime metrics to Agent Monitor. Triggers fire on Stop and SubagentStop, packaging the session ID, subagent ID, stop reason, and timestamp.

Each action executes a shell pipeline that shapes the JSON payload via jq and posts it with curl to http://localhost:4820/api/hooks/event. It relies on local curl and jq binaries alongside an active Agent Monitor instance listening on port 4820.

What it helps with

  • track session completions automatically
  • forward subagent termination events to Agent Monitor
  • record timestamps and stop reasons for agent tasks

Example prompts for the agent

  • Finish the current task and generate a summary
  • Launch a subagent to inspect unit tests
  • Stop execution and close the session

How to install ccam-analytics

1Plugin marketplace

/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-analytics@claude-code-agent-monitor-plugins

2Manually: put the files in place

.claude/settings.json

The hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json

Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command

Questions about ccam-analytics

How to install ccam-analytics in Claude Code?

Run /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor followed by /plugin install ccam-analytics@claude-code-agent-monitor-plugins.

What does ccam-analytics do?

It listens for Stop and SubagentStop triggers, converts session metadata into JSON, and dispatches it to a local Agent Monitor endpoint.

What is required to run ccam-analytics?

It requires jq and curl installed in the system environment, as well as an active Agent Monitor service at http://localhost:4820.

Source text

hooks.json · MIT
Hooks bundle shipped with the ccam-analytics plugin for Claude Code.

Deep analytics and monitoring for Claude Code sessions — cost tracking, token usage breakdowns, usage trends, and productivity scoring powered by Agent Monitor.

Triggers on: Stop, SubagentStop.

```json
{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '{session_id: .session_id, stop_reason: .stop_reason, timestamp: now | todate}' | curl -s -X POST http://localhost:4820/api/hooks/event -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 || true"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '{session_id: .session_id, agent_id: .agent_id, stop_reason: .stop_reason, timestamp: now | todate}' | curl -s -X POST http://localhost:4820/api/hooks/event -H 'Content-Type: application/json' -d @- > /dev/null 2>&1 || true"
          }
        ]
      }
    ]
  }
}

```

© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor

Similar hooks

All hooks for Agent setup: memory, context, orchestration →

From the same set155

The whole set →
ccam-productivity ccam-productivity — a hook that writes session start and end timestamps from Claude Code into a log file. Handy when you want to measure how long you actually work on tasks. CX Codex ★ 1,198repo stars ccam-cost-guard ccam-cost-guard tracks Claude Code spending and posts session stop events directly to the local Agent Monitor dashboard. CX Codex ★ 1,198repo stars docs-markdown docs-markdown — a markdown documentation rule: command samples must run, project paths start at the root, and architecture notes have to match what the code does. CX Codex +1 ★ 1,198repo stars integration-operator integration-operator is a Claude Code subagent that manages CCAM alerts, webhooks, push notifications, and SSH sources. It confirms changes first and hides secrets. CX Codex ★ 1,198repo stars backend-reviewer The backend-reviewer subagent reviews backend routes and hooks for regressions, data integrity risks, and missing tests. It works with Claude Code and Codex. CX Codex ★ 1,198repo stars frontend-react frontend-react — a React frontend rule for Claude and Claude that keeps UI edits small: explicit prop types, existing state patterns, routes left alone. CX Codex +1 ★ 1,198repo stars platform-admin platform-admin manages settings, hooks, data imports, backups, and MCP for Claude Code Agent Monitor. Confirms writes before updating. CX Codex ★ 1,198repo stars frontend-reviewer The frontend-reviewer subagent reviews React UI changes for behavior regressions, state mismatches, and broken user flows. Use it after frontend edits. CX Codex ★ 1,198repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open