claude-langfuse

Claude Code observability skill: analyze session traces stored in Langfuse, extract learnings from corrections, identify success patterns, and propose agent/skill improvements based on historical data. Powers self-improvement through trace analysis of Claude Code sessions.

Best use case

claude-langfuse is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Claude Code observability skill: analyze session traces stored in Langfuse, extract learnings from corrections, identify success patterns, and propose agent/skill improvements based on historical data. Powers self-improvement through trace analysis of Claude Code sessions.

Teams using claude-langfuse should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/claude-langfuse/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/toolkit/packages/skills/claude-langfuse/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/claude-langfuse/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How claude-langfuse Compares

Feature / Agentclaude-langfuseStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Claude Code observability skill: analyze session traces stored in Langfuse, extract learnings from corrections, identify success patterns, and propose agent/skill improvements based on historical data. Powers self-improvement through trace analysis of Claude Code sessions.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Claude Langfuse Observability Skill

Analyze Claude Code session traces stored in Langfuse to extract learnings, identify patterns, and drive continuous improvement.

## Sub-Commands

| Command | Description |
|---------|-------------|
| `/claude-langfuse` | Show help and available sub-commands |
| `/claude-langfuse:status` | Current session status and recent traces |
| `/claude-langfuse:reflect` | Analyze recent sessions for learnings and corrections |
| `/claude-langfuse:insights [trace_id]` | Deep analysis of a specific session |
| `/claude-langfuse:patterns` | Identify recurring patterns across sessions |

## Usage

### Status Check
```
/claude-langfuse:status
```
Shows:
- Current session trace ID and observation count
- Last 5 sessions with quick stats
- Tool usage breakdown

### Reflect on Sessions
```
/claude-langfuse:reflect
/claude-langfuse:reflect --sessions 10
/claude-langfuse:reflect --since 2024-01-01
```
Analyzes traces to find:
- **High confidence signals**: Explicit corrections ("never", "always", "don't", "must")
- **Medium confidence signals**: Patterns that worked well, positive feedback
- **Low confidence signals**: Observations and preferences to review later

### Deep Insights
```
/claude-langfuse:insights <trace_id>
```
Provides detailed analysis of a specific session including:
- Full timeline of tool usage
- User prompt analysis
- Error patterns
- Success patterns

## Implementation

When this skill is invoked, execute the appropriate sub-command:

### For `/claude-langfuse` or `/langfuse:status`:

1. Query Langfuse API for recent traces
2. Display current session info
3. Show summary statistics

```bash
source ~/.secrets && python3 {{HOME_TOOL_DIR}}/skills/claude-langfuse/utils/status.py
```

### For `/claude-langfuse:reflect`:

1. Fetch recent session traces from Langfuse
2. Extract user prompts and tool outputs
3. Scan for correction signals (high/medium/low confidence)
4. Match learnings to relevant agent files
5. Propose updates with diff format
6. Present for user approval

```bash
source ~/.secrets && python3 {{HOME_TOOL_DIR}}/skills/claude-langfuse/utils/reflect.py $ARGUMENTS
```

### For `/claude-langfuse:insights <trace_id>`:

```bash
source ~/.secrets && python3 {{HOME_TOOL_DIR}}/skills/claude-langfuse/utils/insights.py $ARGUMENTS
```

## Signal Detection Patterns

### High Confidence (Explicit Corrections)
- "never do X", "don't ever Y"
- "always check Z", "must verify"
- "stop doing X", "wrong approach"
- Repeated corrections for same issue

### Medium Confidence (Success Patterns)
- "perfect", "exactly what I wanted"
- "good approach", "keep doing this"
- Approved solutions that can be templated

### Low Confidence (Observations)
- Preferences mentioned in passing
- One-time edge cases
- Context-specific decisions

## Learning Categories

| Category | Examples | Target Files |
|----------|----------|--------------|
| Code Style | Formatting, naming conventions | agents/code-reviewer.md |
| Architecture | Design patterns, boundaries | agents/solution-architect.md |
| Process | Workflow, review practices | CLAUDE.md |
| Tools | Preferred utilities, commands | agents/superstar-engineer.md |
| Domain | Project-specific knowledge | Project CLAUDE.md |

## Output Format

