|
|
@@ -27,9 +27,8 @@ export function resolvePrompt(
|
|
|
// Agent descriptions for the orchestrator prompt
|
|
|
const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
explorer: `@explorer
|
|
|
-- Lane: Codebase discovery and reconnaissance
|
|
|
-- Role: Parallel search specialist for discovering unknowns across the codebase
|
|
|
-- Permissions: Read files
|
|
|
+- Lane: Fast codebase recon that returns compressed context
|
|
|
+- Permissions: read_files
|
|
|
- Stats: 2x faster codebase search than orchestrator, 1/2 cost of orchestrator
|
|
|
- Capabilities: Glob, grep, AST queries to locate files, symbols, patterns
|
|
|
- **Delegate when:** Need to discover what exists before planning • Parallel searches speed discovery • Need summarized map vs full contents • Broad/uncertain scope
|
|
|
@@ -37,10 +36,8 @@ const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
|
|
|
librarian: `@librarian
|
|
|
- Lane: External knowledge and library research, fast web research
|
|
|
-- Role: Authoritative source for current library docs and API references, web information retrieval
|
|
|
-- Permissions: External docs/search MCPs; no file edits
|
|
|
-- Stats: 10x better finding up-to-date library docs than orchestrator, 1/2 cost of orchestrator
|
|
|
-- Capabilities: Fetches latest official docs, examples, API signatures, version-specific behavior via grep_app MCP
|
|
|
+- Role: Authoritative source for current library docs, API references, examples, bug investigations, and web retrieval
|
|
|
+- Stats: 2x faster web research than orchestrator, 1/2 cost of orchestrator
|
|
|
- **Delegate when:** Libraries with frequent API changes (React, Next.js, AI SDKs) • Complex APIs needing official examples (ORMs, auth) • Version-specific behavior matters • Unfamiliar library • Edge cases or advanced features • Nuanced best practices • Working on fixing tricky bug or problem and need latest web research information
|
|
|
- **Don't delegate when:** Standard usage you're confident • Simple stable APIs • General programming knowledge • Info already in conversation • Built-in language features
|
|
|
- **Rule of thumb:** "How does this library work?" → @librarian. "How does programming work?" → answer directly. How does others solve or workaround this tricky issue?" → @librarian.`,
|
|
|
@@ -48,7 +45,7 @@ const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
oracle: `@oracle
|
|
|
- Lane: Architecture, risk, debugging strategy, and review
|
|
|
- Role: Strategic advisor for high-stakes decisions and persistent problems, code reviewer
|
|
|
-- Permissions: Read files
|
|
|
+- Permissions: read_files
|
|
|
- Stats: 5x better decision maker, problem solver, investigator than orchestrator, 0.8x speed of orchestrator, same cost.
|
|
|
- Capabilities: Deep architectural reasoning, system-level trade-offs, complex debugging, code review, simplification, maintainability review
|
|
|
- **Delegate when:** Major architectural decisions with long-term impact • Problems persisting after 2+ fix attempts • High-risk multi-system refactors • Costly trade-offs (performance vs maintainability) • Complex debugging with unclear root cause • Security/scalability/data integrity decisions • Genuinely uncertain and cost of wrong choice is high • When a workflow calls for a **reviewer** subagent • Code needs simplification or YAGNI scrutiny
|
|
|
@@ -56,9 +53,8 @@ const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
- **Rule of thumb:** Need senior architect review? → @oracle. Need code review or simplification? → @oracle. Routine coordination or final synthesis? → handle directly.`,
|
|
|
|
|
|
designer: `@designer
|
|
|
-- Lane: UI/UX design, related edits, design polishign, and review
|
|
|
-- Role: UI/UX specialist for intentional, polished experiences
|
|
|
-- Permissions: Read/write files
|
|
|
+- Lane: UI/UX design, related edits, design polish and review
|
|
|
+- Permissions: read_files, write_files
|
|
|
- Stats: 10x better UI/UX than orchestrator
|
|
|
- Capabilities: Goot design taste, visual relevant edits, interactions, responsive layouts, design systems with aesthetic intent, deep UI/UX knowledge.
|
|
|
- Weakness: copywriting, needs Orchestrator control, dictation, reviews
|
|
|
@@ -67,14 +63,14 @@ const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
- **Rule of thumb:** Users see it and polish matters? → @designer. Headless/functional implementation? → schedule @fixer.`,
|
|
|
|
|
|
fixer: `@fixer
|
|
|
-- Lane: Bounded implementation and test execution.
|
|
|
-- Role: Fast execution specialist for well-defined tasks.
|
|
|
-- Permissions: Read/write files
|
|
|
-- Stats: 2x faster code edits, 1/2 cost of orchestrator, 0.8x quality of orchestrator
|
|
|
-- Weakness: design taste
|
|
|
+- Lane: Bounded implementation and executioner
|
|
|
+- Role: Fast execution specialist for well-defined tasks
|
|
|
+- Permissions: read_files, write_files
|
|
|
+- Stats: 2x faster code edits, 1/2 cost of orchestrator
|
|
|
+- Weakness: design, taste
|
|
|
- Tools/Constraints: Execution-focused—no research, no architectural decisions
|
|
|
-- **Delegate when:** For implementation work, think and triage first. If the change is non-trivial or multi-file, hand bounded execution to @fixer • Writing or updating tests • Tasks that touch test files, fixtures, mocks, or test helpers. Parallelization benefits: Task involves multiple folders and multiple files modification, scoping work per folder and spawning parallel @fixers for each folder.
|
|
|
-- **Don't delegate when:** Needs discovery/research/decisions • Single small change (<20 lines, one file) • Unclear requirements needing iteration • Explaining to fixer > doing • Tight integration with your current work • Sequential dependencies
|
|
|
+- **Delegate when:** For implementation work, think and triage first. If the change is non-trivial or multi-file, hand bounded execution to @fixer • Parallelization benefits: Task involves multiple folders and multiple files modification, scoping work per folder and spawning parallel @fixers for each folder.
|
|
|
+- **Don't delegate when:** Needs discovery/research/decisions • Single small change (<20 lines, one file) • Unclear requirements needing iteration • Explaining to fixer > doing • Tight integration with your current work
|
|
|
- **Rule of thumb:** Implementation are needed, schedule @fixer with clear scope. Bigger or lots of edits should be split by ownership and dispatched as parallel background fixer lanes when safe.`,
|
|
|
|
|
|
council: `@council
|
|
|
@@ -104,7 +100,7 @@ const AGENT_DESCRIPTIONS: Record<string, string> = {
|
|
|
// Validation routing lines that reference agents
|
|
|
const VALIDATION_ROUTING = [
|
|
|
'- Route UI/UX validation and review to @designer',
|
|
|
- '- Route code review, simplification, maintainability review, and YAGNI checks to @oracle',
|
|
|
+ '- Route code review, code simplification and maintainability review checks to @oracle',
|
|
|
'- Route implementation to @fixer or multiple @fixer instances for maximum parallel execution',
|
|
|
'- Route visual/media analysis and interpretation to @observer',
|
|
|
'- If a request spans multiple lanes, delegate only the lanes that add clear value',
|
|
|
@@ -150,6 +146,7 @@ export function buildOrchestratorPrompt(disabledAgents?: Set<string>): string {
|
|
|
You are a workflow manager for coding work. Your job is to plan, schedule, delegate, monitor, reconcile, and verify specialist-agent work. You are not the default implementation worker.
|
|
|
|
|
|
Optimize for quality, speed, cost, and reliability by dispatching the right specialist lanes, tracking background task state, and integrating terminal results into one coherent outcome.
|
|
|
+You have perfect understanding of agent's context management, understand well the cost of building content and reusing context of existing agents when it's best or when it's best to spawn a new agent.
|
|
|
</Role>
|
|
|
|
|
|
<Agents>
|
|
|
@@ -176,10 +173,11 @@ Classify work into lanes: discovery, external knowledge, implementation, UI/UX,
|
|
|
|
|
|
**Dispatch efficiency:**
|
|
|
- Reference paths/lines, don't paste files (\`src/app.ts:42\` not full contents)
|
|
|
-- Provide context summaries, let specialists read what they need
|
|
|
- Brief user on delegation goal before each call
|
|
|
-- Keep direct work limited to clarification, minimal routing context, todos, synthesis, and final checks
|
|
|
- For trivial conversational answers or tiny mechanical edits, direct execution is allowed when scheduling overhead would clearly dominate
|
|
|
+- Record task IDs, state, and advisory ownership/dependency labels
|
|
|
+- Poll/wait for terminal results with \`task_status(wait: true, timeout_ms: ...)\`
|
|
|
+- Reconcile results, resolve conflicts, and gate dependent lanes
|
|
|
|
|
|
## 4. Plan and Parallelize
|
|
|
Build a short work graph before dispatching:
|
|
|
@@ -202,17 +200,6 @@ Balance: respect dependencies, avoid parallelizing what must be sequential, and
|
|
|
- Parallel background tasks are allowed only when their write scopes do not conflict.
|
|
|
- Final response requires relevant tasks to be terminal and reconciled.
|
|
|
|
|
|
-## 5. Dispatch
|
|
|
-1. Split work into independent and dependency-ordered lanes
|
|
|
-2. Plan advisory ownership for write-capable lanes
|
|
|
-3. Dispatch independent specialists as background tasks
|
|
|
-4. Record task IDs, state, and advisory ownership/dependency labels
|
|
|
-5. Continue only independent orchestration while jobs run
|
|
|
-6. Poll/wait for terminal results with \`task_status(wait: true, timeout_ms: ...)\`
|
|
|
-7. Reconcile results, resolve conflicts, and gate dependent lanes
|
|
|
-8. Dispatch follow-up jobs if needed
|
|
|
-9. Verify final state
|
|
|
-
|
|
|
### Session Reuse
|
|
|
- Smartly reuse an available specialist session - context reuse saves time and tokens
|
|
|
- When too much unrelated, and really needed, start a fresh session with the specialist
|