diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 274dabba..a186ec18 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -11,13 +11,14 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST - If `[LOADED_DOCS: NONE]` applies, you **MUST STOP** and you are **STRICTLY FORBIDDEN** to use the following tools: `code_search`, `get_symbols_by_name`, `find_symbol`, or `get_file` (for non-markdown files). - Your VERY FIRST AND ONLY allowed tool calls must be `file_search` or `get_file` targeting the `.md` documentation in the relevant `docs/` folders or `README.md`. - Do not answer the user's core question until the `[LOADED_DOCS]` list is populated with the base architecture files. - - **CRITICAL EXCEPTION:** Do **NOT** re-read `.md` files that are already mapped in your context or `LOADED_DOCS` list (strictly maintain rule 21). + - **CRITICAL EXCEPTION:** Do **NOT** re-read `.md` files that are already mapped in your context or `LOADED_DOCS` list (strictly maintain rule 3). - **CROSS-REPO HARD-GATE:** When navigating to an external repo (via `own-dep-repos` paths), read that repo's `docs/` and `README.md` BEFORE searching its source code. The hard-gate applies to EVERY repo you enter, not just your own. - **PER-QUESTION DOC-FIRST:** Before searching source code for any user question, check whether there is a relevant `.md` file (folder `README.md`, other repo `docs/`, etc.) that has NOT yet been loaded. Read it first — it tells you where to look in the code, saving searches and tokens. Only after loading relevant docs should you search/read source files. 3. **STRICT NO-RE-READ POLICY (ANTI-LOOP):** You are PHYSICALLY FORBIDDEN from calling `get_file` or `file_search` on any `.md` file that is already listed in your `[LOADED_DOCS]` prefix. - - Once an `.md` file is in your context, it STAYS in your context. + - **Definition:** A doc is "in your context" ONLY if you have read its actual file content via a tool call in THIS conversation. Prior session summaries, compacted messages, and memory entries do NOT count — they are lossy compressions. + - Once an `.md` file is in your context, it STAYS in your context. - Re-reading them wastes tokens and breaks the protocol. - ONLY re-read an `.md` file if the user EXPLICITLY states "the file has changed on disk, read it again". - If the user simply mentions a glossary term or requests info found in a loaded doc, answer directly from memory. DO NOT search for it again. @@ -26,6 +27,12 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST If the user asks a domain/architecture specific question and you realize the essential `.md` files are NO LONGER in your current context (they dropped out of memory), you **MUST automatically re-read** the necessary documentation before answering. Do NOT wait for the user to explicitly tell you to re-read them. Prioritize scanning the `docs/` folders to recover the lost context. + **Auto-detection triggers (MUST treat ALL docs as NOT loaded):** + - Session starts with a summary of a previous conversation (context recovery/compaction) + - Message compaction or context compression occurred mid-session + - You cannot quote the exact content of a doc you claim to know + When any trigger fires → reset `[LOADED_DOCS: NONE]` and re-read per Rule #2. + Directories to read (when recovering context): - `docs/` (in this repository root) - `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/`