Files
solution-erp/docs/governance/adap-reports/2026-06-17-Governance-harness-9-l2-recovery-and-adap-workflow.md
pqhuy1987 f36aab8934
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 4m52s
[CLAUDE] Docs: adopt Harness-9 — L2 archive dark-matter recovery (4 sub) + adap 2-workflow mandate (S70)
3-stage Workflow run-id evidence: investigate wf_be952f3c-97f / implement wf_a58e0d15-beb / audit wf_9520d8cd-4fe.

PART 1 (L2 recovery): 4 over-cap sub (cicd-monitor/investigator-codebase/reviewer/implementer-backend)
curated L1->L2 byte-exact + archive/_INDEX.md (substring sha-keyed pointers, no line-hints)
+ <period>.gist.md (4-field distill, distill-gen:1, verbatim frozen). All 4 MEMORY.md now < 25KB
auto-inject cap (closes P1 curate-debt). ~240KB archive no longer RAG-dark. 0-byte-loss git+sha
verified (Stage C audit + em-main self-gate on 2 reviewer StructuredOutput no-returns). Read-side
gap fixed (MEMORY.md L5 header -> _INDEX). + memory-budget.json (seed-by-measure) +
scripts/measure-agent-memory.ps1 + .ragignore guard.

PART 2/3 (process mandate): every adap = 2 separate workflows (implement + review) + report with
run-id; short-but-needs-confirm still requires review. Codified in .claude/commands/adap-apply.md
+ agents/README.md (Upgrade S70) + session-start.md (§2.1.2 budget-audit, pending-restart).

adap-report + email-back to AI_INFRA (body-hash 7c07b716e775).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 23:52:51 +07:00

9.3 KiB

id, from, applied_by, applied_date, nac, project_fit, source_content_sha256, run_ids
id from applied_by applied_date nac project_fit source_content_sha256 run_ids
2026-06-17-Governance-harness-9-l2-recovery-and-adap-workflow ai_infra se (SOLUTION_ERP) 2026-06-17 executed-file + VERIFIED (0-byte-loss git+sha-proven; Stage C audit) · session-start §2.1.2 budget-audit = pending-restart full (PART 2/3 process-mandate áp trọn; PART 1 L2-recovery fit cao — SE có ~240KB archive dark-matter thật) e6dca9f95c21e61a6a0d963c78798ad6ca230d416ae37e9dbd811f35abac11ae
stage_a_investigate stage_b_implement stage_c_audit
wf_be952f3c-97f wf_a58e0d15-beb wf_9520d8cd-4fe

Adap-report — Harness-9 (L2 archive dark-matter recovery + adap 2-workflow mandate)

SOLUTION_ERP (sister se) áp broadcast 2026-06-17-Governance-harness-9-l2-recovery-and-adap-workflow của AI_INFRA. Anh chốt phạm vi: "đầy đủ nhất, làm cẩn thận từng stage — investigate → implement → audit". Báo cáo ghi đúng nấc trạng thái thật, kèm bằng chứng (run-id + byte + git), phần tailor theo roster thật của SE, và caveat trung thực.

1. Broadcast yêu cầu gì

  • PART 2 — 🔴 FUNCTION-floor (mandate, áp MỌI adap từ nay): mỗi lần adap 1 Harness phải đi qua 2 workflow tách biệt (IMPLEMENT + REVIEW double-check RIÊNG) + REPORT về AI_INFRA kèm run-id làm bằng chứng. Số agent mỗi workflow tùy dự án tự cân; cái bắt buộc là cấu trúc 2-workflow.
  • PART 3 — 🔴 FUNCTION-floor: task ngắn-nhưng-cần-confirm (có điểm-quyết-định) VẪN bắt buộc review-workflow — không áp lối tắt "việc vặt làm 1 mình".
  • PART 1 — PROPOSAL (tailor tự do): cứu tầng L2 archive "vật-chất-tối" (không vào RAG): write-side nén <period>.gist.md ADDITIVE (file mới, verbatim frozen) + read-side mục-lục _INDEX.md (inject bản-đồ, không inject lãnh-thổ) + memory-budget.json seed-by-measure + budget-audit @session-start + command nén gist (chỉ-nén, không kiêm build-index).

2. PROJECT-FIT — full

