Skip to content

Reasoning Trace Optimizer

Lets an agent debug and improve other AI agents by analyzing their reasoning traces and prompts

Stars
18,282
Licence
MIT
Files
15 files

What it does

This skill teaches an agent to examine how an AI agent reasoned through a task, looking for patterns such as lost goals, tool confusion, or premature conclusions. It can then suggest a better system prompt and, in its full form, run repeated capture-analyze-optimize cycles. It is built around MiniMax M2.1 and its interleaved thinking, though the SKILL.md says the session analysis mode can work with other models.

Great for

  • Developers building or debugging agents that call tools repeatedly
  • Teams who want to turn failed agent runs into prompt fixes and shareable notes
  • Anyone experimenting with MiniMax M2.1 reasoning traces

Skip it if

  • Non-developers who just want a writing or research helper; the main modes need a Python package, API keys and scripts that are not included in the file list (the package reasoning_trace_optimizer and rto CLI are referenced but not shipped here)
  • Production systems where automatic prompt rewrites are applied without human review, since the optimizer can change prompts and generated skills should be reviewed before sharing
  • Anyone who does not want their task data or session thinking sent to a third-party API, because captured runs are sent to the MiniMax endpoint

Try asking

  • “Analyze why my agent kept calling the wrong tool after three turns and suggest prompt fixes”
  • “Analyze this session's thinking blocks and tell me where I drifted from the original instructions”
  • “Run an optimization loop on my research agent prompt and stop when the score reaches 80”
  • “Turn my optimization artifacts into a reusable skill for web search best practices”
Step-by-step guide: how to use Reasoning Trace OptimizerInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 15 original files, the MIT licence and an attribution note.

    interleaved-thinking.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip interleaved-thinking.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip interleaved-thinking.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Keep full response history including thinking blocks when capturing traces, as the skill recommends
  • Review any generated skill or optimized prompt before sharing or deploying it
  • Set a small max_iterations value first, since each optimization iteration uses significant tokens

What's inside

  • docs/agentthinking.md
  • docs/interleavedthinking.md
  • docs/m2-1.md
  • examples/01_basic_capture.py
  • examples/02_tool_usage.py
  • examples/03_full_optimization.py
  • generated_skills/comprehensive-research-agent/references/optimization_summary.json
  • generated_skills/comprehensive-research-agent/references/optimized_prompt.txt
  • generated_skills/comprehensive-research-agent/references/patterns_found.json
  • generated_skills/comprehensive-research-agent/SKILL.md
  • optimization_artifacts/final_prompt.txt
  • optimization_artifacts/iteration_1/analysis.txt
  • optimization_artifacts/iteration_1/optimization.txt
  • README.md
  • SKILL.md

Redistributed unmodified from muratcankoylan/Agent-Skills-for-Context-Engineering under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.