[CLAUDE] Docs: adopt Harness-10 — tracked run-trace folder convention + checklist 9-10 (3-workflow invest/imple/review)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m36s

Migrate .claude/workflows/wave-*/ (gitignored) -> runs/<run-id>/ git-TRACKED (run.md+sub-md/+harvest/) + _ledger.md 2-beat + 3-layer anti-miss + containment model shift (B6 'any tracked-change=violation' -> 'tracked-change outside run-folder+code-disjoint=violation'). hmw.js wave->run-trace (accept args.run + alias). Review (R2+R3) caught C5 L1 over-claim -> fixed (em-main convention, engine no-fs). 3 run-id: wf_9c2cd2cd-2e7 / wf_e4e46725-231 / wf_636bc95b-939. 0 production code, state unchanged (Mig 53/88 tables/306 test/68 gotcha).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-06-18 09:15:51 +07:00
parent f3ad1a2ae0
commit 8c47bd0f0c
28 changed files with 467 additions and 69 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
# S71 (2026-06-18) — Harness-10 adopt: tracked run-trace folder convention + checklist 9-10 self-verify
**Trigger:** anh `--resume``/check-email AI_INFRA và /adap-apply harness-10 và check list 9-10` → chốt (AskUserQuestion) "full-adap + dogfood ngay qua HMW đủ các bước invest/imple/review đầy đủ, tránh sai sót".
**Loại:** governance/workflow-infra · **0 production code** · em-main + 3 Workflow (mandate Harness-9 PART 2).
---
## Bối cảnh
- `/check-email AI_INFRA`: 0 thư mới se-directed. Broadcast mới `outbox/all/2026-06-18-Governance-checklist-harness-9-10.md` (content_sha256 `ec32951a` MATCH, đọc UTF-8 tường minh #61).
- **KHÔNG có base broadcast Harness-10 file riêng** (grep toàn `broadcasts/` chỉ match checklist) → spec Harness-10 = **Part C (C1-C8) + CAVEAT** của checklist.
- Checklist 3 phần: A (Harness-9 memory, proposal — đã adopt S70) · B (adap 2-workflow, mandatory — codify S70) · **C (Harness-10 run-trace, mandatory — MỚI)**.
- Điểm-quyết-định (AskUserQuestion): Harness-10 C3 đảo ngược Harness-2 B6 gitignore (`.claude/workflows/wave-*/` transient-ignored → `runs/<run-id>/` tracked) → anh chốt full-adopt qua HMW.
## 3-stage Workflow (run-id = bằng chứng mandate B3)
| Stage | run-id | verdict |
|---|---|---|
| INVEST | `wf_9c2cd2cd-2e7` (4× investigator-codebase) | PASS — B+C+D strong; A trả stub structured-output nhưng ghi diary thật trên đĩa → self-gate bù |
| IMPLEMENT | `wf_e4e46725-231` (3× general-purpose file-disjoint + em-main cluster) | PASS — 3/3, containment CLEAN, wording đồng-bộ 4 file |
| REVIEW | `wf_636bc95b-939` (3× reviewer adversarial 3-lens) | PASS sau-fix — bắt C5 L1 over-claim |
Dogfood: 3 run-trace folder TRACKED đầu tiên (`.claude/workflows/runs/2026-06-18-h10-{invest,implement,review}/`) + 3 entry `_ledger.md` 2-nhịp.
## Thay đổi (migrate wave→run-trace)
- **`.gitignore`** — runs/ tracked qua negation `!.claude/**:83` (KHÔNG thêm dòng); wave-*/ giữ legacy-ignored + comment superseded; **exit-code-trap note** (`check-ignore` exit 0 cho CẢ negation lẫn ignore → `&& IGNORED || NOT`).
- **`hmw.js`** (em-main, live engine minimal-risk) — accept `args.run` primary + `args.wave` alias back-compat; path `sub-md/<role>-<i>.md`; wording containment model mới; 9 ref wave→RUN-TRACE. `node --check` PARSE-OK (R1 verify).
- **`workflows/README.md`** full-rewrite + NEW **`runs/README.md`** (C1-C7 + caveat trung-thực + verify-pattern).
- **`session-start.md:71`** L2 orphan-scan · **`session-end.md:51`** L3 close-gate idempotent-VERIFY-not-re-APPEND · **`agents/README.md`/`harvest-curator.md`/`tooling-auditor.md`** repoint.
## Review caught — C5 L1 over-claim (R2 + R3 độc-lập = high-confidence)
`runs/README.md` ban đầu (Agent 3) ghi L1 in-run reminder fire trong "hmw.js prompt-builder" với text cụ thể → grep hmw.js = 0. **Engine no-fs KHÔNG đọc được ledger** → L1 "check prior-run-harvested" KHÔNG THỂ là engine-prompt. **Fixed path-a (em-main):** L1 = em-main @P1 ledger-check convention (đọc `_ledger`, run trước `closed=⏳` → harvest+CLOSE trước) + C7 timing đồng-bộ. Verify: hmw.js L1-text=0 / C4-text=1 → doc khớp engine.
**Đây là giá trị cốt lõi của mandate B2** (review-workflow RIÊNG): 1-workflow-vừa-làm-vừa-tự-chấm đã bỏ sót (IMPLEMENT synthesis không nhắc L1); review độc-lập bắt TRƯỚC commit.
## Floor C1-C8 (nấc THẬT, honest)
C1 run-folder 3-phần ✓ · C2 scaffold-đầu-run (em-main @P1, engine no-fs) ✓ · **C3 tracked-eligible → COMMITTED** (sau commit; review bắt `git ls-files` rỗng = 2-level) · C4 per-turn harvest ✓ · C5 L2/L3 wired + L1 honest-doc ✓ · C6 ledger 2-nhịp ✓ · C7 caveat (reviewer khen "điểm sáng nhất") ✓ · C8 migration clean (0 wave-*/ remain) ✓.
## Residual / lessons
- **Race INVEST:** 4 same-role investigator tự-ghi chung `investigator-codebase/MEMORY.md` ("file modified since read") → +6 lines/29.8KB. Content hợp-lệ (R1/R2 verify, purely additive). **Fixed cấu-trúc:** hmw.js RUN-TRACE writeGuard cấm sub tự-ghi MEMORY (return-delta-only); custom workflow (như INVEST này) thiếu guard → lesson: custom Workflow script phải copy delta-guard. curate-debt: consolidate 3→1 + L1→L2 next.
- **4 reverse-findings → AI_INFRA** (B2.5): (1) C5-L1 không thể là engine-prompt (engine no-fs → lead-side) · (2) custom-workflow thiếu return-delta-guard gây same-role race · (3) check-ignore exit-code trap nên vào C3 self-verify · (4) C3 2-level (eligible vs committed) là bẫy thật, floor tách đúng.
## State (GIỮ NGUYÊN — adap không đụng production)
Mig 53 · 88 bảng · 306 test · 68 gotcha · menu 54 · bundle admin `BgNCjwsG`/user `CBvh0vtf`. + CLAUDE.md test-flush 263→306 (pre-existing uncommitted, resolve H1 stale-flag).
## NEXT
- ⚠️ Restart CLI: hmw.js RUN-TRACE runtime + carry §2.1.2/reviewer-Cat-6/H8-inherit.
- curate-debt **reviewer 33.8KB (over-soft) + inv-codebase 29.8KB** (S71 same-role races; cicd/impl-be OK post-S70) · monthly audit 07-01.
- Pending product/ops carry S69 (ngưỡng CEO · cờ gấp PE · tzutil · real-staff pw).

View File

@ -0,0 +1,54 @@
# adap-report — Checklist Harness-9 + Harness-10 (run-trace folder)
- **id:** 2026-06-18-Governance-checklist-harness-9-10
- **broadcast:** `ai_infra/broadcasts/outbox/all/2026-06-18-Governance-checklist-harness-9-10.md` (content_sha256 `ec32951a…` — verified MATCH, đọc UTF-8 tường minh per gotcha #61)
- **applied:** S71 (2026-06-18), em-main + 3 Workflow (invest→implement→review) + 3 reviewer
- **nấc (G-011):** **executed-file + VERIFIED (static)** — committed; runtime hmw.js pending-restart (no hot-reload)
- **PROJECT-FIT:** Part A (Harness-9 memory) = ĐÃ adopt S70 (self-verify lại) · Part B (adap 2-workflow) = ĐÃ codify S70 · **Part C (Harness-10 run-trace) = MỚI adopt S71 (lõi việc)**
## Mandate Harness-9 PART 2 — 3 workflow run-id (bằng chứng B3)
| Stage | run-id | verdict |
|---|---|---|
| INVESTIGATE (4× investigator-codebase) | `wf_9c2cd2cd-2e7` | PASS (B+C+D strong; A stub-return nhưng ghi diary thật → bù) |
| IMPLEMENT (3× general-purpose + em-main cluster) | `wf_e4e46725-231` | PASS (3/3, containment CLEAN, wording đồng-bộ 4 file) |
| REVIEW (3× reviewer adversarial) | `wf_636bc95b-939` | PASS sau-fix (R2+R3 độc-lập bắt C5 L1 over-claim → fixed) |
> Vượt sàn tối-thiểu 2-workflow (anh chốt "đủ 3 bước invest/imple/review, tránh sai sót"). Dogfood: chính 3 workflow này tạo 3 run-trace folder TRACKED đầu tiên + 3 entry ledger 2-nhịp.
## CHECK LIST 9-10 — nấc THẬT (honest, kiểm đĩa)
### PART A — Harness-9 memory (proposal, đã adopt S70) → 🟢
A1 budget.json ✓ · A2 measure-script + seed-by-measure ✓runtime · A3 gist additive distill-gen:1 ✓ · A4 coverage-diff (H2 verify) ✓ · A5 `_INDEX` 4 sub ✓ · A6 pointer-resolve substring-sha ✓ · A7 budget-audit @session-start (em chạy TAY S71) 🟡 automation pending-restart · **A8 gist-command tách-biệt = tailored: SE KHÔNG có command riêng, curate ad-hoc (function-floor "compress≠index" giữ)** · A9 `.ragignore` ✓.
### PART B — adap 2-workflow (BẮT BUỘC, codify S70) → 🟢
B1/B2 implement+review tách (3 run-id trên) ✓ · B2.5 reverse-findings (dưới) ✓ · B3 report+run-id (file này + email) ✓ · B4 short-but-confirm vẫn review ✓ (codify `adap-apply.md:38`).
### PART C — Harness-10 run-trace (BẮT BUỘC) → 🟢 MỚI
| C | nấc THẬT | bằng chứng |
|---|---|---|
| C1 run-folder 3-phần | executed-file | `runs/2026-06-18-h10-{invest,implement,review}/` đều run.md+sub-md/+harvest/ |
| C2 scaffold-cả-3-đầu-run | convention (em-main @P1, engine no-fs) | cả 3 run scaffold đủ từ đầu |
| **C3 git-TRACKED** | **tracked-eligible → COMMITTED** (sau commit này) | check-ignore NOT-IGNORED + **`git ls-files runs/` sau commit = non-empty** |
| C4 per-turn primary | executed-file | 3 harvest synthesis viết liền sau mỗi stage |
| C5 3-layer | L2/L3 wired (session-start/end) + L1 honest (em-main @P1 convention) | review bắt L1 over-claim → fixed |
| C6 ledger 2-nhịp | convention | `_ledger.md` 3 run OPEN+CLOSE + orphan def |
| C7 caveat | doc honest (reviewer: "điểm sáng nhất") | `runs/README.md` §C7 đủ 4 trục |
| C8 migration wave→runs | convention complete | wave-*/ giữ legacy ignored, runs/ tracked, 0 wave-*/ remain |
## Tailored (form) vs floor (function)
- **Tailored:** giữ tên biến `wave` nội-bộ hmw.js (accept `args.run` primary + `args.wave` alias back-compat — minimal-risk live-engine) · wave-*/ giữ legacy-ignored thay vì xóa (no wave-*/ remain, harmless) · A8 no dedicated gist-command (curate ad-hoc) · run-id folder = `2026-06-18-h10-<stage>` (date-slug).
- **Function-floor giữ nguyên:** run-trace TRACKED 3-phần · ledger 2-nhịp · 3-layer · containment-model-shift · caveat trung-thực · 2-workflow mandate.
## Reverse-findings (B2.5 — know-how chắt-lọc gửi ngược AI_INFRA)
1. **Engine no-fs làm C5-L1 KHÔNG THỂ là engine-prompt** — L1 "check prior-run-harvested" cần đọc ledger → BẮT BUỘC là lead @P1 convention, KHÔNG phải workflow-prompt. Checklist C5 nên ghi rõ L1 = lead-side (review của tụi em bắt đúng over-claim này khi 1 implement-agent tự-nhận "wired vào prompt-builder").
2. **Custom workflow (ngoài hmw.js) thiếu return-delta-guard → same-role fan-out race** (4 investigator tự-ghi chung MEMORY.md, "file modified since read"). hmw.js DEFAULT-mode đã có guard; custom Workflow script KHÔNG → đề xuất: mandate B nên nhắc "custom workflow phải copy return-delta-guard, KHÔNG để sub tự-ghi memory chung".
3. **check-ignore exit-code trap** (exit 0 cho CẢ negation lẫn ignore) — verify C3/C8 PHẢI dùng `&& IGNORED || NOT`, nếu không kết-luận ngược. Đáng đưa vào checklist C3 self-verify như guard tường-minh.
4. **C3 2-level (eligible vs committed) là bẫy thật** — review bắt `git ls-files` rỗng dù doc nói "tracked". Floor C3 đã tách 2-level rất đúng; tụi em confirm value của nó.
## Honest caveat
- hmw.js = source-clean + `node --check` PARSE-OK, NHƯNG runtime RUN-TRACE mode chưa chạy thật (no hot-reload → restart CLI mới active; SE ít dùng wave/run-mode nên forward-looking).
- A7 budget-audit + reviewer Cat-6 + H8 inherit vẫn pending-restart (carry S66/S70).
- `reviewer/MEMORY.md` 33.8KB (over-soft) + `investigator-codebase/MEMORY.md` 29.8KB (S71 same-role races REVIEW+INVEST, content hợp-lệ additive) = curate-debt (consolidate + L1→L2 next budget-audit).
- Review = static disk-truth (git/grep/node --check), KHÔNG curl/runtime (governance adap, no endpoint).
## Files (commit S71)
NEW: `runs/_ledger.md` · `runs/README.md` · `runs/2026-06-18-h10-{invest,implement,review}/{run.md,sub-md/,harvest/}`. MOD: `.gitignore` · `hmw.js` · `workflows/README.md` · `agents/README.md` · `harvest-curator.md` · `tooling-auditor.md` · `commands/session-{start,end}.md`. + `CLAUDE.md` (test-count flush 263→306, pre-existing, resolve H1 stale-flag). adap = governance/infra only, **0 production code · 306 test untouched**.