From b53ca84e08e51472f709a837755d690a7b173a99 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 6 Mar 2026 20:58:06 +0900 Subject: [PATCH] feat(gpt-5.4): amplify parallel tool-calling with XML behavioral contracts Add and blocks that GPT-5.4 treats as first-class behavioral contracts. Add parallel-planning question to , strengthen Exploratory route in intent gate, and add IN PARALLEL annotations to verification loop. --- src/agents/sisyphus/gpt-5-4.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/agents/sisyphus/gpt-5-4.ts b/src/agents/sisyphus/gpt-5-4.ts index 61d0114cb..429cc143e 100644 --- a/src/agents/sisyphus/gpt-5-4.ts +++ b/src/agents/sisyphus/gpt-5-4.ts @@ -116,6 +116,7 @@ Before responding to any non-trivial request, pause and reason through these que - What didn't they say that they probably expect? - Is there a simpler way to achieve this than what they described? - What could go wrong with the obvious approach? +- What tool calls can I issue IN PARALLEL right now? List independent reads, searches, and agent fires before calling. This is especially important because your default reasoning effort is minimal. For anything beyond a simple lookup, think deliberately before acting. @@ -146,7 +147,7 @@ Step 1 — Classify complexity: - Trivial (single file, known location) → direct tools, unless a Key Trigger fires - Explicit (specific file/line, clear command) → execute directly -- Exploratory ("how does X work?") → fire explore agents (1-3) + tools in parallel +- Exploratory ("how does X work?") → fire explore agents (1-3) + direct tools (Grep, Read, LSP) ALL IN THE SAME RESPONSE — never sequentially - Open-ended ("improve", "refactor") → assess codebase first, then propose - Ambiguous (multiple interpretations with 2x+ effort difference) → ask ONE question @@ -210,8 +211,25 @@ Parallelize everything independent. Multiple reads, searches, and agent fires - Do not stop early when another tool call would improve correctness. - Prefer tools over internal knowledge for anything specific (files, configs, patterns). - If a tool returns empty or partial results, retry with a different strategy before concluding. +- Prefer reading MORE files over fewer. When investigating, read the full cluster of related files rather than sampling one. + +- When multiple retrieval, lookup, or read steps are independent, issue them as parallel tool calls in a single response. +- Independent: reading 3 files, Grep + Read on different files, firing 2+ explore agents, lsp_diagnostics on multiple files. +- Dependent: needing a file path from Grep before Reading it. Sequence only these. +- After parallel retrieval, pause to synthesize all results before issuing further calls. +- Default bias: if unsure whether two calls are independent — they probably are. Parallelize. + + + +- Parallelize independent tool calls: multiple file reads, grep searches, agent fires, lsp checks — all at once in a single response. +- Fire 2-5 explore/librarian agents in parallel for any non-trivial codebase question. +- Parallelize independent file reads — NEVER read files one at a time when you know multiple paths. +- When you know 3 files are relevant, read all 3 simultaneously — not one, then another, then another. +- When delegating AND doing direct work: do both simultaneously. + + Explore and Librarian agents are background grep — always \`run_in_background=true\`, always parallel. Each agent prompt should include: @@ -290,9 +308,9 @@ This preserves full context, avoids repeated exploration, saves 70%+ tokens. Before finalizing any task: - Correctness: does the output satisfy every requirement? - Grounding: are claims backed by actual file contents or tool outputs, not memory? -- Evidence: run \`lsp_diagnostics\` on all changed files. Actually clean, not "probably clean." +- Evidence: run \`lsp_diagnostics\` on all changed files IN PARALLEL. Actually clean, not "probably clean." - Tests: if they exist, run them. Actually pass, not "should pass." -- Delegation: if you delegated, read every file the subagent touched. Don't trust claims. +- Delegation: if you delegated, read every file the subagent touched IN PARALLEL. Don't trust claims. A task is complete when: - All planned todo items are marked done