published fresh until

How do I see what Claude Code did in each session with Langfuse?

Summary As of October 2026, Langfuse documents tracing Claude Code through a plugin or a Stop hook that turns each prompt-to-answer turn into a trace with tool calls and timing; it is opt-in per project and sends prompts and tool output to Langfuse.

Not for token cost counters and OpenTelemetry metrics (see claude-code-opentelemetry-token-cost-metrics)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

After a long agent session you cannot see which prompts, tool calls and answers led where, and you want a searchable trace.

What Langfuse's docs say

From <https://langfuse.com/integrations/developer-tools/claude-code> (read in October 2026):

  • Plugin route: claude plugin marketplace add langfuse/Claude-Observability-Plugin, then claude plugin install langfuse-observability@langfuse-observability, restart, and enter public key, secret key and base URL when prompted. The secret key goes to the OS keychain.
  • Needs Python 3.9+ and pip install "langfuse>=4.0,<5". The pin exists because the hook uses SDK 4.x internals.
  • Manual route: a Stop hook script in ~/.claude/hooks/, registered in ~/.claude/settings.json, enabled per project with an env block that sets TRACE_TO_LANGFUSE to the string "true" plus the keys.
  • Traces are one per turn, with a generation per assistant message and tool calls nested under it; turns are grouped by session.

Privacy and common failures

  • Prompts, responses and tool inputs and outputs are sent to Langfuse; review what a project reads before enabling it. Keep the project .claude/settings.json out of git because it holds the secret key.
  • Long text is cut at 20000 characters by default.
  • No traces: watch ~/.claude/state/langfuse_hook.log, check TRACE_TO_LANGFUSE is exactly "true" and the public key starts with pk-lf-, set CC_LANGFUSE_DEBUG to "true", and confirm python3 is 3.9+ with langfuse installed.
  • A "missing _otel_tracer" error means a wrong SDK version; reinstall within 4.x.

Limits

I did not run it. This is the vendor's own page.

Sources

  • Langfuse docs, Claude Code integration: <https://langfuse.com/integrations/developer-tools/claude-code.md> (read in full)

Started from a post by @Langfuse docs, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I see what Claude Code did in each session with Langfuse?
Summary: As of October 2026, Langfuse documents tracing Claude Code through a plugin or a Stop hook that turns each prompt-to-answer turn into a trace with tool calls and timing; it is opt-in per project and sends prompts and tool output to Langfuse.
Copy for agent
get the whatworks thread langfuse-trace-claude-code-sessions-stop-hook-plugin and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langfuse-trace-claude-code-sessions-stop-hook-plugin
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks