# 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)
  - **+2 double-check (anh giao thêm):** DOUBLE-CHECK `wf_a0b68d2f-30e` (3× reviewer — committed-state + over-suppression regression) → CHECKLIST-VERIFY `wf_39cd4cbe-f07` (3× investigator-codebase — formal scorecard A1-7/B1-4/C1-5/D1-11)
- **run-trace:** `.claude/workflows/runs/{2026-06-18-h11-audit,-implement,-review,-doublecheck,-checklist-verify}/` (TRACKED FLAT, 5 run)

## 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.

## Double-check ×2 (anh giao thêm — 2026-06-18)
- **DOUBLE-CHECK #1** (`wf_a0b68d2f-30e`, 3× reviewer): committed-state `e70c046` **PASS** — B1 ×11 exact, root CLAUDE.md:53 tail byte-identical (0 prose loss), broadcasts hash recompute KHỚP (b2a2fc1c/7fa1b53a/318ff9f6), single-writer clean, budget additive. **Over-suppression regression:** DA1 lane failed-no-return → em-main self-gate (inject prose fake-drift "99 migration" → detector **CAUGHT** → revert) = no over-suppression runtime-proven; DA2+DA3 độc-lập confirm (hunt: C2-skip che per-item/historical/==canonical, KHÔNG live-aggregate; 11 prose-drift vẫn bắt). Fix nhỏ: +C2 "test project" skip (27→26) + agents/README "(pending)"→run-id.
- **CHECKLIST-VERIFY #2** (`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-label=YES + D8 one-direction codify=YES. A7 GATE 186/186, C4 0 self-match, NO-API+0-auto-write grep 0-hit. Honest: A6 runtime cần 2×-Apply (legit by-design), B1 residual soft-net FP (advisory).
- **Lesson NEW:** box-glyph (├└─) KHÔNG đưa vào `.ps1` — gotcha #30 (PS5.1 `-File` ANSI-decode mojibake), KỂ CẢ qua Edit tool (render-normalize escape→literal). Detector giữ pure-ASCII (Python scan 0 non-ASCII verified). Tree-line FP-skip attempted→reverted; line "6 test" giữ làm documented soft-net FP.

## 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`.
