Skip to main content
command CX Codex

metrics — Claude Code command: per-turn report

Turns the log kept by the track-metrics hook into a short report: how many turns ran, which files changed, what got committed.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/metrics.md
Open on GitHub

What metrics does

The command reads .claude/agent-metrics.jsonl, where the track-metrics hook appends one record for every agent reply. From those lines it builds an overview: total turns, turns from the past 7 days, average number of files touched per turn.

Then comes a table of the ten newest turns — UTC timestamp, file count, short commit message. A patterns section follows: which turns touched many files, how often commits appear, how many turns changed nothing at all. It works with Read, Bash and Glob.

The recording belongs to the hook, not to the command. Without track-metrics installed there is no file, and /metrics simply says nothing has been logged yet.

What it helps with

  • check how many turns were logged in the past week
  • spot turns that changed no files
  • see recent commits next to the turns behind them
  • measure the average number of files touched per turn
  • catch stretches where one turn rewrites a lot

Example prompts for the agent

  • Run /metrics and tell me how many turns landed in the last week.
  • Use /metrics to list the ten newest turns with their commits.
  • Run /metrics and flag the turns that changed nothing.

How to install metrics

Manually: put the files in place

.claude/commands/metrics.md

Call it with /metrics. For all projects use ~/.claude/commands/

Questions about metrics

How do I install metrics in Claude Code?

Copy the command file to .claude/commands/metrics.md inside your project. Call it afterwards as /metrics.

What does the metrics command do?

It parses .claude/agent-metrics.jsonl, filled by the track-metrics hook, and prints an overview, a table of the ten latest turns and any patterns it notices.

Why does /metrics say nothing has been recorded?

Records come only from the track-metrics hook. Skip it and .claude/agent-metrics.jsonl never exists, so the command has nothing to read.

Source text

metrics.md · MIT
---
allowed-tools: Read, Bash, Glob
description: "Summarise the per-turn records written by the track-metrics hook: activity over time, files changed, and latest commits."
---

## Context

- Metrics file: !`cat .claude/agent-metrics.jsonl 2>/dev/null || echo "NO_METRICS_FILE"`

## Task

Analyze the recorded metrics and present a summary.

**If the metrics file does not exist or the context above shows "NO_METRICS_FILE":**
Print exactly: "No metrics recorded yet. Metrics are automatically collected after each turn."

**If metrics data exists**, parse each JSON line and present:

1. **Overview**
   - Total turns logged (the hook writes one record each time Claude finishes responding)
   - Turns in the last 7 days (compare timestamps to now)
   - Average files changed per turn

2. **Recent Turns** (last 10)
   Format as a markdown table:

   | #   | Timestamp (UTC) | Files Changed | Commit |
   | --- | --------------- | ------------- | ------ |
   - Show the most recent 10 turns, newest first
   - For "Commit", show the short commit message or "—" if none

3. **Patterns**
   - Note any trends (e.g., turns with many file changes, frequency of commits)
   - If there are turns with 0 files changed, note how many were "no-op" turns

Keep the output concise and well-formatted.

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set46

The whole set →
quick-fix quick-fix — a command that fixes lint errors, type errors, and simple bugs. Finds the issue, applies a minimal fix, and verifies the result. CX Codex +1 ★ 1,424repo stars sync-branch sync-branch fetches origin, then rebases or merges the default branch into your current one, stashing uncommitted work first. Useful right before a push or a pull request. CX Codex +1 ★ 1,424repo stars lint-fix lint-fix detects repository linters, runs formatting and auto-fixes, then reports unresolved issues. CX Codex +1 ★ 1,424repo stars add-tests The add-tests command adds tests for a chosen file or function, or targets recently changed code when no argument is given. It runs the tests afterward. CX Codex +1 ★ 1,424repo stars commit-push-pr commit-push-pr prepares a conventional commit from staged diffs, pushes the branch, and opens a GitHub pull request. Prevents accidental commits to the default branch. CX Codex +1 ★ 1,424repo stars summarize-changes summarize-changes reads Git history and changed files to prepare standup notes, reports, or a PR description. Use it when a recent change summary needs a clear structure. CX Codex +1 ★ 1,424repo stars rapid rapid puts Claude into a speed-first development mode: code right away, planning and docs kept short. Built for prototypes and MVPs. CX Codex +1 ★ 1,424repo stars architect Switches Claude Code into a software architect mode to plan architectures, evaluate trade-offs, and draft ADRs before coding. CX Codex +1 ★ 1,424repo stars

Project sponsors

Companies that keep this analytics open