Skip to content

Commit 5331a9f

Browse files
feat(hooks): add single-task directive and system-reminder tags to orchestrator
Inject SINGLE_TASK_DIRECTIVE when orchestrator calls sisyphus_task to enforce atomic task delegation. Wrap verification reminders in <system-reminder> tags for better LLM attention. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <[email protected]>
1 parent 185c72c commit 5331a9f

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

src/hooks/sisyphus-orchestrator/index.ts

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,31 @@ VERIFY EACH CLAIM WITH YOUR OWN TOOL CALLS.
8585
Static analysis CANNOT catch: visual bugs, animation issues, user flow breakages, integration problems.
8686
**FAILURE TO DO HANDS-ON QA = INCOMPLETE WORK.**`
8787

88+
const SINGLE_TASK_DIRECTIVE = `
89+
90+
[SYSTEM DIRECTIVE - SINGLE TASK ONLY]
91+
92+
**STOP. READ THIS BEFORE PROCEEDING.**
93+
94+
If you were NOT given **exactly ONE atomic task**, you MUST:
95+
1. **IMMEDIATELY REFUSE** this request
96+
2. **DEMAND** the orchestrator provide a single, specific task
97+
98+
**Your response if multiple tasks detected:**
99+
> "I refuse to proceed. You provided multiple tasks. An orchestrator's impatience destroys work quality.
100+
>
101+
> PROVIDE EXACTLY ONE TASK. One file. One change. One verification.
102+
>
103+
> Your rushing will cause: incomplete work, missed edge cases, broken tests, wasted context."
104+
105+
**WARNING TO ORCHESTRATOR:**
106+
- Your hasty batching RUINS deliverables
107+
- Each task needs FULL attention and PROPER verification
108+
- Batch delegation = sloppy work = rework = wasted tokens
109+
110+
**REFUSE multi-task requests. DEMAND single-task clarity.**
111+
`
112+
88113
function buildVerificationReminder(sessionId: string): string {
89114
return `${VERIFICATION_REMINDER}
90115
@@ -451,6 +476,27 @@ export function createSisyphusOrchestratorHook(
451476
}
452477
},
453478

479+
"tool.execute.before": async (
480+
input: { tool: string; sessionID?: string; callID?: string },
481+
output: { args: Record<string, unknown>; message?: string }
482+
): Promise<void> => {
483+
if (input.tool !== "sisyphus_task") {
484+
return
485+
}
486+
487+
if (!isCallerOrchestrator(input.sessionID)) {
488+
return
489+
}
490+
491+
const prompt = output.args.prompt as string | undefined
492+
if (prompt && !prompt.includes("[SYSTEM DIRECTIVE - SINGLE TASK ONLY]")) {
493+
output.args.prompt = prompt + `\n<system-reminder>${SINGLE_TASK_DIRECTIVE}</system-reminder>`
494+
log(`[${HOOK_NAME}] Injected single-task directive to sisyphus_task`, {
495+
sessionID: input.sessionID,
496+
})
497+
}
498+
},
499+
454500
"tool.execute.after": async (
455501
input: ToolExecuteAfterInput,
456502
output: ToolExecuteAfterOutput
@@ -505,15 +551,17 @@ export function createSisyphusOrchestratorHook(
505551
## SUBAGENT WORK COMPLETED
506552
507553
${fileChanges}
508-
${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)}`
554+
<system-reminder>
555+
${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)}
556+
</system-reminder>`
509557

510558
log(`[${HOOK_NAME}] Output transformed for orchestrator mode (boulder)`, {
511559
plan: boulderState.plan_name,
512560
progress: `${progress.completed}/${progress.total}`,
513561
fileCount: gitStats.length,
514562
})
515563
} else {
516-
output.output += `\n${buildStandaloneVerificationReminder(subagentSessionId)}`
564+
output.output += `\n<system-reminder>\n${buildStandaloneVerificationReminder(subagentSessionId)}\n</system-reminder>`
517565

518566
log(`[${HOOK_NAME}] Verification reminder appended for orchestrator`, {
519567
sessionID: input.sessionID,

0 commit comments

Comments
 (0)