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.
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-optimizerRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install reasoning-trace-optimizer in Claude Code
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering /tmp/Agent-Skills-for-Context-Engineering && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/Agent-Skills-for-Context-Engineering/examples/interleaved-thinking ~/.gemini/antigravity-cli/skills/reasoning-trace-optimizerAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install reasoning-trace-optimizer in Antigravity CLI
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
ANo 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 →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
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.
