From bcea6b32054f8ce039fe36b116eac3d6cd54aa1b Mon Sep 17 00:00:00 2001 From: Loretta Date: Sat, 4 Apr 2026 09:27:49 +0200 Subject: [PATCH] Strengthen doc-first, multi-repo protocol and clarify tools Expanded copilot-instructions.md to enforce strict doc-first and cross-repo hard-gate rules, including per-question doc checks and a no re-read policy with explicit penalties. Broadened consent requirements for all file modifications. Updated context recovery paths. In CLAUDE.md, added sequential execution override and mapped Copilot tool names to Claude Code equivalents, ensuring protocol consistency across tools. --- .github/copilot-instructions.md | 4 +++- CLAUDE.md | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ee737ee..2ebd295 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -12,6 +12,8 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST - 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 15). + - **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. **🛑 CRITICAL TOOL EXECUTION FIREWALL (NO RE-READING):** BEFORE you invoke `get_file`, `file_search`, or `run_command_in_terminal` targeting any `.md` file, you **MUST** physically verify if its name appears in your `[LOADED_DOCS]` list OR in the user's prompt context. @@ -26,7 +28,7 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST - `docs/` (in this repository root) 5. **EXPLICIT CONSENT FOR MODIFICATIONS:** - NEVER rewrite, create, or delete code/files without the user's explicit permission. If the user does not specifically request a code modification (e.g., using phrases like "we are just thinking," "what do you think," "let's plan"), you MUST ONLY provide text-based analysis and planning. You are FORBIDDEN from using file-modifying tools (`replace_string_in_file`, `edit_file`, `create_file`, etc.) until the user explicitly says "ok", "go ahead", "implement", or a similar unambiguous approval. + NEVER rewrite, create, or delete any file (code, documentation, configuration, memory, or otherwise) without the user's explicit permission. If the user does not specifically request a code modification (e.g., using phrases like "we are just thinking," "what do you think," "let's plan"), you MUST ONLY provide text-based analysis and planning. You are FORBIDDEN from using file-modifying tools (`replace_string_in_file`, `edit_file`, `create_file`, etc.) until the user explicitly says "ok", "go ahead", "implement", or a similar unambiguous approval. ## Workspace Dependencies # own-dep-repos: "name: path" — paths are relative to this repo root (.github/..) diff --git a/CLAUDE.md b/CLAUDE.md index 577d61b..d8a5d03 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1 +1,17 @@ CRITICAL: Your FIRST action in every session MUST be reading `.github/copilot-instructions.md`. Execute ALL session-start instructions found there before responding to any user query. It is the single source of truth for this repo. + +## SEQUENTIAL EXECUTION OVERRIDE +The AI AGENT CORE PROTOCOL in copilot-instructions.md requires STRICT SEQUENTIAL execution. This OVERRIDES your default parallelization behavior. Do NOT parallelize doc reads with code searches. The sequence is: +1. Read copilot-instructions.md → process its rules FULLY +2. Read ALL docs/ .md files listed in the protocol → wait for completion +3. Output [LOADED_DOCS: ...] prefix +4. ONLY THEN respond to the user's query or search code + +## Tool mapping for AI AGENT CORE PROTOCOL +The copilot-instructions.md references Copilot tool names. Map them to Claude Code tools: +- `get_file` / `file_search` → `Read`, `Glob`, `Grep` +- `code_search` / `get_symbols_by_name` / `find_symbol` → `Grep`, `Glob` +- `replace_string_in_file` / `edit_file` → `Edit` +- `create_file` → `Write` + +Follow the protocol using YOUR tools. The rules (LOADED_DOCS prefix, hard-gate, no-re-read, context recovery, explicit consent) apply equally to Claude Code.