Clarify and enforce doc-first, no-redundant-read policy

Correct rule references for no re-reading of loaded `.md` files. Add explicit "STRICT NO-RE-READ POLICY" section defining context and re-read conditions. Expand context recovery rules with auto-detection triggers and specify directories for recovery. These changes make doc-first and anti-loop policies clearer and more robust, ensuring efficient and up-to-date documentation usage.
This commit is contained in:
Loretta 2026-04-04 20:50:51 +02:00
parent 322f38f1fa
commit 8f48838ded
1 changed files with 9 additions and 2 deletions

View File

@ -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). - 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`. - 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. - 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. - **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. - **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):** 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. 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. - 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". - 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. - 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. 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. 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): Directories to read (when recovering context):
- `docs/` (in this repository root) - `docs/` (in this repository root)
- `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/` - `../NopCommerce.Common/4.70/Plugins/Nop.Plugin.Misc.AIPlugin/docs/`