From a5d2cd0b0ec2f837dfcb27d4fef75a007ae42985 Mon Sep 17 00:00:00 2001 From: Loretta Date: Fri, 17 Apr 2026 06:49:20 +0200 Subject: [PATCH] Add protocol-audit skill and repo config for protocol checks Added SKILL.md defining the protocol-audit skill to verify AI AGENT CORE PROTOCOL consistency across five AyCode/Mango repos. Introduced REPOS.md listing the repos, their absolute paths, and expected own-dep-repos for audit reference. These additions enable structured, cross-repo protocol compliance checks without direct file modification. --- .github/skills/protocol-audit/SKILL.md | 111 ++++++++++++++++++ .../skills/protocol-audit/references/REPOS.md | 25 ++++ 2 files changed, 136 insertions(+) create mode 100644 .github/skills/protocol-audit/SKILL.md create mode 100644 .github/skills/protocol-audit/references/REPOS.md diff --git a/.github/skills/protocol-audit/SKILL.md b/.github/skills/protocol-audit/SKILL.md new file mode 100644 index 0000000..8d0b4a7 --- /dev/null +++ b/.github/skills/protocol-audit/SKILL.md @@ -0,0 +1,111 @@ +--- +name: protocol-audit +description: Audit the 5 AyCode/Mango repos (AyCode.Core, AyCode.Blazor, Libraries, FruitBank, FruitBankHybridApp) for .github/copilot-instructions.md protocol consistency. Checks Rule numbering, required substrings (NO-RE-READ definition, auto-detection triggers, CROSS-REPO HARD-GATE, PER-QUESTION DOC-FIRST, Rule 5 scope), @repo block format, and own-dep-repos relative paths. Use when the user asks to "audit protocol", "check instruction consistency", "verify repo rules", "check cross-repo drift", or after modifying the AI AGENT CORE PROTOCOL in any of the 5 repos. Produces a repo x invariant table and concrete patch suggestions; does NOT modify any file without explicit consent. +compatibility: Designed for Claude Code and GitHub Copilot (VS). Requires read access to the 5 listed repo paths. +metadata: + author: Fullepi + version: "1.0" +--- + +# Protocol Audit + +Verify that the 5 AyCode/Mango repos share a consistent AI AGENT CORE PROTOCOL in `.github/copilot-instructions.md`. + +## Before you start + +This skill READS files and REPORTS findings. It MUST NOT modify any file. Patch suggestions are surfaced as diffs for the user to review and approve. Follow Rule #5 from the active repo's `copilot-instructions.md`. + +## Step 1 — Load the repo list + +Read `references/REPOS.md` (relative to this SKILL.md). Extract the 5 absolute repo paths and the expected own-dep-repos table. + +## Step 2 — Read each instruction file + +For each repo in REPOS.md, read `\.github\copilot-instructions.md` once. Record the full text keyed by repo name. + +Do NOT re-read a file that is already in your LOADED_DOCS list (per Rule #3 of the active repo's protocol). + +## Step 3 — Run invariant checks + +For each file, evaluate these invariants. Each yields PASS / FAIL and (on FAIL) an evidence snippet. + +### Structural invariants + +1. **Rule numbering is contiguous 1..N** + Extract all `^\d+\. \*\*` lines. The numbers must form `1, 2, 3, ..., N` with no gaps and no duplicates. + +2. **Rule count is >= 5** + The AI AGENT CORE PROTOCOL has five core rules. Sections after rule 5 (Conventions etc.) may add more; the first 5 are mandatory. + +### Rule-content invariants + +3. **Rule #2 contains `CROSS-REPO HARD-GATE`** + Substring present. + +4. **Rule #2 contains `PER-QUESTION DOC-FIRST`** + Substring present. + +5. **Rule #3 is the NO-RE-READ rule** + Header matches `STRICT NO-RE-READ POLICY (ANTI-LOOP)`. + +6. **Rule #3 contains the "in context" definition** + Substring `lossy compressions` present. + +7. **Rule #4 contains auto-detection triggers** + Substring `Auto-detection triggers` present AND substring `LOADED_DOCS: NONE` present. + +8. **Rule #5 scope is broad** + Substring `any file (code, documentation, configuration, memory, or otherwise)` present. + Negative check: substring `delete code/files without` must be ABSENT (old wording). + +### Cross-reference invariants + +9. **"strictly maintain rule 3" reference exists in Rule #2** + Substring `strictly maintain rule 3` present. Old references (`rule 15`, `rule 18`, `rule 19`, `rule 20`, `rule 21`) must be absent. + +### @repo block invariants + +10. **@repo block has all 4 required fields** + Inside the `@repo { ... }` block, the keys `name`, `type`, `layer`, `own-dep-repos` must all be present. + +11. **own-dep-repos paths resolve to existing directories** + For each `": "` entry, resolve `/` and check the directory exists. + +12. **own-dep-repos matches REPOS.md expectations** + For each repo, the deps listed must equal the expected set in REPOS.md's "Expected own-dep-repos" table. + +## Step 4 — Produce the report + +Emit a markdown table with one row per repo and one column per invariant. Cell values: `PASS` / `FAIL`. Use concise column headers (e.g., `1.Num`, `2.Cnt`, `3.XR-HG`, ...). + +Below the table, list every FAIL with: +- Repo name +- Invariant ID +- Evidence (the offending line or missing substring) +- Suggested patch (concrete old-string / new-string pair the user can review) + +## Step 5 — DO NOT apply patches + +End the report with: + +> All checks complete. N failures detected. To apply any of the suggested patches, reply with "apply patches 1,2,5" (or similar). No files have been modified. + +Wait for explicit user consent before using any edit/write tool. + +## Tool usage + +This skill is tool-neutral. Use whichever file-reading and file-editing tool your host agent provides: + +- Reading files: `Read` (Claude Code), `get_file` (Copilot), or equivalent +- Directory existence checks: `Glob` / `file_search` / `ls` / `Test-Path` +- Applying patches (only after consent): `Edit` / `replace_string_in_file` + +Map these to your tools per the active repo's `CLAUDE.md` (if present) before proceeding. + +## Edge cases + +- **Repo path missing from disk:** Skip that repo, record as `MISSING` in every invariant cell, and continue with the others. +- **File read fails:** Same handling — record `UNREADABLE`. +- **Multiple `@repo` blocks in one file:** Audit the first one; flag the duplicate as its own finding. +- **Rule order differs (e.g., Rule #3 and #4 swapped):** Invariants 5 and 7 fail independently — do not try to auto-reorder. +- **User is running this mid-edit:** If a file has obviously unfinished edits (e.g., truncated mid-sentence), report as `CORRUPT` and stop that repo's audit. diff --git a/.github/skills/protocol-audit/references/REPOS.md b/.github/skills/protocol-audit/references/REPOS.md new file mode 100644 index 0000000..ee7082a --- /dev/null +++ b/.github/skills/protocol-audit/references/REPOS.md @@ -0,0 +1,25 @@ +# Repos under protocol-audit + +Each row is one repo whose `.github/copilot-instructions.md` must obey the shared AI AGENT CORE PROTOCOL. + +| # | Name | Absolute path | Layer | +|---|---------------------|----------------------------------------------------------------------------|------------------| +| 1 | AyCode.Core | `H:\Applications\Aycode\Source\AyCode.Core` | framework | +| 2 | AyCode.Blazor | `H:\Applications\Aycode\Source\AyCode.Blazor` | framework | +| 3 | Libraries | `H:\Applications\Mango\Source\NopCommerce.Common\4.70\Libraries` | shared libraries | +| 4 | FruitBank | `H:\Applications\Mango\Source\FruitBank` | product | +| 5 | FruitBankHybridApp | `H:\Applications\Mango\Source\FruitBankHybridApp` | product | + +The instruction file to audit for each is: `\.github\copilot-instructions.md`. + +## Expected own-dep-repos (for @repo block path validation) + +| Repo | Expected deps (relative path from this repo's root) | +|--------------------|-------------------------------------------------------------------------------------------------------------| +| AyCode.Core | — (none) | +| AyCode.Blazor | `AyCode.Core: ../AyCode.Core` | +| Libraries | `AyCode.Core: ../../../../../Aycode/Source/AyCode.Core` | +| FruitBank | `AyCode.Core: ../../../Aycode/Source/AyCode.Core`, `Libraries: ../NopCommerce.Common/4.70/Libraries` | +| FruitBankHybridApp | `AyCode.Core: ../../../Aycode/Source/AyCode.Core`, `AyCode.Blazor: ../../../Aycode/Source/AyCode.Blazor`, `Libraries: ../NopCommerce.Common/4.70/Libraries` | + +When modifying the repo set (add/remove/move), update this table. SKILL.md remains stable.