# adap-report — Harness-11 (engine bộ-nhớ-và-governance TỰ-BẢO-TRÌ) - **id:** 2026-06-18-Governance-harness-11 - **source broadcast:** `ai_infra/broadcasts/outbox/all/2026-06-18-Governance-harness-11.md` (+ checklist `2026-06-18-Governance-checklist-harness-11.md`) · directed heads-up `outbox/se/2026-06-18-ai_infra-to-se-harness-11-available.md` (inbox verify ✓ whole-file `318ff9f6` + body `b2a2fc1c`) - **adopted by:** se (SOLUTION_ERP) · **session:** S75 · **date:** 2026-06-18 - **protocol:** Harness-9 PART-2 mandate = 3 workflow tách biệt + report-with-run-id - AUDIT `wf_7fdc3bd5-930` (4× investigator-codebase) → IMPLEMENT `wf_c5e5844e-7c1` (2× general-purpose script ∥ + em-main MD cluster) → REVIEW `wf_d7ca1ff8-942` (3× reviewer adversarial) - **run-trace:** `.claude/workflows/runs/{2026-06-18-h11-audit,-h11-implement,-h11-review}/` (TRACKED FLAT) ## VERDICT: ✅ ADOPTED — completeness-gate ĐẠT (B+C+D function-floor đủ-trọn), REVIEW PASS 0-blocker H11 = chuẩn-hoá lại cái SE đã thể-hiện MỘT PHẦN (Harness-9 L2-recovery + Harness-10 run-trace + single-writer). AUDIT xác nhận: nhiều cấu-phần PRESENT sẵn, GAP thật = **PHẦN C (3 detector-script)** + **B1/B3 (derived→canonical pointer + freshness)** + **D5-D8 (3-tier + one-direction-lock chưa nhãn-hoá)**. ## Nấc theo PHẦN (trung-thực executed-file vs runtime · mechanized vs convention) | PHẦN | Trạng-thái | Nấc | |---|---|---| | **A** (hot-mem auto-archive 🟡) | A1-A3 PRESENT sẵn (H9) · A4 hysteresis 0.85 / A5 keep-floor 5 / A6 2-strike / A7 NO-API L1-eval = **MỚI** | `memory-archive-gate.ps1` runtime-proven (A7 186/186 pointer-resolve, A4/A5 DRY-RUN observed). A6 2-strike = executed-file (cần 2 -Apply mới đủ runtime). budget.json `archive_gate` params. mechanized DRY-RUN planner; MOVE thật = em-main (D5 semantic-null). | | **B** (derived→canonical 🔴) | B1 ✅ (11 edit count→pointer `docs/STATUS.md`) · B2 ✅ · B3 ✅ (=C2) · B4 ✅ | B1 landed + **drift THẬT root CLAUDE.md RESOLVED** (post-B1 re-run: 3 TP-flag mig53/test306/gotcha68 GONE). runtime-proven. | | **C** (3 grep detector 🔴 MANDATE) | C1/C2/C3 + C4 + C5 = **MỚI build** | `governance-detectors.ps1` runtime-proven: bắt drift thật + C4 0-self-match + C5 100%-resolve + NO-API + 0-auto-write. **Refinement post-R2:** 59→27 flag (C2 context-skip + C1 `[-_]` normalize). | | **D** (orchestration 🔴) | D1/D2 wired MỚI (session-start §2.1.3 + session-end §L.b(c)) · D3/D4/D9/D10/D11 PRESENT-mạnh sẵn · **D5/D6/D7 3-tier + D8 one-direction-lock = MỚI codify** | mix. D4/D9/D11 mechanized (hmw.js:76 THROW · store_memory strip · md5sum byte-0-loss). engine-doc `docs/governance/harness-11-engine.md` = canonical. | ## Tailoring (SE-specific) - Detector = **PowerShell .ps1** (khớp `scripts/*.ps1` + `measure-agent-memory.ps1` precedent), KHÔNG bash — chạy `powershell.exe -File`. - A = DRY-RUN planner (in kế-hoạch, người duyệt) thay auto-move — vì MOVE đụng memory canonical (D6/D9 single-writer). - Canonical = `docs/STATUS.md` CURRENT-STATE table (nguồn-chuẩn state); detector cross-check disk (mig=`ls Migrations/*.cs`, gotcha=max `### N`). - Engine-doc TỰ-NÓ B1-compliant (0 hardcoded volatile-count) — dogfood. ## Honest caveats (KHÔNG nói quá) - **no-OS-hook:** detector/gate chạy TRONG thân session-start/end body, em-main kích — DÒ tự-động, SỬA+GÁC dựa người. KHÔNG fully-autonomous. - **auto-WRITE luật = CỐ Ý chưa làm** (defer ≥2 sự-cố thật, hiện 0). Mọi thứ chạm luật/copy = chỉ DÒ+FLAG. - **C2 residual ~11 FP** (module-local "4 bảng Budget" historical, "1 migration" prose revert-cmd) = soft-net chấp-nhận (LOW/MED advisory exit-0, self-documented). FP-rate cắt từ ~89%→~40% sau refinement. - **C1 13 wikilink-dangling = REAL pre-existing** memory-index drift (genuinely-missing + cross-scope) — engine SURFACE đúng; fix từng cái = chore riêng, KHÔNG block adap. - **C3 console mojibake VN-variant** = cosmetic Bash-capture (match THẬT đúng — gotcha #30 code-point builder). - **A6 2-strike** = executed-file logic (runtime cần 2 lần -Apply); **detector stateless** nên 2-strike-for-flag là convention em-main, KHÔNG mechanized-per-detector (KHÔNG over-claim). ## Reverse-findings (đề-xuất ngược AI_INFRA) 1. **gotcha #30 = floor-class lesson cho mọi sister Windows:** detector .ps1 NO-API tiếng-Việt BẮT BUỘC build token từ Unicode code-point (`[char]0x1EAB`...) — `powershell.exe -File` decode .ps1 UTF-8-no-BOM bằng ANSI-1252 → literal Việt mojibake → detector MÙ token bản-địa (vòng-1 thiếu 18/71 flag). Đề-xuất thêm vào H11 checklist PHẦN C như cảnh-báo encoding cho dự-án non-ASCII. 2. **C2 count-token grep = soft-net FP cao bản-chất** (~89% raw) — cần context-skip (table-row + version-prefix + historical-marker) để dùng được; đề-xuất H11 checklist note FP-mitigation pattern. 3. **B1 + C2 = cặp bổ-trợ:** B1 (pointer-conversion) gỡ copy → C2 chỉ gác doc copy MỚI. Sau B1, C2 trên doc đã-pointer = no-op (đúng ý-đồ). Xác-nhận thiết-kế này khớp intent H11. ## Evidence - 3 run-id (trên) · run-trace synthesis 3 file `*-synthesis.md` (audit/implement/review) · ledger `runs/_ledger.md` 3 row CLOSE. - Detector runtime: exit 0, 27 flag post-refinement (C4 0-self-match, NO-API grep 0-hit, 0-auto-write git pre==post). - Archive-gate runtime: A7 186/186 pointer-resolve, A4/A5 DRY-RUN observed. - State THẬT GIỮ NGUYÊN (0 production code): Mig 55 · 88 bảng · 339 test · gotcha 69 · menu 54 · bundle `BYF5vIMJ`/`CB-tiRxd`.