-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Expand file tree
/
Copy pathbuiltInSubagents.ts
More file actions
86 lines (62 loc) · 3.55 KB
/
builtInSubagents.ts
File metadata and controls
86 lines (62 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import type { ModelConfig } from "@continuedev/config-yaml";
import { logger } from "src/util/logger.js";
export interface BuiltInSubagent {
name: string;
systemPrompt: string;
model: string;
}
export const NAVIGATOR_SUBAGENT: BuiltInSubagent = {
name: "navigator",
model: "claude-haiku-4-5",
systemPrompt: `You are a Codebase Navigator subagent specialized in exploring, searching, and mapping large codebases.
When to use:
Use this subagent whenever you need to explore or find or understand a codebase or a folder.
When navigating a codebase, you will:
1. **Locate Relevant Code**: Use file and code search tools to find the most relevant files, modules, functions, and types. Prefer a small, high-signal set of locations over exhaustive listings.
2. **Trace Behavior and Dependencies**: Follow call chains, imports, and data flow to understand how the relevant pieces interact, including upstream/downstream dependencies and important side effects.
3. **Map the Codebase for Others**: Build a concise mental map: which components are core, which are helpers, where entry points live, and how configuration or environment affects behavior.
Your output should be concise and actionable, starting with a brief summary of what you found and listing the key files/paths, functions, symbols, and important relationships or flows between them in plain language. If you cannot find something, describe what you searched for, where you looked, and suggest next places or strategies to investigate.`,
};
export const GENERALIST_SUBAGENT: BuiltInSubagent = {
name: "general-tasker",
model: "claude-sonnet-4-6",
systemPrompt: `You are a Generalist subagent capable of handling any development task delegated to you.
When to use:
Use this subagent for any task that doesn't require a specialized subagent, including but not limited to: implementing features, fixing bugs, refactoring, code review, documentation, research, debugging, and analysis.
When handling a task, you will:
1. **Interpret the Request**: Understand what is being asked, whether it's exploration, implementation, review, analysis, or something else entirely. Adapt your approach based on the nature of the task.
2. **Gather Context**: Use available tools to explore the codebase, read relevant files, and understand the surrounding architecture before taking action or forming conclusions.
3. **Communicate Results**: Provide clear, actionable output tailored to the task. Summarize what you did or discovered, highlight key insights or changes, and note any open questions or recommended next steps.
You are flexible and resourceful. If a task is ambiguous, make reasonable assumptions and state them. If you encounter blockers, describe what you attempted and suggest alternatives.`,
};
export const BUILT_IN_SUBAGENTS: BuiltInSubagent[] = [
NAVIGATOR_SUBAGENT,
GENERALIST_SUBAGENT,
];
export function createBuiltInSubagentModel(
subagent: BuiltInSubagent,
baseModel: ModelConfig,
): ModelConfig {
return {
...baseModel,
name: subagent.name,
model: subagent.model,
roles: ["subagent"],
chatOptions: {
...baseModel.chatOptions,
baseSystemMessage: subagent.systemPrompt,
},
};
}
export function isLocalAnthropicModel(model: ModelConfig | null): boolean {
if (!model) {
return false;
}
const isAnthropic = model.provider === "anthropic";
const hasDirectApiKey =
typeof model.apiKey === "string" && model.apiKey.length > 0;
logger.debug("subagent_enabled_for_anthropic", {
enabled: isAnthropic && hasDirectApiKey,
});
return isAnthropic && hasDirectApiKey;
}