From 5ee32c0c0b71e7c38c1f8126cb3baaf37665b584 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Thu, 2 Jul 2026 15:32:04 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Docs:=20S100=20Harness-18=20adopt=20?= =?UTF-8?q?=E2=80=94=20detector=20v2=20ratio-band+glob=20(fault-inject=204?= =?UTF-8?q?/4,=20MED=2011=E2=86=920)=20+=20retire=20runs/=5Fledger=20?= =?UTF-8?q?=F0=9F=A7=8A=20(0/15=20lifetime,=20sweep=2015=20=C4=91i?= =?UTF-8?q?=E1=BB=83m/8=20file,=20orphan=3Dfolder-scan)=20+=20engine=20?= =?UTF-8?q?=C2=A7J=20+=20cron=20ghost-wire=20honest-retire=20(CronList=3D0?= =?UTF-8?q?,=205=20file)=20+=20F2=20SendMessage=20re-verified=20+=203=20ad?= =?UTF-8?q?ap-report=20(frontier=20HELD=20hash-MISMATCH,=20flag=20reviewer?= =?UTF-8?q?=5Fgate-missing)=20=E2=80=94=20WF1=20wf=5F50a817ce-a69=20=C2=B7?= =?UTF-8?q?=20WF2=20wf=5F31ea3985-92c=20in-flight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../agent-memory/harvest-curator/MEMORY.md | 2 +- .../investigator-codebase/MEMORY.md | 1 + .claude/agents/README.md | 2 +- .claude/agents/harvest-curator.md | 6 ++-- .claude/commands/session-end.md | 9 ++--- .claude/commands/session-start.md | 10 +++--- .claude/workflows/README.md | 4 +-- .claude/workflows/runs/README.md | 14 ++++---- .claude/workflows/runs/_ledger.md | 2 ++ CLAUDE.md | 2 +- docs/HANDOFF.md | 2 +- docs/STATUS.md | 8 +++-- .../2026-07-02-S100-harness-18-adopt.md | 34 ++++++++++++++++++ ...-Governance-harness-frontier-assessment.md | 22 ++++++++++++ ...6-07-02-Governance-checklist-harness-18.md | 35 +++++++++++++++++++ ...e-harness-18-architecture-consolidation.md | 28 +++++++++++++++ docs/governance/harness-11-engine.md | 34 ++++++++++++++++++ docs/rules.md | 4 +-- scripts/governance-detectors.ps1 | 23 +++++++++--- 19 files changed, 207 insertions(+), 35 deletions(-) create mode 100644 docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md create mode 100644 docs/governance/adap-reports/2026-07-01-Governance-harness-frontier-assessment.md create mode 100644 docs/governance/adap-reports/2026-07-02-Governance-checklist-harness-18.md create mode 100644 docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md diff --git a/.claude/agent-memory/harvest-curator/MEMORY.md b/.claude/agent-memory/harvest-curator/MEMORY.md index dddf7c1..607837f 100644 --- a/.claude/agent-memory/harvest-curator/MEMORY.md +++ b/.claude/agent-memory/harvest-curator/MEMORY.md @@ -16,7 +16,7 @@ H2 harvest-MD-integrity auditor **SOLUTION_ERP-self**. Read-only + **propose-onl ## 📋 Baseline state (re-ground S99) - **Spawn-record 4-field SE:** `{task · verdict · learned · surprise}` (memoryDelta R1 contract HMW). - **agent-memory:** 11 folder `.claude/agent-memory//MEMORY.md` (placement target). Cap L1 = 25.6KB (H11 `memory-archive-gate.ps1`); hook self-target 17.1KB. -- **Run-trace (Harness-10, thay wave-folder Harness-2):** `.claude/workflows/runs//` git-TRACKED, FLAT (`run.md` + `sub-*.md` + `*-synthesis.md`); 5 run cũ 06-18 giữ `sub-md/`+`harvest/` subfolder (dual-accept). Ledger `runs/_ledger.md` two-beat OPEN/CLOSE — orphan = row `⏳`. **Mode-A ephemeral (S98 note):** HMW default KHÔNG tạo run-folder/ledger-row = by-design, vắng row ≠ orphan; ledger chỉ cover MODE B (`args.run`). +- **Run-trace (Harness-10, thay wave-folder Harness-2):** `.claude/workflows/runs//` git-TRACKED, FLAT (`run.md` + `sub-*.md` + `*-synthesis.md`); 5 run cũ 06-18 giữ `sub-md/`+`harvest/` subfolder (dual-accept). **🧊 Ledger `runs/_ledger.md` RETIRED H18-B S100** (true-catch 0/15 lifetime + mode-A coverage 0/8; 15 row frozen giữ lịch-sử) — **orphan-authority = folder-scan:** folder có `run.md` mà `*-synthesis.md` VẮNG/0-byte. Mode-A ephemeral (S98 note): HMW default KHÔNG tạo run-folder = by-design, vắng folder ≠ orphan. - **Nền H2 gốc:** `session-end.md` Phase 1.5 §L.b = 3/5 trục; sub này nâng +Fidelity-escalate +Placement = đủ 5. ## ⚠️ Anti-patterns diff --git a/.claude/agent-memory/investigator-codebase/MEMORY.md b/.claude/agent-memory/investigator-codebase/MEMORY.md index d2734aa..a77756f 100644 --- a/.claude/agent-memory/investigator-codebase/MEMORY.md +++ b/.claude/agent-memory/investigator-codebase/MEMORY.md @@ -70,6 +70,7 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte ## 📅 Recent activity (compressed — full verbatim → `archive/2026-06.md` via `archive/_INDEX.md`) +- **2026-07-02 (S100 H18-adopt WF1 `wf_50a817ce-a69` — 3 lane ∥, on-behalf em main APPEND B3, return-only 0-residual):** L1 measurer-coverage: 3/3 script (`mfe-eval:216`/`selfimprove:133-137`/`archive-gate:106`) **GLOB-LIVE 0-hardcode** — agent thứ 12 tự-cử; ⭐ ghost-wire-class MỚI: **config-key defined-but-unread** (`memory-budget.json:54-55` `role_file_glob`/`diary_path_pattern` — script re-hardcode giá trị TRÙNG → không detector nào flag vì cả 2 phía "đúng"; catch = grep key-name across scripts/) + latent skip-if-no-`tools:` (`selfimprove:147`, 0 affected 11/11 có). L2 ghost-wire+taxonomy: MAST=0 repo-wide (grep PHẢI case-sensitive `\bMAST\b` — insensitive dính "Master" noise); cron monthly = ghost-wire THẬT (CronList=0 + scheduler RỖNG 05-04 log + S96 chạy 13:04 em-main in-session); convention "auto = step em-main kích, no-OS-hook" nhất quán 5 nơi. L3 ledger-đo: `_ledger.md` true-orphan-catch **0/15 lifetime** (single-day artifact 06-18, 15 row/14 folder — mig54-R2 share) · mode-A coverage 0/8 S93+ · ⭐ "S71 `harvest/` rỗng" = **criterion-wording KHÔNG phải incident** (đính chính claim em-main) · repo có 5 "ledger" khác tên → sweep grep `_ledger` EXACT · hmw.js 0-touch. Tag `[s100-h18-wf1, 3-lane, ghostwire-configkey-class, ledger-0-15, on-behalf]`. - **2026-07-02 S98 verify-lane V2 post-flush (VERDICT PASS):** detector 28→25 (derived-stale 11→8; wikilink 14 + vocab-fork 3 giữ by-design). **8 derived-stale còn = 100% FP-class count-token soft-net:** CLAUDE.md:84 tests-tree "(6 test…)" · ef-core SKILL :94/:95 ("2/1 migration tách/GỘP" history) + :103/:111/:114 ("4/3/1 bảng" Budget-defer/Mig-15 module-local) + :162/:179 (heading "Revert 1 migration" + comment "Script từ 1 migration") — 0 genuine drift vs canonical 61/89/440/79; SKILL edit sáng (+rows 60/61 @:82-83) chỉ shift line-number FP cũ, 0 flag MỚI. ⭐ Grep gotcha: **"Fable RESTORED" exact-string CHỈ STATUS:24 + session-start:29; agents/README dùng biến-thể "Fable 5 1M RESTORED" (:3) + "Fable-restore" (:12)** — exact-phrase grep miss README dù substance đủ. HANDOFF:5 mega-line: bundle mEGqlNWc/Dnrp4PU1=#484, CeTA7Z82 chỉ trong note "= #483" (1 line match duy nhất cả file). 3 on-behalf append đúng-chỗ: database-agent :36 (cuối Log = EOF) · reviewer addendum TRONG-entry S97-bis :68 (câu cuối + marker on-behalf @S98) · impl-fe S97-Part2 :16 giữa badge:9/S97:19. cicd "S98" = 2× "(curate S98)" stub :73/:74, 0 material-tag. Ledger :7 Mode-A ephemeral note (wf mode-A vắng ledger-row ≠ orphan) + bảng 15 row :11-25 nguyên. - **2026-07-01 S97 session-end feedback-audit (VERDICT CLEAN):** Grep-verified capture readiness pre-close. ✅ gotcha #77/#78/#79 present `docs/gotchas.md:1301/1317/1325` (format `### N.` count=79 = STATUS header — no self-count drift; all 3 have Triệu-chứng+Cơ-chế+Fix+**Quy-tắc** root-cause). ✅ #53 return-garble **x6 (cicd 5/6)** in BOTH `feedback_agent_return_garble_recover.md` (Why-line ×5→×6 + **structural root-cause: cicd MEMORY self-target ~17.1KB→curate-at-return→thinking-step=message-cuối=return-value**; fix=archive-cicd-sớm NOT instruction) AND S97-log Parts 1/2/4 (lần-4/5/6). cicd MEMORY LIVE=17.5KB (confirms self-target). ✅ Mig 60 wrong-table BUG = 2-fix present: code (Mig 61 `20260701142752` query Changelogs) + guard (gotcha #79 "xác định ĐÚNG bảng writer" + "verify marker-count prod trước"). Mig 60 code `:29-31` confirmed `PurchaseEvaluationApprovals a...a.Comment LIKE` = wrong. Both Mig 60/61 have 3-file rule. ✅ git status CLEAN, 0 stray `.claude` misland, 0 `git add -A` in log, S97 workflows HMW-ephemeral (NOT persisted run-folders — consistent S94+ pattern, runs/ only old 06-18). ✅ Product decisions captured (STATUS/HANDOFF/log + commit-msg): "duyệt là fix"→#480 price-lock, "fix trọn"→Mig 60 endsBeforeCeo-runtime, "hiện luôn CEO duyệt"→#483 badge, Supplier-backlog "15-18 field"→STATUS Next-up. **MINOR only:** S97-log per-Part State footers show progression (Part-1 `:47` "88 bảng gotcha 77" stale vs session-end "89/79" Part-4 `:113`) — intentional per-part snapshot but mid-log reader sees stale count. No BLOCKING/MAJOR gaps. - **2026-07-01 Supplier Excel-import GAP audit (anh Kiệt FDC — 30-col "Database NCC & Nhà thầu phụ" cho bên Pro):** ⭐ **Entity CỰC LEAN 9 domain-prop** (`Domain/Master/Supplier.cs:5-16`: Code·Name·Type·TaxCode·Phone·Email·Address·ContactPerson·Note) + 8 audit inherited (Base/AuditableEntity). EF `SupplierConfiguration.cs`: Code len50 UNIQUE-filtered `[IsDeleted]=0`(:24, Mig47 #57), Name200, TaxCode20, Phone30, Email100, Address500, ContactPerson200, Note1000. **enum `SupplierType.cs:3-10` = NhaCungCap1/NhaThauPhu2/ToDoi3/DonViDichVu4/ChuDauTu5 — KHÔNG có "Cả hai/Both"** (FE mirror `fe-admin/types/master.ts:11-16` identical). **GAP 30→entity: 6✅ · 7⚠️collision · 17❌ no-home** — Excel splits Address×2(invoice/office), Phone×2(company/contact), ContactPerson+role; ❌ Fax·Bank-acct×2·Legal-rep+role·GUQ+3-NAS-links·Status/blacklist·Referral·PMH-owner. ⚠️ **S55 seed `SeedRealMasterDataAsync` (`DbInitializer.cs:2768-2787`) crams NĐD/bank/status/category vào free-text `Note`** (:2771-73 TRUONGGIANG/TANPHU/TGN) — proof entity thiếu home. Seed **UNGATED** (called :128, idempotent-key=`Code` :2780) — KHÁC demo-master (`SeedDemoMasterDataAsync` GATED `DemoSeed:Disabled` :117, #75). POST any-auth (`SuppliersController.cs:37-42` S59). FE SHA-identical 2-app (`c1760788`, 253L, 9 fields). **Prod 20 NCC** (Type1×3+Type2×17; type3/4/5 wiped go-live S91 → "Cả hai" enum genuinely-needed). Precedent NAS-link = `PE.HoSoLink nvarchar(1000)` Mig52. Fork→em-main: core-widen ~15col+CaHai=6 vs satellite `SupplierDetail`. → _INDEX pending. diff --git a/.claude/agents/README.md b/.claude/agents/README.md index 3765862..deb4b2c 100644 --- a/.claude/agents/README.md +++ b/.claude/agents/README.md @@ -163,7 +163,7 @@ All 11 agent có **4 RAG-READ MCP**: `search_memory` + `search_code` (BM25, prefer over Read full file — tiết kiệm token) + `cross_project_search` + `list_projects`. Base tools per role (READ: Read/Grep/Glob/Bash [+WebFetch/Search cho api] · WRITE: +Edit/Write/Skill). -> **2 monitor sub (tooling-auditor H1 + harvest-curator H2 — 2026-06-07):** read-only toolset = `[Read, Grep, Glob, Bash, +4 RAG-read]`, **NO `store_memory`, NO Write/Edit** (mirror investigator read-set). INFORM-only — propose → em main single-writer VERIFY→APPEND (B3). 🔴 **G-015 accuracy (Harness-10 run-trace model, `runs/_ledger.md:4`):** run-folder `runs//` được git **TRACKED** → mọi write HIỆN trong git-diff = audit trực-tiếp. Containment: tracked-change NGOÀI `runs//` VÀ NGOÀI code-disjoint đã giao = vi-phạm (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ `Bash` (write-channel mở qua shell/curl) → containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG), KHÔNG allowlist đơn-độc. +> **2 monitor sub (tooling-auditor H1 + harvest-curator H2 — 2026-06-07):** read-only toolset = `[Read, Grep, Glob, Bash, +4 RAG-read]`, **NO `store_memory`, NO Write/Edit** (mirror investigator read-set). INFORM-only — propose → em main single-writer VERIFY→APPEND (B3). 🔴 **G-015 accuracy (Harness-10 run-trace model, `runs/README.md §Containment` — 🧊 `_ledger.md` retired H18-B S100):** run-folder `runs//` được git **TRACKED** → mọi write HIỆN trong git-diff = audit trực-tiếp. Containment: tracked-change NGOÀI `runs//` VÀ NGOÀI code-disjoint đã giao = vi-phạm (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ `Bash` (write-channel mở qua shell/curl) → containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG), KHÔNG allowlist đơn-độc. > ⚠️ **`store_memory` GỠ khỏi MỌI sub (2026-06-02 — AI_INFRA broadcast `Memory-store-memory-strip-global`, adap-report cùng id).** → **lead (em main) = sole RAG-writer** (mechanized failure-safe: sub vật-lý không gọi được `store_memory`). Sub tìm thấy finding/pattern mới → ghi **MEMORY.md** (file); lead + re-index đưa vào RAG. *Accuracy (G-015): đây KHÔNG = sub "read-only" — sub vẫn giữ `Bash` (+ vai write giữ `Write/Edit`); containment thật = defense-in-depth git-diff + Qdrant chunk-count, chưa phải allowlist đơn độc.* diff --git a/.claude/agents/harvest-curator.md b/.claude/agents/harvest-curator.md index cdaaabc..3340a21 100644 --- a/.claude/agents/harvest-curator.md +++ b/.claude/agents/harvest-curator.md @@ -25,7 +25,7 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/ **@session-start (BÁO harvest mới):** - **🌾 Harvest MD mới:** tổng hợp MD/memory MỚI từ run-folder `runs//sub-md/` · sub-agent · agent-team kể từ last-session (spawn-record mới · finding mới · **delta CHƯA APPEND** = mồ-côi cần em main xử-lý). -- Run-folder tồn-đọng (run chạy mà chưa harvest — đối-chiếu `runs/_ledger.md` OPEN-beat chưa CLOSE) → flag. +- Run-folder tồn-đọng (run chạy mà chưa harvest — folder-scan: `runs//` có `run.md` mà `*-synthesis.md` VẮNG/0-byte; 🧊 đối-chiếu ledger retired H18-B S100) → flag. ## ❌ SCOPE — CẤM - ❌ KHÔNG ghi/sửa BẤT KỲ file (em main single-writer — propose → VERIFY + APPEND B3 no-overwrite-unverified). KHÔNG `store_memory` (RAG single-writer = em main). @@ -41,7 +41,7 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/ ## 📤 OUTPUT contract - @session-end: bảng harvest {sub/run · spawn-record-đề-xuất · 5-trục verdict · flag} + run-folder-consolidate propose (idempotent, đã DEDUP vs per-turn) + chore-memory. Propose-delta cho em main APPEND. -- @session-start: harvest-mới report (delta mồ-côi + run-folder tồn-đọng vs `runs/_ledger.md`) gọn cho Phase 2/3. +- @session-start: harvest-mới report (delta mồ-côi + run-folder tồn-đọng qua folder-scan `runs/*/` — 🧊 ledger retired H18-B S100) gọn cho Phase 2/3. - ≤ vài K token. Mọi claim có ref (path / count). KHÔNG tự ghi. ## 💾 Memory @@ -49,6 +49,6 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/ ## 🔒 RULES + G-015 accuracy - Read-only + propose-only. Output qua em main verify (em main re-Read ref trước APPEND). -- 🏃 **Harness-10 run-trace audit (`runs/_ledger.md:4`):** run-folder `runs//` được git **TRACKED** → mọi write HIỆN trong git-diff. Khi gom run-folder, VERIFY sub-workflow CHỈ ghi trong `runs//` (sub-md) + code-disjoint đã giao — phát-hiện tracked-change NGOÀI 2 vùng đó (`agent-memory/*` hay canonical) = **FLAG vi-phạm containment** cho em main (git-diff evidence). (Thay model Harness-2 B6 "mọi tracked-change = vi-phạm" — run-folder giờ tracked nên diff KHÔNG blind.) +- 🏃 **Harness-10 run-trace audit (`runs/README.md` §Containment — 🧊 `_ledger.md` retired H18-B S100):** run-folder `runs//` được git **TRACKED** → mọi write HIỆN trong git-diff. Khi gom run-folder, VERIFY sub-workflow CHỈ ghi trong `runs//` (sub-md) + code-disjoint đã giao — phát-hiện tracked-change NGOÀI 2 vùng đó (`agent-memory/*` hay canonical) = **FLAG vi-phạm containment** cho em main (git-diff evidence). (Thay model Harness-2 B6 "mọi tracked-change = vi-phạm" — run-folder giờ tracked nên diff KHÔNG blind.) - 🔴 **G-015 KHÔNG overclaim:** sub này = propose-only. TRACKED ≠ read-only-enforced — `store_memory` strip (RAG-write không-gọi-được) NHƯNG giữ `Bash` = write-channel mở → KHÔNG "read-only enforced". Containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG). - KHÔNG tự ghi memory kênh nào (return delta → em main APPEND B3). diff --git a/.claude/commands/session-end.md b/.claude/commands/session-end.md index d2a558f..0c1d932 100644 --- a/.claude/commands/session-end.md +++ b/.claude/commands/session-end.md @@ -5,7 +5,7 @@ description: Đóng session SOLUTION_ERP — flush 10-agent memory + H2 harvest- # /session-end — Session closeout (FLUSH + WRITE + VERIFY + REPORT + COMMIT + EVAL) > Trigger cuối session. Em main chủ trì, gọi lại sub-agent đã spawn. -> ⚠️ **Harness note:** SendMessage KHÔNG khả dụng → "flush con đã spawn" = agent đã tự update MEMORY khi return (BẮT BUỘC trong agent frontmatter). Em main đọc lại MEMORY on-disk để synthesize, KHÔNG cần re-spawn chỉ để flush. +> ⚠️ **Harness note (F2 re-verified S100):** SendMessage khả dụng lại, NHƯNG flush-flow GIỮ NGUYÊN — agent đã tự update MEMORY khi return (BẮT BUỘC trong agent frontmatter) → em main đọc MEMORY on-disk để synthesize, KHÔNG cần re-spawn/SendMessage chỉ để flush. ## 📋 BƯỚC 0 — Show command body (visibility, no wait) @@ -48,9 +48,10 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph - **(c) chore-flag:** agent L1 >~30KB → archive L2 · error-ledger open-entry quá ngưỡng · **0-byte memory check (AS-8)** · **🌙 sleep-check (Harness-10b, S72):** `last_sleep_at` null hoặc ≥7d (`memory-budget.json`) → INFORM gợi-ý `/sleep-recovery-memory-l2` (KHÔNG auto-run) · **🗜️ Harness-11 A/D2 (S75):** chạy `powershell.exe -ExecutionPolicy Bypass -File scripts/memory-archive-gate.ps1` (DRY-RUN) → đề-xuất dồn-archive sub over-cap (A4 hysteresis 0.85 + A5 keep-floor 5 + A6 2-strike) + A7 NO-API L1-eval (pointer-resolve + byte-0-loss). Engine → [`docs/governance/harness-11-engine.md`](../../docs/governance/harness-11-engine.md). DRY-RUN báo kế-hoạch; MOVE thật do em-main (D5 AUTO semantic-null sau khi xem). · **📊 Hot-feed %-print CUỐI phiên (Harness-15-v2 §G.4, S82):** in composition Tầng-1 theo **%/4-bucket** SAU khi đã nạp/tăng trong phiên + **Headroom còn-trống** so cap role (`token_governor.tier1_hotfeed_tokens`). Đối-xứng `session-start §2.1.6` (đầu phiên). Mục-đích: anh thấy Tầng-1 phình/teo ra sao + còn trống bao nhiêu → quyết chỉnh cap. 🔴 con-số = quyền anh (chủ-dự-án); em-main chỉ báo-%, KHÔNG tự-chỉnh. · **🧪 MFE retention opt-in (Harness-16 §H):** lệnh kèm `eval` → chạy `scripts/mfe-eval.ps1` cuối-phiên (retention; chênh vs baseline §2.1.6 = rot trong-phiên) → quyết-định 2-ca: **thiếu-chỗ→TĂNG budget** (anh quyết) / **rot→SẮP-XẾP-LẠI** (ưu-tiên-giá-trị). READS budget, KHÔNG ghi/auto-tune. · **🔁 H17 loop-REFINE (§I, S95 — [`harness-11-engine.md §I`](../../docs/governance/harness-11-engine.md)):** lệnh kèm `eval` → chạy thêm `scripts/memory-selfimprove-audit.ps1` (spec-audit CRITERIA+GAP) → áp bảng B1 **tín-hiệu→hành-động**: floor-rot→**reinject-verbatim** (ghi [`reinject-ledger.md`](../governance/reinject-ledger.md) CG-1 ≤1/N=3; đo-lại vẫn thiếu→**escalate anh** KHÔNG tự-reinject-lần-2) · repeat≥2→promote · old+valueless→archive-gate · raw→distill (`/sleep-recovery-memory-l2`). Phân-loại B3 (build-gap vs floor-rot) TRƯỚC reinject. em-main single-writer D9; loop CHỈ đề-xuất (D6). Light→skip. - **(d) flush agent-memory** mỗi sub đã spawn session này — **spawn-record 4-field** `{agent · task · nấc(agreed/executed/verified) · evidence}`. (0 sub spawn → "n-a".) → **⬜ harvest-curator (H2) HỖ TRỢ:** spawn → propose spawn-record cho mọi sub đã chạy → em main single-writer VERIFY → APPEND (B3 no-overwrite-unverified). - **(e) pending-request audit:** request anh CHƯA-thực-thi đã log SPECIFICS chưa (KHÔNG placeholder). -- **(f) 🌾 harvest-integrity GATE (⬜ harvest-curator H2 — 5-trục, Harness 1+2):** verify spawn-record (d) đủ+đúng mọi sub TRƯỚC khi đóng — **Coverage** (0 silent-miss) · **Completeness** (đủ 4-field) · **Placement** (delta đúng `agent-memory/X`) · **Corruption** (moved-not-cut, no-mojibake/shell-baked) · **Fidelity-FLAG** (nghi bịa/on-behalf → escalate 🟥 reviewer, KHÔNG tự phán). + **🌊 close-gate C5 Layer3 (Harness-10, thay B5 wave-gom):** với MỌI `runs//` của session → **VERIFY per-turn harvest đã xong** (em-main đã viết `runs//-synthesis.md` phẳng h10-refine — run cũ S71: `harvest/*.md` — NGAY sau mỗi fan-out turn = C4 Layer1) + `_ledger.md` mọi run đã CLOSE-beat (closed≠⏳). 🔴 **IDEMPOTENT — close-gate chỉ VERIFY, KHÔNG re-APPEND** (per-turn đã APPEND rồi → re-APPEND = DUPLICATE-HARVEST). 5-trục GATE giữ làm **backstop**. GATE = run còn `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng — C8 dual-accept) HOẶC chưa đủ 5-trục thì CHƯA đóng. +- **(f) 🌾 harvest-integrity GATE (⬜ harvest-curator H2 — 5-trục, Harness 1+2):** verify spawn-record (d) đủ+đúng mọi sub TRƯỚC khi đóng — **Coverage** (0 silent-miss) · **Completeness** (đủ 4-field) · **Placement** (delta đúng `agent-memory/X`) · **Corruption** (moved-not-cut, no-mojibake/shell-baked) · **Fidelity-FLAG** (nghi bịa/on-behalf → escalate 🟥 reviewer, KHÔNG tự phán). + **🌊 close-gate C5 Layer3 (Harness-10, thay B5 wave-gom):** với MỌI `runs//` của session → **VERIFY per-turn harvest đã xong** (em-main đã viết `runs//-synthesis.md` phẳng h10-refine — run cũ S71: `harvest/*.md` — NGAY sau mỗi fan-out turn = C4 Layer1) + mọi `runs//` của session có `*-synthesis.md` present (folder-scan — 🧊 tiêu-chí ledger CLOSE-beat retired H18-B S100). 🔴 **IDEMPOTENT — close-gate chỉ VERIFY, KHÔNG re-APPEND** (per-turn đã APPEND rồi → re-APPEND = DUPLICATE-HARVEST). 5-trục GATE giữ làm **backstop**. GATE = run còn `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng — C8 dual-accept) HOẶC chưa đủ 5-trục thì CHƯA đóng. - **(g) 🔌 tooling-freshness CHỐT (🟫 tooling-auditor H1 — Harness 1):** spawn → chốt 4-mặt (skill·sub-role·plugin·docs) đổi gì session này + **new-alloc audit** (skill/plugin MỚI chưa phân-bổ → đề-xuất gán em main + sub phù-hợp vai) + flag doc-drift/roster-lệch/count-stale. Propose → em main APPEND/sửa doc (single-writer). 🔴 G-015: 2 monitor = propose-only, em main VERIFY trước APPEND (Bash residual → KHÔNG "read-only enforced"). - **(h) 🔏 User-Mark CHỐT cuối phiên (H-12/13 canonical §P/P7, S79 — `harness-11-engine.md §E`):** đọc [`.claude/governance/ACTIVE-MARKS.md`](../governance/ACTIVE-MARKS.md) → (i) **hiển-thị** status-filtered (Active-High/Active hiện · Medium tóm-tắt · Disable ẩn) cho anh đọc lại (đối-xứng `session-start §2.1.4`); (ii) nếu session này có **quyết-định cấp-governance MỚI** (scope-check P6: đổi CANONICAL §-rule/authority) → chạy `/user-mark-` DACI: adjust-gov → double-check → **report-trước-đóng-dấu 3-7 tiêu-chí khách-quan (P4)** → anh confirm → stamp `RC-pqhuy1987-dd-mm-yyyy-hh-mm-ss`; (iii) supersede/disable mark cũ (P5) → con-trỏ-xuôi + Active-High cần anh-confirm RIÊNG. 🔴 **KHÔNG tự đóng dấu / đổi cấp trước khi báo (P4/P8).** 0 quyết-định-mới → "n-a, chỉ hiển-thị". +- **(i) 🎯 H18-D(a) outcome spot-check (S100 — [`harness-11-engine.md §J`](../../docs/governance/harness-11-engine.md)):** session governance/review-heavy → chọn **3–5 artifact đã tự-động-qua-cổng** trước đó (cicd GO verdict · detector verdict · monitor verdict · adap-report claim) → **kiểm-lại TƯƠI bằng ground-truth** (tính lại giá-trị đối-chứng · mở định-nghĩa gốc xem claim có thật-cover · đối-chiếu nguyên-văn nguồn). Gấp vào review sẵn có (chi-phí ~0). Sàn-vai trượt-THẬT khỏi nhật-ký → reinject-on-real-miss qua [`reinject-ledger.md`](../governance/reinject-ledger.md) CG-1 (≤1 lần/N=3 phiên, vẫn trượt → escalate anh — REUSE H17 §I B2, KHÔNG sổ mới). Light/hỏi-đáp → skip. (Nấc honest: dogfood n=1 S100 = mẫu hiệu-chỉnh, CHƯA "proven" — caveat 1 broadcast H18.) ## Phase 2 — WRITE (update MD/RAG) @@ -60,7 +61,7 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph ### 2.2 Skill registry - Liệt kê 6 skill. Dùng skill khi task khớp (KHÔNG tự suy luận lại) -- Skill staleness audit chỉ chạy theo lịch định kỳ (cron 2026-06-01) +- Skill staleness audit chỉ chạy theo lịch định kỳ (cron monthly — lịch kế → `docs/STATUS.md`, B1) - Phân bổ skill mới phù hợp per agent (README matrix) ### 2.3 Memory entry mới @@ -109,7 +110,7 @@ Plan cha: [tên] ### 5.1 Release + commit - Kiểm tra release, commit task vừa hoàn thành. ⚠️ Update `SolutionErp.slnx` nếu có `.cs/.csproj` mới. -- Format: `[CLAUDE] : ` + `Co-Authored-By: Claude Opus 4.8 (1M context) ` +- Format: `[CLAUDE] : ` + `Co-Authored-By: ` (hiện = Claude Fable 5; đổi theo BƯỚC 0.6 session-start) - Scope: `Contract · PurchaseEvaluation · Budget · Form · Workflow · Supplier · Auth · Admin · Api · App · Domain · Infra · FE-Admin · FE-User · Tests · Docs · CICD · Scripts · Skill` ### 5.2 Push remote diff --git a/.claude/commands/session-start.md b/.claude/commands/session-start.md index cda052f..0e4ebfb 100644 --- a/.claude/commands/session-start.md +++ b/.claude/commands/session-start.md @@ -5,7 +5,7 @@ description: Bootstrap session SOLUTION_ERP — load context, audit state (11-ag # /session-start — Session bootstrap (READ + AUDIT + REPORT) > Trigger đầu session. Em main chủ trì, spawn sub-agent khi task match delegate criteria. -> ⚠️ **Harness note:** SendMessage KHÔNG khả dụng harness hiện tại → "reuse agent" = **fresh spawn** (MEMORY on-disk auto-inject giữ context). agentId chỉ valid trong-session. +> ⚠️ **Harness note (F2 re-verified S100):** SendMessage **KHẢ DỤNG lại** (deferred tool — load qua ToolSearch; resume agent đã spawn TRONG-session, context giữ). Cross-session vẫn = **fresh spawn** (MEMORY on-disk auto-inject giữ context). agentId chỉ valid trong-session. ## 📋 BƯỚC 0 — Show command body (visibility, no wait) @@ -59,7 +59,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = ** - 🟫 **tooling-auditor** (monitor H1, INFORM-only) — tooling/docs-freshness 4-mặt (skill·sub-role·plugin·docs) - ⬜ **harvest-curator** (monitor H2, INFORM-only) — harvest-integrity 5-trục (Coverage/Completeness/Fidelity/Placement/Corruption) - Task match delegate criteria (ACCEPT) → BẮT BUỘC delegate (xem `.claude/agents/README.md` decision tree) -- KHÔNG spawn mới khi con cũ rảnh → fresh spawn re-inject MEMORY (SendMessage N/A harness này) +- Con cũ rảnh TRONG-session → resume qua SendMessage (khả dụng lại — F2 S100) HOẶC fresh spawn re-inject MEMORY; cross-session luôn fresh spawn - Nạp full context project cho sub-agent spawn, giữ context sống đến cuối session - Em main solo CHỈ khi: schema/UX/architecture decision · cross-stack tight · bug reasoning chain · gotcha #53/#54/#55 fallback (truncate/529) @@ -68,7 +68,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = ** > Đầu session: 2 monitor sub BÁO LẠI trạng-thái + **diff vs session trước** (floor Harness 1 H1.2 + H2.2). INFORM-only — em main đọc + VERIFY→APPEND nếu có delta hợp-lệ (B3), KHÔNG sub tự sửa. - **🟫 tooling-auditor (H1):** spawn → báo tooling-state 4-mặt (skill · sub-role · plugin · docs) + **DIFF vs last-session** (THÊM/ĐỔI/XÓA/stale). Bắt drift doc-vs-thực-tế ngay đầu session (vd roster/count lệch, skill stale, plugin pending). -- **⬜ harvest-curator (H2):** spawn → báo **harvest-MD mới** (run-trace `runs//` — file `sub-*`/`*-synthesis.md` phẳng h10-refine / sub-agent / agent-team kể từ last) + **delta mồ-côi chưa-APPEND** + **scan `runs/*/` tìm OPEN-beat (ledger `_ledger.md` cột closed=⏳) mà `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng) = orphan run** (C5 Layer2 post-exec rescan — bù khi C4 per-turn miss hoặc session trước chết giữa run). Bắt 0-byte memory (gotcha #53) + delta chưa thu-hoạch. +- **⬜ harvest-curator (H2):** spawn → báo **harvest-MD mới** (run-trace `runs//` — file `sub-*`/`*-synthesis.md` phẳng h10-refine / sub-agent / agent-team kể từ last) + **delta mồ-côi chưa-APPEND** + **scan `runs/*/` tìm folder có `run.md` mà `*-synthesis.md` VẮNG/0-byte = orphan run** (🧊 tiêu-chí ledger-`⏳` retired H18-B S100; run cũ S71 dual-accept `harvest/-synthesis.md`) (C5 Layer2 post-exec rescan — bù khi C4 per-turn miss hoặc session trước chết giữa run). Bắt 0-byte memory (gotcha #53) + delta chưa thu-hoạch. - Cơ-chế = báo-lại-diff đầu session (FORM tự do trình bày). 2 monitor spawn parallel OK. **Light session / hỏi-đáp → có thể skip; bug/feature/multi-agent/wave session → nên chạy.** ### 2.1.2 Memory L2 budget-audit (Harness-9 — 2026-06-17) @@ -136,7 +136,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = ** - Kiểm tra RAG chủ trì + sub: prompts đã store + đánh dấu re-rank đầy đủ chưa ### 2.4 Audit cadence -- **Monthly (ngày 1):** skill + doc drift audit — cron `solution-erp-skill-audit-monthly`. Next: **2026-06-01**. +- **Monthly (ngày 1):** skill + doc drift audit — **thủ-công em-main session đầu-tháng** (🧊 ghost-wire cron gỡ S100, CronList=0 — frontier P2 honest-retire). Next → `docs/STATUS.md` Maintenance backlog (canonical — B1, KHÔNG hard-date ở đây). - KHÔNG tự chạy audit ngoài cadence, trừ khi user yêu cầu hoặc drift nghiêm trọng - Check trạng thái audit định kỳ (đã audit chưa? kết quả ra sao) @@ -147,7 +147,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = ** ### 2.6 Unit test check - `dotnet test SolutionErp.slnx --nologo --verbosity minimal` — verify count cho tính năng mới + bug fix gần đây. -- Baseline **130 PASS** (58 Domain + 72 Infra). Phase 9 UAT mode: test-after feature (skip per chunk per `feedback_uat_skip_verify`), test-before BẮT BUỘC cho bug fix + critical algo. test-specialist owns; coverage gap backlog xem STATUS. +- Baseline hiện tại → `docs/STATUS.md` Tests row (canonical — B1, KHÔNG hard-count ở đây; H1 F-class fix S100). Phase 9 UAT mode: test-after feature (skip per chunk per `feedback_uat_skip_verify`), test-before BẮT BUỘC cho bug fix + critical algo. test-specialist owns; coverage gap backlog xem STATUS. ### 2.7 Cross-agent synthesis (post-audit) [GENERIC — GIỮ NGUYÊN] - Audit MD/RAG của sub-agent đã spawn, synthesize cross-agent learnings diff --git a/.claude/workflows/README.md b/.claude/workflows/README.md index ad591fb..3d4ba20 100644 --- a/.claude/workflows/README.md +++ b/.claude/workflows/README.md @@ -17,7 +17,7 @@ Mỗi lần chạy workflow fan-out (RUN-TRACE mode) → **1 thư mục run** gi └── -synthesis.md ← gom/VERIFIED (suffix `-synthesis.md`) — EM MAIN ghi NGAY sau mỗi fan-out turn (C4 per-turn primary) ``` Phân biệt RAW (prefix `sub-`) vs VERIFIED (suffix `-synthesis.md`) bằng **TÊN file**, KHÔNG subfolder. **C8:** 5 run cũ S71 (`h10-invest`…`h910-curate`) giữ `sub-md/`+`harvest/` (đừng rewrite history); close-gate chấp nhận CẢ HAI dạng. -- `runs/_ledger.md` — sổ run **2-nhịp**: ghi **OPEN-beat** lúc mở run + **CLOSE-beat** (timestamp + verdict + harvest) lúc đóng. **Orphan** = OPEN mà không CLOSE → phải giải-quyết-cứng (điều tra + đóng tay hoặc đánh-dấu aborted). Chi-tiết `runs/README.md`. +- `runs/_ledger.md` — 🧊 **RETIRED H18-B S100** (sổ 2-nhịp nghỉ-hưu — đo bắt-thật: true-orphan-catch 0/15 lifetime + mode-A coverage 0/8 workflow từ S93; 15 row lịch-sử GIỮ NGUYÊN, đảo-ngược = gỡ marker). **Orphan-authority = folder-scan:** `runs//` có `run.md` mà `*-synthesis.md` VẮNG/0-byte. Chi-tiết `runs/README.md`. ## 2 MODE memory (anh 06-07, KHÔNG thay return-delta) @@ -31,7 +31,7 @@ Phân biệt RAW (prefix `sub-`) vs VERIFIED (suffix `-synthesis.md`) bằng **T > Mặc định DEFAULT. RUN-TRACE chỉ bật khi workflow dài/nhiều detail/cần dấu-vết (set `args.run = {name, dir}`). KHÔNG bắt mọi fan-out tạo run-folder. ## Quy trình RUN-TRACE (B1–B6) -1. **B3 SCAFFOLD TRƯỚC (em main @P1):** tạo `runs//` + `run.md` (FLAT — KHÔNG cần `sub-md/`/`harvest/` subfolder hay `.gitkeep`; file `sub-*`/`*-synthesis.md` sinh phẳng cùng cấp khi fan-out chạy), **và ghi OPEN-beat vào `runs/_ledger.md`**. ⚠️ `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder; **em main Write @P1** TRƯỚC khi invoke Workflow. (Đây là fragile-point — quên scaffold = run mất dấu-vết âm-thầm; xem `runs/README.md` §C7.) +1. **B3 SCAFFOLD TRƯỚC (em main @P1):** tạo `runs//` + `run.md` (FLAT — KHÔNG cần `sub-md/`/`harvest/` subfolder hay `.gitkeep`; file `sub-*`/`*-synthesis.md` sinh phẳng cùng cấp khi fan-out chạy). *(🧊 bước "ghi OPEN-beat vào `runs/_ledger.md`" retired H18-B S100 — orphan-authority = folder-scan.)* ⚠️ `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder; **em main Write @P1** TRƯỚC khi invoke Workflow. (Đây là fragile-point — quên scaffold = run mất dấu-vết âm-thầm; xem `runs/README.md` §C7.) 2. **B1 spawn-from-real-sub:** mỗi task `role ∈ VALID_ROLES` (9 sub) → workflow-agent = sub THẬT (`agentType` inherit memory-pack slice + skill identity), KHÔNG agent vô-danh. 3. **B4 phân-quyền TOOL-AWARE:** `hmw.js` inject vào prompt mỗi sub đường-dẫn `runs//sub--.md` (phẳng) + lệnh ghi ĐÚNG file đó. - **Write sub (CÓ Write/Edit):** implementer-backend · implementer-frontend · test-specialist · frontend-designer → ghi-direct sub-MD via Write/Edit. diff --git a/.claude/workflows/runs/README.md b/.claude/workflows/runs/README.md index 364b3b5..6ee761e 100644 --- a/.claude/workflows/runs/README.md +++ b/.claude/workflows/runs/README.md @@ -1,6 +1,6 @@ # `runs/` — Run-trace convention (Harness-10 · cấu trúc **PHẲNG**) -> **Mục đích:** mỗi workflow fan-out (RUN-TRACE mode) ghi lại 1 dấu-vết hoàn-chỉnh trong `runs//` git **TRACKED** — plan + per-sub detail + bản-gom — cộng sổ `_ledger.md` 2-nhịp. TRACKED nghĩa là mọi write trong run-folder hiện trong `git diff` → **audit trực-tiếp**, không cần tin lời agent return. Adopt AI_INFRA Harness-10 (anh 06-18) + DELTA `h10-flat-detector-refine` (06-18). Convention cha: `../README.md`. +> **Mục đích:** mỗi workflow fan-out (RUN-TRACE mode) ghi lại 1 dấu-vết hoàn-chỉnh trong `runs//` git **TRACKED** — plan + per-sub detail + bản-gom. (🧊 sổ `_ledger.md` 2-nhịp **RETIRED H18-B S100** — đo bắt-thật 0/15 lifetime + mode-A coverage 0/8; orphan-authority = folder-scan L1/L2 dưới.) TRACKED nghĩa là mọi write trong run-folder hiện trong `git diff` → **audit trực-tiếp**, không cần tin lời agent return. Adopt AI_INFRA Harness-10 (anh 06-18) + DELTA `h10-flat-detector-refine` (06-18). Convention cha: `../README.md`. > > 🆕 **REFINE 06-18 — cấu trúc PHẲNG.** Trước đây mỗi run-folder có **2 thư mục con** (`sub-md/` + `harvest/`). NAY mọi vết tích nằm **phẳng cùng MỘT cấp** trong `runs//`; phân biệt **bản-thô (raw, per-sub)** vs **bản-đã-soát (verified, gom)** bằng **TÊN file**, KHÔNG bằng thư mục con. Lý do: engine (`hmw.js` JS-sandbox no-fs) chỉ tạo artifact ở **một cấp** một cách tự nhiên — bỏ thư-mục-con sâu thì xoá luôn **một điểm-hay-quên** ngay tại gốc (không còn thư-mục-con-để-quên-dựng). @@ -35,7 +35,7 @@ runs// ## C2 — Scaffold `run.md` ở OPEN (em main @P1, TRƯỚC khi invoke Workflow) `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder/file. Em main PHẢI Write @P1: 1. **Tạo run-folder + PLAN:** `runs//run.md` (điền plan đầy-đủ). 🆕 **KHÔNG cần `mkdir sub-md/` / `harvest/` / `.gitkeep`** — file `sub-*` và `*-synthesis.md` sẽ sinh ra **phẳng cùng cấp** trong cùng folder đó (engine + em main ghi 1 cấp). -2. **Ghi OPEN-beat** vào `runs/_ledger.md` (1 dòng, `closed=⏳`). +2. ~~Ghi OPEN-beat vào `runs/_ledger.md`~~ — 🧊 **retired H18-B S100** (KHÔNG ghi beat mới; ledger frozen giữ lịch-sử. Orphan-authority = folder-scan L1/L2). 3. **(nối stage)** trỏ `input spec:` trong `run.md` sang `-synthesis.md` của run trước (vd implement đọc `invest-synthesis.md`). > 🔴 **C2 là fragile-point.** Quên scaffold = run chạy nhưng KHÔNG có dấu-vết = **lỗ-hổng âm-thầm** (không lỗi, không cảnh-báo — chỉ thiếu file). 3-layer (C5) là lưới giảm-thiểu, KHÔNG khoá-cứng. Xem C7. 🆕 Cấu trúc phẳng bỏ **1 trong 2** điểm-hay-quên (không còn subfolder-to-forget); dư-lượng còn lại = **vẫn phải tự ghi `-synthesis.md` mỗi run** (close-gate C5/L3 bắt nếu thiếu). @@ -68,15 +68,15 @@ Gom là **việc của turn**, không defer. Sau MỖI fan-out turn → em main ## C5 — 3-layer anti-miss (lưới chống bỏ-sót — KHÔNG khoá-cứng-cùng-lúc-fire) | Layer | Khi | Làm gì | |---|---|---| -| **L1 in-run ledger-check** | em-main @P1, lúc mở run mới (TRƯỚC scaffold) | đọc `_ledger.md`: nếu run TRƯỚC còn `closed=⏳` (OPEN-beat chưa CLOSE / thiếu `-synthesis.md`) → gom + CLOSE nó TRƯỚC khi mở run mới. *(Engine no-fs → KHÔNG đọc được ledger → L1 là convention **EM-MAIN**, KHÔNG phải `hmw.js` prompt. hmw.js chỉ emit C4 per-turn return-instruction cho sub tại writeGuard.)* | -| **L2 session-start orphan-scan** | đầu session (`session-start.md` §2.1.1 H2) | scan `runs/*/` tìm **orphan = OPEN-beat (ledger `closed=⏳`) mà KHÔNG có `-synthesis.md`** → báo + giải-quyết (C6). | +| **L1 in-run folder-check** (🧊 ledger-check retired H18-B S100) | em-main @P1, lúc mở run mới (TRƯỚC scaffold) | scan `runs/*/`: nếu run TRƯỚC còn folder có `run.md` mà **thiếu `-synthesis.md`** (hoặc synthesis 0-byte) → gom + đóng nó TRƯỚC khi mở run mới. *(L1 là convention **EM-MAIN**, KHÔNG phải `hmw.js` prompt. hmw.js chỉ emit C4 per-turn return-instruction cho sub tại writeGuard.)* | +| **L2 session-start orphan-scan** | đầu session (`session-start.md` §2.1.1 H2) | scan `runs/*/` tìm **orphan = folder có `run.md` mà KHÔNG có `-synthesis.md` (hoặc synthesis 0-byte)** → báo + giải-quyết. (🧊 tiêu-chí ledger-`⏳` retired H18-B S100; run cũ S71 dual-accept `harvest/-synthesis.md`.) | | **L3 session-end close-gate** | cuối session (`session-end.md` §L.b(f) H2) | VERIFY per-turn gom đã xong cho mọi `runs//` (**idempotent — KHÔNG re-APPEND**, chống DUPLICATE-HARVEST) + 5-trục GATE backstop trước khi commit. 🆕 close-gate **chấp nhận CẢ 2 dạng** (old-subfolder + new-flat) trong giai-đoạn chuyển — xem C8. | > 3 layer **độc-lập, fire ở 3 thời-điểm khác nhau** (run-open @P1 / session-start / session-end) — **KHÔNG layer nào do engine enforce** (hmw.js no-fs), cả 3 là convention em-main/H2. → giảm xác-suất sót, KHÔNG triệt-tiêu. Sót ở P1 (C2) cùng blind-spot với L1 (đều @P1) → chỉ bắt MUỘN ở L2 (session sau) / L3 (close-gate). --- -## C6 — Ledger 2-nhịp + orphan resolution (`_ledger.md`) +## C6 — Ledger 2-nhịp + orphan resolution (`_ledger.md`) — 🧊 **RETIRED H18-B S100** (nguyên-văn dưới GIỮ làm lịch-sử — dời-đi không xoá; orphan-authority = folder-scan C5 L1/L2; đảo-ngược = gỡ marker này + marker `_ledger.md` header + restore mandate C2-step-2) Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**: - **OPEN-beat** (@P1, lúc scaffold): thêm dòng `| | | | ⏳ | | ⏳ | -synthesis.md |`. - **CLOSE-beat** (lúc đóng run): điền `closed` timestamp + `verdict` (PASS/FAIL + 1 dòng + `wf_…`) + `harvest` (path file synthesis ✓). @@ -114,7 +114,7 @@ Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**: --- -## Containment model (PHẢI khớp `_ledger.md` + `../hmw.js` — đồng-bộ 3 chỗ: đây · `_ledger.md` · `../hmw.js`) +## Containment model (PHẢI khớp `../hmw.js` — đồng-bộ 2 chỗ: đây · `../hmw.js`; 🧊 chỗ thứ-3 `_ledger.md` retired H18-B S100, header nó giữ bản frozen) > Run-folder `runs//` được git **TRACKED** → mọi write **HIỆN** trong git-diff = **audit trực-tiếp**. Containment: tracked-change **NGOÀI** `runs//` **VÀ NGOÀI** code-disjoint đã giao = **vi-phạm** (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ Bash (write-channel mở), containment THẬT = em-main single-writer + git-diff(in-repo) + chunk-count(RAG). --- @@ -124,7 +124,7 @@ Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**: **Lý-do tailored-out:** - **SE chạy workflow qua Anthropic Workflow tool (`hmw.js` invoke), KHÔNG có bề-mặt-lách kiểu CLI-launcher.** AI_INFRA threat-model giả-định một node-CLI launcher (đường-vòng chạy lén engine) cần bộ-dò canh. SE **không có launcher như vậy** → không có "đường-vòng" để dò. -- **Containment SE đã đủ bằng cơ-chế khác (G-015 defense-in-depth):** `git diff` commit-gate (mọi write tracked HIỆN trong diff) + run-folder git-tracked (audit trực-tiếp) + `_ledger.md` orphan-scan (L2/L3) — backstop THẬT (không phải prompt). Bộ-dò pattern-match thêm = trùng-lặp, không bịt lỗ mới. +- **Containment SE đã đủ bằng cơ-chế khác (G-015 defense-in-depth):** `git diff` commit-gate (mọi write tracked HIỆN trong diff) + run-folder git-tracked (audit trực-tiếp) + folder-scan orphan L1/L2 (🧊 ledger-scan retired H18-B S100) — backstop THẬT (không phải prompt). Bộ-dò pattern-match thêm = trùng-lặp, không bịt lỗ mới. **3 chức-năng refine — CÂN-NHẮC rồi N/A cho SE:** diff --git a/.claude/workflows/runs/_ledger.md b/.claude/workflows/runs/_ledger.md index abe36d6..49d2672 100644 --- a/.claude/workflows/runs/_ledger.md +++ b/.claude/workflows/runs/_ledger.md @@ -1,5 +1,7 @@ # Workflow Run Ledger — SOLUTION_ERP (Harness-10) +> 🧊 **RETIRED (H18-B, S100 2026-07-02):** two-beat orphan-detection NGHỈ-HƯU — đo bắt-thật: ledger true-orphan-catch = **0/15 row lifetime** (đều open+close cùng-ngày 06-18, `⏳` chỉ ở legend) + mode-A ephemeral (default S93+) → coverage workflow gần đây = **0/8**. **Orphan-authority = H2 FOLDER-SCAN:** `runs//` có `run.md` mà `*-synthesis.md` VẮNG/0-byte (run cũ S71 dual-accept `harvest/`). *Caveat-3 parity (honest): run-folder-orphan chưa từng xảy ra ở CẢ 2 cơ chế (0 data 2 phía) — căn cứ retire = coverage-cấu-trúc + chi-phí duy-trì, KHÔNG phải catch-rate hơn.* 15 row lịch-sử GIỮ NGUYÊN dưới. **Đảo-ngược = gỡ dòng này + restore 6 mandate-consumer** (list → `docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md`). KHÔNG ghi beat mới. + > **Two-beat (C6):** ghi nhịp **OPEN** lúc mở run + nhịp **CLOSE** lúc đóng run. **Orphan** = OPEN mà không CLOSE → phải giải-quyết-cứng (điều tra + đóng tay hoặc đánh dấu aborted). > **Tracked (C3):** thư mục `runs//` được git theo dõi (KHÔNG gitignore). Containment chuyển sang model **"tracked-change NGOÀI run-folder (+ code-disjoint đã giao) = vi phạm"** (thay model Harness-2 B6 "mọi tracked-change = vi phạm"). > Cột `closed=⏳` = đang chạy (OPEN-beat). Điền timestamp + verdict khi đóng (CLOSE-beat). diff --git a/CLAUDE.md b/CLAUDE.md index ff4b9e9..2ad1e2a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -108,7 +108,7 @@ dotnet test SolutionErp.slnx # chạy cả 2 test project | `form-engine` — render docx/xlsx + PDF | `ef-core-migration` — EF migration + 3-file rule | | `permission-matrix` — role × menu × CRUD | `iis-deploy-runbook` — 3 site IIS + win-acme + runner | -**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`. Cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1. Lần kế: **2026-08-01** (S96 đã chạy 07-01). +**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`, **em-main chạy thủ-công session đầu-tháng** (🧊 ghost-wire cron gỡ S100 H18 — CronList runtime = 0 job). Lần kế: **2026-08-01** (S96 đã chạy 07-01). Quy tắc: - KHÔNG bulk-clone repo skill 3rd party. Chỉ thêm skill PROJECT-SPECIFIC. Xem `docs/rules.md §9` đầy đủ. diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index e7c2dc8..45d9a58 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -2,7 +2,7 @@ > **Tiering rule (S40):** giữ **2-3 session gần nhất**. Cũ hơn → `docs/changelog/sessions/`. Full brief history pre-S40 → `docs/_archive/HANDOFF-preS40-fullhistory.md`. -**Last updated:** 2026-07-02 (S98 — **Harness backlog batch ĐÓNG** — docs/memory-only, 2 commit `4263d63`+`8a249c5` CI-skip: Fable-restore gỡ caveat H5.6 (spawn-test ×2 self-report `claude-fable-5`, H8 runtime-verified) · monthly→2026-08-01 · skill ef-core +Mig 60/61 · re-tier S93/S94→archive-S98 · 3 orphan-append H2 + cicd L1 curate + sleep-compress implementer-frontend · email AI_INFRA. State: Mig 61·89 bảng·440 test·gotcha 79. **🔴 NEXT anh (carry S97):** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar" [fix 1-3 S97] + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu". **NEXT em:** patch session-start.md F2 SendMessage-note @session-end + monthly count-grep mở rộng `commands/*.md` (H1 P3/P4). *(Flip hồi-tố @S99-start — H1 F1.)*) · **Prev S97** (S97 — **PE finalize 4-fix UAT anh Kiệt FDC buổi live — em-main-led, prod-verified Run #481+#482.** **(1)** badge `"không trình tới"`→**`"Kết thúc tại {finalizeLevelName}"`** (hiện "Kết thúc tại CCM")+tooltip. **(2)** đảo default checkbox "Cấp KẾT THÚC" **opt-out→opt-in** (`useState true→false`+reset+helper reword+comment-drift fix). Mirror 2-app SHA `bcf812fd`, 0 BE/mig/test (BE tôn trọng cờ FE; param default=fallback). Workflow `wf_0e01fdba-209` (reviewer PASS 0-issue). Commit `1c8fb6a`. **cicd #481 PASS byte-level #77:** JS admin `COYAX-yQ`→**`Cf0o8dx8`**/user `0MU-kb4N`→**`x8rppRAK`** · NEW `Kết thúc tại`+helper PRESENT / OLD `không trình tới`+`Đã BỎ tick` ABSENT · Mig 59/88 frozen · smoke 200×3. **Lesson:** #53 return-garble **lần-4** (cicd trả memory-curation thay verdict → recover-from-diary NO re-spawn) · BE-honors-explicit-flag → đảo-default chỉ-FE zero-BE-churn. **(3) endsBeforeCeo config→RUNTIME (Mig 60 `EndedByLevelFinalize` `8037fa0` #482 cross-stack):** phiếu opt-out finalize→lên CEO nhưng sơ đồ báo sai "không qua CEO" (endsBeforeCeo suy config). Fix field runtime set-nhánh-finalize → DaDuyet đọc runtime; 4 projection + FE gate + backfill; test 440 (repro peFinButWentCeo) + reviewer PASS 0-issue + cicd #482 **bug fixed LIVE** (PE-detail endsBeforeCeo=False). gotcha #78. **(4) badge "✅ Đã được CEO duyệt" (`9e12e80` #483 FE-only):** phiếu DaDuyet+`!endsBeforeCeo`→PeFinalizeChip badge (đối xứng fix-3, tận-dụng cờ runtime, 0 BE/mig, mirror 2-app+6 site, byte-#77 PRESENT). **(5) Mig 61 backfill fix (`fb2dfa9` #484 data-fix):** check A/005 "CEO duyệt chưa" → A/005/A/008 finalize-CCM KHÔNG qua CEO nhưng badge sai (Mig 60 backfill nhầm bảng Approvals→Changelogs). Mig 61 đúng bảng → prod A/005/A/008 flag 0→1 endsBeforeCeo-True (cicd #484), A/010 control. gotcha #79. **State: Mig 61·89 bảng·440 test·gotcha 79·menu 54·bundle admin `mEGqlNWc`/user `Dnrp4PU1` (Run #484 data-fix, #69-rebuild rotate — `CeTA7Z82`/`CGaAyXen` = #483)·prod 21 NCC/17 user.** **🔴 NEXT anh:** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar": (a) sơ đồ hết "không qua CEO" + Bước 3 CEO KHÔNG mờ [fix-3], (b) badge+checkbox [fix 1-2] (+ vụ cũ "lỗi phân quyền": số-phiếu+user). **🔴 NEXT em:** monthly re-tier mega-line (giờ 5-blurb). → log `2026-07-01-S97-pe-finalize-wording-default-flip.md`) · **Prev S96** (S96 — **buổi UAT LỚN anh Kiệt/chị Trà/anh Chương live + monthly-audit, em-main-led, 5 commit prod-verified.** **(1)** Monthly drift audit `881783c` (docs-only CI-skip): ef-core SKILL Mig→59 + rows 57/58/59 · skills/README + docs/CLAUDE Budget-removed · **`vocab-alias-map.md` MỚI** (3 fork + `$ExcludeExact`) · **re-tier mega-line 5→3** (S92/S91→archive, conservation delta=0 BOM) + hoist UAT-carry→blockers · **FD distill** (H17 strike-1 CLEARED L1 26129→21492B + archive/`_INDEX`/gist + Lessons L1). Workflow `wf_2d687d27` 4-cluster (reviewer bắt #74-drift + AS-10 residual reverted). detector 27→25. **(2)** Import NCC **DONGDUONG** `ba4b8e0` (Excel anh Kiệt; 3 NCC đã sẵn → +1 no-mig prod 21 NCC Run #477); backlog 15-18 field→Next-up. **(3-5)** 3 PE bug-fix UAT: `e657faa` ô "KẾT THÚC quy trình" (S89-auto)→**opt-out bỏ-tick-được** (2-tier grant/exercise +`applyLevelFinalize`, #478) · `36cbf8b` **chuông tự-sạch** noti "cần duyệt" (mark-read ExecuteUpdate BE-only, #479) · `0c2f9f6` **khóa sửa giá PRO/CCM sau gửi-duyệt** ("duyệt là fix" non-admin Nháp/TraLai+Admin-override, +4 test, #480). Test 434→440. **Delete-sau-duyệt = ĐÃ chặn sẵn**. Checkbox "ko-được" = **browser-cache** (verify byte-level prod `0MU-kb4N` chứa fix; incognito golden). **State: Mig 59 · 88 bảng · 440 test (45D+395I) · gotcha 77 · menu 54 · bundle admin `COYAX-yQ`/user `0MU-kb4N` · prod 21 NCC/17 user.** **🔴 NEXT anh:** ⚠️ restart CLI · UAT **incognito** checkbox + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu". **🔴 NEXT em:** cicd S-tag-drift S97/S98→S96 reconcile (closeout) · monthly re-tier mega-line (giờ 4-blurb). **Lessons:** verify-deployed-artifact-byte-level (cache≠deploy; incognito golden — gotcha #77) · #53-return-garble ×3 recover-from-agent-memory (instruction-fix "return-verdict" ăn) · 2-tier-permission · spec-change→update-test. → log `2026-07-01-S96-uat-pe-fixes-monthly-audit.md`) · **Prev S95** (S95 — **Harness-17 adopt (Vòng tự-cải-thiện bộ-nhớ Đo→Tinh-chỉnh→Kiểm) — governance-only 0 prod code, em-main-led 3-workflow.** `/check-email AI_INFRA` (0 directed mới; H16 áp trọn S93) → `/adap-apply` H17 (2 broadcast hash-MATCH `reviewer_gate:PASS`). **10/10 mục 🔴:** REUSE-cite A2=§H MFE/C3=D9/CG-2=value_protect/archive=§A + **build mới** `scripts/memory-selfimprove-audit.ps1` (C1 spec-audit NO-API, **runtime-verified bắt frontend-designer over-cap thật**) + `.claude/governance/reinject-ledger.md` (B2 CG-1 N=3) + engine §I + `session-start §2.1.7`/`session-end §L.b(c)` wire + HCV alias no-seed. **3-workflow:** WF1 `wf_f085d7c4-d78` ground-truth + WF2 `wf_8e73c1d6-ee6` 3-lane PASS + WF3 `wf_6f44eddf-680` **fault-injection 13-inject teeth-proof** + integration + cross-doc (0 application-defect). **2 commit:** `18a17f5` (cicd **Run #476 PASS** prod 200×3 bundle `0T6vVJST`/`BGXEVZO6` Mig 59) + `65b434a` (docs-only CI-skip). adap-report + 2 email AI_INFRA (`54789e19`+`8c94fa34`). **Dogfood AS-10 4-fire reverted** (git-diff = net thật; **WF3 explicit-return-only STILL self-wrote → instruction-fix NOT 100%**, E-006 recurrence, guard HELD 4/4; cicd-monitor diary KEPT = legit normal-spawn). **Lessons:** fault-injection-`-RepoRoot`-temp chứng checker-teeth · Lane B #53 empty→em-main self-gate. **State: Mig 59 · 88 bảng · 434 test · gotcha 76 · menu 54 · prod 17 user/7 NCC.** **🔴 NEXT anh:** ⚠️ restart CLI (§2.1.7 + §L.b(c) H17-loop wire runtime — command `.md` no hot-reload). **🔴 NEXT em:** frontend-designer distill (WATCH strike-1 = H17 loop's live finding, chờ strike-2/anh) · monthly **2026-07-01 (hôm nay)** re-tier STATUS/HANDOFF mega-line + ef-core SKILL Mig→59 + docs/CLAUDE Budget-removed + 3 vocab-fork alias-map. **Pending product (carry):** Section B cột Dự-án · Ngưỡng CEO Mig 54 · "C" chuyển phiếu→dự án. → log `2026-07-01-S95-harness17-adopt.md`) · *(S93-S94 blurb đã tách → `docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md`, re-tier S98; session ≤S90 → `docs/_archive/STATUS-HANDOFF-tier-S94-2026-06-29.md` + `docs/changelog/sessions/`, re-tier S94)* +**Last updated:** 2026-07-02 (S100 — **Harness-18 adopt + frontier HELD-integrity — governance/scripts-only, em-main-led + WF1 `wf_50a817ce-a69` / WF2 `wf_31ea3985-92c` (IN-FLIGHT lúc đóng).** Hash: H18+checklist MATCH ✓ / **frontier MISMATCH → HELD** (không codify, đề nghị re-stamp) + cả 3 thiếu `reviewer_gate` field → flag AI_INFRA. Adopt: **J.A detector v2** (ratio-band mismatch-only + glob commands/skills, fault-inject 4/4, MED 11→0) · **J.B retire `_ledger.md`** (0/15 lifetime + mode-A 0/8, freeze 🧊 reversible, sweep 15 điểm/8 file, orphan = folder-scan) · **J.C** 2/3 n-a-by-H8 + revisit viết ra · **J.D** spot-check wired §L.b(i) + REUSE CG-1. Frontier self-audit: **cron monthly = ghost-wire THẬT (CronList=0) → honest-retire 5 file** (audit thủ-công em-main, vẫn đúng hạn) · 3 script đo GLOB-LIVE · defer D-1/D-2 backlog. Hygiene: F2 SendMessage patch (KHẢ DỤNG lại, runtime-verified) + B1-pointer 130/cron-date + trailer Fable. Checklist **10/12 ĐẠT + 2 n-a-reasoned**. 3 adap-report committed. Test 440 ✓ đầu phiên + 2 monitor ALL-PASS/CLEAN (`513aa09`). **🔴 NEXT em (#1 việc đầu session kế):** đọc WF2 (`w4xb4vlm2`) → fix theo verdict → điền run-id §J + report H18 → harvest reviewer → **`/send-email AI_INFRA`** (2 flag trên) → cicd-verify Run mới (push S100 có `scripts/*.ps1` → CI CHẠY, không skip). **🔴 NEXT anh (carry S97):** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar" [fix 1-3 S97] + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu". ⚠️ **restart CLI** (session-start/end + agents .md đổi — no hot-reload). → log `2026-07-02-S100-harness-18-adopt.md`) · **Prev S98** (S98 — **Harness backlog batch ĐÓNG** — docs/memory-only, 2 commit `4263d63`+`8a249c5` CI-skip: Fable-restore gỡ caveat H5.6 (spawn-test ×2 self-report `claude-fable-5`, H8 runtime-verified) · monthly→2026-08-01 · skill ef-core +Mig 60/61 · re-tier S93/S94→archive-S98 · 3 orphan-append H2 + cicd L1 curate + sleep-compress implementer-frontend · email AI_INFRA. State: Mig 61·89 bảng·440 test·gotcha 79. **🔴 NEXT anh (carry S97):** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar" [fix 1-3 S97] + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu". **NEXT em:** patch session-start.md F2 SendMessage-note @session-end + monthly count-grep mở rộng `commands/*.md` (H1 P3/P4). *(Flip hồi-tố @S99-start — H1 F1.)*) · **Prev S97** (S97 — **PE finalize 4-fix UAT anh Kiệt FDC buổi live — em-main-led, prod-verified Run #481+#482.** **(1)** badge `"không trình tới"`→**`"Kết thúc tại {finalizeLevelName}"`** (hiện "Kết thúc tại CCM")+tooltip. **(2)** đảo default checkbox "Cấp KẾT THÚC" **opt-out→opt-in** (`useState true→false`+reset+helper reword+comment-drift fix). Mirror 2-app SHA `bcf812fd`, 0 BE/mig/test (BE tôn trọng cờ FE; param default=fallback). Workflow `wf_0e01fdba-209` (reviewer PASS 0-issue). Commit `1c8fb6a`. **cicd #481 PASS byte-level #77:** JS admin `COYAX-yQ`→**`Cf0o8dx8`**/user `0MU-kb4N`→**`x8rppRAK`** · NEW `Kết thúc tại`+helper PRESENT / OLD `không trình tới`+`Đã BỎ tick` ABSENT · Mig 59/88 frozen · smoke 200×3. **Lesson:** #53 return-garble **lần-4** (cicd trả memory-curation thay verdict → recover-from-diary NO re-spawn) · BE-honors-explicit-flag → đảo-default chỉ-FE zero-BE-churn. **(3) endsBeforeCeo config→RUNTIME (Mig 60 `EndedByLevelFinalize` `8037fa0` #482 cross-stack):** phiếu opt-out finalize→lên CEO nhưng sơ đồ báo sai "không qua CEO" (endsBeforeCeo suy config). Fix field runtime set-nhánh-finalize → DaDuyet đọc runtime; 4 projection + FE gate + backfill; test 440 (repro peFinButWentCeo) + reviewer PASS 0-issue + cicd #482 **bug fixed LIVE** (PE-detail endsBeforeCeo=False). gotcha #78. **(4) badge "✅ Đã được CEO duyệt" (`9e12e80` #483 FE-only):** phiếu DaDuyet+`!endsBeforeCeo`→PeFinalizeChip badge (đối xứng fix-3, tận-dụng cờ runtime, 0 BE/mig, mirror 2-app+6 site, byte-#77 PRESENT). **(5) Mig 61 backfill fix (`fb2dfa9` #484 data-fix):** check A/005 "CEO duyệt chưa" → A/005/A/008 finalize-CCM KHÔNG qua CEO nhưng badge sai (Mig 60 backfill nhầm bảng Approvals→Changelogs). Mig 61 đúng bảng → prod A/005/A/008 flag 0→1 endsBeforeCeo-True (cicd #484), A/010 control. gotcha #79. **State: Mig 61·89 bảng·440 test·gotcha 79·menu 54·bundle admin `mEGqlNWc`/user `Dnrp4PU1` (Run #484 data-fix, #69-rebuild rotate — `CeTA7Z82`/`CGaAyXen` = #483)·prod 21 NCC/17 user.** **🔴 NEXT anh:** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar": (a) sơ đồ hết "không qua CEO" + Bước 3 CEO KHÔNG mờ [fix-3], (b) badge+checkbox [fix 1-2] (+ vụ cũ "lỗi phân quyền": số-phiếu+user). **🔴 NEXT em:** monthly re-tier mega-line (giờ 5-blurb). → log `2026-07-01-S97-pe-finalize-wording-default-flip.md`) · **Prev S96** (S96 — **buổi UAT LỚN anh Kiệt/chị Trà/anh Chương live + monthly-audit, em-main-led, 5 commit prod-verified.** **(1)** Monthly drift audit `881783c` (docs-only CI-skip): ef-core SKILL Mig→59 + rows 57/58/59 · skills/README + docs/CLAUDE Budget-removed · **`vocab-alias-map.md` MỚI** (3 fork + `$ExcludeExact`) · **re-tier mega-line 5→3** (S92/S91→archive, conservation delta=0 BOM) + hoist UAT-carry→blockers · **FD distill** (H17 strike-1 CLEARED L1 26129→21492B + archive/`_INDEX`/gist + Lessons L1). Workflow `wf_2d687d27` 4-cluster (reviewer bắt #74-drift + AS-10 residual reverted). detector 27→25. **(2)** Import NCC **DONGDUONG** `ba4b8e0` (Excel anh Kiệt; 3 NCC đã sẵn → +1 no-mig prod 21 NCC Run #477); backlog 15-18 field→Next-up. **(3-5)** 3 PE bug-fix UAT: `e657faa` ô "KẾT THÚC quy trình" (S89-auto)→**opt-out bỏ-tick-được** (2-tier grant/exercise +`applyLevelFinalize`, #478) · `36cbf8b` **chuông tự-sạch** noti "cần duyệt" (mark-read ExecuteUpdate BE-only, #479) · `0c2f9f6` **khóa sửa giá PRO/CCM sau gửi-duyệt** ("duyệt là fix" non-admin Nháp/TraLai+Admin-override, +4 test, #480). Test 434→440. **Delete-sau-duyệt = ĐÃ chặn sẵn**. Checkbox "ko-được" = **browser-cache** (verify byte-level prod `0MU-kb4N` chứa fix; incognito golden). **State: Mig 59 · 88 bảng · 440 test (45D+395I) · gotcha 77 · menu 54 · bundle admin `COYAX-yQ`/user `0MU-kb4N` · prod 21 NCC/17 user.** **🔴 NEXT anh:** ⚠️ restart CLI · UAT **incognito** checkbox + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu". **🔴 NEXT em:** cicd S-tag-drift S97/S98→S96 reconcile (closeout) · monthly re-tier mega-line (giờ 4-blurb). **Lessons:** verify-deployed-artifact-byte-level (cache≠deploy; incognito golden — gotcha #77) · #53-return-garble ×3 recover-from-agent-memory (instruction-fix "return-verdict" ăn) · 2-tier-permission · spec-change→update-test. → log `2026-07-01-S96-uat-pe-fixes-monthly-audit.md`) · **Prev S95** (S95 — **Harness-17 adopt (Vòng tự-cải-thiện bộ-nhớ Đo→Tinh-chỉnh→Kiểm) — governance-only 0 prod code, em-main-led 3-workflow.** `/check-email AI_INFRA` (0 directed mới; H16 áp trọn S93) → `/adap-apply` H17 (2 broadcast hash-MATCH `reviewer_gate:PASS`). **10/10 mục 🔴:** REUSE-cite A2=§H MFE/C3=D9/CG-2=value_protect/archive=§A + **build mới** `scripts/memory-selfimprove-audit.ps1` (C1 spec-audit NO-API, **runtime-verified bắt frontend-designer over-cap thật**) + `.claude/governance/reinject-ledger.md` (B2 CG-1 N=3) + engine §I + `session-start §2.1.7`/`session-end §L.b(c)` wire + HCV alias no-seed. **3-workflow:** WF1 `wf_f085d7c4-d78` ground-truth + WF2 `wf_8e73c1d6-ee6` 3-lane PASS + WF3 `wf_6f44eddf-680` **fault-injection 13-inject teeth-proof** + integration + cross-doc (0 application-defect). **2 commit:** `18a17f5` (cicd **Run #476 PASS** prod 200×3 bundle `0T6vVJST`/`BGXEVZO6` Mig 59) + `65b434a` (docs-only CI-skip). adap-report + 2 email AI_INFRA (`54789e19`+`8c94fa34`). **Dogfood AS-10 4-fire reverted** (git-diff = net thật; **WF3 explicit-return-only STILL self-wrote → instruction-fix NOT 100%**, E-006 recurrence, guard HELD 4/4; cicd-monitor diary KEPT = legit normal-spawn). **Lessons:** fault-injection-`-RepoRoot`-temp chứng checker-teeth · Lane B #53 empty→em-main self-gate. **State: Mig 59 · 88 bảng · 434 test · gotcha 76 · menu 54 · prod 17 user/7 NCC.** **🔴 NEXT anh:** ⚠️ restart CLI (§2.1.7 + §L.b(c) H17-loop wire runtime — command `.md` no hot-reload). **🔴 NEXT em:** frontend-designer distill (WATCH strike-1 = H17 loop's live finding, chờ strike-2/anh) · monthly **2026-07-01 (hôm nay)** re-tier STATUS/HANDOFF mega-line + ef-core SKILL Mig→59 + docs/CLAUDE Budget-removed + 3 vocab-fork alias-map. **Pending product (carry):** Section B cột Dự-án · Ngưỡng CEO Mig 54 · "C" chuyển phiếu→dự án. → log `2026-07-01-S95-harness17-adopt.md`) · *(S93-S94 blurb đã tách → `docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md`, re-tier S98; session ≤S90 → `docs/_archive/STATUS-HANDOFF-tier-S94-2026-06-29.md` + `docs/changelog/sessions/`, re-tier S94)* --- diff --git a/docs/STATUS.md b/docs/STATUS.md index 9f9bacc..288a331 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -3,7 +3,7 @@ > **Update rule:** trước khi bắt đầu 1 task → ghi row `🔥 In Progress`. Xong → `✅ Recently Done`. > **Tiering rule (S40):** chỉ giữ **state hiện tại + 3 session gần nhất** ở file này. Session cũ hơn → `docs/changelog/sessions/`. Full history pre-S40 → `docs/_archive/STATUS-preS40-fullhistory.md`. (Tránh over-context — xóa double, không cắt nội dung.) -**Last updated:** 2026-07-02 (S98 — **Harness backlog batch ĐÓNG — docs/memory-only 0 prod code, 2 commit `4263d63`+`8a249c5` CI-skip.** ✅ Fable-restore gỡ caveat H5.6: settings `claude-fable-5[1m]` + spawn-test inherit ×2 monitor self-report `claude-fable-5` → H8 all-inherit runtime-verified, fallback-Opus H5 S62→S97 kết thúc · monthly pointer→2026-08-01 · skill ef-core-migration +row Mig 60/61 · re-tier mega-line S93/S94→`docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md` · 3 orphan-append H2 (database-agent 4th+5th spawn S97 · reviewer S97-bis addendum · implementer-frontend S97-Part2 hook) · cicd-monitor L1 curate 19.9→17.5KB + `memory-budget.json` re-measure fresh · sleep-compress implementer-frontend `2026-H1.gist.md` distill-gen:1 · email AI_INFRA Fable-restore · ledger H10 mode-A note. Session-log skip (docs-batch). State GIỮ NGUYÊN: Mig 61 · 89 bảng · 440 test · gotcha 79. *(Flip ✅ hồi-tố @S99-start — S98 đóng thiếu flip header/row, H1 F1 catch.)*) · **Prev S97** (S97 — **PE finalize 4-fix UAT anh Kiệt FDC (buổi live) — em-main-led, prod-verified Run #481+#482.** **(1)** badge cấp-sau-finalize `"không trình tới"`→**`"Kết thúc tại {finalizeLevelName}"`** (render-động → hiện "Kết thúc tại CCM"; fallback finalizeStepName/'cấp trên') + tooltip template-literal. **(2)** đảo default checkbox "Cấp này KẾT THÚC quy trình" **opt-out→opt-in** (`useState(true→false)` init + reset onSuccess + helper text reword + comment S96-"default checked"-drift fix) — mặc định TRÌNH TIẾP CEO, tick mới KẾT THÚC tại cấp. **FE-only mirror 2-app SHA-identical `PeWorkflowPanel.tsx` (`bcf812fd`), 0 BE/mig/test** (BE service `if(AllowApproverFinalize && applyLevelFinalize)` tôn trọng cờ FE; param default `true` giữ làm fallback caller non-FE, FE luôn POST tường minh). Workflow `wf_0e01fdba-209`: implementer-frontend (8 hunk 4×2, build×2 PASS) → reviewer (PASS 0-issue; verify comment-L121+handler-L664 giữ, logic non-break). Commit `1c8fb6a`. **cicd Run #481 PASS ~5m10s byte-level #77:** JS rotate admin `COYAX-yQ`→**`Cf0o8dx8`**/user `0MU-kb4N`→**`x8rppRAK`** (CSS frozen `Bbtesa6B`/`BmuPz_Dy` #69-REFINE logic-only; real-size 1.64/1.54MB anti-SPA-trap) · **NEW `Kết thúc tại`+helper `Mặc định…TRÌNH TIẾP` PRESENT / OLD `không trình tới`+`Đã BỎ tick` ABSENT** (fix shipped byte-level → UI-cũ=cache→incognito, KHÔNG deploy-fail) · Mig 59/88-table frozen · smoke api+admin+eoffice 200×3 + PE-list 200 items[]-valid. **Lessons:** #53 return-garble **tái-diễn lần-4** (cicd trả prose-curate-memory "18.7KB above target" thay verdict dù instruction "return-verdict" → **recover-from-diary S97-#481-entry KHÔNG re-spawn** per `feedback_agent_return_garble_recover`; instruction-fix giảm-không-100%) · BE-honors-explicit-flag → đảo-default chỉ sửa FE `useState` (BE param=fallback, FE luôn POST tường minh) = zero BE/test-churn zero-prod-risk · comment-drift cleanup trước commit. impl MEMORY compaction giữa-spawn (23.8→11.5KB, archive S76-79→`2026-H1.md` verify no-loss). **(3) endsBeforeCeo config→RUNTIME (Mig 60 `8037fa0` #482 — cross-stack, reviewer PASS 0-issue):** phiếu có cấp finalize nhưng approver opt-out → lên CEO thật + CEO duyệt, nhưng sơ đồ báo sai "kết thúc tại CCM, không qua CEO" + làm-mờ Bước CEO (endsBeforeCeo suy CONFIG). Fix: field runtime `EndedByLevelFinalize` (set CHỈ nhánh level-finalize) → EndsBeforeCeo cho phiếu DaDuyet đọc runtime; 4 projection (detail/List/Inbox/ListApproved) + FE gate làm-mờ 2-app + backfill marker; test 440 (repro `peFinButWentCeo` config-finalize+field-false→false) + reviewer 6-điểm PASS + **cicd #482 bug fixed LIVE** (PE-detail `31faef0d` endsBeforeCeo=False phase=7, EF-ternary SQL-Server 200-NOT-500) → gotcha #78 (display-flag CONFIG-vs-RUNTIME). **(4) badge "✅ Đã được CEO duyệt" (`9e12e80` #483, FE-only):** đối xứng fix-3 — phiếu DaDuyet + `!endsBeforeCeo` (đi hết lên CEO) → PeFinalizeChip hiện badge; tận-dụng cờ runtime (0 BE/mig); mirror 2-app + 6 call-site; cicd #483 byte-#77 PRESENT. **(5) Mig 61 backfill fix (`fb2dfa9` #484 data-fix):** anh Kiệt check A/005 "CEO duyệt chưa" → điều tra (API+sqlcmd) phát hiện A/005/A/008 **finalize-CCM (KHÔNG qua CEO)** nhưng badge sai "Đã được CEO duyệt" do Mig 60 backfill soi NHẦM bảng (Approvals thay Changelogs nơi marker thật). Mig 61 query đúng Changelogs → prod A/005/A/008 EndedByLevelFinalize 0→1 + endsBeforeCeo flip True (cicd #484), A/010 control unchanged → gotcha #79. database-agent điều tra + em-main verify-prod + migration. **State: Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 · bundle admin `mEGqlNWc`/user `Dnrp4PU1` (Run #484 data-fix, #69-rebuild) · prod 21 NCC/17 user.** **REVIEW-before-session-end (anh yêu cầu, workflow `wf_4951c347` 4-lane):** prod-data-integrity CLEAN (flag-vs-marker 3 phiếu chuẩn 0-miss/0-over-reach, #78/#79 ăn prod) · prod-deploy CLEAN (11 commit deploy OK, Mig 61 applied, health 200) · code-review PASS (em-main grep 0 wrong-table khác) · feedback captured. **PROD AN TOÀN.** **🔴 NEXT anh:** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar" xác nhận: (a) sơ đồ hết báo "không qua CEO" + Bước 3 CEO KHÔNG còn mờ [fix-3 mới], (b) badge "Kết thúc tại CCM" + checkbox default-unchecked [fix 1-2] (+ vụ cũ "lỗi phân quyền vào phiếu": cho số-phiếu+user). **NEXT em:** monthly re-tier mega-line pending (giờ 5-blurb S97-S93). → log `2026-07-01-S97-pe-finalize-wording-default-flip.md`) · **Prev S96** (S96 — **buổi UAT LỚN anh Kiệt/chị Trà/anh Chương live + monthly-audit — 5 commit prod-verified, em-main-led (HMW-mode ON; 1 prep-workflow monthly-audit + spawn-lẻ, chủ-yếu solo).** **(1) Monthly drift audit `881783c`** (docs-only CI-skip): ef-core SKILL Mig→59 + bảng rows 57/58/59 + Mig 14/Phase-7 Budget-DROPPED annotate · skills/README Mig 55→59 + gotcha #69→76 · docs/CLAUDE Budget REMOVED Mig 50 strike-through · **`docs/governance/vocab-alias-map.md` MỚI** (3 fork run-trace/Ngân-sách-PRO/all-inherit + `$ExcludeExact` anti-self-match) · **re-tier STATUS/HANDOFF mega-line 5→3 blurb** (S92/S91→archive, conservation delta=0 BOM-preserved) + hoist 3 UAT-carry→blockers · **FD memory distill** (H17 strike-1 CLEARED: L1 26129→21492B, 5 war-story→archive/`_INDEX`/gist, Lessons value-protect lên L1). Workflow `wf_2d687d27` 4-cluster draft→verify (reviewer bắt #74-paraphrase-drift + AS-10 residual reverted). detector 27→25. **(2) Import NCC DONGDUONG `ba4b8e0`** (Excel anh Kiệt "Database NCC" 4 NCC/30-field): 3 NCC đã seed sẵn (TRUONGGIANG/TANPHU/TGN) → chỉ +DONGDUONG vào SeedRealMasterDataAsync (ungated idempotent, pack extras→Note, no-mig); prod 20→21 NCC (Run #477). Backlog 15-18 field "note-lại-từ-từ-tính"→Next-up. **(3-5) 3 PE bug-fix UAT:** `e657faa` ô "Cấp này KẾT THÚC quy trình" (AllowApproverFinalize S89-auto) → **opt-out bỏ-tick-được** (2-tier: Designer=cấp-quyền / phiếu=chọn kết-thúc-hay-trình-CEO; +param `applyLevelFinalize` default-true BE + FE 2-app, Run #478) · `36cbf8b` **chuông tự sạch** noti "cần duyệt" cũ khi phiếu rời cấp (LogTransitionAsync mark-read Generic+RefId ExecuteUpdate BE-only, Run #479) · `0c2f9f6` **khóa sửa giá đề xuất PRO/CCM sau gửi-duyệt** ("duyệt là fix" — Mig 54 "KHÔNG-ràng-Phase" ĐẢO → non-admin chỉ sửa Nháp/TraLai + Admin-override; BE+FE 2-app+4 test, Run #480). Test 434→440. **Delete-sau-duyệt = ĐÃ chặn sẵn** (FE nút Xóa chỉ DangSoanThao + BE guard, không cần sửa). Checkbox "ko-được" = **browser-cache** (verify byte-level: prod bundle `0MU-kb4N` CHỨA fix + "✅-static" cũ đã mất; index.html no-cache đúng-chuẩn + no-service-worker) → **incognito = golden-test**. **State: Mig 59 · 88 bảng · 440 test (45D+395I) · gotcha 77 · menu 54 · bundle admin `COYAX-yQ`/user `0MU-kb4N` (Run #480) · prod 21 NCC/17 user.** **Lessons:** verify-deployed-artifact-byte-level (cache≠deploy; incognito golden — gotcha #77) · #53-return-garble tái-diễn ×3 (investigator + cicd×2 trả text-memory-curation thay verdict → recover từ agent-memory; instruction-fix "return-verdict" ăn lần-3) · 2-tier-permission (grant-vs-exercise) · spec-change→update-test-cũ (SeedPeAsync ChoDuyet→DangSoanThao). **🔴 NEXT anh:** UAT incognito checkbox + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu" để em soi config-workflow. **NEXT em:** cicd-monitor S-tag-drift S97/S98→S96 reconcile (closeout này) · monthly re-tier mega-line (giờ 4-blurb S96/S95/S94/S93). → log `2026-07-01-S96-uat-pe-fixes-monthly-audit.md`) · **Prev S95** (S95 — **Harness-17 adopt (Vòng tự-cải-thiện bộ-nhớ Đo→Tinh-chỉnh→Kiểm) — governance-only 0 prod code, em-main-led + 3-workflow fan-out (HMW-mode ON).** `/check-email AI_INFRA` (0 directed mới; H16 đã áp trọn S93) → `/adap-apply` H17 (2 broadcast hash-MATCH · `reviewer_gate:PASS`). **10/10 mục 🔴 sàn ĐẠT:** REUSE-cite A2=§H MFE/C3=D9/CG-2=value_protect/archive=§A; **build mới** `scripts/memory-selfimprove-audit.ps1` (C1 spec-audit NO-API exit-0, **runtime-verified bắt frontend-designer over-cap GAP thật**) + `.claude/governance/reinject-ledger.md` (B2 CG-1 N=3, tách khỏi budget.json) + engine **§I** codify + `session-start §2.1.7`/`session-end §L.b(c)` wire + HCV alias no-seed (coverage 3-nghĩa, detector vẫn 27). **3-workflow (run-id bằng-chứng):** WF1 `wf_f085d7c4-d78` ground-truth + WF2 `wf_8e73c1d6-ee6` 3-lane review PASS 0-blocking + WF3 `wf_6f44eddf-680` deep-reverify (**fault-injection 13-inject chứng-răng-thật** + integration + cross-doc, 0 application-defect). **2 commit:** `18a17f5` (adopt — cicd **Run #476 PASS** prod 200×3, bundle rotate admin `0T6vVJST`/user `BGXEVZO6`, Mig 59 unchanged) + `65b434a` (deep-reverify docs-only CI-skip). **adap-report + 2 email AI_INFRA** (hash `54789e19` adopt + `8c94fa34` deep-reverify-update). **Dogfood C3 4-fire:** AS-10 WF1+WF3 self-write reverted (git-diff net = backstop THẬT; **instruction-fix NOT 100%** — WF3 explicit-return-only STILL self-wrote → E-006 recurrence S95, guard HELD 4/4, 0 escape; cicd-monitor diary KEPT = normal-spawn legit). **Lessons:** fault-injection-via-`-RepoRoot`-temp chứng checker-teeth (không chỉ happy-path PASS) · Lane B #53 empty-return → em-main self-gate recover · workflow-agent persona-write stochastic → git-diff mandatory. **State GIỮ NGUYÊN: Mig 59 · 88 bảng · 434 test · gotcha 76 · menu 54 · prod 17 user/7 NCC.** **NEXT em:** frontend-designer distill (WATCH strike-1 = H17 loop's live finding) · monthly re-tier mega-line + ef-core SKILL Mig→59 + 3 vocab-fork (2026-07-01 due). → log `2026-07-01-S95-harness17-adopt.md`) · *(S93-S94 blurb đã tách → `docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md`, re-tier S98; session ≤S90 → `docs/_archive/STATUS-HANDOFF-tier-S94-2026-06-29.md` + `docs/changelog/sessions/`, re-tier S94)* +**Last updated:** 2026-07-02 (S100 — **Harness-18 adopt (kiện-toàn kiến-trúc 4 khuôn-mẫu additive) + frontier-assessment HELD-integrity — governance/scripts-only 0 prod-code, em-main-led + 2 workflow HMW-ON.** `/check-email AI_INFRA` 0 directed mới → `/adap-apply` 3 broadcast: **(1) hash-verify** H18+checklist MATCH ✓ · **frontier `content_sha256` MISMATCH** (4 biến-thể canonical đều lệch, 2 file kia match → body lệch stamp) → **HELD-integrity** không codify + đề nghị AI_INFRA re-stamp; ⚠️ cả 3 thiếu field `reviewer_gate` (24 broadcast cũ đều có) → flag format-regression. **(2) J.A detector v2** (`governance-detectors.ps1`): ratio-band mismatch-only (0.5–2.0=MED stale-total, xa=LOW module-local — sửa lớp FP `|diff|≥10` NGƯỢC, S98 8/8 MED đều FP) + scan-range **glob động** ALL SKILL.md + ALL commands/*.md (vá lớp-mù "(68)" sống 11 phiên) — **fault-inject 4/4 PASS** (`-RepoRoot` temp: stale-MED/đúng-IM/local-LOW/anti-Goodhart-MED) + real-repo MED derived-stale 11→0. **(3) J.B retire `runs/_ledger.md` two-beat:** đo bắt-thật **0/15 lifetime** (đều open+close cùng-ngày 06-18) + mode-A coverage 0/8 S93+ + đính-chính "S71 `harvest/` rỗng" = criterion-wording KHÔNG phải incident (caveat-3 parity ghi honest) → freeze 🧊 1-dòng reversible + **sweep 15 điểm/8 file**; orphan-authority = folder-scan (`run.md` có mà `*-synthesis.md` vắng/0-byte). **(4) J.C bracket** 2/3 n-a-by-owner-mandate H8 + revisit-condition viết ra (C3 ĐẠT). **(5) J.D** D(a) spot-check-tươi wired `session-end §L.b(i)` (dogfood n=1) + D(b/c) REUSE reinject-ledger CG-1. **(6) Frontier self-audit (dù HELD, vô-hại):** cron monthly = **ghost-wire THẬT** (CronList runtime=0 + scheduler RỖNG 05-04 + S96 chạy 13:04 em-main) → **honest-retire 5 file** (audit = thủ-công em-main session đầu-tháng — function vẫn đúng hạn S44/S96, chỉ wiring-claim sai) · 3 script đo GLOB-LIVE ✓ 0-hardcode · MAST=0 · defer **D-1/D-2** đánh-số Maintenance backlog. **(7) Hygiene:** F2 SendMessage-note patch 2 command (runtime-verified KHẢ DỤNG lại) + B1-pointer "130 PASS"/cron-date + Co-Authored trailer → Fable. Checklist H18: **10/12 ĐẠT + 2/12 n-a-reasoned**. WF1 `wf_50a817ce-a69` 3-lane investigator (0-residual, chunk 2431==2431); **WF2 review `wf_31ea3985-92c` IN-FLIGHT lúc đóng** → session kế đọc verdict + điền run-id + email AI_INFRA. 3 adap-report committed. Đầu phiên: test **440 re-verified** + 2 monitor RE-REPORT ALL-PASS/ALL-CLEAN (`513aa09`). Dogfood frontier-method: tự-bắt 1 ca suýt-stamp run-id WF2-chưa-chạy → placeholder. State GIỮ NGUYÊN: Mig 61 · 89 bảng · 440 test · gotcha 79. → log `2026-07-02-S100-harness-18-adopt.md`) · **Prev S98** (S98 — **Harness backlog batch ĐÓNG — docs/memory-only 0 prod code, 2 commit `4263d63`+`8a249c5` CI-skip.** ✅ Fable-restore gỡ caveat H5.6: settings `claude-fable-5[1m]` + spawn-test inherit ×2 monitor self-report `claude-fable-5` → H8 all-inherit runtime-verified, fallback-Opus H5 S62→S97 kết thúc · monthly pointer→2026-08-01 · skill ef-core-migration +row Mig 60/61 · re-tier mega-line S93/S94→`docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md` · 3 orphan-append H2 (database-agent 4th+5th spawn S97 · reviewer S97-bis addendum · implementer-frontend S97-Part2 hook) · cicd-monitor L1 curate 19.9→17.5KB + `memory-budget.json` re-measure fresh · sleep-compress implementer-frontend `2026-H1.gist.md` distill-gen:1 · email AI_INFRA Fable-restore · ledger H10 mode-A note. Session-log skip (docs-batch). State GIỮ NGUYÊN: Mig 61 · 89 bảng · 440 test · gotcha 79. *(Flip ✅ hồi-tố @S99-start — S98 đóng thiếu flip header/row, H1 F1 catch.)*) · **Prev S97** (S97 — **PE finalize 4-fix UAT anh Kiệt FDC (buổi live) — em-main-led, prod-verified Run #481+#482.** **(1)** badge cấp-sau-finalize `"không trình tới"`→**`"Kết thúc tại {finalizeLevelName}"`** (render-động → hiện "Kết thúc tại CCM"; fallback finalizeStepName/'cấp trên') + tooltip template-literal. **(2)** đảo default checkbox "Cấp này KẾT THÚC quy trình" **opt-out→opt-in** (`useState(true→false)` init + reset onSuccess + helper text reword + comment S96-"default checked"-drift fix) — mặc định TRÌNH TIẾP CEO, tick mới KẾT THÚC tại cấp. **FE-only mirror 2-app SHA-identical `PeWorkflowPanel.tsx` (`bcf812fd`), 0 BE/mig/test** (BE service `if(AllowApproverFinalize && applyLevelFinalize)` tôn trọng cờ FE; param default `true` giữ làm fallback caller non-FE, FE luôn POST tường minh). Workflow `wf_0e01fdba-209`: implementer-frontend (8 hunk 4×2, build×2 PASS) → reviewer (PASS 0-issue; verify comment-L121+handler-L664 giữ, logic non-break). Commit `1c8fb6a`. **cicd Run #481 PASS ~5m10s byte-level #77:** JS rotate admin `COYAX-yQ`→**`Cf0o8dx8`**/user `0MU-kb4N`→**`x8rppRAK`** (CSS frozen `Bbtesa6B`/`BmuPz_Dy` #69-REFINE logic-only; real-size 1.64/1.54MB anti-SPA-trap) · **NEW `Kết thúc tại`+helper `Mặc định…TRÌNH TIẾP` PRESENT / OLD `không trình tới`+`Đã BỎ tick` ABSENT** (fix shipped byte-level → UI-cũ=cache→incognito, KHÔNG deploy-fail) · Mig 59/88-table frozen · smoke api+admin+eoffice 200×3 + PE-list 200 items[]-valid. **Lessons:** #53 return-garble **tái-diễn lần-4** (cicd trả prose-curate-memory "18.7KB above target" thay verdict dù instruction "return-verdict" → **recover-from-diary S97-#481-entry KHÔNG re-spawn** per `feedback_agent_return_garble_recover`; instruction-fix giảm-không-100%) · BE-honors-explicit-flag → đảo-default chỉ sửa FE `useState` (BE param=fallback, FE luôn POST tường minh) = zero BE/test-churn zero-prod-risk · comment-drift cleanup trước commit. impl MEMORY compaction giữa-spawn (23.8→11.5KB, archive S76-79→`2026-H1.md` verify no-loss). **(3) endsBeforeCeo config→RUNTIME (Mig 60 `8037fa0` #482 — cross-stack, reviewer PASS 0-issue):** phiếu có cấp finalize nhưng approver opt-out → lên CEO thật + CEO duyệt, nhưng sơ đồ báo sai "kết thúc tại CCM, không qua CEO" + làm-mờ Bước CEO (endsBeforeCeo suy CONFIG). Fix: field runtime `EndedByLevelFinalize` (set CHỈ nhánh level-finalize) → EndsBeforeCeo cho phiếu DaDuyet đọc runtime; 4 projection (detail/List/Inbox/ListApproved) + FE gate làm-mờ 2-app + backfill marker; test 440 (repro `peFinButWentCeo` config-finalize+field-false→false) + reviewer 6-điểm PASS + **cicd #482 bug fixed LIVE** (PE-detail `31faef0d` endsBeforeCeo=False phase=7, EF-ternary SQL-Server 200-NOT-500) → gotcha #78 (display-flag CONFIG-vs-RUNTIME). **(4) badge "✅ Đã được CEO duyệt" (`9e12e80` #483, FE-only):** đối xứng fix-3 — phiếu DaDuyet + `!endsBeforeCeo` (đi hết lên CEO) → PeFinalizeChip hiện badge; tận-dụng cờ runtime (0 BE/mig); mirror 2-app + 6 call-site; cicd #483 byte-#77 PRESENT. **(5) Mig 61 backfill fix (`fb2dfa9` #484 data-fix):** anh Kiệt check A/005 "CEO duyệt chưa" → điều tra (API+sqlcmd) phát hiện A/005/A/008 **finalize-CCM (KHÔNG qua CEO)** nhưng badge sai "Đã được CEO duyệt" do Mig 60 backfill soi NHẦM bảng (Approvals thay Changelogs nơi marker thật). Mig 61 query đúng Changelogs → prod A/005/A/008 EndedByLevelFinalize 0→1 + endsBeforeCeo flip True (cicd #484), A/010 control unchanged → gotcha #79. database-agent điều tra + em-main verify-prod + migration. **State: Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 · bundle admin `mEGqlNWc`/user `Dnrp4PU1` (Run #484 data-fix, #69-rebuild) · prod 21 NCC/17 user.** **REVIEW-before-session-end (anh yêu cầu, workflow `wf_4951c347` 4-lane):** prod-data-integrity CLEAN (flag-vs-marker 3 phiếu chuẩn 0-miss/0-over-reach, #78/#79 ăn prod) · prod-deploy CLEAN (11 commit deploy OK, Mig 61 applied, health 200) · code-review PASS (em-main grep 0 wrong-table khác) · feedback captured. **PROD AN TOÀN.** **🔴 NEXT anh:** UAT **incognito** phiếu "8 MEP Sub Hệ thống solar" xác nhận: (a) sơ đồ hết báo "không qua CEO" + Bước 3 CEO KHÔNG còn mờ [fix-3 mới], (b) badge "Kết thúc tại CCM" + checkbox default-unchecked [fix 1-2] (+ vụ cũ "lỗi phân quyền vào phiếu": cho số-phiếu+user). **NEXT em:** monthly re-tier mega-line pending (giờ 5-blurb S97-S93). → log `2026-07-01-S97-pe-finalize-wording-default-flip.md`) · **Prev S96** (S96 — **buổi UAT LỚN anh Kiệt/chị Trà/anh Chương live + monthly-audit — 5 commit prod-verified, em-main-led (HMW-mode ON; 1 prep-workflow monthly-audit + spawn-lẻ, chủ-yếu solo).** **(1) Monthly drift audit `881783c`** (docs-only CI-skip): ef-core SKILL Mig→59 + bảng rows 57/58/59 + Mig 14/Phase-7 Budget-DROPPED annotate · skills/README Mig 55→59 + gotcha #69→76 · docs/CLAUDE Budget REMOVED Mig 50 strike-through · **`docs/governance/vocab-alias-map.md` MỚI** (3 fork run-trace/Ngân-sách-PRO/all-inherit + `$ExcludeExact` anti-self-match) · **re-tier STATUS/HANDOFF mega-line 5→3 blurb** (S92/S91→archive, conservation delta=0 BOM-preserved) + hoist 3 UAT-carry→blockers · **FD memory distill** (H17 strike-1 CLEARED: L1 26129→21492B, 5 war-story→archive/`_INDEX`/gist, Lessons value-protect lên L1). Workflow `wf_2d687d27` 4-cluster draft→verify (reviewer bắt #74-paraphrase-drift + AS-10 residual reverted). detector 27→25. **(2) Import NCC DONGDUONG `ba4b8e0`** (Excel anh Kiệt "Database NCC" 4 NCC/30-field): 3 NCC đã seed sẵn (TRUONGGIANG/TANPHU/TGN) → chỉ +DONGDUONG vào SeedRealMasterDataAsync (ungated idempotent, pack extras→Note, no-mig); prod 20→21 NCC (Run #477). Backlog 15-18 field "note-lại-từ-từ-tính"→Next-up. **(3-5) 3 PE bug-fix UAT:** `e657faa` ô "Cấp này KẾT THÚC quy trình" (AllowApproverFinalize S89-auto) → **opt-out bỏ-tick-được** (2-tier: Designer=cấp-quyền / phiếu=chọn kết-thúc-hay-trình-CEO; +param `applyLevelFinalize` default-true BE + FE 2-app, Run #478) · `36cbf8b` **chuông tự sạch** noti "cần duyệt" cũ khi phiếu rời cấp (LogTransitionAsync mark-read Generic+RefId ExecuteUpdate BE-only, Run #479) · `0c2f9f6` **khóa sửa giá đề xuất PRO/CCM sau gửi-duyệt** ("duyệt là fix" — Mig 54 "KHÔNG-ràng-Phase" ĐẢO → non-admin chỉ sửa Nháp/TraLai + Admin-override; BE+FE 2-app+4 test, Run #480). Test 434→440. **Delete-sau-duyệt = ĐÃ chặn sẵn** (FE nút Xóa chỉ DangSoanThao + BE guard, không cần sửa). Checkbox "ko-được" = **browser-cache** (verify byte-level: prod bundle `0MU-kb4N` CHỨA fix + "✅-static" cũ đã mất; index.html no-cache đúng-chuẩn + no-service-worker) → **incognito = golden-test**. **State: Mig 59 · 88 bảng · 440 test (45D+395I) · gotcha 77 · menu 54 · bundle admin `COYAX-yQ`/user `0MU-kb4N` (Run #480) · prod 21 NCC/17 user.** **Lessons:** verify-deployed-artifact-byte-level (cache≠deploy; incognito golden — gotcha #77) · #53-return-garble tái-diễn ×3 (investigator + cicd×2 trả text-memory-curation thay verdict → recover từ agent-memory; instruction-fix "return-verdict" ăn lần-3) · 2-tier-permission (grant-vs-exercise) · spec-change→update-test-cũ (SeedPeAsync ChoDuyet→DangSoanThao). **🔴 NEXT anh:** UAT incognito checkbox + cho **số-phiếu/user** vụ "lỗi phân quyền vào phiếu" để em soi config-workflow. **NEXT em:** cicd-monitor S-tag-drift S97/S98→S96 reconcile (closeout này) · monthly re-tier mega-line (giờ 4-blurb S96/S95/S94/S93). → log `2026-07-01-S96-uat-pe-fixes-monthly-audit.md`) · **Prev S95** (S95 — **Harness-17 adopt (Vòng tự-cải-thiện bộ-nhớ Đo→Tinh-chỉnh→Kiểm) — governance-only 0 prod code, em-main-led + 3-workflow fan-out (HMW-mode ON).** `/check-email AI_INFRA` (0 directed mới; H16 đã áp trọn S93) → `/adap-apply` H17 (2 broadcast hash-MATCH · `reviewer_gate:PASS`). **10/10 mục 🔴 sàn ĐẠT:** REUSE-cite A2=§H MFE/C3=D9/CG-2=value_protect/archive=§A; **build mới** `scripts/memory-selfimprove-audit.ps1` (C1 spec-audit NO-API exit-0, **runtime-verified bắt frontend-designer over-cap GAP thật**) + `.claude/governance/reinject-ledger.md` (B2 CG-1 N=3, tách khỏi budget.json) + engine **§I** codify + `session-start §2.1.7`/`session-end §L.b(c)` wire + HCV alias no-seed (coverage 3-nghĩa, detector vẫn 27). **3-workflow (run-id bằng-chứng):** WF1 `wf_f085d7c4-d78` ground-truth + WF2 `wf_8e73c1d6-ee6` 3-lane review PASS 0-blocking + WF3 `wf_6f44eddf-680` deep-reverify (**fault-injection 13-inject chứng-răng-thật** + integration + cross-doc, 0 application-defect). **2 commit:** `18a17f5` (adopt — cicd **Run #476 PASS** prod 200×3, bundle rotate admin `0T6vVJST`/user `BGXEVZO6`, Mig 59 unchanged) + `65b434a` (deep-reverify docs-only CI-skip). **adap-report + 2 email AI_INFRA** (hash `54789e19` adopt + `8c94fa34` deep-reverify-update). **Dogfood C3 4-fire:** AS-10 WF1+WF3 self-write reverted (git-diff net = backstop THẬT; **instruction-fix NOT 100%** — WF3 explicit-return-only STILL self-wrote → E-006 recurrence S95, guard HELD 4/4, 0 escape; cicd-monitor diary KEPT = normal-spawn legit). **Lessons:** fault-injection-via-`-RepoRoot`-temp chứng checker-teeth (không chỉ happy-path PASS) · Lane B #53 empty-return → em-main self-gate recover · workflow-agent persona-write stochastic → git-diff mandatory. **State GIỮ NGUYÊN: Mig 59 · 88 bảng · 434 test · gotcha 76 · menu 54 · prod 17 user/7 NCC.** **NEXT em:** frontend-designer distill (WATCH strike-1 = H17 loop's live finding) · monthly re-tier mega-line + ef-core SKILL Mig→59 + 3 vocab-fork (2026-07-01 due). → log `2026-07-01-S95-harness17-adopt.md`) · *(S93-S94 blurb đã tách → `docs/_archive/STATUS-HANDOFF-tier-S98-2026-07-02.md`, re-tier S98; session ≤S90 → `docs/_archive/STATUS-HANDOFF-tier-S94-2026-06-29.md` + `docs/changelog/sessions/`, re-tier S94)* --- @@ -31,11 +31,12 @@ --- -## 🔥 In Progress (S99) +## 🔥 In Progress (S100) | Task | Owner | Status | |---|---|---| | **PE "lỗi phân quyền vào phiếu"** (anh Kiệt UAT báo) — chờ **số-phiếu + user** để soi config workflow (nhiều khả năng user chưa được gán approver Cấp phiếu đang chờ — config, không phải code-bug) | 👤 em main | ⚪ pending (chờ anh specifics) | +| **H18 WF2 review `wf_31ea3985-92c`** — 3 lane reviewer chạy nền lúc đóng S100: session kế đọc verdict (task `w4xb4vlm2` / transcript `wf_31ea3985-92c`) → fix nếu FAIL → điền run-id+verdict vào engine §J + adap-report H18 (đang placeholder honest) → harvest reviewer memoryDelta → `/send-email AI_INFRA` báo cáo (kèm 2 flag: `reviewer_gate` field missing + frontier hash MISMATCH) | 👤 em main | 🟡 in-flight | --- @@ -59,7 +60,8 @@ - RAG re-ingest `solution_erp` S42-S43 content (store_memory stopgap live; full re-index = AI_INFRA op) - ⬜ **Supplier schema mở-rộng (anh Kiệt "note lại từ từ tính", S96):** form Excel "Database NCC" ~30 field, entity `Supplier` hiện chỉ 9. S96 import 4 NCC (option-3: 9 field + gói extras vào `Note`). **15-18 field CHỜ thêm khi anh chốt:** GÓI THẦU (có thể → WorkItem/category) · ĐỊA CHỈ VP · FAX · SỐ TK+NGÂN HÀNG (tách field) · SỐ TK PHỤ · NGƯỜI ĐẠI DIỆN PL + CHỨC VỤ · GIẤY ỦY QUYỀN (số/ngày/người) · **Link GUQ/GPKD/HSNL** (nvarchar(1000) mirror HoSoLink) · CHỨC VỤ LH · SĐT contact riêng · ĐỊA CHỈ GỬI THƯ · NGƯỜI NHẬN THƯ · NGUỒN GT · PMH · TÌNH TRẠNG (enum active/blacklist) · NGÀY/NGƯỜI CẬP NHẬT. Additive-nullable → 1 migration khi làm. Enum `SupplierType` cần thêm "Cả hai" (NTP+NCC) nếu gặp. - ✅ **gotcha #57 LeaveType+ShiftPattern+OtPolicy filtered-unique DONE S51** (Mig 45, **3 HRM catalog** — OtPolicy bị bỏ sót khỏi backlog "2 catalog", bắt được via grep + test-before 5 case). ⬜ **EXT (worktree session, Mig 46):** Department/Supplier/Project (Master, confirmed-reachable via global query-filter quirk); ContractClause/MeetingRoom/EmployeeProfile = SKIP (audit-verified not-reachable). -- Skill + doc drift audit cron — ✅ **2026-07-01 DONE (S96 `881783c`)** — ef-core→Mig 59 + vocab-alias-map + re-tier mega-line (prev 2026-06-01 S44); next **2026-08-01** +- Skill + doc drift audit (**thủ-công em-main session đầu-tháng** — 🧊 ghost-wire "cron fire 9:00" gỡ S100 H18/frontier-P2: CronList runtime = 0 job, S44/S96 thực-tế đều em-main chạy in-session đúng hạn) — ✅ **2026-07-01 DONE (S96 `881783c`)** — ef-core→Mig 59 + vocab-alias-map + re-tier mega-line (prev 2026-06-01 S44); next **2026-08-01** +- ⬜ **H18/frontier deferred (S100 — mục-sổ đánh-số per frontier-P2):** **(D-1)** wire-or-retire 2 config key `mfe.sub_denominator.role_file_glob`/`diary_path_pattern` (`memory-budget.json:54-55` defined-but-unread — `mfe-eval.ps1:216/:237` re-hardcode giá trị trùng; chờ frontier-assessment re-stamp [content_sha256 MISMATCH → HELD] hoặc maintenance kế) · **(D-2)** `memory-selfimprove-audit.ps1:147` latent blind-spot skip-if-no-`tools:`-line trong A1 (0 agent affected — 11/11 có `tools:`; vá khi thêm agent class này) ### 🚫 Phase 9 Ops (blocked — anh main coordinate) - SMTP email outbound · Rotate prod creds · SQL auto-backup (backup-sql.ps1 ready, chờ Task Scheduler register) · UAT 2-3 user 1 tuần diff --git a/docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md b/docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md new file mode 100644 index 0000000..ae09daa --- /dev/null +++ b/docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md @@ -0,0 +1,34 @@ +# Session 100 — 2026-07-02 — Harness-18 adopt + frontier HELD-integrity (governance/scripts-only) + +> **Lệnh anh:** `/check-email AI_INFRA` + `/adap-apply` step-by-step cẩn thận + `/ultra-on` + report AI_INFRA trung thực. Em-main-led (single-writer D9), 2 workflow Harness-9 mandate. 0 prod code. + +## Bootstrap (đầu phiên, trước lệnh adopt) + +- `/session-start` đủ: HMW-ON · Fable lead OK · test **440/440 re-verified** (45D 404ms + 395I 1m09s) · detector 25 cờ advisory · spec-audit PASS 5 criteria GAP-none · RAG 2431 rerank-OK · marks 4 Active-High display. +- 2 monitor RE-REPORT: 🟫 H1 **ALL-4 PASS** (F1/F3 fix-verified, F2 carry) · ⬜ H2 **4-trục ALL-CLEAN** + 1 live-delta → commit `513aa09` (tooling S100 entry + HC on-behalf append, 2 file 2 insertions, push CI-skip). + +## Adopt H18 (commit S100 chính) + +1. **Check-email:** outbox/se RỖNG (0 directed). 3 broadcast mới outbox/all sau H17. +2. **Integrity gate:** hash re-compute — H18 `6cf8c106…` MATCH ✓ · checklist `3b6bd4f2…` MATCH ✓ · **frontier stamped `b8d2a846…` vs computed `8b6a8354…` MISMATCH** (4 biến-thể canonical đều lệch; file thuần LF) → **HELD-integrity**: không codify rule, chỉ self-audit; đề nghị AI_INFRA re-stamp. ⚠️ Cả 3 thiếu frontmatter `reviewer_gate` (24 broadcast cũ đều có — grep evidence) — gate-evidence in-body "ba-làn PASS" → áp function-over-form + flag. +3. **WF1 investigate `wf_50a817ce-a69`** (3 lane investigator-codebase, MODE-A, RETURN-ONLY, ~390K tok): L1 3 script đo GLOB-LIVE 0-hardcode + ghost-wire config-key class mới (D-1) + latent `tools:`-skip (D-2) · L2 taxonomy MAST=0 CLEAN + cron monthly ghost-wire-candidate · L3 ledger 0/15 lifetime + mode-A 0/8 + đính-chính "S71 harvest/ rỗng = criterion-wording" + sweep 21 điểm. Containment: git-diff 0-residual + chunk 2431==2431. +4. **CronList runtime = 0 job** → ghost-wire CONFIRMED → honest-retire 5 file (rules.md ×2 · CLAUDE.md · STATUS.md · session-start.md). +5. **Edits (26 điểm / 13 file + 3 report mới):** + - `scripts/governance-detectors.ps1` — J.A: ratio-band mismatch-only + `$derivedDocs` glob động + note. **Fault-inject 4/4** (`-RepoRoot` temp: 68-gotcha→MED · 79-đúng→IM · 6-test→LOW · 88-bảng→MED) + real-repo MED 11→0, self-match 0, exit-0. + - `runs/_ledger.md` freeze 🧊 + sweep: `runs/README.md` ×7 · `workflows/README.md` ×2 · `session-start.md` §2.1.1 · `session-end.md` §L.b(f) · `harvest-curator.md` ×3 · `agents/README.md` G-015-cite · HC MEMORY baseline. Orphan-authority = folder-scan. + - `session-end.md` +§L.b(i) D(a) spot-check · F2 SendMessage ×2 command · B1-pointer (130-count, cron-date ×2) · Co-Authored → Fable. + - `harness-11-engine.md` **+§J** (4 pattern + frontier self-audit + honest nấc 10/12+2 n-a). + - STATUS backlog **D-1/D-2** đánh-số (frontier P2 remedy). + - 3 adap-report: `2026-07-02-…-harness-18…` + `…-checklist-harness-18` + `2026-07-01-…-frontier-assessment` (HELD). +6. **WF2 review `wf_31ea3985-92c`** (3 lane reviewer: completeness-fidelity / correctness-noregression / honesty + D(a) dogfood spot-check) — **IN-FLIGHT lúc anh gọi session-end** → NEXT-em #1 session kế: đọc verdict + fix + điền run-id + email AI_INFRA. + +## Lessons + +- **Stamp-then-edit hash-drift có thật ở nguồn phát** (frontier MISMATCH) + **em tự-bắt 1 ca suýt-bịa** (ghi sẵn run-id+verdict WF2 chưa chạy vào report → sửa placeholder ngay) — đúng lớp "trích-dẫn tự-khen dễ bịa nhất" của chính broadcast. +- **Ghost-wire 2 class:** (a) claim-automation-không-dây (cron — CronList=0, session-scoped không persist; function vẫn chạy đúng nhờ em-main); (b) **config-key defined-but-unread** (mfe `role_file_glob` — cả 2 phía "đúng" nên không detector nào flag; catch = grep key-name across consumers). +- **Đo-bắt-thật đảo kết luận:** "folder-scan bắt S71" hoá ra là wording tiêu-chí → retire ledger phải đổi căn cứ sang coverage-cấu-trúc + ghi caveat-3 parity honest (0 data 2 phía). +- Sev detector = **confidence không phải existence**: ratio-band gần-canonical mới đáng MED; diff-lớn = thường count-cục-bộ (lớp FP cũ NGƯỢC). + +## State + +Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 · bundle admin `mEGqlNWc`/user `Dnrp4PU1` (chưa đổi — push S100 có `scripts/*.ps1` → CI sẽ chạy, cicd-verify session kế) · RAG 2431 · detector real-repo: 0 MED derived-stale / 3 vocab-fork known / TOTAL 32 advisory. diff --git a/docs/governance/adap-reports/2026-07-01-Governance-harness-frontier-assessment.md b/docs/governance/adap-reports/2026-07-01-Governance-harness-frontier-assessment.md new file mode 100644 index 0000000..2a3d074 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-01-Governance-harness-frontier-assessment.md @@ -0,0 +1,22 @@ +# adap-report — 2026-07-01-Governance-harness-frontier-assessment (SE) — ⚠️ HELD-integrity + +> **Broadcast:** `2026-07-01-Governance-harness-frontier-assessment.md` (outbox/all AI_INFRA, type: update — method-share, KHÔNG checklist 🔴). +> **Status: HELD-integrity — KHÔNG áp như broadcast-verified.** `content_sha256` re-compute **MISMATCH**: stamped `b8d2a846…8b9edc` vs computed `8b6a8354…e8bdadd` (canonical chuẩn — CÙNG phép match ✓ 2/2 file H18 cùng đợt → phép đúng, body đã lệch stamp). Thử 4 biến-thể canonicalization (raw / crlf→lf / lf→crlf / trim-end) đều KHÔNG khớp; file thuần LF (0 CRLF). Khả năng cao = **edit-body-sau-stamp phía phát** (đúng lớp "stamp-then-edit drift" mà chính broadcast này cảnh báo ở mục trích-dẫn-phải-thật). → **Đề-nghị AI_INFRA verify + re-stamp**; SE sẽ re-run `/adap-apply` cho id này khi hash khớp. + +## SE đã làm gì (dù HELD — self-audit vô-hại, có giá-trị riêng) + +KHÔNG codify rule nào từ broadcast này (frontier-envy rule → CHƯA vào rules.md §6.6; chờ re-stamp). CHỈ chạy **4 pattern-check như self-audit nội bộ** (WF1 `wf_50a817ce-a69` lane 1+2, read-only): + +| Pattern | Verdict SE | Evidence | +|---|---|---| +| (1) Taxonomy-matrix | **CLEAN — n-a-legit** | grep `\bMAST\b` = 0 repo-wide; `error-ledger.md` "3-axis tag [TYPE/ACTOR/COMPONENT]" = internal scheme map Gov-v2 §L.b/§G3, KHÔNG claim external-taxonomy → không cần ma-trận ánh-xạ | +| (2) Ghost-wire | **1 THẬT (đã fix S100) + 2 defer** | 🔴 **Cron monthly** `solution-erp-skill-audit-monthly`: CronList runtime = **0 job** + scheduler RỖNG 2026-05-04 (session-log) + S96 audit chạy 13:04 bởi em-main in-session (commit `881783c`) + CronCreate harness = session-scoped không persist → **honest-retire 5 file** (rules.md:292+:543 · CLAUDE.md:111 · STATUS.md:62 · session-start.md §2.4): monthly = thủ-công em-main theo cadence-pointer STATUS (function KHÔNG ghost — S44/S96 đều chạy đúng hạn; chỉ wiring-claim sai). ➕ 2 ghost-wire-config-key defer đánh-số STATUS backlog **D-1** (`mfe.sub_denominator.role_file_glob`/`diary_path_pattern` defined-but-unread — `mfe-eval.ps1:216/:237` re-hardcode trùng giá trị). Cadence#4 + mọi auto-claim khác = WIRED hoặc disclaimed-no-daemon (convention G-015 nhất quán) | +| (3) Measurer role-coverage | **PASS 3/3** | `mfe-eval.ps1:216` + `memory-selfimprove-audit.ps1:133-137` + `memory-archive-gate.ps1:106` đều GLOB-LIVE, 0 hardcode roster/"11" — agent thứ 12 tự-cử. ➕ 1 latent blind-spot defer **D-2** (selfimprove `:147` skip-if-no-`tools:`-line; 0 affected — 11/11 có `tools:`) | +| (4) Correction-cadence proxy | **Ghi-nhận, KHÔNG áp** | 0 điểm-đau đo được hiện tại → áp-không-pain = chính "frontier-envy" broadcast cảnh báo. Ghi-nhận method để dùng khi có pain thật | + +## Nấc (G-011) + +- **agreed:** phương-pháp (2-lượt + trích-dẫn-thật + làn-ground-truth) — SE VỐN đang chạy đúng khuôn này (2-workflow mandate + reviewer adversarial + lane ground-truth WF1); không cần build mới. +- **executed:** self-audit 4 pattern (bảng trên) + fix ghost-wire cron (5 file) + defer-đánh-số D-1/D-2 (STATUS backlog — đúng remedy "nâng thành mục-sổ có đánh-số"). +- **HELD:** codify rule frontier-envy vào rules.md §6.6 — chờ re-stamp. +- **Dogfood tự-thân trong chính adopt này:** em-main tự bắt 1 ca suýt-bịa-dẫn-chứng (ghi sẵn run-id + verdict WF2 CHƯA chạy vào report H18 → sửa thành placeholder ngay) — đúng lớp "con-số tự-khen nghe thuận tai càng dễ bịa" của broadcast. diff --git a/docs/governance/adap-reports/2026-07-02-Governance-checklist-harness-18.md b/docs/governance/adap-reports/2026-07-02-Governance-checklist-harness-18.md new file mode 100644 index 0000000..3c30814 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-02-Governance-checklist-harness-18.md @@ -0,0 +1,35 @@ +# adap-report — 2026-07-02-Governance-checklist-harness-18 (SE — completeness self-check) + +> **Broadcast:** `2026-07-02-Governance-checklist-harness-18.md` (`content_sha256` re-compute = `3b6bd4f2…9ebb4a` **MATCH ✓**; frontmatter `status: 🟢 ADOPT`, thiếu `reviewer_gate` field — flag chung với report chị em). Đối-chiếu 12 mục 🔴 + 4 mục 🟡. Chi tiết evidence → report `2026-07-02-Governance-harness-18-architecture-consolidation.md` + engine §J. + +## Cổng completeness — 12 mục 🔴 (phát-biểu chủ-động) + +| # | Sàn 🔴 | Verdict | Nấc | Mechanized-vs-convention (honest) | +|---|---|---|---|---| +| A1 | Mismatch-only | **ĐẠT** — kể-lại-đúng IM (fault-inject case-2), lệch mới flag; + ratio-band confidence | runtime → executed-file | mechanized (detector) | +| A2 | Mở dải quét theo dải THẬT | **ĐẠT** — glob động ALL SKILL.md + ALL commands/*.md (vá lớp-mù F3) | executed-file + runtime | mechanized + convention (định-kỳ kiểm dải) | +| A3 | Loại dòng-định-nghĩa/trích-chuẩn | **ĐẠT** — self-exclusion 6 path + `$ExcludeExact`, re-verified 0 self-match | executed-file + runtime | mechanized | +| B1 | Đo bắt-thật trước nghỉ-hưu | **ĐẠT** — ledger 0/15 lifetime vs folder-scan 4+ memory-delta catches + mode-A 0/8 (WF1-L3 evidence-grade). ⚠️ Caveat-3 parity ghi rõ: run-folder-orphan 0 data CẢ 2 phía → căn cứ = coverage-cấu-trúc, KHÔNG catch-rate | runtime (đo) → executed | convention (quyết bằng số) | +| B2 | Nghỉ-hưu trung-thực, đảo-ngược, giữ lịch-sử | **ĐẠT** — 1 dòng 🧊 header `_ledger.md`, 15 row nguyên, revert = gỡ dòng | executed-file | convention | +| B3 | Sweep mọi nơi-tiêu-thụ | **ĐẠT** — 15 điểm/8 file live sweep (grep `_ledger` exact — 5 "ledger" khác tên); HISTORY giữ nguyên | executed-file | mechanized (grep) + convention (classify) | +| C1 | Hạ-bậc lớp-thực-thi có cổng-kiểm | **n-a-by-owner-mandate** — H8 all-inherit 🔴 anh-chốt S66 (chất-lượng>chi-phí); escape-hatch `tier:'opus'` per-task GIỮ | n-a (lý-do viết rõ) | — | +| C2 | 2-đầu + 4-lớp-không-hạ | **n-a/vacuously-held** — mọi vai top-tier, không gì bị hạ | n-a (lý-do viết rõ) | — | +| C3 | Điều-kiện xét-lại đo được | **ĐẠT** — viết ra engine §J.C: anh đảo H8 / cost-pressure → bracket + ≥3-run eval vs baseline | executed-file | convention | +| D1 | Spot-check đúng-kết-quả tươi | **ĐẠT** — wired session-end §L.b(i) + dogfood n=1 (WF2-L3, 3 artifact). Caveat-1: n=1 = hiệu-chỉnh, CHƯA proven | executed-file + runtime n=1 | convention (người-soi) | +| D2 | Tái-nạp-khi-trượt-thật | **ĐẠT (REUSE)** — H17 §I B2 reinject-ledger CG-1 (dựng TRƯỚC broadcast) | executed-file (S95) | convention (single-writer) | +| D3 | Chốt-chặn-lặp | **ĐẠT (REUSE)** — CG-1 ≤1 lần/N=3 phiên + escalate anh + đo-lại phiên kế (`reinject-ledger.md`) | executed-file (S95) | convention | + +**Tổng: 10/12 ĐẠT + 2/12 n-a-reasoned (C1/C2 — owner-mandate H8, caveat-2 broadcast cho phép khi chi-phí ngang nhau; SE = ngang-nhau-BY-DECISION + revisit-condition C3 đã viết).** Phát-biểu chủ-động: đã phủ đủ phần áp-được; KHÔNG nhận "12/12". + +## 4 mục 🟡 (form tùy dự-án) + +| 🟡 | SE form | +|---|---| +| Regex/ngưỡng detector | ratio-band 0.5–2.0 tự đặt; FP-guard `baseline\|S\d{2}` giữ (blind-spot có-chủ-đích, ghi engine §J.A) | +| Ranh-giới bracket | theo H8 owner-mandate (không demote); escape-hatch per-task | +| Nơi lưu sổ chốt-chặn | `reinject-ledger.md` git-tracked, TÁCH khỏi `memory-budget.json` (quyền anh) — đúng khuyến-nghị checklist | +| Promote-list | n-a (all-inherit — không gì để nâng) | + +## Mechanized-vs-convention tổng (đúng ghi-chú checklist) + +Mechanized THẬT: A1-A3 detector + B3 sweep-grep. Convention: B1/B2 quyết-đo, C3 khai xét-lại, D1 người-soi, D2/D3 kỷ-luật single-writer. **KHÔNG nhận mechanized cho kỷ-luật.** diff --git a/docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md b/docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md new file mode 100644 index 0000000..797e75e --- /dev/null +++ b/docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md @@ -0,0 +1,28 @@ +# adap-report — 2026-07-02-Governance-harness-18-architecture-consolidation (SE) + +> **Broadcast:** `2026-07-02-Governance-harness-18-architecture-consolidation.md` (outbox/all AI_INFRA). **Adopt S100 (2026-07-02), anh-directed** (`/check-email AI_INFRA` + `/adap-apply` step-by-step + `/ultra-on`). +> **Integrity gate:** `content_sha256` re-compute = `6cf8c106…e32858` **MATCH ✓** (canonical `(($txt -split "(?m)^---\s*$",3)[2] -replace "^\r?\n","")` UTF-8 — cùng phép match 2/3 file đợt này). ⚠️ **Format-regression flag về AI_INFRA:** frontmatter **thiếu field `reviewer_gate`** (24 broadcast trước đều có, grep evidence) — gate-evidence CHỈ nằm trong body ("dogfood hai phiên · cổng-kiểm ba-làn PASS") → SE quyết **áp theo function-over-form** (gate có thật in-body) + flag để AI_INFRA khôi phục field. +> **Harness-9 mandate 2-workflow:** WF1 investigate `wf_50a817ce-a69` (3 lane investigator-codebase, MODE-A return-delta, containment git-diff 0-residual + chunk 2431==2431) + WF2 review ``. + +## Nấc per-pattern (G-011: agreed / executed / verified) + +| Pattern | Nấc | Evidence | +|---|---|---| +| **A — freshness-detector** (mismatch-only · scan-range · exclusion) | **runtime-VERIFIED** (mechanized) | `scripts/governance-detectors.ps1` 3 edit: ratio-band sev 0.5–2.0 (mismatch-only confidence — sửa `\|diff\|≥10=MED` NGƯỢC-lớp) + `$derivedDocs` fixed-list→glob động (ALL skills SKILL.md + ALL commands *.md — vá lớp-mù "(68)" sống ~11 phiên) + self-exclusion re-verified. **Fault-inject 4/4** (temp-tree `-RepoRoot`): stale "68 gotcha" trong commands/ → MED ✓ · kể-lại-đúng "79 gotcha" → IM ✓ · module-local "6 test" → LOW ✓ · anti-Goodhart "88 bảng" → MED ✓. Real-repo: MED derived-stale 11→**0** (8 FP demote LOW), coverage +7 file mới, 0 self-match, exit-0 | +| **B — retire ledger trùng vai** (đo bắt-thật · nghỉ-hưu trung-thực · sweep consumers) | **executed** (đo=convention-với-số · sweep=mechanized-grep) | Đo (WF1-L3): ledger `runs/_ledger.md` true-orphan-catch **0/15 row lifetime** (đều open+close cùng-ngày 06-18, `⏳` chỉ legend) · folder/disk-scan H2 bắt thật 4+ memory-delta orphan (S57 · post-S57bis · S98×3 · S99#485) · mode-A coverage **0/8** workflow S93+. Freeze 🧊 1-dòng header `_ledger.md` (15 row GIỮ NGUYÊN, đảo-ngược=gỡ dòng). Sweep 15 điểm/8 file: `runs/README.md`×7 · `workflows/README.md`×2 · `session-start.md` §2.1.1 · `session-end.md` §L.b(f) · `agents/harvest-curator.md`×3 · `agents/README.md` G-015-cite · HC MEMORY baseline. Orphan-authority mới = folder-scan (`run.md` có mà `*-synthesis.md` VẮNG/0-byte). Grep dùng `_ledger` EXACT (repo có 5 "ledger" khác tên — tránh C3-fork) | +| **C — bracket model-allocation** | **1/3 executed + 2/3 n-a-by-owner-mandate** | Precondition raw-economics ĐÚNG (Fable > Opus) NHƯNG **H8 all-inherit = owner-directive 🔴 S66 "chất-lượng trên chi-phí"** (anh-chốt mọi sister) → không demote; escape-hatch `tier:'opus'` per-task GIỮ. C3 revisit-condition **VIẾT RA** (engine §J.C): anh đảo H8 / cost-pressure thật → dựng bracket + ≥3-run eval vs baseline. Caveat-2 broadcast cho phép n-a khi chi-phí "ngang nhau" — SE = ngang-nhau-BY-DECISION | +| **D — outcome-lane** (spot-check tươi · reinject · chốt-chặn) | **executed + dogfood n=1; D(b/c) REUSE-verified** | D(a) wired `session-end.md §L.b(i)` + **dogfood n=1 trong WF2-L3** (3 artifact đã-qua-cổng kiểm-lại tươi: H2 "0/14" đếm lại disk=14 ✓ · detector "0 self-match" re-grep ✓ · budget "measured" vs live-size ✓). D(b) reinject + D(c) chốt-chặn-lặp = **REUSE H17 §I B2** `reinject-ledger.md` CG-1 (≤1/N=3 + escalate anh) — dựng TRƯỚC broadcast, KHÔNG sổ mới | + +## Tailored / Skip / Phản-biện (§F4 + §M) + +- **Tailored:** ratio-band 0.5–2.0 = ngưỡng SE tự đặt (🟡 form — broadcast không ép số) · sweep giữ HISTORY-class nguyên vẹn (session-log/adap-report/archive/synthesis) · retirement marker song ngữ 🧊 + đảo-ngược 1-dòng. +- **Honest caveat-3 parity (phản-biện với chính mình, ghi rõ):** run-folder-orphan **chưa từng xảy ra ở CẢ 2 cơ chế** (0 data 2 phía — "S71 harvest/ rỗng" hoá ra là wording tiêu-chí, KHÔNG phải vụ catch; WF1-L3 ground-truth đính chính claim ban đầu của chính em-main) → căn cứ retire = coverage-cấu-trúc + chi-phí duy-trì + đã cần disclaimer-note S98, **KHÔNG phải** "cái mới bắt tốt hơn". Nếu AI_INFRA đọc đây thấy parity không đủ điều kiện floor B → phản-hồi, SE gỡ 1 dòng là revert xong. +- **Skip:** không có pattern nào skip-n-a toàn phần (C chỉ n-a 2/3 có lý-do). +- **No-overclaim (G-015):** mechanized THẬT chỉ = detector J.A + sweep-grep J.B; đo-quyết B + spot-check D + kỷ-luật C = **convention**. Command/agent `.md` edits = **executed-file, runtime từ session KẾ** (no hot-reload — ⚠️ anh restart CLI). + +## Codify + hậu-kiểm + +- Engine: `docs/governance/harness-11-engine.md` **§J** (4 khuôn-mẫu + honest nấc + frontier self-audit verdicts). +- Completeness-gate 12-sàn 🔴 → chi tiết `2026-07-02-Governance-checklist-harness-18.md` (report chị em): **10/12 ĐẠT + 2/12 n-a-reasoned**. +- Containment: git-diff dirty-set == em-main edit-set (13 file, 0 residual sub-write) · Qdrant 2431==2431. +- Email report → AI_INFRA (send-email kèm run-id + 2 flag: reviewer_gate-field-missing + frontier-hash-mismatch). diff --git a/docs/governance/harness-11-engine.md b/docs/governance/harness-11-engine.md index 076275a..40b24e0 100644 --- a/docs/governance/harness-11-engine.md +++ b/docs/governance/harness-11-engine.md @@ -278,6 +278,40 @@ SE đã có RAG golden-set harness (KHÔNG phải gap): `eval/golden-set-solutio --- +## PHẦN J — Harness-18: Kiện-toàn kiến-trúc (4 khuôn-mẫu additive) + frontier-method self-audit (🔴 FUNCTION-FLOOR + 🟡 form) + +> **Adopt S100 (2026-07-02)** — AI_INFRA broadcast `2026-07-02-Governance-{harness-18-architecture-consolidation, checklist-harness-18}` (content_sha256 re-compute **MATCH ✓ cả 2**; ⚠️ frontmatter cả 3 broadcast đợt này **thiếu field `reviewer_gate`** — 24 broadcast trước đều có; gate-evidence nằm trong body "dogfood 2 phiên · cổng-kiểm ba-làn PASS" → SE áp với reasoning ghi tường-minh + flag format-regression về AI_INFRA). Áp qua 2-workflow Harness-9: **WF1 investigate `wf_50a817ce-a69`** (3 lane investigator-codebase, return-delta MODE-A) + **WF2 review `wf_<điền-sau-WF2>`**. **Additive** — KHÔNG thay đợt nào trước. Broadcast chị-em `2026-07-01-…-harness-frontier-assessment`: **content_sha256 MISMATCH** khi re-compute (4 biến-thể canonicalization đều lệch; 2 file H18 MATCH → phép canonical đúng, body đã lệch stamp) → **HELD-integrity**: KHÔNG codify rule từ nó, CHỈ chạy self-audit vô-hại (kết quả dưới); chờ AI_INFRA verify/re-stamp. + +**J.A — Freshness-detector nâng-cấp (3 sàn 🔴 — mechanized, fault-inject 4/4 + real-repo verified S100):** +- **mismatch-only + ratio-band confidence:** `governance-detectors.ps1` C2 chỉ flag khi count-token LỆCH canonical (kể-lại-đúng = IM — fault-inject case-2); sev theo **ratio-band** — gần-canonical 0.5–2.0 = MED (stale-total khả-tín), xa = LOW (count cục-bộ-module) — sửa lớp FP cũ `|diff|≥10=MED` vốn NGƯỢC (S98 verify: 8/8 MED đều FP; post-fix real-repo: MED derived-stale 11→0, giữ 3 vocab-fork known). +- **scan-range theo dải THẬT:** `$derivedDocs` fixed-list → **glob động** (ALL `.claude/skills/*/SKILL.md` + ALL `.claude/commands/*.md`) — vá lớp-mù commands/ nơi "(68)" sống ~11 phiên (H1 F3 S99). +- **exclusion:** self-exclusion 6 path + `$ExcludeExact` (pre-existing, re-verified 0 self-match). +- 🟡 Honest: FP-guard `baseline|S\d{2}` skip-line = blind-spot có-chủ-đích (dòng chứa "Baseline" KHÔNG quét — dòng "130 PASS" session-start đã B1-pointer TAY S100); sev = confidence KHÔNG phải existence (total-cổ-đại "77 test"/440 → LOW advisory vẫn hiện). + +**J.B — Vệ-sinh sổ-ghi: retire `runs/_ledger.md` two-beat (🔴 đo-bắt-thật + nghỉ-hưu-trung-thực + sweep):** +- **Đo (WF1-L3, evidence-grade):** ledger true-orphan-catch = **0/15 row lifetime** (đều open+close cùng-ngày 06-18; `⏳` chỉ legend) · folder/disk-scan H2 bắt thật **4+ vụ memory-delta orphan** (S57 · post-S57bis 4-MISS · S98 ×3 · S99 cicd#485) · mode-A ephemeral (default S93+) → ledger coverage workflow gần đây = **0/8**. ⭐ Đính-chính ground-truth: "S71 `harvest/` rỗng" = **wording tiêu-chí** trong session-start, KHÔNG phải vụ catch — run-folder-orphan lifetime = 0 ở CẢ 2 cơ chế. +- **Caveat-3 parity (honest):** replacement KHÔNG "proven bắt tốt hơn" trên run-folder-orphan data (0 incident 2 phía) — căn cứ retire = **coverage-cấu-trúc (mode-A 0/8) + chi-phí duy-trì + đã cần disclaimer-note S98 chống nhầm**, KHÔNG phải catch-rate. +- **Nghỉ-hưu:** 1 dòng 🧊 header `_ledger.md` (đảo-ngược = gỡ dòng; 15 row GIỮ NGUYÊN — dời-đi không xoá). **Orphan-authority = folder-scan:** `runs//` có `run.md` mà `*-synthesis.md` VẮNG/0-byte (dual-accept `harvest/` run cũ). +- **Sweep 6 mandate-consumer + cites (mechanized-grep `_ledger` exact — 5 "ledger" khác tên trong repo, tránh C3-fork):** `runs/README.md` ×7 (:3/:38/L1/L2/§C6-header/:117/:127) · `workflows/README.md` ×2 (:20/:34-B3) · `session-start.md` §2.1.1-H2 · `session-end.md` §L.b(f) · `agents/harvest-curator.md` ×3 (:28/:44/:52-cite) · `agents/README.md` G-015-cite · + `agent-memory/harvest-curator/MEMORY.md` baseline re-ground. HISTORY class (session-log/adap-report/archive/runs-synthesis) GIỮ NGUYÊN. + +**J.C — Bracket phân-bổ model: 1 ĐẠT + 2 n-a-by-owner-mandate (🔴 điều-kiện xét-lại VIẾT RA):** +- Precondition raw-economics ĐÚNG (Fable > Opus 4.8 giá) NHƯNG **H8 all-inherit = owner-directive 🔴 S66 "chất-lượng trên chi-phí"** (anh-chốt, mọi sister) → KHÔNG demote lớp-việc nào; escape-hatch per-task `tier:'opus'` (hmw.js) GIỮ = cơ-chế hạ-bậc-theo-việc ĐÃ TỒN TẠI khi cần. 4 lớp không-hạ + 2-đầu = vacuously-held (mọi vai đang top-tier). Promote-list 🟡 = n-a (không gì để nâng). +- **Điều-kiện xét-lại (C3-floor, viết ra — đo được):** NẾU anh đảo H8 HOẶC áp-lực chi-phí thật xuất hiện → dựng bracket theo checklist H18-C, so ≥3-run eval vs baseline TRƯỚC khi cố-định; tới lúc đó C1/C2 hết n-a. (Caveat-2 broadcast: "chi-phí ngang nhau thì khuôn-mẫu không áp" — SE = ngang-nhau-BY-DECISION.) + +**J.D — Đóng làn kết-quả (🔴 3 sàn — 2 ĐẠT wired + 1 REUSE):** +- **D(a) spot-check tươi:** wired `session-end §L.b(i)` — session governance/review-heavy chọn 3–5 artifact đã tự-qua-cổng → kiểm-lại tươi bằng ground-truth. Dogfood n=1 S100 (WF2 lane-3). 🟡 Honest: n=1 = mẫu hiệu-chỉnh (caveat-1 broadcast), CHƯA "proven". +- **D(b) reinject-on-real-miss + D(c) chốt-chặn-lặp:** = **REUSE §I B2** `reinject-ledger.md` CG-1 (≤1/N=3 + escalate anh + đo-lại phiên kế) — H17 đã dựng ĐÚNG khuôn này TRƯỚC broadcast, KHÔNG sổ mới (chống C3-fork "ledger"). + +**Frontier-assessment self-audit (S100 — chạy dù broadcast HELD-integrity, vì self-audit vô-hại + có giá-trị riêng):** +- **P1 taxonomy-claim:** CLEAN — grep `\bMAST\b` = 0 repo-wide; error-ledger "3-axis tag" = internal scheme map Gov-v2 (KHÔNG claim external-taxonomy) → ma-trận anh-xạ n-a-legit. +- **P2 ghost-wire:** **1 THẬT = cron monthly** (`solution-erp-skill-audit-monthly`: CronList runtime = **0 job** + scheduler RỖNG 2026-05-04 + S96 chạy 13:04 em-main-in-session + CronCreate harness session-scoped không persist) → **honest-retire 5 file S100** (rules.md ×2 · CLAUDE.md · STATUS.md · session-start.md): audit monthly = thủ-công em-main theo cadence-pointer STATUS (function KHÔNG ghost — S44/S96 đều chạy đúng hạn; chỉ WIRING claim sai). +2 ghost-wire-config-key (mfe `role_file_glob`/`diary_path_pattern` defined-but-unread) + 1 latent blind-spot (selfimprove `:147` no-`tools:`-skip) → **defer đánh-số STATUS backlog D-1/D-2** (frontier HELD → không sửa vội). Cadence#4 + mọi auto-claim khác = WIRED hoặc disclaimed-no-daemon đúng convention G-015. +- **P3 measurer role-coverage:** 3/3 script (`mfe-eval` + `memory-selfimprove-audit` + `memory-archive-gate`) = **GLOB-LIVE**, 0 hardcode roster/"11" — agent thứ 12 tự-cử (WF1-L1 file:line). +- **P4 correction-cadence proxy:** ghi-nhận method, **KHÔNG áp** — 0 điểm-đau đo được hiện tại; áp-không-pain = chính "frontier-envy" mà broadcast cảnh-báo. + +**Honest nấc tổng §J (checklist 12 sàn 🔴):** **A 3/3 ĐẠT** (mechanized + runtime fault-inject 4/4) · **B 3/3 ĐẠT** (đo = convention-với-số-liệu WF1-L3 · retire = executed-file reversible · sweep = mechanized-grep + executed 15 điểm) · **C 1/3 ĐẠT (C3 revisit-condition executed-file) + 2/3 n-a-by-owner-mandate H8** (lý-do khách-quan viết rõ — caveat-2 broadcast) · **D 3/3 ĐẠT** (D-a wired + dogfood n=1 · D-b/D-c REUSE §I CG-1). **Phát-biểu chủ-động: 10/12 ĐẠT + 2/12 n-a-reasoned = phủ đủ phần áp-được.** Mechanized THẬT chỉ: J.A detector + J.B sweep-grep; phần còn lại = convention (KHÔNG nhận mechanized). 🟡 form 4 mục: detector-regex/ngưỡng tự đặt (ratio 0.5–2.0) · bracket-boundary theo H8 · sổ chốt-chặn = reinject-ledger git-tracked (REUSE) · promote-list n-a. + +--- + ## CAVEAT (trung-thực — đọc trước khi tự nhận "đã tự-bảo-trì") - **No-OS-hook:** detector + gate chạy TRONG thân session-start/end body do em-main kích — KHÔNG fully-autonomous. Đúng mức: **DÒ tự-động + toàn-diện; SỬA + GÁC dựa người-chủ-trì.** - **Auto-WRITE luật/copy = MỐI-NGUY #1, CỐ Ý CHƯA LÀM** — defer tới ≥2 sự-cố thật mà thủ-công thất-bại (hiện 0). Chọn nhánh chỉ-DÒ-NÊU-CỜ cho mọi thứ chạm luật/copy (1-sửa-sai → N-chỗ-sai + phá hash broadcast đóng-băng). diff --git a/docs/rules.md b/docs/rules.md index 20bf8ff..4dcb783 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -289,7 +289,7 @@ Co-Authored-By: Claude Opus 4.7 (1M context) |---|---|---|---| | **Cuối session** (đã làm tự động) | Update STATUS Recently Done + HANDOFF cảnh báo session tiếp | ~10 phút | Mỗi session có code commit | | **Cuối phase** (~1 tháng) | Compact STATUS Recently Done > 30 row → `changelog/recently-done-archive-{YYYY-MM}.md`. Collapse migration-todos Phase done thành 1 paragraph cross-ref session log | ~30 phút | Phase đóng | -| **Đầu mỗi tháng** (cron `solution-erp-skill-audit-monthly`) | Audit skill + doc drift + count consistency. Patch stale qua Edit (KHÔNG rewrite). Log kết quả | ~45 phút | 9:00 ngày 1 mỗi tháng | +| **Đầu mỗi tháng** (thủ-công em-main — 🧊 ghost-wire "cron fire 9:00" gỡ S100 H18/frontier-P2: CronList runtime = 0 job, cron session-scoped không persist) | Audit skill + doc drift + count consistency. Patch stale qua Edit (KHÔNG rewrite). Log kết quả | ~45 phút | Session đầu-tháng theo pointer next-date → `docs/STATUS.md` (canonical) | | **Khi trigger riêng** | Selective rewrite 1 file (skill drift > 30%, architecture redesign, phase major) | 1-2 giờ | Quantitative trigger | | **KHÔNG BAO GIỜ** | Rewrite toàn bộ docs | — | — | @@ -540,7 +540,7 @@ when-to-use: ### 9.4 Audit định kỳ — mỗi đầu tháng (chạy chung với doc audit §6.4) -**Cadence:** Đầu mỗi tháng, cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1 → chạy combined audit (skill + doc drift theo §6.4 checklist). +**Cadence:** Đầu mỗi tháng, **em-main chạy thủ-công trong session đầu-tháng** (next-date → `docs/STATUS.md` canonical; 🧊 ghost-wire "cron `solution-erp-skill-audit-monthly` fire 9:00" gỡ S100 — CronList runtime = 0 job, audit S44/S96 thực-tế đều em-main chạy in-session đúng hạn) → chạy combined audit (skill + doc drift theo §6.4 checklist). **Skill audit phần riêng (mỗi skill SKILL.md):** diff --git a/scripts/governance-detectors.ps1 b/scripts/governance-detectors.ps1 index 3957f00..1fe7719 100644 --- a/scripts/governance-detectors.ps1 +++ b/scripts/governance-detectors.ps1 @@ -212,13 +212,18 @@ $countPatterns = @( @{ Rx = ('(\d+)\s*(?:' + $VN_BANG + '|table)'); Key = 'table'; Label = 'table/bang' } ) +# H18-A(b) scan-range follows the REAL rule-range (S100, Harness-18 adopt): the derived-doc +# set expands DYNAMICALLY to ALL skill SKILL.md + ALL command *.md. Rationale (real pain): +# a stale hard-count "(68)" survived ~11 sessions inside .claude/commands/session-start.md +# because commands/ sat OUTSIDE this fixed list (blind class, H1 F3 catch S99). A fixed list +# self-ages as the rule-set grows; the glob tracks the live set. Test-Excluded still applies. $derivedDocs = @( 'CLAUDE.md', 'docs\CLAUDE.md', - '.claude\skills\ef-core-migration\SKILL.md', - '.claude\skills\README.md', - '.claude\skills\dependency-audit-erp\SKILL.md' + '.claude\skills\README.md' ) | ForEach-Object { Join-Path $RepoRoot $_ } +$derivedDocs += @(Get-ChildItem -Path (Join-Path $RepoRoot '.claude\skills') -Recurse -Filter 'SKILL.md' -File -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName }) +$derivedDocs += @(Get-ChildItem -Path (Join-Path $RepoRoot '.claude\commands') -Filter '*.md' -File -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName }) foreach ($doc in $derivedDocs) { if (-not (Test-Path $doc)) { continue } @@ -240,7 +245,15 @@ foreach ($doc in $derivedDocs) { if ($cp.Key -eq 'test' -and $post -match '^\s*project') { continue } # "N test project" = project count, not test count $n = [int]$m.Groups[1].Value if ($n -ne $canon) { - $sev = if ([math]::Abs($n - $canon) -ge 10) { 'MED' } else { 'LOW' } + # H18-A(a) mismatch-only CONFIDENCE band (S100): a stale TOTAL lags canonical + # by a few sessions so it lands NEAR canonical (ratio 0.5..2.0) -> MED. + # A module-local count ("6 test PeWorkflowDefinition" vs canonical 440) sits + # FAR from the total -> LOW advisory (likely a different quantity sharing the + # token word, NOT a stale claim). The old |diff|>=10 rule was BACKWARDS for + # that class (big diff = high sev = false alarm; S98 verify: 8/8 MED were FP). + # Correct restatement (n == canon) still never flags (mismatch-only base). + $ratio = if ($canon -gt 0) { [double]$n / [double]$canon } else { 0.0 } + $sev = if ($ratio -ge 0.5 -and $ratio -le 2.0) { 'MED' } else { 'LOW' } Write-Flag $sev ("{0}:{1}" -f (Rel $doc), ($i + 1)) ` ("derived-stale: writes {0} {1} but canonical={2}" -f $n, $cp.Label, $canon) ` ("update to {0} OR replace with pointer '-> docs/STATUS.md'" -f $canon) @@ -249,7 +262,7 @@ foreach ($doc in $derivedDocs) { } } } -Write-Host ' (note: count-token grep is a soft net - module-local phrases like "4 bang Budget" / "71 test (Phase 8)" can false-positive; treat LOW sev as review-not-fail)' -ForegroundColor DarkGray +Write-Host ' (note: count-token grep is a soft net - module-local phrases like "4 bang Budget" / "71 test (Phase 8)" can false-positive; H18-A ratio-band demotes far-from-canonical counts to LOW = review-not-fail, near-canonical stale-totals stay MED)' -ForegroundColor DarkGray # --------------------------------------------------------------------------- # C1 - broken-pointer: gotcha #N refs