reasoning-trace-optimizer
An agent skill by muratcankoylan, from muratcankoylan/Agent-Skills-for-Context-Engineering. Tags: automation, debugging, developer-tools, performance, strategy.
What it does
Debug and optimize AI agents by analyzing reasoning traces, context degradation, tool confusion, instruction drift, repeated task failures, and performance regressions.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add muratcankoylan/Agent-Skills-for-Context-Engineering --skill reasoning-trace-optimizer
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering
cp -r Agent-Skills-for-Context-Engineering/examples/interleaved-thinking ~/.claude/skills/reasoning-trace-optimizer
Safety box score
Grade D, elevated risk: 56 of 100 risk points, rated 2026-10-16. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill is a research/debugging toolkit for AI agents: it captures traces, analyzes them, optimizes prompts, and can generate reusable skills. The main risks are outbound transmission of traces and keys to MiniMax/Anthropic, broad file writes for reports/artifacts/generated skills, and prompt/behavior mutation through auto-hooks and optional system-prompt updates.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | It ships executable Python modules, a CLI entry point (`rto = "reasoning_trace_optimizer.cli:main"`), and runnable examples (`if __name__ == "__main__": main()`), so installing it gives the user code that can be executed locally. |
| Network access | 3 (high) | Core functionality calls remote model APIs (`self.client.messages.create(...)`) and examples point at `base_url="https://api.minimax.io/anthropic"`, so reasoning traces, prompts, and tool context can leave the machine. |
| Filesystem reach | 2 (moderate) | The CLI writes directly to user-chosen paths (`Path(args.output).write_text(...)`) and generates artifacts/skills in configurable directories (`--artifacts-dir`, `--skills-dir`, `--output-dir`). |
| Secrets & credentials | 2 (moderate) | Examples and library code load credentials from `.env` and `ANTHROPIC_API_KEY` (`load_dotenv(env_path)`, `os.environ.get("ANTHROPIC_API_KEY")`), so the skill is designed to use secret-bearing environment state. |
| Privilege & persistence | 0 (none) | There is no use of sudo, service registration, shell startup edits, global installs, or other privilege-changing behavior in the reviewed files. |
| Instruction hijack surface | 2 (moderate) | The docs and skill text push the agent toward following embedded instructions and prompt changes, including `"Optionally update the system prompt"` and remote doc-following via `fetch the llms.txt file at: https://platform.minimax.io/docs/llms.txt`. |
| Irreversible actions | 2 (moderate) | It can auto-trigger analysis via hooks (`"post_tool_error": { "command": "rto analyze-session --last-error" }`) and generate new skills/prompts, which can alter agent behavior without a separate human editing step. |
| Transparency | 1 (low) | Several core implementation files were not readable in this review (`capture.py`, `analyzer.py`, `loop.py`, `skill_generator.py`), so some runtime behavior could not be independently verified. |
Before installing
- Read `reasoning_trace_optimizer/capture.py`, `analyzer.py`, `loop.py`, and `skill_generator.py` before trusting the runtime behavior.
- Test it with a throwaway API key in a scratch account and confirm exactly what prompts/traces leave the machine.
- Decide up front whether to allow `post_tool_error` hooks and automatic system-prompt updates; disable them if you want less autonomy.
Rated 2026-10-16 by an automated review of 46 files from the skill's repository.
Source
- Repository
- muratcankoylan/Agent-Skills-for-Context-Engineering (all skills from this repository)
- Path
- examples/interleaved-thinking/SKILL.md
- Branch
- main
- Updated
- 2026-09-19
Related skills
- context-degradation — This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion.
- self-improvement-loops — This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops.
- context-compression — This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization.
- context-optimization — This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning.
- harness-engineering — This skill should be used when designing autonomous agent harnesses: research loops, evaluation scaffolds, locked and editable surfaces, durable logs.
- latent-briefing — This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context".