feat(plan): unify workflow location in system prompt to optimize caching (#18258)

This commit is contained in:
Jerop Kipruto
2026-02-03 22:11:28 -05:00
committed by GitHub
parent ed02b94570
commit d866e7e6e7
3 changed files with 67 additions and 69 deletions
+13 -17
View File
@@ -54,18 +54,6 @@ export class PromptProvider {
);
const isGemini3 = isPreviewModel(desiredModel);
// --- Context Gathering ---
const planOptions: snippets.ApprovalModePlanOptions | undefined = isPlanMode
? {
planModeToolsList: PLAN_MODE_TOOLS.filter((t) =>
new Set(toolNames).has(t),
)
.map((t) => `- \`${t}\``)
.join('\n'),
plansDir: config.storage.getProjectTempPlansDir(),
}
: undefined;
let basePrompt: string;
// --- Template File Override ---
@@ -122,6 +110,18 @@ export class PromptProvider {
}),
!isPlanMode,
),
planningWorkflow: this.withSection(
'planningWorkflow',
() => ({
planModeToolsList: PLAN_MODE_TOOLS.filter((t) =>
new Set(toolNames).has(t),
)
.map((t) => `- \`${t}\``)
.join('\n'),
plansDir: config.storage.getProjectTempPlansDir(),
}),
isPlanMode,
),
operationalGuidelines: this.withSection(
'operationalGuidelines',
() => ({
@@ -145,11 +145,7 @@ export class PromptProvider {
}
// --- Finalization (Shell) ---
const finalPrompt = snippets.renderFinalShell(
basePrompt,
userMemory,
planOptions,
);
const finalPrompt = snippets.renderFinalShell(basePrompt, userMemory);
// Sanitize erratic newlines from composition
const sanitizedPrompt = finalPrompt.replace(/\n{3,}/g, '\n\n');