Self-composing reasoning structures for AI agents.
Let AI discover the optimal reasoning strategy β before solving the problem.
Most AI reasoning uses a single strategy (usually "think step by step"). This skill lets the AI discover the optimal reasoning structure for each specific task:
SELECT β ADAPT β IMPLEMENT β SOLVE
Based on peer-reviewed research showing up to 32% improvement over Chain-of-Thought and >20% over Self-Consistency with 10-40x less compute (Zhou et al., 2024, ICML).
One file. Zero dependencies. Zero API cost. The host AI composes its own reasoning structures.
Benchmarked on 20 questions across 5 categories with controlled before/after evaluation. β Full report
| Metric | Result |
|---|---|
| Overall improvement | +25.3% |
| Questions improved | 20/20 (100%) |
| Best single improvement | +48.2% |
Per-dimension improvement:
| Dimension | Ξ |
|---|---|
| Reasoning Depth | +31.5% |
| Structure Quality | +28.8% |
| Answer Accuracy | +24.2% |
| Problem Coverage | +23.7% |
| Actionability | +22.0% |
| Efficiency | +19.5% |
π Read the full benchmark report β
Example 1 β Complex Debugging
User: "My microservice throws intermittent 503s under load. Sometimes works, sometimes doesn't. No pattern I can see."
β Without Self-Discover:
This sounds like a capacity issue. Your service might be running out of resources under load. Check your CPU and memory usage during peak times. You might need to scale horizontally or optimize your code. Also check your database connections β connection pool exhaustion is a common cause. Consider adding circuit breakers and retry logic.
β With Self-Discover:
Selected modules: Decomposition, Causal Analysis, Hypothesis Testing, Constraint Satisfaction
Root cause candidates (ranked by likelihood):
# Hypothesis Evidence to Check Fix 1 Connection pool exhaustion SHOW STATUS LIKE 'Threads_connected'during 503Increase pool size + add timeout 2 Thread pool saturation wrk -t12 -c400+ watchActiveThreadsin metricsSwitch to async I/O or increase worker count 3 Downstream timeout cascade Check upstream service latency at P99 during 503 window Add circuit breaker, fail fast Debugging sequence:
# 1. Confirm it's load-dependent watch -n1 'curl -s -o /dev/null -w "%{http_code}" http://service/health' # 2. Check connections during 503 window netstat -an | grep ESTABLISHED | wc -l # 3. Compare against pool config grep -i pool application.yml
Example 2 β Architecture Decision
User: "Should we use WebSockets or Server-Sent Events for real-time notifications?"
β Without Self-Discover:
Both work for real-time. WebSockets are bidirectional and SSE is server-to-client only. If you only need server push, SSE is simpler. If you need the client to send messages too, use WebSockets. Consider compatibility β SSE works everywhere, WebSockets might have proxy issues.
β With Self-Discover:
Selected modules: Comparative Analysis, Constraint Satisfaction, Systems Thinking
Factor SSE WebSocket Winner Direction ServerβClient Bidirectional Depends Reconnection Auto (built-in) Manual (heartbeat + reconnect) SSE Protocol HTTP/1.1+ (simple) Upgrade handshake (complex) SSE Binary data No (text only) Yes WS Load balancer compat Native HTTP Requires sticky sessions/config SSE Scaling Easy (stateless connections) Harder (stateful) SSE For notifications (serverβclient, text-based, needs reliability): SSE.
// Server (Express) app.get('/notifications', (req, res) => { res.setHeader('Content-Type', 'text/event-stream'); res.setHeader('Cache-Control', 'no-cache'); const push = (data) => res.write(`data: ${JSON.stringify(data)}\n\n`); subscribe(req.user.id, push); req.on('close', () => unsubscribe(req.user.id, push)); });Use WebSocket only if you need clientβserver real-time (e.g., collaborative editing, gaming).
Example 3 β Math Problem
User: "A bat and ball cost $1.10 total. The bat costs $1.00 more than the ball. How much is the ball?"
β Without Self-Discover:
The ball costs $0.10. The bat costs $1.00 more, so $1.10. Total is $1.10. β
β With Self-Discover:
Selected modules: Critical Thinking, Constraint Satisfaction, Hypothesis Testing
Constraint setup:
- Bat + Ball = $1.10
- Bat = Ball + $1.00
Substitute: (Ball + $1.00) + Ball = $1.10 β 2 Γ Ball = $0.10 β Ball = $0.05
Verify: Bat = $0.05 + $1.00 = $1.05. Total = $1.05 + $0.05 = $1.10 β
The intuitive answer ($0.10) fails: $0.10 + $1.10 = $1.20 β $1.10.
| # | Module | Best For |
|---|---|---|
| 1 | Step-by-Step Thinking | Sequential procedures |
| 2 | Decomposition | Multi-part problems |
| 3 | Critical Thinking | Evaluating claims |
| 4 | Reflective Thinking | Deep analysis |
| 5 | Creative Thinking | Open-ended design |
| 6 | Pattern Recognition | Data, sequences |
| 7 | Analogical Reasoning | Transfer learning |
| 8 | Causal Analysis | Debugging, diagnostics |
| 9 | Constraint Satisfaction | Optimization |
| 10 | Abstraction | Architecture, generalization |
| ... | + 10 more in SKILL.md |
| Level | When | Modules | Token Cost |
|---|---|---|---|
| 0 | Simple Q&A | 0 | +0% |
| 1 | Most conversations | 1-2 | ~10% |
| 2 | Complex technical | 3-5 | ~25% |
| 3 | High-stakes / full discovery | 4-7 | ~40% |
No configuration. The agent picks the right depth automatically based on task complexity.
Discovered reasoning structures transfer between similar tasks β use memory/discovered-structures.md to cache and reuse. Based on Zhou et al.'s finding that structures transfer across model families.
OpenClaw (recommended)
# Copy to your skills directory
cp -r self-discover-skill/ ~/.openclaw/skills/That's it. OpenClaw auto-detects skills.
Claude Code
# Copy to your project
cp -r self-discover-skill/ skills/
# Add to CLAUDE.md
echo "Read and follow skills/self-discover-skill/SKILL.md" >> CLAUDE.mdCursor
# Copy to project root
cp -r self-discover-skill/ skills/
# Add to .cursorrules
echo "Read and follow skills/self-discover-skill/SKILL.md" >> .cursorrulesGemini CLI
# Copy to project, add to GEMINI.md
cp -r self-discover-skill/ skills/
echo "Read and follow skills/self-discover-skill/SKILL.md" >> GEMINI.mdGitHub Copilot
# Add to your repository's Copilot instructions
mkdir -p skills && cp -r self-discover-skill/ skills/
echo "Read and follow skills/self-discover-skill/SKILL.md" >> .github/copilot-instructions.mdCodex CLI (OpenAI)
cp -r self-discover-skill/ skills/
echo "Read and follow skills/self-discover-skill/SKILL.md" >> AGENTS.mdWindsurf
cp -r self-discover-skill/ skills/
echo "Read and follow skills/self-discover-skill/SKILL.md" >> .windsurfrulesCline / AI Coding Assistants
Copy self-discover-skill/ to your project. Reference SKILL.md in your assistant's custom instructions.
JetBrains AI / Junie
- Open Settings β Tools β AI Assistant β System Instructions
- Add:
Read and follow skills/self-discover-skill/SKILL.md - Place the skill folder in your project root
Zed
- Open Zed settings
- Add to your context or assistant instructions:
Read and follow skills/self-discover-skill/SKILL.md
Kiro
- Add skill folder to project
- Reference in Kiro's instruction configuration
OpenCode
- Add skill folder to project
- Add to
AGENTS.md:Read and follow skills/self-discover-skill/SKILL.md
ChatGPT Custom GPT
- Open your GPT β Settings β Instructions
- Paste the contents of
SKILL.md - Save
Note: SKILL.md includes inline templates for environments without file access β all depth levels work. Structure memory is in-conversation only (no persistence).
Any AI Tool
Copy SKILL.md into your system prompt or instructions file. That's the only file you need.
Top platforms (most popular by usage):
| Platform | Rating | Structure Memory | Notes |
|---|---|---|---|
| Claude Code | βββββ | β File write | #1 coding agent 2026, full support |
| Cursor | βββββ | β File write | $2B ARR AI IDE, full support |
| GitHub Copilot | βββββ | β File write | Largest user base, full support |
| Codex CLI | βββββ | β File write | OpenAI's coding agent, full support |
| ChatGPT | ββββ | Inline templates auto-load, all levels |
Show all 14 supported platforms
| Platform | Rating | Structure Memory | Install |
|---|---|---|---|
| OpenClaw | βββββ | β
memory/ dir |
Copy to skills/, auto-detect |
| Claude Code | βββββ | β File write | Copy to project, add to CLAUDE.md |
| Cursor | βββββ | β File write | Copy to project, add to .cursorrules |
| GitHub Copilot | βββββ | β File write | Add to .github/copilot-instructions.md |
| Codex CLI | βββββ | β File write | Add to AGENTS.md |
| Gemini CLI | βββββ | β File write | Add to GEMINI.md |
| Windsurf | βββββ | β File write | Add to .windsurfrules |
| Cline | βββββ | β File write | Add to custom instructions |
| JetBrains AI / Junie | ββββΒ½ | β File write | Add to AI Assistant instructions |
| Aider | ββββ | β File write | Place in project, reference with --file |
| Zed | ββββ | β File write | Add to Zed settings |
| ChatGPT GPT | ββββ | Paste SKILL.md into GPT Instructions | |
| Kiro | ββββ | β File write | Add to Kiro instructions |
| OpenCode | ββββ | β File write | Add to AGENTS.md |
| Paper | Year | What We Use |
|---|---|---|
| SELF-DISCOVER β Zhou et al. | 2024 | Core SELECTβADAPTβIMPLEMENTβSOLVE framework |
| Chain of Thought β Wei et al. | 2022 | Baseline single-module reasoning |
| Self-Consistency β Wang et al. | 2022 | Comparison target (Self-Discover outperforms with less compute) |
| Least-to-Most Prompting β Zhou et al. | 2022 | Decomposition module inspiration |
| Tree of Thoughts β Yao et al. | 2023 | Multi-path reasoning comparison |
| Step-Back Prompting β Zheng et al. | 2023 | Principle-first reasoning module |
| OPRO β Yang et al. | 2023 | Optimized prompt comparison |
Full bibliography: references/sources.md
self-discover-skill/
βββ SKILL.md # Core instructions (the only required file)
βββ README.md # This file
βββ LICENSE # MIT
βββ references/
βββ sources.md # Academic sources with URLs
βββ discovery-templates.md # Ready-to-use discovery templates per depth level
The art of reasoning is not in the answer, but in discovering the structure that leads to it.
β Star this repo if it improved your AI's reasoning quality.