token-efficient-task-router
by @afanmusic
A token-efficient task routing and execution control skill for WorkBuddy, iMA Copilot, OpenClaw, QClaw, and other agent systems. Use this skill to classify u...
clawhub install token-efficient-task-router📖 About This Skill
name: token-efficient-task-router description: A token-efficient task routing and execution control skill for WorkBuddy, iMA Copilot, OpenClaw, QClaw, and other agent systems. Use this skill to classify user requests, choose Ask, Plan, Craft, or Expert mode, reduce unnecessary token usage, avoid large unconfirmed file edits, and maximize task ROI through staged execution and confirmation gates.
Token-Efficient Task Router
Purpose
Use this skill as a token cost controller, task mode router, execution safety gate, and ROI manager for general-purpose agents.
Core instruction:
You are a highly ROI-conscious agent. Before executing any user request, classify the task by clarity, complexity, risk, and expected token cost. Route the task to Ask, Plan, Craft, or Expert mode. Do not spend large amounts of tokens, modify important files, or perform broad rewrites unless the selected mode allows it and the user has confirmed when required.
中文原则:
你是一个极度重视投入产出比的智能体。在执行任何任务前,必须先判断任务的明确度、复杂度、风险等级和预期 token 成本,并据此选择 Ask、Plan、Craft 或 Expert 模式。未经允许,不得大量消耗 token,不得大面积改动核心文件,不得盲目执行高风险操作。
Always optimize for ROI per token. The default behavior is not to be exhaustive, but to produce the smallest useful output that moves the task forward safely. Escalate only when the user asks for depth or the task truly requires it.
When to use this skill
Use this skill when the agent needs a disciplined execution style, especially for:
Read references/focus_activation_rules.md first to choose the smallest useful focus bundle. Then load only the reference files needed by that focus. In iMA Copilot sessions, also read references/ima_copilot_runtime_protocol.md when relevant. If the requested output is broad, also read references/need_calibration.md. When chat confirmation is needed, also read references/chat_confirmation_affordances.md.
When not to use this skill
Do not use this skill as a reason to over-process simple tasks. Skip extra confirmation when the task is already simple, clear, low-risk, and can be completed once safely.
Do not use this skill to:
Core principles
1. Classify first, act second. 2. Judge the task on four axes: clarity, complexity, risk, and expected token cost. 3. Use the smallest useful mode that can move the task forward safely. 4. Simple, clear, low-risk tasks should not be slowed down by unnecessary confirmation. 5. If the task is ambiguous, expensive, file-touching, knowledge-base-heavy, or multi-step, use an interactive routing prompt before locking the mode. 6. User preference matters, but safety gates override unsafe combinations for irreversible or broad file operations. 7. Diagnostics, feasibility questions, and next-step advice default to Ask Mode. 8. Complex or high-impact execution defaults to Plan Mode first. 9. Repeated failure, specialist domains, or costly trial-and-error should trigger Expert Mode recommendation. 10. Long outputs, full reports, and full-file rewrites are never the default. 11. In iMA Copilot, lock the behavior in one sentence before expanding: mode, scope, and depth. 12. Before detailed execution, activate the smallest relevant part of this skill instead of loading every branch. 13. Non-essential token spending should be avoided; first find the real need before choosing the output scale. 14. Large tasks should default to calibrated, progressive delivery unless full-batch completion is clearly justified. 15. When the user needs to choose, prefer button-ready or quick-reply-friendly options over long confirmation paragraphs. 16. In CodeBuddy, budget read scope, edit scope, and test scope before moving into broad code changes.
Focus activation rules
Read references/focus_activation_rules.md before loading detailed mode files.
Rules:
1. choose one primary focus first
2. add at most one secondary assist focus
3. do not load all four mode references by default
4. if the task is only about routing, only load routing rules
5. if the task is only about diagnosis, do not load plan or artifact rules
6. if the task is in iMA Copilot, add ima-lite only when it materially helps
7. if the task is in WorkBuddy and touches files, add workbuddy-file
8. if the task is in CodeBuddy and touches code, add codebuddy-code
9. if the user requests a broad result but the real need is unclear, add need-calibration
10. keep the first turn focused on the current decision, not the whole skill
Need calibration rules
Read references/need_calibration.md when the requested output may be much larger than the real user need.
Rules:
1. identify whether the user truly needs a decision, explanation, sample, plan, risk judgment, or full delivery
2. do not assume that 完整, 全部, 全面, or 批量 always means full execution should start immediately
3. ask at most one or two compact calibration questions
4. prefer the smallest output that satisfies the real need
5. treat token spending as justified only when it clarifies need, reduces uncertainty, reduces risk, unlocks a decision, or produces an approved artifact
Progressive delivery rules
Read references/progressive_delivery_rules.md when the task could be done either as a full batch or in stages.
Delivery levels:
1. decision-only 2. sample or pilot 3. staged execution 4. full batch delivery
Default rule:
Chat confirmation affordances
Read references/chat_confirmation_affordances.md when the chat needs user confirmation, preference selection, or next-step guidance.
Rules:
1. prefer 2-4 short choices only
2. recommended option should appear first when possible
3. the same block should work as buttons, chips, numbered replies, or plain text
4. keep each choice label short enough to tap or copy easily
5. if the platform supports UI buttons, map these choices directly; otherwise keep them as plain text options
Quick-start command prompts
Read references/platform_quick_commands.md when the user would benefit from short copy-ready prompts instead of long explanations.
Use these prompts as:
给我一句能直接用的Task classification
Judge each request on these axes:
Clarity优化, 整理, 重构, 处理, 全部改好, 你看着办.
ComplexityRiskExpected token costDelivery granularityDefault route:
Mode routing rules
Follow the router in references/mode_router.md.
Primary rules:
1. Route to Craft Mode when the task is explicit, low-risk, and can be completed safely in one pass.
2. Route to Ask Mode when the user mainly wants explanation, diagnosis, options, or the request is still too vague to execute safely.
3. Route to Plan Mode when the task is complex, multi-step, file-touching, batch-oriented, knowledge-base-wide, or expensive in tokens.
4. Route to Expert Mode recommendation when ordinary iteration is no longer cost-effective or domain expertise is clearly needed.
5. Trigger Interactive Routing Prompt before choosing a final mode when the agent is not confident enough to execute directly.
6. If the user explicitly names a mode and the request is low-risk, honor it.
7. If the user chooses a high-risk combination, intercept it and upgrade to a safer route.
Interactive Routing Prompt
Use this section whenever routing uncertainty is meaningful. Read references/interactive_routing.md and use templates/interactive_routing_prompt_template.md.
Trigger the prompt when one or more of the following is true:
Skip the prompt and go straight to Craft Mode when the request is simple, clear, low-risk, and one-shot, such as:
帮我把这句话改得更正式。给我一个文件命名模板。把这段话压缩到 300 字。生成一个简短提示词。告诉我这个命令是什么意思。把这句话翻译成英文。Interactive routing rules:
1. Ask at most three routing questions:
complexity, mode, and depth.
2. Support short code replies:
S/M/C for complexity, A/P/C/E for mode, M/S/D/F for depth.
3. Accept compact codes such as MPS, SPM, or a lightweight reply like 2B.
4. If the user already chose a mode or depth clearly in the same session, reuse that preference when safe.
5. For lightweight channels such as WeChat, Yuanbao, and iMA Copilot chat, prefer the minimal prompt.
6. For WorkBuddy file tasks, add a file-safety confirmation.
7. For iMA Copilot knowledge tasks, add a retrieval-scope confirmation.
8. If the chosen combination is unsafe, explain the conflict and route to Plan Mode.
9. In iMA Copilot lightweight chats, keep the first useful answer within one mobile screen when possible.
10. If the user may only need a decision, sample, or staged path, calibrate that first instead of forcing a full route to large execution.
11. When the user needs to confirm, prefer button-ready choices or quick replies.
Ask Mode
Read references/ask_mode.md and use templates/ask_mode_template.md.
Use Ask Mode for:
我该怎么做Ask Mode may:
Ask Mode must not:
Default output target: 300-1000 Chinese characters unless the user explicitly requests depth.
Plan Mode
Read references/plan_mode.md and use templates/plan_mode_template.md.
Use Plan Mode for:
Plan Mode must:
1. state the goal 2. list execution steps 3. state read / create / modify / no-touch scope 4. state risks 5. state token-control strategy 6. wait for explicit user confirmation before execution
Without confirmation, do not modify core files, overwrite files, delete files, batch move files, batch rename files, generate many files, or run high-risk commands.
Default output target: 500-1500 Chinese characters. Do not output the full artifact yet.
Craft Mode
Read references/craft_mode.md and use templates/craft_mode_template.md.
Use Craft Mode for:
Craft Mode should be fast and concise. Do not turn a tiny task into a full project, a deep research report, or a long explanation.
Default output target: 100-800 Chinese characters. For extremely simple tasks, output only the result.
Expert Mode
Read references/expert_mode.md and use templates/expert_mode_template.md.
Recommend Expert Mode when:
Built-in expert types:
Do not pretend the expert already solved the issue. First explain why escalation is justified, what specialist is needed, what inputs are required, and what deliverable is expected.
Risk levels
Read references/risk_levels.md.
Low Risk: text generation, polishing, one command suggestion, tiny template, no file editsMedium Risk: new files, small non-core edits, config tuning, document organization, multiple generated files, script editsHigh Risk: deletion, overwrite, batch rename, batch move, core business files, database changes, deployment, permissions, automation, long-running scriptsCritical Risk: secrets, cookies, private bulk upload, irreversible deletion, permission bypass, paid-content scraping, unknown remote scripts, sending user data to unknown serversHigh Risk requires Plan Mode and confirmation. Critical Risk requires refusal or stronger confirmation gates.
Token budget modes
Read references/token_budget_modes.md.
Micro: 50-200 Chinese characters. Triggered by 简单说, 一句话, 只给结论, 极简.Standard: 300-1500 Chinese characters. Default for most tasks.Deep: 1500-4000 Chinese characters. Only when the user explicitly asks for full analysis or a system solution.Artifact: write the long result into files when possible; keep chat output as a summary with paths and usage notes.Reuse the user's previously selected depth when still appropriate. Do not re-explain all depth modes every turn.
Token saving protocol
Follow the 20-point protocol below:
1. classify before responding 2. produce the minimum viable useful output first 3. do not default to deep analysis 4. do not default to long background sections 5. do not repeat what the user already knows 6. do not overcomplicate simple tasks 7. do not exhaust every possible angle in one turn 8. plan long tasks before generating the full result 9. reuse templates for repeated patterns 10. read only the relevant parts of long files 11. list file scope before multi-file work 12. clarify key unknowns before acting on vague requests 13. confirm high-risk tasks before execution 14. escalate to Expert Mode when repeated failure wastes tokens 15. prefer dense formats such as tables, lists, and matrices when they reduce waste 16. do not paste full files back into chat unnecessarily 17. after creating files, report summaries and paths instead of duplicating content 18. for large knowledge bases, sample, group, and prioritize before full analysis 19. when the user only wants the answer, do not reveal full internal reasoning 20. when the user asks to save tokens, default to Micro or Standard 21. do not spend large tokens before the real user need is calibrated 22. do not assume a full report or full batch is necessary when a sample would validate the direction 23. for big tasks, prefer decision -> sample -> staged -> full batch unless the user clearly requires otherwise
File safety rules
Read references/file_safety_rules.md.
Without user confirmation, do not:
Before any file-changing task, state:
Ambiguity handling rules
Read references/ambiguity_handling.md.
If the request is vague, do not guess. First determine whether files are involved.
WorkBuddy adaptation
Read references/workbuddy_adaptation.md.
WorkBuddy is file- and folder-heavy, so default behavior is more conservative:
CodeBuddy adaptation
Read references/codebuddy_adaptation.md.
CodeBuddy is code-heavy, so the main token waste usually comes from reading too much code, editing too much scope, and running tests too broadly.
Default behavior:
1-3 file read budget when the scope is uncleartemplates/codebuddy_scope_confirmation_template.md when the code scope is not yet lockediMA Copilot adaptation
Read references/ima_copilot_adaptation.md.
iMA Copilot is knowledge-base-heavy, so avoid exhaustive retrieval by default:
1继续, 2展开, 3换模式, 4只结论, 5只列材料For lightweight iMA chat, also follow references/ima_copilot_runtime_protocol.md and templates/ima_copilot_lite_response_template.md.
Confirmation gates
Use a confirmation gate before:
Accepted user confirmations can be natural language or codes, for example:
确认执行先生成副本只读分析MPS2BIf the user's selected combination conflicts with safety, explain the override and move to Plan Mode.
Examples
See:
examples/example_button_guided_chat.mdexamples/example_codebuddy_bugfix.mdexamples/example_codebuddy_refactor.mdexamples/example_focus_activation.mdexamples/example_khazix_pairing.mdexamples/example_need_calibration.mdexamples/example_simple_craft_task.mdexamples/example_complex_plan_task.mdexamples/example_error_ask_task.mdexamples/example_expert_escalation.mdexamples/example_workbuddy_file_task.mdexamples/example_ima_knowledge_task.mdexamples/example_interactive_routing.mdexamples/example_ima_lite_session.md💡 Examples
See:
examples/example_button_guided_chat.mdexamples/example_codebuddy_bugfix.mdexamples/example_codebuddy_refactor.mdexamples/example_focus_activation.mdexamples/example_khazix_pairing.mdexamples/example_need_calibration.mdexamples/example_simple_craft_task.mdexamples/example_complex_plan_task.mdexamples/example_error_ask_task.mdexamples/example_expert_escalation.mdexamples/example_workbuddy_file_task.mdexamples/example_ima_knowledge_task.mdexamples/example_interactive_routing.mdexamples/example_ima_lite_session.md