refactor: migrate delegate_task to task tool with metadata fixes
- Rename delegate_task tool to task across codebase (100 files) - Update model references: claude-opus-4-6 → 4-5, gpt-5.3-codex → 5.2-codex - Add tool-metadata-store to restore metadata overwritten by fromPlugin() - Add session ID polling for BackgroundManager task sessions - Await async ctx.metadata() calls in tool executors - Add ses_ prefix guard to getMessageDir for performance - Harden BackgroundManager with idle deferral and error handling - Fix duplicate task key in sisyphus-junior test object literals - Fix unawaited showOutputToUser in ast_grep_replace - Fix background=true → run_in_background=true in ultrawork prompt - Fix duplicate task/task references in docs and comments
This commit is contained in:
@@ -24,7 +24,7 @@ export const TARGET_TOOLS = new Set([
|
||||
export const AGENT_TOOLS = new Set([
|
||||
"task",
|
||||
"call_omo_agent",
|
||||
"delegate_task",
|
||||
"task",
|
||||
]);
|
||||
|
||||
export const REMINDER_MESSAGE = `
|
||||
@@ -32,13 +32,13 @@ export const REMINDER_MESSAGE = `
|
||||
|
||||
You called a search/fetch tool directly without leveraging specialized agents.
|
||||
|
||||
RECOMMENDED: Use delegate_task with explore/librarian agents for better results:
|
||||
RECOMMENDED: Use task with explore/librarian agents for better results:
|
||||
|
||||
\`\`\`
|
||||
// Parallel exploration - fire multiple agents simultaneously
|
||||
delegate_task(agent="explore", prompt="Find all files matching pattern X")
|
||||
delegate_task(agent="explore", prompt="Search for implementation of Y")
|
||||
delegate_task(agent="librarian", prompt="Lookup documentation for Z")
|
||||
task(agent="explore", prompt="Find all files matching pattern X")
|
||||
task(agent="explore", prompt="Search for implementation of Y")
|
||||
task(agent="librarian", prompt="Lookup documentation for Z")
|
||||
|
||||
// Then continue your work while they run in background
|
||||
// System will notify you when each completes
|
||||
@@ -50,5 +50,5 @@ WHY:
|
||||
- Specialized agents have domain expertise
|
||||
- Reduces context window usage in main session
|
||||
|
||||
ALWAYS prefer: Multiple parallel delegate_task calls > Direct tool calls
|
||||
ALWAYS prefer: Multiple parallel task calls > Direct tool calls
|
||||
`;
|
||||
|
||||
@@ -86,7 +86,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when - calling with undefined output
|
||||
const result = await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID: "session-123" },
|
||||
{ tool: "task", sessionID: "session-123" },
|
||||
undefined as unknown as { title: string; output: string; metadata: Record<string, unknown> }
|
||||
)
|
||||
|
||||
@@ -94,8 +94,8 @@ describe("atlas hook", () => {
|
||||
expect(result).toBeUndefined()
|
||||
})
|
||||
|
||||
test("should ignore non-delegate_task tools", async () => {
|
||||
// given - hook and non-delegate_task tool
|
||||
test("should ignore non-task tools", async () => {
|
||||
// given - hook and non-task tool
|
||||
const hook = createAtlasHook(createMockPluginInput())
|
||||
const output = {
|
||||
title: "Test Tool",
|
||||
@@ -138,7 +138,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -162,14 +162,14 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
// then - standalone verification reminder appended
|
||||
expect(output.output).toContain("Task completed successfully")
|
||||
expect(output.output).toContain("MANDATORY:")
|
||||
expect(output.output).toContain("delegate_task(session_id=")
|
||||
expect(output.output).toContain("task(session_id=")
|
||||
|
||||
cleanupMessageStorage(sessionID)
|
||||
})
|
||||
@@ -199,7 +199,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -208,7 +208,7 @@ describe("atlas hook", () => {
|
||||
expect(output.output).toContain("SUBAGENT WORK COMPLETED")
|
||||
expect(output.output).toContain("test-plan")
|
||||
expect(output.output).toContain("LIE")
|
||||
expect(output.output).toContain("delegate_task(session_id=")
|
||||
expect(output.output).toContain("task(session_id=")
|
||||
|
||||
cleanupMessageStorage(sessionID)
|
||||
})
|
||||
@@ -238,7 +238,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -275,7 +275,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -311,7 +311,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -348,7 +348,7 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
@@ -385,12 +385,12 @@ describe("atlas hook", () => {
|
||||
|
||||
// when
|
||||
await hook["tool.execute.after"](
|
||||
{ tool: "delegate_task", sessionID },
|
||||
{ tool: "task", sessionID },
|
||||
output
|
||||
)
|
||||
|
||||
// then - should include session_id instructions and verification
|
||||
expect(output.output).toContain("delegate_task(session_id=")
|
||||
expect(output.output).toContain("task(session_id=")
|
||||
expect(output.output).toContain("[x]")
|
||||
expect(output.output).toContain("MANDATORY:")
|
||||
|
||||
@@ -425,8 +425,8 @@ describe("atlas hook", () => {
|
||||
|
||||
// then
|
||||
expect(output.output).toContain("ORCHESTRATOR, not an IMPLEMENTER")
|
||||
expect(output.output).toContain("delegate_task")
|
||||
expect(output.output).toContain("delegate_task")
|
||||
expect(output.output).toContain("task")
|
||||
expect(output.output).toContain("task")
|
||||
})
|
||||
|
||||
test("should append delegation reminder when orchestrator edits outside .sisyphus/", async () => {
|
||||
|
||||
+10
-10
@@ -44,7 +44,7 @@ You just performed direct file modifications outside \`.sisyphus/\`.
|
||||
**You are an ORCHESTRATOR, not an IMPLEMENTER.**
|
||||
|
||||
As an orchestrator, you should:
|
||||
- **DELEGATE** implementation work to subagents via \`delegate_task\`
|
||||
- **DELEGATE** implementation work to subagents via \`task\`
|
||||
- **VERIFY** the work done by subagents
|
||||
- **COORDINATE** multiple tasks and ensure completion
|
||||
|
||||
@@ -54,7 +54,7 @@ You should NOT:
|
||||
- Implement features yourself
|
||||
|
||||
**If you need to make changes:**
|
||||
1. Use \`delegate_task\` to delegate to an appropriate subagent
|
||||
1. Use \`task\` to delegate to an appropriate subagent
|
||||
2. Provide clear instructions in the prompt
|
||||
3. Verify the subagent's work after completion
|
||||
|
||||
@@ -128,7 +128,7 @@ You (Atlas) are attempting to directly modify a file outside \`.sisyphus/\`.
|
||||
**THIS IS FORBIDDEN** (except for VERIFICATION purposes)
|
||||
|
||||
As an ORCHESTRATOR, you MUST:
|
||||
1. **DELEGATE** all implementation work via \`delegate_task\`
|
||||
1. **DELEGATE** all implementation work via \`task\`
|
||||
2. **VERIFY** the work done by subagents (reading files is OK)
|
||||
3. **COORDINATE** - you orchestrate, you don't implement
|
||||
|
||||
@@ -146,11 +146,11 @@ As an ORCHESTRATOR, you MUST:
|
||||
|
||||
**IF THIS IS FOR VERIFICATION:**
|
||||
Proceed if you are verifying subagent work by making a small fix.
|
||||
But for any substantial changes, USE \`delegate_task\`.
|
||||
But for any substantial changes, USE \`task\`.
|
||||
|
||||
**CORRECT APPROACH:**
|
||||
\`\`\`
|
||||
delegate_task(
|
||||
task(
|
||||
category="...",
|
||||
prompt="[specific single task with clear acceptance criteria]"
|
||||
)
|
||||
@@ -193,7 +193,7 @@ function buildVerificationReminder(sessionId: string): string {
|
||||
|
||||
**If ANY verification fails, use this immediately:**
|
||||
\`\`\`
|
||||
delegate_task(session_id="${sessionId}", prompt="fix: [describe the specific failure]")
|
||||
task(session_id="${sessionId}", prompt="fix: [describe the specific failure]")
|
||||
\`\`\``
|
||||
}
|
||||
|
||||
@@ -688,12 +688,12 @@ export function createAtlasHook(
|
||||
return
|
||||
}
|
||||
|
||||
// Check delegate_task - inject single-task directive
|
||||
if (input.tool === "delegate_task") {
|
||||
// Check task - inject single-task directive
|
||||
if (input.tool === "task") {
|
||||
const prompt = output.args.prompt as string | undefined
|
||||
if (prompt && !prompt.includes(SYSTEM_DIRECTIVE_PREFIX)) {
|
||||
output.args.prompt = `<system-reminder>${SINGLE_TASK_DIRECTIVE}</system-reminder>\n` + prompt
|
||||
log(`[${HOOK_NAME}] Injected single-task directive to delegate_task`, {
|
||||
log(`[${HOOK_NAME}] Injected single-task directive to task`, {
|
||||
sessionID: input.sessionID,
|
||||
})
|
||||
}
|
||||
@@ -732,7 +732,7 @@ export function createAtlasHook(
|
||||
return
|
||||
}
|
||||
|
||||
if (input.tool !== "delegate_task") {
|
||||
if (input.tool !== "task") {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe("category-skill-reminder hook", () => {
|
||||
|
||||
// then - reminder should be injected
|
||||
expect(output.output).toContain("[Category+Skill Reminder]")
|
||||
expect(output.output).toContain("delegate_task")
|
||||
expect(output.output).toContain("task")
|
||||
|
||||
clearSessionAgent(sessionID)
|
||||
})
|
||||
@@ -130,16 +130,16 @@ describe("category-skill-reminder hook", () => {
|
||||
})
|
||||
|
||||
describe("delegation tool tracking", () => {
|
||||
test("should NOT inject reminder if delegate_task is used", async () => {
|
||||
// given - sisyphus agent that uses delegate_task
|
||||
test("should NOT inject reminder if task is used", async () => {
|
||||
// given - sisyphus agent that uses task
|
||||
const hook = createHook()
|
||||
const sessionID = "delegation-session"
|
||||
updateSessionAgent(sessionID, "Sisyphus")
|
||||
|
||||
const output = { title: "", output: "result", metadata: {} }
|
||||
|
||||
// when - delegate_task is used, then more tool calls
|
||||
await hook["tool.execute.after"]({ tool: "delegate_task", sessionID, callID: "1" }, output)
|
||||
// when - task is used, then more tool calls
|
||||
await hook["tool.execute.after"]({ tool: "task", sessionID, callID: "1" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "2" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "3" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "4" }, output)
|
||||
@@ -329,15 +329,15 @@ describe("category-skill-reminder hook", () => {
|
||||
})
|
||||
|
||||
test("should handle delegation tool names case-insensitively", async () => {
|
||||
// given - sisyphus agent using DELEGATE_TASK in uppercase
|
||||
// given - sisyphus agent using TASK in uppercase
|
||||
const hook = createHook()
|
||||
const sessionID = "case-delegate-session"
|
||||
updateSessionAgent(sessionID, "Sisyphus")
|
||||
|
||||
const output = { title: "", output: "result", metadata: {} }
|
||||
|
||||
// when - DELEGATE_TASK in uppercase is used
|
||||
await hook["tool.execute.after"]({ tool: "DELEGATE_TASK", sessionID, callID: "1" }, output)
|
||||
// when - TASK in uppercase is used
|
||||
await hook["tool.execute.after"]({ tool: "TASK", sessionID, callID: "1" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "2" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "3" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "4" }, output)
|
||||
|
||||
@@ -30,9 +30,8 @@ const DELEGATABLE_WORK_TOOLS = new Set([
|
||||
* Tools that indicate the agent is already using delegation properly.
|
||||
*/
|
||||
const DELEGATION_TOOLS = new Set([
|
||||
"delegate_task",
|
||||
"call_omo_agent",
|
||||
"task",
|
||||
"task",
|
||||
"call_omo_agent",
|
||||
])
|
||||
|
||||
function formatSkillNames(skills: AvailableSkill[], limit: number): string {
|
||||
@@ -63,7 +62,7 @@ function buildReminderMessage(availableSkills: AvailableSkill[]): string {
|
||||
"> User-installed skills OVERRIDE built-in defaults. ALWAYS prefer YOUR SKILLS when domain matches.",
|
||||
"",
|
||||
"```typescript",
|
||||
`delegate_task(category=\"visual-engineering\", load_skills=${loadSkills}, run_in_background=true)`,
|
||||
`task(category=\"visual-engineering\", load_skills=${loadSkills}, run_in_background=true)`,
|
||||
"```",
|
||||
"",
|
||||
]
|
||||
|
||||
@@ -257,7 +257,7 @@ export function createClaudeCodeHooksHook(
|
||||
const cachedInput = getToolInput(input.sessionID, input.tool, input.callID) || {}
|
||||
|
||||
// Use metadata if available and non-empty, otherwise wrap output.output in a structured object
|
||||
// This ensures plugin tools (call_omo_agent, delegate_task, task) that return strings
|
||||
// This ensures plugin tools (call_omo_agent, task) that return strings
|
||||
// get their results properly recorded in transcripts instead of empty {}
|
||||
const metadata = output.metadata as Record<string, unknown> | undefined
|
||||
const hasMetadata = metadata && typeof metadata === "object" && Object.keys(metadata).length > 0
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
describe("sisyphus-task-retry", () => {
|
||||
describe("DELEGATE_TASK_ERROR_PATTERNS", () => {
|
||||
// given error patterns are defined
|
||||
// then should include all known delegate_task error types
|
||||
// then should include all known task error types
|
||||
it("should contain all known error patterns", () => {
|
||||
expect(DELEGATE_TASK_ERROR_PATTERNS.length).toBeGreaterThan(5)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export const DELEGATE_TASK_ERROR_PATTERNS: DelegateTaskErrorPattern[] = [
|
||||
{
|
||||
pattern: "Cannot call primary agent",
|
||||
errorType: "primary_agent",
|
||||
fixHint: "Primary agents cannot be called via delegate_task. Use a subagent like 'explore', 'oracle', or 'librarian'",
|
||||
fixHint: "Primary agents cannot be called via task. Use a subagent like 'explore', 'oracle', or 'librarian'",
|
||||
},
|
||||
{
|
||||
pattern: "Skills not found",
|
||||
@@ -85,11 +85,11 @@ export function buildRetryGuidance(errorInfo: DetectedError): string {
|
||||
)
|
||||
|
||||
if (!pattern) {
|
||||
return `[delegate_task ERROR] Fix the error and retry with correct parameters.`
|
||||
return `[task ERROR] Fix the error and retry with correct parameters.`
|
||||
}
|
||||
|
||||
let guidance = `
|
||||
[delegate_task CALL FAILED - IMMEDIATE RETRY REQUIRED]
|
||||
[task CALL FAILED - IMMEDIATE RETRY REQUIRED]
|
||||
|
||||
**Error Type**: ${errorInfo.errorType}
|
||||
**Fix**: ${pattern.fixHint}
|
||||
@@ -101,11 +101,11 @@ export function buildRetryGuidance(errorInfo: DetectedError): string {
|
||||
}
|
||||
|
||||
guidance += `
|
||||
**Action**: Retry delegate_task NOW with corrected parameters.
|
||||
**Action**: Retry task NOW with corrected parameters.
|
||||
|
||||
Example of CORRECT call:
|
||||
\`\`\`
|
||||
delegate_task(
|
||||
task(
|
||||
description="Task description",
|
||||
prompt="Detailed prompt...",
|
||||
category="unspecified-low", // OR subagent_type="explore"
|
||||
@@ -124,7 +124,7 @@ export function createDelegateTaskRetryHook(_ctx: PluginInput) {
|
||||
input: { tool: string; sessionID: string; callID: string },
|
||||
output: { title: string; output: string; metadata: unknown }
|
||||
) => {
|
||||
if (input.tool.toLowerCase() !== "delegate_task") return
|
||||
if (input.tool.toLowerCase() !== "task") return
|
||||
|
||||
const errorInfo = detectDelegateTaskError(output.output)
|
||||
if (errorInfo) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export function createEmptyTaskResponseDetectorHook(_ctx: PluginInput) {
|
||||
input: { tool: string; sessionID: string; callID: string },
|
||||
output: { title: string; output: string; metadata: unknown }
|
||||
) => {
|
||||
if (input.tool !== "Task") return
|
||||
if (input.tool !== "Task" && input.tool !== "task") return
|
||||
|
||||
const responseText = output.output?.trim() ?? ""
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Default ultrawork message optimized for Claude series models.
|
||||
*
|
||||
* Key characteristics:
|
||||
* - Natural tool-like usage of explore/librarian agents (background=true)
|
||||
* - Natural tool-like usage of explore/librarian agents (run_in_background=true)
|
||||
* - Parallel execution emphasized - fire agents and continue working
|
||||
* - Simple workflow: EXPLORES → GATHER → PLAN → DELEGATE
|
||||
*/
|
||||
@@ -44,9 +44,9 @@ export const ULTRAWORK_DEFAULT_MESSAGE = `<ultrawork-mode>
|
||||
|
||||
**WHEN IN DOUBT:**
|
||||
\`\`\`
|
||||
delegate_task(subagent_type="explore", load_skills=[], prompt="Find [X] patterns in codebase", run_in_background=true)
|
||||
delegate_task(subagent_type="librarian", load_skills=[], prompt="Find docs/examples for [Y]", run_in_background=true)
|
||||
delegate_task(subagent_type="oracle", load_skills=[], prompt="Review my approach: [describe plan]", run_in_background=false)
|
||||
task(subagent_type="explore", load_skills=[], prompt="Find [X] patterns in codebase", run_in_background=true)
|
||||
task(subagent_type="librarian", load_skills=[], prompt="Find docs/examples for [Y]", run_in_background=true)
|
||||
task(subagent_type="oracle", load_skills=[], prompt="Review my approach: [describe plan]", run_in_background=false)
|
||||
\`\`\`
|
||||
|
||||
**ONLY AFTER YOU HAVE:**
|
||||
@@ -104,7 +104,7 @@ TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
||||
| Architecture decision needed | MUST call plan agent |
|
||||
|
||||
\`\`\`
|
||||
delegate_task(subagent_type="plan", prompt="<gathered context + user request>")
|
||||
task(subagent_type="plan", prompt="<gathered context + user request>")
|
||||
\`\`\`
|
||||
|
||||
**WHY PLAN AGENT IS MANDATORY:**
|
||||
@@ -119,9 +119,9 @@ delegate_task(subagent_type="plan", prompt="<gathered context + user request>")
|
||||
|
||||
| Scenario | Action |
|
||||
|----------|--------|
|
||||
| Plan agent asks clarifying questions | \`delegate_task(session_id="{returned_session_id}", prompt="<your answer>")\` |
|
||||
| Need to refine the plan | \`delegate_task(session_id="{returned_session_id}", prompt="Please adjust: <feedback>")\` |
|
||||
| Plan needs more detail | \`delegate_task(session_id="{returned_session_id}", prompt="Add more detail to Task N")\` |
|
||||
| Plan agent asks clarifying questions | \`task(session_id="{returned_session_id}", prompt="<your answer>")\` |
|
||||
| Need to refine the plan | \`task(session_id="{returned_session_id}", prompt="Please adjust: <feedback>")\` |
|
||||
| Plan needs more detail | \`task(session_id="{returned_session_id}", prompt="Add more detail to Task N")\` |
|
||||
|
||||
**WHY SESSION_ID IS CRITICAL:**
|
||||
- Plan agent retains FULL conversation context
|
||||
@@ -131,10 +131,10 @@ delegate_task(subagent_type="plan", prompt="<gathered context + user request>")
|
||||
|
||||
\`\`\`
|
||||
// WRONG: Starting fresh loses all context
|
||||
delegate_task(subagent_type="plan", prompt="Here's more info...")
|
||||
task(subagent_type="plan", prompt="Here's more info...")
|
||||
|
||||
// CORRECT: Resume preserves everything
|
||||
delegate_task(session_id="ses_abc123", prompt="Here's my answer to your question: ...")
|
||||
task(session_id="ses_abc123", prompt="Here's my answer to your question: ...")
|
||||
\`\`\`
|
||||
|
||||
**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**
|
||||
@@ -147,23 +147,23 @@ delegate_task(session_id="ses_abc123", prompt="Here's my answer to your question
|
||||
|
||||
| Task Type | Action | Why |
|
||||
|-----------|--------|-----|
|
||||
| Codebase exploration | delegate_task(subagent_type="explore", run_in_background=true) | Parallel, context-efficient |
|
||||
| Documentation lookup | delegate_task(subagent_type="librarian", run_in_background=true) | Specialized knowledge |
|
||||
| Planning | delegate_task(subagent_type="plan") | Parallel task graph + structured TODO list |
|
||||
| Hard problem (conventional) | delegate_task(subagent_type="oracle") | Architecture, debugging, complex logic |
|
||||
| Hard problem (non-conventional) | delegate_task(category="artistry", load_skills=[...]) | Different approach needed |
|
||||
| Implementation | delegate_task(category="...", load_skills=[...]) | Domain-optimized models |
|
||||
| Codebase exploration | task(subagent_type="explore", run_in_background=true) | Parallel, context-efficient |
|
||||
| Documentation lookup | task(subagent_type="librarian", run_in_background=true) | Specialized knowledge |
|
||||
| Planning | task(subagent_type="plan") | Parallel task graph + structured TODO list |
|
||||
| Hard problem (conventional) | task(subagent_type="oracle") | Architecture, debugging, complex logic |
|
||||
| Hard problem (non-conventional) | task(category="artistry", load_skills=[...]) | Different approach needed |
|
||||
| Implementation | task(category="...", load_skills=[...]) | Domain-optimized models |
|
||||
|
||||
**CATEGORY + SKILL DELEGATION:**
|
||||
\`\`\`
|
||||
// Frontend work
|
||||
delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux"])
|
||||
task(category="visual-engineering", load_skills=["frontend-ui-ux"])
|
||||
|
||||
// Complex logic
|
||||
delegate_task(category="ultrabrain", load_skills=["typescript-programmer"])
|
||||
task(category="ultrabrain", load_skills=["typescript-programmer"])
|
||||
|
||||
// Quick fixes
|
||||
delegate_task(category="quick", load_skills=["git-master"])
|
||||
task(category="quick", load_skills=["git-master"])
|
||||
\`\`\`
|
||||
|
||||
**YOU SHOULD ONLY DO IT YOURSELF WHEN:**
|
||||
@@ -177,14 +177,14 @@ delegate_task(category="quick", load_skills=["git-master"])
|
||||
|
||||
## EXECUTION RULES
|
||||
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.
|
||||
- **PARALLEL**: Fire independent agent calls simultaneously via delegate_task(background=true) - NEVER wait sequentially.
|
||||
- **BACKGROUND FIRST**: Use delegate_task for exploration/research agents (10+ concurrent if needed).
|
||||
- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.
|
||||
- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).
|
||||
- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.
|
||||
- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.
|
||||
|
||||
## WORKFLOW
|
||||
1. Analyze the request and identify required capabilities
|
||||
2. Spawn exploration/librarian agents via delegate_task(background=true) in PARALLEL (10+ if needed)
|
||||
2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL (10+ if needed)
|
||||
3. Use Plan agent with gathered context to create detailed work breakdown
|
||||
4. Execute with continuous verification against original requirements
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ Use these when they provide clear value based on the decision framework above:
|
||||
|
||||
| Resource | When to Use | How to Use |
|
||||
|----------|-------------|------------|
|
||||
| explore agent | Need codebase patterns you don't have | \`delegate_task(subagent_type="explore", run_in_background=true, ...)\` |
|
||||
| librarian agent | External library docs, OSS examples | \`delegate_task(subagent_type="librarian", run_in_background=true, ...)\` |
|
||||
| oracle agent | Stuck on architecture/debugging after 2+ attempts | \`delegate_task(subagent_type="oracle", ...)\` |
|
||||
| plan agent | Complex multi-step with dependencies (5+ steps) | \`delegate_task(subagent_type="plan", ...)\` |
|
||||
| delegate_task category | Specialized work matching a category | \`delegate_task(category="...", load_skills=[...])\` |
|
||||
| explore agent | Need codebase patterns you don't have | \`task(subagent_type="explore", run_in_background=true, ...)\` |
|
||||
| librarian agent | External library docs, OSS examples | \`task(subagent_type="librarian", run_in_background=true, ...)\` |
|
||||
| oracle agent | Stuck on architecture/debugging after 2+ attempts | \`task(subagent_type="oracle", ...)\` |
|
||||
| plan agent | Complex multi-step with dependencies (5+ steps) | \`task(subagent_type="plan", ...)\` |
|
||||
| task category | Specialized work matching a category | \`task(category="...", load_skills=[...])\` |
|
||||
|
||||
<tool_usage_rules>
|
||||
- Prefer tools over internal knowledge for fresh or user-specific data
|
||||
@@ -97,8 +97,8 @@ Use these when they provide clear value based on the decision framework above:
|
||||
**ALWAYS run both tracks in parallel:**
|
||||
\`\`\`
|
||||
// Fire background agents for deep exploration
|
||||
delegate_task(subagent_type="explore", load_skills=[], prompt="Find X patterns...", run_in_background=true)
|
||||
delegate_task(subagent_type="librarian", load_skills=[], prompt="Find docs for Y...", run_in_background=true)
|
||||
task(subagent_type="explore", load_skills=[], prompt="Find X patterns...", run_in_background=true)
|
||||
task(subagent_type="librarian", load_skills=[], prompt="Find docs for Y...", run_in_background=true)
|
||||
|
||||
// WHILE THEY RUN - use direct tools for immediate context
|
||||
grep(pattern="relevant_pattern", path="src/")
|
||||
|
||||
@@ -14,7 +14,7 @@ You ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO N
|
||||
| Write/Edit | \`.sisyphus/**/*.md\` ONLY | Everything else |
|
||||
| Read | All files | - |
|
||||
| Bash | Research commands only | Implementation commands |
|
||||
| delegate_task | explore, librarian | - |
|
||||
| task | explore, librarian | - |
|
||||
|
||||
**IF YOU TRY TO WRITE/EDIT OUTSIDE \`.sisyphus/\`:**
|
||||
- System will BLOCK your action
|
||||
@@ -38,9 +38,9 @@ You ARE the planner. Your job: create bulletproof work plans.
|
||||
### Research Protocol
|
||||
1. **Fire parallel background agents** for comprehensive context:
|
||||
\`\`\`
|
||||
delegate_task(agent="explore", prompt="Find existing patterns for [topic] in codebase", background=true)
|
||||
delegate_task(agent="explore", prompt="Find test infrastructure and conventions", background=true)
|
||||
delegate_task(agent="librarian", prompt="Find official docs and best practices for [technology]", background=true)
|
||||
task(agent="explore", prompt="Find existing patterns for [topic] in codebase", background=true)
|
||||
task(agent="explore", prompt="Find test infrastructure and conventions", background=true)
|
||||
task(agent="librarian", prompt="Find official docs and best practices for [technology]", background=true)
|
||||
\`\`\`
|
||||
2. **Wait for results** before planning - rushed plans fail
|
||||
3. **Synthesize findings** into informed requirements
|
||||
@@ -117,9 +117,9 @@ Each TODO item MUST include:
|
||||
|
||||
| Wave | Tasks | Dispatch Command |
|
||||
|------|-------|------------------|
|
||||
| 1 | 1, 4 | \`delegate_task(category="...", load_skills=[...], run_in_background=false)\` × 2 |
|
||||
| 2 | 2, 3, 5 | \`delegate_task(...)\` × 3 after Wave 1 completes |
|
||||
| 3 | 6 | \`delegate_task(...)\` final integration |
|
||||
| 1 | 1, 4 | \`task(category="...", load_skills=[...], run_in_background=false)\` × 2 |
|
||||
| 2 | 2, 3, 5 | \`task(...)\` × 3 after Wave 1 completes |
|
||||
| 3 | 6 | \`task(...)\` final integration |
|
||||
|
||||
**WHY PARALLEL TASK GRAPH IS MANDATORY:**
|
||||
- Orchestrator (Sisyphus) executes tasks in parallel waves
|
||||
|
||||
@@ -51,14 +51,14 @@ ${createSystemDirective(SystemDirectiveTypes.PROMETHEUS_READ_ONLY)}
|
||||
│ │ - Record decisions to .sisyphus/drafts/ │
|
||||
├──────┼──────────────────────────────────────────────────────────────┤
|
||||
│ 2 │ METIS CONSULTATION: Pre-generation gap analysis │
|
||||
│ │ - delegate_task(agent="Metis (Plan Consultant)", ...) │
|
||||
│ │ - task(agent="Metis (Plan Consultant)", ...) │
|
||||
│ │ - Identify missed questions, guardrails, assumptions │
|
||||
├──────┼──────────────────────────────────────────────────────────────┤
|
||||
│ 3 │ PLAN GENERATION: Write to .sisyphus/plans/*.md │
|
||||
│ │ <- YOU ARE HERE │
|
||||
├──────┼──────────────────────────────────────────────────────────────┤
|
||||
│ 4 │ MOMUS REVIEW (if high accuracy requested) │
|
||||
│ │ - delegate_task(agent="Momus (Plan Reviewer)", ...) │
|
||||
│ │ - task(agent="Momus (Plan Reviewer)", ...) │
|
||||
│ │ - Loop until OKAY verdict │
|
||||
├──────┼──────────────────────────────────────────────────────────────┤
|
||||
│ 5 │ SUMMARY: Present to user │
|
||||
|
||||
@@ -227,11 +227,11 @@ describe("prometheus-md-only", () => {
|
||||
).resolves.toBeUndefined()
|
||||
})
|
||||
|
||||
test("should inject read-only warning when Prometheus calls delegate_task", async () => {
|
||||
test("should inject read-only warning when Prometheus calls task", async () => {
|
||||
// given
|
||||
const hook = createPrometheusMdOnlyHook(createMockPluginInput())
|
||||
const input = {
|
||||
tool: "delegate_task",
|
||||
tool: "task",
|
||||
sessionID: TEST_SESSION_ID,
|
||||
callID: "call-1",
|
||||
}
|
||||
@@ -289,7 +289,7 @@ describe("prometheus-md-only", () => {
|
||||
// given
|
||||
const hook = createPrometheusMdOnlyHook(createMockPluginInput())
|
||||
const input = {
|
||||
tool: "delegate_task",
|
||||
tool: "task",
|
||||
sessionID: TEST_SESSION_ID,
|
||||
callID: "call-1",
|
||||
}
|
||||
@@ -330,11 +330,11 @@ describe("prometheus-md-only", () => {
|
||||
).resolves.toBeUndefined()
|
||||
})
|
||||
|
||||
test("should not inject warning for non-Prometheus agents calling delegate_task", async () => {
|
||||
test("should not inject warning for non-Prometheus agents calling task", async () => {
|
||||
// given
|
||||
const hook = createPrometheusMdOnlyHook(createMockPluginInput())
|
||||
const input = {
|
||||
tool: "delegate_task",
|
||||
tool: "task",
|
||||
sessionID: TEST_SESSION_ID,
|
||||
callID: "call-1",
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ function getMessageDir(sessionID: string): string | null {
|
||||
return null
|
||||
}
|
||||
|
||||
const TASK_TOOLS = ["delegate_task", "task", "call_omo_agent"]
|
||||
const TASK_TOOLS = ["task", "call_omo_agent"]
|
||||
|
||||
function getAgentFromMessageFiles(sessionID: string): string | undefined {
|
||||
const messageDir = getMessageDir(sessionID)
|
||||
|
||||
@@ -12,8 +12,8 @@ export function createSisyphusJuniorNotepadHook(ctx: PluginInput) {
|
||||
input: { tool: string; sessionID: string; callID: string },
|
||||
output: { args: Record<string, unknown>; message?: string }
|
||||
): Promise<void> => {
|
||||
// 1. Check if tool is delegate_task
|
||||
if (input.tool !== "delegate_task") {
|
||||
// 1. Check if tool is task
|
||||
if (input.tool !== "task") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function createSisyphusJuniorNotepadHook(ctx: PluginInput) {
|
||||
output.args.prompt = NOTEPAD_DIRECTIVE + prompt
|
||||
|
||||
// 6. Log injection
|
||||
log(`[${HOOK_NAME}] Injected notepad directive to delegate_task`, {
|
||||
log(`[${HOOK_NAME}] Injected notepad directive to task`, {
|
||||
sessionID: input.sessionID,
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const TARGET_TOOLS = ["task", "Task", "task_tool", "call_omo_agent", "delegate_task"]
|
||||
const TARGET_TOOLS = ["task", "Task", "task_tool", "call_omo_agent"]
|
||||
|
||||
const SESSION_ID_PATTERNS = [
|
||||
/Session ID: (ses_[a-zA-Z0-9_-]+)/,
|
||||
@@ -27,7 +27,7 @@ export function createTaskResumeInfoHook() {
|
||||
const sessionId = extractSessionId(output.output)
|
||||
if (!sessionId) return
|
||||
|
||||
output.output = output.output.trimEnd() + `\n\nto continue: delegate_task(session_id="${sessionId}", prompt="...")`
|
||||
output.output = output.output.trimEnd() + `\n\nto continue: task(session_id="${sessionId}", prompt="...")`
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -16,7 +16,7 @@ export const REPLACEMENT_MESSAGE = `TodoRead/TodoWrite are DISABLED because expe
|
||||
3. DO THE WORK
|
||||
4. TaskUpdate({ id: "T-xxx", status: "completed" })
|
||||
|
||||
CRITICAL: 1 task = 1 delegate_task. Fire independent tasks concurrently.
|
||||
CRITICAL: 1 task = 1 task. Fire independent tasks concurrently.
|
||||
|
||||
**STOP! DO NOT START WORKING DIRECTLY - NO MATTER HOW SMALL THE TASK!**
|
||||
Even if the task seems trivial (1 line fix, simple edit, quick change), you MUST:
|
||||
|
||||
Reference in New Issue
Block a user