diff --git a/src/agents/AGENTS.md b/src/agents/AGENTS.md index 60cddc5f..2713507a 100644 --- a/src/agents/AGENTS.md +++ b/src/agents/AGENTS.md @@ -2,20 +2,19 @@ ## OVERVIEW -7 AI agents for multi-model orchestration. Sisyphus orchestrates, specialists handle domains. +AI agent definitions for multi-model orchestration. 7 specialized agents: Sisyphus (orchestrator), oracle (strategy), librarian (research), explore (grep), frontend-ui-ux-engineer, document-writer, multimodal-looker. ## STRUCTURE ``` agents/ -├── sisyphus.ts # Primary orchestrator (504 lines) -├── oracle.ts # Strategic advisor -├── librarian.ts # Multi-repo research -├── explore.ts # Fast codebase grep -├── frontend-ui-ux-engineer.ts # UI generation -├── document-writer.ts # Technical docs -├── multimodal-looker.ts # PDF/image analysis -├── sisyphus-prompt-builder.ts # Sisyphus prompt construction +├── sisyphus.ts # Primary orchestrator (Claude Opus 4.5) +├── oracle.ts # Strategic advisor (GPT-5.2) +├── librarian.ts # Multi-repo research (Claude Sonnet 4.5) +├── explore.ts # Fast codebase grep (Grok Code) +├── frontend-ui-ux-engineer.ts # UI generation (Gemini 3 Pro) +├── document-writer.ts # Technical docs (Gemini 3 Flash) +├── multimodal-looker.ts # PDF/image analysis (Gemini 3 Flash) ├── build-prompt.ts # Shared build agent prompt ├── plan-prompt.ts # Shared plan agent prompt ├── types.ts # AgentModelConfig interface @@ -25,40 +24,68 @@ agents/ ## AGENT MODELS -| Agent | Model | Fallback | Purpose | -|-------|-------|----------|---------| -| Sisyphus | anthropic/claude-opus-4-5 | - | Orchestrator with extended thinking | -| oracle | openai/gpt-5.2 | - | Architecture, debugging, review | -| librarian | anthropic/claude-sonnet-4-5 | google/gemini-3-flash | Docs, GitHub research | -| explore | opencode/grok-code | gemini-3-flash, haiku-4-5 | Contextual grep | -| frontend-ui-ux-engineer | google/gemini-3-pro-preview | - | Beautiful UI code | +| Agent | Default Model | Fallback | Purpose | +|-------|---------------|----------|---------| +| Sisyphus | anthropic/claude-opus-4-5 | - | Primary orchestrator with extended thinking | +| oracle | openai/gpt-5.2 | - | Architecture, debugging, code review | +| librarian | anthropic/claude-sonnet-4-5 | google/gemini-3-flash | Docs, OSS research, GitHub examples | +| explore | opencode/grok-code | google/gemini-3-flash, anthropic/claude-haiku-4-5 | Fast contextual grep | +| frontend-ui-ux-engineer | google/gemini-3-pro-preview | - | UI/UX code generation | | document-writer | google/gemini-3-pro-preview | - | Technical writing | -| multimodal-looker | google/gemini-3-flash | - | Visual analysis | +| multimodal-looker | google/gemini-3-flash | - | PDF/image analysis | -## HOW TO ADD +## HOW TO ADD AN AGENT 1. Create `src/agents/my-agent.ts`: ```typescript + import type { AgentConfig } from "@opencode-ai/sdk" + export const myAgent: AgentConfig = { model: "provider/model-name", temperature: 0.1, - system: "...", - tools: { include: ["tool1"] }, + system: "Agent system prompt...", + tools: { include: ["tool1", "tool2"] }, // or exclude: [...] } ``` -2. Add to `builtinAgents` in index.ts -3. Update types.ts if new config options +2. Add to `builtinAgents` in `src/agents/index.ts` +3. Update `types.ts` if adding new config options -## MODEL FALLBACK +## AGENT CONFIG OPTIONS -`createBuiltinAgents()` handles fallback: -1. User config override -2. Installer settings (claude max20, gemini antigravity) -3. Default model +| Option | Type | Description | +|--------|------|-------------| +| model | string | Model identifier (provider/model-name) | +| temperature | number | 0.0-1.0, most use 0.1 for consistency | +| system | string | System prompt (can be multiline template literal) | +| tools | object | `{ include: [...] }` or `{ exclude: [...] }` | +| top_p | number | Optional nucleus sampling | +| maxTokens | number | Optional max output tokens | -## ANTI-PATTERNS +## MODEL FALLBACK LOGIC -- High temperature (>0.3) for code agents -- Broad tool access (prefer explicit `include`) -- Monolithic prompts (delegate to specialists) -- Missing fallbacks for rate-limited models +`createBuiltinAgents()` in utils.ts handles model fallback: + +1. Check user config override (`agents.{name}.model`) +2. Check installer settings (claude max20, gemini antigravity) +3. Use default model + +**Fallback order for explore**: +- If gemini antigravity enabled → `google/gemini-3-flash` +- If claude max20 enabled → `anthropic/claude-haiku-4-5` +- Default → `opencode/grok-code` (free) + +## ANTI-PATTERNS (AGENTS) + +- **High temperature**: Don't use >0.3 for code-related agents +- **Broad tool access**: Prefer explicit `include` over unrestricted access +- **Monolithic prompts**: Keep prompts focused; delegate to specialized agents +- **Missing fallbacks**: Consider free/cheap fallbacks for rate-limited models + +## SHARED PROMPTS + +- **build-prompt.ts**: Base prompt for build agents (OpenCode default + Sisyphus variants) +- **plan-prompt.ts**: Base prompt for plan agents (legacy) +- **prometheus-prompt.ts**: System prompt for Prometheus (Planner) agent +- **metis.ts**: Metis (Plan Consultant) agent for pre-planning analysis + +Used by `src/index.ts` when creating Builder-Sisyphus and Prometheus (Planner) variants. diff --git a/src/agents/index.ts b/src/agents/index.ts index b10ee264..16803440 100644 --- a/src/agents/index.ts +++ b/src/agents/index.ts @@ -6,6 +6,9 @@ import { exploreAgent } from "./explore" import { frontendUiUxEngineerAgent } from "./frontend-ui-ux-engineer" import { documentWriterAgent } from "./document-writer" import { multimodalLookerAgent } from "./multimodal-looker" +import { metisAgent } from "./metis" +import { orchestratorSisyphusAgent } from "./orchestrator-sisyphus" +import { momusAgent } from "./momus" export const builtinAgents: Record = { Sisyphus: sisyphusAgent, @@ -15,6 +18,9 @@ export const builtinAgents: Record = { "frontend-ui-ux-engineer": frontendUiUxEngineerAgent, "document-writer": documentWriterAgent, "multimodal-looker": multimodalLookerAgent, + "Metis (Plan Consultant)": metisAgent, + "Momus (Plan Reviewer)": momusAgent, + "orchestrator-sisyphus": orchestratorSisyphusAgent, } export * from "./types" diff --git a/src/agents/types.ts b/src/agents/types.ts index dcd08126..8cbe78d9 100644 --- a/src/agents/types.ts +++ b/src/agents/types.ts @@ -64,6 +64,9 @@ export type BuiltinAgentName = | "frontend-ui-ux-engineer" | "document-writer" | "multimodal-looker" + | "Metis (Plan Consultant)" + | "Momus (Plan Reviewer)" + | "orchestrator-sisyphus" export type OverridableAgentName = | "build"