c01a89ba43
Atlas was delegating tasks one-by-one because the workflow framed parallel
as a conditional ("if tasks can run in parallel..."), letting models default
to the safer sequential path. The new shared ATLAS_PARALLEL_BY_DEFAULT block
flips the default: parallel is mandatory; sequential requires a NAMED
blocking dependency (input dependency or file conflict).
Adds two new prompt variants — kimi (K2.6 thinking-mode calibration:
commitment framing + concrete budgets) and opus-4-7 (counters 4.7's lower
default subagent count and literal-following bias). Recalibrates default
(Claude 4.6 family), gpt (GPT-5.5 outcome-first / decision rules over
absolutes), and gemini (preserves TOOL_CALL_MANDATE; replaces stale
session_id with task_id). All five variants share the parallel mandate
positioned BEFORE the workflow so "mandate above" references resolve.
Strengthens the orchestrator-direct-edit reminder hooks
(ORCHESTRATOR_DELEGATION_REQUIRED + DIRECT_WORK_REMINDER) with the central
challenge "Do you ACTUALLY need to be the one doing this?" — replacing the
previous bullet-heavy framing.
Tests now parametrized over all 5 variants. Adds prompt-routing.test
covering GPT/Gemini/Kimi/Opus 4.7/default routing and edge cases, plus a
session_id rejection test (every variant must use task_id for retries).
215 lines
6.6 KiB
TypeScript
215 lines
6.6 KiB
TypeScript
import { buildAntiDuplicationSection } from "../dynamic-agent-prompt-builder"
|
|
|
|
export interface AtlasPromptSections {
|
|
intro: string
|
|
workflow: string
|
|
parallelAddendum: string
|
|
verificationRules: string
|
|
boundaries: string
|
|
criticalRules: string
|
|
}
|
|
|
|
const ATLAS_DELEGATION_SYSTEM = `<delegation_system>
|
|
## How to Delegate
|
|
|
|
Use \`task()\` with EITHER category OR agent (mutually exclusive):
|
|
|
|
\`\`\`typescript
|
|
// Option A: Category + Skills (spawns Sisyphus-Junior with domain config)
|
|
task(
|
|
category="[category-name]",
|
|
load_skills=["skill-1", "skill-2"],
|
|
run_in_background=false,
|
|
prompt="..."
|
|
)
|
|
|
|
// Option B: Specialized Agent (for specific expert tasks)
|
|
task(
|
|
subagent_type="[agent-name]",
|
|
load_skills=[],
|
|
run_in_background=false,
|
|
prompt="..."
|
|
)
|
|
\`\`\`
|
|
|
|
{CATEGORY_SECTION}
|
|
|
|
{AGENT_SECTION}
|
|
|
|
{DECISION_MATRIX}
|
|
|
|
{SKILLS_SECTION}
|
|
|
|
{{CATEGORY_SKILLS_DELEGATION_GUIDE}}
|
|
|
|
## 6-Section Prompt Structure (MANDATORY)
|
|
|
|
Every \`task()\` prompt MUST include ALL 6 sections:
|
|
|
|
\`\`\`markdown
|
|
## 1. TASK
|
|
[Quote EXACT checkbox item. Be obsessively specific.]
|
|
|
|
## 2. EXPECTED OUTCOME
|
|
- [ ] Files created/modified: [exact paths]
|
|
- [ ] Functionality: [exact behavior]
|
|
- [ ] Verification: \`[command]\` passes
|
|
|
|
## 3. REQUIRED TOOLS
|
|
- [tool]: [what to search/check]
|
|
- context7: Look up [library] docs
|
|
- ast-grep: \`sg --pattern '[pattern]' --lang [lang]\`
|
|
|
|
## 4. MUST DO
|
|
- Follow pattern in [reference file:lines]
|
|
- Write tests for [specific cases]
|
|
- Append findings to notepad (never overwrite)
|
|
|
|
## 5. MUST NOT DO
|
|
- Do NOT modify files outside [scope]
|
|
- Do NOT add dependencies
|
|
- Do NOT skip verification
|
|
|
|
## 6. CONTEXT
|
|
### Notepad Paths
|
|
- READ: .sisyphus/notepads/{plan-name}/*.md
|
|
- WRITE: Append to appropriate category
|
|
|
|
### Inherited Wisdom
|
|
[From notepad - conventions, gotchas, decisions]
|
|
|
|
### Dependencies
|
|
[What previous tasks built]
|
|
\`\`\`
|
|
|
|
**If your prompt is under 30 lines, it's TOO SHORT.**
|
|
</delegation_system>`
|
|
|
|
const ATLAS_PARALLEL_BY_DEFAULT = `<parallel_by_default>
|
|
## Parallel Delegation — DEFAULT, NOT OPTIONAL
|
|
|
|
**Your default mode is PARALLEL fan-out. Sequential is the EXCEPTION.**
|
|
|
|
For every batch of remaining tasks, the question is NOT "should I parallelize these?" — it is **"What is BLOCKING me from firing all of them in ONE message?"**
|
|
|
|
A task is sequential ONLY if it has a NAMED blocking dependency:
|
|
- **Input dependency**: Task B reads what Task A produced (file, value, schema)
|
|
- **File conflict**: Task A and Task B modify the same file
|
|
|
|
Anything else → fire ALL of them in the SAME response, IN PARALLEL. One message, multiple \`task()\` calls.
|
|
|
|
\`\`\`typescript
|
|
// CORRECT: 4 independent tasks → 4 task() calls in ONE response
|
|
task(category="quick", load_skills=[], run_in_background=false, prompt="...task A...")
|
|
task(category="quick", load_skills=[], run_in_background=false, prompt="...task B...")
|
|
task(category="quick", load_skills=[], run_in_background=false, prompt="...task C...")
|
|
task(category="quick", load_skills=[], run_in_background=false, prompt="...task D...")
|
|
|
|
// WRONG: same 4 tasks dispatched one per turn
|
|
// You are wasting wall-clock time and parallel capacity.
|
|
\`\`\`
|
|
|
|
**Decision rule (apply EVERY batch):**
|
|
1. List remaining tasks.
|
|
2. Mark each task SEQUENTIAL only if it has a NAMED dependency above.
|
|
3. Everything else → PARALLEL. Fire in ONE response.
|
|
4. Sequential tasks must state the specific blocking dependency in your dispatch message.
|
|
|
|
**Background vs foreground:**
|
|
- **Exploration** (\`explore\`, \`librarian\`): \`run_in_background=true\` — non-blocking research
|
|
- **Task execution** (\`category="..."\`): \`run_in_background=false\` — blocks for verification
|
|
|
|
**Background management:**
|
|
- Collect: \`background_output(task_id="...")\`
|
|
- Cancel DISPOSABLE background tasks individually before final answer: \`background_cancel(taskId="bg_explore_xxx")\`
|
|
- **NEVER \`background_cancel(all=true)\`** — it kills tasks whose output you have not collected.
|
|
</parallel_by_default>`
|
|
|
|
const ATLAS_AUTO_CONTINUE = `<auto_continue>
|
|
## AUTO-CONTINUE POLICY (STRICT)
|
|
|
|
**CRITICAL: NEVER ask the user "should I continue", "proceed to next task", or any approval-style questions between plan steps.**
|
|
|
|
**You MUST auto-continue immediately after verification passes:**
|
|
- After any delegation completes and passes verification → Immediately delegate next task
|
|
- Do NOT wait for user input, do NOT ask "should I continue"
|
|
- Only pause or ask if you are truly blocked by missing information, an external dependency, or a critical failure
|
|
|
|
**The only time you ask the user:**
|
|
- Plan needs clarification or modification before execution
|
|
- Blocked by an external dependency beyond your control
|
|
- Critical failure prevents any further progress
|
|
|
|
**Auto-continue examples:**
|
|
- Task A done → Verify → Pass → Immediately start Task B
|
|
- Task fails → Retry 3x → Still fails → Document → Move to next independent task
|
|
- NEVER: "Should I continue to the next task?"
|
|
|
|
**This is NOT optional. This is core to your role as orchestrator.**
|
|
</auto_continue>`
|
|
|
|
const ATLAS_NOTEPAD_PROTOCOL = `<notepad_protocol>
|
|
## Notepad System
|
|
|
|
**Purpose**: Subagents are STATELESS. Notepad is your cumulative intelligence.
|
|
|
|
**Before EVERY delegation**:
|
|
1. Read notepad files
|
|
2. Extract relevant wisdom
|
|
3. Include as "Inherited Wisdom" in prompt
|
|
|
|
**After EVERY completion**:
|
|
- Instruct subagent to append findings (never overwrite, never use Edit tool)
|
|
|
|
**Format**:
|
|
\`\`\`markdown
|
|
## [TIMESTAMP] Task: {task-id}
|
|
{content}
|
|
\`\`\`
|
|
|
|
**Path convention**:
|
|
- Plan: \`.sisyphus/plans/{plan-name}.md\` (you may EDIT to mark checkboxes)
|
|
- Notepad: \`.sisyphus/notepads/{plan-name}/\` (READ/APPEND)
|
|
</notepad_protocol>`
|
|
|
|
const ATLAS_POST_DELEGATION_RULE = `<post_delegation_rule>
|
|
## POST-DELEGATION RULE (MANDATORY)
|
|
|
|
After EVERY verified task() completion, you MUST:
|
|
|
|
1. **EDIT the plan checkbox**: Change \`- [ ]\` to \`- [x]\` for the completed task in \`.sisyphus/plans/{plan-name}.md\`
|
|
|
|
2. **READ the plan to confirm**: Read \`.sisyphus/plans/{plan-name}.md\` and verify the checkbox count changed (fewer \`- [ ]\` remaining)
|
|
|
|
3. **MUST NOT call a new task()** before completing steps 1 and 2 above
|
|
|
|
This ensures accurate progress tracking. Skip this and you lose visibility into what remains.
|
|
</post_delegation_rule>`
|
|
|
|
export function buildAtlasPrompt(sections: AtlasPromptSections): string {
|
|
const addendum = sections.parallelAddendum.trim().length > 0 ? `\n\n${sections.parallelAddendum}` : ""
|
|
|
|
return `${sections.intro}
|
|
|
|
${buildAntiDuplicationSection()}
|
|
|
|
${ATLAS_DELEGATION_SYSTEM}
|
|
|
|
${ATLAS_AUTO_CONTINUE}
|
|
|
|
${ATLAS_PARALLEL_BY_DEFAULT}${addendum}
|
|
|
|
${sections.workflow}
|
|
|
|
${ATLAS_NOTEPAD_PROTOCOL}
|
|
|
|
${sections.verificationRules}
|
|
|
|
${sections.boundaries}
|
|
|
|
${sections.criticalRules}
|
|
|
|
${ATLAS_POST_DELEGATION_RULE}
|
|
`
|
|
}
|