SE có dark-matter THẬT: 4 sub-agent over-cap với archive không vào RAG (corpus glob chỉ match MEMORY.md):

Agent L1 trước L2 archive (dark)
cicd-monitor 65.2KB 136.6KB (5 file)
investigator-codebase 47.0KB 38.8KB (4 file)
reviewer 43.5KB 22.2KB (2 file)
implementer-backend 33.2KB 42.6KB (4 file)

~240KB archive vô hình với RAG. Việc này TRÙNG đúng P1 curate-debt (4 sub over-cap) mà 2 monitor H1/H2 flag đầu session → adopt Harness-9 = vừa cứu dark-matter vừa đóng curate-debt một lượt.

3. SE đã làm gì (tailored theo roster thật + anh chốt "đầy đủ nhất, 3 stage")

3a. PART 2/3 process-mandate (codify — em main single-writer governance)

  • .claude/commands/adap-apply.md — thêm mục "🔴 Harness-9 mandate: adap 2-workflow" (IMPLEMENT + REVIEW + report-with-run-id) + PART 3 short-confirm→review.
  • .claude/agents/README.md — "Upgrade S70 (Harness-9)" + L2 _INDEX/gist tier trong Tiered Memory Policy.
  • .claude/commands/session-start.md — §2.1.2 Memory L2 budget-audit (pending-restart, command no hot-reload).

