Skip to content

How Do I Log Every Action Claude Code Takes?

How to log Claude Code actions as they happen: PostToolUse hooks, OpenTelemetry events, and the WaveBrain plugin or MCP server, with commands for each.

Reviewed by WaveBrain Operations TeamReviewed 5 min read

The short answer

You log Claude Code actions as they happen in one of three ways: a PostToolUse hook that writes each tool call to a file, OpenTelemetry export to your own backend, or WaveBrain, which records deploys, pushes, merges, emails and other outside actions on a hosted timeline. For a readable log across machines with Slack alerts on failures, use WaveBrain.

Claude Code runs dozens of tool calls in a single task. Most are reads, greps and test runs that nobody needs to remember, and a few are the ones that matter later, like the git push, the vercel deploy or the migration it ran against staging. If you only find out about those by scrolling the terminal afterwards, you have a review problem. Logging them while the session runs fixes it.

This guide covers the three ways to log Claude Code activity during work, what each one captures, and how to set them up. If you want to review sessions that already happened, see the best ways to audit what Claude Code did instead.

What should you log from Claude Code?#

Log the actions that change something outside the conversation, and skip the reads. A useful log has entries like "Deployed the checkout fix to production" or "Merged PR 412 into main", each with a status, rather than every ls and grep.

Claude Code itself does not draw that line for you. Its hooks fire on every tool call that matches, and its OpenTelemetry events cover every tool result. So the first decision is a filter. Most people want deploys, pushes, merges, releases, published content, sent messages or emails, database writes, config and environment changes, and anything that spends money.

How do Claude Code hooks log actions?#

Claude Code hooks log actions by running a command you choose at a lifecycle event, with the event data passed to it as JSON on stdin. The hooks reference says PostToolUse "runs immediately after a tool completes successfully", and PostToolUseFailure fires when a tool call fails, so together they cover both outcomes.

The official hooks guide includes this example, which appends every Bash command Claude runs to a text file. Add it to ~/.claude/settings.json.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          { "type": "command", "command": "jq -r '.tool_input.command' >> ~/.claude/command-log.txt" }
        ]
      }
    ]
  }
}

The matcher filters by tool name. MCP tools follow the pattern mcp__<server>__<tool>, so you can match a specific integration. Every hook also receives session_id and transcript_path, which lets a script tie each line back to its session. Other events help too. Stop runs when Claude finishes responding, and SessionEnd runs when a session ends.

Hooks are free and local, and they never miss a matching tool call. The trade-off is that you write the filtering, the secret stripping, the storage and the search yourself, and the log lives on one machine.

How does OpenTelemetry log Claude Code activity?#

Claude Code can export metrics and events over OpenTelemetry to a collector you run. The monitoring docs say you enable it with CLAUDE_CODE_ENABLE_TELEMETRY=1, then choose exporters such as OTEL_LOGS_EXPORTER=otlp (or console for local testing) and point OTEL_EXPORTER_OTLP_ENDPOINT at your collector.

The event stream includes claude_code.tool_result each time a tool completes, and the metrics include commit, pull request, lines of code, cost and token counters. For privacy, prompt text stays redacted unless you set OTEL_LOG_USER_PROMPTS=1, and Bash commands and tool inputs only appear with OTEL_LOG_TOOL_DETAILS. This suits a team that already runs Grafana, Datadog or another OTLP backend and wants usage dashboards. On its own it does not give you a plain-language list of outcomes.

How do I log Claude Code actions to WaveBrain?#

You log Claude Code actions to WaveBrain by installing its Claude Code plugin or by adding its MCP server. Either way, actions show up on a hosted timeline that you can search from any machine, with failures posted to Slack.

The plugin is open source (MIT) and installs with two commands.

claude plugin marketplace add tambo-ai-labs/wavebrain
claude plugin install wavebrain@wavebrain

It adds the MCP server, a skill that tells Claude when to log, and hooks on PostToolUse, PostToolUseFailure, Stop and SessionEnd. After each tool call, high-stakes calls (deploys, pushes, merges, releases, publishes, payments, email, database writes and write-type MCP calls) are queued in ~/.wavebrain/queue. At the end of the turn they are sent to WaveBrain, with Stripe, GitHub, AWS, OpenAI and Anthropic keys, JWTs, bearer tokens and passwords redacted on your machine first. If Claude already logged the same action itself, the hook entry is dropped, and failed uploads retry on the next turn. Set WAVEBRAIN_HOOKS=off to pause the hooks.

Without the plugin, add the MCP server with claude mcp add and Claude logs through the log_action tool. The server tells agents to log right after any action with external effects, without being asked, and to skip pure reads. Our step-by-step guide on connecting Claude Code to WaveBrain has the exact command.

What does a logged action look like?#

A WaveBrain entry is one sentence plus context, which is why it reads faster than a hook file or an event stream. Each action has an agent, a type, a title (a short past-tense sentence of up to 200 characters), details of 20 to 10,000 characters covering what changed, why and the result, plus the project, a link and a status of success, failure or pending.

FieldExample
agentclaude-code
typedeploy
titleDeployed the checkout fix to production
detailsFixed the coupon field on mobile. The build passed and a test order went through.
projectnorthwind/web
statussuccess

Which logging method should you use?#

Use hooks when you want a free, local record of specific tool calls on one machine, OpenTelemetry when your team already has an observability backend, and WaveBrain when you want a readable log of outcomes across machines and agents. The methods can run side by side, since WaveBrain does not replace your telemetry and does not read your files or transcripts.

WaveBrain is not LLM tracing (no prompts, tokens or latency) and not a tamper-proof audit log, because it stores what Claude reports and what its hooks catch. If WaveBrain is unreachable, Claude keeps working and queued entries wait locally. Create a free account to get 1,000 actions a month, or read how WaveBrain works first.

Frequently asked questions#

Can Claude Code log every tool call automatically?#

Yes. A PostToolUse hook with no matcher runs after every successful tool call, and PostToolUseFailure catches failed ones, so a script can append each call to a file.

Where does Claude Code store its own logs?#

Claude Code keeps session transcripts in plaintext under ~/.claude/projects/ for 30 days by default. They hold the full conversation, not a filtered list of actions.

Does Claude Code's OpenTelemetry export include my prompts?#

Not by default. Prompt content is redacted unless you set OTEL_LOG_USER_PROMPTS=1, and tool inputs such as Bash commands need OTEL_LOG_TOOL_DETAILS.

Will the WaveBrain plugin send my API keys or code?#

The plugin's hooks redact common secrets such as API keys, JWTs and bearer tokens on your machine before sending, and WaveBrain never reads your repository, files or conversations. Text Claude writes into a log entry itself is not filtered server-side, so treat it like a commit message.

How do I turn off WaveBrain's automatic logging?#

Set WAVEBRAIN_HOOKS=off to pause the hooks, or uninstall the plugin. Claude can still call log_action through the MCP server while the hooks are off.

Sources#