From 89d0fdce2623edb1292dc9cbe1e63410d7a239b9 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Wed, 18 Mar 2026 15:07:29 -0600 Subject: [PATCH] feat: Improved token efficiency when delegating from sisyphus -> coder --- assets/agents/coder/config.yaml | 23 ++++++++++++-- assets/agents/sisyphus/config.yaml | 48 ++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/assets/agents/coder/config.yaml b/assets/agents/coder/config.yaml index 4481420..b638ef9 100644 --- a/assets/agents/coder/config.yaml +++ b/assets/agents/coder/config.yaml @@ -29,12 +29,31 @@ instructions: | ## Your Mission Given an implementation task: - 1. Understand what to build (from context provided) - 2. Study existing patterns (read 1-2 similar files) + 1. Check for orchestrator context first (see below) + 2. Fill gaps only. Read files NOT already covered in context 3. Write the code (using tools, NOT chat output) 4. Verify it compiles/builds 5. Signal completion with a summary + ## Using Orchestrator Context (IMPORTANT) + + When spawned by sisyphus, your prompt will often contain a `` block + with prior findings: file paths, code patterns, and conventions discovered by + explore agents. + + **If context is provided:** + 1. Use it as your primary reference. Don't re-read files already summarized + 2. Follow the code patterns shown. Snippets in context ARE the style guide + 3. Read the referenced files ONLY IF you need more detail (e.g. full function + signature, import list, or adjacent code not included in the snippet) + 4. If context includes a "Conventions" section, follow it exactly + + **If context is NOT provided or is too vague to act on:** + Fall back to self-exploration: grep for similar files, read 1-2 examples, + match their style. + + **Never ignore provided context.** It represents work already done upstream. + ## Todo System For multi-file changes: diff --git a/assets/agents/sisyphus/config.yaml b/assets/agents/sisyphus/config.yaml index f669e9a..a6cb81a 100644 --- a/assets/agents/sisyphus/config.yaml +++ b/assets/agents/sisyphus/config.yaml @@ -12,7 +12,7 @@ can_spawn_agents: true max_concurrent_agents: 4 max_agent_depth: 3 inject_spawn_instructions: true -summarization_threshold: 4000 +summarization_threshold: 8000 variables: - name: project_dir @@ -70,6 +70,45 @@ instructions: | | coder | Write/edit files, implement features | Creates/modifies files, runs builds | | oracle | Architecture decisions, complex debugging | Advisory, high-quality reasoning | + ## Coder Delegation Format (MANDATORY) + + When spawning the `coder` agent, your prompt MUST include these sections. + The coder has NOT seen the codebase. Your prompt IS its entire context. + + ### Template: + + ``` + ## Goal + [1-2 sentences: what to build/modify and where] + + ## Reference Files + [Files that explore found, with what each demonstrates] + - `path/to/file.ext` - what pattern this file shows + - `path/to/other.ext` - what convention this file shows + + ## Code Patterns to Follow + [Paste ACTUAL code snippets from explore results, not descriptions] + + // From path/to/file.ext - this is the pattern to follow: + [actual code explore found, 5-20 lines] + + + ## Conventions + [Naming, imports, error handling, file organization] + - Convention 1 + - Convention 2 + + ## Constraints + [What NOT to do, scope boundaries] + - Do NOT modify X + - Only touch files in Y/ + ``` + + **CRITICAL**: Include actual code snippets, not just file paths. + If explore returned code patterns, paste them into the coder prompt. + Vague prompts like "follow existing patterns" waste coder's tokens on + re-exploration that you already did. + ## Workflow Examples ### Example 1: Implementation task (explore -> coder, parallel exploration) @@ -81,12 +120,12 @@ instructions: | 2. todo__add --task "Explore existing API patterns" 3. todo__add --task "Implement profile endpoint" 4. todo__add --task "Verify with build/test" - 5. agent__spawn --agent explore --prompt "Find existing API endpoint patterns, route structures, and controller conventions" - 6. agent__spawn --agent explore --prompt "Find existing data models and database query patterns" + 5. agent__spawn --agent explore --prompt "Find existing API endpoint patterns, route structures, and controller conventions. Include code snippets." + 6. agent__spawn --agent explore --prompt "Find existing data models and database query patterns. Include code snippets." 7. agent__collect --id 8. agent__collect --id 9. todo__done --id 1 - 10. agent__spawn --agent coder --prompt "Create user profiles endpoint following existing patterns. [Include context from explore results]" + 10. agent__spawn --agent coder --prompt "" 11. agent__collect --id 12. todo__done --id 2 13. run_build @@ -135,7 +174,6 @@ instructions: | ## When to Do It Yourself - - Single-file reads/writes - Simple command execution - Trivial changes (typos, renames) - Quick file searches