( tools: Tools, model: string, additionalWorkingDirectories?: string[], mcpClients?: MCPServerConnection[], )
| 408 | } |
| 409 | |
| 410 | export async function getSystemPrompt( |
| 411 | tools: Tools, |
| 412 | model: string, |
| 413 | additionalWorkingDirectories?: string[], |
| 414 | mcpClients?: MCPServerConnection[], |
| 415 | ): Promise<string[]> { |
| 416 | if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) { |
| 417 | return [ |
| 418 | `You are Claude Code, Anthropic's official CLI for Claude.\n\nCWD: ${getCwd()}\nDate: ${getSessionStartDate()}`, |
| 419 | ] |
| 420 | } |
| 421 | |
| 422 | const cwd = getCwd() |
| 423 | const [skillToolCommands, outputStyleConfig, envInfo] = await Promise.all([ |
| 424 | getSkillToolCommands(cwd), |
| 425 | getOutputStyleConfig(), |
| 426 | computeSimpleEnvInfo(model, additionalWorkingDirectories), |
| 427 | ]) |
| 428 | |
| 429 | const settings = getInitialSettings() |
| 430 | const enabledTools = new Set(tools.map(_ => _.name)) |
| 431 | |
| 432 | if ( |
| 433 | (feature('PROACTIVE') || feature('KAIROS')) && |
| 434 | proactiveModule?.isProactiveActive() |
| 435 | ) { |
| 436 | logForDebugging(`[SystemPrompt] path=simple-proactive`) |
| 437 | return [ |
| 438 | `\nYou are an autonomous agent. Use the available tools to do useful work. |
| 439 | |
| 440 | ${CYBER_RISK_INSTRUCTION}`, |
| 441 | getSystemRemindersSection(), |
| 442 | await loadMemoryPrompt(), |
| 443 | envInfo, |
| 444 | getLanguageSection(settings.language), |
| 445 | // When delta enabled, instructions are announced via persisted |
| 446 | // mcp_instructions_delta attachments (attachments.ts) instead. |
| 447 | isMcpInstructionsDeltaEnabled() |
| 448 | ? null |
| 449 | : getMcpInstructionsSection(mcpClients), |
| 450 | getScratchpadInstructions(), |
| 451 | SUMMARIZE_TOOL_RESULTS_SECTION, |
| 452 | getProactiveSection(), |
| 453 | ].filter(s => s !== null) |
| 454 | } |
| 455 | |
| 456 | const dynamicSections = [ |
| 457 | systemPromptSection('mode_persona', () => getModePersonaSection()), |
| 458 | systemPromptSection('session_guidance', () => |
| 459 | getSessionSpecificGuidanceSection(enabledTools, skillToolCommands), |
| 460 | ), |
| 461 | systemPromptSection('memory', () => loadMemoryPrompt()), |
| 462 | systemPromptSection('ant_model_override', () => |
| 463 | getAntModelOverrideSection(), |
| 464 | ), |
| 465 | systemPromptSection('env_info_simple', () => |
| 466 | computeSimpleEnvInfo(model, additionalWorkingDirectories), |
| 467 | ), |
no test coverage detected