Files
solution-erp/docs/governance/adap-reports/2026-06-20-Governance-harness-15-memory-budget.md
pqhuy1987 0bc2112952
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m0s
[CLAUDE] Docs: adopt Harness-15 memory-budget per-agent (token-governor + value-gate + work-state block, S81)
8/8 floor via engine section-G + budget.json (harness_floor/token_governor/value_protect) + session-start 2.1.5 + rules 6.6 + gate-script value-protect FLAG (runtime-fired test-specialist). Review wf_b7f3c8ac-b53 PASS/PASS/HONEST -> 2 CONCERN fixed (anchoring + tool-attribution) + refresh stale measured S71->S81. adap-report + email ai_infra body-hash bb8fb6e803ae. 0 production code, A7 217/217, detector 26-flag baseline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:46:17 +07:00

51 lines
7.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

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

# adap-report — Harness-15 (Memory-budget per-agent, token-based)
- **id:** 2026-06-20-Governance-harness-15-memory-budget
- **source broadcast:** `ai_infra/broadcasts/outbox/all/2026-06-20-Governance-harness-15-memory-budget.md` (`status: 🟢 ADOPT` · `reviewer_gate: PASS wf_269fc353-560` · `content_sha256: 95272379462a3eb0061855e5fcc24454f45f54a17a5790f326b3f7982847f2f8`) + checklist `2026-06-20-Governance-checklist-harness-15.md` (`content_sha256: 94267ab5c2fbb0b972f7df65686554903d19b23ab4156b47c8e79eb70f872bd5`)
- **no directed notify** cho H15 (outbox/se dừng ở harness-14-notify) → pull qua **fan-out `outbox/all`** per `/adap-apply` (anh giao `/check-email AI_INFRA và /adap-apply step by step, review sau lẫn imple, report trung thực`).
- **adopted by:** se (SOLUTION_ERP) · **session:** S81 · **date:** 2026-06-20
- **protocol:** §6 mandate = 2-process tách-biệt (IMPLEMENT em-main single-writer D9 [governance-authoring solo per H6.1] + REVIEW workflow độc-lập) + report.
- IMPLEMENT: em-main đo SÀN (runtime) → `memory-budget.json` (harness_floor + token_governor + value_protect) + engine `§G` + session-start `§2.1.5` + rules `§6.6` + gate-script value-protect FLAG.
- REVIEW: `wf_b7f3c8ac-b53` (3 free-text lane: Part-A PASS · Part-B PASS · Honesty HONEST) → bắt 2 CONCERN honesty (anchoring + tool-attribution) → **đã fix** (review→fix loop).
- **project-fit:** ✅ FIT — SE đã có L1/L2/L3 + byte-archive-gate + budget.json seed-by-measure (Harness-9/11). H-15 = thêm **thước TOKEN** (governor thứ-2) + **value-gate** + **work-state block**.
## VERDICT: ✅ ADOPTED — 8/8 🔴 floor MET · 2-governor mechanized + 5/6 sàn-chức-năng convention (honest)
H-15 = ngân-sách bộ-nhớ per-agent token-based, cốt-lõi **"budget = sàn-tận-dụng-tối-thiểu KHÔNG trần-tiết-kiệm"** (tiết-kiệm-token = quên-việc, khoảng-trống hay rơi đúng vào **LEAD**). **Phát-hiện then-chốt:** SE đã có thước-BYTE + 3-tầng từ H-9/H-11 → adopt = thêm thước-TOKEN orthogonal + value-gate (mark `RC-…10-29-11` áp xuống tầng-bộ-nhớ) + formalize work-state block @session-start (vá khoảng-trống-LEAD).
## Nấc theo floor (review `wf_b7f3c8ac-b53`)
| Floor | SE artifact | Nấc | Cơ-chế-hóa vs quy-ước |
|---|---|---|---|
| 🔴 **A1 đo-SÀN** | persona đo-thật-byte TRỰC-TIẾP (`Get-ChildItem` 4.3-13.3KB) + harness-injected ước SE-riêng → 21K→**30K cap riêng SE** (`harness_floor`) | runtime→executed-file | mechanized (byte-count) + convention (ước + round-up) |
| 🔴 **A2 ghi 3-tầng** | `token_governor` L1 12K / L2 6K / L3 4K (lead hard-cap, no-AI-re-optimize) | executed-file | **mechanized** (config) |
| 🔴 **A3 tách-nhà** | persona+lead-docs = SÀN, KHÔNG đếm vào L1-managed (own-mem+_INDEX+work-state) | executed-file | convention (accounting) |
| 🔴 **B(a) nạp-đầy L1** | `token_governor._note` + session-start §2.1.5 + rules §6.6 (sàn-tận-dụng, no-token-saving, no-garbage) | executed-file→runtime | convention (kỷ-luật nạp) |
| 🔴 **B(b) value-gate** | `archive_gate.value_protect` 10-pattern + **gate-script FLAG runtime-fired** (test-specialist gotcha#/guard) ⟂ keep-floor recency = mark `RC-…10-29-11` | executed-file (**runtime-proven**) | convention (em-main quyết) + mechanized **FLAG-only** (advisory, KHÔNG auto-exclude) |
| 🔴 **B(c) work-state block** | `session-start §2.1.5` 4 thành-phần (roadmap+WIP+pending+recurring-bugs) vá khoảng-trống-LEAD | executed-file→runtime mỗi phiên | convention (kỷ-luật đầu-phiên) |
| 🔴 **B(d) 3 tệp-chốt** | persona `.claude/agents/*.md` + own MEMORY.md auto-inject + `hmw.js:124` MEMORY-PACK slice — **verified đã có** | executed-file | convention (verify-declare) |
| 🔴 **B(e) 2-governor** | byte (`tiers`/`archive_gate`) ⟂ token (`token_governor`) — giữ CẢ HAI tách-biệt | executed-file | **mechanized** (2 config tách) |
**Completeness-gate:** 8/8 🔴 (6 sàn-chức-năng: đo-SÀN+a+b+c+d+e · 2 config: ghi-3-tầng + tách-nhà) — review meta-gate xác-nhận đủ.
## Tailoring (SE-specific)
- §G gom vào `harness-11-engine.md` (engine governance hợp-nhất A-G) — H-15 byte-governor + 3-tầng = đã có (H-9/H-11) → map-onto + thêm token-governor, KHÔNG dựng mới.
- value-gate = mechanized **FLAG-only** (DÒ+NÊU-CỜ D6) thay vì auto-exclude — đúng triết-lý SE detector (auto-WRITE memory = mối-nguy #1, cố-ý chưa-làm). EXCLUDE = em-main quyết.
- con-số 3-tầng SE tự-suy từ byte-cap × workload (ERP nhiều-module); con-số AI_INFRA = bằng-chứng HỌ KHÔNG áp-cứng SE.
## Honest caveats (KHÔNG nói quá)
- **5/6 sàn-chức-năng = CONVENTION** (nạp-đầy · value-gate-DECISION · work-state · 3-tệp-chốt = kỷ-luật người+AI). Chỉ **(e) 2-config + đo-SÀN byte-count** = mechanized. KHÔNG nhận "mechanized" cho kỷ-luật.
- **floor = measured-ESTIMATE KHÔNG exact:** persona đo-thật-byte (verified review: investigator-api 4324B / cicd-monitor 13298B / README 32704B khớp đĩa từng byte); tool-schema+framing = ƯỚC-LƯỢNG (không byte-count cục-bộ được). token≈byte/3.3 (byte/4 = cận-trên → headroom THẬT lớn hơn).
- **value-protect = advisory FLAG KHÔNG enforce:** gate-script chỉ `Write-Output` cờ, KHÔNG move/exclude file (DRY-RUN giữ nguyên); EXCLUDE = em-main. Đã runtime-fire 1 case thật (test-specialist) — KHÔNG over-claim "tự-bảo-vệ".
- **2 CONCERN review đã fix (review→fix loop):** (1) anchoring — wording "matches AI_INFRA" → reframe "SE ước-riêng, trùng vì cùng-họ-toolset KHÔNG mượn-số"; (2) attribution — đo-SÀN cite sai `measure-agent-memory.ps1` (script đó chỉ đo agent-memory-tier byte) → sửa "persona đo TRỰC-TIẾP `Get-ChildItem`". + refresh stale `measured` block (S71→S81 fresh, đóng misread).
## Reverse-findings (đề-xuất ngược AI_INFRA)
1. **SE byte-governor đã thoả H-15 (e)-half + value-axis-precedent TRƯỚC adopt:** Harness-9 seed-by-measure + Harness-11 keep-floor/2-strike = nửa byte của 2-governor. H-15 ròng = thêm token-thread + value-gate. Dự-án đã chắc H-9/H-11 → H-15 byte-half gần free; chỉ token-thread + value-gate + work-state là mới.
2. **Token-budget = HARD-cap nhưng SE chưa có cơ-chế ĐO token-thực-nạp** (chỉ byte/3.3 ước-lượng) — cùng nút-thắt H-14 budget-hit-rate (Mức-2 chờ-tích-lũy). Nếu AI_INFRA mở tooling đếm token-loaded-per-spawn cho sister, token-governor sẽ lên **measured** thay vì **estimated**. Hiện honest = estimate.
## Evidence
- run-id: `wf_b7f3c8ac-b53` (REVIEW 3-lane: Part-A PASS · Part-B PASS · Honesty HONEST; bắt 2 CONCERN → fixed).
- gate-script runtime: `memory-archive-gate.ps1` value-protect FLAG fired on test-specialist (gotcha#/guard) + A7 GATE PASS 217/217 (integrity intact post-edit).
- detector: 26-flag baseline unchanged (0 new vocab-fork/broken-link từ edits).
- **0 production code.** State THẬT GIỮ NGUYÊN: Mig 57 · 88 bảng · 354 test · gotcha 71 · menu 54 · bundle `CsJetgZH`/`BVS0ApIm`.
- Mark đề-xuất (report-before-stamp, CHỜ anh confirm): H-15 memory-budget per-agent → cấp Active-High (mở-rộng cụm §P/§G, supersedes:null additive).