reasoning-trace-optimizer

Analyze AI agent reasoning traces to detect failure patterns and optimize prompts.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/monmacllcapp/skill-forks --skill reasoning-trace-optimizer-monmacllcapp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reasoning-trace-optimizer
Source: https://github.com/monmacllcapp/skill-forks/tree/main/skills/context-engineering/examples/interleaved_thinking
Command: npx skills add https://github.com/monmacllcapp/skill-forks --skill reasoning-trace-optimizer-monmacllcapp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires anthropic, pydantic, rich, python-dotenv, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers debug and optimize AI agents by analyzing their reasoning traces, identifying failure patterns, and suggesting prompt improvements.

Core Features & Use Cases

  • Trace Capture: Records detailed thinking blocks and tool calls from AI agent interactions.
  • Pattern Analysis: Detects common issues like context degradation, tool confusion, and instruction drift.
  • Prompt Optimization: Generates improved prompts based on analysis to enhance agent performance.
  • Use Case: An AI agent is failing on complex tasks. Use this Skill to analyze its reasoning, pinpoint why it's failing (e.g., losing context), and automatically generate a better prompt to fix the issue.

Quick Start

Use the reasoning trace optimizer skill to analyze the agent's last reasoning trace.

Frequently Asked Questions about reasoning-trace-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug AI agents that fail complex tasks due to context degradation?

Debug AI agents by capturing detailed reasoning traces to identify failure patterns like context degradation. The Skill analyzes interleaved thinking blocks and tool calls to pinpoint exactly why an agent is failing, enabling targeted prompt optimization.

How does reasoning trace analysis detect instruction drift in AI agents?

Reasoning trace analysis detects instruction drift by recording detailed thinking blocks and tool calls during agent interactions. It identifies common failure patterns where the agent loses track of original instructions, providing data to refine and optimize prompts.

Can I optimize prompts automatically using interleaved thinking capabilities?

You can optimize prompts automatically through an iterative optimization loop. The Skill analyzes captured reasoning traces using interleaved thinking capabilities to generate improved prompts that enhance agent performance and resolve identified issues.

What is the best way to fix tool confusion in AI agent workflows?

Fix tool confusion by analyzing AI agent reasoning traces to detect when agents misuse or misunderstand available tools. The Skill identifies these specific failure patterns and suggests prompt improvements to clarify tool usage and workflow execution.

Do I need Python and specific dependencies to run the reasoning trace optimizer?

You need a Python environment with dependencies including anthropic, pydantic, rich, and python-dotenv. These libraries support trace capture, pattern analysis, and the iterative optimization loop required to analyze and refine agent reasoning.