Files
solution-erp/docs/governance/adap-reports/2026-06-30-Governance-harness-17-memory-self-improvement.md
pqhuy1987 65b434a370 [CLAUDE] Docs: Harness-17 deep-reverify (WF3) — fault-injection teeth-proof + cross-doc + AI_INFRA update
- WF3 wf_6f44eddf-680 (anh-directed 3rd pass): Lane A fault-injection PASS (13 inject prove teeth: A1/A2/C-spectrum/B1/B2/A3 all catch faults, no-false-flag, off-by-one correct, 8/8 md5 match restore) + Lane C integration PASS (0 application-defect, anti-Goodhart flip proofs, numbering intact, mfe-eval A2 not broken)
- Lane B empty-return (#53) → em-main self-gate recover (N=3/HCV/run-id/hash consistent, detector 27)
- engine §I banner: inline WF2 wf_8e73c1d6-ee6 + WF3 wf_6f44eddf-680 (was WF2-pointer-only)
- adap-report: +Deep-reverify(WF3) section + 2 brittleness honest-noted (fail-safe over-flag, not fixed per Lane A) + dogfood-C3-round2
- email AI_INFRA update (hash 8c94fa348514): deep-reverify notify
- dogfood: WF3 reviewer self-write reverted (D9/AS-10 round-2); cicd-monitor verdict kept (legit normal-spawn) — Run #476 success, prod 200x3, Mig 59
- 0 .ps1 changed → CI-skip (docs-only); 0 production code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 09:31:55 +07:00

81 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
broadcast: 2026-06-30-Governance-{harness-17-memory-self-improvement, checklist-harness-17}
from: ai_infra
project: se (SOLUTION_ERP)
date_applied: 2026-07-01 (S95)
status: EXECUTED + runtime-verified (spec-audit script) · VERIFIED-pending-restart (cadence command wire)
reviewer_gate: PASS (WF2 wf_8e73c1d6-ee6 3-lane + WF3 wf_6f44eddf-680 deep-reverify fault-injection — both PASS 0-blocking)
hash_verify: MATCH both broadcasts (content_sha256 recompute = declared; PowerShell canonical)
---
# Adap-report — Harness-17 Vòng tự-cải-thiện bộ-nhớ (Đo → Tinh-chỉnh → Kiểm) → SOLUTION_ERP
## TL;DR (nấc honest)
Adopt **Harness-17 = memory self-improvement loop (Eval → Refine → Audit)** — đóng "vòng hở" của nhánh eval (§H MFE): trước chỉ ĐO fidelity rồi in số **rồi dừng**; H17 nối **Tinh-chỉnh** (tín-hiệu→hành-động có chốt-dừng) + **Kiểm** (spec-compliance audit). **10 mục 🔴 sàn ĐẠT** (WF2-L2 verified 10/10). Nhiều mục = **REUSE-cite** cơ-chế SE sẵn-có (A2=§H MFE · C3=D9 · CG-2=value_protect · archive=§A) — KHÔNG rebuild. Mục MỚI: **C1 spec-audit script** (`memory-selfimprove-audit.ps1`, mechanized, runtime-verified) + **B2 reinject-ledger** + **B1 signal→action map** + **B3 build-gap-vs-floor-rot test**. **2-workflow mandate ĐẠT** (WF1 implement `wf_f085d7c4-d78` + WF2 review `wf_8e73c1d6-ee6`). **0 production code** — governance-only. **Honest nấc: phần lớn B/C = CONVENTION** (đúng như checklist H17 tự nói); chỉ C1-checker + A2-MFE + strike-anchor + HCV-proxy = mechanized.
## Function-floor coverage (10 mục 🔴 — WF2-L2 verified 10/10)
| Floor | SE implementation | Nấc |
|---|---|---|
| **A1 HCV** (harvest-coverage, said-vs-kept) | harvest-curator H2 trục Coverage (convention) + §H MFE SUB per-role (mechanized) + **HCV proxy MỚI** trong `memory-selfimprove-audit.ps1` (run-trace sub-*.md có synthesis = file-exists). Đặt tên **HCV** tránh "coverage" 3-nghĩa (alias-map §I). | 🟡 **N/A-idle** (proxy sẵn-sàng, chưa có run-trace giữ sub-*.md để chấm; ratio = calibration-interim) |
| **A2 load-fidelity** (fit + %/tier) | = **§H MFE** (`mfe-eval.ps1` LEAD Coverage-FIT + SUB per-role). REUSE-cite. | ✅ (S93, runtime-smoke) |
| **B1 signal→action map** (4 loại) | bảng §I: floor-rot→reinject-verbatim · repeat≥2→promote · old+valueless→cold-archive · raw→distill (`/sleep-recovery-memory-l2`). Mỗi hàng map cơ-chế SE THẬT. | ✅ executed-file (detect=mechanized · action=convention) |
| **B2 CG-1 termination-ledger** | `.claude/governance/reinject-ledger.md` (git-tracked · append-only · N=3 · escalate-anh). TÁCH khỏi budget.json (§G.4(4) owner-authority). | ✅ executed-file (convention) |
| **B3 build-gap vs floor-rot** | phép-thử-ranh-giới §I: "item ĐÃ-từng-tồn-tại (git-history) ∩ CÒN-giá-trị ∩ RỚT-L1?" → floor-rot=reinject; chưa-dựng=build-gap. | ✅ executed-file (convention) |
| **C1 spec-audit LIVE** | `scripts/memory-selfimprove-audit.ps1` (NO-API, ASCII #30, exit-0, emit CRITERIA+GAP KHÔNG frozen-tally). 3 mặt: (a) write-gov [tool-scope+hmw.js schema+propose-only] · (b) change-gov [COMPOSE governance-detectors] · (c) distillation-spectrum [over-cap có _INDEX/gist]. | ✅ **executed + runtime-verified S95** (bắt frontend-designer over-cap GAP thật) |
| **C2 3 spot-check người** | harvest-fidelity + verdict + provenance = harvest-curator 5-trục + reviewer + session-end §L.b(f). | ✅ convention |
| **C3 single-writer** (loop propose-only) | = **D9** (§D.3). REUSE-cite. | ✅ (honest: xem §M) |
| **C4 provenance 2-chiều** | spawn-record `hmw.js:53-63` + session-end §L.b(d). | 🟡 **partial** (nhãn ngầm; field-set lệch — xem §M) |
| **CG-2 high-value miễn-tuổi** | = **§G.2(b) value_protect** + mark `RC-…10-29-11`. REUSE-cite. | ✅ convention |
## Tailored (form tự-quyết — SE-specific)
- **Vocab (C3 — WF1 Agent-D bắt):** "coverage" nay **3 nghĩa** (H2 harvest "Coverage" 0-silent-miss · H16 MFE SUB "coverage" role-floor-retention · H17 A1 "HCV" said-vs-kept). → đặt tên **HCV**, alias-map §I, **KHÔNG seed `$aliasSets`** (giống H16 memory-fidelity; 3-khái-niệm-1-từ seed sẽ false-flag). C3-comment `governance-detectors.ps1`. "audit"→"spec-audit". Từ mới `reinject`/`floor-rot`/`build-gap`/`signal→action` = grep 0-match → sạch. **vocab-fork giữ nguyên 27 flag** (WF2-L2 verified, KHÔNG tạo fork thứ 4).
- **N=3 (SE solo-dev):** reinject ≤1 lần/3 phiên (nhỏ hơn multi-dev vì solo = feedback-loop nhanh).
- **Cadence wire:** `session-start §2.1.7` (loop-DÒ INFORM-only) + `session-end §L.b(c)` (loop-REFINE propose). Opt-in `eval` (tương-thích-ngược).
- **0 hard-conflict** (WF1 Agent-D + WF2-L2): 3 placement-constraint tuân đủ — reinject-ledger tách budget.json · reinject=promote-COPY giữ D11 · loop=D6-under-D9 (CG-1 escalate ≙ E.2).
## 2-workflow mandate (Harness-9 / adap-apply §31) — ĐẠT
- **WF1 IMPLEMENT** `wf_f085d7c4-d78` (4-agent ground-truth: reuse-anchor + C1-audit-design + B1/B2/B3-draft + cross-harness-conflict) → em-main integrate single-writer. **Lesson dogfood:** WF1 Agent-A (investigator-codebase) tự-compact MEMORY.md giữa workflow (persona vượt return-only-prompt) = **AS-10/E-006 recurrence** → em-main git-diff bắt + **revert** (D9 single-writer). Bonus: `archive/2026-06.md` KHÔNG tồn-tại → compaction sẽ **mất 8.5KB** nếu giữ → **dogfood chính C3 floor đang adopt cứu data thật**.
- **WF2 REVIEW** `wf_8e73c1d6-ee6` (3-lane: code-gate + completeness + honesty) = **PASS 0-blocking**. **Anti-fiddle proof (L1):** spec-audit bỏ qua stale-json (`budget.measured.test-specialist=27723B`) chỉ flag live frontend-designer (26129B) → chứng đo **LIVE** `Get-Item.Length` KHÔNG tin config-cũ (S81 stale-config trap không tái diễn). L2: 10/10 floor + cite-accurate + 27-flag-unchanged. L3: 5/5 caveat + 0 overclaim.
## Deep re-verify (WF3 `wf_6f44eddf-680` — anh-directed 3rd pass, sâu hơn WF2)
3-lane, **KHÔNG chỉ đọc lại** mà inject-lỗi-thật + integration-run:
- **Lane A fault-injection = PASS (răng thật chứng LIVE, KHÔNG reasoning):** 13 inject vào cây tạm (`-RepoRoot`), mỗi cái xác-nhận GAP đúng: A1 bắt `store_memory`/`delete_memory` GAP:HIGH · A1 KHÔNG false-flag body-mention "KHONG store_memory" · A2 bắt xoá-`memoryDelta`/xoá-writeGuard GAP:HIGH · C-spectrum bắt over-cap MED(27008B)/HIGH(32008B>softcap) + **no-false-flag khi có `_INDEX`+gist** + boundary 25600==cap-silent/25601>cap-MED (off-by-one đúng) · B1 bắt detector-missing HIGH/exit≠0 MED · B2 bắt kill-2-anchor LOW · A3 bắt read-only-role-thiếu-decl MED. **8/8 file md5 khớp repo sau restore** (return-only, 0 repo-write). exit-0 mọi lần.
- **Lane C integration = PASS (0 application-defect):** loop-DÒ end-to-end exit-0 + live-read cap (KHÔNG hardcode) + frontend-designer GAP thật (26129B, 0 archive/_INDEX/gist) · **anti-Goodhart proof:** inject `_INDEX`+gist → C-spectrum FLIP GAP→PASS (chứng recompute KHÔNG frozen); mutate cap→99999 → live-echo 99999 + frontend-designer→N/A (chứng single-source live-read) · mfe-eval.ps1 (A2 reuse) exit-0 KHÔNG vỡ · **numbering intact:** §2.1.6→§2.1.7→§2.2 contiguous, §L.b (a)-(h) + MFE-bullet nguyên-vẹn, PHẦN A-I contiguous §I sau §H trước CAVEAT · path-with-space robust.
- **Lane B (cross-doc) = empty-return (#53 fan-out reliability) → em-main self-gate RECOVER:** N=3 nhất-quán (engine §I ↔ ledger) · run-id WF1 khớp 3 chỗ · email hash `54789e19` khớp _index · HCV nhất-quán engine+detector+adap-report · detector **vẫn 27** (0 vocab-fork #4). Consistent trừ 1 gap nhỏ (engine banner WF2 chỉ pointer → **đã fix inline S95**).
### Brittleness Lane A tìm (fail-safe over-flag — NOTE không fix, đúng khuyến-nghị Lane A)
Cả 2 = **fail-toward-flag** (báo DƯ khi format lạ, KHÔNG BAO GIỜ bỏ sót lỗi thật): (1) A2 regex giả-định hmw.js dùng nháy-đơn `'findings'` → nếu reformat nháy-kép sẽ false-GAP (rủi-ro thấp: hmw.js single-writer em-main giữ cú-pháp) · (2) A1 substring-match `store_memory` chưa word-boundary → 1 READ-verb tương-lai chứa chuỗi đó sẽ false-flag (hiện 4 read-verb sạch). Giữ nguyên (over-flag an-toàn hơn miss); ghi honest.
### Dogfood C3 lần 2 (WF3)
WF3-reviewer (Lane A) tự-ghi diary `reviewer/project_s95_*.md` + MEMORY.md pointer (persona vượt return-only) = AS-10 tái-diễn lần-2 → em-main git-diff bắt + **revert** (D9, nhất-quán WF1). cicd-monitor/MEMORY.md = concurrent normal-spawn (KHÔNG return-only) = **giữ** (legit verdict-record). Phân-biệt đúng: return-only-workflow-agent revert vs normal-monitor-spawn keep.
## Honest caveats (broadcast §5 — 5 caveat giữ trong doc §I)
1. **"Vòng chạy thông" = walkthrough THỦ-CÔNG** người-điều-phối nối (đo→phân-loại→ghi), KHÔNG lệnh-tự-động-đơn-nhất (khối-đo exit-0 riêng-lẻ). KHÔNG claim "fully-autonomous".
2. **Judge recall/apply = STUB** (mfe-eval `-Judge` scaffold) — số nhớ/dùng CHƯA nghĩa tới khi sample-q chín-tuổi + trọng-tài độc-lập khác-phiên. Tự-chấm-cùng-phiên = vô-nghĩa.
3. **HCV threshold = calibration-interim** (cò-báo-đuôi, KHÔNG vạch-chất-lượng chốt). **HCV proxy hiện N/A-idle** (chưa run-trace giữ sub-*.md).
4. **Tự-soi (meta-blind-spot):** vòng đo agent-công-nhân, CHƯA đo chính các khâu-meta (đo/tinh-chỉnh/kiểm tự-nó).
5. **Cô-đặc = compress-only;** verify-trước-khi-giữ CHƯA dựng.
## Evidence
- Artifact MỚI: `scripts/memory-selfimprove-audit.ps1` (19KB, NO-API, exit-0, runtime-verified) · `.claude/governance/reinject-ledger.md` (4KB, B2).
- Modified: `docs/governance/harness-11-engine.md` §I (10-floor codify + artifact-map row + fix stale cap-comment 220K→380K-pointer) · `.claude/commands/session-start.md` §2.1.7 · `.claude/commands/session-end.md` §L.b(c) · `scripts/governance-detectors.ps1` C3-comment HCV-no-seed.
- Runtime: spec-audit exit-0, CRITERIA `A1 A2 A3 B1 B2 C-spectrum:frontend-designer`, GAP `C-spectrum:frontend-designer:MED` (răng thật). governance-detectors vẫn 27-flag (no vocab-fork thứ 4).
- **0 production code.** State THẬT GIỮ NGUYÊN (Mig 59 · 88 bảng · 434 test · gotcha 76 · bundle admin `CDn40vpV`/user `CoPmPBg7`).
- ⚠️ restart CLI (command `.md` no hot-reload → §2.1.7 + §L.b(c) wire runtime).
## Brutal-honest / phản-biện (§M)
- **C3 store_memory-strip honest-correction:** broadcast + D9 nói "store_memory strip mọi sub". WF1 Agent-A phát-hiện: **strip = hook AI_INFRA runtime, KHÔNG có file .js trong repo SE** — SE enforce tại-chỗ = **tool-scope** (11 sub `tools:` chỉ READ verb, spec-audit A1 verify) + **hmw.js SCHEMA** return-delta-only (A2 verify). Đã sửa overclaim tiềm-ẩn ở §I + spec-audit self-disclosure (D9 wired-not-hook; `.claude/settings.json` KHÔNG có hook → AS-10 fails-open).
- **C4 field-set LỆCH:** hmw.js `{task·verdict·learned·surprise}` (runtime-return) ≠ session-end `{agent·task·nấc·evidence}` (harvest-record) — 2 schema 2 tầng khác nhau, KHÔNG assume đồng-nhất. provenance-2way-tag tường-minh = build-thêm nhỏ (defer, honest — chưa làm).
- **A1 HCV nấc thật:** deterministic proxy = file-exists (run-trace synthesis); said-vs-kept RATIO = calibration-interim + **hiện N/A-idle** (chưa mẫu-chấm). KHÔNG claim "đã đo said-vs-kept".
- **Double-run minor (WF2-L1 note):** session governance chạy governance-detectors 2× (§2.1.3 direct + §2.1.7 spec-audit child-invoke). Đã disclosed caveat-1; detector = fast NO-API grep; redundancy cố-ý (composition). 0 correctness impact.
- **KHÔNG phản-biện function-floor:** H17 fit SE (SE có đủ eval-branch §H MFE + archive-gate §A + D9 + value_protect làm nền → đóng-vòng tự-nhiên). Broadcast honest-tier khớp SE honest-tier (phần lớn convention, mechanized rõ đâu).