From ae957c4e351adb3e267f3936d9270a42368f7ae5 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Thu, 18 Jun 2026 23:01:10 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Docs:=20Harness-11=20double-check=20?= =?UTF-8?q?=C3=972=20+=20finalize=20report=20(anh=20giao)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DOUBLE-CHECK wf_a0b68d2f-30e (3× reviewer): committed-state e70c046 PASS — B1 ×11 exact, root CLAUDE.md:53 tail byte-identical, broadcasts hash recompute khớp, single-writer clean. Over-suppression regression CLEAN: DA1 no-return → em-main self-gate fake-drift "99 migration" CAUGHT (runtime) + DA2/DA3 độc-lập confirm - CHECKLIST-VERIFY wf_39cd4cbe-f07 (3× investigator-codebase): completeness-gate H11 FORMAL ĐẠT — B 4/4 + C 5/5 + D 11/11 đủ-trọn (function-floor MET), A 🟡 tailored; D5/D6/D7 explicit + D8 one-direction codify = YES - detector refine: +C2 "test project" skip (27→26); tree-skip reverted (gotcha #30 box-glyph trap, kể cả qua Edit render-normalize); detector pure-ASCII verified - agents/README "(pending)"→run-id; adap-report + outbox email +double-check section (hash 2316773229f2) - 0 production code; state THẬT giữ nguyên (Mig 55 · 88 bảng · 339 test · gotcha 69 · bundle BYF5vIMJ/CB-tiRxd) Co-Authored-By: Claude Opus 4.8 --- .claude/agents/README.md | 2 +- .../checklist-verify-synthesis.md | 39 ++ .../2026-06-18-h11-checklist-verify/run.md | 25 ++ .../runs/2026-06-18-h11-doublecheck/_patch.py | 14 + .../_scratch-det.ps1 | 406 ++++++++++++++++++ .../doublecheck-synthesis.md | 28 ++ .../runs/2026-06-18-h11-doublecheck/run.md | 20 + .claude/workflows/runs/_ledger.md | 2 + broadcasts/_index.md | 2 +- ...-se-to-ai_infra-harness-11-adopt-report.md | 8 +- .../2026-06-18-Governance-harness-11.md | 8 +- scripts/governance-detectors.ps1 | 3 + 12 files changed, 553 insertions(+), 4 deletions(-) create mode 100644 .claude/workflows/runs/2026-06-18-h11-checklist-verify/checklist-verify-synthesis.md create mode 100644 .claude/workflows/runs/2026-06-18-h11-checklist-verify/run.md create mode 100644 .claude/workflows/runs/2026-06-18-h11-doublecheck/_patch.py create mode 100644 .claude/workflows/runs/2026-06-18-h11-doublecheck/_scratch-det.ps1 create mode 100644 .claude/workflows/runs/2026-06-18-h11-doublecheck/doublecheck-synthesis.md create mode 100644 .claude/workflows/runs/2026-06-18-h11-doublecheck/run.md diff --git a/.claude/agents/README.md b/.claude/agents/README.md index fa9d478..a26c47b 100644 --- a/.claude/agents/README.md +++ b/.claude/agents/README.md @@ -12,7 +12,7 @@ > **Upgrade S66 (2026-06-16 — Harness-8 all-inherit + workflow-fastest adopt):** 🔴 BẮT BUỘC (anh-chốt, mọi sister; chất lượng trên chi phí). **H8.1** — toàn bộ 11 sub-agent có memory → `model: inherit` (ăn top-tier lead), **GỠ cơ chế demote two-tier của Harness-4** (7 sub pin `claude-opus-4-8` đã flip `inherit`: 2 implementer · test-specialist · cicd-monitor · investigator-api · frontend-designer · tooling-auditor; 4 đã-inherit giữ nguyên reviewer·investigator-codebase·database-agent·harvest-curator). SE KHÔNG có helper/gopher rẻ để chừa → cả 11 lên inherit. Escape-hatch per-task `tier:'opus'` (hmw.js) GIỮ cho sweep/cost. **H8.2** — chạy workflow nhanh nhất: **song song tối đa + xuất nhanh + lead auto-HMW** cho task substantive (theo H6) — "nhanh" = parallelism, **KHÔNG phải hạ model**. **Caveat (trung thực):** runtime HIỆN KHÔNG đổi (inherit = Opus 4.8 1M vì Fable suspended H5 — trùng two-tier đã collapse); khác biệt thật khi Fable về (cả đội tự lên Fable 5 không sửa frontmatter) + H5.6 restore gọn hơn (chỉ đổi lead). Frontmatter no hot-reload → **executed-file, VERIFIED-pending-restart**. `[1m]` cấm trong frontmatter `model` (gotcha #37). adap-report `2026-06-16-Governance-harness-8-all-inherit-workflow-fastest.md`. > **Upgrade S70 (2026-06-17 — Harness-9 L2-recovery + adap 2-workflow adopt):** **(1) PROCESS-mandate 🔴 BẮT BUỘC (PART 2/3, áp MỌI adap từ nay):** mỗi adap 1 Harness = **2 workflow tách biệt** (IMPLEMENT + REVIEW double-check RIÊNG) + REPORT về AI_INFRA kèm **run-id** bằng chứng; task ngắn-nhưng-cần-confirm VẪN phải review-workflow. Codify `.claude/commands/adap-apply.md`. **(2) L2 dark-matter recovery (PART 1, tailored):** archive `agent-memory//archive/*.md` KHÔNG vào RAG → build `archive/_INDEX.md` (mục-lục 1-dòng/bản-ghi + con-trỏ **substring** sha-keyed, fallback Ctrl-F, KHÔNG line-hint) + `.gist.md` (nén 4-field ADDITIVE, `distill-gen` counter, verbatim FROZEN) + `memory-budget.json` (seed-by-measure qua `scripts/measure-agent-memory.ps1`) + budget-audit @session-start (§2.1.2) + `.ragignore` guard. Rollout S70 (đầy-đủ-nhất, stage investigate→implement→audit qua 3 Workflow run-id): 4 over-cap sub (cicd-monitor · investigator-codebase · reviewer · implementer-backend). adap-report `2026-06-17-Governance-harness-9-l2-recovery-and-adap-workflow.md`. > **Upgrade S72 (2026-06-18 — Harness-10 flat-refine + checklist-v2 adopt):** run-trace SUBFOLDER→**FLAT** (file phẳng cùng cấp: `sub--.md` raw + `-synthesis.md` verified, KHÔNG `sub-md/`/`harvest/` subdir) — `hmw.js` (`:103` subMd path) + `workflows/README` + `runs/README` + session-start/end + decision-tree (dòng dưới) repoint. **C8 migration:** 5 run cũ S71 GIỮ subfolder (đừng rewrite history); close-gate dual-accept cả hai dạng. **+`/sleep-recovery-memory-l2`** (đóng A8 — port §J2-tailored SE-only: sleep-compress L2 gist additive, INFORM-only ≥7d). **Anti-bypass detector (refine b): TAILORED-OUT** — SE dùng Anthropic Workflow tool (no CLI-launcher bypass-surface), containment = git-diff + run-folder TRACKED + ledger orphan-scan (G-015). 3 run-id bằng-chứng: audit `wf_13868efb-ea7` · implement `wf_ac43b5ff-7d1` · review (pending). adap-report `2026-06-18-Governance-harness-10-flat-refine-checklist-v2.md` (pending). -> **Upgrade S75 (2026-06-18 — Harness-11 engine bộ-nhớ-và-governance TỰ-BẢO-TRÌ adopt):** engine tự-DÒ toàn-diện (luôn tươi báo cờ) + AUTO chỉ semantic-null git-diff + **single-writer bar-KHÔNG-hạ (D9)** + đổi-luật owner-approve (D7). 🔑 Canonical → [`docs/governance/harness-11-engine.md`](../../docs/governance/harness-11-engine.md) (**KHÔNG copy luật ở đây — B1 dogfood**). Artifact MỚI: `scripts/governance-detectors.ps1` (C1 broken-pointer + C2/B3 staleness + C3 vocab-fork + C4 self-exclusion, NO-API DÒ+FLAG-only, **runtime-proven** bắt drift root CLAUDE.md mig53→55 + 0 self-match; số flag động → run-trace) + `scripts/memory-archive-gate.ps1` (PHẦN A hysteresis 0.85/keep-floor 5/2-strike/A7 NO-API L1-eval) + budget.json `archive_gate`. 3-tier D5(AUTO)/D6(DÒ+FLAG)/D7(owner-approve) + one-direction-lock D8 (canonical→derived) codify ở engine-doc. Cadence wired: D1 session-start §2.1.3 (chạy detector) · D2 session-end §L.b(c) (archive-gate). Áp 3-workflow: audit `wf_7fdc3bd5-930` + implement `wf_c5e5844e-7c1` + review (pending). adap-report `2026-06-18-Governance-harness-11.md` (pending). +> **Upgrade S75 (2026-06-18 — Harness-11 engine bộ-nhớ-và-governance TỰ-BẢO-TRÌ adopt):** engine tự-DÒ toàn-diện (luôn tươi báo cờ) + AUTO chỉ semantic-null git-diff + **single-writer bar-KHÔNG-hạ (D9)** + đổi-luật owner-approve (D7). 🔑 Canonical → [`docs/governance/harness-11-engine.md`](../../docs/governance/harness-11-engine.md) (**KHÔNG copy luật ở đây — B1 dogfood**). Artifact MỚI: `scripts/governance-detectors.ps1` (C1 broken-pointer + C2/B3 staleness + C3 vocab-fork + C4 self-exclusion, NO-API DÒ+FLAG-only, **runtime-proven** bắt drift root CLAUDE.md mig53→55 + 0 self-match; số flag động → run-trace) + `scripts/memory-archive-gate.ps1` (PHẦN A hysteresis 0.85/keep-floor 5/2-strike/A7 NO-API L1-eval) + budget.json `archive_gate`. 3-tier D5(AUTO)/D6(DÒ+FLAG)/D7(owner-approve) + one-direction-lock D8 (canonical→derived) codify ở engine-doc. Cadence wired: D1 session-start §2.1.3 (chạy detector) · D2 session-end §L.b(c) (archive-gate). Áp qua workflow: audit `wf_7fdc3bd5-930` + implement `wf_c5e5844e-7c1` + review `wf_d7ca1ff8-942` + double-check `wf_a0b68d2f-30e`. adap-report `docs/governance/adap-reports/2026-06-18-Governance-harness-11.md`. --- diff --git a/.claude/workflows/runs/2026-06-18-h11-checklist-verify/checklist-verify-synthesis.md b/.claude/workflows/runs/2026-06-18-h11-checklist-verify/checklist-verify-synthesis.md new file mode 100644 index 0000000..19e103c --- /dev/null +++ b/.claude/workflows/runs/2026-06-18-h11-checklist-verify/checklist-verify-synthesis.md @@ -0,0 +1,39 @@ +# CHECKLIST-VERIFY SYNTHESIS — Harness-11 (2026-06-18-h11-checklist-verify · `wf_39cd4cbe-f07`) + +> 3× investigator-codebase (read-only ∥, evidence-mapping). Em-main scribe @P3. **VERDICT: ✅ completeness-gate H11 ĐẠT — B+C+D đủ-trọn, A 🟡 tailored.** Rà từng item bằng bằng-chứng thật (run-output/file:line), KHÔNG trí-nhớ. + +## CL1 — PHẦN A (🟡) + PHẦN B (🔴) → PASS +**A1-A7 PRESENT (🟡 tailored), runtime qua `memory-archive-gate.ps1`:** +| Item | Nấc | Loại | Evidence | +|---|---|---|---| +| A1 byte-gate | exec+runtime | mechanized | cap 25600 echoed; flag 3 over-cap (cicd 26798·inv 31502·reviewer 38755) | +| A2 additive MOVE | exec (design) | convention | DRY-RUN plan-only, MOVE thật = em-main D5 (no auto-move memory canonical) | +| A3 _INDEX pointer | exec+runtime | mechanized | A7 đọc 4 _INDEX, 186 pointer | +| A4 hysteresis 0.85 | exec+runtime | mechanized | low-water 21760 echoed | +| A5 keep-floor 5 | exec+runtime | mechanized | WARN fired inv+reviewer (oldest-movable exhausted trước lowMark) | +| A6 2-strike | exec / runtime-PARTIAL | mechanized | **legit-gap by-design:** cần 2× `-Apply` (DRY-RUN strike=1 WATCH, `.archive-strikes.json` absent); script self-doc [TAILOR] | +| A7 NO-API L1-eval | exec+runtime | mechanized | **GATE PASS 186/186 resolve, 0 fail, exit 0** | + +**B1-B4 PRESENT (🔴 floor MET), completeness B PASS:** +- B1 ✅ 5/5 derived docs ≥1 STATUS pointer (CLAUDE.md:53/66/87 · ef-core SKILL:3/19 · skills/README:20). Caveat: residual soft-net FP (module-local "6 test"/"4 bảng Budget") — B2 tradeoff, KHÔNG B1-fail. +- B2 ✅ readable giữ (ef-core SKILL:85-120 table inline, không pointer-soup). +- B3 ✅ exec+runtime (C2 ran, canonical mig55/test339/gotcha69/table88 == disk, FLAG 10 stale = detect-works). +- B4 ✅ GATED (engine:42 FLAG→em-main + git-diff backstop + D9 single-writer). + +## CL2 — PHẦN C (🔴 MANDATE) → ĐẠT 5/5, completeness-gate CỨNG met +26 flag, exit 0, qua `governance-detectors.ps1`: +- C1 ✅ exec+runtime mechanized (gotcha-ref 0 broken + 13 dangling-wikilink LOW). +- C2/B3 ✅ exec+runtime mechanized (canonical 55/339/69/88 + disk cross-check [OK] + 10 MED). +- C3 ✅ exec+runtime mechanized (CẢ 3 fork: wave↔run-trace 15/19f · Dự trù↔Ngân sách PRO 7/6f · two-tier↔all-inherit 17/10f). +- C4 ✅ exec+runtime mechanized (self-match=0, 5 paths excluded ALL exist, leaked=0). +- C5 ✅ resolve 26/26 + 2-strike HONEST-scoped (convention em-main, detector stateless — KHÔNG over-claim). +- NO-API grep 0-hit · 0-auto-write grep 0-hit. + +## CL3 — PHẦN D (🔴) → ĐẠT 11/11, completeness-gate D PASS +- D1 session-start.md:83 (detector) · D2 session-end.md:48 (archive-gate) · D3 ultra-on.md:35 (per-turn) · **D4 hmw.js:76-78 THROW MECHANIZED** (verify dòng throw tồn-tại ✓). +- **D5/D6/D7 explicit-label = YES** (engine:62-69 table NHÃN-HOÁ EXPLICIT — H11 chuẩn-hoá-mới). +- **D8 one-direction codify = YES** (engine:72 'codify mới H11' canonical→derived KHÔNG ghi ngược). +- D9 store_memory strip MECHANIZED (grep tools-line 0-hit) · D10 file-tool-write convention (engine tự nhận Bash chưa block cứng) · **D11 byte-0-loss RUNTIME** (h910-curate md5sum+grep-Fxf 10/10 proven). + +## TỔNG: completeness-gate H11 ĐẠT +**B (4/4) + C (5/5) + D (11/11) đủ-trọn** = function-floor MET. **A 🟡 tailored** (A6 runtime cần 2× -Apply = legit-gap có-chủ-đích, đã self-doc). Honest residual: B1 soft-net FP (advisory), A6 runtime-partial (by-design), C3 console mojibake (display-only). KHÔNG bộ-khung nào thiếu → KHÔNG phải "áp một phần". diff --git a/.claude/workflows/runs/2026-06-18-h11-checklist-verify/run.md b/.claude/workflows/runs/2026-06-18-h11-checklist-verify/run.md new file mode 100644 index 0000000..90bf8e3 --- /dev/null +++ b/.claude/workflows/runs/2026-06-18-h11-checklist-verify/run.md @@ -0,0 +1,25 @@ +# RUN — 2026-06-18-h11-checklist-verify (Harness-11 adap · CHECKLIST self-verify, anh giao) + +> **Harness-10 FLAT run-trace** (TRACKED). 3× investigator-codebase (read-only ∥, evidence-mapping). Synthesis → `checklist-verify-synthesis.md`. + +- **Workflow:** Harness-11 CHECKLIST formal self-verify (anh giao "workflow double check lại checklist 1 lần nữa") +- **Mode:** hmw RUN-TRACE. Rà TỪNG item checklist H11 broadcast → chấm nấc + bằng-chứng. "Completeness-gate: bằng chứng thật, KHÔNG bằng trí nhớ." +- **Khác double-check #1:** DC#1 = adversarial correctness/regression. Cái này = formal checklist scorecard từng-item theo đúng rubric checklist H11 (Hành-động · Tự-verify · Nấc · Loại). + +## Rubric (theo checklist H11) +- **Nấc:** executed-file (file tĩnh có trên đĩa) / runtime (đã chạy-quan-sát) / executed-file+runtime. +- **Loại:** mechanized (artifact/cổng-máy bảo-chứng) / convention (người tuân-thủ, không cổng máy). +- **Completeness-gate:** B+C+D phải hiện-diện ĐỦ-TRỌN; thiếu 1 = CHƯA-ĐẠT. A = 🟡 tailorable. + +## 3 lane +| Lane | Role | Checklist section | +|---|---|---| +| CL1 | investigator-codebase | PHẦN A (A1-A7 🟡) + PHẦN B (B1-B4 🔴) | +| CL2 | investigator-codebase | PHẦN C (C1-C5 🔴 mandate) — chạy detector | +| CL3 | investigator-codebase | PHẦN D (D1-D11 🔴) — D.1 nhịp + D.2 3-tier + D.3 4-chốt | + +## Acceptance +Mỗi item: status + evidence (file:line / run-output) + nấc + loại, KHÔNG trí-nhớ. Section verdict ĐẠT/CHƯA. Completeness-gate cuối: B+C+D đủ-trọn? + +## Run-id +`wf_39cd4cbe-f07` diff --git a/.claude/workflows/runs/2026-06-18-h11-doublecheck/_patch.py b/.claude/workflows/runs/2026-06-18-h11-doublecheck/_patch.py new file mode 100644 index 0000000..b103a63 --- /dev/null +++ b/.claude/workflows/runs/2026-06-18-h11-doublecheck/_patch.py @@ -0,0 +1,14 @@ +p=r"D:/Dropbox/CONG_VIEC/SOLUTION/SOLUTION_ERP/.claude/workflows/runs/2026-06-18-h11-doublecheck/_scratch-det.ps1" +lines=open(p,encoding='utf-8').read().split('\n') +out=[];n=0 +for ln in lines: + s=ln + if "if ($line -match '^\s*\|') { continue }" in ln: + s=" if ($false) { continue } #DIS-tablerow"; n+=1 + elif "baseline|" in ln and "S\d{2}" in ln and "{ continue }" in ln: + s=" if ($false) { continue } #DIS-historical"; n+=1 + elif "if ($pre -match" in ln and "phase|session" in ln: + s=" if ($false) { continue } #DIS-versionprefix"; n+=1 + out.append(s) +open(p,'w',encoding='utf-8').write('\n'.join(out)) +print("patched lines:",n) diff --git a/.claude/workflows/runs/2026-06-18-h11-doublecheck/_scratch-det.ps1 b/.claude/workflows/runs/2026-06-18-h11-doublecheck/_scratch-det.ps1 new file mode 100644 index 0000000..4438157 --- /dev/null +++ b/.claude/workflows/runs/2026-06-18-h11-doublecheck/_scratch-det.ps1 @@ -0,0 +1,406 @@ +<# +.SYNOPSIS + governance-detectors.ps1 - Harness-11 PHAN C + B3 governance drift detectors. + +.DESCRIPTION + NO-API, DETECT-and-FLAG-only grep net (Harness-11 mandate): + (1) NO-API - only Select-String + byte/file-exist measure. NEVER calls model/API. + (2) FLAG-only - prints FLAGs, NEVER edits files (auto-WRITE of rules = top hazard, forbidden). + (3) PowerShell 5.1 compatible. Run offline. ASCII-only script body (gotcha #30); + target-file content is read -Encoding UTF8 so Vietnamese count-tokens + (bay / bang / Du tru) match correctly. + (5) DETECT-only LOWERING NET, not a hard build gate. Exit code always 0. + + Detectors: + C2/B3 - derived-staleness : canonical counts from STATUS.md (cross-checked vs disk), + then derived docs scanned for stale count-tokens. + C1 - broken-pointer : (a) gotcha #N refs > max-gotcha or missing "### N." anchor + (b) dangling [[wikilink]] in user-memory / agent-memory. + C3 - vocab-fork : alias-sets where >=2 variants live side-by-side. + C4 - self-line exclusion: pattern-describing files removed from every scan + (else the detector self-matches). + + Each FLAG line: + [DETECTOR] severity | file:line | description | resolve: (C5) + +.PARAMETER RepoRoot + Repo root. Default = resolved 2 levels up from this script (scripts/ -> repo root). + +.EXAMPLE + powershell.exe -ExecutionPolicy Bypass -File scripts/governance-detectors.ps1 +#> +param( + [string]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +) + +$ErrorActionPreference = 'Continue' + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- +$script:FlagCount = 0 + +function Write-Flag { + param( + [ValidateSet('HIGH', 'MED', 'LOW')] [string]$Severity, + [string]$Where, # file:line + [string]$Desc, + [string]$Resolve + ) + $color = switch ($Severity) { 'HIGH' { 'Red' } 'MED' { 'Yellow' } default { 'Gray' } } + Write-Host ("[DETECTOR] {0,-4} | {1} | {2} | resolve: {3}" -f $Severity, $Where, $Desc, $Resolve) -ForegroundColor $color + $script:FlagCount++ +} + +function Write-Section($title) { + Write-Host '' + Write-Host ("===== $title =====") -ForegroundColor Cyan +} + +# Make a path repo-relative for readable FLAG output (forward slashes). +function Rel($full) { + $r = $full + if ($full.StartsWith($RepoRoot, [StringComparison]::OrdinalIgnoreCase)) { + $r = $full.Substring($RepoRoot.Length).TrimStart('\', '/') + } + return ($r -replace '\\', '/') +} + +# --------------------------------------------------------------------------- +# Unicode-token builder (gotcha #30 mojibake guard). +# This .ps1 is ASCII-only on disk. PowerShell 5.1 decodes a BOM-less .ps1 with +# the system ANSI codepage (NOT UTF-8) when launched via -File, which corrupts +# any inline Vietnamese literal (e.g. "bay" -> mojibake) so it can no longer +# match correctly-decoded UTF-8 file content. We therefore build every +# Vietnamese token from Unicode code points at RUNTIME -> encoding-independent. +function U { param([int[]]$cp) -join ($cp | ForEach-Object { [char]$_ }) } + +# Vietnamese tokens used by detectors: +$VN_BAY = U @(0x62, 0x1EAB, 0x79) # "bay" (gotcha synonym) +$VN_BANG = U @(0x62, 0x1EA3, 0x6E, 0x67) # "bang" (table synonym) +$VN_DUTRU_PRO = U @(0x44, 0x1EF1, 0x20, 0x74, 0x72, 0xF9, 0x20, 0x50, 0x52, 0x4F) # "Du tru PRO" +$VN_NGANSACH_PRO = U @(0x4E, 0x67, 0xE2, 0x6E, 0x20, 0x73, 0xE1, 0x63, 0x68, 0x20, 0x50, 0x52, 0x4F) # "Ngan sach PRO" + +# --------------------------------------------------------------------------- +# C4 - self-line exclusion (BUILT FIRST so every scan can apply it) +# These files DESCRIBE the patterns the detectors look for; without exclusion +# the detector would flag itself. Glob-style suffix/substring rules. +# --------------------------------------------------------------------------- +$ExcludeExact = @( + (Join-Path $RepoRoot 'scripts\governance-detectors.ps1'), + (Join-Path $RepoRoot 'docs\governance\harness-11-engine.md') +) | ForEach-Object { $_ -replace '/', '\' } + +$ExcludeDirFragments = @( + '\broadcasts\inbox\', + '\broadcasts\outbox\', + '\.claude\workflows\runs\', + '\.claude\workflows\scripts\' +) + +function Test-Excluded($full) { + $p = ($full -replace '/', '\') + foreach ($ex in $ExcludeExact) { if ($p -ieq $ex) { return $true } } + foreach ($frag in $ExcludeDirFragments) { if ($p -ilike "*$frag*") { return $true } } + return $false +} + +# Resolve which excluded paths actually exist on disk (for the audit line). +$ExcludedActual = @() +foreach ($ex in $ExcludeExact) { if (Test-Path $ex) { $ExcludedActual += $ex } } +foreach ($frag in $ExcludeDirFragments) { + $probe = Join-Path $RepoRoot ($frag.Trim('\')) + if (Test-Path $probe) { $ExcludedActual += $probe } +} + +# Gather governance MD set ONCE (docs/** + .claude/** *.md), minus excluded. +function Get-GovernanceMd { + $dirs = @((Join-Path $RepoRoot 'docs'), (Join-Path $RepoRoot '.claude')) + $all = @() + foreach ($d in $dirs) { + if (Test-Path $d) { + $all += Get-ChildItem -Path $d -Recurse -Filter *.md -File -ErrorAction SilentlyContinue + } + } + return $all | Where-Object { -not (Test-Excluded $_.FullName) } +} + +$GovMd = Get-GovernanceMd + +# --------------------------------------------------------------------------- +# Canonical values from docs/STATUS.md + disk cross-check +# --------------------------------------------------------------------------- +function Get-StatusValue { + param([string]$StatusPath, [string]$RowLabel) + # Match a CURRENT-STATE table row: |