make agents to load skills more

This commit is contained in:
YeonGyu-Kim 2026-02-14 12:43:52 +09:00
parent c8cd6370e2
commit ac99f98b27
2 changed files with 111 additions and 63 deletions

View File

@ -1,6 +1,11 @@
import type { AgentConfig } from "@opencode-ai/sdk" import type { AgentConfig } from "@opencode-ai/sdk";
import type { AgentMode } from "./types" import type { AgentMode } from "./types";
import type { AvailableAgent, AvailableTool, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder" import type {
AvailableAgent,
AvailableTool,
AvailableSkill,
AvailableCategory,
} from "./dynamic-agent-prompt-builder";
import { import {
buildKeyTriggersSection, buildKeyTriggersSection,
buildToolSelectionTable, buildToolSelectionTable,
@ -12,9 +17,9 @@ import {
buildHardBlocksSection, buildHardBlocksSection,
buildAntiPatternsSection, buildAntiPatternsSection,
categorizeTools, categorizeTools,
} from "./dynamic-agent-prompt-builder" } from "./dynamic-agent-prompt-builder";
const MODE: AgentMode = "primary" const MODE: AgentMode = "primary";
function buildTodoDisciplineSection(useTaskSystem: boolean): string { function buildTodoDisciplineSection(useTaskSystem: boolean): string {
if (useTaskSystem) { if (useTaskSystem) {
@ -52,7 +57,7 @@ function buildTodoDisciplineSection(useTaskSystem: boolean): string {
| Proceeding without \`in_progress\` | No indication of current work | | Proceeding without \`in_progress\` | No indication of current work |
| Finishing without completing tasks | Task appears incomplete | | 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) return `## Todo Discipline (NON-NEGOTIABLE)
@ -89,7 +94,7 @@ function buildTodoDisciplineSection(useTaskSystem: boolean): string {
| Proceeding without \`in_progress\` | No indication of current work | | Proceeding without \`in_progress\` | No indication of current work |
| Finishing without completing todos | Task appears incomplete | | 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[] = [], availableTools: AvailableTool[] = [],
availableSkills: AvailableSkill[] = [], availableSkills: AvailableSkill[] = [],
availableCategories: AvailableCategory[] = [], availableCategories: AvailableCategory[] = [],
useTaskSystem = false useTaskSystem = false,
): string { ): string {
const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills) const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills);
const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills) const toolSelection = buildToolSelectionTable(
const exploreSection = buildExploreSection(availableAgents) availableAgents,
const librarianSection = buildLibrarianSection(availableAgents) availableTools,
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills) availableSkills,
const delegationTable = buildDelegationTable(availableAgents) );
const oracleSection = buildOracleSection(availableAgents) const exploreSection = buildExploreSection(availableAgents);
const hardBlocks = buildHardBlocksSection() const librarianSection = buildLibrarianSection(availableAgents);
const antiPatterns = buildAntiPatternsSection() const categorySkillsGuide = buildCategorySkillsDelegationGuide(
const todoDiscipline = buildTodoDisciplineSection(useTaskSystem) 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. 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 ### Step 3: Validate Before Acting
**Delegation Check (MANDATORY before acting directly):** **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? 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? 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}, ...])\` - 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.** **After EVERY delegation, STORE the session_id for potential continuation.**
${oracleSection ? ` ${
oracleSection
? `
${oracleSection} ${oracleSection}
` : ""} `
: ""
}
## Role & Agency (CRITICAL - READ CAREFULLY) ## Role & Agency (CRITICAL - READ CAREFULLY)
@ -591,7 +608,7 @@ When working on long sessions or complex multi-file tasks:
## Soft Guidelines ## Soft Guidelines
- Prefer existing libraries over new dependencies - Prefer existing libraries over new dependencies
- Prefer small, focused changes over large refactors` - Prefer small, focused changes over large refactors`;
} }
export function createHephaestusAgent( export function createHephaestusAgent(
@ -600,14 +617,20 @@ export function createHephaestusAgent(
availableToolNames?: string[], availableToolNames?: string[],
availableSkills?: AvailableSkill[], availableSkills?: AvailableSkill[],
availableCategories?: AvailableCategory[], availableCategories?: AvailableCategory[],
useTaskSystem = false useTaskSystem = false,
): AgentConfig { ): AgentConfig {
const tools = availableToolNames ? categorizeTools(availableToolNames) : [] const tools = availableToolNames ? categorizeTools(availableToolNames) : [];
const skills = availableSkills ?? [] const skills = availableSkills ?? [];
const categories = availableCategories ?? [] const categories = availableCategories ?? [];
const prompt = availableAgents const prompt = availableAgents
? buildHephaestusPrompt(availableAgents, tools, skills, categories, useTaskSystem) ? buildHephaestusPrompt(
: buildHephaestusPrompt([], tools, skills, categories, useTaskSystem) availableAgents,
tools,
skills,
categories,
useTaskSystem,
)
: buildHephaestusPrompt([], tools, skills, categories, useTaskSystem);
return { return {
description: description:
@ -617,8 +640,11 @@ export function createHephaestusAgent(
maxTokens: 32000, maxTokens: 32000,
prompt, prompt,
color: "#D97706", // Forged Amber - Golden heated metal, divine craftsman 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", reasoningEffort: "medium",
};
} }
} createHephaestusAgent.mode = MODE;
createHephaestusAgent.mode = MODE

View File

@ -1,15 +1,20 @@
import type { AgentConfig } from "@opencode-ai/sdk" import type { AgentConfig } from "@opencode-ai/sdk";
import type { AgentMode, AgentPromptMetadata } from "./types" import type { AgentMode, AgentPromptMetadata } from "./types";
import { isGptModel } from "./types" import { isGptModel } from "./types";
const MODE: AgentMode = "primary" const MODE: AgentMode = "primary";
export const SISYPHUS_PROMPT_METADATA: AgentPromptMetadata = { export const SISYPHUS_PROMPT_METADATA: AgentPromptMetadata = {
category: "utility", category: "utility",
cost: "EXPENSIVE", cost: "EXPENSIVE",
promptAlias: "Sisyphus", promptAlias: "Sisyphus",
triggers: [], triggers: [],
} };
import type { AvailableAgent, AvailableTool, AvailableSkill, AvailableCategory } from "./dynamic-agent-prompt-builder" import type {
AvailableAgent,
AvailableTool,
AvailableSkill,
AvailableCategory,
} from "./dynamic-agent-prompt-builder";
import { import {
buildKeyTriggersSection, buildKeyTriggersSection,
buildToolSelectionTable, buildToolSelectionTable,
@ -21,7 +26,7 @@ import {
buildHardBlocksSection, buildHardBlocksSection,
buildAntiPatternsSection, buildAntiPatternsSection,
categorizeTools, categorizeTools,
} from "./dynamic-agent-prompt-builder" } from "./dynamic-agent-prompt-builder";
function buildTaskManagementSection(useTaskSystem: boolean): string { function buildTaskManagementSection(useTaskSystem: boolean): string {
if (useTaskSystem) { if (useTaskSystem) {
@ -80,7 +85,7 @@ I want to make sure I understand correctly.
Should I proceed with [recommendation], or would you prefer differently? Should I proceed with [recommendation], or would you prefer differently?
\`\`\` \`\`\`
</Task_Management>` </Task_Management>`;
} }
return `<Task_Management> return `<Task_Management>
@ -138,7 +143,7 @@ I want to make sure I understand correctly.
Should I proceed with [recommendation], or would you prefer differently? Should I proceed with [recommendation], or would you prefer differently?
\`\`\` \`\`\`
</Task_Management>` </Task_Management>`;
} }
function buildDynamicSisyphusPrompt( function buildDynamicSisyphusPrompt(
@ -146,21 +151,28 @@ function buildDynamicSisyphusPrompt(
availableTools: AvailableTool[] = [], availableTools: AvailableTool[] = [],
availableSkills: AvailableSkill[] = [], availableSkills: AvailableSkill[] = [],
availableCategories: AvailableCategory[] = [], availableCategories: AvailableCategory[] = [],
useTaskSystem = false useTaskSystem = false,
): string { ): string {
const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills) const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills);
const toolSelection = buildToolSelectionTable(availableAgents, availableTools, availableSkills) const toolSelection = buildToolSelectionTable(
const exploreSection = buildExploreSection(availableAgents) availableAgents,
const librarianSection = buildLibrarianSection(availableAgents) availableTools,
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills) availableSkills,
const delegationTable = buildDelegationTable(availableAgents) );
const oracleSection = buildOracleSection(availableAgents) const exploreSection = buildExploreSection(availableAgents);
const hardBlocks = buildHardBlocksSection() const librarianSection = buildLibrarianSection(availableAgents);
const antiPatterns = buildAntiPatternsSection() const categorySkillsGuide = buildCategorySkillsDelegationGuide(
const taskManagementSection = buildTaskManagementSection(useTaskSystem) availableCategories,
availableSkills,
);
const delegationTable = buildDelegationTable(availableAgents);
const oracleSection = buildOracleSection(availableAgents);
const hardBlocks = buildHardBlocksSection();
const antiPatterns = buildAntiPatternsSection();
const taskManagementSection = buildTaskManagementSection(useTaskSystem);
const todoHookNote = useTaskSystem const todoHookNote = useTaskSystem
? "YOUR TASK CREATION WOULD BE TRACKED BY HOOK([SYSTEM REMINDER - TASK CONTINUATION])" ? "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 `<Role> return `<Role>
You are "Sisyphus" - Powerful AI Agent with orchestration capabilities from OhMyOpenCode. You are "Sisyphus" - Powerful AI Agent with orchestration capabilities from OhMyOpenCode.
@ -315,6 +327,7 @@ STOP searching when:
## Phase 2B - Implementation ## Phase 2B - Implementation
### Pre-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 announcementsjust create it. 1. If task has 2+ steps Create todo list IMMEDIATELY, IN SUPER DETAIL. No announcementsjust create it.
2. Mark current task \`in_progress\` before starting 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 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 - Prefer small, focused changes over large refactors
- When uncertain about scope, ask - When uncertain about scope, ask
</Constraints> </Constraints>
` `;
} }
export function createSisyphusAgent( export function createSisyphusAgent(
@ -506,16 +519,25 @@ export function createSisyphusAgent(
availableToolNames?: string[], availableToolNames?: string[],
availableSkills?: AvailableSkill[], availableSkills?: AvailableSkill[],
availableCategories?: AvailableCategory[], availableCategories?: AvailableCategory[],
useTaskSystem = false useTaskSystem = false,
): AgentConfig { ): AgentConfig {
const tools = availableToolNames ? categorizeTools(availableToolNames) : [] const tools = availableToolNames ? categorizeTools(availableToolNames) : [];
const skills = availableSkills ?? [] const skills = availableSkills ?? [];
const categories = availableCategories ?? [] const categories = availableCategories ?? [];
const prompt = availableAgents const prompt = availableAgents
? buildDynamicSisyphusPrompt(availableAgents, tools, skills, categories, useTaskSystem) ? buildDynamicSisyphusPrompt(
: buildDynamicSisyphusPrompt([], tools, skills, categories, useTaskSystem) 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 = { const base = {
description: 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)", "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, prompt,
color: "#00CED1", color: "#00CED1",
permission, permission,
} };
if (isGptModel(model)) { 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;