From 1ee6900190668ac1a6eb6d2213ab45ee4ed5a521 Mon Sep 17 00:00:00 2001 From: Christian Gunderman Date: Thu, 12 Feb 2026 17:15:34 -0800 Subject: [PATCH] Agent provided prompt suggestions. --- packages/core/src/prompts/snippets.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/core/src/prompts/snippets.ts b/packages/core/src/prompts/snippets.ts index d91933809a..8c7ef80ad4 100644 --- a/packages/core/src/prompts/snippets.ts +++ b/packages/core/src/prompts/snippets.ts @@ -164,16 +164,15 @@ export function renderCoreMandates(options?: CoreMandatesOptions): string { - **Credential Protection:** Never log, print, or commit secrets, API keys, or sensitive credentials. Rigorously protect \`.env\` files, \`.git\`, and system configuration folders. - **Source Control:** Do not stage or commit changes unless specifically requested by the user. -## Context Efficiency: -- Always minimize wasted context window by aggressively scoping and limiting all of your ${GREP_TOOL_NAME} searches. e.g.: always pass total_max_matches, include, and max_matches_per_file. -- Use names_only=true or max_matches_per_file=1 to find a list of files that contain a pattern. -- Limit unnecessary context consumption from file reads by always using ${GREP_TOOL_NAME} (configured with \`max_matches_per_file\`) to search large files (> 5kb). -- Conserve context when reading files by reading just enough context to definitively answer the question by passing offset and limit to ${READ_FILE_TOOL_NAME} or by searching with ${GREP_TOOL_NAME} and before=50 and after=50 and total_max_matches - - Always request a large enough range (e.g., 100-500 lines) to ensure you see sufficient details of the code. - - If you have multiple ranges that you want to read, always combine them into a single range to avoid wasting tokens on another tool call. - - Avoid "paging" by requesting a generous buffer around your target; it is more token-efficient to - read 500 lines in one turn than 100 lines across two turns. - - If you identify multiple relevant sections in a file, combine them into a single wide range covering all of them. +## Context Efficiency & Research Decisiveness: + - **Primary Discovery:** Utilize \`grep_search\` as your primary investigative tool to pinpoint specific lines and anchor points before using \`read_file\`. + - **Single-Turn Synthesis:** Aim to gather all necessary context for a file in a single, well-scoped \`read_file\` call. Consolidating your research needs into one turn is the most efficient path to a solution. + - **Range Consolidation:** If you identify multiple relevant sections, calculate a single range that encompasses them all. Consolidating into one wide read (typically under 300 lines) is more effective than "paging" through a file + turn-by-turn. + - **Strategic Buffering:** When preparing an edit, request a range that provides approximately 10-15 lines of context above and below your target. This ensures the \`replace\` tool has the stable, unique markers required to succeed in one + attempt. + - **Edit Confirmation:** Rely on the "Success" output of your editing tools. Proceed directly to behavioral validation (running tests) after a successful modification, as test results provide the most accurate verification of the file's + state. ## Engineering Standards - **Contextual Precedence:** Instructions found in ${formattedFilenames} files are foundational mandates. They take absolute precedence over the general workflows and tool defaults described in this system prompt.