[CLAUDE] Docs: S135-S136 adap khung-nhip-nam-vong 7-item — tick da-diem-vao OR-guard+label-pin + force-fire consent + nhip-no-probe 3-ve + 2 detector H25 (fault-inject 9/9, FP W3 tail-adjacency classified) + residual do-token e0bb5bbf + luat non-JSON-args + sleep-khuon; AC A10/10 B6/6 C8/8; reviewer GO 0C/0M/2n

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-17 19:12:41 +07:00
parent 36ccf3bbe8
commit da349fc2c9
10 changed files with 413 additions and 39 deletions

View File

@ -95,6 +95,8 @@ const SCHEMA = {
}
// S4b — args có thể tới OBJECT hoặc JSON-STRING (harness đôi khi stringify object args) → normalize defensive
// 🔴 LUẬT (per 6c2eb2b1 — B6 non-JSON-args): args LUÔN là object JSON thật — dòng normalize NGAY DƯỚI là
// LƯỚI-CUỐI cho ca tầng-máy tự stringify, KHÔNG phải giấy phép để em-main tự stringify args khi gọi.
const A = (typeof args === 'string') ? JSON.parse(args) : (args || {})
if (!A || !Array.isArray(A.taskList) || A.taskList.length === 0) {

View File

@ -70,7 +70,7 @@ Adap-report mới (wave) + cập nhật/append adap-report liên quan + email hu
| ⚑DP-3 | force-fire qua **consent-gate** (INFORM bắt buộc + đề-xuất) | luật cứng owner-era `:94/:203` + hẹn hub "owner-triggered"; reviewer phán carve-out HỢP LỆ — báo hub "PASS-với-carve-out" | đổi 1 câu (vi) thành auto-run |
| ⚑DP-4 | reconcile `fable-real.md:31` spec-pointer + dogfood wave này | B6 chốt-2 = function-floor BẮT BUỘC; scope cấm vào **spec/nguồn** (n-2) | revert 1 dòng, quay prompt-embed |
| ⚑DP-5 | giữ INFORM 7d + byte-display **wire ở LANE-A 2 site runtime** (M-10); anh đặt ngưỡng sau | đổi số = quyền anh; ngày-lịch cục-bộ hợp lệ B1 §3.4; tránh ghost-wire | anh cho số → đổi 1 điều-kiện INFORM |
| — | light-run-now KHÔNG chạy (moot: OVERDUE tự fire @counter 9 sau wire+restart, consent-gate giữ) | tick S136 → 9 ≥ 3+6 | anh gật → spawn cặp H24 ngay |
| — | light-run-now KHÔNG chạy (moot: OVERDUE tự fire sau wire+restart, consent-gate giữ) | tick S136 → **10** ≥ 3+6 *(reviewer n-2 @S136: bản đầu ước 9 — thiếu đếm tick S135 @pause; OVERDUE:light vẫn fire 10≥9, logic không đổi)* | anh gật → spawn cặp H24 ngay |
## ③ Checklist (vai + deliverable + acceptance ĐO ĐƯỢC)
@ -85,7 +85,7 @@ AC-B: (1) probe chạy 2 lần → output byte-y-hệt (phép 5) + 0-mutation (`
**LANE-C — residual + doc + sleep-cmd (Items 6 + 7 + 8-phần-cmd, TRỪ `:206` và INFORM-byte đã sang LANE-A):** sửa `memory-budget.json` (:65 :90 :121) + append 2 note adap-report san-su-that + `hmw.js` comment-luật + `fable-real.md` (:31 reconcile + câu luật) + `sleep-recovery-memory-l2.md` (2 chốt + optional assert + bảng Trigger mô tả). **0 file trùng LANE-A/B.**
AC-C: (1) `grep -rn "draft 2026-07-15"` ngoài {runs/, broadcasts/, docs/governance/adap-reports (dòng `:19` GIỮ lịch-sử + note mới), **`.claude/agent-memory/**` (diary lịch-sử — CẤM sửa để làm xanh grep)**} = **0 site sống** (baseline 2 site sống + 1 diary-mention); (2) `grep -c "e0bb5bbf" memory-budget.json` = 2 và `:121`-vùng chứa `e50a4bd0` **và caveat `chua ai duoc ban`** (M-3); (3) *(→ AC-A(7))*; (4) adap-report san-su-that có 2 append (đóng-ask + flip-4c **executed-inferred**, hedge M-8) additive; (5) `hmw.js` + `fable-real.md` mỗi file có câu luật object-thật (viết relative n-1); (6) `fable-real.md:31`-vùng = bản reconcile spec-pointer (scope n-2); (7) sleep cmd chứa `cross-file bleed` + `grep nguoc`/`grep-ngược` (+ optional per-file assert); (8) JSON valid sau sửa (`ConvertFrom-Json` pass) + budget.json giữ ASCII-không-dấu.
**Post-merge (LEAD, không lane):** reviewer pre-commit (vai `reviewer`, worker-tier opus+max) → **commit wave = `git add` ĐÍCH-DANH** {`.claude/commands/*.md` ×5 sửa · `scripts/nhip-no-probe.ps1` · `scripts/governance-detectors.ps1` · `.claude/workflows/hmw.js` · `.claude/governance/.session-counter.json` · `.claude/agent-memory/memory-budget.json` · `docs/governance/adap-reports/*` · run-folder} — đa số NGOÀI hook-3-path; **acceptance: sau commit `git status --porcelain` các path này RỖNG** (M-7) → **RESTART Claude Code bắt buộc** (command `.md` no-hot-reload, `pause.md:9`) → phiên kế: đo phép 7 (1 chu-kỳ pausetiep → counter +1 = 9) + phép 1 cửa-sổ mới + light-OVERDUE fire @9 (consent-gate) → Item 9 báo hub kèm số + STAGE-2.
**Post-merge (LEAD, không lane):** reviewer pre-commit (vai `reviewer`, worker-tier opus+max) → **commit wave = `git add` ĐÍCH-DANH** {`.claude/commands/*.md` ×6 sửa *(reviewer n-1 @S136: tiep·pause·session-end·session-start [LANE-A, đã vào HEAD qua wal:] + fable-real·sleep-recovery [LANE-C] — bản đầu ghi ×5 thiếu đếm; glob vẫn bắt đủ)* · `scripts/nhip-no-probe.ps1` · `scripts/governance-detectors.ps1` · `.claude/workflows/hmw.js` · `.claude/governance/.session-counter.json` · `.claude/agent-memory/memory-budget.json` · `docs/governance/adap-reports/*` · run-folder} — đa số NGOÀI hook-3-path; **acceptance: sau commit `git status --porcelain` các path này RỖNG** (M-7) → **RESTART Claude Code bắt buộc** (command `.md` no-hot-reload, `pause.md:9`) → phiên kế: đo phép 7 (1 chu-kỳ pausetiep → counter +1 = 9) + phép 1 cửa-sổ mới + light-OVERDUE fire @9 (consent-gate) → Item 9 báo hub kèm số + STAGE-2.
**Baseline mốc so (T6 đo 17-07, lead verify + reviewer re-đo 4/4 khớp):** counter=8/S133 (tick S133 uncommitted — governance-drift, M-7 bịt) · phép-1 FAIL: +3 tick / 9 nhãn-phiên / 7 `wal: pause` cửa-sổ `(e9124fc..a6cd0a2]` · phép-3 PASS 3/3 union-per-label · phép-4 PASS 14/14 · orphan=1 (S135 self-open) · H1/H2 last-vết `72f68d1` (S133/S134 closeout KHÔNG spawn cặp = vòng-1 tự-verify FAIL sống) · un-gisted 2026-07 ≈183KB/5 file · `last_sleep_at=2026-07-10` · `e0bb5bbf` trong budget.json = 0 (post-wave 2) · diary-mention `investigator-codebase/MEMORY.md:23` (lịch-sử, giữ nguyên).

View File

@ -15,4 +15,4 @@
- [x] 0. hmw 1-task LANE-B remainder (wf_c3a56fef-520, ~20min, return CLEAN 0-garble) — 2 detector H25 appended + fault-inject 9/9 PASS + real-repo AC-B(5)
- [x] 1. lead verify: H25=4 · parse 0-err · pure-ASCII 0 · detector re-run output khớp lời khai 100% · FP W3 re-verified git độc-lập 3/3 (72f68d1 chứa HANDOFF + session-log ADDED, 9e874ca parent=72f68d1) · sub-task-0.md gốc S135 NGUYÊN 8187B (không đè) · isolation clean → `implement-synthesis.md`
- [!] 2. reviewer pre-commit (sub-reviewer-0.md folder này) → commit wave đích-danh M-7
- [x] 2. reviewer pre-commit **GO_WITH_FIXES 0C/0M/2n** (sub-reviewer-0.md folder này; tự re-run detector + tự dựng fault-tree riêng + FP W3 confirm độc-lập + tick contract OK + M-7 add-list đủ + honesty clean) → 2 fix n áp vào spec (annotation ×6 cmd + tick→10) → commit wave đích-danh

View File

@ -1,47 +1,78 @@
# sub-reviewer-0 — ADVERSARIAL PRE-COMMIT REVIEW (S136 laneB-remainder + full wave)
> Vai: reviewer (READ-ONLY code; Write only to THIS trace file). Anti-#53: ghi-đĩa-trong-lúc-làm.
> VERDICT ở CUỐI file (cập nhật liên tục). Nếu return garble → file này là nguồn cứu.
> VERDICT ở CUỐI file. Nếu return garble → file này là nguồn cứu.
## Scope
- Wave adap khung-nhịp-năm-vòng S135→S136, 7 item AI_INFRA.
- Diff: (a) committed origin/main..HEAD (LANE-A cmd + counter) + (b) working-tree M (LANE-C + LANE-B detector + probe ??).
- Spec canonical: runs/2026-07-17-S135-.../spec-adap-khung-nhip-17-07-2026.md §② Items 1-8 + §③ AC-A/B/C.
---
## PROVISIONAL VERDICT (updated as I go)
VERDICT: (pending — investigation in progress)
## ★ FINAL VERDICT
**VERDICT: GO_WITH_FIXES 0C/0M/2n** — COMMIT MAY PROCEED (0 Critical, 0 Major; 2 nice-to-have là spec-annotation drift, KHÔNG chặn commit). Wiring/code/detector đều đúng; đã live-verify + independent teeth-proof.
---
## A. Detector H25 code audit (Category 2 — core) — governance-detectors.ps1:900-1091
## A. Detector H25 code audit (Item 4+5) — governance-detectors.ps1:900-1091
### A1. H25-closeout-ritual (Item 4) — MATCHES spec
- Regex L930 `^\[CLAUDE\] Docs: S\d+.*(?:closeout|session-end)` held-in-var, applied to git SUBJECTS only (L943) → 0 self-match / citation-trap avoided.
- Window `$prev.Hash..$cur.Hash` (L967) = git HALF-OPEN (prev,cur] = spec "(closeout-trước-nó..nó]". OK.
- NEW-session `--diff-filter=A -- docs/changelog/sessions/` (L974). OK. 4 books L978-981 (STATUS/HANDOFF forward-slash literal; agent-memory `^\.claude/agent-memory/` forward-slash = git canonical). OK.
- (iv) skip-no-predecessor L962; non-git-tree skip L933/952. OK.
- HONEST-LIMIT comment L916-921 documents S132-tail FP + do-not-special-case + surface-to-owner. Matches spec + S81 honesty.
### A2. H25-role-notebook (Item 5) — MATCHES spec
- roster minus README L1009-10; greedy 2-step parse L1028-29 (safe direction, won't false-map); has-run = mapped OR diaryExists L1041; 0-byte anti-Goodhart L1047 (0-byte→flag); UNMAPPED INFORM-only L1059-63. OK.
### A3. Summary/C4 L1069-85 self-match assert; exit 0 L1091. OK.
**Verdict: structurally MATCHES Items 4+5. No lệch-thật. 1 lệch-chấp-nhận-được = S132-tail FP (documented, fails-safe-direction).**
### A1. H25-closeout-ritual (Item 4) — line-by-line vs spec
- Regex `$CloseoutSubjectRx = '^\[CLAUDE\] Docs: S\d+.*(?:closeout|session-end)'` (L930). Spec wrote capturing `(closeout|session-end)`; code uses non-capturing `(?:...)` — functionally identical for -match. OK.
- Held-in-variable + only applied to git SUBJECTS (L943), never to scanned files → 0 self-match / citation-trap avoided. OK (matches feedback_citation_trap lesson).
- Window = `$prev.Hash..$cur.Hash` (L967) → git range is HALF-OPEN (prev, cur]. Matches spec "(closeout-trước-nó .. nó]". OK.
- `git log --name-only --pretty=format: $range` (L970) union of all touches. OK.
- NEW-session = `--diff-filter=A ... -- docs/changelog/sessions/` (L974) non-empty. Matches spec "sửa file cũ ≠ có log mới". OK.
- 4 books check L978-981:
- STATUS: `$union -contains 'docs/STATUS.md'` — git emits forward-slash paths → literal matches. OK.
- HANDOFF: same. OK.
- NEW-session: `$newSess.Count -eq 0`. OK.
- agent-memory: `$union -match '^\.claude/agent-memory/'` — forward-slash (git canonical), matches. OK.
- (iv) skip-no-predecessor: L962 `if ($i+1 -ge $closeouts.Count)` → skip msg, no crash. OK.
- Non-git-tree: L933 `Test-Path (Join-Path $RepoRoot '.git')` → skip w/ reason L952. OK.
- HONEST-LIMIT comment L916-921 = documents the S132-tail FP + says do-not-special-case + surface to owner. Matches spec Item 4 intent + honesty (S81).
## B. LIVE runtime verification (không tin evidence — tự chạy lại)
- **AC-B5 detector real-repo:** RE-RAN. Output = sub-task-0 claim ĐÚNG 100%: closeouts 73, 2 PASS (99fc373 S134 [ok], e53a693 S133 [ok]) + 1 FLAG (9e874ca S132 missing 2/4 = HANDOFF+NEW-session). role-notebook roster=14 diaries-ok=14 flagged=0 UNMAPPED=27. self-match=0. TOTAL FLAGS 46.
- **AC-B1 probe determinism:** RE-RAN ×2 → byte-identical `NHIP-NO: kiem light 7/6 deep 7/15 OVERDUE:light | tran-bo-nho 0 over-cap | run-chua-gom 0`, exit 0 cả 2.
- **AC-B2 nonexistent RepoRoot:** `probe-loi (khong chan)` + exit 0. OK (không chặn).
- **Probe 3-vế đo độc-lập:** vế-1 counter=10 last_audit=3 light_every=6 → a=7≥6 OVERDUE:light; deep 7/15 ok. ✓. vế-2 cap=25600, cả 14 MEMORY.md < cap (max investigator-codebase 23420) 0 over-cap. ✓. vế-3 mọi folder run.md đều *-synthesis.md (S136 implement-synthesis.md 3572B) 0 orphan. (2 folder S117 KHÔNG run.md skip đúng contract).
### A2. H25-role-notebook (Item 5) — line-by-line vs spec
- roster = agents/*.md minus README (L1009-1010). OK.
- greedy 2-step parse L1028-1029: `^sub-(.+)-\d+\.md$` then `^sub-(.+)\.md$`. Greedy `.+` — analyzed edge cases (reviewer-1-verdict → UNMAPPED; investigator-codebase-0 → mapped). Safe direction (won't false-map roster). OK.
- has-run = mapped-sub OR diaryExists (L1041). On real repo all 14 have diaries → prefix-map irrelevant to flag result, only affects UNMAPPED INFORM list.
- 0-byte anti-Goodhart L1047: `if ($diaryExists -and $bytes -gt 0){ok} else{flag}` → 0-byte → flag. OK.
- UNMAPPED INFORM-only L1059-1063. OK (S122 measure-content-not-name).
## C. INDEPENDENT TEETH-PROOF (temp git tree -RepoRoot, S95 — KHÔNG tin fault-inject của worker)
Tự dựng cây tạm + inject gap, chạy detector:
- **closeout FLAG:** fake S11 closeout (chỉ chạm foo.txt) FLAGGED "missing 4 of 4 books". TEETH (không always-pass).
- **role 0-byte anti-Goodhart:** truncate lead-view-auditor diary 0-byte FLAGGED "0-byte (empty notebook)", diaries-ok=1 flagged=1. TEETH ✓.
- **role MISSING:** delete reviewer diary FLAGGED "diary is MISSING", flagged=2. TEETH ✓.
- PASS-direction đã chứng trên repo thật (W1/W2 [ok], role 14/14). **Cả 2 detector có RĂNG 2 chiều, độc-lập xác nhận khớp matrix worker (c-i/r-i/r-iv).**
### A3. Summary/C4 self-exclusion L1069-1085 — asserts 0 self-match + 0 leaked-excluded. exit 0 L1091. OK.
## D. FP W3 — phán ĐỘC-LẬP (task item 3)
Git verify: `9e874ca` (S132 closeout-tail) parent = `72f68d1`; window (72f68d1..9e874ca] = CHỈ 9e874ca; `72f68d1` (lower-bound bị LOẠI) chứa `sessions/2026-07-17-S131-S132-...md` **ADDED (--diff-filter=A)** + touch HANDOFF+STATUS.
- **(i) Classification ĐÚNG:** W3 = FALSE POSITIVE thật (tail-adjacency: ritual của batch S131-S132 nằm trọn commit lower-bound bị loại). Fails-SAFE-direction (over-flag, không under-flag). NOT silenced (đúng S95/Goodhart). Đồng-thuận worker + lead (implement-synthesis L20 khớp git-check của tôi).
- **(ii) Per-label folding = đúng-hướng NHƯNG mở lỗ:** fold cùng-nhãn-batch GIẢM FP tail-adjacency, nhưng MỞ lỗ false-NEGATIVE: nhiều phiên gộp 1 nhãn `S<a>-S<b>` phiên sau "ăn " ritual của phiên đầu phiên giữa trốn ritual window vẫn PASS. Worker+lead KHÔNG tự-áp + treo owner = ĐÚNG (reshape đo để xanh = cấm). FP hiện-tại ship được vì: documented in-code + fails-safe + fix owner-mechanism-decision.
**Detector code verdict so far: structurally MATCHES spec Items 4+5. Now verifying RUNTIME (AC-B5) + FP W3 + fault-inject spot-run.**
## E. Tick S136 (task item 4) — ĐÚNG _contract.tick
counter=10, last_ticked_session=S136, last_ticked_head=a7bafd5. a7bafd5 REACHABLE từ HEAD 9d32f89 ancestor-check PASS, **KHÔNG fail-loud oan**. OR-guard idempotent: S1359, S13610 (2 nhãn-phiên phân-biệt = +2 từ baseline 8). Monotonic (no regress, fail_loud_on_regress không kích). Pointer §2.1.8 canonical TỒN-TẠI (L181-193 OR-guard đầy đủ) pointer từ tiep/pause/session-end resolve THẬT (không dangling).
- **n-2 (nice-to-have):** spec DP-table :73 ghi "tick S136 9 3+6" nhưng ACTUAL counter=10 (spec under-count: KHÔNG tính S135 tick như nhãn-phiên riêng). Logic ĐÚNG; chỉ narrative-estimate lệch 1. OVERDUE:light vẫn fire (109). Post-restart phép-7 (S137 pause-tiep) vẫn +1 đúng (OR-guard per-label). Cosmetic.
---
(continuing...)
## F. M-7 add-list (task item 5)
Working-tree wave files: fable-real.md, sleep-recovery-memory-l2.md, .session-counter.json, hmw.js, adap-report, governance-detectors.ps1, ?? nhip-no-probe.ps1, run-folder S136. TẤT được cover bởi glob add-list spec §③. LANE-A cmd (tiep/pause/session-end/session-start) ĐÃ committed qua `0363495 wal: pause` (dogfood pause.md:34 add-list mới counter+file-dở). counter.json S136-tick delta uncommitted glob/explicit listing bắt. **0 stray file ngoài add-list.**
- **n-1 (nice-to-have):** spec §③:88 ghi "`.claude/commands/*.md` ×5 sửa" = UNDERCOUNT thật 6 cmd đổi (tiep/pause/session-end/session-start + fable-real/sleep-recovery). Glob `*.md` bắt hết 6 nên KHÔNG rớt IF dùng glob; nhưng nếu lead enumerate theo con-số "5" thì rớt 1. Đề-xuất: sửa annotation →×6 hoặc xác-nhận dùng glob (M-7 acceptance `git status --porcelain` rỗng vẫn thoả 4 file đã committed + 2 file glob-bắt).
## G. Honesty-presentation (task item 6) — S81 PASS
- sub-task-2.md L16: nhãn tường-minh "🔴 LEAD SCRIBE ON-BEHALF ... Phần dưới do lead ghi SAU KHI verify-đĩa 8/8, KHÔNG phải lời worker" + phân disk-truth vs lost-narrative (đúng feedback_return_terminates + #53). VERDICT nhãn "lead re-run AC-C @S136". KHÔNG worker-self-attest giả.
- implement-synthesis.md L3 "VERIFIED bởi lead (không phải lời worker)".
- Flip-4c nấc = "executed-inferred" (🔴 KHÔNG "verified"), giữ 2 caveat (S119). Hedge đúng. Nấc tick-wire = executed/verified-pending-restart (phép-7 đo SAU restart cmd .md no-hot-reload). KHÔNG claim vượt bằng-chứng.
## H. 6-category rollup
- Cat1 Wire (detector/probe/cmd wiring, không BE-endpoint): PASS live-verify tất.
- Cat2 Schema: N/A (0 migration). PASS.
- Cat3 Security: N/A (script read-only exit 0, 0 auth). PASS.
- Cat4 Code quality: PS5.1 pure-ASCII (60003B, 0 byte>127), parse 0-err, isolation LANE clean, no --no-verify. PASS.
- Cat5 Test/teeth: fault-inject 9/9 + independent teeth-proof 3-ca (mine). PASS.
- Cat6 Writing (adap-report outward): 2 append full-grammar VN đủ dấu. PASS. (cmd .md internal-compressed OK.)
## Nice-to-have (non-blocking, optional)
- **n-1:** spec §③:88 "×5 cmd .md" → thật ×6 (annotation drift; glob mitigates). Đề-xuất sửa ×6 / confirm glob.
- **n-2:** spec DP-table :73 "tick S136→9" → actual 10 (narrative off-by-1; logic đúng). Cosmetic.
- **info:** lead tạo implement-synthesis.md + update run.md @17:49-50 CONCURRENT với review (moving-target nhẹ); implementation content ổn-định, file review của tôi intact. Không phải lỗi, chỉ ghi-nhận ordering.
- **info (DP-2 accepted-noise):** tick head=a7bafd5 (wal:flush) — closeout kế squash wal-commit → phiên kế-kế có thể fail-loud oan (đã khai spec DP-2, có vết, không mất số).
## Positives đáng nhớ (resisted scrutiny)
- Pointer-integrity: 3 tick-point CON-TRỎ §2.1.8 (không chép logic) + target TỒN-TẠI thật — AC-A(4) risky-case CLEAN.
- Detector teeth độc-lập-chứng 2 chiều; FP classified-not-silenced (Goodhart-resist).
- exclusion-set AC-C(1) đúng nghĩa: 2 site sống fixed, excluded-zone (diary/adap:19/runs) giữ đúng.
- Probe 3-vế số đúng hết khi tự đo lại (cap 25600, 7/6 arithmetic, orphan 0).