(
mcpClients: ReadonlyArray<{ name: string }>,
scratchpadDir?: string,
)
| 78 | } |
| 79 | |
| 80 | export function getCoordinatorUserContext( |
| 81 | mcpClients: ReadonlyArray<{ name: string }>, |
| 82 | scratchpadDir?: string, |
| 83 | ): { [k: string]: string } { |
| 84 | if (!isCoordinatorMode()) { |
| 85 | return {} |
| 86 | } |
| 87 | |
| 88 | const workerTools = isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE) |
| 89 | ? [BASH_TOOL_NAME, FILE_READ_TOOL_NAME, FILE_EDIT_TOOL_NAME] |
| 90 | .sort() |
| 91 | .join(', ') |
| 92 | : Array.from(ASYNC_AGENT_ALLOWED_TOOLS) |
| 93 | .filter(name => !INTERNAL_WORKER_TOOLS.has(name)) |
| 94 | .sort() |
| 95 | .join(', ') |
| 96 | |
| 97 | let content = `Workers spawned via the ${AGENT_TOOL_NAME} tool have access to these tools: ${workerTools}` |
| 98 | |
| 99 | if (mcpClients.length > 0) { |
| 100 | const serverNames = mcpClients.map(c => c.name).join(', ') |
| 101 | content += `\n\nWorkers also have access to MCP tools from connected MCP servers: ${serverNames}` |
| 102 | } |
| 103 | |
| 104 | if (scratchpadDir && isScratchpadGateEnabled()) { |
| 105 | content += `\n\nScratchpad directory: ${scratchpadDir}\nWorkers can read and write here without permission prompts. Use this for durable cross-worker knowledge — structure files however fits the work.` |
| 106 | } |
| 107 | |
| 108 | return { workerToolsContext: content } |
| 109 | } |
| 110 | |
| 111 | export function getCoordinatorSystemPrompt(): string { |
| 112 | const workerCapabilities = isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE) |
no test coverage detected