Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/cli/ai/runtimes/pi/tool-safety.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 >;
Expand Down
17 changes: 1 addition & 16 deletions apps/cli/ai/system-prompt.ts
Original file line number Diff line number Diff line change
@@ -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.`;

Expand Down Expand Up @@ -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 <<EOF\`, or Python scripts to write large generated files — they carry the same payload-truncation risk.`;
- 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.`;

const PLAN_DATA_GUARDRAIL = `For ANY question about WordPress.com or Pressable plans, pricing, upgrades, or what a plan tier includes (plugins, themes, custom code, SSH, hosting, storage, etc.), you MUST load the \`hosting-plans-helper\` skill and answer only from the data it fetches. Do NOT answer from memory: your training knowledge of plan names, prices, and feature-tier gating is stale and frequently wrong. In particular, do not claim a tier lacks a feature (e.g. that Personal or Premium cannot install plugins) based on memory — check the fetched per-tier feature list, which is the only source of truth. If you cannot fetch the data, say you cannot verify current plan details and point the user to https://wordpress.com/pricing; never guess.`;

Expand Down
1 change: 0 additions & 1 deletion apps/cli/ai/tests/system-prompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ describe( 'buildSystemPrompt', () => {
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', () => {
Expand Down
Loading