3b. PART 1 L2-recovery — chạy qua 3 Workflow run-id (stage investigate → implement → audit)

  • Stage A INVESTIGATE (wf_be952f3c-97f, 4 investigator-codebase //): recon 4 archive → build-plan + quyết định con-trỏ = substring sha-keyed (KHÔNG anchor-slug: slug-collision same-date + Vietnamese-diacritic/em-dash fragility + cicd 2026-06.md ZERO heading) + KHÔNG line-hint (additive shift dòng).

  • Stage B IMPLEMENT (wf_a58e0d15-beb, 4 //, file-disjoint): mỗi sub curate L1→L2 byte-exact → _INDEX.md.gist.md. Kết quả:

    Agent L1 sau moved markers _INDEX ptr git additive
    cicd-monitor 23.2KB 10 22/22 76/76 +13 -0 verbatim
    investigator-codebase 24.1KB 15 22/22 37/37 +25 -0 verbatim
    reviewer 24.8KB 9 19/19 19/19 new file
    implementer-backend 17.4KB 14 20/20 41/41 new file

    Cả 4 nay < 25.6KB auto-inject cap (P1 curate-debt CLOSED, lần này CÓ _INDEX/gist nên archive hết "tối").

  • Em main shared infra: .claude/agent-memory/memory-budget.json (seed-by-measure), scripts/measure-agent-memory.ps1 (đo byte THẬT → JSON, ASCII-only), .ragignore (defensive exclude _INDEX/gist khỏi corpus).

  • Stage C AUDIT (wf_9520d8cd-4fe, 4 reviewer //): độc-lập verify 0-byte-loss + pointer-resolve + coverage-diff (semantic, né 3 false-flag negation/catalog-count/lens-cite).

3c. Evidence 0-byte-loss (THE invariant)

  • Verbatim frozen byte-unchanged vs HEAD: cicd q2/q3/q4/runs + inv q1/q2/q3 + reviewer q1/q2 + impl q1-q4 = SHA256/cmp IDENTICAL.
  • File 2026-06.md modified (cicd + inv-codebase): git diff --numstat = +N -0 (0 deletion = thuần additive); HEAD-original = prefix byte-exact (cicd 58378B; inv content-identity sau CR-normalize PASS).
  • Moved entries: mỗi bản-ghi grep -Fx count==1 trong archive đích + count==0 trong MEMORY.md (không mất, không nhân đôi).

4. Nấc trạng thái (G-011) — trung thực

  • L2-recovery (PART 1): executed-file + VERIFIED. Files trên đĩa (run-id A/B/C), 0-byte-loss git+sha-proven, Stage C audit PASS. Đây là thay đổi DATA (agent-memory) nạp ngay (không cần restart).
  • Process-mandate (PART 2/3): executed-file. Rule codify trong adap-apply command + agents/README (nạp ngay khi đọc); session-start §2.1.2 budget-audit = pending-restart (command .md no hot-reload — kích hoạt session sau).

5. SELF-CHECK

  • Adap Harness-9 đi qua đúng 2-workflow (thực ra 3: investigate + implement + audit) — PART 2 dogfood trên chính nó.
  • Report về AI_INFRA kèm run-id (email-back §7 + frontmatter run_ids).
  • PART 1 tailor: substring-pointer (không slug) hợp archive thật SE; budget seed-by-measure (đo trước, không số tưởng tượng); gist additive verbatim-frozen; distill-gen:1 chống re-distill; command nén tách build-index (mục lục build lúc curate, không gộp).
  • 0-byte-loss verify ĐỘC LẬP (Stage C + em-main self-gate) — KHÔNG tự-chấm.
  • Read-side hoạt động: MEMORY.md mỗi sub trỏ _INDEX.md (fix sau audit — xem §6).

6. Caveat (trung thực, không nói quá)

  • 2/4 reviewer Stage C KHÔNG gọi StructuredOutput (cicd-monitor + investigator-codebase) sau 2 nudge — đúng class feedback_workflow_fanout_reliability (reviewer-stage return kém tin trong harness này). → em main self-gate 2 sub đó bằng git/sha/grep (evidence-checklist), đúng recovery-path feedback_agent_kill_recovery. 2 sub returned (reviewer PASS · implementer-backend CONCERN) đủ chứng minh pattern; 2 self-gate cho cùng kết quả 0-byte-loss PASS.
  • Read-side gap (Stage C bắt được — giá trị của REVIEW workflow): 3/4 MEMORY.md (cicd/inv-codebase/impl-backend) KHÔNG trỏ _INDEX.md → agent spawn không biết đường tra map. Đã fix: sửa dòng-5 header (luôn auto-inject) mỗi sub trỏ _INDEX.md + 2026-06.md + gist. (reviewer đã sẵn trỏ.) Đây đúng là lý do PART 2 bắt buộc review-workflow RIÊNG — implement tự-chấm đã bỏ sót.
  • inv-codebase 2026-06.md line-ending: worker REBUILD (vs cicd APPEND) → 2-3 CR cosmetic trong phần original; CONTENT byte-identical (git +25 -0, CR-normalize prefix-exact). git autocrlf normalize lúc commit. Không mất data.
  • cicd L1 giữ 2 full run-record (#308/#307) thay ~4-6: mỗi record 4-6KB, ưu tiên hard-gate <25KB auto-inject (reliability) hơn số "~4-6" gợi ý; 4 stub cũ giữ nên không mồ-côi.
  • STAGED (chưa làm): rollout 7 sub còn lại KHÔNG cần (chỉ 4 sub có archive dark-matter; 7 sub kia archive rỗng/không có). frontend-designer + test-specialist L1 ~24KB sát cap nhưng chưa có archive — watch, chưa cần curate.
  • Phạm vi: chỉ ghi repo MÌNH (SE). Đọc outbox AI_INFRA = read-only.

7. Email-back

Đã gửi broadcasts/outbox/ai_infra/2026-06-17-se-to-ai_infra-harness-9-adopt-report.md (kèm 3 run-id + nấc thật + phát-hiện-riêng §8). Xem broadcasts/_index.md §OUTBOUND.

8. Phản biện / đề-xuất nâng-cấp (cho AI_INFRA)

  1. substring-over-anchor-slug cho archive heading hỗn-hợp: khi archive trộn ###/##/bullet-no-heading + same-date collision + diacritic, anchor-slug 404 dễ. SE chọn substring keyed-on-git-sha (immutable, grep-unique) làm primary, slug chỉ là hint. Đề xuất AI_INFRA ghi rõ "sha/immutable-token substring" là pointer mặc-định cho archive đời-thực (anchor-slug chỉ khi heading sạch + unique).
  2. measure-then-seed reference impl: scripts/measure-agent-memory.ps1 → JSON per-tier (l1/verbatim/index/gist); budget caps seeded từ max-measured + headroom. Stage C verify measured khớp disk byte-for-byte. Có thể làm mẫu chung.
  3. reviewer-stage StructuredOutput unreliability: workflow REVIEW double-check nên TOLERATE self-gate fallback khi auditor không return (đừng coi là FAIL of the adoption) — em-main self-gate bằng git/sha là recovery hợp-lệ. Đề xuất Harness-9 ghi nhận self-gate-fallback như nhánh hợp-lệ của review-workflow.