diff --git a/src/agents/hephaestus.ts b/src/agents/hephaestus.ts index e1c9a436..1ac55275 100644 --- a/src/agents/hephaestus.ts +++ b/src/agents/hephaestus.ts @@ -1,6 +1,11 @@ -import type { AgentConfig } from "@opencode-ai/sdk" -import type { AgentMode } from "./types" -import type { AvailableAgent, AvailableTool, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder" +import type { AgentConfig } from "@opencode-ai/sdk"; +import type { AgentMode } from "./types"; +import type { + AvailableAgent, + AvailableTool, + AvailableSkill, + AvailableCategory, +} from "./dynamic-agent-prompt-builder"; import { buildKeyTriggersSection, buildToolSelectionTable, @@ -12,9 +17,9 @@ import { buildHardBlocksSection, buildAntiPatternsSection, categorizeTools, -} from "./dynamic-agent-prompt-builder" +} from "./dynamic-agent-prompt-builder"; -const MODE: AgentMode = "primary" +const MODE: AgentMode = "primary"; function buildTodoDisciplineSection(useTaskSystem: boolean): string { if (useTaskSystem) { @@ -52,7 +57,7 @@ function buildTodoDisciplineSection(useTaskSystem: boolean): string { | Proceeding without \`in_progress\` | No indication of current work | | Finishing without completing tasks | Task appears incomplete | -**NO TASKS ON MULTI-STEP WORK = INCOMPLETE WORK.**` +**NO TASKS ON MULTI-STEP WORK = INCOMPLETE WORK.**`; } return `## Todo Discipline (NON-NEGOTIABLE) @@ -89,7 +94,7 @@ function buildTodoDisciplineSection(useTaskSystem: boolean): string { | Proceeding without \`in_progress\` | No indication of current work | | Finishing without completing todos | Task appears incomplete | -**NO TODOS ON MULTI-STEP WORK = INCOMPLETE WORK.**` +**NO TODOS ON MULTI-STEP WORK = INCOMPLETE WORK.**`; } /** @@ -111,18 +116,25 @@ function buildHephaestusPrompt( availableTools: AvailableTool[] = [], availableSkills: AvailableSkill[] = [], availableCategories: AvailableCategory[] = [], - useTaskSystem = false + useTaskSystem = false, ): string { - const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills) - const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills) - const exploreSection = buildExploreSection(availableAgents) - const librarianSection = buildLibrarianSection(availableAgents) - const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills) - const delegationTable = buildDelegationTable(availableAgents) - const oracleSection = buildOracleSection(availableAgents) - const hardBlocks = buildHardBlocksSection() - const antiPatterns = buildAntiPatternsSection() - const todoDiscipline = buildTodoDisciplineSection(useTaskSystem) + const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills); + const toolSelection = buildToolSelectionTable( + availableAgents, + availableTools, + availableSkills, + ); + const exploreSection = buildExploreSection(availableAgents); + const librarianSection = buildLibrarianSection(availableAgents); + const categorySkillsGuide = buildCategorySkillsDelegationGuide( + availableCategories, + availableSkills, + ); + const delegationTable = buildDelegationTable(availableAgents); + const oracleSection = buildOracleSection(availableAgents); + const hardBlocks = buildHardBlocksSection(); + const antiPatterns = buildAntiPatternsSection(); + const todoDiscipline = buildTodoDisciplineSection(useTaskSystem); return `You are Hephaestus, an autonomous deep worker for software engineering. @@ -226,6 +238,7 @@ Agent: *runs gh pr list, gh pr view, searches recent commits* ### Step 3: Validate Before Acting **Delegation Check (MANDATORY before acting directly):** +0. Find relevant skills that you can load, and load them IMMEDIATELY. 1. Is there a specialized agent that perfectly matches this request? 2. If not, is there a \`task\` category that best describes this task? What skills are available to equip the agent with? - MUST FIND skills to use: \`task(load_skills=[{skill1}, ...])\` @@ -411,9 +424,13 @@ Every \`task()\` output includes a session_id. **USE IT.** **After EVERY delegation, STORE the session_id for potential continuation.** -${oracleSection ? ` +${ + oracleSection + ? ` ${oracleSection} -` : ""} +` + : "" +} ## Role & Agency (CRITICAL - READ CAREFULLY) @@ -591,7 +608,7 @@ When working on long sessions or complex multi-file tasks: ## Soft Guidelines - Prefer existing libraries over new dependencies -- Prefer small, focused changes over large refactors` +- Prefer small, focused changes over large refactors`; } export function createHephaestusAgent( @@ -600,14 +617,20 @@ export function createHephaestusAgent( availableToolNames?: string[], availableSkills?: AvailableSkill[], availableCategories?: AvailableCategory[], - useTaskSystem = false + useTaskSystem = false, ): AgentConfig { - const tools = availableToolNames ? categorizeTools(availableToolNames) : [] - const skills = availableSkills ?? [] - const categories = availableCategories ?? [] + const tools = availableToolNames ? categorizeTools(availableToolNames) : []; + const skills = availableSkills ?? []; + const categories = availableCategories ?? []; const prompt = availableAgents - ? buildHephaestusPrompt(availableAgents, tools, skills, categories, useTaskSystem) - : buildHephaestusPrompt([], tools, skills, categories, useTaskSystem) + ? buildHephaestusPrompt( + availableAgents, + tools, + skills, + categories, + useTaskSystem, + ) + : buildHephaestusPrompt([], tools, skills, categories, useTaskSystem); return { description: @@ -617,8 +640,11 @@ export function createHephaestusAgent( maxTokens: 32000, prompt, color: "#D97706", // Forged Amber - Golden heated metal, divine craftsman - permission: { question: "allow", call_omo_agent: "deny" } as AgentConfig["permission"], + permission: { + question: "allow", + call_omo_agent: "deny", + } as AgentConfig["permission"], reasoningEffort: "medium", - } + }; } -createHephaestusAgent.mode = MODE +createHephaestusAgent.mode = MODE; diff --git a/src/agents/sisyphus.ts b/src/agents/sisyphus.ts index 1a6fac44..11ecdc34 100644 --- a/src/agents/sisyphus.ts +++ b/src/agents/sisyphus.ts @@ -1,15 +1,20 @@ -import type { AgentConfig } from "@opencode-ai/sdk" -import type { AgentMode, AgentPromptMetadata } from "./types" -import { isGptModel } from "./types" +import type { AgentConfig } from "@opencode-ai/sdk"; +import type { AgentMode, AgentPromptMetadata } from "./types"; +import { isGptModel } from "./types"; -const MODE: AgentMode = "primary" +const MODE: AgentMode = "primary"; export const SISYPHUS_PROMPT_METADATA: AgentPromptMetadata = { category: "utility", cost: "EXPENSIVE", promptAlias: "Sisyphus", triggers: [], -} -import type { AvailableAgent, AvailableTool, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder" +}; +import type { + AvailableAgent, + AvailableTool, + AvailableSkill, + AvailableCategory, +} from "./dynamic-agent-prompt-builder"; import { buildKeyTriggersSection, buildToolSelectionTable, @@ -21,7 +26,7 @@ import { buildHardBlocksSection, buildAntiPatternsSection, categorizeTools, -} from "./dynamic-agent-prompt-builder" +} from "./dynamic-agent-prompt-builder"; function buildTaskManagementSection(useTaskSystem: boolean): string { if (useTaskSystem) { @@ -80,7 +85,7 @@ I want to make sure I understand correctly. Should I proceed with [recommendation], or would you prefer differently? \`\`\` -` +`; } return ` @@ -138,7 +143,7 @@ I want to make sure I understand correctly. Should I proceed with [recommendation], or would you prefer differently? \`\`\` -` +`; } function buildDynamicSisyphusPrompt( @@ -146,21 +151,28 @@ function buildDynamicSisyphusPrompt( availableTools: AvailableTool[] = [], availableSkills: AvailableSkill[] = [], availableCategories: AvailableCategory[] = [], - useTaskSystem = false + useTaskSystem = false, ): string { - const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills) - const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills) - const exploreSection = buildExploreSection(availableAgents) - const librarianSection = buildLibrarianSection(availableAgents) - const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills) - const delegationTable = buildDelegationTable(availableAgents) - const oracleSection = buildOracleSection(availableAgents) - const hardBlocks = buildHardBlocksSection() - const antiPatterns = buildAntiPatternsSection() - const taskManagementSection = buildTaskManagementSection(useTaskSystem) + const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills); + const toolSelection = buildToolSelectionTable( + availableAgents, + availableTools, + availableSkills, + ); + const exploreSection = buildExploreSection(availableAgents); + const librarianSection = buildLibrarianSection(availableAgents); + const categorySkillsGuide = buildCategorySkillsDelegationGuide( + availableCategories, + availableSkills, + ); + const delegationTable = buildDelegationTable(availableAgents); + const oracleSection = buildOracleSection(availableAgents); + const hardBlocks = buildHardBlocksSection(); + const antiPatterns = buildAntiPatternsSection(); + const taskManagementSection = buildTaskManagementSection(useTaskSystem); const todoHookNote = useTaskSystem ? "YOUR TASK CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TASK CONTINUATION])" - : "YOUR TODO CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TODO CONTINUATION])" + : "YOUR TODO CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TODO CONTINUATION])"; return ` You are "Sisyphus" - Powerful AI Agent with orchestration capabilities from OhMyOpenCode. @@ -315,6 +327,7 @@ STOP searching when: ## Phase 2B - Implementation ### Pre-Implementation: +0. Find relevant skills that you can load, and load them IMMEDIATELY. 1. If task has 2+ steps → Create todo list IMMEDIATELY, IN SUPER DETAIL. No announcements—just create it. 2. Mark current task \`in_progress\` before starting 3. Mark \`completed\` as soon as done (don't batch) - OBSESSIVELY TRACK YOUR WORK USING TODO TOOLS @@ -497,7 +510,7 @@ ${antiPatterns} - Prefer small, focused changes over large refactors - When uncertain about scope, ask -` +`; } export function createSisyphusAgent( @@ -506,16 +519,25 @@ export function createSisyphusAgent( availableToolNames?: string[], availableSkills?: AvailableSkill[], availableCategories?: AvailableCategory[], - useTaskSystem = false + useTaskSystem = false, ): AgentConfig { - const tools = availableToolNames ? categorizeTools(availableToolNames) : [] - const skills = availableSkills ?? [] - const categories = availableCategories ?? [] + const tools = availableToolNames ? categorizeTools(availableToolNames) : []; + const skills = availableSkills ?? []; + const categories = availableCategories ?? []; const prompt = availableAgents - ? buildDynamicSisyphusPrompt(availableAgents, tools, skills, categories, useTaskSystem) - : buildDynamicSisyphusPrompt([], tools, skills, categories, useTaskSystem) + ? buildDynamicSisyphusPrompt( + availableAgents, + tools, + skills, + categories, + useTaskSystem, + ) + : buildDynamicSisyphusPrompt([], tools, skills, categories, useTaskSystem); - const permission = { question: "allow", call_omo_agent: "deny" } as AgentConfig["permission"] + const permission = { + question: "allow", + call_omo_agent: "deny", + } as AgentConfig["permission"]; const base = { description: "Powerful AI orchestrator. Plans obsessively with todos, assesses search complexity before exploration, delegates strategically via category+skills combinations. Uses explore for internal code (parallel-friendly), librarian for external docs. (Sisyphus - OhMyOpenCode)", @@ -525,12 +547,12 @@ export function createSisyphusAgent( prompt, color: "#00CED1", permission, - } + }; if (isGptModel(model)) { - return { ...base, reasoningEffort: "medium" } + return { ...base, reasoningEffort: "medium" }; } - return { ...base, thinking: { type: "enabled", budgetTokens: 32000 } } + return { ...base, thinking: { type: "enabled", budgetTokens: 32000 } }; } -createSisyphusAgent.mode = MODE +createSisyphusAgent.mode = MODE;