fix(delegate-task): aggressive tool description to prevent missing category/subagent_type
Problem: Agents frequently omit both 'category' and 'subagent_type' parameters
when calling the task() tool, causing validation failures. The JSON Schema
marks both as optional, and LLMs follow schema structure over description text.
Solution (Option A): Add aggressive visual warnings and failure-mode examples
to the tool description:
- ⚠️ CRITICAL warning header
- COMMON MISTAKE example showing what will FAIL
- CORRECT examples for both category and subagent_type usage
- Clear explanation that ONE must be provided
Tests: All 153 existing tests pass (no behavior change, only prompt improvement)
This commit is contained in:
parent
30491d769b
commit
121e1cb879
@ -54,27 +54,45 @@ export function createDelegateTask(options: DelegateTaskToolOptions): ToolDefini
|
|||||||
}).join("\n")
|
}).join("\n")
|
||||||
|
|
||||||
const description = `Spawn agent task with category-based or direct agent selection.
|
const description = `Spawn agent task with category-based or direct agent selection.
|
||||||
|
|
||||||
REQUIRED: You MUST provide EITHER category OR subagent_type (one of them is REQUIRED, but not both).
|
⚠️ CRITICAL: You MUST provide EITHER category OR subagent_type. Omitting BOTH will FAIL.
|
||||||
- If using a predefined category → provide category
|
|
||||||
- If using a specific agent → provide subagent_type
|
**COMMON MISTAKE (DO NOT DO THIS):**
|
||||||
- Providing NEITHER is INVALID and will fail.
|
\`\`\`
|
||||||
|
task(description="...", prompt="...", run_in_background=false) // ❌ FAILS - missing category AND subagent_type
|
||||||
- load_skills: ALWAYS REQUIRED. Pass at least one skill name.
|
\`\`\`
|
||||||
- category: Use predefined category → Spawns Sisyphus-Junior with category config
|
|
||||||
Available categories:
|
**CORRECT - Using category:**
|
||||||
${categoryList}
|
\`\`\`
|
||||||
- subagent_type: Use specific agent directly
|
task(category="quick", load_skills=[], description="Fix type error", prompt="...", run_in_background=false)
|
||||||
- run_in_background: true=async (returns task_id), false=sync (waits for result). Default: false. Use background=true ONLY for parallel exploration with 5+ independent queries.
|
\`\`\`
|
||||||
- session_id: Existing Task session to continue (from previous task output). Continues agent with FULL CONTEXT PRESERVED - saves tokens, maintains continuity.
|
|
||||||
- command: The command that triggered this task (optional, for slash command tracking).
|
**CORRECT - Using subagent_type:**
|
||||||
|
\`\`\`
|
||||||
**WHEN TO USE session_id:**
|
task(subagent_type="explore", load_skills=[], description="Find patterns", prompt="...", run_in_background=true)
|
||||||
- Task failed/incomplete → session_id with "fix: [specific issue]"
|
\`\`\`
|
||||||
- Need follow-up on previous result → session_id with additional question
|
|
||||||
- Multi-turn conversation with same agent → always session_id instead of new task
|
REQUIRED: Provide ONE of:
|
||||||
|
- category: For task delegation (uses Sisyphus-Junior with category-optimized model)
|
||||||
Prompts MUST be in English.`
|
- subagent_type: For direct agent invocation (explore, librarian, oracle, etc.)
|
||||||
|
|
||||||
|
**DO NOT provide both.** If category is provided, subagent_type is ignored.
|
||||||
|
|
||||||
|
- load_skills: ALWAYS REQUIRED. Pass [] if no skills needed, or ["skill-1", "skill-2"] for category tasks.
|
||||||
|
- category: Use predefined category → Spawns Sisyphus-Junior with category config
|
||||||
|
Available categories:
|
||||||
|
${categoryList}
|
||||||
|
- subagent_type: Use specific agent directly (explore, librarian, oracle, metis, momus)
|
||||||
|
- run_in_background: true=async (returns task_id), false=sync (waits). Default: false. Use background=true ONLY for parallel exploration with 5+ independent queries.
|
||||||
|
- session_id: Existing Task session to continue (from previous task output). Continues agent with FULL CONTEXT PRESERVED - saves tokens, maintains continuity.
|
||||||
|
- command: The command that triggered this task (optional, for slash command tracking).
|
||||||
|
|
||||||
|
**WHEN TO USE session_id:**
|
||||||
|
- Task failed/incomplete → session_id with "fix: [specific issue]"
|
||||||
|
- Need follow-up on previous result → session_id with additional question
|
||||||
|
- Multi-turn conversation with same agent → always session_id instead of new task
|
||||||
|
|
||||||
|
Prompts MUST be in English.`
|
||||||
|
|
||||||
return tool({
|
return tool({
|
||||||
description,
|
description,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user