MCPcopy
hub / github.com/codeaashu/claude-code / getSessionSpecificGuidanceSection

Function getSessionSpecificGuidanceSection

src/constants/prompts.ts:352–400  ·  view source on GitHub ↗

* Session-variant guidance that would fragment the cacheScope:'global' * prefix if placed before SYSTEM_PROMPT_DYNAMIC_BOUNDARY. Each conditional * here is a runtime bit that would otherwise multiply the Blake2b prefix * hash variants (2^N). See PR #24490, #24171 for the same bug class. * * out

(
  enabledTools: Set<string>,
  skillToolCommands: Command[],
)

Source from the content-addressed store, hash-verified

350 * in the static intro pending eval.
351 */
352function getSessionSpecificGuidanceSection(
353 enabledTools: Set<string>,
354 skillToolCommands: Command[],
355): string | null {
356 const hasAskUserQuestionTool = enabledTools.has(ASK_USER_QUESTION_TOOL_NAME)
357 const hasSkills =
358 skillToolCommands.length > 0 && enabledTools.has(SKILL_TOOL_NAME)
359 const hasAgentTool = enabledTools.has(AGENT_TOOL_NAME)
360 const searchTools = hasEmbeddedSearchTools()
361 ? `\`find\` or \`grep\` via the ${BASH_TOOL_NAME} tool`
362 : `the ${GLOB_TOOL_NAME} or ${GREP_TOOL_NAME}`
363
364 const items = [
365 hasAskUserQuestionTool
366 ? `If you do not understand why the user has denied a tool call, use the ${ASK_USER_QUESTION_TOOL_NAME} to ask them.`
367 : null,
368 getIsNonInteractiveSession()
369 ? null
370 : `If you need the user to run a shell command themselves (e.g., an interactive login like \`gcloud auth login\`), suggest they type \`! <command>\` in the prompt — the \`!\` prefix runs the command in this session so its output lands directly in the conversation.`,
371 // isForkSubagentEnabled() reads getIsNonInteractiveSession() — must be
372 // post-boundary or it fragments the static prefix on session type.
373 hasAgentTool ? getAgentToolSection() : null,
374 ...(hasAgentTool &&
375 areExplorePlanAgentsEnabled() &&
376 !isForkSubagentEnabled()
377 ? [
378 `For simple, directed codebase searches (e.g. for a specific file/class/function) use ${searchTools} directly.`,
379 `For broader codebase exploration and deep research, use the ${AGENT_TOOL_NAME} tool with subagent_type=${EXPLORE_AGENT.agentType}. This is slower than using ${searchTools} directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than ${EXPLORE_AGENT_MIN_QUERIES} queries.`,
380 ]
381 : []),
382 hasSkills
383 ? `/<skill-name> (e.g., /commit) is shorthand for users to invoke a user-invocable skill. When executed, the skill gets expanded to a full prompt. Use the ${SKILL_TOOL_NAME} tool to execute them. IMPORTANT: Only use ${SKILL_TOOL_NAME} for skills listed in its user-invocable skills section - do not guess or use built-in CLI commands.`
384 : null,
385 DISCOVER_SKILLS_TOOL_NAME !== null &&
386 hasSkills &&
387 enabledTools.has(DISCOVER_SKILLS_TOOL_NAME)
388 ? getDiscoverSkillsGuidance()
389 : null,
390 hasAgentTool &&
391 feature('VERIFICATION_AGENT') &&
392 // 3P default: false — verification agent is ant-only A/B
393 getFeatureValue_CACHED_MAY_BE_STALE('tengu_hive_evidence', false)
394 ? `The contract: when non-trivial implementation happens on your turn, independent adversarial verification must happen before you report completion \u2014 regardless of who did the implementing (you directly, a fork you spawned, or a subagent). You are the one reporting to the user; you own the gate. Non-trivial means: 3+ file edits, backend/API changes, or infrastructure changes. Spawn the ${AGENT_TOOL_NAME} tool with subagent_type="${VERIFICATION_AGENT_TYPE}". Your own checks, caveats, and a fork's self-checks do NOT substitute \u2014 only the verifier assigns a verdict; you cannot self-assign PARTIAL. Pass the original user request, all files changed (by anyone), the approach, and the plan file path if applicable. Flag concerns if you have them but do NOT share test results or claim things work. On FAIL: fix, resume the verifier with its findings plus your fix, repeat until PASS. On PASS: spot-check it \u2014 re-run 2-3 commands from its report, confirm every PASS has a Command run block with output that matches your re-run. If any PASS lacks a command block or diverges, resume the verifier with the specifics. On PARTIAL (from the verifier): report what passed and what could not be verified.`
395 : null,
396 ].filter(item => item !== null)
397
398 if (items.length === 0) return null
399 return ['# Session-specific guidance', ...prependBullets(items)].join('\n')
400}
401
402// @[MODEL LAUNCH]: Remove this section when we launch numbat.
403function getOutputEfficiencySection(): string {

Callers 1

getSystemPromptFunction · 0.85

Calls 10

hasEmbeddedSearchToolsFunction · 0.85
getAgentToolSectionFunction · 0.85
isForkSubagentEnabledFunction · 0.85
featureFunction · 0.85
prependBulletsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected