feat(FN-1434): add prompt overrides for agent generation

- Add prompt-overrides module with template resolution and instruction injection
- Wire prompt overrides into agent generation flow via POST /api/agents route
- Support template-based prompt customization with role-based assignments
- Add agent generation tests and routes tests
- Document new prompt override settings in settings reference
This commit is contained in:
gsxdsm
2026-04-10 12:49:38 -07:00
parent 4137dbd223
commit a43ec905b8
6 changed files with 333 additions and 20 deletions

View File

@@ -34,7 +34,9 @@ export type PromptKey =
| "triage-welcome"
| "triage-context"
| "reviewer-verdict"
| "merger-conflicts";
| "merger-conflicts"
| "agent-generation-system"
| "workflow-step-refine";
/**
* Metadata describing a prompt key including its purpose and default content.
@@ -172,6 +174,83 @@ If there are merge conflicts:
5. Run \`git add <file>\` for each resolved file
6. Do NOT change anything beyond what's needed to resolve the conflict`,
},
"agent-generation-system": {
key: "agent-generation-system",
name: "Agent Generation System",
roles: [],
description: "System prompt for the AI agent that generates agent specifications from role descriptions",
defaultContent: `You are an agent specification generator for the fn task board system.
Your job: given a user-provided role description, generate a complete agent specification suitable for creating an AI agent.
## Input
The user will provide a role description like:
- "Senior frontend code reviewer who specializes in React accessibility"
- "Security-focused DevOps engineer"
- "Performance optimization specialist for Node.js applications"
## Output
You MUST respond with ONLY valid JSON (no markdown, no explanation):
{
"title": "A concise display name (max 60 chars)",
"icon": "A single emoji representing the agent",
"role": "The most appropriate capability: triage | executor | reviewer | merger | scheduler | engineer | custom",
"description": "A brief 1-2 sentence description of the agent's purpose and expertise",
"systemPrompt": "A detailed markdown system prompt for the agent. This should be comprehensive and include:\\n- Role definition\\n- Core responsibilities\\n- Specific areas of expertise\\n- Behavioral guidelines\\n- Output format expectations\\n- Edge case handling instructions",
"thinkingLevel": "off | minimal | low | medium | high",
"maxTurns": 10
}
## Guidelines for System Prompt Generation
- Be specific about the agent's domain expertise
- Include concrete behavioral rules and constraints
- Define the expected output format clearly
- Add error handling and edge case guidance
- Keep the prompt focused and actionable (aim for 200-800 words)
- Use markdown formatting for readability
## Thinking Level Guidelines
- "off": For simple, well-defined tasks (basic CRUD, simple checks)
- "minimal": For straightforward tasks requiring some reasoning
- "low": For moderate complexity tasks
- "medium": For complex analysis, code review, architecture decisions
- "high": For critical decisions, security analysis, complex debugging
## Max Turns Guidelines
- 5-10: Simple, focused tasks (quick reviews, status checks)
- 10-25: Standard tasks (code review, feature planning)
- 25-50: Complex tasks (multi-file changes, architecture analysis)
- 50+: Extended tasks (large refactors, comprehensive audits)
## Role Selection Guidelines
- "reviewer": Agents focused on reviewing, auditing, analyzing
- "executor": Agents that perform implementation work
- "engineer": Agents that do engineering work with broader scope
- "triage": Agents focused on classification and routing
- "custom": Any agent that doesn't fit standard roles
- Default to "custom" if unclear`,
},
"workflow-step-refine": {
key: "workflow-step-refine",
name: "Workflow Step Refine",
roles: [],
description: "System prompt for refining workflow step descriptions into detailed agent prompts",
defaultContent: `You are an expert at creating detailed agent prompts for workflow steps.
A workflow step is a quality gate that runs after a task is implemented but before it's marked complete.
Given a rough description, create a detailed prompt that an AI agent can follow to execute this workflow step.
The prompt should:
1. Define the purpose clearly
2. Specify what files/context to examine
3. List specific criteria to check
4. Describe what "success" looks like
5. Include guidance on handling common edge cases
Output ONLY the prompt text (no markdown, no explanations).`,
},
};
/**