mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(plan): unify workflow location in system prompt to optimize caching (#18258)
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user