Skip to content

Commit c217174

Browse files
committed
Add independent thinker agent!
1 parent 3fec635 commit c217174

File tree

3 files changed

+83
-8
lines changed

3 files changed

+83
-8
lines changed

.agents/base2/base2.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const createBase2: (mode: 'normal' | 'max') => SecretAgentDefinition = (
4949
'researcher-docs',
5050
'commander',
5151
'decomposing-thinker',
52+
'independent-thinker',
5253
'code-sketcher',
5354
'editor',
5455
'reviewer',
@@ -99,7 +100,7 @@ ${
99100
: '1. Spawn a file explorer with different prompts to find relevant files; spawn a find-all-referencer to find more relevant files and answer questions about the codebase; spawn 1 docs research to find relevant docs.'
100101
}
101102
1a. Read all the relevant files using the read_files tool.
102-
2. Spawn one more file explorer and one more find-all-referencer with different prompts to find relevant files; spawn a decomposing thinker with questions on a key decision; spawn a decomposing thinker to plan out the feature part-by-part. Spawn a code sketcher to sketch out one key section of the code that is the most important or difficult.
103+
2. Spawn one more file explorer and one more find-all-referencer with different prompts to find relevant files; spawn an independent thinker with questions on a key decision; spawn a decomposing thinker to plan out the feature part-by-part. Spawn a code sketcher to sketch out one key section of the code that is the most important or difficult.
103104
2a. Read all the relevant files using the read_files tool.
104105
3. Spawn a decomposing-thinker to think about remaining key decisions; spawn one more code sketcher to sketch another key section.
105106
4. Spawn two editors to implement all the changes.
@@ -113,7 +114,8 @@ ${
113114
- Spawn thinkers and code sketchers before editors so editors can use the insights from the thinkers and code sketchers.
114115
- Spawn editors later. Only spawn editors after gathering all the context and creating a plan.
115116
- Reviewers should be spawned after editors.
116-
- **Use the decomposing thinker also to check what context you are missing:** Ask what context you don't have for specific subtasks that you should could still acquire (with file pickers or find-all-referencers or researchers or using the read_files tool). Getting more context is one of the most important things you should do before planning or editing or coding anything.
117+
- **Use the decomposing thinker to generate ideas, plan, and check what context you are missing:** Decomposing thinker is faster and cheaper for most thinking tasks. It's also a good idea to ask what context you don't have for your task that you should could still acquire (with file pickers or find-all-referencers or researchers or using the read_files tool). Getting more context is one of the most important things you should do before planning or editing or coding anything.
118+
- **Use the independent thinker for key self-contained decisions:** Give it the exact context that is needed to answer the question or problem you are trying to solve. The independent thinker is really good at thinking.
117119
- **Once you've gathered all the context you need, create a plan:** Write out your plan as a bullet point list. The user wants to see you write out your plan so they know you are on track.
118120
- **No need to include context:** When prompting an agent, realize that many agents can already see the entire conversation history, so you can be brief in prompting them without needing to include context.
119121
- **Don't spawn editors for trivial changes:** Prefer to use the str_replace or write_file tool to make trivial changes yourself.

.agents/commander.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ When describing command output:
4646
instructionsPrompt: `The user has provided a command to run and specified what information they want from the output.
4747
4848
Run the command and then describe the relevant information from the output, following the user's instructions about what to focus on.`,
49-
handleSteps: function* ({
50-
agentState,
51-
prompt,
52-
params,
53-
logger,
54-
}: AgentStepContext) {
49+
handleSteps: function* ({ params }: AgentStepContext) {
5550
const command = params?.command as string | undefined
5651
if (!command) {
5752
return

.agents/independent-thinker.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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

Comments
 (0)