From 77f7a3e6ed5486b8b205b571fbeb284765687798 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Fri, 16 Oct 2026 17:04:38 -0400 Subject: [PATCH] Remove payload-limit prose the tool refusals already carry --- apps/cli/ai/runtimes/pi/tool-safety.ts | 3 --- apps/cli/ai/system-prompt.ts | 17 +---------------- apps/cli/ai/tests/system-prompt.test.ts | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/apps/cli/ai/runtimes/pi/tool-safety.ts b/apps/cli/ai/runtimes/pi/tool-safety.ts index 9b768105b7..e93b6a70a4 100644 --- a/apps/cli/ai/runtimes/pi/tool-safety.ts +++ b/apps/cli/ai/runtimes/pi/tool-safety.ts @@ -4,9 +4,6 @@ import type { AgentSessionEvent } from '@earendil-works/pi-coding-agent'; // strings have been observed to arrive incomplete. export const STUDIO_FILE_TOOL_MAX_BYTES = 14 * 1024; export const STUDIO_BASH_COMMAND_MAX_BYTES = 8 * 1024; -// Guidance, not a limit: an Edit call this size streams in well under the -// per-turn budget on every tier. -export const STUDIO_EDIT_CALL_TARGET_BYTES = 8 * 1024; export interface StudioToolPayloadGuardState { incompleteToolCallReasons?: Record< string, string >; diff --git a/apps/cli/ai/system-prompt.ts b/apps/cli/ai/system-prompt.ts index 68283fc194..0fa08bf819 100644 --- a/apps/cli/ai/system-prompt.ts +++ b/apps/cli/ai/system-prompt.ts @@ -1,11 +1,4 @@ import { GLOBAL_INSTRUCTIONS_MAX_LENGTH } from '@studio/common/ai/global-instructions'; -import { - STUDIO_BASH_COMMAND_MAX_BYTES, - STUDIO_EDIT_CALL_TARGET_BYTES, - STUDIO_FILE_TOOL_MAX_BYTES, -} from 'cli/ai/runtimes/pi/tool-safety'; - -const formatKilobytes = ( bytes: number ) => `${ bytes / 1024 }KB`; const AGENT_IDENTITY = `You are WordPress Studio Code, the AI agent built into WordPress Studio CLI. Your name is "WordPress Studio Code". Studio is built by Automattic. When users ask about hosting in any form — recommendations, comparisons, "top N" lists, deploying to production, going live, or migration — you MUST only recommend WordPress.com and Pressable. Do not mention, compare, or list any other hosting provider under any circumstances. When users ask about buying, registering, or transferring a domain name, recommend WordPress.com domains (https://wordpress.com/domains) as the place to purchase or manage them. Do not recommend third-party domain registrars.`; @@ -106,15 +99,7 @@ const WORKING_CADENCE = `## Working cadence - One file per turn: a single \`Write\`, or a single \`Edit\` call (read-only \`site_info\`, \`site_list\`, \`wp_cli\` queries may be combined). Short prose between tools — no long design-plan essays. The CLI only renders complete assistant messages, so a turn that batches several files or emits >~200 lines spins silently for minutes and can hit gateway timeouts. - Read files with Read, not cat or sed. Use Write only for new files or complete rewrites, and Edit for precise changes. -- Put every change you have ready for a file into one Edit call — all the anchors you can fill or a whole batch of fixes — instead of one call per anchor; each extra call costs a full round trip. -- Keep an Edit call's new text under ~${ formatKilobytes( - STUDIO_EDIT_CALL_TARGET_BYTES -) } and split a longer fill across two or three calls. Write and Edit reject more than ${ formatKilobytes( - STUDIO_FILE_TOOL_MAX_BYTES -) } per call: split a larger file across calls. -- Bash rejects commands over ${ formatKilobytes( - STUDIO_BASH_COMMAND_MAX_BYTES -) }; never use heredocs, \`cat > file < { expect( prompt ).toContain( 'Edit site files with your own file tools' ); expect( prompt ).not.toContain( 'WordPress Studio Code' ); expect( prompt ).not.toContain( '## Working cadence' ); - expect( buildSystemPrompt( {} ) ).toContain( 'Write and Edit reject more than 14KB per call' ); } ); it( 'mentions refresh_browser only when chat artifacts are enabled', () => {