Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

reasoning-trace-optimizer

Skill by muratcankoylan

Debugs and optimizes AI agents by analyzing their reasoning traces. Built for developers who need to find why an agent failed or reduce repeated errors. Supports MiniMax M2.1 runs and Claude Code session analysis.

  • Score 94
  • 18k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install reasoning-trace-optimizer

Built from the published package, never by AI.

git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.claude/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/examples/interleaved-thinking ~/.claude/skills/reasoning-trace-optimizer

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install reasoning-trace-optimizer in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

Reasoning Trace Optimizer is an agent skill for debugging and improving AI agents. It analyzes reasoning traces to detect patterns such as context degradation, tool confusion, instruction drift, goal abandonment, circular reasoning and premature conclusion. It is built around MiniMax M2.1 and its interleaved thinking, which allows reasoning between tool interactions.

A full optimization loop captures traces, scores the run, suggests prompt changes and repeats until a score threshold is reached. It can also analyze the current Claude Code session's thinking blocks and convert learnings into reusable Agent Skills. It is aimed at developers who need to understand why an agent failed or want to reduce repeated errors.

Written from the project's SKILL.md and checked against it.

What it can do

  • Pattern detectionDetects context degradation, tool confusion, instruction drift, goal abandonment, circular reasoning and premature conclusion.
  • Trace captureRuns a task through MiniMax M2.1 and records its reasoning trace.
  • Trace analysisProduces an overall score out of 100 and a list of found patterns with suggestions.
  • Optimization loopIteratively improves the prompt based on detected patterns until a score threshold is met.
  • Session analysisAnalyzes the current Claude Code session's thinking blocks and suggests prompt improvements.
  • Skill generationConverts optimization results into reusable Agent Skills for sharing.
  • CLI commandsProvides the rto command for capture, analyze, optimize and generate-skill tasks.

What you need

  • Python
  • MiniMax M2.1 access
  • Claude Code for session analysis and slash command

Try asking

  • Analyze why my research agent keeps calling the wrong tools
  • Run an optimization loop on this code review prompt
  • Analyze the thinking blocks in this Claude Code session

Good to know

  • Each optimization iteration uses significant tokens.
  • Auto-generated skills should be reviewed before sharing.
  • Version 0.1.0.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: examples/interleaved-thinking/SKILL.md, examples/interleaved-thinking/examples/01_basic_capture.py, examples/interleaved-thinking/examples/02_tool_usage.py, examples/interleaved-thinking/examples/03_full_optimization.py, examples/interleaved-thinking/reasoning_trace_optimizer/__init__.py, examples/interleaved-thinking/reasoning_trace_optimizer/analyzer.py, examples/interleaved-thinking/reasoning_trace_optimizer/capture.py, examples/interleaved-thinking/reasoning_trace_optimizer/cli.py, examples/interleaved-thinking/reasoning_trace_optimizer/loop.py. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • README.md20 KB
  • SKILL.md6 KB
  • docs/agentthinking.md6 KB
  • docs/interleavedthinking.md30 KB
  • docs/m2-1.md9 KB
Show all 63 files
  • examples/01_basic_capture.py2 KB
  • examples/02_tool_usage.py6 KB
  • examples/03_full_optimization.py39 KB
  • generated_skills/comprehensive-research-agent/SKILL.md8 KB
  • generated_skills/comprehensive-research-agent/references/optimization_summary.json899 B
  • generated_skills/comprehensive-research-agent/references/optimized_prompt.txt81 B
  • generated_skills/comprehensive-research-agent/references/patterns_found.json12 KB
  • optimization_artifacts/final_prompt.txt3 KB
  • optimization_artifacts/iteration_1/analysis.txt3 KB
  • optimization_artifacts/iteration_1/optimization.txt485 B
  • optimization_artifacts/iteration_1/optimized_prompt.txt81 B
  • optimization_artifacts/iteration_1/trace.txt28 KB
  • optimization_artifacts/iteration_10/analysis.txt4 KB
  • optimization_artifacts/iteration_10/trace.txt28 KB
  • optimization_artifacts/iteration_2/analysis.txt3 KB
  • optimization_artifacts/iteration_2/optimization.txt7 KB
  • optimization_artifacts/iteration_2/optimized_prompt.txt3 KB
  • optimization_artifacts/iteration_2/trace.txt22 KB
  • optimization_artifacts/iteration_3/analysis.txt3 KB
  • optimization_artifacts/iteration_3/optimization.txt8 KB
  • optimization_artifacts/iteration_3/optimized_prompt.txt4 KB
  • optimization_artifacts/iteration_3/trace.txt28 KB
  • optimization_artifacts/iteration_4/analysis.txt3 KB
  • optimization_artifacts/iteration_4/optimization.txt6 KB
  • optimization_artifacts/iteration_4/optimized_prompt.txt3 KB

And 33 more files on GitHub.

Alternatives to reasoning-trace-optimizer

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

reasoning-trace-optimizer: common questions

What is interleaved thinking in this skill?

The source describes interleaved thinking as reasoning between each tool interaction, rather than thinking once at the start. The skill uses it, via MiniMax M2.1, to show how agent decisions were made.

Does it work with models other than MiniMax M2.1?

The source says the session analysis mode works with Claude, GPT and similar agents by analyzing their previous thinking. The full capture and optimization modes are described with M2.1.

What does the optimization loop do?

It executes the agent, captures traces, analyzes patterns, optimizes the prompt and re-runs the task. The source says each iteration repeats until the prompt converges or reaches the configured threshold.

How do I install reasoning-trace-optimizer?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is reasoning-trace-optimizer free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is reasoning-trace-optimizer safe to use?

It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to reasoning-trace-optimizer?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

reasoning-trace-optimizer Install

Add to stack

Loading.