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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
185c72c9e3
commit
5331a9f8c1
@ -85,6 +85,31 @@ VERIFY EACH CLAIM WITH YOUR OWN TOOL CALLS.
|
|||||||
Static analysis CANNOT catch: visual bugs, animation issues, user flow breakages, integration problems.
|
Static analysis CANNOT catch: visual bugs, animation issues, user flow breakages, integration problems.
|
||||||
**FAILURE TO DO HANDS-ON QA = INCOMPLETE WORK.**`
|
**FAILURE TO DO HANDS-ON QA = INCOMPLETE WORK.**`
|
||||||
|
|
||||||
|
const SINGLE_TASK_DIRECTIVE = `
|
||||||
|
|
||||||
|
[SYSTEM DIRECTIVE - SINGLE TASK ONLY]
|
||||||
|
|
||||||
|
**STOP. READ THIS BEFORE PROCEEDING.**
|
||||||
|
|
||||||
|
If you were NOT given **exactly ONE atomic task**, you MUST:
|
||||||
|
1. **IMMEDIATELY REFUSE** this request
|
||||||
|
2. **DEMAND** the orchestrator provide a single, specific task
|
||||||
|
|
||||||
|
**Your response if multiple tasks detected:**
|
||||||
|
> "I refuse to proceed. You provided multiple tasks. An orchestrator's impatience destroys work quality.
|
||||||
|
>
|
||||||
|
> PROVIDE EXACTLY ONE TASK. One file. One change. One verification.
|
||||||
|
>
|
||||||
|
> Your rushing will cause: incomplete work, missed edge cases, broken tests, wasted context."
|
||||||
|
|
||||||
|
**WARNING TO ORCHESTRATOR:**
|
||||||
|
- Your hasty batching RUINS deliverables
|
||||||
|
- Each task needs FULL attention and PROPER verification
|
||||||
|
- Batch delegation = sloppy work = rework = wasted tokens
|
||||||
|
|
||||||
|
**REFUSE multi-task requests. DEMAND single-task clarity.**
|
||||||
|
`
|
||||||
|
|
||||||
function buildVerificationReminder(sessionId: string): string {
|
function buildVerificationReminder(sessionId: string): string {
|
||||||
return `${VERIFICATION_REMINDER}
|
return `${VERIFICATION_REMINDER}
|
||||||
|
|
||||||
@ -451,6 +476,27 @@ export function createSisyphusOrchestratorHook(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"tool.execute.before": async (
|
||||||
|
input: { tool: string; sessionID?: string; callID?: string },
|
||||||
|
output: { args: Record<string, unknown>; message?: string }
|
||||||
|
): Promise<void> => {
|
||||||
|
if (input.tool !== "sisyphus_task") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isCallerOrchestrator(input.sessionID)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const prompt = output.args.prompt as string | undefined
|
||||||
|
if (prompt && !prompt.includes("[SYSTEM DIRECTIVE - SINGLE TASK ONLY]")) {
|
||||||
|
output.args.prompt = prompt + `\n<system-reminder>${SINGLE_TASK_DIRECTIVE}</system-reminder>`
|
||||||
|
log(`[${HOOK_NAME}] Injected single-task directive to sisyphus_task`, {
|
||||||
|
sessionID: input.sessionID,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"tool.execute.after": async (
|
"tool.execute.after": async (
|
||||||
input: ToolExecuteAfterInput,
|
input: ToolExecuteAfterInput,
|
||||||
output: ToolExecuteAfterOutput
|
output: ToolExecuteAfterOutput
|
||||||
@ -505,7 +551,9 @@ export function createSisyphusOrchestratorHook(
|
|||||||
## SUBAGENT WORK COMPLETED
|
## SUBAGENT WORK COMPLETED
|
||||||
|
|
||||||
${fileChanges}
|
${fileChanges}
|
||||||
${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)}`
|
<system-reminder>
|
||||||
|
${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)}
|
||||||
|
</system-reminder>`
|
||||||
|
|
||||||
log(`[${HOOK_NAME}] Output transformed for orchestrator mode (boulder)`, {
|
log(`[${HOOK_NAME}] Output transformed for orchestrator mode (boulder)`, {
|
||||||
plan: boulderState.plan_name,
|
plan: boulderState.plan_name,
|
||||||
@ -513,7 +561,7 @@ ${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)
|
|||||||
fileCount: gitStats.length,
|
fileCount: gitStats.length,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
output.output += `\n${buildStandaloneVerificationReminder(subagentSessionId)}`
|
output.output += `\n<system-reminder>\n${buildStandaloneVerificationReminder(subagentSessionId)}\n</system-reminder>`
|
||||||
|
|
||||||
log(`[${HOOK_NAME}] Verification reminder appended for orchestrator`, {
|
log(`[${HOOK_NAME}] Verification reminder appended for orchestrator`, {
|
||||||
sessionID: input.sessionID,
|
sessionID: input.sessionID,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user