### Reflect Output
```
═══════════════════════════════════════════════════════════════
  LANGFUSE REFLECT - Session Analysis
═══════════════════════════════════════════════════════════════

Sessions Analyzed: 5
Time Range: 2024-01-08 to 2024-01-10

┌─────────────────────────────────────────────────────────────┐
│ HIGH CONFIDENCE SIGNALS (3 found)                           │
├─────────────────────────────────────────────────────────────┤
│ [1] "Never guess file paths - always verify with ls first"  │
│     Session: abc123... @ 2024-01-09                         │
│     Target: agents/superstar-engineer.md                    │
│     Proposed: Add to working rules section                  │
├─────────────────────────────────────────────────────────────┤
│ [2] "Always use ast-grep for code searches"                 │
│     Session: def456... @ 2024-01-10                         │
│     Target: CLAUDE.md                                       │
│     Proposed: Already exists - reinforce                    │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│ MEDIUM CONFIDENCE SIGNALS (2 found)                         │
├─────────────────────────────────────────────────────────────┤
│ [1] User approved parallel agent pattern                    │
│     Session: ghi789... @ 2024-01-10                         │
│     Pattern: Launch 3+ agents for independent tasks         │
└─────────────────────────────────────────────────────────────┘

Apply these learnings? [Y/n/modify]:
```

## Integration with Hooks

The Langfuse hooks (`session_start`, `pre_tool_use`, `post_tool_use`, `stop`) automatically capture:
- Session metadata (project, branch, user)
- All tool invocations with inputs/outputs
- User prompts
- Timing information

This skill reads that data to power reflection and insights.

## Configuration

Requires Langfuse credentials in `~/.secrets`:
```bash
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_HOST="https://cloud.langfuse.com"  # optional
```

Related Skills

langfuse-setup

8
from stevengonsalvez/agents-in-a-box

Set up or disable Langfuse observability for Claude Code sessions. Manages hook configuration, credential verification, and connection testing.

workflow

8
from stevengonsalvez/agents-in-a-box

Guide through structured delivery workflow with plan, implement, validate phases

webapp-testing

8
from stevengonsalvez/agents-in-a-box

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

validate

8
from stevengonsalvez/agents-in-a-box

Verify implementation against specifications

ui-ux-pro-max

8
from stevengonsalvez/agents-in-a-box

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, Astro, Nuxt, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

tui-style-guide

8
from stevengonsalvez/agents-in-a-box

TUI style guide for consistent terminal interface design

token-usage

8
from stevengonsalvez/agents-in-a-box

Show Claude Code token usage across sessions — daily, weekly, per-project, and per-session breakdowns. Parses {{HOME_TOOL_DIR}}/projects/**/*.jsonl for consumption data. Use when the user asks about token usage, costs, how many tokens were used, session statistics, or wants a usage report.

tmux-status

8
from stevengonsalvez/agents-in-a-box

Show status of all tmux sessions including dev environments, spawned agents, and running processes

tmux-monitor

8
from stevengonsalvez/agents-in-a-box

Monitor and report status of all tmux sessions including dev environments, spawned agents, and running processes. Uses tmuxwatch for enhanced visibility.

tmux-message

8
from stevengonsalvez/agents-in-a-box

Reliable peer-to-peer message delivery to other Claude Code instances via tmux send-keys. Use as a fallback when claude-peers MCP send_message fails to surface in the receiver's inbox (delivered server-side but receiver never picks it up — observed behaviour). Also use when sending a directive to a known Claude Code TUI session by tmux session name or fuzzy hint, or when injecting a multi-line directive into a peer's prompt and submitting it. Trigger phrases — "claude-peers fallback", "tmux send-keys", "send to peer via tmux", "inject directive", "deliver to nanoclaw/hermes peer", "peer message". Tmux-only — won't reach peers running outside tmux.

test-driven-development

8
from stevengonsalvez/agents-in-a-box

Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.

test-ainb

8
from stevengonsalvez/agents-in-a-box

Run tests for the ainb (agents-in-a-box) Rust workspace via a 5-layer strategy — unit, insta snapshot, mock-plugin compositing, real-plugin spawn, vhs recording. Wraps cargo + insta + vhs into one CLI. Use when Stevie says "/test-ainb", "test ainb", "run ainb tests", "snapshot <component>", "regenerate vhs tapes", or any phrasing about validating ainb test layers. The skill autodetects which ainb-tui worktree the cwd sits in and dispatches to scripts/run.sh.