From 398baabc59876a752ad571debf6429cf258eab48 Mon Sep 17 00:00:00 2001 From: Adam Weidman Date: Thu, 26 Feb 2026 09:50:36 -0500 Subject: [PATCH] merge(read-exp): Reconcile 'afw/read-exp-v3' with 'main' - Integrate model-specific tool optimizations (isGemini3) into read-file and snippets. - Reconcile prompt snippets with main's Context Efficiency mandates and experiment's discovery guidelines. - Adopt main's refactored tool definition structure while retaining experiment's surgical extraction guidance. - Resolve pagination and truncation logic in file utilities. - Update snapshots and verify with full test suite. - Align prompt provider and snippets with main's code style and linting patterns. --- packages/core/src/prompts/promptProvider.ts | 10 +++++++--- packages/core/src/prompts/snippets.ts | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/core/src/prompts/promptProvider.ts b/packages/core/src/prompts/promptProvider.ts index 91b2ba2b00..23dcc4bcbe 100644 --- a/packages/core/src/prompts/promptProvider.ts +++ b/packages/core/src/prompts/promptProvider.ts @@ -119,6 +119,7 @@ export class PromptProvider { })), coreMandates: this.withSection('coreMandates', () => ({ interactive: interactiveMode, + isGemini3: isModernModel, hasSkills: skills.length > 0, hasHierarchicalMemory, contextFilenames, @@ -175,7 +176,6 @@ export class PromptProvider { 'operationalGuidelines', () => ({ interactive: interactiveMode, - isGemini3: isModernModel, enableShellEfficiency: config.getEnableShellOutputEfficiency(), interactiveShellEnabled: config.isInteractiveShellEnabled(), }), @@ -196,9 +196,13 @@ export class PromptProvider { : this.withSection('finalReminder', () => ({ readFileToolName: READ_FILE_TOOL_NAME, })), - }; + } as snippets.SystemPromptOptions; - basePrompt = activeSnippets.getCoreSystemPrompt(options); + // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion + const getCoreSystemPrompt = activeSnippets.getCoreSystemPrompt as ( + options: snippets.SystemPromptOptions, + ) => string; + basePrompt = getCoreSystemPrompt(options); } // --- Finalization (Shell) --- diff --git a/packages/core/src/prompts/snippets.ts b/packages/core/src/prompts/snippets.ts index 1d6d21a363..0a5c3ba27c 100644 --- a/packages/core/src/prompts/snippets.ts +++ b/packages/core/src/prompts/snippets.ts @@ -35,6 +35,7 @@ export interface SystemPromptOptions { sandbox?: SandboxMode; interactiveYoloMode?: boolean; gitRepo?: GitRepoOptions; + finalReminder?: FinalReminderOptions; } export interface PreambleOptions { @@ -60,7 +61,6 @@ export interface PrimaryWorkflowsOptions { export interface OperationalGuidelinesOptions { interactive: boolean; - isGemini3: boolean; enableShellEfficiency: boolean; interactiveShellEnabled: boolean; } @@ -71,6 +71,10 @@ export interface GitRepoOptions { interactive: boolean; } +export interface FinalReminderOptions { + readFileToolName: string; +} + export interface PlanningWorkflowOptions { planModeToolsList: string; plansDir: string;