( tools: Tools, model: string, additionalWorkingDirectories?: string[], mcpClients?: MCPServerConnection[], )
| 442 | } |
| 443 | |
| 444 | export async function getSystemPrompt( |
| 445 | tools: Tools, |
| 446 | model: string, |
| 447 | additionalWorkingDirectories?: string[], |
| 448 | mcpClients?: MCPServerConnection[], |
| 449 | ): Promise<string[]> { |
| 450 | if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) { |
| 451 | return [ |
| 452 | `You are Claude Code, Anthropic's official CLI for Claude.\n\nCWD: ${getCwd()}\nDate: ${getSessionStartDate()}`, |
| 453 | ] |
| 454 | } |
| 455 | |
| 456 | const cwd = getCwd() |
| 457 | const [skillToolCommands, outputStyleConfig, envInfo] = await Promise.all([ |
| 458 | getSkillToolCommands(cwd), |
| 459 | getOutputStyleConfig(), |
| 460 | computeSimpleEnvInfo(model, additionalWorkingDirectories), |
| 461 | ]) |
| 462 | |
| 463 | const settings = getInitialSettings() |
| 464 | const enabledTools = new Set(tools.map(_ => _.name)) |
| 465 | |
| 466 | if ( |
| 467 | (feature('PROACTIVE') || feature('KAIROS')) && |
| 468 | proactiveModule?.isProactiveActive() |
| 469 | ) { |
| 470 | logForDebugging(`[SystemPrompt] path=simple-proactive`) |
| 471 | return [ |
| 472 | `\nYou are an autonomous agent. Use the available tools to do useful work. |
| 473 | |
| 474 | ${CYBER_RISK_INSTRUCTION}`, |
| 475 | getSystemRemindersSection(), |
| 476 | await loadMemoryPrompt(), |
| 477 | envInfo, |
| 478 | getLanguageSection(settings.language), |
| 479 | // When delta enabled, instructions are announced via persisted |
| 480 | // mcp_instructions_delta attachments (attachments.ts) instead. |
| 481 | isMcpInstructionsDeltaEnabled() |
| 482 | ? null |
| 483 | : getMcpInstructionsSection(mcpClients), |
| 484 | getScratchpadInstructions(), |
| 485 | getFunctionResultClearingSection(model), |
| 486 | SUMMARIZE_TOOL_RESULTS_SECTION, |
| 487 | getProactiveSection(), |
| 488 | ].filter(s => s !== null) |
| 489 | } |
| 490 | |
| 491 | const dynamicSections = [ |
| 492 | systemPromptSection('session_guidance', () => |
| 493 | getSessionSpecificGuidanceSection(enabledTools, skillToolCommands), |
| 494 | ), |
| 495 | systemPromptSection('memory', () => loadMemoryPrompt()), |
| 496 | systemPromptSection('ant_model_override', () => |
| 497 | getAntModelOverrideSection(), |
| 498 | ), |
| 499 | systemPromptSection('env_info_simple', () => |
| 500 | computeSimpleEnvInfo(model, additionalWorkingDirectories), |
| 501 | ), |
no test coverage detected