From acebeea1293c62e6151df85316e36fe1c34936f5 Mon Sep 17 00:00:00 2001 From: Hadi Minooei Date: Fri, 20 Mar 2026 10:21:58 -0700 Subject: [PATCH] refactor(cli): optimize prompt caching for user simulator screen output --- packages/cli/src/services/UserSimulator.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/services/UserSimulator.ts b/packages/cli/src/services/UserSimulator.ts index efc8aa5e87..42f847b4b4 100644 --- a/packages/cli/src/services/UserSimulator.ts +++ b/packages/cli/src/services/UserSimulator.ts @@ -92,11 +92,6 @@ export class UserSimulator { : ''; const prompt = `You are evaluating a CLI agent by simulating a user sitting at the terminal. -Here is the current terminal screen output: - - -${strippedScreen} - Look carefully at the screen and determine the CLI's current state: STATE 1: The agent is busy (e.g., streaming a response, showing a spinner, running a tool, or displaying a timer like "7s"). It is actively working and NOT waiting for text input. @@ -119,7 +114,13 @@ CRITICAL RULES: - RULE 2: If there is an "Action Required" or confirmation prompt on the screen, YOU MUST HANDLE IT (State 2). This takes precedence over everything else. - RULE 3: Output ONLY the raw characters to send, , or . - RULE 4: Do NOT output markdown, explanations of your thought process, or quotes. -${goalInstruction}${historyInstruction}`; +${goalInstruction}${historyInstruction} + +Here is the current terminal screen output: + + +${strippedScreen} +`; if (this.interactionsFile) { fs.appendFileSync(