From b4d68e1fa42cd1e2589a1f542195d39feb616b3c Mon Sep 17 00:00:00 2001 From: Loretta Date: Sun, 26 Apr 2026 13:44:12 +0200 Subject: [PATCH] [LOADED_DOCS: 3 files, no new loads] Add Rule #6, AUTH topic, ADRs, config & doc updates - Codified Rule #6 (authority, rule scope, skill invocation) in all primary copilot-instructions.md files - Clarified skill pre-load/lazy-load rules and LOADED_DOCS prefix - Forbid skill/template version labels in Decision Log governance - Scaffolded new AUTH topic with README, ISSUES, and TODO files - Added repo/project ADR folders and templates; new ADR for AcBinaryHubProtocol decorator stack - Migrated cross-cutting issues/TODOs to Closed with detailed resolution - Made FruitBankHybrid.Shared/appsettings.json the canonical config source; suppressed Razor SDK auto-publish to avoid file collisions - Updated protocol/wire format docs for AcBinaryHubProtocol - Minor config: updated ports, WaitForFlush, and csproj content rules --- .github/copilot-instructions.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6b5861b..5f2ceec 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -58,22 +58,35 @@ You are operating in a multi-repo, documentation-first architecture. You MUST ST 5. **EXPLICIT CONSENT FOR MODIFICATIONS:** 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. +6. **AUTHORITY, RULE SCOPE, AND SKILL INVOCATION:** + When proposing structural changes (new files, conventions, categories, IDs, naming patterns, URL schemes, etc.), follow these three principles: + + - **Authority before proposal:** Before proposing new structures, conventions, categories, or IDs, verify the proposal against the **authoritative source** for that domain. If a registry, convention doc, or canonical reference exists, follow it (or its registered maintenance workflow for new entries). Do not invent ad-hoc when an authority exists. + + - **Rule implications are part of the rule:** Rules have **scope implications** beyond their literal text. Apply rules **conservatively** — if a rule prohibits action X, do not work around it with novel patterns Y that achieve the same effect. Working around rule scope with ad-hoc patterns is a process violation, not a creative solution. + + - **Skill invocation preferred over reimplementation:** If a workspace skill's scope covers the current task, **invoke the skill explicitly** rather than manually performing similar steps. Skills canonicalize subtleties (validation rules, cross-references, edge cases) that ad-hoc reimplementation risks missing. Improvising a skill's logic is a process violation. + ## Session Setup -**Mandatory reads at session start** — in addition to this `copilot-instructions.md`, the agent MUST load the four workspace skills' `SKILL.md` files: +**Mandatory reads at session start** — in addition to this `copilot-instructions.md`, the agent MUST load the **two reactive workspace skills' `SKILL.md` files** (the three user-gated skills are lazy-loaded on demand — see notes below): - `docs-discovery/SKILL.md` — **reactive** (triggers on any domain question — must be ready BEFORE the first domain query arrives) - `docs-check/SKILL.md` — **reactive** (triggers at the end of every code-modifying response) -- `protocol-audit/SKILL.md` — **on-demand** (triggers on explicit "audit protocol" command) -- `adr-author/SKILL.md` — **on-demand + LLM-suggested** (triggers on explicit planning/design requests, or when the LLM flags an ADR-worthy conversation and the user confirms) + +The remaining three skills are **lazy-loaded** — `SKILL.md` is read on demand at invocation, not at session start. The 1-2 line summaries in `## Shared Agent Skills` below are sufficient for trigger recognition; the full skill content loads only when needed: + +- `protocol-audit/SKILL.md` — user-invoked ("audit protocol"); LLM-suggest-back when a `.github/copilot-instructions.md` or `SKILL.md` is modified during the session. +- `adr-author/SKILL.md` — user-invoked ("let's plan X", "design Y"); LLM-suggest-back on ADR-worthy conversation drift. +- `docs-archive/SKILL.md` — user-invoked ("archive ISSUES", "rotate logs"); LLM-suggest-back when active `_ISSUES.md` / `_TODO.md` / DEC log shows many closed prior entries. **Path resolution**: if this repo is the canonical protocol host (see `@repo` block below — typically AyCode.Core), the paths are local: `.github/skills//SKILL.md`. Otherwise, prefix with this repo's `own-dep-repos` AyCode.Core path (see the `## Shared Agent Skills` section below for explicit paths). -**Why mandatory**: workspace skills are NOT in Claude Code's native skill-registry / system-reminder. Without pre-loading their `SKILL.md` content, the agent cannot reliably recognize implicit triggers (e.g., "domain question → invoke docs-discovery" at the moment the question arrives, not retroactively). Pre-loading is a **one-time cost** per session (~10-13K tokens); Rule #3 (no-re-read) prevents repeated reads; re-read only if Rule #4 (Context Recovery) fires. +**Why mandatory**: workspace skills live as plain `SKILL.md` files in `.github/skills/` — LLMs do NOT auto-discover them via any built-in skill-registry. Without pre-loading their `SKILL.md` content, the agent cannot reliably recognize implicit triggers (e.g., "domain question → invoke docs-discovery" at the moment the question arrives, not retroactively). Pre-loading is a **one-time cost** per session (~5-8K tokens for the 2 reactive `SKILL.md` files; the 3 user-gated skills are lazy-loaded — no upfront cost); Rule #3 (no-re-read) prevents repeated reads; re-read only if Rule #4 (Context Recovery) fires. **Amortization — critical, do NOT re-evaluate per-turn**: the Session Setup cost is measured over the ENTIRE session, not per single turn. A typical session has many turns; the first domain question alone already recoups the investment (alternative — repeated source-code `Grep`/`Read` per turn — costs 10-20K tokens *per turn* with lower output quality). Do NOT flag pre-loaded content as "wasteful" for turns that don't invoke it — the design depends on cross-turn amortization + Rule #3 (no-re-read) + on-demand specificity of Rule #4 (Context Recovery). This amortization is the **central token-economics principle** of the entire protocol stack. -The first response's `[LOADED_DOCS: ...]` prefix must reflect **5 files** (this `copilot-instructions.md` + 4 SKILL.md). +The first response's `[LOADED_DOCS: ...]` prefix must reflect **3 files** (this `copilot-instructions.md` + 2 reactive SKILL.md). Lazy-loaded skills add to the count when invoked. ## Workspace Dependencies # own-dep-repos: "name: path" — paths are relative to this repo root (.github/..) @@ -91,7 +104,7 @@ The first response's `[LOADED_DOCS: ...]` prefix must reflect **5 files** (this ## Shared Agent Skills -Skills defined in other repos. **All four are pre-loaded at session start per the `## Session Setup` section above** (mandatory — ensures implicit triggers fire reliably): +Skills defined in other repos. **Two reactive skills are pre-loaded at session start; three user-gated skills are lazy-loaded on demand** — see `## Session Setup` above for the load matrix: - **protocol-audit** — Cross-repo consistency audit for `.github/copilot-instructions.md` across all 5 repos. Location: `AyCode.Core/.github/skills/protocol-audit/SKILL.md` @@ -109,6 +122,10 @@ Skills defined in other repos. **All four are pre-loaded at session start per th Location: `AyCode.Core/.github/skills/adr-author/SKILL.md` **Invoke on explicit user request** ("let's plan X", "decide Y vs Z", "design the W module") **or proactively flag** when the conversation looks ADR-worthy (user must confirm — never auto-invoke). +- **docs-archive** — Rotate closed entries (Status: Fixed/Resolved/Won't fix/Superseded by X) from active `_ISSUES.md`, `_TODO.md`, and `LLM_PROTOCOL_DECISIONS.md` into year-bucketed archive companions (`*_.md`). Year of the Status update determines destination file. Active files retain only Open/Partially Fixed entries plus a pointer to the archives. Archive files are NOT auto-loaded — agents read them on-demand when historical context becomes relevant. + Location: `AyCode.Core/.github/skills/docs-archive/SKILL.md` + **Invoke on explicit user request** ("archive ISSUES", "rotate logs") **or proactively flag** when an active artifact file has many closed prior entries (user must confirm — never auto-invoke). + ## Protocol History Cumulative log of LLM-protocol decisions (rule changes, new skills, structural shifts):