@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
|
@@ -55,43 +55,43 @@ export function registerDebugSkill() {
|
|
|
55
55
|
}
|
|
56
56
|
const justEnabledSection = wasAlreadyLogging
|
|
57
57
|
? ''
|
|
58
|
-
: `
|
|
59
|
-
## Debug Logging Just Enabled
|
|
60
|
-
|
|
61
|
-
Debug logging was OFF for this session until now. Nothing prior to this /debug invocation was captured.
|
|
62
|
-
|
|
63
|
-
Tell the user that debug logging is now active at \`${debugLogPath}\`, ask them to reproduce the issue, then re-read the log. If they can't reproduce, they can also restart with \`claude --debug\` to capture logs from startup.
|
|
58
|
+
: `
|
|
59
|
+
## Debug Logging Just Enabled
|
|
60
|
+
|
|
61
|
+
Debug logging was OFF for this session until now. Nothing prior to this /debug invocation was captured.
|
|
62
|
+
|
|
63
|
+
Tell the user that debug logging is now active at \`${debugLogPath}\`, ask them to reproduce the issue, then re-read the log. If they can't reproduce, they can also restart with \`claude --debug\` to capture logs from startup.
|
|
64
64
|
`;
|
|
65
|
-
const prompt = `# Debug Skill
|
|
66
|
-
|
|
67
|
-
Help the user debug an issue they're encountering in this current Context Code session.
|
|
68
|
-
${justEnabledSection}
|
|
69
|
-
## Session Debug Log
|
|
70
|
-
|
|
71
|
-
The debug log for the current session is at: \`${debugLogPath}\`
|
|
72
|
-
|
|
73
|
-
${logInfo}
|
|
74
|
-
|
|
75
|
-
For additional context, grep for [ERROR] and [WARN] lines across the full file.
|
|
76
|
-
|
|
77
|
-
## Issue Description
|
|
78
|
-
|
|
79
|
-
${args || 'The user did not describe a specific issue. Read the debug log and summarize any errors, warnings, or notable issues.'}
|
|
80
|
-
|
|
81
|
-
## Settings
|
|
82
|
-
|
|
83
|
-
Remember that settings are in:
|
|
84
|
-
* user - ${getSettingsFilePathForSource('userSettings')}
|
|
85
|
-
* project - ${getSettingsFilePathForSource('projectSettings')}
|
|
86
|
-
* local - ${getSettingsFilePathForSource('localSettings')}
|
|
87
|
-
|
|
88
|
-
## Instructions
|
|
89
|
-
|
|
90
|
-
1. Review the user's issue description
|
|
91
|
-
2. The last ${DEFAULT_DEBUG_LINES_READ} lines show the debug file format. Look for [ERROR] and [WARN] entries, stack traces, and failure patterns across the file
|
|
92
|
-
3. Consider launching the ${CLAUDE_CODE_GUIDE_AGENT_TYPE} subagent to understand the relevant Context Code features
|
|
93
|
-
4. Explain what you found in plain language
|
|
94
|
-
5. Suggest concrete fixes or next steps
|
|
65
|
+
const prompt = `# Debug Skill
|
|
66
|
+
|
|
67
|
+
Help the user debug an issue they're encountering in this current Context Code session.
|
|
68
|
+
${justEnabledSection}
|
|
69
|
+
## Session Debug Log
|
|
70
|
+
|
|
71
|
+
The debug log for the current session is at: \`${debugLogPath}\`
|
|
72
|
+
|
|
73
|
+
${logInfo}
|
|
74
|
+
|
|
75
|
+
For additional context, grep for [ERROR] and [WARN] lines across the full file.
|
|
76
|
+
|
|
77
|
+
## Issue Description
|
|
78
|
+
|
|
79
|
+
${args || 'The user did not describe a specific issue. Read the debug log and summarize any errors, warnings, or notable issues.'}
|
|
80
|
+
|
|
81
|
+
## Settings
|
|
82
|
+
|
|
83
|
+
Remember that settings are in:
|
|
84
|
+
* user - ${getSettingsFilePathForSource('userSettings')}
|
|
85
|
+
* project - ${getSettingsFilePathForSource('projectSettings')}
|
|
86
|
+
* local - ${getSettingsFilePathForSource('localSettings')}
|
|
87
|
+
|
|
88
|
+
## Instructions
|
|
89
|
+
|
|
90
|
+
1. Review the user's issue description
|
|
91
|
+
2. The last ${DEFAULT_DEBUG_LINES_READ} lines show the debug file format. Look for [ERROR] and [WARN] entries, stack traces, and failure patterns across the file
|
|
92
|
+
3. Consider launching the ${CLAUDE_CODE_GUIDE_AGENT_TYPE} subagent to understand the relevant Context Code features
|
|
93
|
+
4. Explain what you found in plain language
|
|
94
|
+
5. Suggest concrete fixes or next steps
|
|
95
95
|
`;
|
|
96
96
|
return [{ type: 'text', text: prompt }];
|
|
97
97
|
},
|
|
@@ -115,158 +115,158 @@ function buildPrompt(opts) {
|
|
|
115
115
|
: BASE_QUESTION;
|
|
116
116
|
const firstStep = userArgs
|
|
117
117
|
? `The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.`
|
|
118
|
-
: `Your FIRST action must be a single ${ASK_USER_QUESTION_TOOL_NAME} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
|
|
119
|
-
|
|
120
|
-
${jsonStringify(initialQuestion)}
|
|
121
|
-
|
|
118
|
+
: `Your FIRST action must be a single ${ASK_USER_QUESTION_TOOL_NAME} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
|
|
119
|
+
|
|
120
|
+
${jsonStringify(initialQuestion)}
|
|
121
|
+
|
|
122
122
|
Set \`header: "Action"\` and offer the four actions (create/list/update/run) as options. After the user picks, follow the matching workflow below.`;
|
|
123
|
-
return `# Schedule Remote Agents
|
|
124
|
-
|
|
125
|
-
You are helping the user schedule, update, list, or run **remote** Context Code agents. These are NOT local cron jobs — each trigger spawns a fully isolated remote session (CCR) in Anthropic's cloud infrastructure on a cron schedule. The agent runs in a sandboxed environment with its own git checkout, tools, and optional MCP connections.
|
|
126
|
-
|
|
127
|
-
## First Step
|
|
128
|
-
|
|
129
|
-
${firstStep}
|
|
130
|
-
${setupNotesSection}
|
|
131
|
-
|
|
132
|
-
## What You Can Do
|
|
133
|
-
|
|
134
|
-
Use the \`${REMOTE_TRIGGER_TOOL_NAME}\` tool (load it first with \`ToolSearch select:${REMOTE_TRIGGER_TOOL_NAME}\`; auth is handled in-process — do not use curl):
|
|
135
|
-
|
|
136
|
-
- \`{action: "list"}\` — list all triggers
|
|
137
|
-
- \`{action: "get", trigger_id: "..."}\` — fetch one trigger
|
|
138
|
-
- \`{action: "create", body: {...}}\` — create a trigger
|
|
139
|
-
- \`{action: "update", trigger_id: "...", body: {...}}\` — partial update
|
|
140
|
-
- \`{action: "run", trigger_id: "..."}\` — run a trigger now
|
|
141
|
-
|
|
142
|
-
You CANNOT delete triggers. If the user asks to delete, direct them to: https://claude.ai/code/scheduled
|
|
143
|
-
|
|
144
|
-
## Create body shape
|
|
145
|
-
|
|
146
|
-
\`\`\`json
|
|
147
|
-
{
|
|
148
|
-
"name": "AGENT_NAME",
|
|
149
|
-
"cron_expression": "CRON_EXPR",
|
|
150
|
-
"enabled": true,
|
|
151
|
-
"job_config": {
|
|
152
|
-
"ccr": {
|
|
153
|
-
"environment_id": "ENVIRONMENT_ID",
|
|
154
|
-
"session_context": {
|
|
155
|
-
"model": "claude-sonnet-4-6",
|
|
156
|
-
"sources": [
|
|
157
|
-
{"git_repository": {"url": "${gitRepoUrl || 'https://github.com/ORG/REPO'}"}}
|
|
158
|
-
],
|
|
159
|
-
"allowed_tools": ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
|
|
160
|
-
},
|
|
161
|
-
"events": [
|
|
162
|
-
{"data": {
|
|
163
|
-
"uuid": "<lowercase v4 uuid>",
|
|
164
|
-
"session_id": "",
|
|
165
|
-
"type": "user",
|
|
166
|
-
"parent_tool_use_id": null,
|
|
167
|
-
"message": {"content": "PROMPT_HERE", "role": "user"}
|
|
168
|
-
}}
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
\`\`\`
|
|
174
|
-
|
|
175
|
-
Generate a fresh lowercase UUID for \`events[].data.uuid\` yourself.
|
|
176
|
-
|
|
177
|
-
## Available MCP Connectors
|
|
178
|
-
|
|
179
|
-
These are the user's currently connected claude.ai MCP connectors:
|
|
180
|
-
|
|
181
|
-
${connectorsInfo}
|
|
182
|
-
|
|
183
|
-
When attaching connectors to a trigger, use the \`connector_uuid\` and \`name\` shown above (the name is already sanitized to only contain letters, numbers, hyphens, and underscores), and the connector's URL. The \`name\` field in \`mcp_connections\` must only contain \`[a-zA-Z0-9_-]\` — dots and spaces are NOT allowed.
|
|
184
|
-
|
|
185
|
-
**Important:** Infer what services the agent needs from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack connectors. Cross-reference against the list above and warn if any required service isn't connected. If a needed connector is missing, direct the user to https://claude.ai/settings/connectors to connect it first.
|
|
186
|
-
|
|
187
|
-
## Environments
|
|
188
|
-
|
|
189
|
-
Every trigger requires an \`environment_id\` in the job config. This determines where the remote agent runs. Ask the user which environment to use.
|
|
190
|
-
|
|
191
|
-
${environmentsInfo}
|
|
192
|
-
|
|
193
|
-
Use the \`id\` value as the \`environment_id\` in \`job_config.ccr.environment_id\`.
|
|
194
|
-
${createdEnvironment ? `\n**Note:** A new environment \`${createdEnvironment.name}\` (id: \`${createdEnvironment.environment_id}\`) was just created for the user because they had none. Use this id for \`job_config.ccr.environment_id\` and mention the creation when you confirm the trigger config.\n` : ''}
|
|
195
|
-
|
|
196
|
-
## API Field Reference
|
|
197
|
-
|
|
198
|
-
### Create Trigger — Required Fields
|
|
199
|
-
- \`name\` (string) — A descriptive name
|
|
200
|
-
- \`cron_expression\` (string) — 5-field cron. **Minimum interval is 1 hour.**
|
|
201
|
-
- \`job_config\` (object) — Session configuration (see structure above)
|
|
202
|
-
|
|
203
|
-
### Create Trigger — Optional Fields
|
|
204
|
-
- \`enabled\` (boolean, default: true)
|
|
205
|
-
- \`mcp_connections\` (array) — MCP servers to attach:
|
|
206
|
-
\`\`\`json
|
|
207
|
-
[{"connector_uuid": "uuid", "name": "server-name", "url": "https://..."}]
|
|
208
|
-
\`\`\`
|
|
209
|
-
|
|
210
|
-
### Update Trigger — Optional Fields
|
|
211
|
-
All fields optional (partial update):
|
|
212
|
-
- \`name\`, \`cron_expression\`, \`enabled\`, \`job_config\`
|
|
213
|
-
- \`mcp_connections\` — Replace MCP connections
|
|
214
|
-
- \`clear_mcp_connections\` (boolean) — Remove all MCP connections
|
|
215
|
-
|
|
216
|
-
### Cron Expression Examples
|
|
217
|
-
|
|
218
|
-
The user's local timezone is **${userTimezone}**. Cron expressions are always in UTC. When the user says a local time, convert it to UTC for the cron expression but confirm with them: "9am ${userTimezone} = Xam UTC, so the cron would be \`0 X * * 1-5\`."
|
|
219
|
-
|
|
220
|
-
- \`0 9 * * 1-5\` — Every weekday at 9am **UTC**
|
|
221
|
-
- \`0 */2 * * *\` — Every 2 hours
|
|
222
|
-
- \`0 0 * * *\` — Daily at midnight **UTC**
|
|
223
|
-
- \`30 14 * * 1\` — Every Monday at 2:30pm **UTC**
|
|
224
|
-
- \`0 8 1 * *\` — First of every month at 8am **UTC**
|
|
225
|
-
|
|
226
|
-
Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
|
|
227
|
-
|
|
228
|
-
## Workflow
|
|
229
|
-
|
|
230
|
-
### CREATE a new trigger:
|
|
231
|
-
|
|
232
|
-
1. **Understand the goal** — Ask what they want the remote agent to do. What repo(s)? What task? Remind them that the agent runs remotely — it won't have access to their local machine, local files, or local environment variables.
|
|
233
|
-
2. **Craft the prompt** — Help them write an effective agent prompt. Good prompts are:
|
|
234
|
-
- Specific about what to do and what success looks like
|
|
235
|
-
- Clear about which files/areas to focus on
|
|
236
|
-
- Explicit about what actions to take (open PRs, commit, just analyze, etc.)
|
|
237
|
-
3. **Set the schedule** — Ask when and how often. The user's timezone is ${userTimezone}. When they say a time (e.g., "every morning at 9am"), assume they mean their local time and convert to UTC for the cron expression. Always confirm the conversion: "9am ${userTimezone} = Xam UTC."
|
|
238
|
-
4. **Choose the model** — Default to \`claude-sonnet-4-6\`. Tell the user which model you're defaulting to and ask if they want a different one.
|
|
239
|
-
5. **Validate connections** — Infer what services the agent will need from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack MCP connectors. Cross-reference with the connectors list above. If any are missing, warn the user and link them to https://claude.ai/settings/connectors to connect first.${gitRepoUrl ? ` The default git repo is already set to \`${gitRepoUrl}\`. Ask the user if this is the right repo or if they need a different one.` : ' Ask which git repos the remote agent needs cloned into its environment.'}
|
|
240
|
-
6. **Review and confirm** — Show the full configuration before creating. Let them adjust.
|
|
241
|
-
7. **Create it** \u2014 Call \`${REMOTE_TRIGGER_TOOL_NAME}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
|
|
242
|
-
|
|
243
|
-
### UPDATE a trigger:
|
|
244
|
-
|
|
245
|
-
1. List triggers first so they can pick one
|
|
246
|
-
2. Ask what they want to change
|
|
247
|
-
3. Show current vs proposed value
|
|
248
|
-
4. Confirm and update
|
|
249
|
-
|
|
250
|
-
### LIST triggers:
|
|
251
|
-
|
|
252
|
-
1. Fetch and display in a readable format
|
|
253
|
-
2. Show: name, schedule (human-readable), enabled/disabled, next run, repo(s)
|
|
254
|
-
|
|
255
|
-
### RUN NOW:
|
|
256
|
-
|
|
257
|
-
1. List triggers if they haven't specified which one
|
|
258
|
-
2. Confirm which trigger
|
|
259
|
-
3. Execute and confirm
|
|
260
|
-
|
|
261
|
-
## Important Notes
|
|
262
|
-
|
|
263
|
-
- These are REMOTE agents — they run in Anthropic's cloud, not on the user's machine. They cannot access local files, local services, or local environment variables.
|
|
264
|
-
- Always convert cron to human-readable when displaying
|
|
265
|
-
- Default to \`enabled: true\` unless user says otherwise
|
|
266
|
-
- Accept GitHub URLs in any format (https://github.com/org/repo, org/repo, etc.) and normalize to the full HTTPS URL (without .git suffix)
|
|
267
|
-
- The prompt is the most important part — spend time getting it right. The remote agent starts with zero context, so the prompt must be self-contained.
|
|
268
|
-
- To delete a trigger, direct users to https://claude.ai/code/scheduled
|
|
269
|
-
${needsGitHubAccessReminder ? `- If the user's request seems to require GitHub repo access (e.g. cloning a repo, opening PRs, reading code), remind them that ${getFeatureValue_CACHED_MAY_BE_STALE('tengu_cobalt_lantern', false) ? "they should run /web-setup to connect their GitHub account (or install the Claude GitHub App on the repo as an alternative) — otherwise the remote agent won't be able to access it" : "they need the Claude GitHub App installed on the repo — otherwise the remote agent won't be able to access it"}.` : ''}
|
|
123
|
+
return `# Schedule Remote Agents
|
|
124
|
+
|
|
125
|
+
You are helping the user schedule, update, list, or run **remote** Context Code agents. These are NOT local cron jobs — each trigger spawns a fully isolated remote session (CCR) in Anthropic's cloud infrastructure on a cron schedule. The agent runs in a sandboxed environment with its own git checkout, tools, and optional MCP connections.
|
|
126
|
+
|
|
127
|
+
## First Step
|
|
128
|
+
|
|
129
|
+
${firstStep}
|
|
130
|
+
${setupNotesSection}
|
|
131
|
+
|
|
132
|
+
## What You Can Do
|
|
133
|
+
|
|
134
|
+
Use the \`${REMOTE_TRIGGER_TOOL_NAME}\` tool (load it first with \`ToolSearch select:${REMOTE_TRIGGER_TOOL_NAME}\`; auth is handled in-process — do not use curl):
|
|
135
|
+
|
|
136
|
+
- \`{action: "list"}\` — list all triggers
|
|
137
|
+
- \`{action: "get", trigger_id: "..."}\` — fetch one trigger
|
|
138
|
+
- \`{action: "create", body: {...}}\` — create a trigger
|
|
139
|
+
- \`{action: "update", trigger_id: "...", body: {...}}\` — partial update
|
|
140
|
+
- \`{action: "run", trigger_id: "..."}\` — run a trigger now
|
|
141
|
+
|
|
142
|
+
You CANNOT delete triggers. If the user asks to delete, direct them to: https://claude.ai/code/scheduled
|
|
143
|
+
|
|
144
|
+
## Create body shape
|
|
145
|
+
|
|
146
|
+
\`\`\`json
|
|
147
|
+
{
|
|
148
|
+
"name": "AGENT_NAME",
|
|
149
|
+
"cron_expression": "CRON_EXPR",
|
|
150
|
+
"enabled": true,
|
|
151
|
+
"job_config": {
|
|
152
|
+
"ccr": {
|
|
153
|
+
"environment_id": "ENVIRONMENT_ID",
|
|
154
|
+
"session_context": {
|
|
155
|
+
"model": "claude-sonnet-4-6",
|
|
156
|
+
"sources": [
|
|
157
|
+
{"git_repository": {"url": "${gitRepoUrl || 'https://github.com/ORG/REPO'}"}}
|
|
158
|
+
],
|
|
159
|
+
"allowed_tools": ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
|
|
160
|
+
},
|
|
161
|
+
"events": [
|
|
162
|
+
{"data": {
|
|
163
|
+
"uuid": "<lowercase v4 uuid>",
|
|
164
|
+
"session_id": "",
|
|
165
|
+
"type": "user",
|
|
166
|
+
"parent_tool_use_id": null,
|
|
167
|
+
"message": {"content": "PROMPT_HERE", "role": "user"}
|
|
168
|
+
}}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
Generate a fresh lowercase UUID for \`events[].data.uuid\` yourself.
|
|
176
|
+
|
|
177
|
+
## Available MCP Connectors
|
|
178
|
+
|
|
179
|
+
These are the user's currently connected claude.ai MCP connectors:
|
|
180
|
+
|
|
181
|
+
${connectorsInfo}
|
|
182
|
+
|
|
183
|
+
When attaching connectors to a trigger, use the \`connector_uuid\` and \`name\` shown above (the name is already sanitized to only contain letters, numbers, hyphens, and underscores), and the connector's URL. The \`name\` field in \`mcp_connections\` must only contain \`[a-zA-Z0-9_-]\` — dots and spaces are NOT allowed.
|
|
184
|
+
|
|
185
|
+
**Important:** Infer what services the agent needs from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack connectors. Cross-reference against the list above and warn if any required service isn't connected. If a needed connector is missing, direct the user to https://claude.ai/settings/connectors to connect it first.
|
|
186
|
+
|
|
187
|
+
## Environments
|
|
188
|
+
|
|
189
|
+
Every trigger requires an \`environment_id\` in the job config. This determines where the remote agent runs. Ask the user which environment to use.
|
|
190
|
+
|
|
191
|
+
${environmentsInfo}
|
|
192
|
+
|
|
193
|
+
Use the \`id\` value as the \`environment_id\` in \`job_config.ccr.environment_id\`.
|
|
194
|
+
${createdEnvironment ? `\n**Note:** A new environment \`${createdEnvironment.name}\` (id: \`${createdEnvironment.environment_id}\`) was just created for the user because they had none. Use this id for \`job_config.ccr.environment_id\` and mention the creation when you confirm the trigger config.\n` : ''}
|
|
195
|
+
|
|
196
|
+
## API Field Reference
|
|
197
|
+
|
|
198
|
+
### Create Trigger — Required Fields
|
|
199
|
+
- \`name\` (string) — A descriptive name
|
|
200
|
+
- \`cron_expression\` (string) — 5-field cron. **Minimum interval is 1 hour.**
|
|
201
|
+
- \`job_config\` (object) — Session configuration (see structure above)
|
|
202
|
+
|
|
203
|
+
### Create Trigger — Optional Fields
|
|
204
|
+
- \`enabled\` (boolean, default: true)
|
|
205
|
+
- \`mcp_connections\` (array) — MCP servers to attach:
|
|
206
|
+
\`\`\`json
|
|
207
|
+
[{"connector_uuid": "uuid", "name": "server-name", "url": "https://..."}]
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
### Update Trigger — Optional Fields
|
|
211
|
+
All fields optional (partial update):
|
|
212
|
+
- \`name\`, \`cron_expression\`, \`enabled\`, \`job_config\`
|
|
213
|
+
- \`mcp_connections\` — Replace MCP connections
|
|
214
|
+
- \`clear_mcp_connections\` (boolean) — Remove all MCP connections
|
|
215
|
+
|
|
216
|
+
### Cron Expression Examples
|
|
217
|
+
|
|
218
|
+
The user's local timezone is **${userTimezone}**. Cron expressions are always in UTC. When the user says a local time, convert it to UTC for the cron expression but confirm with them: "9am ${userTimezone} = Xam UTC, so the cron would be \`0 X * * 1-5\`."
|
|
219
|
+
|
|
220
|
+
- \`0 9 * * 1-5\` — Every weekday at 9am **UTC**
|
|
221
|
+
- \`0 */2 * * *\` — Every 2 hours
|
|
222
|
+
- \`0 0 * * *\` — Daily at midnight **UTC**
|
|
223
|
+
- \`30 14 * * 1\` — Every Monday at 2:30pm **UTC**
|
|
224
|
+
- \`0 8 1 * *\` — First of every month at 8am **UTC**
|
|
225
|
+
|
|
226
|
+
Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
|
|
227
|
+
|
|
228
|
+
## Workflow
|
|
229
|
+
|
|
230
|
+
### CREATE a new trigger:
|
|
231
|
+
|
|
232
|
+
1. **Understand the goal** — Ask what they want the remote agent to do. What repo(s)? What task? Remind them that the agent runs remotely — it won't have access to their local machine, local files, or local environment variables.
|
|
233
|
+
2. **Craft the prompt** — Help them write an effective agent prompt. Good prompts are:
|
|
234
|
+
- Specific about what to do and what success looks like
|
|
235
|
+
- Clear about which files/areas to focus on
|
|
236
|
+
- Explicit about what actions to take (open PRs, commit, just analyze, etc.)
|
|
237
|
+
3. **Set the schedule** — Ask when and how often. The user's timezone is ${userTimezone}. When they say a time (e.g., "every morning at 9am"), assume they mean their local time and convert to UTC for the cron expression. Always confirm the conversion: "9am ${userTimezone} = Xam UTC."
|
|
238
|
+
4. **Choose the model** — Default to \`claude-sonnet-4-6\`. Tell the user which model you're defaulting to and ask if they want a different one.
|
|
239
|
+
5. **Validate connections** — Infer what services the agent will need from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack MCP connectors. Cross-reference with the connectors list above. If any are missing, warn the user and link them to https://claude.ai/settings/connectors to connect first.${gitRepoUrl ? ` The default git repo is already set to \`${gitRepoUrl}\`. Ask the user if this is the right repo or if they need a different one.` : ' Ask which git repos the remote agent needs cloned into its environment.'}
|
|
240
|
+
6. **Review and confirm** — Show the full configuration before creating. Let them adjust.
|
|
241
|
+
7. **Create it** \u2014 Call \`${REMOTE_TRIGGER_TOOL_NAME}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
|
|
242
|
+
|
|
243
|
+
### UPDATE a trigger:
|
|
244
|
+
|
|
245
|
+
1. List triggers first so they can pick one
|
|
246
|
+
2. Ask what they want to change
|
|
247
|
+
3. Show current vs proposed value
|
|
248
|
+
4. Confirm and update
|
|
249
|
+
|
|
250
|
+
### LIST triggers:
|
|
251
|
+
|
|
252
|
+
1. Fetch and display in a readable format
|
|
253
|
+
2. Show: name, schedule (human-readable), enabled/disabled, next run, repo(s)
|
|
254
|
+
|
|
255
|
+
### RUN NOW:
|
|
256
|
+
|
|
257
|
+
1. List triggers if they haven't specified which one
|
|
258
|
+
2. Confirm which trigger
|
|
259
|
+
3. Execute and confirm
|
|
260
|
+
|
|
261
|
+
## Important Notes
|
|
262
|
+
|
|
263
|
+
- These are REMOTE agents — they run in Anthropic's cloud, not on the user's machine. They cannot access local files, local services, or local environment variables.
|
|
264
|
+
- Always convert cron to human-readable when displaying
|
|
265
|
+
- Default to \`enabled: true\` unless user says otherwise
|
|
266
|
+
- Accept GitHub URLs in any format (https://github.com/org/repo, org/repo, etc.) and normalize to the full HTTPS URL (without .git suffix)
|
|
267
|
+
- The prompt is the most important part — spend time getting it right. The remote agent starts with zero context, so the prompt must be self-contained.
|
|
268
|
+
- To delete a trigger, direct users to https://claude.ai/code/scheduled
|
|
269
|
+
${needsGitHubAccessReminder ? `- If the user's request seems to require GitHub repo access (e.g. cloning a repo, opening PRs, reading code), remind them that ${getFeatureValue_CACHED_MAY_BE_STALE('tengu_cobalt_lantern', false) ? "they should run /web-setup to connect their GitHub account (or install the Claude GitHub App on the repo as an alternative) — otherwise the remote agent won't be able to access it" : "they need the Claude GitHub App installed on the repo — otherwise the remote agent won't be able to access it"}.` : ''}
|
|
270
270
|
${userArgs ? `\n## User Request\n\nThe user said: "${userArgs}"\n\nStart by understanding their intent and working through the appropriate workflow above.` : ''}`;
|
|
271
271
|
}
|
|
272
272
|
export function registerScheduleRemoteAgentsSkill() {
|