MCPcopy Create free account
hub / github.com/Noumena-Network/code / getSessionSpecificGuidanceSection

Function getSessionSpecificGuidanceSection

src/constants/prompts.ts:344–390  ·  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

342 * in the static intro pending eval.
343 */
344function getSessionSpecificGuidanceSection(
345 enabledTools: Set<string>,
346 skillToolCommands: Command[],
347): string | null {
348 const hasAskUserQuestionTool = enabledTools.has(ASK_USER_QUESTION_TOOL_NAME)
349 const hasSkills =
350 skillToolCommands.length > 0 && enabledTools.has(SKILL_TOOL_NAME)
351 const hasAgentTool = enabledTools.has(AGENT_TOOL_NAME)
352 const searchTools = `${BASH_TOOL_NAME} with \`find\` or \`rg\``
353
354 const items = [
355 hasAskUserQuestionTool
356 ? `If you do not understand why the user has denied a tool call, use the ${ASK_USER_QUESTION_TOOL_NAME} to ask them.`
357 : null,
358 getIsNonInteractiveSession()
359 ? null
360 : `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.`,
361 // isForkSubagentEnabled() reads getIsNonInteractiveSession() — must be
362 // post-boundary or it fragments the static prefix on session type.
363 hasAgentTool ? getAgentToolSection() : null,
364 ...(hasAgentTool &&
365 areExplorePlanAgentsEnabled() &&
366 !isForkSubagentEnabled()
367 ? [
368 `For simple, directed codebase searches (e.g. for a specific file/class/function) use ${searchTools} directly.`,
369 `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.`,
370 ]
371 : []),
372 hasSkills
373 ? `/<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.`
374 : null,
375 DISCOVER_SKILLS_TOOL_NAME !== null &&
376 hasSkills &&
377 enabledTools.has(DISCOVER_SKILLS_TOOL_NAME)
378 ? getDiscoverSkillsGuidance()
379 : null,
380 hasAgentTool &&
381 feature('VERIFICATION_AGENT') &&
382 // 3P default: false — verification agent is ant-only A/B
383 getFeatureValue_CACHED_MAY_BE_STALE('ncode_hive_evidence', false)
384 ? `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.`
385 : null,
386 ].filter(item => item !== null)
387
388 if (items.length === 0) return null
389 return ['# Session-specific guidance', ...prependBullets(items)].join('\n')
390}
391
392// @[MODEL LAUNCH]: Remove this section when we launch numbat.
393function getOutputEfficiencySection(): string {

Callers 1

getSystemPromptFunction · 0.85

Calls 8

getAgentToolSectionFunction · 0.85
isForkSubagentEnabledFunction · 0.85
prependBulletsFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected