|
| 1 | +import { publisher } from './constants' |
| 2 | +import type { |
| 3 | + AgentDefinition, |
| 4 | + AgentStepContext, |
| 5 | +} from './types/agent-definition' |
| 6 | + |
| 7 | +const independentThinker: AgentDefinition = { |
| 8 | + id: 'independent-thinker', |
| 9 | + publisher, |
| 10 | + model: 'anthropic/claude-sonnet-4.5', |
| 11 | + displayName: 'Independent Thinker', |
| 12 | + spawnerPrompt: |
| 13 | + 'A strong independent thinking agent that analyzes specific files or does research without seeing the conversation history. Useful for getting fresh perspectives and analysis on code or a research question without context pollution. You must provide all the relevant context (via the prompt or filePaths) for this agent to work well.', |
| 14 | + inputSchema: { |
| 15 | + prompt: { |
| 16 | + type: 'string', |
| 17 | + description: 'The question or problem to analyze', |
| 18 | + }, |
| 19 | + params: { |
| 20 | + type: 'object', |
| 21 | + properties: { |
| 22 | + filePaths: { |
| 23 | + type: 'array', |
| 24 | + items: { type: 'string' }, |
| 25 | + description: 'Optional list of file paths to read and analyze', |
| 26 | + }, |
| 27 | + }, |
| 28 | + required: [], |
| 29 | + }, |
| 30 | + }, |
| 31 | + outputMode: 'last_message', |
| 32 | + includeMessageHistory: false, |
| 33 | + inheritParentSystemPrompt: false, |
| 34 | + toolNames: ['read_files', 'spawn_agents'], |
| 35 | + spawnableAgents: [ |
| 36 | + 'file-picker', |
| 37 | + 'find-all-referencer', |
| 38 | + 'researcher-web', |
| 39 | + 'researcher-docs', |
| 40 | + ], |
| 41 | + systemPrompt: `You are an expert software architect and analyst. You provide independent, unbiased analysis of code and problems. |
| 42 | +
|
| 43 | +Your strength is analyzing specific files and problems with fresh eyes, without being influenced by prior conversation context. |
| 44 | +
|
| 45 | +You have access to: |
| 46 | +- File reading capabilities |
| 47 | +- File exploration and search agents |
| 48 | +- Web and documentation research agents |
| 49 | +
|
| 50 | +Use these tools to gather information and provide thorough, well-reasoned analysis.`, |
| 51 | + instructionsPrompt: `The user has provided a question or problem to think about. |
| 52 | +
|
| 53 | +You can spawn additional agents if you need more context: |
| 54 | +- file-picker: to find related files |
| 55 | +- find-all-referencer: to find references or definitions |
| 56 | +- researcher-web: to search the web |
| 57 | +- researcher-docs: to read technical documentation |
| 58 | +
|
| 59 | +Provide a thorough, well-reasoned analysis that addresses the user's question. |
| 60 | +
|
| 61 | +Be concise but comprehensive. Focus on insights, trade-offs, and recommendations.`, |
| 62 | + handleSteps: function* ({ params }: AgentStepContext) { |
| 63 | + const filePaths = params?.filePaths as string[] | undefined |
| 64 | + |
| 65 | + if (filePaths && filePaths.length > 0) { |
| 66 | + // Read all the specified files immediately |
| 67 | + yield { |
| 68 | + toolName: 'read_files', |
| 69 | + input: { paths: filePaths }, |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + // Let the model think and use any additional tools it needs |
| 74 | + yield 'STEP_ALL' |
| 75 | + }, |
| 76 | +} |
| 77 | + |
| 78 | +export default independentThinker |
0 commit comments