aboutsummaryrefslogtreecommitdiff
path: root/skills/agent-optimizer.json
blob: 9f7e0cd638a988ef22ab48404492a69c8ee72dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "name": "agent-optimizer",
  "description": "Optimize agent efficiency by batching tool calls, managing turn limits, and delegating tasks effectively",
  "tags": [
    "agent",
    "optimization",
    "efficiency",
    "turn-limit",
    "delegation"
  ],
  "category": "system",
  "created": "2026-10-16T16:26:38.912Z",
  "updated": "2026-10-16T16:30:38.270Z",
  "content": "---\nname: agent-optimizer\ndescription: Optimize agent efficiency by batching tool calls, managing turn limits, and delegating tasks effectively\ntags: [agent, optimization, efficiency, turn-limit, delegation]\ncategory: system\n---\n## Steps\n# Agent Optimizer\n\n**Purpose:** Maximize agent efficiency by minimizing turn usage, batching operations, and intelligently delegating tasks.\n\n---\n\n## Core Principles\n\n1. **Batch Everything:** Combine multiple read/write operations into single tool calls where possible.\n2. **Delegate Wisely:** Split heavy tasks across spawned agents to parallelize work.\n3. **Pre-Empt Limits:** Monitor turn count and trigger delegation before hitting 7/8.\n\n---\n\n## Turn Budget Strategy\n\n| Turns Used | Action |\n|------------|--------|\n| 0-3 | Heavy computation, spawning agents, web fetching |\n| 4-6 | Tool execution, file operations |\n| 7-8 | Finalize, report, cleanup |\n| 9+ | **Delegate immediately** if task not complete |\n\n---\n\n## Efficiency Patterns\n\n### ✅ Do: Batch Reads\n```\nBad:  read_file(a) → read_file(b) → read_file(c)  [3 turns]\nGood: Use list_files + read multiple files in one response [1 turn]\n```\n\n### ✅ Do: Parallel Agent Spawn\n```\ndelegate_task(\"task A\")\ndelegate_task(\"task B\")\ndelegate_task(\"task C\")\n// All 3 run concurrently\n```\n\n### ✅ Do: Pre-Empt the Limit\n```\nif (turnCount > 6) {\n  delegate_task(\"Finish: \" + remainingWork)\n  return \"Delegated remaining work to prevent timeout\"\n}\n```\n\n### ❌ Don't: Chain Web Calls\n```\nBad:  web_search(x) → web_fetch(url) → web_search(y)  [3 turns]\nGood: web_search(x) → web_search(y) in same turn if possible\n```\n\n---\n\n## Turn-Count Awareness\n\n- **Current Limit:** 8 turns (auto-adjusts to 10 if needed)\n- **Warning Threshold:** 7/8 turns — delegate remaining work\n- **Critical Path:** If you're at turn 5 and have >3 tasks left, spawn an agent NOW\n\n---\n\n## Delegation Triggers\n\nDelegate when:\n- [ ] More than 3 independent sub-tasks remain\n- [ ] A sub-task requires >2 tool calls\n- [ ] Current turn count > 5\n- [ ] Task involves external APIs or heavy computation\n\n---\n\n## Quick Reference\n\n```javascript\n// Check turn count (if available in context)\nconst turnsRemaining = maxTurns - currentTurn;\n\n// Always end with summary if at turn 7+\nif (turnsRemaining <= 1) {\n  delegate_task(\"Complete: \" + remainingGoal);\n  return \"Delegated. Summary: [what was done]\";\n}\n```\n\n---\n\n## Related Skills\n\n- `loop-lesson-*` — Past anomalies and auto-adjustments\n- `agent-orchestration` — Advanced multi-agent patterns\n"
}