reasoning-trace-optimizer

Analyze interleaved thinking traces to detect failure patterns and optimize prompts.

17.7k|1.5k|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill reasoning-trace-optimizer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reasoning-trace-optimizer
Source: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/examples/interleaved_thinking
Command: npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering --skill reasoning-trace-optimizer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires anthropic>=0.40.0, pydantic>=2.0.0, rich>=13.0.0, python-dotenv>=1.0.0.

What problem does it solve?

Debug and optimize AI agents by analyzing interleaved thinking traces to detect failure patterns and improve prompts.

Core Features & Use Cases

  • Pattern detection in interleaved thinking traces
  • Iterative prompt optimization and convergence
  • Generation of shareable Agent Skills from optimization results
  • Tool-assisted debugging for long-horizon tasks

Quick Start

Run a trace capture, analyze the results, and generate an optimized prompt.

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 using interleaved thinking traces?

Debug AI agents by capturing interleaved thinking traces to detect failure patterns. The tool analyzes these traces to identify where reasoning goes wrong, allowing you to iteratively optimize prompts until the agent converges on correct behavior.

What is the iterative loop for prompt optimization in agent debugging?

The iterative prompt optimization loop consists of capture, analyze, optimize, and re-run stages. It repeatedly captures thinking traces, analyzes failure patterns, and refines prompts until the AI agent's performance converges and no longer fails.

Can I generate shareable Agent Skills from prompt optimization results?

Yes, you can generate shareable Agent Skills from prompt optimization results. After detecting failure patterns and converging on an optimized prompt, the tool outputs a shareable skill file for team use.

Do I need Python and specific packages to analyze reasoning traces?

Yes, analyzing reasoning traces requires Python with specific dependencies. You need the anthropic, pydantic, rich, and python-dotenv packages installed in your environment to run the trace capture and optimization loops.

What's the best way to fix long-horizon task failures in AI agents?

Fix long-horizon task failures using tool-assisted debugging on interleaved thinking traces. By analyzing the full reasoning trace, you can detect where the agent's logic breaks down over extended tasks and apply iterative prompt optimization.