( existingSystemPrompt: string[], model: string, additionalWorkingDirectories?: string[], enabledToolNames?: ReadonlySet<string>, )
| 758 | export const DEFAULT_AGENT_PROMPT = `You are an agent for Claude 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. 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.` |
| 759 | |
| 760 | export async function enhanceSystemPromptWithEnvDetails( |
| 761 | existingSystemPrompt: string[], |
| 762 | model: string, |
| 763 | additionalWorkingDirectories?: string[], |
| 764 | enabledToolNames?: ReadonlySet<string>, |
| 765 | ): Promise<string[]> { |
| 766 | const notes = `Notes: |
| 767 | - Agent threads always have their cwd reset between bash calls, as a result please only use absolute file paths. |
| 768 | - In your final response, share file paths (always absolute, never relative) that are relevant to the task. Include code snippets only when the exact text is load-bearing (e.g., a bug you found, a function signature the caller asked for) — do not recap code you merely read. |
| 769 | - For clear communication with the user the assistant MUST avoid using emojis. |
| 770 | - Do not use a colon before tool calls. Text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.` |
| 771 | // Subagents get skill_discovery attachments (prefetch.ts runs in query(), |
| 772 | // no agentId guard since #22830) but don't go through getSystemPrompt — |
| 773 | // surface the same DiscoverSkills framing the main session gets. Gated on |
| 774 | // enabledToolNames when the caller provides it (runAgent.ts does). |
| 775 | // AgentTool.tsx:768 builds the prompt before assembleToolPool:830 so it |
| 776 | // omits this param — `?? true` preserves guidance there. |
| 777 | const discoverSkillsGuidance = |
| 778 | feature('EXPERIMENTAL_SKILL_SEARCH') && |
| 779 | skillSearchFeatureCheck?.isSkillSearchEnabled() && |
| 780 | DISCOVER_SKILLS_TOOL_NAME !== null && |
| 781 | (enabledToolNames?.has(DISCOVER_SKILLS_TOOL_NAME) ?? true) |
| 782 | ? getDiscoverSkillsGuidance() |
| 783 | : null |
| 784 | const envInfo = await computeEnvInfo(model, additionalWorkingDirectories) |
| 785 | return [ |
| 786 | ...existingSystemPrompt, |
| 787 | notes, |
| 788 | ...(discoverSkillsGuidance !== null ? [discoverSkillsGuidance] : []), |
| 789 | envInfo, |
| 790 | ] |
| 791 | } |
| 792 | |
| 793 | /** |
| 794 | * Returns instructions for using the scratchpad directory if enabled. |
no test coverage detected