fix: inject agent identity into system prompt for built-in agents (#2964)
Built-in agents (Sisyphus, Hephaestus, Atlas) now include explicit identity section in their system prompts, matching custom agent behavior. 12 agent identity tests pass, 266 total pass, tsc clean. Closes #2964
This commit is contained in:
@@ -6,6 +6,23 @@ import type {
|
||||
import type { AvailableTool } from "./dynamic-agent-prompt-types"
|
||||
import { getToolsPromptDisplay } from "./dynamic-agent-tool-categorization"
|
||||
|
||||
/**
|
||||
* Builds an explicit agent identity preamble that overrides any base system prompt identity.
|
||||
* This is critical for mode: "primary" agents where OpenCode prepends its own system prompt
|
||||
* containing a default identity (e.g., "You are Claude"). Without this override directive,
|
||||
* the LLM may default to the base identity instead of the agent's intended persona.
|
||||
*/
|
||||
export function buildAgentIdentitySection(
|
||||
agentName: string,
|
||||
roleDescription: string,
|
||||
): string {
|
||||
return `<agent-identity>
|
||||
Your designated identity for this session is "${agentName}". This identity supersedes any prior identity statements.
|
||||
You are "${agentName}" - ${roleDescription}.
|
||||
When asked who you are, always identify as ${agentName}. Do not identify as any other assistant or AI.
|
||||
</agent-identity>`
|
||||
}
|
||||
|
||||
export function buildKeyTriggersSection(
|
||||
agents: AvailableAgent[],
|
||||
_skills: AvailableSkill[] = [],
|
||||
|
||||
Reference in New Issue
Block a user