chore: Add --system flag for existing agents + update system prompt variable names (#328)

This commit is contained in:
Devansh Jain
2025-12-19 17:16:21 -08:00
committed by GitHub
parent f9bffaed81
commit 7d73219c50
6 changed files with 127 additions and 59 deletions

View File

@@ -99,26 +99,26 @@ export const SYSTEM_PROMPTS: SystemPromptOption[] = [
];
/**
* Resolve a system prompt string to its content.
* Resolve a system prompt ID to its content.
*
* Resolution order:
* 1. If it matches a systemPromptId from SYSTEM_PROMPTS, use its content
* 1. If it matches an ID from SYSTEM_PROMPTS, use its content
* 2. If it matches a subagent name, use that subagent's system prompt
* 3. Otherwise, use the default system prompt
*
* @param systemPromptInput - The system prompt ID or subagent name
* @param systemPromptId - The system prompt ID (e.g., "codex") or subagent name (e.g., "explore")
* @returns The resolved system prompt content
*/
export async function resolveSystemPrompt(
systemPromptInput: string | undefined,
systemPromptId: string | undefined,
): Promise<string> {
// No input - use default
if (!systemPromptInput) {
if (!systemPromptId) {
return SYSTEM_PROMPT;
}
// 1. Check if it matches a system prompt ID
const matchedPrompt = SYSTEM_PROMPTS.find((p) => p.id === systemPromptInput);
const matchedPrompt = SYSTEM_PROMPTS.find((p) => p.id === systemPromptId);
if (matchedPrompt) {
return matchedPrompt.content;
}
@@ -126,7 +126,7 @@ export async function resolveSystemPrompt(
// 2. Check if it matches a subagent name
const { getAllSubagentConfigs } = await import("./subagents");
const subagentConfigs = await getAllSubagentConfigs();
const matchedSubagent = subagentConfigs[systemPromptInput];
const matchedSubagent = subagentConfigs[systemPromptId];
if (matchedSubagent) {
return matchedSubagent.systemPrompt;
}