@iaforged/context-code 1.0.77 → 1.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -68
- package/cli.js +8515 -8515
- package/context-bootstrap.js +27 -27
- package/dist/src/bootstrap/state.js +3 -0
- package/dist/src/bridge/bridgeMain.js +40 -40
- package/dist/src/cli/print.js +12 -12
- package/dist/src/commands/agent/agent.js +8 -0
- package/dist/src/commands/commit-push-pr.js +55 -55
- package/dist/src/commands/createMovedToPluginCommand.js +9 -9
- package/dist/src/commands/init-verifiers.js +238 -238
- package/dist/src/commands/init.js +216 -216
- package/dist/src/commands/install.js +2 -2
- package/dist/src/commands/login/login.js +24 -10
- package/dist/src/commands/orchestrate/index.js +1 -1
- package/dist/src/commands/orchestrate/orchestrate.js +110 -24
- package/dist/src/commands/profile/profile.js +15 -1
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +34 -1
- package/dist/src/commands/review.js +22 -22
- package/dist/src/commands/run/index.js +2 -2
- package/dist/src/commands/run/run.js +63 -61
- package/dist/src/commands/team/index.js +1 -1
- package/dist/src/commands/team/team.js +84 -76
- package/dist/src/commands/team-auto/teamAuto.js +89 -29
- package/dist/src/commands/terminalSetup/terminalSetup.js +24 -24
- package/dist/src/commands/usage/index.js +7 -0
- package/dist/src/commands/usage/usage.js +5 -0
- package/dist/src/commands/workspace/workspace.js +39 -31
- package/dist/src/commands.js +0 -2
- package/dist/src/components/ConsoleOAuthFlow.js +92 -14
- package/dist/src/components/ModelPicker.js +2 -0
- package/dist/src/components/agents/generateAgent.js +92 -92
- package/dist/src/components/grove/Grove.js +10 -10
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +8 -8
- package/dist/src/constants/geminiOAuth.js +13 -0
- package/dist/src/constants/github-app.js +134 -134
- package/dist/src/constants/prompts.js +123 -123
- package/dist/src/coordinator/coordinatorMode.js +252 -252
- package/dist/src/hooks/useTypeahead.js +7 -7
- package/dist/src/ink/reconciler.js +7 -7
- package/dist/src/main.js +5 -5
- package/dist/src/memdir/findRelevantMemories.js +6 -6
- package/dist/src/services/MagicDocs/prompts.js +56 -56
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +29 -29
- package/dist/src/services/SessionMemory/prompts.js +66 -66
- package/dist/src/services/api/openai.js +584 -21
- package/dist/src/services/limits/adapters/ollama.js +3 -3
- package/dist/src/services/oauth/geminiCli.js +107 -0
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +5 -3
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +18 -18
- package/dist/src/services/orchestration/global/reporting.js +2 -2
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +9 -9
- package/dist/src/skills/bundled/batch.js +78 -78
- package/dist/src/skills/bundled/claudeApi.js +34 -34
- package/dist/src/skills/bundled/claudeInChrome.js +4 -4
- package/dist/src/skills/bundled/debug.js +36 -36
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +151 -151
- package/dist/src/skills/bundled/skillify.js +132 -132
- package/dist/src/skills/bundled/stuck.js +53 -53
- package/dist/src/skills/bundled/updateConfig.js +418 -418
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +26 -26
- package/dist/src/tools/AgentTool/AgentTool.js +7 -7
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +67 -67
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +32 -32
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +13 -13
- package/dist/src/tools/AgentTool/built-in/planAgent.js +49 -49
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +129 -129
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +119 -119
- package/dist/src/tools/AgentTool/prompt.js +131 -131
- package/dist/src/tools/AgentTool/runAgent.js +9 -9
- package/dist/src/tools/BashTool/BashTool.js +10 -10
- package/dist/src/tools/BashTool/prompt.js +94 -94
- package/dist/src/tools/ConfigTool/prompt.js +29 -29
- package/dist/src/tools/EnterWorktreeTool/prompt.js +27 -27
- package/dist/src/tools/FileReadTool/prompt.js +12 -12
- package/dist/src/tools/PowerShellTool/prompt.js +82 -82
- package/dist/src/tools/RemoteTriggerTool/prompt.js +9 -9
- package/dist/src/tools/ScheduleCronTool/prompt.js +37 -37
- package/dist/src/tools/TeamCreateTool/prompt.js +110 -110
- package/dist/src/tools/TeamDeleteTool/prompt.js +13 -13
- package/dist/src/utils/advisor.js +15 -15
- package/dist/src/utils/api.js +2 -2
- package/dist/src/utils/auth.js +207 -2
- package/dist/src/utils/autoUpdater.js +18 -18
- package/dist/src/utils/bash/ShellSnapshot.js +86 -86
- package/dist/src/utils/bash/commands.js +61 -61
- package/dist/src/utils/claudeInChrome/prompt.js +53 -53
- package/dist/src/utils/claudeInChrome/setup.js +8 -8
- package/dist/src/utils/databaseMcp/server/queries.js +632 -632
- package/dist/src/utils/deepLink/registerProtocol.js +35 -35
- package/dist/src/utils/deepLink/terminalLauncher.js +12 -12
- package/dist/src/utils/hooks/execAgentHook.js +7 -7
- package/dist/src/utils/hooks/execPromptHook.js +4 -4
- package/dist/src/utils/hooks/skillImprovement.js +36 -36
- package/dist/src/utils/logoV2Utils.js +1 -1
- package/dist/src/utils/mcp/dateTimeParser.js +9 -9
- package/dist/src/utils/messages.js +191 -191
- package/dist/src/utils/model/model.js +18 -0
- package/dist/src/utils/model/modelOptions.js +51 -1
- package/dist/src/utils/model/modelStrings.js +5 -1
- package/dist/src/utils/model/modelSupportOverrides.js +3 -0
- package/dist/src/utils/model/providerBaseUrls.js +6 -1
- package/dist/src/utils/model/providerCatalog.js +64 -28
- package/dist/src/utils/model/providerModels.js +88 -17
- package/dist/src/utils/model/providerProfiles.js +8 -0
- package/dist/src/utils/model/providerProfilesDb.js +578 -393
- package/dist/src/utils/model/providerSwitch.js +12 -0
- package/dist/src/utils/model/providerWorkspaces.js +2 -0
- package/dist/src/utils/model/providers.js +65 -2
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +3 -1
- package/dist/src/utils/orchestration/store/runStore.js +47 -47
- package/dist/src/utils/orchestration/store/teamStore.js +61 -61
- package/dist/src/utils/powershell/parser.js +253 -253
- package/dist/src/utils/sessionTitle.js +12 -12
- package/dist/src/utils/sideQuestion.js +17 -17
- package/dist/src/utils/status.js +1 -1
- package/dist/src/utils/swarm/backends/registry.js +9 -9
- package/dist/src/utils/telemetry/instrumentation.js +9 -9
- package/dist/src/utils/teleport.js +15 -15
- package/dist/src/utils/undercover.js +28 -28
- package/package.json +1 -1
|
@@ -97,12 +97,12 @@ function enqueueRemoteNotification(taskId, title, status, setAppState, toolUseId
|
|
|
97
97
|
const statusText = status === 'completed' ? 'completed successfully' : status === 'failed' ? 'failed' : 'was stopped';
|
|
98
98
|
const toolUseIdLine = toolUseId ? `\n<${TOOL_USE_ID_TAG}>${toolUseId}</${TOOL_USE_ID_TAG}>` : '';
|
|
99
99
|
const outputPath = getTaskOutputPath(taskId);
|
|
100
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
101
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
102
|
-
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
103
|
-
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
104
|
-
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
105
|
-
<${SUMMARY_TAG}>Remote task "${title}" ${statusText}</${SUMMARY_TAG}>
|
|
100
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
101
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
102
|
+
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
103
|
+
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
104
|
+
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
105
|
+
<${SUMMARY_TAG}>Remote task "${title}" ${statusText}</${SUMMARY_TAG}>
|
|
106
106
|
</${TASK_NOTIFICATION_TAG}>`;
|
|
107
107
|
enqueuePendingNotification({
|
|
108
108
|
value: message,
|
|
@@ -153,12 +153,12 @@ export function enqueueUltraplanFailureNotification(taskId, sessionId, reason, s
|
|
|
153
153
|
if (!markTaskNotified(taskId, setAppState))
|
|
154
154
|
return;
|
|
155
155
|
const sessionUrl = getRemoteTaskSessionUrl(sessionId);
|
|
156
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
157
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
158
|
-
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
159
|
-
<${STATUS_TAG}>failed</${STATUS_TAG}>
|
|
160
|
-
<${SUMMARY_TAG}>Ultraplan failed: ${reason}</${SUMMARY_TAG}>
|
|
161
|
-
</${TASK_NOTIFICATION_TAG}>
|
|
156
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
157
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
158
|
+
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
159
|
+
<${STATUS_TAG}>failed</${STATUS_TAG}>
|
|
160
|
+
<${SUMMARY_TAG}>Ultraplan failed: ${reason}</${SUMMARY_TAG}>
|
|
161
|
+
</${TASK_NOTIFICATION_TAG}>
|
|
162
162
|
The remote Ultraplan session did not produce a plan (${reason}). Inspect the session at ${sessionUrl} and tell the user to retry locally with plan mode.`;
|
|
163
163
|
enqueuePendingNotification({
|
|
164
164
|
value: message,
|
|
@@ -256,14 +256,14 @@ function extractReviewTagFromLog(log) {
|
|
|
256
256
|
function enqueueRemoteReviewNotification(taskId, reviewContent, setAppState) {
|
|
257
257
|
if (!markTaskNotified(taskId, setAppState))
|
|
258
258
|
return;
|
|
259
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
260
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
261
|
-
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
262
|
-
<${STATUS_TAG}>completed</${STATUS_TAG}>
|
|
263
|
-
<${SUMMARY_TAG}>Remote review completed</${SUMMARY_TAG}>
|
|
264
|
-
</${TASK_NOTIFICATION_TAG}>
|
|
265
|
-
The remote review produced the following findings:
|
|
266
|
-
|
|
259
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
260
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
261
|
+
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
262
|
+
<${STATUS_TAG}>completed</${STATUS_TAG}>
|
|
263
|
+
<${SUMMARY_TAG}>Remote review completed</${SUMMARY_TAG}>
|
|
264
|
+
</${TASK_NOTIFICATION_TAG}>
|
|
265
|
+
The remote review produced the following findings:
|
|
266
|
+
|
|
267
267
|
${reviewContent}`;
|
|
268
268
|
enqueuePendingNotification({
|
|
269
269
|
value: message,
|
|
@@ -276,12 +276,12 @@ ${reviewContent}`;
|
|
|
276
276
|
function enqueueRemoteReviewFailureNotification(taskId, reason, setAppState) {
|
|
277
277
|
if (!markTaskNotified(taskId, setAppState))
|
|
278
278
|
return;
|
|
279
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
280
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
281
|
-
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
282
|
-
<${STATUS_TAG}>failed</${STATUS_TAG}>
|
|
283
|
-
<${SUMMARY_TAG}>Remote review failed: ${reason}</${SUMMARY_TAG}>
|
|
284
|
-
</${TASK_NOTIFICATION_TAG}>
|
|
279
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
280
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>
|
|
281
|
+
<${TASK_TYPE_TAG}>remote_agent</${TASK_TYPE_TAG}>
|
|
282
|
+
<${STATUS_TAG}>failed</${STATUS_TAG}>
|
|
283
|
+
<${SUMMARY_TAG}>Remote review failed: ${reason}</${SUMMARY_TAG}>
|
|
284
|
+
</${TASK_NOTIFICATION_TAG}>
|
|
285
285
|
Remote review did not produce output (${reason}). Tell the user to retry /ultrareview, or use /review for a local review instead.`;
|
|
286
286
|
enqueuePendingNotification({
|
|
287
287
|
value: message,
|
|
@@ -1137,10 +1137,10 @@ export const AgentTool = buildTool({
|
|
|
1137
1137
|
type: 'tool_result',
|
|
1138
1138
|
content: [{
|
|
1139
1139
|
type: 'text',
|
|
1140
|
-
text: `Spawned successfully.
|
|
1141
|
-
agent_id: ${spawnData.teammate_id}
|
|
1142
|
-
name: ${spawnData.name}
|
|
1143
|
-
team_name: ${spawnData.team_name}
|
|
1140
|
+
text: `Spawned successfully.
|
|
1141
|
+
agent_id: ${spawnData.teammate_id}
|
|
1142
|
+
name: ${spawnData.name}
|
|
1143
|
+
team_name: ${spawnData.team_name}
|
|
1144
1144
|
The agent is now running and will receive instructions via mailbox.`
|
|
1145
1145
|
}]
|
|
1146
1146
|
};
|
|
@@ -1197,9 +1197,9 @@ The agent is now running and will receive instructions via mailbox.`
|
|
|
1197
1197
|
type: 'tool_result',
|
|
1198
1198
|
content: [...contentOrMarker, {
|
|
1199
1199
|
type: 'text',
|
|
1200
|
-
text: `agentId: ${data.agentId} (use SendMessage with to: '${data.agentId}' to continue this agent)${worktreeInfoText}
|
|
1201
|
-
<usage>total_tokens: ${data.totalTokens}
|
|
1202
|
-
tool_uses: ${data.totalToolUseCount}
|
|
1200
|
+
text: `agentId: ${data.agentId} (use SendMessage with to: '${data.agentId}' to continue this agent)${worktreeInfoText}
|
|
1201
|
+
<usage>total_tokens: ${data.totalTokens}
|
|
1202
|
+
tool_uses: ${data.totalToolUseCount}
|
|
1203
1203
|
duration_ms: ${data.totalDurationMs}</usage>`
|
|
1204
1204
|
}]
|
|
1205
1205
|
};
|
|
@@ -19,62 +19,62 @@ function getClaudeCodeGuideBasePrompt() {
|
|
|
19
19
|
const localSearchHint = hasEmbeddedSearchTools()
|
|
20
20
|
? `${FILE_READ_TOOL_NAME}, \`find\`, and \`grep\``
|
|
21
21
|
: `${FILE_READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, and ${GREP_TOOL_NAME}`;
|
|
22
|
-
return `You are the Context Code guide agent. Your primary responsibility is helping users understand and use Context Code, the Context Agent SDK, and the underlying AI models (like Claude or GPT) effectively.
|
|
23
|
-
|
|
24
|
-
**Your expertise spans three domains:**
|
|
25
|
-
|
|
26
|
-
1. **Context Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
|
|
27
|
-
|
|
28
|
-
2. **Claude Agent SDK**: A framework for building custom AI agents based on Context Code technology. Available for Node.js/TypeScript and Python.
|
|
29
|
-
|
|
30
|
-
3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
|
|
31
|
-
|
|
32
|
-
**Documentation sources:**
|
|
33
|
-
|
|
34
|
-
- **Context Code docs** (${CONTEXT_CODE_DOCS_MAP_URL}): Fetch this for questions about the Context Code CLI tool, including:
|
|
35
|
-
- Installation, setup, and getting started
|
|
36
|
-
- Hooks (pre/post command execution)
|
|
37
|
-
- Custom skills
|
|
38
|
-
- MCP server configuration
|
|
39
|
-
- IDE integrations (VS Code, JetBrains)
|
|
40
|
-
- Settings files and configuration
|
|
41
|
-
- Keyboard shortcuts and hotkeys
|
|
42
|
-
- Subagents and plugins
|
|
43
|
-
- Sandboxing and security
|
|
44
|
-
|
|
45
|
-
- **Context Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
|
|
46
|
-
- SDK overview and getting started (Python and TypeScript)
|
|
47
|
-
- Agent configuration + custom tools
|
|
48
|
-
- Session management and permissions
|
|
49
|
-
- MCP integration in agents
|
|
50
|
-
- Hosting and deployment
|
|
51
|
-
- Cost tracking and context management
|
|
52
|
-
Note: Agent SDK docs are part of the Claude API documentation at the same URL.
|
|
53
|
-
|
|
54
|
-
- **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
|
|
55
|
-
- Messages API and streaming
|
|
56
|
-
- Tool use (function calling) and Anthropic-defined tools (computer use, code execution, web search, text editor, bash, programmatic tool calling, tool search tool, context editing, Files API, structured outputs)
|
|
57
|
-
- Vision, PDF support, and citations
|
|
58
|
-
- Extended thinking and structured outputs
|
|
59
|
-
- MCP connector for remote MCP servers
|
|
60
|
-
- Cloud provider integrations (Bedrock, Vertex AI, Foundry)
|
|
61
|
-
|
|
62
|
-
**Approach:**
|
|
63
|
-
1. Determine which domain the user's question falls into
|
|
64
|
-
2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
|
|
65
|
-
3. Identify the most relevant documentation URLs from the map
|
|
66
|
-
4. Fetch the specific documentation pages
|
|
67
|
-
5. Provide clear, actionable guidance based on official documentation
|
|
68
|
-
6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
|
|
69
|
-
7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
|
|
70
|
-
|
|
71
|
-
**Guidelines:**
|
|
72
|
-
- Always prioritize official documentation over assumptions
|
|
73
|
-
- Keep responses concise and actionable
|
|
74
|
-
- Include specific examples or code snippets when helpful
|
|
75
|
-
- Reference exact documentation URLs in your responses
|
|
76
|
-
- Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
|
|
77
|
-
|
|
22
|
+
return `You are the Context Code guide agent. Your primary responsibility is helping users understand and use Context Code, the Context Agent SDK, and the underlying AI models (like Claude or GPT) effectively.
|
|
23
|
+
|
|
24
|
+
**Your expertise spans three domains:**
|
|
25
|
+
|
|
26
|
+
1. **Context Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
|
|
27
|
+
|
|
28
|
+
2. **Claude Agent SDK**: A framework for building custom AI agents based on Context Code technology. Available for Node.js/TypeScript and Python.
|
|
29
|
+
|
|
30
|
+
3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
|
|
31
|
+
|
|
32
|
+
**Documentation sources:**
|
|
33
|
+
|
|
34
|
+
- **Context Code docs** (${CONTEXT_CODE_DOCS_MAP_URL}): Fetch this for questions about the Context Code CLI tool, including:
|
|
35
|
+
- Installation, setup, and getting started
|
|
36
|
+
- Hooks (pre/post command execution)
|
|
37
|
+
- Custom skills
|
|
38
|
+
- MCP server configuration
|
|
39
|
+
- IDE integrations (VS Code, JetBrains)
|
|
40
|
+
- Settings files and configuration
|
|
41
|
+
- Keyboard shortcuts and hotkeys
|
|
42
|
+
- Subagents and plugins
|
|
43
|
+
- Sandboxing and security
|
|
44
|
+
|
|
45
|
+
- **Context Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
|
|
46
|
+
- SDK overview and getting started (Python and TypeScript)
|
|
47
|
+
- Agent configuration + custom tools
|
|
48
|
+
- Session management and permissions
|
|
49
|
+
- MCP integration in agents
|
|
50
|
+
- Hosting and deployment
|
|
51
|
+
- Cost tracking and context management
|
|
52
|
+
Note: Agent SDK docs are part of the Claude API documentation at the same URL.
|
|
53
|
+
|
|
54
|
+
- **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
|
|
55
|
+
- Messages API and streaming
|
|
56
|
+
- Tool use (function calling) and Anthropic-defined tools (computer use, code execution, web search, text editor, bash, programmatic tool calling, tool search tool, context editing, Files API, structured outputs)
|
|
57
|
+
- Vision, PDF support, and citations
|
|
58
|
+
- Extended thinking and structured outputs
|
|
59
|
+
- MCP connector for remote MCP servers
|
|
60
|
+
- Cloud provider integrations (Bedrock, Vertex AI, Foundry)
|
|
61
|
+
|
|
62
|
+
**Approach:**
|
|
63
|
+
1. Determine which domain the user's question falls into
|
|
64
|
+
2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
|
|
65
|
+
3. Identify the most relevant documentation URLs from the map
|
|
66
|
+
4. Fetch the specific documentation pages
|
|
67
|
+
5. Provide clear, actionable guidance based on official documentation
|
|
68
|
+
6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
|
|
69
|
+
7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
|
|
70
|
+
|
|
71
|
+
**Guidelines:**
|
|
72
|
+
- Always prioritize official documentation over assumptions
|
|
73
|
+
- Keep responses concise and actionable
|
|
74
|
+
- Include specific examples or code snippets when helpful
|
|
75
|
+
- Reference exact documentation URLs in your responses
|
|
76
|
+
- Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
|
|
77
|
+
|
|
78
78
|
Complete the user's request by providing accurate, documentation-based guidance.`;
|
|
79
79
|
}
|
|
80
80
|
function getFeedbackGuideline() {
|
|
@@ -153,20 +153,20 @@ export const CLAUDE_CODE_GUIDE_AGENT = {
|
|
|
153
153
|
}
|
|
154
154
|
// Add the feedback guideline (conditional based on whether user is using 3P services)
|
|
155
155
|
const feedbackGuideline = getFeedbackGuideline();
|
|
156
|
-
const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
|
|
156
|
+
const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
|
|
157
157
|
${feedbackGuideline}`;
|
|
158
158
|
// If we have any context to add, append it to the base system prompt
|
|
159
159
|
if (contextSections.length > 0) {
|
|
160
|
-
return `${basePromptWithFeedback}
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
# User's Current Configuration
|
|
165
|
-
|
|
166
|
-
The user has the following custom setup in their environment:
|
|
167
|
-
|
|
168
|
-
${contextSections.join('\n\n')}
|
|
169
|
-
|
|
160
|
+
return `${basePromptWithFeedback}
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
# User's Current Configuration
|
|
165
|
+
|
|
166
|
+
The user has the following custom setup in their environment:
|
|
167
|
+
|
|
168
|
+
${contextSections.join('\n\n')}
|
|
169
|
+
|
|
170
170
|
When answering questions, consider these configured features and proactively suggest them when relevant.`;
|
|
171
171
|
}
|
|
172
172
|
// Return the base prompt if no context to add
|
|
@@ -18,38 +18,38 @@ function getExploreSystemPrompt() {
|
|
|
18
18
|
const grepGuidance = embedded
|
|
19
19
|
? `- Use \`grep\` via ${BASH_TOOL_NAME} for searching file contents with regex`
|
|
20
20
|
: `- Use ${GREP_TOOL_NAME} for searching file contents with regex`;
|
|
21
|
-
return `You are a file search specialist for Context Code, Anthropic's official CLI for Claude. You excel at thoroughly navigating and exploring codebases.
|
|
22
|
-
|
|
23
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
24
|
-
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
25
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
26
|
-
- Modifying existing files (no Edit operations)
|
|
27
|
-
- Deleting files (no rm or deletion)
|
|
28
|
-
- Moving or copying files (no mv or cp)
|
|
29
|
-
- Creating temporary files anywhere, including /tmp
|
|
30
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
31
|
-
- Running ANY commands that change system state
|
|
32
|
-
|
|
33
|
-
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
34
|
-
|
|
35
|
-
Your strengths:
|
|
36
|
-
- Rapidly finding files using glob patterns
|
|
37
|
-
- Searching code and text with powerful regex patterns
|
|
38
|
-
- Reading and analyzing file contents
|
|
39
|
-
|
|
40
|
-
Guidelines:
|
|
41
|
-
${globGuidance}
|
|
42
|
-
${grepGuidance}
|
|
43
|
-
- Use ${FILE_READ_TOOL_NAME} when you know the specific file path you need to read
|
|
44
|
-
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find${embedded ? ', grep' : ''}, cat, head, tail)
|
|
45
|
-
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
46
|
-
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
47
|
-
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
48
|
-
|
|
49
|
-
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
50
|
-
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
51
|
-
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
52
|
-
|
|
21
|
+
return `You are a file search specialist for Context Code, Anthropic's official CLI for Claude. You excel at thoroughly navigating and exploring codebases.
|
|
22
|
+
|
|
23
|
+
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
24
|
+
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
25
|
+
- Creating new files (no Write, touch, or file creation of any kind)
|
|
26
|
+
- Modifying existing files (no Edit operations)
|
|
27
|
+
- Deleting files (no rm or deletion)
|
|
28
|
+
- Moving or copying files (no mv or cp)
|
|
29
|
+
- Creating temporary files anywhere, including /tmp
|
|
30
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
31
|
+
- Running ANY commands that change system state
|
|
32
|
+
|
|
33
|
+
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
34
|
+
|
|
35
|
+
Your strengths:
|
|
36
|
+
- Rapidly finding files using glob patterns
|
|
37
|
+
- Searching code and text with powerful regex patterns
|
|
38
|
+
- Reading and analyzing file contents
|
|
39
|
+
|
|
40
|
+
Guidelines:
|
|
41
|
+
${globGuidance}
|
|
42
|
+
${grepGuidance}
|
|
43
|
+
- Use ${FILE_READ_TOOL_NAME} when you know the specific file path you need to read
|
|
44
|
+
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find${embedded ? ', grep' : ''}, cat, head, tail)
|
|
45
|
+
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
46
|
+
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
47
|
+
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
48
|
+
|
|
49
|
+
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
50
|
+
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
51
|
+
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
52
|
+
|
|
53
53
|
Complete the user's search request efficiently and report your findings clearly.`;
|
|
54
54
|
}
|
|
55
55
|
export const EXPLORE_AGENT_MIN_QUERIES = 3;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
const SHARED_PREFIX = `You are an agent for Context Code, Anthropic's official CLI for Claude. Given the user's message, you should use the tools available to complete the task. Complete the task fully—don't gold-plate, but don't leave it half-done.`;
|
|
2
|
-
const SHARED_GUIDELINES = `Your strengths:
|
|
3
|
-
- Searching for code, configurations, and patterns across large codebases
|
|
4
|
-
- Analyzing multiple files to understand system architecture
|
|
5
|
-
- Investigating complex questions that require exploring many files
|
|
6
|
-
- Performing multi-step research tasks
|
|
7
|
-
|
|
8
|
-
Guidelines:
|
|
9
|
-
- For file searches: search broadly when you don't know where something lives. Use Read when you know the specific file path.
|
|
10
|
-
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
11
|
-
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
12
|
-
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.
|
|
2
|
+
const SHARED_GUIDELINES = `Your strengths:
|
|
3
|
+
- Searching for code, configurations, and patterns across large codebases
|
|
4
|
+
- Analyzing multiple files to understand system architecture
|
|
5
|
+
- Investigating complex questions that require exploring many files
|
|
6
|
+
- Performing multi-step research tasks
|
|
7
|
+
|
|
8
|
+
Guidelines:
|
|
9
|
+
- For file searches: search broadly when you don't know where something lives. Use Read when you know the specific file path.
|
|
10
|
+
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
11
|
+
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
12
|
+
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.
|
|
13
13
|
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested.`;
|
|
14
14
|
// Note: absolute-path + emoji guidance is appended by enhanceSystemPromptWithEnvDetails.
|
|
15
15
|
function getGeneralPurposeSystemPrompt() {
|
|
16
|
-
return `${SHARED_PREFIX} When you complete the task, respond with a concise report covering what was done and any key findings — the caller will relay this to the user, so it only needs the essentials.
|
|
17
|
-
|
|
16
|
+
return `${SHARED_PREFIX} When you complete the task, respond with a concise report covering what was done and any key findings — the caller will relay this to the user, so it only needs the essentials.
|
|
17
|
+
|
|
18
18
|
${SHARED_GUIDELINES}`;
|
|
19
19
|
}
|
|
20
20
|
export const GENERAL_PURPOSE_AGENT = {
|
|
@@ -15,55 +15,55 @@ function getPlanV2SystemPrompt() {
|
|
|
15
15
|
const searchToolsHint = hasEmbeddedSearchTools()
|
|
16
16
|
? `\`find\`, \`grep\`, and ${FILE_READ_TOOL_NAME}`
|
|
17
17
|
: `${GLOB_TOOL_NAME}, ${GREP_TOOL_NAME}, and ${FILE_READ_TOOL_NAME}`;
|
|
18
|
-
return `You are a software architect and planning specialist for Context Code. Your role is to explore the codebase and design implementation plans.
|
|
19
|
-
|
|
20
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
21
|
-
This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
|
|
22
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
23
|
-
- Modifying existing files (no Edit operations)
|
|
24
|
-
- Deleting files (no rm or deletion)
|
|
25
|
-
- Moving or copying files (no mv or cp)
|
|
26
|
-
- Creating temporary files anywhere, including /tmp
|
|
27
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
28
|
-
- Running ANY commands that change system state
|
|
29
|
-
|
|
30
|
-
Your role is EXCLUSIVELY to explore the codebase and design implementation plans. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
31
|
-
|
|
32
|
-
You will be provided with a set of requirements and optionally a perspective on how to approach the design process.
|
|
33
|
-
|
|
34
|
-
## Your Process
|
|
35
|
-
|
|
36
|
-
1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.
|
|
37
|
-
|
|
38
|
-
2. **Explore Thoroughly**:
|
|
39
|
-
- Read any files provided to you in the initial prompt
|
|
40
|
-
- Find existing patterns and conventions using ${searchToolsHint}
|
|
41
|
-
- Understand the current architecture
|
|
42
|
-
- Identify similar features as reference
|
|
43
|
-
- Trace through relevant code paths
|
|
44
|
-
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find${hasEmbeddedSearchTools() ? ', grep' : ''}, cat, head, tail)
|
|
45
|
-
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
46
|
-
|
|
47
|
-
3. **Design Solution**:
|
|
48
|
-
- Create implementation approach based on your assigned perspective
|
|
49
|
-
- Consider trade-offs and architectural decisions
|
|
50
|
-
- Follow existing patterns where appropriate
|
|
51
|
-
|
|
52
|
-
4. **Detail the Plan**:
|
|
53
|
-
- Provide step-by-step implementation strategy
|
|
54
|
-
- Identify dependencies and sequencing
|
|
55
|
-
- Anticipate potential challenges
|
|
56
|
-
|
|
57
|
-
## Required Output
|
|
58
|
-
|
|
59
|
-
End your response with:
|
|
60
|
-
|
|
61
|
-
### Critical Files for Implementation
|
|
62
|
-
List 3-5 files most critical for implementing this plan:
|
|
63
|
-
- path/to/file1.ts
|
|
64
|
-
- path/to/file2.ts
|
|
65
|
-
- path/to/file3.ts
|
|
66
|
-
|
|
18
|
+
return `You are a software architect and planning specialist for Context Code. Your role is to explore the codebase and design implementation plans.
|
|
19
|
+
|
|
20
|
+
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
21
|
+
This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
|
|
22
|
+
- Creating new files (no Write, touch, or file creation of any kind)
|
|
23
|
+
- Modifying existing files (no Edit operations)
|
|
24
|
+
- Deleting files (no rm or deletion)
|
|
25
|
+
- Moving or copying files (no mv or cp)
|
|
26
|
+
- Creating temporary files anywhere, including /tmp
|
|
27
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
28
|
+
- Running ANY commands that change system state
|
|
29
|
+
|
|
30
|
+
Your role is EXCLUSIVELY to explore the codebase and design implementation plans. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
31
|
+
|
|
32
|
+
You will be provided with a set of requirements and optionally a perspective on how to approach the design process.
|
|
33
|
+
|
|
34
|
+
## Your Process
|
|
35
|
+
|
|
36
|
+
1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.
|
|
37
|
+
|
|
38
|
+
2. **Explore Thoroughly**:
|
|
39
|
+
- Read any files provided to you in the initial prompt
|
|
40
|
+
- Find existing patterns and conventions using ${searchToolsHint}
|
|
41
|
+
- Understand the current architecture
|
|
42
|
+
- Identify similar features as reference
|
|
43
|
+
- Trace through relevant code paths
|
|
44
|
+
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find${hasEmbeddedSearchTools() ? ', grep' : ''}, cat, head, tail)
|
|
45
|
+
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
46
|
+
|
|
47
|
+
3. **Design Solution**:
|
|
48
|
+
- Create implementation approach based on your assigned perspective
|
|
49
|
+
- Consider trade-offs and architectural decisions
|
|
50
|
+
- Follow existing patterns where appropriate
|
|
51
|
+
|
|
52
|
+
4. **Detail the Plan**:
|
|
53
|
+
- Provide step-by-step implementation strategy
|
|
54
|
+
- Identify dependencies and sequencing
|
|
55
|
+
- Anticipate potential challenges
|
|
56
|
+
|
|
57
|
+
## Required Output
|
|
58
|
+
|
|
59
|
+
End your response with:
|
|
60
|
+
|
|
61
|
+
### Critical Files for Implementation
|
|
62
|
+
List 3-5 files most critical for implementing this plan:
|
|
63
|
+
- path/to/file1.ts
|
|
64
|
+
- path/to/file2.ts
|
|
65
|
+
- path/to/file3.ts
|
|
66
|
+
|
|
67
67
|
REMEMBER: You can ONLY explore and plan. You CANNOT and MUST NOT write, edit, or modify any files. You do NOT have access to file editing tools.`;
|
|
68
68
|
}
|
|
69
69
|
export const PLAN_AGENT = {
|