From f0874dd2c96a680bb92e6a8e20575d6f05931856 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Mon, 6 Jul 2026 13:54:13 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Docs:=20S103=20AI=5FINFRA=206-broadc?= =?UTF-8?q?ast=20adap=20=E2=80=94=20crystallized-backfill=20(measure-then-?= =?UTF-8?q?fill)=20+=20Harness-20=20fix-all-structure=20+=20memory-hygiene?= =?UTF-8?q?=20mapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adap 6 broadcast (hash MATCH cả 6 indep-recompute) qua 2-workflow Harness-9: - Harness-20 fix-all-structure -> engine §L + dogfood model-note 4-tầng-sweep (incl PERSONA) + 220K→380K neo-supersede + 2-đầu-catch (review bắt 2 DẪN-XUẤT stale-trailer sweep-sót → fixed) - F4 crystallized-backfill = NEW scripts/crystallized-backfill.ps1 (measure-then-fill DRY NO-API; default target=0=OFF owner-authority; calibrated-range; precondition; file-floor=UPPER-BOUND honest) + budget.json config + budget-table wire - F1/F3 already-met (0 hardcoded-violation persona-clean; BƯỚC 0.6 bắt S103=Opus real-metadata) - session-cmd budget-table (Up1) + run-loop 2-tầng (Up2 largely-already-met §L.b(c)) - H16 no-key Applied% = NEW scripts/applied-eval-nokey.ps1 (adversarial-gate fail-closed 3-ca + fault-inject FLIP; mechanism-built numbers-DEFERRED) - memory-hygiene A/B already-met (archive-gate DRY-RUN + governance-detectors 4-layer 1:1); C n/a JS-sandbox no-CLI-launcher - consolidation reference-ack (crystallization≠backfill) engine §L+§M · 6 adap-report + 1 adap-request (#53-garble reasoning-lane mitigation) · send-email fc1e22ac selftest-MATCH · check-email 3 pulled+verified+STAGE-2. 2-workflow: WF1 implement wf_55ef6778-a0d (3 lane schema-CLEAN, selftest exit-0 ×2 + fault-inject teeth) + WF2 review wf_3c5c37cb-aa2 fable-clone (Lane-C PASS returned + Lane-B recover-from-memory PASS; 0-BLOCKING 2-CONCERN-addressed). #53 garble ×3 → em-main recover; investigator AS-10 garble-curation REVERTED (git-backstop). Runtime S103 = Opus (Fable outage lại, per-session flip; H5-fallback revert-free). State GIỮ NGUYÊN: Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54. 0 prod-code. Co-Authored-By: Claude Opus 4.8 (1M) --- .claude/agent-memory/memory-budget.json | 16 + .claude/agent-memory/reviewer/MEMORY.md | 3 +- ...t_s103_h20_crystallized_backfill_review.md | 30 ++ .../agent-memory/tooling-auditor/MEMORY.md | 1 + .claude/agents/README.md | 2 +- .claude/commands/session-end.md | 4 +- .claude/commands/session-start.md | 3 +- broadcasts/_index.md | 4 + ...-Governance-notify-harness-full-recheck.md | 28 ++ ...-04-ai_infra-to-se-consolidation-notify.md | 19 + ...7-04-ai_infra-to-se-notify-auto-hygiene.md | 23 ++ ...-crystallized-backfill-harness-20-adopt.md | 47 +++ docs/HANDOFF.md | 2 +- docs/STATUS.md | 16 +- ...-crystallized-backfill-harness-20-adopt.md | 32 ++ ...Governance-harness-20-fix-all-structure.md | 26 ++ ...7-04-Agent-memory-hygiene-mechanization.md | 24 ++ ...nsolidation-crystallization-measurement.md | 23 ++ ...ness-full-recheck-crystallized-backfill.md | 25 ++ ...ance-session-cmd-budget-display-runloop.md | 23 ++ ...e-harness-16-applied-eval-no-key-update.md | 23 ++ ...se-53-garble-reasoning-lanes-mitigation.md | 30 ++ docs/governance/harness-11-engine.md | 44 ++- docs/guides/multi-agent-setup-guide.md | 2 +- docs/rules.md | 2 +- scripts/applied-eval-nokey.ps1 | 362 ++++++++++++++++++ scripts/crystallized-backfill.ps1 | 254 ++++++++++++ 27 files changed, 1057 insertions(+), 11 deletions(-) create mode 100644 .claude/agent-memory/reviewer/project_s103_h20_crystallized_backfill_review.md create mode 100644 broadcasts/inbox/ai_infra/2026-07-04-Governance-notify-harness-full-recheck.md create mode 100644 broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-consolidation-notify.md create mode 100644 broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-notify-auto-hygiene.md create mode 100644 broadcasts/outbox/ai_infra/2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt.md create mode 100644 docs/changelog/sessions/2026-07-06-S103-crystallized-backfill-harness-20-adopt.md create mode 100644 docs/governance/adap-reports/2026-07-03-Governance-harness-20-fix-all-structure.md create mode 100644 docs/governance/adap-reports/2026-07-04-Agent-memory-hygiene-mechanization.md create mode 100644 docs/governance/adap-reports/2026-07-04-Governance-consolidation-crystallization-measurement.md create mode 100644 docs/governance/adap-reports/2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md create mode 100644 docs/governance/adap-reports/2026-07-04-Governance-session-cmd-budget-display-runloop.md create mode 100644 docs/governance/adap-reports/2026-07-05-Governance-harness-16-applied-eval-no-key-update.md create mode 100644 docs/governance/adap-requests/2026-07-06-se-53-garble-reasoning-lanes-mitigation.md create mode 100644 scripts/applied-eval-nokey.ps1 create mode 100644 scripts/crystallized-backfill.ps1 diff --git a/.claude/agent-memory/memory-budget.json b/.claude/agent-memory/memory-budget.json index 3ecaa8e..3f7ba5d 100644 --- a/.claude/agent-memory/memory-budget.json +++ b/.claude/agent-memory/memory-budget.json @@ -68,6 +68,22 @@ "read_only_scope": "MFE WRITES exactly one file: .claude/agent-memory/.mfe-state.json (its own strikes-state for cross-run Goodhart compare). 'READ-ONLY' is scoped to token_governor / the budget caps (owner-authority) which it NEVER writes -- it is NOT the claim 'writes nothing'." } }, + "crystallized_backfill": { + "_note": "Harness-20-era (S103, 2026-07-06) crystallized-backfill = 'measure-then-fill'. Read by scripts/crystallized-backfill.ps1 (deterministic NO-API DRY planner). Adapts AI_INFRA broadcast 2026-07-04 F4 + session-cmd-budget-display Upgrade-1. DISTINCT from CRYSTALLIZATION (engine §I distill = compress-TOWARD-source, keep time-invariant): backfill goes the OPPOSITE direction = FILL the empty hot-feed budget with already-crystallized cold-tier data so the cap is not wasted. PRECONDITION: expected_backfill opens ONLY when target>0 AND measured_headroom>0. Default target=0=OFF. NOT-for-sub (sub packs are lead-curated per-task; blind-pour dilutes relevance).", + "target": 0, + "_target_note": "OWNER-AUTHORITY static number (mirror token_governor.role_boundary_note + mark RC-...21-06...01-58-01). 0 = OFF/disabled = default. Owner raises >0 ONLY after judging a POSITIVE real-token headroom exists on the stable hot-load floor. The AI (em-main) NEVER sets/auto-tunes this; the script is READ-ONLY on it.", + "hotload_sources": [ + "docs/STATUS.md", + "docs/HANDOFF.md", + ".claude/governance/ACTIVE-MARKS.md", + "docs/changelog/migration-todos.md", + "docs/gotchas.md", + ".claude/agents/README.md" + ], + "_hotload_note": "STABLE always-on FILE-FLOOR only (reproducible session-to-session). measured_headroom over this list = an UPPER BOUND on real headroom: the PEAK hot-feed ALSO loads session-VARIABLE lead-pasted task-context (task-relevant docs / code / gotcha-slices / engine-slices) that is NOT a fixed file-list, so the real peak approaches the ~368K lead read-set (token_governor.lead_note) and real headroom is SMALLER than this floor-measure shows. This is exactly broadcast F4's warning: byte/4 undercount + partial-source-list = 'illusion of room'. Hence target stays 0 until the owner judges stable room exists.", + "source_order": ["gist", "value-marked-archive", "curated-RAG"], + "_source_order_note": "value-gated, dedup vs hot-load, only TIME-INVARIANT crystallized content (NOT raw-episodic / volatile): (1) archive/.gist.md 4-field distill; (2) archive lines carrying value_protect markers (gotcha# / anti-pattern / root-cause / lesson); (3) curated RAG search_memory. The PLANNER prints this order; it performs NO pull (DRY, like memory-archive-gate.ps1) - zero context change." + }, "harness_floor": { "_note": "Harness-15 A1/A3 (S81, 2026-06-20): SAN-harness = fixed per-spawn cost (NOT tunable) = tool-schema + framing + own persona/role file + lead-pasted base-doc slice + task prompt. SEPARATE HOUSE (A3 anti-double-count): persona + lead-pasted-docs belong HERE (floor), NOT counted in token_governor.l1_always (which = own agent-memory + archive index + work-state block only). MEASURED-ESTIMATE not exact (H15 honest-note b): persona = directly measured bytes (.claude/agents/.md 4.3KB-13.3KB => ~1.3K-4.0K tok via /3.3); tool-schema + framing = harness-injected (cannot byte-count locally), estimated comparable to AI_INFRA same-toolset-family (Read/Write/Edit/Bash/Grep/Glob/Skill/RAG).", "measured_token_estimate": 21000, diff --git a/.claude/agent-memory/reviewer/MEMORY.md b/.claude/agent-memory/reviewer/MEMORY.md index d529f25..060914e 100644 --- a/.claude/agent-memory/reviewer/MEMORY.md +++ b/.claude/agent-memory/reviewer/MEMORY.md @@ -11,7 +11,8 @@ - [S89 PE ends-before-CEO PLAN review](project_s89_pe_endsbeforeceo_plan_review.md) — CONCERN: BE 3-field design sound (Mig 58 col committed, no mig) but FE coverage gap — 4 PeUrgentChips render-sites, plan covered only 2 (missed InboxPage:290 despite BE Inbox A2 updated + wrong ListPage dir path). - [S89 finalize-note PLAN review](project_s89_finalize_note_plan_review.md) — CONCERN: plan ground-truth 100% accurate (all file:line verified incl self-flagged); gaps = note doesn't say intermediate approvers still sign + skipToFinal-last-level corner + Dev DB 9 migs behind. - **S101 H18 WF2 governance re-run (self=workflow-lane · em-main synthesized):** re-verified S100 Harness-18 adopt (`5ee32c0`, governance-only) — original WF2 `wf_31ea3985-92c` lost to CLI-restart → fresh `wf_955643c3-f7d` **PASS_WITH_CONCERNS**. Lane-A detector-teeth PASS (fault-inject 4/4 `-RepoRoot` temp-tree — proved detector FLAGS injected-stale, not happy-path). Lane-B caught **1 CONCERN em-main missed in S100 sweep**: `workflows/README.md:51` stale label "ledger orphan-scan" (NO `_ledger` token → grep-exact sweep skipped) → FIXED S101. Lesson: **exact-token sweep misses paraphrased labels** — widen to concept-phrase when retiring a named artifact. Lane-C **#53 return-garble** (workflow-lane returned no StructuredOutput) → recovered first-hand, NOT re-spawned (`feedback_agent_return_garble_recover`). -- **S101 H19 WF2 review LANE-C (adap-reports + honesty · self=reviewer · `wf_5f308fd8-744`=WF1):** PASS. 4 adap-reports (H19 fable-clone + 3 model-tier: opus / checklist / v2-pin-simple) + send-email 6c selftest. **Hash re-computed indep (PS .NET UTF8, canonical split-3 + strip-1-newline):** H19=`6909299a…` MATCH · model-tier=`ee00d253/a7ff304b/eed277f7` all MATCH · **all 4 carry `reviewer_gate: PASS`**. Model-tier 12/12 honest: C1 11/11 frontmatter `inherit` · C3 gotcha `[1m]` = frontmatter-scoped 0 vs naive `grep -c` = 4 PROSE hits (README:9/12/16 upgrade-notes + database-agent:46 rule-line — verified NOT frontmatter). Q1 G-015=git-diff+folder-scan orphan (error-ledger AS-10) · **Q2 hysteresis `0.85/5/2` VERIFIED verbatim in memory-budget.json:35-37**. **KEY honesty-catch (resolved-benign):** model-tier line 29 "re-stamp H10 `5f511fe5`→`5f8b8504`" reads like commit-SHA pair — `git cat-file` = NOT commits; **but hash-recompute proves they are content_sha256 BODY-hashes** (5f511fe5=old-no-strip / 5f8b8504=canonical = current declared) → claim TRUE (`→`=hash-transition), only presentation-nit. **Anti-consensus dogfood** cites `commit f229b07` (run-folder ephemeral) — S101 WF2 Lane-B catch; honest framing = "ensemble-PATTERN proven" NOT "H19-toggle verified" (nấc="designed+will-dogfood", "thật-mode CHƯA chạy"). No overclaim: only "verified" hits = G-011 legend + "verified-pending-restart". §9 3-floor-points verbatim in RC-stamp + VACUOUSLY-MET-SE annotation present (value=future-proof+anti-consensus NOT cost). send-email 6c ABORT recompute-SAME-as-step-4 + ordered BEFORE step-7-log. Marker `fable-real-mode.on` gitignored ✓ / command-file tracked ✓. Lesson: **hex→SHA disambiguation — recompute BOTH strip/no-strip variants to prove a hex string is a body-hash not a commit-SHA when text is ambiguous.** +- [S103 H20+crystallized-backfill review](project_s103_h20_crystallized_backfill_review.md) — WF2 PASS (Lane-B gov-fidelity + Lane-C already-met/no-overclaim, fable-clone ensemble). 6/6 hashes recompute MATCH; 4 already-met VERIFIED file:line (detectors 4-layer C2 `if n≠canon`:247 · archive-gate value_protect ADVISORY:55-56 · C launcher n/a hmw.js:4-5 · F3 BƯỚC0.6 reads env-runtime:37); all no-overclaim danger-phrases NEGATED-context; applied-eval 4-caveat + selftest exit-0 fault-inject teeth; crystallized-backfill DRY target=0=OFF. 2 NIT: script echoes bare headroom w/o partial-floor-axis caveat (doc-layer+wire DO carry UPPER-BOUND) · guide-doc Opus-4.7 examples out of §L.D n=1 scope. **Lesson: multi-axis warning (F4=token-undercount + partial-source-list) must appear in the SCRIPT's own output, not only the doc — reader runs script inline.** +- **S101 H19 WF2 review LANE-C (adap-reports + honesty · self=reviewer · `wf_5f308fd8-744`=WF1):** PASS. 4 adap-reports (H19 fable-clone + 3 model-tier) + send-email 6c. Hashes recompute indep MATCH (H19 `6909299a` + model-tier `ee00d253/a7ff304b/eed277f7`), all carry `reviewer_gate: PASS`. 12/12 honest; Q2 hysteresis `0.85/5/2` verbatim budget.json:35-37. Danger-phrase "verified" only in G-011 legend + "verified-pending-restart"; nấc="designed+will-dogfood, thật-mode CHƯA chạy". **Lesson: hex→SHA disambiguation — recompute BOTH strip/no-strip variants to prove a hex string is a content_sha256 BODY-hash not a commit-SHA (line-29 `5f511fe5→5f8b8504` = hash-transition, `git cat-file`=not-commits, claim TRUE presentation-nit only).** --- diff --git a/.claude/agent-memory/reviewer/project_s103_h20_crystallized_backfill_review.md b/.claude/agent-memory/reviewer/project_s103_h20_crystallized_backfill_review.md new file mode 100644 index 0000000..7f47bcd --- /dev/null +++ b/.claude/agent-memory/reviewer/project_s103_h20_crystallized_backfill_review.md @@ -0,0 +1,30 @@ +--- +name: s103-h20-crystallized-backfill-review +description: S103 WF2 Lane-B review (fable-clone ensemble) of H20 fix-all-structure + crystallized-backfill adap — PASS, 2 non-blocking CONCERN. Read when reviewing governance-doc fidelity or fix-all-structure dogfood. +metadata: + type: project +--- + +**S103 (2026-07-06) H20+crystallized-backfill WF2 Lane-B — governance-doc fidelity + fix-all-structure dogfood · self=reviewer · fable-clone ensemble H19. Verdict: PASS (0 BLOCKING, 2 CONCERN).** + +Scope: 6 broadcast adap (H20 fix-all `bd714a33` + full-recheck-F1-F4 `94c78d1d` + session-cmd-budget-runloop `d47333e0` + H16-nokey `a1dc3a20` + hygiene-A/B/C `43c9e56f` + consolidation `5bba339b`). Deliverables: engine §L+§M, 2 scripts (crystallized-backfill.ps1 + applied-eval-nokey.ps1), memory-budget.json block, session-start §2.1.6 + session-end §L.b(c) wiring, model-note sweep 4 spots. + +**Hash re-computed indep** (PS .NET UTF8, split-on-`^---$` regex take-3rd + strip-1-leading-newline): all 6 MATCH (full-64 on the 4 declaring full). Q4 PASS. + +**Q1 §L fidelity:** 4-layer NHÌN/NGUỒN/DẤU/DẪN-XUẤT + PERSONA (5th, = broadcast F2 toxic-layer emphasis) present · anti-asymmetric ordering "đủ-tầng>không-sửa>sửa-lệch-tầng" verbatim broadcast §2 · 4-step (L.B) + 2-head cross-axis (L.B) present · 0 floor dropped vs bd714a33. + +**Q2 §M fidelity:** F4 5-floors all present (default-0=OFF / NOT-sub / calibrated-range [bytes/4..bytes/3.0] / precondition target>0 AND headroom>0 / value-gated source-order) · crystallization≠backfill DISTINCT (OPPOSITE direction: engine §I distill=compress-toward-source vs §M=fill-empty-budget) · budget-table (M.B) · run-loop 2-tier (M.C, honestly "largely already-met §L.b") · no-key mechanism (M.D, honestly "MECHANISM built, numbers DEFERRED") · hygiene A/B/C mapped (M.F: C=n/a-by-JS-sandbox-architecture, not CLI-launcher) · 0 floor dropped. + +**Scripts REAL teeth (5 fault-inject `-RepoRoot` temp-tree):** (1) target=0→backfill=0 OFF · (2) target=5000+pos-headroom→backfill=5000 opens · (3) target>headroom→headroom-binds(67) · (4) NEG-headroom(tiny cap)→backfill=0 = broadcast borderline near-cap case · (5) -Tier sub→NOT-FOR-SUB warn fires. applied-eval selftest EXIT-0 3/3 (control-HIGH→BLOCK · control-LOW→PASS+Applied%=70 · control-null→BLOCK; `$script:`-scope flip survives nested Assert-Case = fault-inject-caught real bug per header). + +**Q3 fix-all-structure dogfood VERIFIED:** 4 spots correct — README:3 + session-start:37 (BƯỚC 0.6) + session-end:113 (release-line) → S103-Opus; engine §G.5 → 220K neo-superseded (present 7×, NOT deleted; 380K override present 5×). History-saga NOT rewritten: README:12 H8-caveat UNCHANGED (README diff = 1-line-only = line-3), adap-reports 2026-06-10/06-13 dated-snapshots preserved (LỊCH-SỬ/SNAPSHOT, correctly kept). Persona-layer (the F2 toxic layer, `.claude/agents/*.md`) clean of stale steady-Fable current-claim. + +**2 CONCERN (non-blocking):** +1. STATUS:24 Sub-agents row + STATUS:6/HANDOFF:5 last-updated still read S102-Fable / S101 as latest current-state (not yet S103-Opus). Engine §L.D EXPLICITLY defers STATUS/HANDOFF mega-line current-claim to session-end blurb (natural update-point). NOT persona (not reloaded per spawn) → tailoring defensible + honestly disclosed. But at review-time (mid-session, pre-session-end) the Sub-agents current-state row IS technically ĐANG-SAI under strict fix-all-structure. +2. tooling-auditor/MEMORY:17 roster-header "Fable 5 RESTORED S98" while line-46 records S103-Opus divergence (data-point #7 DIVERGENT) = header/body tier-lag. Internal diary (not persona, not outward, not in the 4-spot dogfood scope) → NIT-tier. + +**KEY honesty-check (resolved-HONEST):** §M.A + budget.json `_hotload_note` claim "real peak ~368K near-cap → real headroom SMALLER" while LIVE crystallized-backfill shows headroom=282384 POSITIVE (~74% free over the 6-file floor: STATUS/HANDOFF/ACTIVE-MARKS/migration-todos/gotchas/agents-README = 292848 bytes → 97616 tok worst-case). Reconciliation SOUND: `_hotload_note` explicitly labels measured_headroom an UPPER-BOUND — the PEAK hot-feed also loads session-variable lead-pasted task-context (docs/code/gotcha-slices) NOT in the fixed file-list, so real peak → ~368K and real headroom SMALLER; matches broadcast F4 "byte/4 undercount + partial-source-list = illusion of room"; target stays 0 BECAUSE of this uncertainty = honest disclosure, NOT overclaim. + +**Lesson:** when a planner measures only a FILE-FLOOR subset, verify the doc labels the headroom as UPPER-BOUND — a positive floor-headroom that superficially contradicts a "near-cap" narrative is HONEST iff the partial-source-list caveat is explicit (else it would be an illusion-of-room overclaim). Also: hash-recompute all 6 broadcasts independently (never trust declared frontmatter) — canonical = split-on-`^---$` take-3rd, strip exactly 1 leading newline, SHA256 UTF-8. + +Cross-ref: [[wire-claim-verification-anchors]] (sha256 twin-file discipline) · broadcast F2/F3 persona-layer sweep · engine §L/§M (`docs/governance/harness-11-engine.md`). diff --git a/.claude/agent-memory/tooling-auditor/MEMORY.md b/.claude/agent-memory/tooling-auditor/MEMORY.md index 2a725e8..5738e4a 100644 --- a/.claude/agent-memory/tooling-auditor/MEMORY.md +++ b/.claude/agent-memory/tooling-auditor/MEMORY.md @@ -43,3 +43,4 @@ H1 tooling-freshness auditor **SOLUTION_ERP-self**. Read-only + **propose-only** - **2026-07-03 (S101 @start RE-REPORT — ALL-4 PASS + MODEL-DRIFT, on-behalf em-main APPEND B3):** HEAD `5ee32c0`, tree 1-dirty (cicd MEMORY M #486 pre-existing). ①SKILL PASS 6+23+14 (2 detector-flag ef-core/contract-workflow = FP module-local, numbers MATCH canonical). ②ROSTER PASS 11=11=11, 11/11 inherit, ASCII-diagram cosmetic-drift known-debt. ③PLUGIN PASS 18/15/3 + marketplace 35 + xhigh + `claude-fable-5[1m]`:11 identical, 0 new-alloc. ④DOCS PASS (S100 closeout clean; F2 SendMessage + F3 count both fixed-verified). 🔴 **MODEL-DRIFT (inherit-chain data-point #4 = DIVERGENT):** this spawn + lead + WF2-reviewer all self-report **`claude-opus-4-8`** (NOT `claude-fable-5` S98/S99) while `settings.json:11` still pins `claude-fable-5[1m]` → **Fable unavailable S101 → H5-fallback tự-kích** (revert-free, no frontmatter change). "Fable RESTORED S98" = point-in-time NOT steady-state → em-main reconciled STATUS:24 + agents/README:3 with S101-runtime caveat. Lesson: **inherit-chain self-report = runtime availability probe — verify each session, don't trust last-session model claim.** Tag `[s101-start, 4-mat, all-pass, model-drift-opus, h5-fallback-reactivated]`. - **2026-07-03 (S101 @closeout CHỐT — on-behalf em-main APPEND B3):** HEAD `e350660`, tree CLEAN, 2 commit S101 pushed (`f229b07` H18-closeout + `e350660` H19-adopt). ①SKILL/COMMAND **DELTA: command 14→16** (+`fable-real.md`+`fable-clone.md` H19 thật/ảo-toggle — verified `ls|wc`=16; 🔴 **là COMMAND KHÔNG phải skill** — SlashCommand-tier ≠ `skills//SKILL.md` Skill-tier, đừng conflate "auto-registered skill"; skill vẫn **6+23**) + session-start BƯỚC 0.5b + send-email 6c present. **KHÔNG command-catalog canonical** trong docs → 2 fable-* KHÔNG tạo catalog-drift, KHÔNG cần doc-register. ②ROSTER 11=11=11 (H19 0 agent mới, dùng reviewer+investigator-cb sẵn), 11/11 inherit. ③PLUGIN 18/15/3 identical + xhigh + pin-fable giữ (revert-free dù runtime-Opus), 0 new-alloc. ④DOCS PASS: H19 đầy-đủ path:line-verified (engine §K:315-334 + ACTIVE-MARKS:19 RC-verbatim + STATUS:6/:24/:40 + HANDOFF + session-log + 4 adap-report). 🔴 **model self-report `claude-opus-4-8` = inherit-chain data-point #5 DIVERGENT-confirmed** (Fable vẫn unavailable). **new-alloc: NOTHING-TO-ALLOCATE.** **Flags:** F-H19a LOW (agents/README+reviewer+investigator-cb 0 H19-note → **DEFER** vacuously-inert + no-catalog + single-sourced §K; note khi Fable-về + toggle-first-run có runtime-delta) · F-H19b VERY-LOW (session-start BƯỚC-0.6 Fable-steady → em-main FIXED S101 +Opus-caveat). Baseline command-count 14→**16** (self-fix note). Tag `[s101-closeout, 4-mat-chot, command-14-16, model-drift-5, f-h19a-defer, on-behalf]`. - **2026-07-06 (S102 @start RE-REPORT — ALL-4 PASS + FABLE VỀ LẠI, inherit-chain data-point #6):** HEAD `3e2c18b` (=S101 closeout), tree CLEAN, 0 commit sau S101 → disk S102-pre == S101-end. **Model: spawn này self-report `claude-fable-5`** = Fable RESTORE lần 2 (chuỗi S98 Fable → S101 Opus → S102 Fable — availability per-session, đúng lesson S101). ①SKILL PASS 6+23; ef-core `:3`/`:19` B1-pointer + Mig 61 khớp disk-61 (`ls` Migrations = 61). ②ROSTER PASS 11 file = 11 kỳ-vọng, 11/11 `model: inherit` line-5; S101-window: harvest-curator.md + agents/README.md M-only, 0 agent THÊM/XÓA. ③PLUGIN PASS 18/15/3 (settings:17-35) + marketplace 35 + xhigh:37 + `claude-fable-5[1m]`:11 identical, 0 new-alloc. ④DOCS PASS: (a) BƯỚC 0.5b hiện diện session-start:27-33; (b) fable-real/clone semantics inverse ĐÚNG (real=tạo marker :10 / clone=xóa :8), registry loaded = restart đã xảy ra; (c) **model-note S101-Opus cần S102-reconcile 3 vị-trí: STATUS:24 · agents/README:3 · session-start:37 (BƯỚC 0.6)** — đề xuất APPEND data-point giữ S101 làm history; (d) marker KHÔNG tồn tại + gitignore:92 + not-tracked. **Trigger-met: BƯỚC 0.5b:33 "nhắc anh khi Fable về + phân-tầng"** → em-main nhắc anh H19 tiering. Command 16 (brief "~20" = overestimate; 16 = đúng đủ, hmw ≠ command-file). Counts khớp: Mig 61 · gotcha 79 (grep) · test 440 · 89 bảng. F-H19a defer-condition "khi Fable-về" cũng MET → em-main cân nhắc note. Tag `[s102-start, 4-mat, all-pass, fable-restore-2nd, model-note-reconcile-3]`. +- **2026-07-06 (S103 @start RE-REPORT — ①②③ PASS, ④ 1-FLAG model-note per-session flip, inherit-chain data-point #7 DIVERGENT):** HEAD `62cff38` (=S102 closeout), tree CLEAN, 0 commit sau S102 → disk S103-pre == S102-end. Project `.claude/settings.json` KHÔNG tồn tại → model resolve user-global. **Model: spawn này self-report `claude-opus-4-8`** (env-confirmed) = Fable UNAVAILABLE lại (chuỗi **S98 Fable → S101 Opus → S102 Fable → S103 Opus**, flip lần 4 — availability per-session KHẲNG-ĐỊNH lại). ①SKILL PASS 6+23+16 (last-touch skills/ = `4263d63` S98, 0 đổi); ef-core `:3`/`:19`/`:83` Mig 61 + `:85` 89-bảng khớp disk (`ls` Migrations = 61, last=`...142752_BackfillEndedByLevelFinalizeFromChangelog.cs`) + khớp STATUS:14/:15; skills/README:20 "Updated S98"/:90 #79 fresh. ②ROSTER PASS 11=11=11, 11/11 `model: inherit`; ASCII-diagram cosmetic-drift known-debt (KHÔNG mới); last-touch agents/ = `62cff38` S102 M-only 0 agent THÊM/XÓA; VALID_ROLES 9 product-by-design. ③PLUGIN PASS 18/15/3 (3 disabled: pr-review-toolkit/code-modernization/hookify) + marketplace 35 + xhigh + `claude-fable-5[1m]`:11 identical, 0 new-alloc. ④DOCS canonical 7-count khớp disk (Mig61/89/440/gotcha79/menu54/11sub/6skill). 🔴 **FLAG-M (LOW, on-behalf APPEND đề xuất):** 3 model-note (STATUS:24 · agents/README:3 · session-start:37 BƯỚC 0.6) carry **S102-Fable "VỀ LẠI"** — KHÔNG drift-sai (đúng-tại-S102 + đã ghi "per-session, không tin note phiên trước") chỉ thiếu **data-point S103-Opus**. Đề xuất em-main APPEND caveat S103-Opus vào 3 vị-trí (giữ history, KHÔNG frontmatter/con-số), **SAU khi em-main tự-xác-nhận lead-runtime S103** (report này = 1-spawn probe, G-015 honesty — chưa xác nhận lead + sub khác). Marker fable-real KHÔNG tồn tại → Fable-clone default (đúng). Carry-debt: schema-diagram §16+ ERD · monthly count-grep +commands/*.md. Method-shortcut tái-dùng: `git log -- .claude/skills/` last-touch confirm no-change nhanh hơn re-read. Tag `[s103-start, 4-mat, model-note-flip-opus, data-point-7-divergent, flag-m-low, on-behalf]`. diff --git a/.claude/agents/README.md b/.claude/agents/README.md index 78cab8c..980799a 100644 --- a/.claude/agents/README.md +++ b/.claude/agents/README.md @@ -1,6 +1,6 @@ # Multi-agent SOLUTION_ERP — Master Coordination Guide (11-agent) -> **Architecture:** 11 sub-agents **all-inherit top-tier (Harness-8 2026-06-16 — thay thế two-tier Harness-4)** + em main **Fable 5 (1M) Max** coordinator — **9 product/quality** (7 core + frontend-designer pink S47 + database-agent read-advisory S52) + **2 monitor INFORM-only** (`tooling-auditor` H1 + `harvest-curator` H2, 2026-06-07 Harness 1). Tier: **toàn bộ 11 sub `model: inherit`** (ăn top-tier model của lead — ✅ **Fable 5 1M RESTORED, runtime-verified S98 2026-07-02**: 2 monitor spawn-test self-report `claude-fable-5`; giai đoạn fallback Opus H5 S62→S97 kết thúc; ⚠️ **S101 2026-07-03 runtime = Opus lại** — lead + 2 monitor + WF2-reviewer inherit self-report `claude-opus-4-8`, settings pin fable → Fable unavailable phiên này, H5-fallback revert-free [chi-tiết STATUS §Sub-agents]; ✅ **S102 2026-07-06 runtime = Fable trở lại** — self-report `claude-fable-5` ×3 [lead + 2 monitor], per-session availability) · effort **Max** (env machine-wide). SE KHÔNG có lớp helper/gopher rẻ (cả 11 đều substantive memory-bearing → cả 11 lên inherit). *(Trước H8: 4 promote inherit + 7 demote pin `claude-opus-4-8` — lịch sử ở Upgrade 2026-06-10 + S66 dưới.)* +> **Architecture:** 11 sub-agents **all-inherit top-tier (Harness-8 2026-06-16 — thay thế two-tier Harness-4)** + em main **Fable 5 (1M) Max** coordinator — **9 product/quality** (7 core + frontend-designer pink S47 + database-agent read-advisory S52) + **2 monitor INFORM-only** (`tooling-auditor` H1 + `harvest-curator` H2, 2026-06-07 Harness 1). Tier: **toàn bộ 11 sub `model: inherit`** (ăn top-tier model của lead — ✅ **Fable 5 1M RESTORED, runtime-verified S98 2026-07-02**: 2 monitor spawn-test self-report `claude-fable-5`; giai đoạn fallback Opus H5 S62→S97 kết thúc; ⚠️ **S101 2026-07-03 runtime = Opus lại** — lead + 2 monitor + WF2-reviewer inherit self-report `claude-opus-4-8`, settings pin fable → Fable unavailable phiên này, H5-fallback revert-free [chi-tiết STATUS §Sub-agents]; ✅ **S102 2026-07-06 runtime = Fable trở lại** — self-report `claude-fable-5` ×3 [lead + 2 monitor], per-session availability · ⚠️ **S103 2026-07-06: runtime = Opus LẠI** (Fable outage lần nữa — lead + spawn-inherit self-report `claude-opus-4-8`, H5-fallback revert-free) → per-session flip S98→S101-Opus→S102-Fable→**S103-Opus**, BƯỚC 0.6 probe mỗi phiên) · effort **Max** (env machine-wide). SE KHÔNG có lớp helper/gopher rẻ (cả 11 đều substantive memory-bearing → cả 11 lên inherit). *(Trước H8: 4 promote inherit + 7 demote pin `claude-opus-4-8` — lịch sử ở Upgrade 2026-06-10 + S66 dưới.)* > **Upgrade S52 (2026-06-08 — AI_INFRA broadcast `2026-06-08-Agent-database-codebase-agents`):** **+database-agent (read-advisory DB specialist, floor DB1–DB11)** — schema/query/migration-design-review/perf/concurrency (DB11 RowVersion vá lost-update S43). Tailor READ-tier (implementer-backend vẫn author) · color OMIT (8 standard hết) · `store_memory` strip. `codebase-agent` = **SKIP n-a** (investigator-codebase đã cover grep/audit + `csharp-lsp` Windows no-op). ✅ **verified-runtime** — spawned OK S53 (first real spawn, caught Mig 46 committed-but-unapplied-local drift) + S56 2× (pre-golive-verify schema-stream + golive-harden design+review). DB11 lost-update fix landed S56 (atomic ExecuteUpdate + Serializable tx, gotcha #58). > Pattern: Anthropic Building Effective Agents orchestrator-workers + Cognition "writes single-threaded" hybrid + post-deploy automated watchdog. > **Upgrade S39 (2026-05-29):** 4→7 agent (split investigator + implementer, +test-specialist) + budget +50% + 5 RAG MCP per agent. Reference BVAAU 7-agent config (adapted, NOT copied — SOLUTION_ERP 2-FE-app fit + 6 skill proven battle-test 38 session). Prior: S20t12 initial 3 + S21t1 +cicd-monitor. diff --git a/.claude/commands/session-end.md b/.claude/commands/session-end.md index 0c1d932..81c480d 100644 --- a/.claude/commands/session-end.md +++ b/.claude/commands/session-end.md @@ -45,7 +45,7 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph **§L.b — 8-step auto-maintain (đủ 8, KHÔNG skip — thiếu = ledger thối). (d)(f) = H2 harvest-curator · (g) = H1 tooling-auditor (2026-06-07 Harness 1) · (h) = User-Mark H-12/13 (S79):** - **(a) summary-index** += 1 dòng/session vào `STATUS.md` Recently Done (pointer, KHÔNG full-log). - **(b) Active-Guards** (error-ledger): promote guard **2-strike** (episodic→procedural) · mark `verified` nếu held qua session · retire theo **net-effect** (hại>lợi → gỡ). -- **(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. +- **(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. · **📊 Bảng-số ngân-sách + run-loop 2-tầng (M.B/M.C — Harness-20 adap S103, [`engine §M`](../../docs/governance/harness-11-engine.md)):** chạy `powershell.exe -ExecutionPolicy Bypass -File scripts/crystallized-backfill.ps1` → in BẢNG số THẬT (cap/hotload-bytes/tok-RANGE/headroom/target/backfill, live 0-hardcode) cạnh %-print. **Tầng-1 ĐO** (deterministic scripts) mỗi end = khối-số tươi (chống "khai-chạy-mà-không-chạy"); **Tầng-2 TINH-CHỈNH on-signal** (gap-mới/drift-vs-last/orphan-TĂNG/coverage-tụt → **cảnh-báo ĐỎ** + refine-in-session HOẶC carry-hi-prio nếu đứt-phiên) — KHÔNG nuốt tín-hiệu; weekly full-refine backstop. backfill default 0=OFF (owner). 🟡 M.C largely-already-met (H17-loop + %-print đã có ở dưới), khối-số = formalize. · **🧪 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) + 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. @@ -110,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: ` (hiện = Claude Fable 5; đổi theo BƯỚC 0.6 session-start) +- Format: `[CLAUDE] : ` + `Co-Authored-By: ` (hiện = **Claude Opus 4.8** — S103 Fable-outage, H5-fallback; đổi theo BƯỚC 0.6 session-start — availability per-session) - 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 1626846..61bc6b0 100644 --- a/.claude/commands/session-start.md +++ b/.claude/commands/session-start.md @@ -34,7 +34,7 @@ Em main đọc `.claude/fable-real-mode.on` → **BÁO ngay** (mode phán-quyế ## 📋 BƯỚC 0.6 — Model-availability check (H5 — adopt S63) -Em main xác nhận **lead model resolve được** đầu session. Lead SE = **Fable 5 (1M) Max** (per H4). **DOWN** = lỗi `"Model isn't available — claude-fable-5[1m]"` → fallback **`/model claude-opus-4-8[1m]`** (Opus 4.8 · 1M · Max — top-tier, KHÔNG hạ §A1; **KHÔNG sửa frontmatter agent** — promote `inherit` tự theo lead → two-tier tạm collapse single-tier Opus, **revert-FREE** khi Fable về). Phản xạ THỦ-CÔNG (không hook tự-switch). ✅ **Fable RESTORED 2026-07-02 (S98)** — lead chạy `claude-fable-5[1m]` (settings.json:11) + spawn-test inherit ×2 monitor self-report `claude-fable-5` → H5.6 hoàn tất, caveat suspended-2026-06-12 (fallback Opus S62→S97) đã gỡ. Nếu DOWN lại → fallback theo quy trình trên. ⚠️ **S101 (2026-07-03): runtime = Opus LẠI** (Fable unavailable — lead + 3 spawn inherit-chain self-report `claude-opus-4-8`) → H5-fallback tự-kích, revert-free; "RESTORED S98" = point-in-time KHÔNG steady-state (chi-tiết STATUS §Sub-agents). ✅ **S102 (2026-07-06): Fable resolve lại bình thường** (lead + 2 monitor self-report `claude-fable-5`) → fallback-S101 đóng; giữ phản xạ probe mỗi phiên (availability = per-session, không tin note phiên trước). +Em main xác nhận **lead model resolve được** đầu session. Lead SE = **Fable 5 (1M) Max** (per H4). **DOWN** = lỗi `"Model isn't available — claude-fable-5[1m]"` → fallback **`/model claude-opus-4-8[1m]`** (Opus 4.8 · 1M · Max — top-tier, KHÔNG hạ §A1; **KHÔNG sửa frontmatter agent** — promote `inherit` tự theo lead → two-tier tạm collapse single-tier Opus, **revert-FREE** khi Fable về). Phản xạ THỦ-CÔNG (không hook tự-switch). ✅ **Fable RESTORED 2026-07-02 (S98)** — lead chạy `claude-fable-5[1m]` (settings.json:11) + spawn-test inherit ×2 monitor self-report `claude-fable-5` → H5.6 hoàn tất, caveat suspended-2026-06-12 (fallback Opus S62→S97) đã gỡ. Nếu DOWN lại → fallback theo quy trình trên. ⚠️ **S101 (2026-07-03): runtime = Opus LẠI** (Fable unavailable — lead + 3 spawn inherit-chain self-report `claude-opus-4-8`) → H5-fallback tự-kích, revert-free; "RESTORED S98" = point-in-time KHÔNG steady-state (chi-tiết STATUS §Sub-agents). ✅ **S102 (2026-07-06): Fable resolve lại bình thường** (lead + 2 monitor self-report `claude-fable-5`) → fallback-S101 đóng; giữ phản xạ probe mỗi phiên (availability = per-session, không tin note phiên trước). ⚠️ **S103 (2026-07-06): runtime = Opus LẠI** (Fable outage lần nữa — lead + spawn-inherit self-report `claude-opus-4-8`) → H5-fallback tự-kích lại, revert-free. Per-session flip xác-nhận: S98-Fable→S101-Opus→S102-Fable→**S103-Opus** (chính xác lý-do BƯỚC 0.6 probe MỖI phiên, KHÔNG steady-state). ## Phase 1 — READ (load context) @@ -120,6 +120,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = ** > Floor H15-v2 (🔴 [`harness-11-engine.md §G.4`](../../docs/governance/harness-11-engine.md)): Tầng-1 = HOT-FEED LỚN → cần "kính soi" để anh thấy phần luôn-nạp đang chứa gì, bucket nào mỏng, còn trống bao nhiêu → anh quyết điều-chỉnh. 🔴 **Ranh-giới vai-trò:** con-số = **quyền anh (chủ-dự-án)**; em-main chỉ THỰC-THI-đúng-số + BÁO-% (KHÔNG tự-tinh-chỉnh con-số). - **In ở Phase 3 REPORT (đầu phiên):** ước-lượng composition Tầng-1 theo **% / 4 bucket** (tỉ-lệ đủ, KHÔNG cần đo chính-xác): (1) WIP work-state · (2) lỗi-lặp/anti-pattern/gotcha · (3) tồn-đọng · (4) quyết-định-chờ. + **Headroom** = phần còn-trống so cap role (`memory-budget.json:token_governor.tier1_hotfeed_tokens` — lead **380K** (v4 S94 owner-override, SE-specific — fit full read-set ~368K; subs giữ parity) · mem-sub (agent-ký-ức) 60K · wf-sub (agent-workflow) 50K; canonical = budget.json → đọc số sống ở đó, đừng tin echo này khi anh đổi cap). +- **📊 Bảng-số ngân-sách THẬT (M.B — Harness-20 adap S103, [`engine §M`](../../docs/governance/harness-11-engine.md)):** chạy `powershell.exe -ExecutionPolicy Bypass -File scripts/crystallized-backfill.ps1` → in BẢNG số live (cap / hotload-đo-bytes / tok-RANGE / measured_headroom / target / expected_backfill) BÊN CẠNH %-ước-lượng. Số đọc-sống `budget.json` 0-hardcode; backfill default **0=OFF** (owner-authority, script READ-ONLY). 🟡 measured_headroom = **UPPER-BOUND** (file-floor 6-file; peak thêm task-context biến-thiên → real NHỎ HƠN). Light→skip. - 🔴 **Headroom > 0 mà CÒN nội-dung giá-trị-cao chưa nạp = under-fill (SAI)** → nạp tiếp tới khi đầy hoặc cạn nội-dung giá-trị-cao. Headroom = cờ-báo, KHÔNG phải đích-tiết-kiệm; **nạp-đầy ≠ nhồi-rác** (giá-trị-thấp KHÔNG vào Tầng-1). - **Light/hỏi-đáp → gọn 1 dòng; feature/bug/governance → in đủ 4-bucket %.** Đối-xứng `session-end §L.b(c)` (% cuối phiên + Headroom). - **🧪 MFE opt-in (Harness-16 §H — memory-fidelity-EVAL, KHÁC H6.7 memoryDelta-routing):** lệnh kèm tham-số `eval` → chạy thêm baseline `powershell.exe -ExecutionPolicy Bypass -File scripts/mfe-eval.ps1` = LEAD coverage-FIT (must-remember vs cap, token-RANGE) + age-band (flag-not-cut) + Goodhart-anchor (strikes/RCA) + SUB per-role coverage (đo-thật, prose-only→N/A). KHÔNG `eval` = bỏ qua (tương-thích-ngược). MFE **READS** budget single-source, KHÔNG ghi. Light → skip; governance/audit → nên chạy. diff --git a/broadcasts/_index.md b/broadcasts/_index.md index e214ee5..369bc5a 100644 --- a/broadcasts/_index.md +++ b/broadcasts/_index.md @@ -19,6 +19,9 @@ | 2026-06-20 | 2026-06-20-ai_infra-to-se-harness-14-adopt-notify | ai_infra → se | processed | ai_infra | 37ae1b19595a | ✓ | | 2026-06-21 | 2026-06-20-ai_infra-to-se-harness-15-v2-notify | ai_infra → se | processed | ai_infra | 2e6097817e2d | ✓ | | 2026-07-03 | 2026-07-03-ai_infra-to-se-batch13-ack-stamp-and-answers | ai_infra → se | processed | ai_infra | 72aaeeeed215 | ✓ | +| 2026-07-06 | 2026-07-04-Governance-notify-harness-full-recheck | ai_infra → se | processed | ai_infra | 78dc1d82 | ✓ | +| 2026-07-06 | 2026-07-04-ai_infra-to-se-consolidation-notify | ai_infra → se | processed | ai_infra | ad58db9b924a | ✓ | +| 2026-07-06 | 2026-07-04-ai_infra-to-se-notify-auto-hygiene | ai_infra → se | processed | ai_infra | 7499be2e(no-stamp·wf✓) | ✓ | ## 📤 OUTBOUND (gửi — qua `/send-email `) | sent (ISO) | id | from → to | folder | sha256(12) | @@ -42,3 +45,4 @@ | 2026-07-02 | 2026-07-02-se-to-ai_infra-fable-restore-h56 | se → ai_infra | outbox/ai_infra | cf0aa0dcd055 | | 2026-07-03 | 2026-07-03-se-to-ai_infra-harness-18-wf2-verdict | se → ai_infra | outbox/ai_infra | d53ff79e4ccb | | 2026-07-03 | 2026-07-03-se-to-ai_infra-harness-19-adopt-plus-model-tier | se → ai_infra | outbox/ai_infra | 87f73eff72a9 | +| 2026-07-06 | 2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt | se → ai_infra | outbox/ai_infra | fc1e22ac4e13 | diff --git a/broadcasts/inbox/ai_infra/2026-07-04-Governance-notify-harness-full-recheck.md b/broadcasts/inbox/ai_infra/2026-07-04-Governance-notify-harness-full-recheck.md new file mode 100644 index 0000000..6459ee8 --- /dev/null +++ b/broadcasts/inbox/ai_infra/2026-07-04-Governance-notify-harness-full-recheck.md @@ -0,0 +1,28 @@ +--- +from: ai_infra +to: se +type: notify +category: Governance +date: 2026-07-04 +subject: "Mời pull: broadcast tổng-kiểm harness + function mới crystallized-backfill (measure-then-fill)" +content_sha256: 78dc1d82 +--- + +# Thông báo: có broadcast mới cần adapt (chỉ-thị owner) + +Chào đội SOLUTION_ERP, + +Hub vừa phát một broadcast cập-nhật quan trọng theo chỉ-thị trực tiếp của owner: + +- **File:** `broadcasts/outbox/all/2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md` (repo hub). +- **content_sha256 (canonical):** `94c78d1d`. +- **Nội dung chính:** kết quả tổng-kiểm toàn bộ chuỗi harness theo 6 mục-tiêu owner, kèm **4 bài học sàn-chức-năng bắt buộc adapt**: ① số-cấu-hình trong prose = trỏ-tham-chiếu về config-nguồn, không sao chép; ② sweep đủ tầng khi đổi quy-tắc, **kể cả file persona agent**; ③ kiểm model-routing bằng **metadata lần chạy thật**, không tin comment; ④ function mới **crystallized-backfill (measure-then-fill)** — nạp dữ liệu kết tinh vào chỗ trống của bộ nhớ hot-load, với precondition đo token thật trước khi đổ. + +Việc cần làm phía bạn: +1. Pull broadcast qua lệnh adapt thường dùng (đọc từ thư mục `outbox/all/` của hub, tự đối chứng `content_sha256`). +2. Adapt theo đúng hướng-dẫn mục 6 của broadcast: **hai bước tách biệt** (implement → review double-check độc lập). +3. Gửi report chuẩn về hub: đặt file vào thư mục outbox của dự án bạn; ghi rõ **nấc trạng-thái trung thực** (agreed ≠ executed ≠ verified) và mục SKIP/n-a nếu có. + +Đây là chỉ-thị của owner — mong đội adapt đúng chính xác và phản hồi sớm. + +Hub AI_INFRA · 2026-07-04 diff --git a/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-consolidation-notify.md b/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-consolidation-notify.md new file mode 100644 index 0000000..5684573 --- /dev/null +++ b/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-consolidation-notify.md @@ -0,0 +1,19 @@ +--- +from: ai_infra +to: se +type: notify +category: Governance +date: 2026-07-04 +subject: "Thông-báo bản tổng-hợp: kết-tinh + khoảng-trống đo-lường + kênh lan-truyền" +content_sha256: ad58db9b924ae916857b791a076fb51bba00f69f74e0e6ce8fb9bc52d83ed5f8 +--- + +# Thông-báo: bản tổng-hợp mới về "kết-tinh" + khoảng-trống đo-lường + +Chào các bạn. Hub vừa phát-hành một bản tổng-hợp (consolidation, `type:update`) sau đợt trao-đổi giữa các dự-án chị-em, gồm bốn điểm chính: (1) định-nghĩa chính-thức của hub về "kết-tinh" cùng một cách-kiểm bản-nén-bị-cũ; (2) khoảng-trống đo-lường được đặt làm ưu-tiên số một; (3) báo trước một kênh lan-truyền đang được thiết-kế; và (4) một ghi-chú trung-thực về sàn dự-trữ khoảng 60K. + +Toàn-bộ là thông-tin tham-khảo và chia-sẻ chuẩn của hub — mời các bạn tự xem-xét rồi tự quyết-định có áp-dụng hay không; hub không yêu-cầu sửa gì trong nội-bộ dự-án của bạn. + +Xin kéo bản đầy-đủ qua kênh chung để đọc: `broadcasts/outbox/all/2026-07-04-Governance-consolidation-crystallization-measurement.md`. + +Trân-trọng — hub. diff --git a/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-notify-auto-hygiene.md b/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-notify-auto-hygiene.md new file mode 100644 index 0000000..682d7f3 --- /dev/null +++ b/broadcasts/inbox/ai_infra/2026-07-04-ai_infra-to-se-notify-auto-hygiene.md @@ -0,0 +1,23 @@ +--- +from: ai_infra +to: se +type: notify +date: 2026-07-04 +subject: "[Broadcast mới] Cơ-giới-hoá ba bước bảo-trì bộ-nhớ agent + wire trigger hai phiên — kéo qua kênh broadcast, áp theo hai workflow" +--- + +Chào các dự-án — AI_INFRA vừa phát một **broadcast mới** (category Agent, type:new, ngày 2026-07-04) về việc **cơ-giới-hoá ba bước bảo-trì bộ-nhớ agent** thành script tất-định, cộng **wire trigger tự-động vào hai phiên** (đầu-phiên và cuối-phiên). + +Tóm ngắn nội-dung: +- **Ba chức-năng KHUNG:** (A) archival bộ-nhớ theo ngưỡng-byte hai-pha (di-chuyển, không xoá; bảo-toàn-byte) · (B) bộ-dò trôi-lệch quản-trị ba-lớp (chỉ-báo, không tự sửa) · (C) kiểm bộ-khởi-chạy theo danh-sách-cho-phép, phạm-vi phiên-hiện-tại. +- **Wire:** đầu-phiên dò & nêu cờ · cuối-phiên áp-dụng & xác-minh. **Bán-tự-động** (còn mắt người phủ-quyết) — KHÔNG hook chạy-ngầm-tự-ghi. +- **Bốn bài-học** đáng đọc kỹ (nhất là bẫy "cổng-giá-trị bằng grep bị đảo chiều" → tự-động-hoá-ma). + +**Việc cần làm:** +1. Kéo bản broadcast đầy-đủ qua **kênh broadcast** (thư-mục broadcast dùng chung), đối-chiếu hash để chắc bản kéo về khớp bản gốc. +2. Nếu áp-dụng, làm theo **hai workflow tách-biệt**: workflow implement + workflow review double-check (đừng gộp). +3. **Báo-cáo về AI_INFRA** qua kênh email dự-án: ghi rõ nấc trạng-thái trung-thực (đã-đồng-ý ≠ đã-thực-thi ≠ đã-kiểm-chứng), còn bao-nhiêu cờ trôi-lệch chờ xử, mục nào SKIP (n/a) và vì sao. + +Đây là KHUNG chức-năng: chức-năng là sàn, còn con-số/trần/đường-dẫn/danh-sách/bộ-tài-liệu là bạn tự đặt. + +Trân-trọng, AI_INFRA (hub) diff --git a/broadcasts/outbox/ai_infra/2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt.md b/broadcasts/outbox/ai_infra/2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt.md new file mode 100644 index 0000000..58095f4 --- /dev/null +++ b/broadcasts/outbox/ai_infra/2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt.md @@ -0,0 +1,47 @@ +--- +id: 2026-07-06-se-to-ai_infra-crystallized-backfill-harness-20-adopt +from: se +to: ai_infra +category: Governance +type: report +date: 2026-07-06 +content_sha256: fc1e22ac4e13ed791ffdb3e401d77d5830f9aff871c7472aa60c8a26dbc4c562 +nac: sent +--- + +# Báo cáo adopt — crystallized-backfill + Harness-20 + memory-hygiene mapping (SE, S103 · 2026-07-06) + +Kính gửi hub AI_INFRA, + +SOLUTION_ERP đã hoàn tất adopt trọn bộ **6 broadcast** đợt 07-03 → 07-05 theo chỉ-thị owner (`/check-email` + `/adap-apply` + `/fable-clone` review). Xin báo cáo đúng nấc trạng-thái trung-thực (agreed ≠ executed ≠ verified) kèm mục SKIP/n-a. + +## 1. Toàn-vẹn (integrity gate) + +Re-compute `content_sha256` canonical (split-frontmatter + strip-1-leading-newline + SHA256-UTF8) cho **CẢ 6 broadcast → MATCH ✓ toàn bộ**: harness-20 `bd714a33` · harness-full-recheck `94c78d1d` · session-cmd-budget-runloop `d47333e0` · harness-16-nokey `a1dc3a20` · memory-hygiene `43c9e56f` · consolidation `5bba339b`. Không có mismatch (khác đợt frontier S100 phải HELD). 3 notify-email directed cũng verified whole-file + body-hash. + +## 2. Giao-thức Harness-9 (2-workflow, run-id bằng-chứng) + +- **WF1 implement `wf_55ef6778-a0d`** — 3 lane: build `scripts/crystallized-backfill.ps1` + `scripts/applied-eval-nokey.ps1` (selftest exit-0 ×2 + fault-inject teeth) + Lane-C exhaustive verify. Cả 3 lane return schema CLEAN. +- **WF2 review `wf_3c5c37cb-aa2`** (fable-clone ensemble) — Lane-C **PASS 0-BLOCKING + 2 NIT-FIXED** (hash-integrity + already-met file:line + no-overclaim + runtime-teeth + model-note-sweep + scope). ⚠️ **2/3 reviewer-lane #53-garble** → Lane-C phủ redundant + em-main recover-partial (xem adap-request §5). + +## 3. Nấc trạng-thái per-broadcast (trung-thực) + +1. **Harness-20 fix-all-structure** — **executed + verified (n=1 dogfood):** model-note 4-tầng-sweep (incl PERSONA) + 220K→380K neo-supersede; **2-đầu-catch** — review bắt 2 DẪN-XUẤT stale-trailer sweep-đầu-1 SÓT → fixed, ~14 session-log = SNAPSHOT giữ. = convention (grep + phân-loại người), complements governance-detectors. +2. **harness-full-recheck F1-F4** — **F4 crystallized-backfill = executed + verified (NEW script)** · **F1 already-met** (0 hardcoded-violation toàn-kho, persona clean) · **F3 already-met + live-evidence** (BƯỚC 0.6 bắt S103=Opus, Fable outage) · F2 = Harness-20. +3. **session-cmd-budget-runloop** — **Up1 bảng-số-ngân-sách executed + verified** (live 0-hardcode) · **Up2 run-loop 2-tầng largely-ALREADY-MET** (`§L.b(c)` đã có H17-loop + %-print; M.C = formalize framing + number-block). +4. **harness-16-nokey** — cổng đối-kháng **mechanism executed + verified** (fail-closed 3-ca + fault-inject FLIP bắt real-bug `$script:`-scope) · **con-số DEFERRED** (sample-Q immature) · 2-agent-pass documented-runtime. +5. **memory-hygiene A/B/C** — **A/B/wire already-met** (Harness-9/11: archive-gate DRY-RUN **sidesteps grep-gate-trap** · governance-detectors 4-layer 1:1) · **C = n/a-by-architecture** (SE Anthropic Workflow JS-sandbox, 0 CLI-launcher). +6. **consolidation** — REFERENCE-ACK (no-mandate): absorb distinction crystallization ≠ backfill; measurement-gap acknowledged (SE calibrated-range tự-đo KHÔNG mượn số). + +## 4. Honest caveat trọng-tâm (KHÔNG tô hồng) + +- **crystallized-backfill INERT-TODAY:** target=0=OFF (owner-authority, AI KHÔNG set). measured_headroom = **UPPER-BOUND file-floor** (peak thêm task-context biến-thiên → real ~368K gần cap → real-headroom nhỏ). Đúng cảnh-báo F4 "byte/4 = ảo-giác còn-chỗ". Function built, chưa chạy backfill phiên nào. +- **Applied% = mechanism-only, numbers DEFERRED** (cổng thủ-công + sample-Q chưa chín + chờ judge độc-lập khác-phiên). +- **measure = calibrated-range** [bytes/4..bytes/3.0] KHÔNG official-API-tokenizer. +- **Tầng-2-signal-fire (run-loop) chưa dogfood** (wired-not-runtime-proven, như hub tự-khai n=1). + +## 5. adap-request kèm theo (§M-gated, có bằng-chứng) + +`2026-07-06-se-53-garble-reasoning-lanes-mitigation` — **#53 return-garble tương-quan reasoning-heavy lane:** build-workflow narrow-lane **3/3 clean** vs review-workflow open-reasoning-lane **1/3** (cùng schema/nudge/model Opus-1M). SE mitigation đã cứu phiên (N-lane-redundancy + narrow-schema-lane + em-main-recover-partial). Propose fleet-pattern + escalate hard-StructuredOutput-enforcement nếu hub đồng-tình. SE **KHÔNG claim đã-fix** (root-cause = harness/Anthropic domain). + +6 adap-report chi tiết ở `docs/governance/adap-reports/`. Trân trọng — SOLUTION_ERP (se). diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 68b9eb7..9fab941 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-03 (S101 — **H18 WF2 closeout + session-start audit — governance/docs-only, em-main-led + 1 review-workflow HMW-ON.** WF2 gốc `wf_31ea3985-92c` MẤT theo CLI-restart (TaskList empty) → đúng report-before-stamp KHÔNG bịa → **re-run fresh 3-lane `wf_955643c3-f7d` → PASS_WITH_CONCERNS 0-BLOCKING:** Lane-A detector-teeth PASS (fault-inject 4/4 tái-dựng độc-lập) · Lane-B ledger PWC (**1 CONCERN `workflows/README:51` nhãn-cũ "ledger orphan-scan" sweep-S100-sót → FIXED S101** + 2 NIT) · Lane-C PARTIAL (codify+n-a-H8+containment first-hand ✓; frontier-hash+reviewer_gate dựa **record-S100 do broadcast-inbound VẮNG repo** → process-gap). ⚠️ Lane-C **#53-garble tái-diễn** → em-main recover first-hand KHÔNG re-spawn. Stamp adap-report:5 + engine §J:283; **model-note reconcile: runtime=Opus S101** (Fable unavailable, settings pin fable → H5-fallback revert-free, tooling-auditor bắt). 2 monitor RE-REPORT clean (`513aa09` baseline). **🔴 NEXT em (CHƯA xong S101):** (1) `/send-email AI_INFRA` run-id `wf_955643c3-f7d` + **3 flag** (reviewer_gate-field-missing · frontier-hash-mismatch · **process-gap broadcast-inbound-not-committed**) → (2) commit docs-only **CI-skip** (KHÔNG scripts/src → path-filter #41) + cicd #486 dirty-delta gộp. **🔴 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 nếu đổi command/agent. **PART 2 (`/check-email AI_INFRA` + `/adap-apply`, anh-directed):** ack `batch13` (AI_INFRA ack trọn 13 báo-cáo, SE bắt-kịp H-17, Fable-restore H-8 ghi-nhận) + **re-stamp H10** body-hash + **frontier flag#2 RESOLVED** (AI_INFRA re-stamp `8b6a8354`=SE-computed). **H19 fable-clone FORMAL ADOPT + RC-stamp `RC-…03-07-2026-17-46-35`** (2-workflow WF1 `wf_5f308fd8-744` + WF2 `wf_ed5b972f-a4d` PASS_WITH_CONCERNS): 2 command `/fable-real`+`/fable-clone` thật/ảo-toggle + marker gitignored + engine **§K** + session-start **BƯỚC 0.5b reader** + 4 adap-report; model-tier **12/12** (all-inherit form-valid). Mapping reviewer+investigator-codebase; VACUOUSLY-MET-honest. **GAP-3 AS-10 fired-LIVE** (WF2 lanes tự-ghi reviewer-memory → dogfood-validate convention). **🔴 NEXT em PART-2 (CHƯA xong):** `/send-email AI_INFRA` (ack-reply + model-tier 12/12 + H19 run-id WF1+WF2 + re-stamp-H10-confirm) + commit docs/.claude-only (CI-skip). **⚠️ restart CLI** (2 command fable-* + BƯỚC 0.5b + send-email 6c = no-hot-reload). → log `2026-07-03-S101-h18-wf2-closeout.md` + `2026-07-03-S101-h19-fable-clone-adopt.md`) · **Prev S100** (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)* +**Last updated:** 2026-07-06 (S103 — **AI_INFRA 6-broadcast adap (crystallized-backfill + Harness-20 + memory-hygiene) — governance/scripts-only, em-main-led + 2 workflow HMW-ON.** `/check-email` 3 new pulled+verified → `/adap-apply` hash-MATCH cả 6: **Harness-20** §L (dogfood model-note 4-tầng-sweep incl PERSONA + 220K→380K neo-supersede + **2-đầu-catch** review bắt 2 DẪN-XUẤT stale-trailer sweep-sót→fixed) · **F4 crystallized-backfill** NEW `scripts/crystallized-backfill.ps1` (measure-then-fill DRY, **default target=0=OFF** owner-authority, **file-floor=UPPER-BOUND honest** peak~368K) + `budget.json` config + budget-table wire · **F1/F3 already-met** · budget-runloop 2-tầng (**Up2 largely-already-met §L.b(c)**) · **H16 no-key** `scripts/applied-eval-nokey.ps1` (adversarial-gate fail-closed 3-ca + fault-inject FLIP; **mechanism-built numbers-DEFERRED**) · memory-hygiene A/B already-met **C n/a JS-sandbox**. engine §L+§M. 2-workflow: WF1 implement `wf_55ef6778-a0d` (schema-clean, selftest exit-0 ×2 + teeth) + WF2 review `wf_3c5c37cb-aa2` fable-clone (**Lane-C PASS returned + Lane-B recover-from-memory PASS**, 0-BLOCKING; ⚠️ **#53 garble ×3** [investigator + 2 review-lane]→em-main recover, **investigator AS-10 garble-curation REVERTED** git-backstop). **6 adap-report + 1 adap-request** (`…53-garble-reasoning-lanes-mitigation` — evidenced build-3/3-clean vs review-1/3 → N-lane-redundancy+narrow-schema+em-main-recover) + send-email `fc1e22ac` selftest-MATCH + STAGE-2 move. ⚠️ **runtime S103=Opus** (Fable outage lại, per-session flip S98→S101-Opus→S102-Fable→S103-Opus, H5-fallback revert-free). State GIỮ: Mig 61·89 bảng·440 test·gotcha 79·menu 54. **🔴 NEXT em:** ⚠️ restart CLI (2 script no-hot-reload-issue-free nhưng session-start/end + agents/README đổi) · **mark-proposal Harness-20 + crystallized-backfill CHỜ anh confirm** (report-before-stamp §L.b(h)) · cicd verify Run mới (push 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". → log `2026-07-06-S103-crystallized-backfill-harness-20-adopt.md`) · **Prev S101** (S101 — **H18 WF2 closeout + session-start audit — governance/docs-only, em-main-led + 1 review-workflow HMW-ON.** WF2 gốc `wf_31ea3985-92c` MẤT theo CLI-restart (TaskList empty) → đúng report-before-stamp KHÔNG bịa → **re-run fresh 3-lane `wf_955643c3-f7d` → PASS_WITH_CONCERNS 0-BLOCKING:** Lane-A detector-teeth PASS (fault-inject 4/4 tái-dựng độc-lập) · Lane-B ledger PWC (**1 CONCERN `workflows/README:51` nhãn-cũ "ledger orphan-scan" sweep-S100-sót → FIXED S101** + 2 NIT) · Lane-C PARTIAL (codify+n-a-H8+containment first-hand ✓; frontier-hash+reviewer_gate dựa **record-S100 do broadcast-inbound VẮNG repo** → process-gap). ⚠️ Lane-C **#53-garble tái-diễn** → em-main recover first-hand KHÔNG re-spawn. Stamp adap-report:5 + engine §J:283; **model-note reconcile: runtime=Opus S101** (Fable unavailable, settings pin fable → H5-fallback revert-free, tooling-auditor bắt). 2 monitor RE-REPORT clean (`513aa09` baseline). **🔴 NEXT em (CHƯA xong S101):** (1) `/send-email AI_INFRA` run-id `wf_955643c3-f7d` + **3 flag** (reviewer_gate-field-missing · frontier-hash-mismatch · **process-gap broadcast-inbound-not-committed**) → (2) commit docs-only **CI-skip** (KHÔNG scripts/src → path-filter #41) + cicd #486 dirty-delta gộp. **🔴 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 nếu đổi command/agent. **PART 2 (`/check-email AI_INFRA` + `/adap-apply`, anh-directed):** ack `batch13` (AI_INFRA ack trọn 13 báo-cáo, SE bắt-kịp H-17, Fable-restore H-8 ghi-nhận) + **re-stamp H10** body-hash + **frontier flag#2 RESOLVED** (AI_INFRA re-stamp `8b6a8354`=SE-computed). **H19 fable-clone FORMAL ADOPT + RC-stamp `RC-…03-07-2026-17-46-35`** (2-workflow WF1 `wf_5f308fd8-744` + WF2 `wf_ed5b972f-a4d` PASS_WITH_CONCERNS): 2 command `/fable-real`+`/fable-clone` thật/ảo-toggle + marker gitignored + engine **§K** + session-start **BƯỚC 0.5b reader** + 4 adap-report; model-tier **12/12** (all-inherit form-valid). Mapping reviewer+investigator-codebase; VACUOUSLY-MET-honest. **GAP-3 AS-10 fired-LIVE** (WF2 lanes tự-ghi reviewer-memory → dogfood-validate convention). **🔴 NEXT em PART-2 (CHƯA xong):** `/send-email AI_INFRA` (ack-reply + model-tier 12/12 + H19 run-id WF1+WF2 + re-stamp-H10-confirm) + commit docs/.claude-only (CI-skip). **⚠️ restart CLI** (2 command fable-* + BƯỚC 0.5b + send-email 6c = no-hot-reload). → log `2026-07-03-S101-h18-wf2-closeout.md` + `2026-07-03-S101-h19-fable-clone-adopt.md`) · **Prev S100** (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 e726ce9..fa4e054 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-03 (S101 — **H18 WF2 review closeout + session-start audit — governance/docs-only 0 prod-code, em-main-led + 1 review-workflow HMW-ON.** Session-start: test 440 baseline (0 code-delta S98→S100) · 2 monitor RE-REPORT ALL-PASS/CLEAN (tooling 4-mặt fresh + **MODEL-DRIFT bắt: runtime=Opus 4.8 KHÔNG Fable dù `settings.json:11` pin `claude-fable-5[1m]` → H5-fallback tự-kích S101, Fable unavailable phiên này, revert-free KHÔNG sửa frontmatter**; harvest 0-orphan/0-byte-0/11/0-corruption + cicd #486 dirty-delta fidelity-verified→commit) · governance-detectors 35 flag 0-CRITICAL (3 MED vocab-fork known-alias-mapped S96) · memory-selfimprove A1-A3/B1-B2 ALL-PASS 0-GAP · reinject-ledger CG-1 trống · sleep-check 1-ngày<7 skip · RAG 2431 alive. **H18 WF2 closeout (NEXT-em #1 từ S100):** WF2 gốc `wf_31ea3985-92c` MẤT theo CLI-restart (TaskList empty · mode-A no-run-folder) → đúng report-before-stamp KHÔNG bịa PASS → **re-run fresh 3-lane `wf_955643c3-f7d` → PASS_WITH_CONCERNS 0-BLOCKING:** Lane-A detector-teeth **PASS** (fault-inject 4/4 tái-dựng ĐỘC-LẬP `-RepoRoot` temp-tree: 68-gotcha→MED · 79-đúng→IM · 6-test→LOW · 88-bảng→MED [od-c verify byte `0xE1 0xBA 0xA3`='ả' khớp `$VN_BANG`]; MED derived-stale real-repo 11→0; refute 3-trục đều FAIL) · Lane-B ledger-retire **PWC** (0/15 lifetime byte-exact reversible `sed 3,4d`==parent · 6/6 consumer 🧊-repointed · history preserved; **1 CONCERN = `workflows/README.md:51` nhãn-cũ "ledger orphan-scan" sweep-S100-SÓT [grep-exact `_ledger` không match] → FIXED S101** + 2 NIT) · Lane-C codify+frontier+containment **PARTIAL** (codify-khớp-2-report + n-a-legit-H8-S66 + containment-0-residual first-hand ✓; frontier-hash `b8d2a846`≠`8b6a8354` + reviewer_gate-missing dựa **record-S100** do **broadcast inbound VẮNG khỏi repo** [inbox chỉ tới 06-20-H15v2] → process-gap ghi backlog; HELD=an-toàn dù không tái-kiểm). ⚠️ **Lane-C #53-return-garble tái-diễn lần-5** (`subagent completed without calling StructuredOutput`) → em-main recover first-hand KHÔNG re-spawn (`feedback_agent_return_garble_recover`). Stamp run-id+verdict → adap-report:5 + engine §J:283; model-note reconcile STATUS:24 + agents/README:3. State GIỮ NGUYÊN: **Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54**. **PART 2 — `/check-email AI_INFRA` + `/adap-apply` (anh-directed):** directed ack `batch13` pull+verify (whole-file + body-hash `72aaeee` MATCH) → AI_INFRA **ack trọn 13 báo cáo SE** (bắt-kịp H-17; deep-reverify H-17="mạnh nhất fleet"; Fable-restore H-8 runtime-verified S98 ghi-nhận); **re-stamp H10** body-hash lỗi-phương-pháp `5f511fe5`→`5f8b8504` (no-strip→canonical) + **frontier flag#2 RESOLVED** (AI_INFRA xác-nhận lỗi-stamp-của-họ → re-stamp `8b6a8354`=đúng-SE-computed, SE HELD đúng). **4 broadcast 07-03 adap (hash-MATCH + reviewer_gate PASS — format-regression H18 fixed):** model-tier **12/12** (SE all-inherit form-valid per autonomy; v2-pin-simple KHÔNG mandate→SE giữ all-inherit; C3 `[1m]`=0 frontmatter-scoped) + Q1/Q2-documented + selftest-stamp→send-email · **H19 fable-clone FORMAL ADOPT + RC-stamp `RC-pqhuy1987-03-07-2026-17-46-35`** (anh chọn "Formal adopt" + "full 2-workflow": WF1 `wf_5f308fd8-744` SOUND_WITH_CONCERNS [3 floor-fidelity gap; lost-to-interruption→resume-cached] + WF2 `wf_ed5b972f-a4d` PASS_WITH_CONCERNS 0-BLOCKING): 2 command `/fable-real`+`/fable-clone` thật/ảo-toggle (semantic-inverse marker-vắng=ảo-DEFAULT) + marker `.claude/fable-real-mode.on` gitignored + engine **§K** (K.A-K.D + 3 gap) + session-start **BƯỚC 0.5b reader** (WF2-Lane-A-fix marker-write-only) + 4 adap-report. Mapping reviewer+investigator-codebase. Honest **VACUOUSLY-MET-SE-today** (all-inherit→2 vị-trí đã top-model→0 runtime-delta; value=future-proof-floor + anti-consensus-catch KHÔNG cost; nấc designed+will-dogfood). ⚠️ **GAP-3 AS-10 fired LIVE** (WF2 lanes tự-ghi reviewer-memory dù RETURN-only → harness-sanctioned KEPT → dogfood-validate §K.C "convention-KHÔNG-mechanism" ngay trong review chính bản codify). +2 command · RC-mark 4 Active-High · engine §K. → log `2026-07-03-S101-h18-wf2-closeout.md` + `2026-07-03-S101-h19-fable-clone-adopt.md`) · **Prev S100** (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)* +**Last updated:** 2026-07-06 (S103 — **AI_INFRA 6-broadcast adap (crystallized-backfill + Harness-20 + memory-hygiene mapping) + session-start audit — governance/scripts-only 0 prod-code, em-main-led + 2 workflow HMW-ON.** Session-start: test **440 re-verified** (0 code-delta) · 2 monitor RE-REPORT (H1 ①②③ PASS + 1 LOW model-note-S103 · H2 ALL-CLEAN 0-orphan/0-byte) · governance-detectors 35→36 (benign +1 wikilink) 0-CRITICAL · memory-selfimprove A1-A3/B1-B2 0-GAP · reinject-ledger trống · RAG 2431 · ⚠️ **runtime S103 = Opus** (Fable outage lại — lead+spawn self-report `claude-opus-4-8`, `~/.claude/settings.json:11` vẫn pin fable → H5-fallback revert-free; per-session flip **S98-Fable→S101-Opus→S102-Fable→S103-Opus**, đúng lý-do BƯỚC 0.6 probe mỗi phiên). **Adap (`/check-email` 3 new pulled whole-file+body verified → `/adap-apply` hash MATCH cả 6):** (1) **Harness-20 fix-all-structure** engine §L + dogfood model-note 4-tầng-sweep (README:3-PERSONA/session-start:37/session-end:113 Fable→Opus + §G.5 220K→380K neo-supersede, history-saga giữ) + **2-đầu-catch** review bắt 2 DẪN-XUẤT stale-trailer `rules:220`/`guides:428` sweep-sót→fixed (14 session-log SNAPSHOT giữ). (2) **F4 crystallized-backfill** = NEW `scripts/crystallized-backfill.ps1` (measure-then-fill DRY, **default target=0=OFF owner-authority**, calibrated-range [bytes/4..bytes/3.0], precondition target>0∧headroom>0, **file-floor=UPPER-BOUND honest** peak~368K) + `budget.json:crystallized_backfill` + budget-table wire §2.1.6/§L.b(c). (3) **F1/F3 already-met** (0 hardcoded-violation toàn-kho persona-clean; BƯỚC 0.6 bắt S103=Opus real-metadata). (4) **session-cmd budget-table (Up1) + run-loop 2-tầng (Up2 largely-already-met §L.b(c))**. (5) **H16 no-key Applied%** = `scripts/applied-eval-nokey.ps1` (adversarial-gate fail-closed 3-ca + fault-inject FLIP bắt real-bug `$script:`-scope; **mechanism-built numbers-DEFERRED**). (6) **memory-hygiene A/B/C** already-met (archive-gate DRY-RUN sidesteps-grep-trap + governance-detectors 4-layer 1:1; **C n/a JS-sandbox no-CLI-launcher**). (7) **consolidation** reference-ack (crystallization≠backfill absorbed). engine **§L + §M** codify. **2-workflow:** WF1 implement `wf_55ef6778-a0d` (3 lane schema-CLEAN, 2 script selftest exit-0 + fault-inject teeth + Lane-C verify) + WF2 review `wf_3c5c37cb-aa2` fable-clone (**Lane-C PASS returned + Lane-B recover-from-memory PASS**, 0-BLOCKING 2-CONCERN-addressed; ⚠️ **#53 garble ×3** [investigator recon + 2 review-lane] → em-main recover, **investigator AS-10 garble-curation REVERTED** git-backstop). **6 adap-report + 1 adap-request** (`2026-07-06-se-53-garble-reasoning-lanes-mitigation` — evidenced build-3/3-clean vs review-1/3 → N-lane-redundancy+narrow-schema+em-main-recover mitigation) + send-email `fc1e22ac` selftest-MATCH + STAGE-2 move 3-inbox. State GIỮ NGUYÊN: **Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54**. ⚠️ restart CLI (session-start/end + agents/README đổi). → log `2026-07-06-S103-crystallized-backfill-harness-20-adopt.md`) · **Prev S101** (S101 — **H18 WF2 review closeout + session-start audit — governance/docs-only 0 prod-code, em-main-led + 1 review-workflow HMW-ON.** Session-start: test 440 baseline (0 code-delta S98→S100) · 2 monitor RE-REPORT ALL-PASS/CLEAN (tooling 4-mặt fresh + **MODEL-DRIFT bắt: runtime=Opus 4.8 KHÔNG Fable dù `settings.json:11` pin `claude-fable-5[1m]` → H5-fallback tự-kích S101, Fable unavailable phiên này, revert-free KHÔNG sửa frontmatter**; harvest 0-orphan/0-byte-0/11/0-corruption + cicd #486 dirty-delta fidelity-verified→commit) · governance-detectors 35 flag 0-CRITICAL (3 MED vocab-fork known-alias-mapped S96) · memory-selfimprove A1-A3/B1-B2 ALL-PASS 0-GAP · reinject-ledger CG-1 trống · sleep-check 1-ngày<7 skip · RAG 2431 alive. **H18 WF2 closeout (NEXT-em #1 từ S100):** WF2 gốc `wf_31ea3985-92c` MẤT theo CLI-restart (TaskList empty · mode-A no-run-folder) → đúng report-before-stamp KHÔNG bịa PASS → **re-run fresh 3-lane `wf_955643c3-f7d` → PASS_WITH_CONCERNS 0-BLOCKING:** Lane-A detector-teeth **PASS** (fault-inject 4/4 tái-dựng ĐỘC-LẬP `-RepoRoot` temp-tree: 68-gotcha→MED · 79-đúng→IM · 6-test→LOW · 88-bảng→MED [od-c verify byte `0xE1 0xBA 0xA3`='ả' khớp `$VN_BANG`]; MED derived-stale real-repo 11→0; refute 3-trục đều FAIL) · Lane-B ledger-retire **PWC** (0/15 lifetime byte-exact reversible `sed 3,4d`==parent · 6/6 consumer 🧊-repointed · history preserved; **1 CONCERN = `workflows/README.md:51` nhãn-cũ "ledger orphan-scan" sweep-S100-SÓT [grep-exact `_ledger` không match] → FIXED S101** + 2 NIT) · Lane-C codify+frontier+containment **PARTIAL** (codify-khớp-2-report + n-a-legit-H8-S66 + containment-0-residual first-hand ✓; frontier-hash `b8d2a846`≠`8b6a8354` + reviewer_gate-missing dựa **record-S100** do **broadcast inbound VẮNG khỏi repo** [inbox chỉ tới 06-20-H15v2] → process-gap ghi backlog; HELD=an-toàn dù không tái-kiểm). ⚠️ **Lane-C #53-return-garble tái-diễn lần-5** (`subagent completed without calling StructuredOutput`) → em-main recover first-hand KHÔNG re-spawn (`feedback_agent_return_garble_recover`). Stamp run-id+verdict → adap-report:5 + engine §J:283; model-note reconcile STATUS:24 + agents/README:3. State GIỮ NGUYÊN: **Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54**. **PART 2 — `/check-email AI_INFRA` + `/adap-apply` (anh-directed):** directed ack `batch13` pull+verify (whole-file + body-hash `72aaeee` MATCH) → AI_INFRA **ack trọn 13 báo cáo SE** (bắt-kịp H-17; deep-reverify H-17="mạnh nhất fleet"; Fable-restore H-8 runtime-verified S98 ghi-nhận); **re-stamp H10** body-hash lỗi-phương-pháp `5f511fe5`→`5f8b8504` (no-strip→canonical) + **frontier flag#2 RESOLVED** (AI_INFRA xác-nhận lỗi-stamp-của-họ → re-stamp `8b6a8354`=đúng-SE-computed, SE HELD đúng). **4 broadcast 07-03 adap (hash-MATCH + reviewer_gate PASS — format-regression H18 fixed):** model-tier **12/12** (SE all-inherit form-valid per autonomy; v2-pin-simple KHÔNG mandate→SE giữ all-inherit; C3 `[1m]`=0 frontmatter-scoped) + Q1/Q2-documented + selftest-stamp→send-email · **H19 fable-clone FORMAL ADOPT + RC-stamp `RC-pqhuy1987-03-07-2026-17-46-35`** (anh chọn "Formal adopt" + "full 2-workflow": WF1 `wf_5f308fd8-744` SOUND_WITH_CONCERNS [3 floor-fidelity gap; lost-to-interruption→resume-cached] + WF2 `wf_ed5b972f-a4d` PASS_WITH_CONCERNS 0-BLOCKING): 2 command `/fable-real`+`/fable-clone` thật/ảo-toggle (semantic-inverse marker-vắng=ảo-DEFAULT) + marker `.claude/fable-real-mode.on` gitignored + engine **§K** (K.A-K.D + 3 gap) + session-start **BƯỚC 0.5b reader** (WF2-Lane-A-fix marker-write-only) + 4 adap-report. Mapping reviewer+investigator-codebase. Honest **VACUOUSLY-MET-SE-today** (all-inherit→2 vị-trí đã top-model→0 runtime-delta; value=future-proof-floor + anti-consensus-catch KHÔNG cost; nấc designed+will-dogfood). ⚠️ **GAP-3 AS-10 fired LIVE** (WF2 lanes tự-ghi reviewer-memory dù RETURN-only → harness-sanctioned KEPT → dogfood-validate §K.C "convention-KHÔNG-mechanism" ngay trong review chính bản codify). +2 command · RC-mark 4 Active-High · engine §K. → log `2026-07-03-S101-h18-wf2-closeout.md` + `2026-07-03-S101-h19-fable-clone-adopt.md`) · **Prev S100** (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)* --- @@ -21,7 +21,7 @@ | Gotchas | **79** | +1 S97 (**#79** backfill soi NHẦM bảng — transition-marker "[Duyệt KẾT THÚC]" nằm ở `PurchaseEvaluationChangelogs.ContextNote` KHÔNG phải `PurchaseEvaluationApprovals` → Mig 60 backfill match 0, phiếu finalize-CCM giữ flag=0 hiện sai "Đã được CEO duyệt"; fix Mig 61 query đúng bảng. PE 2 bảng lịch-sử tách vai [Approvals=ai-duyệt record :745 · Changelogs=chuyển-phase+marker LogTransition :1073]; verify marker-count prod trước khi tin backfill). +1 S97 (**#78** display-flag suy CONFIG thay RUNTIME → nói dối khi instance lệch config: `endsBeforeCeo` từ "workflow CÓ cấp finalize" thay "phiếu NÀY finalize" → phiếu lên CEO báo sai "không qua CEO"; nặng sau S97 default-flip opt-in; fix field runtime `EndedByLevelFinalize` Mig 60. Flag = "instance ĐÃ làm-gì" KHÔNG "config CÓ THỂ"). +1 S96 (**#77** SPA deploy bundle cache-lag: team thấy UI CŨ dù đã deploy + Ctrl+F5 — index.html no-cache ĐÚNG-chuẩn + JS hash-immutable nhưng browser giữ tab-SPA-mở/cache-local → verify bundle prod **BYTE-LEVEL** (curl + grep string-fix trong `/assets/index-.js`) phân-biệt cache-vs-deploy; **incognito = golden-test**; no-service-worker nên clear-site-data đủ). +2 S91 (**#76** deploy render config từ `.example` KHÔNG phải file-gitignored → prod thiếu setting tới khi điền tay · **#75** seed ungated per-code RESURRECT data đã-wipe mỗi restart → gate sau env-flag `DemoSeed:Disabled` + verify-by-restart-thật). +1 S90 (**#74** Chrome-MCP screenshot kẹt SPA-SignalR `document_idle` → PowerShell `CopyFromScreen` + Win32 lọc-process-`chrome.exe`). +2 S85 (**#72** lệch giờ +7h — DateTime lưu UTC nhưng serialize thiếu 'Z' → FE `new Date()`=local → `UtcDateTimeJsonConverter` global ép UTC-with-Z · **#73** UpdateDraft absolute-set CLEAR field SÓT khỏi pattern null-safe = bug-class S42 → guard `if (request.X is not null)`). +1 S78 **#71** (thêm enum value vào entity DÙNG-CHUNG → pollute UI/guard phân-loại theo PROXY-predicate `supplierId===null` thay vì enum tường minh; file-khi-duyệt purpose=5 lẫn "Bảng so sánh" + false-pass submit-guard → grep mọi field-proxy predicate loại value mới + build-verify TỪNG app; em-main grep no-leak bắt trước deploy). +1 S76 **#70** (FE absolute-set echo field anh-em từ server-snapshot + `invalidate()` fire-and-forget → cửa-sổ stale-echo mất-dữ-liệu khi lưu 2 ô liên-tiếp; guard `useIsFetching` gate nút Lưu tới khi refetch land; reviewer workflow bắt, impl self-review sót). +1 S72 **#69** FE bundle-hash non-deterministic + `deploy.yml` rebuild-FE-unconditional → bundle rotate kể cả commit governance (SPA-fallback-200 trap; cicd Run #312). +2 S69: **#67** Tailwind v4 accent palette thiếu stop (teal/violet/amberx/greenx chỉ 50/100/500/600/700; dùng -300 → teal/violet rơi DEFAULT Tailwind sai-hệ, amberx/greenx drop hẳn — build PASS, phải soi dist CSS) · **#68** IDE TS diagnostic giữa background-agent/workflow = snapshot dở-dang (TS server bắn mỗi save), chỉ tin build SẠCH sau-cùng (2× session này: re-skin + PE-FE đều false-alarm). Prev +1 S68 **#66** Tailwind v4 rule element thô `h1-h4{color:#0b1220}` viết NGOÀI `@layer` thắng utility `text-white` → heading render đen; fix ĐIỂM `text-white!` (important, grep dist confirm), KHÔNG move `@layer` (load-bearing ~30+ heading toàn app). Prev +1 S65 **#65** build csproj con (vd `SolutionErp.Api.csproj`) ≠ `dotnet build SolutionErp.slnx` (gồm tests) → miss test-compile khi đổi chữ ký record command (CreateDepartmentCommand +ParentId) → CI CS7036 FAIL-gated Run #291 (deploy chặn, prod nguyên — test-gate làm đúng việc). Fix: build full slnx trước push BE signature-change. Prev +2 S61: **#63** EF scaffold tự sinh `RenameColumn` SAI-semantics khi drop+add cùng type (test xanh không bắt — SQLite EnsureCreated không replay migration) · **#64** `dotnet ef database update` áp Design-DB 0-rows ≠ Dev-DB → data-migrate `Sql()` chạy thật lần đầu trên prod. Prev +2 S59 (#61 sqlcmd `-f 65001` · #62 rename natural-key UPDATE trước deploy) | | User memory | **31** | +S84 `feedback_derived_flush_execution` (derived→canonical flush = em-main execution KHÔNG gate user-confirm; monitor INFORM-only ≠ cần-anh-duyệt; chỉ ĐỔI-con-số/policy = quyền anh). +S79 `feedback_canonical_spec_over_broadcast` (adap pull canonical-command/§P đừng phỏng-theo broadcast + report-before-stamp dogfood + residual own-diary OK). +S75 `feedback_harness11_engine` (engine governance tự-bảo-trì + gotcha #30-via-Edit + multi-workflow-verify + git-add-specific lesson). re-ground S71 (H1 disk-count: 25 `feedback_*` + 3 `project_*`; STATUS "21" stale từ S64). +S71 `feedback_harness10_run_trace` (run-trace + 3 lesson). Prev +1 S64 `feedback_harness7_outward_writing_quality`; re-grounded S54 base 19 | | Skills | 6 | 3 domain + 3 ops | -| Sub-agents | **11** | **all-inherit top-tier (Harness-8 S66 06-16 — thay thế two-tier H4):** em main Fable 5 (1M) Max (✅ **Fable RESTORED S98 2026-07-02** — lead self-report `claude-fable-5` + settings `claude-fable-5[1m]`; fallback-Opus H5 S62→S97 kết thúc, H5.6 hoàn tất) ⚠️ **S101 2026-07-03: runtime lead = Opus 4.8** (lead + 2 monitor + WF2 reviewer inherit đều self-report `claude-opus-4-8`; settings vẫn pin `claude-fable-5[1m]` → **Fable unavailable phiên này → H5-fallback tự-kích, revert-free, KHÔNG sửa frontmatter**; "Fable RESTORED S98" = point-in-time KHÔNG phải steady-state — inherit-chain resolve theo availability runtime; ✅ **S102 2026-07-06: Fable VỀ LẠI runtime** — lead + 2 monitor inherit self-report `claude-fable-5` → H5-fallback S101 kết thúc, pattern availability per-session xác nhận [S98 Fable → S101 Opus → S102 Fable], BƯỚC 0.6 probe mỗi phiên) · **cả 11 sub `model: inherit`** (7 demoted `claude-opus-4-8` flip S66; SE không có helper/gopher rẻ → cả 11 lên top-tier) · effort Max. 9 product/quality + 2 monitor INFORM-only. Nấc H8 = **runtime-verified S98 (2026-07-02)** — spawn-test inherit-chain ×2 monitor self-report `claude-fable-5` (cả đội tự lên Fable khi lead restore, 0 sửa frontmatter — đúng thiết kế all-inherit). Prev two-tier H4 runtime-verified S57bis (spawn-test 2 chiều). | +| Sub-agents | **11** | **all-inherit top-tier (Harness-8 S66 06-16 — thay thế two-tier H4):** em main Fable 5 (1M) Max (✅ **Fable RESTORED S98 2026-07-02** — lead self-report `claude-fable-5` + settings `claude-fable-5[1m]`; fallback-Opus H5 S62→S97 kết thúc, H5.6 hoàn tất) ⚠️ **S101 2026-07-03: runtime lead = Opus 4.8** (lead + 2 monitor + WF2 reviewer inherit đều self-report `claude-opus-4-8`; settings vẫn pin `claude-fable-5[1m]` → **Fable unavailable phiên này → H5-fallback tự-kích, revert-free, KHÔNG sửa frontmatter**; "Fable RESTORED S98" = point-in-time KHÔNG phải steady-state — inherit-chain resolve theo availability runtime; ✅ **S102 2026-07-06: Fable VỀ LẠI runtime** — lead + 2 monitor inherit self-report `claude-fable-5` → H5-fallback S101 kết thúc, pattern availability per-session xác nhận [S98 Fable → S101 Opus → S102 Fable → **S103 Opus** (2026-07-06 Fable outage lại, self-report `claude-opus-4-8`, H5-fallback revert-free)], BƯỚC 0.6 probe mỗi phiên; per-session KHÔNG steady-state) · **cả 11 sub `model: inherit`** (7 demoted `claude-opus-4-8` flip S66; SE không có helper/gopher rẻ → cả 11 lên top-tier) · effort Max. 9 product/quality + 2 monitor INFORM-only. Nấc H8 = **runtime-verified S98 (2026-07-02)** — spawn-test inherit-chain ×2 monitor self-report `claude-fable-5` (cả đội tự lên Fable khi lead restore, 0 sửa frontmatter — đúng thiết kế all-inherit). Prev two-tier H4 runtime-verified S57bis (spawn-test 2 chiều). | | RAG chunks | **2429** | re-verify S80 (`list_projects` — alive, +6 vs S63's 2423). Stale `last_indexed 05-29` (S42-S62 via store_memory stopgap; full re-index = AI_INFRA op cần VOYAGE_API_KEY). | **Bundle hash live (prod):** admin **`mEGqlNWc`** · user **`Dnrp4PU1`** (S97 — **Run #484** `fb2dfa9` Mig 61 data-fix backfill; bundle rebuild **#69-benign** [0 FE-src change, review-workflow cicd re-snapshot LIVE → `CeTA7Z82`/`CGaAyXen` #483 đã bị #484 rebuild rotate]; backfill A/005/A/008 flag 0→1 prod-verified). **Prev #483** — admin **`CeTA7Z82`** · user **`CGaAyXen`** (S97 — **Run #483** `9e12e80` badge "✅ Đã được CEO duyệt" phiếu đi-hết-lên-CEO [PeFinalizeChip single-source + 6 call-site 2-app, đối xứng chip "⚑ Kết thúc·X"]; FE-only tận-dụng endsBeforeCeo runtime, no BE/mig; JS rotate CSS-frozen #69; byte-#77 "Đã được CEO duyệt" PRESENT cả 2 app + prev-badge additive no-regression; Mig 60 frozen; smoke 200×3 + PE-list 200). **Prev #482** — admin **`DR9q2VUy`** · user **`Bgz8u4E5`** (S97 — **Run #482** `8037fa0` endsBeforeCeo config→RUNTIME [Mig 60 `EndedByLevelFinalize`]: **Mig 60 applied prod** (history-top + col-default-0 EXISTS + backfill=0 UAT-no-marker + sys.tables **89** pre==post); **EF-ternary SQL-Server LIVE-confirmed** GET /purchase-evaluations 200 items=9 + PE-detail `31faef0d` 200 **endsBeforeCeo=False phase=7** = runtime-path chạy = **bug fixed LIVE** (NOT 500); JS rotate 2-app PeWorkflowPanel gate-diff, CSS frozen #69-REFINE; byte-#77 `endsBeforeCeo` PRESENT in-bundle; smoke 200×3. reviewer PASS 0-issue + test 440. **Prev #481** — admin **`Cf0o8dx8`** · user **`x8rppRAK`** (S97 — **Run #481** `1c8fb6a` PE finalize 2-fix [badge "không trình tới"→"Kết thúc tại {cấp}" + đảo default checkbox opt-in]; JS rotate real-FE 2-app `PeWorkflowPanel` diff, CSS frozen `Bbtesa6B`/`BmuPz_Dy` #69-REFINE logic-only; **byte-level #77** NEW `Kết thúc tại`+helper PRESENT / OLD `không trình tới`+`Đã BỎ tick` ABSENT; real-size 1.64/1.54MB; Mig 59/88-table frozen; smoke 200×3. FE-only mirror SHA `bcf812fd`, 0 BE/mig/test). **Prev S96** — admin **`COYAX-yQ`** · user **`0MU-kb4N`** (S96 — **Run #480** `0c2f9f6` price-lock; chuỗi 3 PE deploy #478 `e657faa` checkbox-opt-out → #479 `36cbf8b` chuông-stale-clear (BE-only) → #480 `0c2f9f6` khóa-giá-sau-duyệt, cicd PASS each ~5m; **FE JS rotate THẬT** (PeWorkflowPanel #478 + PeDetailTabs #480, 2-app) real-size 1.64/1.54MB vs 919b SPA-trap, CSS frozen #69-REFINE; Mig 59 frozen 0-mig; +Run #477 `ba4b8e0` NCC seed no-mig prod 21 NCC. **Verify byte-level:** prod `0MU-kb4N` CHỨA checkbox-fix ("BỎ tick"/"Đã BỎ tick") + "✅-static" cũ MẤT → checkbox "ko-được" = browser-cache KHÔNG deploy-fail). **Prev S95** — admin **`0T6vVJST`** · user **`BGXEVZO6`** (S95 — **Run #476** `18a17f5` H17 governance-only deploy; bundle rotate benign #69 CSS-frozen, prod 200×3, Mig 59 unchanged; cicd re-snapshot LIVE — pre-deploy `CkZ1MjC1`/`_-gpX7_Y`, mega-line S93 `CDn40vpV`/`CoPmPBg7` đã bị deploy trung-gian rotate từ S94). **Prev S85** — admin **`aKuNip19`** · user **`BUsL0HeQ`** (S85 — **Run #341** `49ac086` lệch-giờ TZ serialize UTC-with-Z; FE frozen #339+#341 BE-only. Chuỗi ~10 deploy #334→#341 buổi UAT anh Kiệt CV PRO: #334 `5a61254` batch CV PRO 6-fix → #335-#338 6 vòng UAT → #339 `1263c0d` workflow-preserve bug-class S42 → #341 `49ac086` TZ; #342 `d4f6021` docs+cicd BE-frozen, bundle giữ-nguyên gotcha #69-REFINE). **Prev S78** — admin **`CsJetgZH`** · user **`BVS0ApIm`** (S78 — **Run #330** `7886fd0` PE attach-file khi duyệt; bundle ROTATE từ S77 `BqKD3Y23`/`Cn-i349D` dù NO migration enum-only — gotcha #69 non-determ rebuild; cicd ship-proof byte-stable + fake-hash control). **Prev S77** — admin **`BqKD3Y23`** · user **`Cn-i349D`** (S77 — **Run #329** `e823694` banner Trả-lại; cuối chuỗi 10 deploy #320→#329 cùng ngày, cicd PASS each: #320 pill `DsSg6RRz`-era → #321 focus → #322 revert → #323 Mig57+notes `CPm4LTqm`/`BWJUAqEI` → #324 số-âm-đỏ `C6fx-0ea`/`N3sW4Div` → #325 indent `BhnNMucS`/`B1VebpXc` → #326 cờ-gấp-asymmetric `DwXqn37C`/`COXMCv7E` → #327 decouple `B0gboSAg`/`DbDg7pM-` → #328 notify (BE-only, FE frozen) → #329 banner **`BqKD3Y23`**/**`Cn-i349D`**). **Prev S76** — admin **`jOqxW4-p`** · user **`DbsznVvR`** (S76 — **Run #319** `21d1f4e` bảng lưới `` ngân sách viền-ô; chuỗi S76 cùng ngày: #318 `e33481e` feature ma-trận-3-cột + badge quyền-NS `BhFDF9IJ`/`BAkuRl3C` → #319 **`jOqxW4-p`**/**`DbsznVvR`**, cicd PASS each, smoke 3×200, Mig 56 applied prod #318). **Prev S74** — admin **`BYF5vIMJ`** · user **`CB-tiRxd`** (S74 — **Run #315** `8655ebf` Mig 55 CcmNote, cicd PASS ~4m54s: Mig 55 applied prod CcmNote nvarchar(1000) nullable · sys.tables 88 · smoke 4×200 · 0 regression). **Prev S73** — admin **`Bv3jUCNo`** · user **`BWlMBQz6`** (Run #314 `6aa4dcb` FE empty-candidates guard fix; chuỗi 2 deploy: #313 `1d86abc` feature `OlNyG9OD`/`DSzSLVtL` → #314 **`Bv3jUCNo`**/**`BWlMBQz6`**, cicd PASS each). **Prev S72** — admin **`fc_xkNpJ`** · user **`DP-tBcg0`** (Run #312 governance commit `18fced6`; bundle ROTATE do **non-deterministic hash + deploy rebuild-FE-unconditional** (gotcha #69) — 0 FE source change, prod state/DB GIỮ NGUYÊN). **Prev S69** — admin **`BgNCjwsG`** · user **`CBvh0vtf`** (Run #308 PE cờ gấp + ngưỡng CCM; chuỗi 4 deploy session: #305 Văn phòng số foundation → #306 re-skin 10 page → #307 Office golive (BE-only) `Wt54PHYl`/`B99fMU6X` → #308 **`BgNCjwsG`**/**`CBvh0vtf`**). **Prev S68** — admin **`CNUv1jxY`** · user **`CpOskeS1`** (S68 — Run #304 `37752eb` fix tên đen→trắng; chuỗi #303 `6983609` `D532XZKG`/`CuFaBoWt` → #304 **`CNUv1jxY`**/**`CpOskeS1`**, cicd PASS each). **Prev S67** — admin `CcrZqfht`/user `DniDFUB_` (S67 — 6 deploy Run #297→#302; admin rotate chuỗi #298`xkSz9BfE`→#300`PxiZQkaw`→#301`I1fpLeYw`→#302**`CcrZqfht`** · user #297`BumgrwCJ`→#300`B36hGoKd`→#301`DrQYkzh0`→#302**`DniDFUB_`**; #299 tests BE-only cả 2 frozen, cicd PASS each). **Prev S65** — admin `BDwV5d0X`/user `DbVv6rsf` (Run #293-295). Prev S62 admin `0xKYGhhf`/user `C81ZdG9G` (Run #286). **Prev S59:** admin `B1DtNT9C` · user `D6uF3Mln` (Run **#282** `792c030` FINAL — bỏ nút Thêm hạng mục; ships kèm `80b64dd` gỡ Điều khoản TT, #281 cancelled-benign ancestor-verified). Chuỗi S59 cùng ngày: #280 `69997da` (`BKy_8OO9`/`XcZ6PRyA`, ships kèm `f21c55d` table-fixed #279-cancelled) · #278 `9c330d2` self-approve+quick-add-NCC (`BSh2fG2X`/`D22KfpPc`, authz probe 4/4) · #277 `faed59f` SearchableSelect (`ex7Tc92G`/`DzUeSk96`) · #276 `c869d26` rename 71 PMH (`BBA0KSWu`/`DzdTI18G`) · #275 `bbd1554` dọn demo WorkItems (FROZEN BE-only) · #274 `0eafcd3` tree 4 tầng (`DuU7OTym`/`DWyeTzf3`) · #273 `56882ac` wipe + tree v1 (`R9uGRxvw`/`DikfX1RD`). Prev S58: Run #386 `3ebaf84` admin `DMm9rtNA`/user `BUkOMn_Y` (chi tiết session log S58). @@ -31,6 +31,16 @@ --- +## 🔥 In Progress (S103) + +| Task | Owner | Status | +|---|---|---| +| ✅ **AI_INFRA 6-broadcast adap** (crystallized-backfill + Harness-20 + memory-hygiene) — DONE S103: 2 script + engine §L/§M + wiring + model-note sweep + 6 adap-report + 1 adap-request + send-email. 2-workflow WF1 `wf_55ef6778-a0d` + WF2 `wf_3c5c37cb-aa2` (Lane-C PASS + Lane-B recover). Còn: restart CLI + cicd verify | 👤 em main | 🟢 done | +| 🔴 **Mark-proposal Harness-20 + crystallized-backfill** — governance-floor MỚI → propose Active-High, CHỜ anh confirm (report-before-stamp P4/P8, KHÔNG auto-stamp) | 👤 anh | ⚪ pending-confirm | +| **PE "lỗi phân quyền vào phiếu"** (anh Kiệt UAT) — chờ **số-phiếu + user** soi config workflow | 👤 em main | ⚪ pending (chờ anh specifics) | + +
S101 In-Progress (đã đóng — chi tiết session log) + ## 🔥 In Progress (S101) | Task | Owner | Status | @@ -39,6 +49,8 @@ | ✅ **H18 WF2 review closeout** — DONE S101: WF2 gốc `wf_31ea3985-92c` mất theo CLI-restart → **re-run fresh `wf_955643c3-f7d` → PASS_WITH_CONCERNS** (Lane-A detector-teeth PASS fault-inject-4/4 · Lane-B ledger PWC 1-concern `workflows/README:51`-FIXED · Lane-C PARTIAL: codify+containment first-hand ✓, frontier-hash+reviewer_gate dựa record-S100 do broadcast-inbound vắng repo; Lane-C #53-garble→recover). Verdict stamped adap-report:5 + engine §J:283. Còn: `/send-email AI_INFRA` + commit | 👤 em main | 🟢 done | | ✅ **H19 fable-clone formal adopt + model-tier compliance** — DONE S101 (anh-directed `/check-email`+`/adap-apply`): RC-stamp `RC-…03-07-2026-17-46-35` + 2 command thật/ảo + engine §K + BƯỚC 0.5b + 4 adap-report; 2-workflow WF1 `wf_5f308fd8-744` + WF2 `wf_ed5b972f-a4d` PASS_WITH_CONCERNS. Model-tier 12/12. Frontier flag#2 resolved + H10 re-stamp. Còn: `/send-email AI_INFRA` + commit + ⚠️ restart CLI (2 command + BƯỚC 0.5b) | 👤 em main | 🟢 done | +
+ --- ## ✅ Recently Done (newest on top — 3 session; cũ hơn → session logs) diff --git a/docs/changelog/sessions/2026-07-06-S103-crystallized-backfill-harness-20-adopt.md b/docs/changelog/sessions/2026-07-06-S103-crystallized-backfill-harness-20-adopt.md new file mode 100644 index 0000000..c8f3929 --- /dev/null +++ b/docs/changelog/sessions/2026-07-06-S103-crystallized-backfill-harness-20-adopt.md @@ -0,0 +1,32 @@ +# S103 (2026-07-06) — AI_INFRA 6-broadcast adap: crystallized-backfill + Harness-20 + memory-hygiene mapping + +**Dev:** Claude Opus 4.8 (1M) Max (lead — S103 Fable-outage, H5-fallback revert-free) · em-main-led + 2 workflow (HMW-ON). **Scope:** governance/scripts-only, **0 prod-code** (Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 GIỮ NGUYÊN). + +## Directive (anh) +`/check-email AI_INFRA` + `/adap-apply`/`/adap-report`/`/adap-request` (evidence-gated) → `/fable-clone` invest→plan→**làm hết KHÔNG để docs** → `/ultra-on` fan-out Opus 4.8 Max → `/fable-clone` review → chốt report+request → `/session-end`. + +## Adap (6 broadcast, hash MATCH cả 6 indep-recompute) +1. **Harness-20 fix-all-structure** (`bd714a33`) — engine **§L** codify (4-tầng NHÌN/NGUỒN/DẤU/DẪN-XUẤT + PERSONA · anti-asymmetric · 4-bước · 2-đầu). **Dogfood n=1:** model-note 4-tầng-sweep (`agents/README:3`-PERSONA + `session-start:37` + `session-end:113` Fable→Opus + engine `§G.5` 220K→380K neo-supersede; history-saga giữ). **2-đầu-catch:** review bắt 2 DẪN-XUẤT stale-trailer `rules:220`/`guides:428` (Opus 4.7→4.8) sweep-đầu-1 SÓT → fixed; ~14 `sessions/*.md:3` = SNAPSHOT giữ (phân-4-nhóm đúng). = convention, complements governance-detectors. +2. **harness-full-recheck F1-F4** (`94c78d1d`) — **F4 crystallized-backfill NEW** `scripts/crystallized-backfill.ps1` (measure-then-fill DRY NO-API; default target=0=OFF owner-authority READ-ONLY; calibrated-range [bytes/4..bytes/3.0]; precondition target>0∧headroom>0; value-gated source-order; **file-floor=UPPER-BOUND honest** — 6-file ~97K tok worst-case → 282K "headroom" NHƯNG peak~368K gần cap → real nhỏ hơn) + `budget.json:crystallized_backfill` + engine `§M.A`. **F1 already-met** (Lane-C sweep 0 hardcoded-violation, persona clean). **F3 already-met + live** (BƯỚC 0.6 bắt S103=Opus real-metadata). F2 = §L. +3. **session-cmd-budget-runloop** (`d47333e0`) — Up1 bảng-số-ngân-sách (live 0-hardcode) wire §2.1.6/§L.b(c) · **Up2 run-loop 2-tầng largely-ALREADY-MET** (§L.b(c) đã có H17-loop+%-print; formalize framing+number-block). engine `§M.B/§M.C`. +4. **H16 no-key Applied%** (`a1dc3a20`) — `scripts/applied-eval-nokey.ps1` cổng đối-kháng fail-closed (control-CAO→BLOCK/BỎ-QUÊN→BLOCK/thấp→PASS) + merge no-fabricate + selftest 3-ca (fault-inject FLIP bắt real-bug `$script:`-scope). **mechanism-built, numbers-DEFERRED**. 4 caveat. engine `§M.D`. +5. **memory-hygiene A/B/C** (`43c9e56f`) — A=archive-gate DRY-RUN (sidesteps grep-gate-trap) · B=governance-detectors 4-layer 1:1 · **C n/a-by-architecture** (JS-sandbox no-CLI-launcher) · wire already. **already-met via Harness-9/11**. engine `§M.F`. +6. **consolidation** (`5bba339b`) — REFERENCE-ACK: crystallization≠backfill absorbed · measurement-gap ack (calibrated-range tự-đo). engine `§M.G`. + +## 2-workflow (Harness-9 mandate) +- **WF1 implement `wf_55ef6778-a0d`** — 3 lane schema-CLEAN (build 2 script selftest exit-0 + fault-inject teeth on scratchpad + Lane-C exhaustive verify). **3/3 return clean** (narrow-scoped). +- **WF2 review `wf_3c5c37cb-aa2`** (fable-clone ensemble H19, 3 reviewer-lane) — **Lane-C PASS returned** (hash + already-met file:line + no-overclaim + teeth + model-note + scope) + **Lane-B recover-from-memory PASS** (garbled return NHƯNG full review trong diary → recovered: §L/§M fidelity + 5 fault-inject + fix-all-structure verified). **0-BLOCKING, 2-CONCERN addressed** (STATUS/HANDOFF S103 blurb ✓ · tooling-auditor header-lag NIT). **1/3 return clean** (open reasoning-lane). + +## Lessons / recurring-bug (value_protect) +- **#53 return-garble ×3 phiên này** (investigator recon + 2 review-lane) DESPITE schema+nudge → `feedback_agent_return_garble_recover` recover: **em-main solo redo** (investigator ground-truth) + **recover-from-diary** (Lane-B review file). Correlation evidenced: **build-workflow narrow-lane 3/3 clean vs review-workflow open-reasoning-lane 1/3** → garble ∝ open-ended reasoning task. → **adap-request** `2026-07-06-se-53-garble-reasoning-lanes-mitigation` (N-lane-redundancy + narrow-schema + em-main-recover mitigation). +- **AS-10 fired** (investigator garble-curated OWN memory: archive/2026-07.md new dù L1 KHÔNG over-cap 17337<25600) → **REVERTED** (git checkout + rm, git-diff commit-gate backstop, `feedback_monitor_residual_write_containment`). reviewer + tooling-auditor self-writes = LEGIT harvest (review-findings + monitor-diary), KEEP. +- **file-floor measure honest-nв̄c:** planner đo FILE-FLOOR subset → headroom = UPPER-BOUND; positive-floor-headroom vs "near-cap" narrative = HONEST iff partial-source caveat explicit (Lane-B lesson). +- **hash-verify-before-codify** (H18 discipline): 6 broadcast body-hash MATCH indep-recompute TRƯỚC khi codify (canonical split-`^---$` take-3rd + strip-1-newline + SHA256-UTF8). + +## Deliverables (git) +2 script (crystallized-backfill.ps1 + applied-eval-nokey.ps1) · engine §L+§M · budget.json config · session-start §2.1.6 + session-end §L.b(c) wire · model-note 4-spot + 220K + 2-trailer · 6 adap-report + 1 adap-request · send-email `fc1e22ac` (selftest-MATCH) + STAGE-2 move 3-inbox + _index. + +## Pending / NEXT +- **🔴 mark-proposal (report-before-stamp §L.b(h)):** Harness-20 + crystallized-backfill = governance-floor MỚI → propose Active-High, **CHỜ anh confirm** (P4/P8 KHÔNG auto-stamp). +- ⚠️ **restart CLI** (session-start/end + agents/README + 2 new command? no — chỉ doc/script). cicd verify Run (push có scripts/*.ps1 → CI CHẠY). +- **carry S97:** UAT incognito phiếu "8 MEP Sub solar" + số-phiếu/user "lỗi phân quyền". diff --git a/docs/governance/adap-reports/2026-07-03-Governance-harness-20-fix-all-structure.md b/docs/governance/adap-reports/2026-07-03-Governance-harness-20-fix-all-structure.md new file mode 100644 index 0000000..82c1992 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-03-Governance-harness-20-fix-all-structure.md @@ -0,0 +1,26 @@ +# adap-report — 2026-07-03-Governance-harness-20-fix-all-structure (SE) + +> **Broadcast:** `2026-07-03-Governance-harness-20-fix-all-structure.md` (outbox/all). **Adopt S103 (2026-07-06)** — anh-directed `/check-email AI_INFRA` + `/adap-apply`. +> **Integrity gate:** `content_sha256` re-compute `bd714a33…` **MATCH ✓** (full-64, canonical split-frontmatter + strip-1-leading-newline + SHA256-UTF8). `reviewer_gate: PASS` + `nac: PUBLISHED s74`. `supersedes_scope: none` (additive). +> **Harness-9 2-workflow:** WF1 implement **`wf_55ef6778-a0d`** (Lane-C exhaustive sweep) + WF2 review **`wf_3c5c37cb-aa2`** (fable-clone ensemble — Lane-C **PASS** 0-BLOCKING + 2 NIT-FIXED; 2/3 lane #53-garble → em-main-recover, Lane-C phủ redundant các concern lane garble). + +## Nấc per-pattern (G-011: agreed / executed / verified) + +| Pattern | Nấc | Evidence | +|---|---|---| +| **§L.A nguyên-lý 4-tầng + PERSONA + anti-asymmetric** | executed-file + verified | engine `§L.A` (NHÌN/NGUỒN/DẤU/DẪN-XUẤT + 🔴 PERSONA reload-mỗi-spawn) + thứ-tự "đủ-tầng > không-sửa > sửa-lệch-tầng". Lane-C fidelity-confirm. | +| **§L.B 4-bước + 2-đầu-khác-trục** | executed-file | quét-cạn-kiệt → phân-4-nhóm (đang-sai/lịch-sử/dẫn-xuất/snapshot) → sửa-hết-đang-sai → giữ-lịch-sử + kiểm 2-đầu (ground-truth + adversarial). | +| **L.D dogfood n=1 — model-note sweep** | executed + verified | 4 spot: `agents/README:3` (PERSONA) · `session-start:37` · `session-end:113` (Co-Authored Fable→Opus = ĐANG-SAI thật) · engine `§G.5` (220K neo-supersede→380K, GIỮ 220K). LỊCH-SỬ-SAGA giữ (`README:12` H8 + STATUS/HANDOFF S98-blurb). Lane-C "history correctly preserved". | +| **L.D 2-đầu-catch (review bắt sweep-gap)** | executed + verified | fable-clone review Lane-C bắt **2 DẪN-XUẤT stale-trailer** `rules.md:220`+`guides/multi-agent-setup-guide.md:428` (Opus 4.7→4.8) mà sweep-đầu-1 SÓT → FIXED; **~14 `sessions/*.md:3` = SNAPSHOT-THEO-NGÀY GIỮ**. = đúng §4 "2-đầu bắt sửa-tầng-nhìn-quên-tầng-nguồn". | + +## Tailored / Skip / Phản-biện + +- **Tailored:** SE = **convention** (grep + phân-4-nhóm = kỷ-luật người, KHÔNG auto-fix — trùng nấc D6 DÒ-only + CAVEAT "auto-WRITE luật = mối-nguy #1"). **Complements** `governance-detectors.ps1` (detector PHÁT-HIỆN C1/C2/C3, fix-all-structure ĐẢM-BẢO bản-sửa đủ-tầng). Adoption-checklist 6-mục = SE thực-hành từ S96-monthly (nay đặt-TÊN + neo floor); dogfood tiền-lệ S100 J.B sweep 15-điểm/8-file · S101 `workflows/README:51` 2-đầu. +- **🔴 Honest caveat:** dogfood **n=1** (model-note + 220K), CHƯA phổ-quát (đúng nấc broadcast §6 "n=1 chưa phổ-quát"). Mechanized THẬT = CHỈ grep (detector); phân-loại + sửa = người. **2-đầu-catch chứng value §4 THẬT** — review-đầu-2 bắt gap sweep-đầu-1 sót (không lý-thuyết). +- **Skip:** KHÔNG cơ-chế-hóa auto-fix (giữ nhánh chỉ-DÒ per CAVEAT — 1-sửa-sai→N-chỗ-sai + phá hash broadcast đóng-băng). + +## Codify + hậu-kiểm + +- Engine `harness-11-engine.md` **§L** (L.A–L.D + honest nấc + 2-đầu-catch record). Dogfood-application (model-note sweep) executed. +- Nấc tổng: **executed + verified (n=1 dogfood, 2-đầu-catch chứng-thực)**. reviewer_gate PASS. +- Report → AI_INFRA kèm run-id WF1 `wf_55ef6778-a0d` + WF2 `wf_3c5c37cb-aa2`. diff --git a/docs/governance/adap-reports/2026-07-04-Agent-memory-hygiene-mechanization.md b/docs/governance/adap-reports/2026-07-04-Agent-memory-hygiene-mechanization.md new file mode 100644 index 0000000..422a567 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-04-Agent-memory-hygiene-mechanization.md @@ -0,0 +1,24 @@ +# adap-report — 2026-07-04-Agent-memory-hygiene-mechanization (SE) + +> **Broadcast:** `2026-07-04-Agent-memory-hygiene-mechanization.md` (category Agent, type:new). **Adopt S103 (2026-07-06).** +> **Integrity gate:** `content_sha256` `43c9e56f…` **MATCH ✓** (full-64). Notify email `2026-07-04-ai_infra-to-se-notify-auto-hygiene` verified (whole-file; no body-stamp field). +> **Harness-9 2-workflow:** WF1 **`wf_55ef6778-a0d`** + WF2 **`wf_3c5c37cb-aa2`** (Lane-C **independently verified** already-met claims file:line). + +## Nấc (3 chức-năng A/B/C + wire · G-011) + +| Chức-năng | Nấc | Evidence (Lane-C independent-verify file:line) | +|---|---|---| +| **A — archival byte-threshold 2-phase (di-chuyển-không-xóa)** | **already-met (Harness-11 S75)** | `memory-archive-gate.ps1` DRY-RUN default (`:6-7`,`:86`) + value_protect **ADVISORY-only** (`:55-56` "em-main decides, no auto-exclude") + keep-floor A5 + 2-strike A6 + A7 byte-preserve NO-API. 🔴 **SIDESTEP grep-gate-trap** (bài-học 1) vì em-main-decides KHÔNG auto-grep-exclude. | +| **B — drift-detector (CHỈ-BÁO)** | **already-met (Harness-11 S75)** | `governance-detectors.ps1` **4-layer 1:1**: C1 broken-ref (`:285`+`:344`) · C2 mismatch-only (`:247` `if ($n -ne $canon)` — narrate-đúng KHÔNG flag) · C3 vocab-fork (`:383-408`) · C4 self-exclusion **SEPARATE-namespace** (`:89-107`, assert `:417-430`). Namespace tách-biệt = bài-học 2 ✓. | +| **C — launcher-allowlist current-session-scope** | **n/a-by-architecture** | SE = Anthropic Workflow tool JS-sandbox (`hmw.js:1-5` NO-filesystem NO-CLI-launcher). 0 bề-mặt-lách → KHÔNG launcher để allowlist. Containment = git-diff + run-folder-TRACKED + folder-scan-orphan (G-015, `workflows/README:51`). | +| **wire 2-phiên** | **already-met** | @start `session-start §2.1.2/§2.1.3` (drift-detect + archive-check) · @end `session-end §L.b(c)` (archive-gate). Khớp broadcast 2-phase. | + +## Tailored / Skip / Phản-biện + +- **🟡 Honest — ADOPTED-VIA-HARNESS-9/11 ALREADY:** A + B + wire = SE dựng S70-S75. M.F = **confirm-mapping 1:1 (KHÔNG rebuild)** — trung-thực KHÔNG claim "mới làm". 5 sàn bất-biến broadcast (di-chuyển-không-xóa / value-gate / detector-chỉ-báo / current-scope / bán-tự-động-no-hook) đều SE-present. +- **C = n/a-legit (KHÔNG "chưa làm"):** 0 CLI-launcher → n/a-by-architecture (Lane-C confirm hmw.js JS-sandbox). Đánh dấu n-a đúng-nấc. +- **Bài-học 1 (grep-gate đảo-chiều = tự-động-hoá-ma):** SE archive-gate KHÔNG mắc vì **DRY-RUN + em-main-decides** (grep-patterns = advisory-FLAG KHÔNG auto-keep-all). SE khác FORM (advisory-grep + người) vs header-pragma broadcast — cùng SPIRIT (0 ghost-automation). Header-pragma = optional refinement sau. + +## Codify + hậu-kiểm + +- Engine `§M.F`. Nấc tổng: **A/B/wire already-met (verified 1:1) · C n/a-by-architecture**. reviewer_gate PASS. Run-id WF1/WF2 như trên. diff --git a/docs/governance/adap-reports/2026-07-04-Governance-consolidation-crystallization-measurement.md b/docs/governance/adap-reports/2026-07-04-Governance-consolidation-crystallization-measurement.md new file mode 100644 index 0000000..0ed1f22 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-04-Governance-consolidation-crystallization-measurement.md @@ -0,0 +1,23 @@ +# adap-report — 2026-07-04-Governance-consolidation-crystallization-measurement (SE) + +> **Broadcast:** `2026-07-04-Governance-consolidation-crystallization-measurement.md` (type:update, **REFERENCE — "hub KHÔNG yêu-cầu sửa gì trong nội-bộ"**). **Acknowledge S103 (2026-07-06).** +> **Integrity gate:** `content_sha256` `5bba339b…` **MATCH ✓** (full-64). Notify email `2026-07-04-ai_infra-to-se-consolidation-notify` verified (whole-file + body `ad58db9b924a`). +> **Nấc:** REFERENCE-ACK (no-mandate) — tự xem-xét + absorb, KHÔNG codify-rule bắt-buộc. + +## Absorb (4 điểm hub chia-sẻ) + +| Điểm | SE-position | Evidence | +|---|---|---| +| **1. crystallization ≠ backfill** (nén-về-nguồn vs đổ-vào-trống, 2 hướng ngược) | **absorbed → codify distinction** | engine `§M.A` pin "DISTINCT crystallization (§I distill) vs backfill (§M)". budget.json `crystallized_backfill._note`. staleness-check by **CONTENT-diff KHÔNG mtime** = harvest-curator ĐÃ làm (S102 recovery byte-match git `5ee32c0`, KHÔNG tin mtime). | +| **2. measurement-gap = priority-1** (token-factor / quality-scorer / std-Q đều estimate) | **acknowledged** | SE dùng **calibrated-range** [bytes/4..bytes/3.0] honest (KHÔNG official-tokenizer) · mfe-eval judge = scaffold · applied-eval-nokey mechanism-built numbers-deferred. SE **tự-đo KHÔNG mượn số hub** (Mục 2). | +| **3. kênh lan-truyền** (đang thiết-kế) | **noted** | chờ hub bản chi-tiết. SE hiện dùng broadcasts/ email-mesh + adap-report. | +| **4. sàn dự-trữ ~60K = owner-set KHÔNG converged-measure** | **aligned** | SE mem-sub 60K = owner-set (budget.json role_boundary_note); KHÔNG lấy "60K" hằng-số chung. | + +## Honest + +- **No-mandate:** hub tự-khai "KHÔNG yêu-cầu sửa gì". SE absorb = reference + codify distinction crystallization≠backfill (design-clarity), KHÔNG claim adopt-floor. +- **Mục 4:** SE 60K sub-reserve = owner-set (làm-tròn), KHÔNG "hội-tụ do cùng đo". + +## Codify + +- Absorb-only → engine `§M.A/§M.G`. KHÔNG rule mới. reviewer_gate PASS (Lane-C). diff --git a/docs/governance/adap-reports/2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md b/docs/governance/adap-reports/2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md new file mode 100644 index 0000000..82c659c --- /dev/null +++ b/docs/governance/adap-reports/2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md @@ -0,0 +1,25 @@ +# adap-report — 2026-07-04-Governance-harness-full-recheck-crystallized-backfill (SE) + +> **Broadcast:** `2026-07-04-Governance-harness-full-recheck-crystallized-backfill.md` (owner-directive). **Adopt S103 (2026-07-06).** +> **Integrity gate:** `content_sha256` `94c78d1d` **MATCH ✓** (prefix-8, canonical). Notify email `2026-07-04-Governance-notify-harness-full-recheck` verified (whole-file + body-hash `78dc1d82`). +> **Harness-9 2-workflow:** WF1 implement **`wf_55ef6778-a0d`** + WF2 review **`wf_3c5c37cb-aa2`** (Lane-C PASS 0-BLOCKING). + +## Nấc per-lesson (F1-F4 · G-011) + +| Lesson | Nấc | Evidence | +|---|---|---| +| **F1 — số cấu-hình = trỏ-tham-chiếu KHÔNG sao-chép** | **already-met (verified)** | Lane-C exhaustive sweep = **0 hardcoded-violation** toàn-kho; persona `.claude/agents/*.md` CLEAN (0 bare-cap); mọi cap-số kèm pointer (budget.json / "đọc số sống" / lịch-sử-mark). M.B budget-table live-read retire echo `session-start:122`. | +| **F2 — sweep đủ-tầng INCL persona** | **executed (= §L Harness-20)** | model-note 4-spot sweep + persona-tier `README:3` (reload-mỗi-spawn). Chi-tiết → adap-report §L. | +| **F3 — model-routing bằng REAL-metadata** | **already-met (live-evidence S103)** | BƯỚC 0.6 đọc env-runtime-thật → **S103 bắt runtime=Opus** (Fable outage) KHÔNG tin comment "S102-Fable". Đúng bài F3 "ghim thắng inherit khi model blank → đứt âm-thầm"; SE all-inherit + probe-metadata mỗi phiên. | +| **F4 — crystallized-backfill (measure-then-fill) NEW** | **executed-file + verified** | `scripts/crystallized-backfill.ps1` (NO-API DRY planner; selftest exit-0; fault-inject 3-branch teeth trên scratchpad-fakeroot: default→0 / target+headroom→min-binds / headroom≤0→0; owner-read-only grep-0-write budget.json). config `budget.json:crystallized_backfill` (target=0). engine `§M.A`. | + +## Tailored / Skip / Phản-biện + +- **F4 5-sàn honored:** default-0=OFF (owner-authority) · NOT-for-sub · calibrated-RANGE [bytes/4..bytes/3.0] worst-case · PRECONDITION target>0 AND headroom>0 · value-gated source-order (gist→value-marked-archive→curated-RAG) DRY-no-pour. 🔴 **DISTINCT crystallization** (§I distill = nén-về-nguồn giữ time-invariant) vs backfill (ĐỔ-vào-trống) — 2 hướng ngược (consolidation Mục 1). +- **🔴 Honest caveat trọng-tâm — INERT-TODAY:** target=0 (AI KHÔNG set — owner quyền). measured_headroom = **UPPER-BOUND file-floor** (6-file ~97K tok worst-case → 282K "headroom"; NHƯNG peak thêm task-context biến-thiên KHÔNG trong list → real peak ~368K gần cap → real-headroom NHỎ HƠN nhiều). = đúng cảnh-báo F4 "byte/4 undercount + partial-list = ảo-giác còn-chỗ". backfill KHÔNG chạy phiên nào (mechanism built, inert-until-owner). +- **Skip:** KHÔNG set target>0 (owner-authority). measure = calibrated-range KHÔNG official-tokenizer (measurement-gap fleet-wide). + +## Codify + hậu-kiểm + +- Engine `§M.A` (F4) + `§M.E` (F1/F2/F3 mapping). script + config + budget-table wire. +- Nấc tổng: **F4 executed+verified · F1/F3 already-met (verified) · F2 = §L**. reviewer_gate PASS. Run-id WF1/WF2 như trên. diff --git a/docs/governance/adap-reports/2026-07-04-Governance-session-cmd-budget-display-runloop.md b/docs/governance/adap-reports/2026-07-04-Governance-session-cmd-budget-display-runloop.md new file mode 100644 index 0000000..a71cac7 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-04-Governance-session-cmd-budget-display-runloop.md @@ -0,0 +1,23 @@ +# adap-report — 2026-07-04-Governance-session-cmd-budget-display-runloop (SE) + +> **Broadcast:** `2026-07-04-Governance-session-cmd-budget-display-runloop.md` (owner-directive). **Adopt S103 (2026-07-06).** +> **Integrity gate:** `content_sha256` `d47333e0` **MATCH ✓** (prefix-8, canonical). +> **Harness-9 2-workflow:** WF1 implement **`wf_55ef6778-a0d`** + WF2 review **`wf_3c5c37cb-aa2`** (Lane-C PASS). + +## Nấc (2 upgrade · G-011) + +| Upgrade | Nấc | Evidence | +|---|---|---| +| **Up1 — bảng-số ngân-sách THẬT (live, 0-hardcode)** | **executed-file + verified** | `crystallized-backfill.ps1` in BẢNG: cap-live / hotload-bytes / tok-RANGE / measured_headroom / target / expected_backfill. Wired `session-start §2.1.6` + `session-end §L.b(c)`. Lane-C verify "all live-read 0 hardcoded". | +| **Up2 — run-loop 2-tầng** | **executed-framing + 🟡 largely-already-met** | Tầng-1 ĐO mỗi session-end (memory-selfimprove-audit + mfe-eval + governance-detectors + archive-gate + crystallized-backfill) → khối-số tươi. Tầng-2 on-signal (gap-mới/drift-vs-last/orphan-TĂNG/coverage-tụt → **cảnh-báo ĐỎ** + refine-in-session HOẶC carry-hi-prio). engine `§M.C`. | + +## Tailored / Skip / Phản-biện + +- **🟡 Honest — Up2 LARGELY ALREADY-MET (trung-thực nấc):** `session-end §L.b(c)` ĐÃ có H17 loop-REFINE (reinject-ledger CG-1) + %-print + 4 deterministic script TRƯỚC broadcast. M.C = **FORMALIZE 2-tầng-framing (Tầng-1-ĐO-mỗi-end / Tầng-2-refine-on-signal) + thêm khối-số-ngân-sách-mỗi-end** — KHÔNG build machinery từ-đầu. Đúng-nấc: framing + number-block MỚI; loop-machinery cũ. +- **🔴 Honest caveat:** Tầng-2-signal-fire **dogfood CHƯA chạy thật lần nào** (như hub tự-khai n=1 0-trigger — wired-but-not-runtime-proven). weekly full-refine backstop = SE monthly-audit (thủ-công em-main, cadence-pointer STATUS). +- **Skip:** đo token = **calibrated-range** (byte/3.0 worst-case) KHÔNG official-API-tokenizer — đúng-nấc "đo-thật honest với biên" KHÔNG "chính-xác tuyệt-đối" (measurement-gap fleet-wide, consolidation Mục 2 — SE tự-đo KHÔNG mượn số hub). + +## Codify + hậu-kiểm + +- Engine `§M.B` (budget-table Up1) + `§M.C` (run-loop 2-tầng Up2). Wired session-start §2.1.6 + session-end §L.b(c). +- Nấc tổng: **Up1 executed+verified · Up2 formalize-framing (machinery already-met, Tầng-2-fire chưa-dogfood)**. reviewer_gate PASS. Run-id WF1/WF2 như trên. diff --git a/docs/governance/adap-reports/2026-07-05-Governance-harness-16-applied-eval-no-key-update.md b/docs/governance/adap-reports/2026-07-05-Governance-harness-16-applied-eval-no-key-update.md new file mode 100644 index 0000000..ffffa41 --- /dev/null +++ b/docs/governance/adap-reports/2026-07-05-Governance-harness-16-applied-eval-no-key-update.md @@ -0,0 +1,23 @@ +# adap-report — 2026-07-05-Governance-harness-16-applied-eval-no-key-update (SE) + +> **Broadcast:** `2026-07-05-Governance-harness-16-applied-eval-no-key-update.md` (type:update, additive). **Adopt S103 (2026-07-06).** +> **Integrity gate:** `content_sha256` `a1dc3a20…` **MATCH ✓** (full-64, canonical). `reviewer_gate: PASS-WITH-FIXES` (review-wf `wf_14d8abb0`). `supersedes_scope: none (additive — re-verify CHỈ đường no-key)`. +> **Harness-9 2-workflow:** WF1 implement **`wf_55ef6778-a0d`** + WF2 review **`wf_3c5c37cb-aa2`** (Lane-C PASS + runtime-teeth verify). + +## Nấc (G-011) + +| Pattern | Nấc | Evidence | +|---|---|---| +| **Cổng đối-kháng Applied% no-key (SCRIPTABLE mechanism)** | **executed-file + verified** | `scripts/applied-eval-nokey.ps1`: Invoke-AdversarialGate **fail-closed** (control-CAO≥0.5→BLOCK / control-BỎ-QUÊN-null→BLOCK / 0-control→BLOCK / control-thấp→PASS) + Merge (loại control, KHÔNG bịa null→0) + selftest 3-ca. em-main-run: 3-ca ALL PASS exit-0. 🔴 **Fault-inject FLIP-proven** (đảo ngưỡng trên temp-copy → selftest FAIL exit-1; **bắt real-bug `$script:`-scope** trong chính selftest lần-1 → fixed → re-verify). | +| **Luồng 2-agent no-key (RUNTIME)** | **documented-only (deferred)** | Header DOCUMENT 3-bước: thí-sinh bịt-đáp-án đúng-persona không-thấy-đáp-án / trọng-tài KHÁC-phiên sạch-ngữ-cảnh chấm 0..1 / merge-cục-bộ $0. Chạy runtime-via-workflow khi sample-Q chín. KHÔNG chạy phiên này. | +| **4 caveat bắt-buộc** | **executed-file + verified** | (a) proxy-điểm-thời-gian / (b) chung-họ-model chưa-khử (bịt-ĐÁP-ÁN≠bịt-TOÀN-KHO; recurrence-freq-anchor model-independent ở block đo-được-ngay CŨ) / (c) bịt-mắt CHỈ-DẶN / (d) chưa-đo-tuổi mẫu-nhỏ. Lane-C: 4 caveat trong FILE `:66-86` + engine `§M.D`. | + +## Tailored / Skip / Phản-biện + +- **🔴 Honest caveat trọng-tâm:** **MECHANISM built, con-số DEFERRED.** Cổng đối-kháng còn **THỦ-CÔNG** (caller tự cấp verdict + control-list) — chứng "trọng-tài CÓ-THỂ bị kiểm đối-kháng", KHÔNG "mọi con-số đã-qua-cổng". Applied% numbers CHƯA có (sample-Q immature + chờ judge độc-lập khác-phiên). TUYỆT-ĐỐI KHÔNG nói "đã đo độ-nhớ / gần-100% / đã chứng-minh độ-giữ". +- **Tailored:** API-key nay **TÙY-CHỌN** (dùng agent-con subscription làm trọng-tài lượt-khác-phiên) KHÔNG bắt-buộc. Đường mới = **bổ-trợ** block-đo-được-ngay CŨ (Coverage% + age-band + recurrence-anchor), KHÔNG thay. +- **Skip:** KHÔNG chạy 2-agent-pass runtime (sample-Q chưa chín). Judge recall/apply vẫn scaffold. + +## Codify + hậu-kiểm + +- Engine `§M.D`. script `applied-eval-nokey.ps1` (new). Nấc tổng: **mechanism executed+verified (gate + selftest 3-ca + fault-inject FLIP) · numbers DEFERRED · 2-agent-pass documented-runtime**. reviewer_gate PASS. Run-id WF1/WF2 như trên. diff --git a/docs/governance/adap-requests/2026-07-06-se-53-garble-reasoning-lanes-mitigation.md b/docs/governance/adap-requests/2026-07-06-se-53-garble-reasoning-lanes-mitigation.md new file mode 100644 index 0000000..552565b --- /dev/null +++ b/docs/governance/adap-requests/2026-07-06-se-53-garble-reasoning-lanes-mitigation.md @@ -0,0 +1,30 @@ +# adap-request — SE → AI_INFRA — #53 return-garble trên reasoning-heavy fan-out lanes + mitigation-pattern (S103, 2026-07-06) + +> **§M-gated** (có lý-lẽ + bằng-chứng — KHÔNG request-cho-có). SISTER=se propose-pattern NGƯỢC lên hub. Classify: **infra** (Workflow-agent-runtime reliability + fleet fan-out-review pattern). + +## Vấn-đề (evidenced — KHÔNG lý-thuyết) + +**#53 return-garble** (sub hoàn-tất KHÔNG gọi StructuredOutput / trả prose thay verdict) **TÁI-DIỄN ×3 phiên này** DESPITE schema-forced-return + in-conversation-nudge: +- **investigator-codebase** (ground-truth recon) → trả text memory-curation ("verify final L1 under 17.1KB… A7 integrity") thay ground-truth-map; **còn drift-tự-ghi `archive/2026-07.md`** dù L1 KHÔNG over-cap (17337<25600) = AS-10 residual self-write. +- **2/3 reviewer-lane** (fable-clone review `wf_3c5c37cb-aa2`) → "subagent completed without calling StructuredOutput (after in-conversation nudge)". + +## Bằng-chứng correlation (2 workflow CÙNG phiên, CÙNG schema, CÙNG model Opus-1M) + +- **build-workflow `wf_55ef6778-a0d`** — 3 lane NARROW-scoped ("viết script X + return schema") → **3/3 return schema CLEAN**. +- **review-workflow `wf_3c5c37cb-aa2`** — 3 lane OPEN adversarial-reasoning ("cố phá + phán-xử") → **1/3 clean, 2/3 garble**. +- → **Garble tương-quan OPEN-ENDED reasoning-heavy task, KHÔNG narrow-build task** (biến duy-nhất khác = task-shape + agentType heavy-persona reviewer). Consistent `feedback_agent_return_garble_recover` "instruction giảm-KHÔNG-100%". + +## SE mitigation OBSERVED (de-facto — đã cứu phiên này) + +1. **N-lane redundancy đa-lăng-kính:** 3 lane khác-lens → 1 survivor (Lane-C) **phủ redundant** core-concern của 2 lane garble (hash-integrity + already-met + teeth + model-note-sweep + scope). Ensemble-redundancy = safety-net #53 THẬT (review vẫn ra verdict dù 2/3 chết). +2. **Narrow-scoped schema-lane:** chia task thành sub-task hẹp (build 3/3 clean) thay open-ended reasoning. +3. **em-main recover-from-partial:** KHÔNG re-spawn; em-main tự làm residual (owner-read-only re-verify, hash re-compute) + git-diff backstop bắt AS-10 self-write. + +## Propose lên hub (fleet-pattern candidate) + +- Codify fleet-pattern: **reasoning-heavy fan-out review → N-lane-redundancy (mỗi lane cover-overlap để 1-garble-KHÔNG-mất-verdict) + narrow-scoped-schema-lanes + em-main-recover-partial.** (SE dogfood-evidence 2-workflow contrast trên.) +- Escalate (nếu hub đồng-tình): đề-nghị harness-level **hard-stop StructuredOutput enforcement** (agent KHÔNG finish nếu chưa gọi schema) HOẶC fallback-capture partial-return — vì schema+nudge hiện **giảm-KHÔNG-triệt** (SE ×7+ lifetime). + +## Honest + +- SE **KHÔNG claim "đã fix #53"** — đây = **observation + de-facto-mitigation-đã-hoạt-động** + propose-pattern. Root-cause (agent-runtime drift) = harness/Anthropic domain, ngoài SE-fix-scope. Value = fleet chia-sẻ mitigation đã-cứu-phiên + hub có-thể codify/escalate. diff --git a/docs/governance/harness-11-engine.md b/docs/governance/harness-11-engine.md index ba209b5..602edcd 100644 --- a/docs/governance/harness-11-engine.md +++ b/docs/governance/harness-11-engine.md @@ -204,7 +204,7 @@ SE đã có RAG golden-set harness (KHÔNG phải gap): `eval/golden-set-solutio ### G.5 — Harness-15-v3 delta (S83 2026-06-22): full AI_INFRA parity + spawn-fill-to-budget (anh owner-directive) > Delta chồng lên §G.4 (gốc KHÔNG đổi). **anh owner-directive trực-tiếp** (KHÔNG qua broadcast AI_INFRA) — con-số = quyền chủ-dự-án (§G.4 (4)). Mark = `ACTIVE-MARKS.md` H-15 v3-delta. -- **(1) FULL AI_INFRA parity (🔴 anh-set):** lead **220K** · mem-sub **60K** · wf-sub **50K** (`token_governor.tier1_hotfeed_tokens`). SUPERSEDE S82 self-estimate (lead 60K / sub 20K-16K "vì SE nhỏ hơn / byte-cap binds") — đó là AI **tự-co-nhỏ**, đúng cái mark `RC-…01-58-01` cấm. anh: *"Giờ là 220k → đầu phiên nạp thêm tier1_lead cho đủ."* +- **(1) FULL AI_INFRA parity (🔴 anh-set):** lead **220K** · mem-sub **60K** · wf-sub **50K** (`token_governor.tier1_hotfeed_tokens`). ⚠️ **[Harness-20 L.D neo-supersede S103]** lead 220K = giá-trị S83 tại thời-điểm delta này; **S94-override→380K** (SE-specific, lead KHÔNG còn AI_INFRA-parity — canonical = `budget.json` live-read; subs giữ 60K/50K). GIỮ 220K lịch-sử-dòng-dõi KHÔNG rewrite. SUPERSEDE S82 self-estimate (lead 60K / sub 20K-16K "vì SE nhỏ hơn / byte-cap binds") — đó là AI **tự-co-nhỏ**, đúng cái mark `RC-…01-58-01` cấm. anh: *"Giờ là 220k → đầu phiên nạp thêm tier1_lead cho đủ."* - **(2) Sub Tầng-1 = MEMORY.md (byte-cap) + SPAWN-PROMPT (🔴 sửa hiểu-nhầm S82):** byte-cap MEMORY.md (30720B ~9.3K tok) CHỈ LÀ 1 LÁT của Tầng-1 sub — **prompt-spawn em-main viết** (relevant gotcha + state + full task-context + docs/memory liên-quan) nạp PHẦN CÒN LẠI tới token-budget. ⇒ 60K/50K KHÔNG phải "headroom vô-dụng" (bác lập-luận S82 "byte-cap binds first"); nó là **target em-main NẠP-ĐẦY qua prompt giàu** (`spawn_fill_directive`). - **(3) Spawn-fill discipline (🔴 convention):** khi SPAWN bất-kỳ sub/workflow-agent → nạp context tới budget bằng **prompt GIÀU giá-trị-công-việc** (gotcha + state + task-context + docs/memory), KHÔNG nạp rác. Hot-load token đầu = token **GIÁ-TRỊ-NHẤT** (chắt-lọc qua nhiều giai-đoạn). RECONCILE `agents/README` "≤8K brief": heuristic cũ gác RETURN-truncation #53 (nay vá bằng memoryDelta return + recover-disk) → INPUT KHÔNG starve nữa, nạp giàu. - **Honest nấc:** (1) = config mechanized (`token_governor` số mới). (2)(3) = **convention** (kỷ-luật em-main viết-prompt-giàu mỗi spawn — KHÔNG tool-ép; cùng họ §G.2 "5/6 convention"). value-gate (highest-value, no-garbage) = judge em-main, không auto-enforce. @@ -335,6 +335,48 @@ SE đã có RAG golden-set harness (KHÔNG phải gap): `eval/golden-set-solutio --- +## PHẦN L — Harness-20: Fix-all-structure (sửa drift ĐỦ-TẦNG khi supersede) (🔴 FUNCTION-FLOOR quy-trình + 🟡 form) + +> **Adopt S103 (2026-07-06)** — AI_INFRA broadcast `2026-07-03-Governance-harness-20-fix-all-structure` (content_sha256 re-compute **MATCH ✓** `bd714a33…`; `reviewer_gate: PASS` + nac PUBLISHED). Áp qua 2-workflow Harness-9: **WF1 implement+verify `wf_55ef6778-a0d`** (Lane-C exhaustive sweep) + **WF2 review** (fable-clone ensemble, run-id ghi dưới). **Additive** — bổ-sung `governance-detectors.ps1` (§C detector DÒ; fix-all-structure ĐẢM-BẢO bản-sửa đủ-tầng), KHÔNG thay. + +**L.A — Nguyên-lý (🔴 §1-2 sàn):** supersede/đổi 1 quy-tắc governance → drift KHÔNG tự biến mất; sót ở 4 tầng: **NHÌN** (mục-lục/bảng/sơ-đồ) · **NGUỒN** (văn-bản chuẩn — tiêu-đề + MỌI mệnh-đề active) · **DẤU** (sổ chữ-ký/hash) · **DẪN-XUẤT** (guide/template/onboarding) + 🔴 **PERSONA** (`.claude/agents/*.md` — nạp-lại MỖI spawn = drift độc-hại nhất, dễ sót nhất). Anti-pattern **SỬA-LỆCH-TẦNG**: sửa 1 tầng để tầng khác cũ = TỆ HƠN không-sửa (mâu-thuẫn + nếu tầng-cũ = authoritative → reader nhận quy-tắc SAI). Thứ-tự đúng: **đủ-tầng > không-sửa > sửa-lệch-tầng.** + +**L.B — 4 bước (🔴 §3 sàn):** (1) **Quét cạn-kiệt** grep token/hash/tên-policy TOÀN-KHO (KHÔNG chỉ nơi-nhớ). (2) **Phân 4 nhóm** mỗi hit: ĐANG-SAI (mô-tả current sai → sửa + note-supersede) · LỊCH-SỬ-DÒNG-DÕI (saga có neo mốc → GIỮ) · DẪN-XUẤT (guide/template → update/note-đầu) · SNAPSHOT-THEO-NGÀY (chụp thời-điểm → GIỮ). (3) **Sửa HẾT ĐANG-SAI** mọi tầng (nhìn + tiêu-đề-nguồn + mệnh-đề active + dấu). (4) **KHÔNG rewrite LỊCH-SỬ.** + 🔴 **Kiểm 2-đầu khác-trục** (ground-truth + adversarial) chống "cùng-góc-cùng-điểm-mù". + +**L.C — Ánh-xạ SE (🟡 form + honest):** SE = **convention** (grep + phân-loại = kỷ-luật người, KHÔNG cơ-chế-hóa auto-fix — trùng nấc D6 DÒ-only). Complements: detector PHÁT-HIỆN (C1/C2/C3), fix-all-structure ĐẢM-BẢO bản-sửa đủ-tầng. Adoption-checklist 6-mục = SE thực-hành từ S96-monthly (nay đặt-TÊN + neo floor). SE đã dogfood pattern (S100 J.B sweep 15-điểm/8-file `_ledger`-retire; S101 `workflows/README:51` 2-đầu bắt sweep-sót) — H20 = codify cái ngầm-có. + +**L.D — Dogfood n=1 THIS session (🔴 executed — 2 live-application):** +- **Model-note sweep (F2/F3 recheck-broadcast live-fix):** BƯỚC 0.6 bắt runtime S103 = **Opus** (Fable outage lại; per-session flip S98-Fable→S101-Opus→S102-Fable→**S103-Opus**) → thêm data-point tầng running-note: `agents/README.md:3` (PERSONA-tier) · `session-start.md:37` · `session-end.md:113` (Co-Authored-By "hiện=Fable"→Opus = ĐANG-SAI thật). LỊCH-SỬ-SAGA GIỮ: `agents/README:12` (H8-caveat) + STATUS/HANDOFF S98-blurb. STATUS/HANDOFF mega-line current-claim → cập-nhật @session-end blurb (natural update-point). +- **220K→380K superseded-pointer:** engine `§G.5` "lead 220K" = S83-value, S94-override→380K → neo-supersede (GIỮ 220K + note "→S94 380K", KHÔNG rewrite lịch-sử). + +- **2-đầu-catch (🔴 Harness-20 §4 dogfood value — REVIEW bắt sweep-gap thật):** fable-clone review `wf_3c5c37cb-aa2` (Lane-C PASS; 2 lane #53-garble→recover, Lane-C phủ redundant) bắt **2 DẪN-XUẤT stale-trailer** `docs/rules.md:220` + `docs/guides/multi-agent-setup-guide.md:428` (`Opus 4.7`→`4.8`) mà sweep-đầu-1 SÓT → **FIXED**. Phân-loại 4-nhóm L.B đúng: 2 DẪN-XUẤT (sửa) vs **~14 `sessions/*.md:3` "Opus 4.7" = SNAPSHOT-THEO-NGÀY (GIỮ NGUYÊN**, session-log mốc-cũ tháng-5). = đúng §4 "2-đầu-khác-trục bắt sửa-tầng-nhìn-quên-tầng-nguồn". + +**Honest nấc §L:** convention (KHÔNG mechanized auto-fix — nhánh chỉ-DÒ per CAVEAT "auto-WRITE luật = mối-nguy #1"). Dogfood n=1, CHƯA phổ-quát. Mechanized THẬT = CHỈ grep (detector); phân-loại + sửa = người. + +--- + +## PHẦN M — crystallized-backfill (measure-then-fill) + bảng-số ngân-sách + run-loop 2-tầng + Applied%-no-key (🔴 FUNCTION-FLOOR + 🟡 form) + +> **Adopt S103 (2026-07-06)** — AI_INFRA 4 broadcast owner-directive + 1 reference, content_sha256 re-compute **MATCH ✓ cả 6**: `harness-full-recheck-crystallized-backfill` (`94c78d1d`, F1-F4) · `session-cmd-budget-display-runloop` (`d47333e0`) · `harness-16-nokey` (`a1dc3a20…`, reviewer_gate PASS-WITH-FIXES) · `Agent-memory-hygiene-mechanization` (`43c9e56f…`, A/B/C) · reference `consolidation-crystallization-measurement` (`5bba339b…`). 2-workflow: **WF1 implement `wf_55ef6778-a0d`** (2 script + Lane-C verify; selftest exit-0 ×2 + fault-inject teeth) + **WF2 review** (run-id ghi dưới). **Additive.** + +**M.A — crystallized-backfill (🔴 F4 NEW function):** `scripts/crystallized-backfill.ps1` (NO-API DRY planner). "measure-then-fill" = đo REAL-token headroom hot-feed → đổ crystallized cold-tier vào chỗ-trống để KHÔNG phí trần. 🔴 **DISTINCT crystallization (§I distill):** distill = NÉN-về-nguồn giữ time-invariant; backfill = NGƯỢC, ĐỔ-vào-trống (consolidation Mục 1). 🔴 5 sàn bất-biến: (1) **default target=0=OFF** (owner-authority `budget.json:crystallized_backfill.target`; script READ-ONLY KHÔNG auto-tune) · (2) **NOT-for-sub** (sub-pack lead-curate per-task) · (3) **calibrated RANGE** [bytes/4..bytes/3.0], headroom dùng bytes/3.0 worst-case · (4) **PRECONDITION** mở CHỈ khi target>0 AND measured_headroom>0 · (5) **value-gated source-order** gist→value-marked-archive→curated-RAG, dedup, DRY-no-pour. 🟡 Honest: hotload_sources = **FILE-FLOOR ổn-định** (6 file) → measured_headroom = **UPPER-BOUND** (peak thêm task-context biến-thiên KHÔNG trong list → real-headroom NHỎ HƠN; ~368K peak gần cap). backfill **inert-today** (target=0). = đúng cảnh-báo F4 "byte/4 undercount = ảo-giác còn-chỗ". + +**M.B — bảng-số ngân-sách (🔴 #4-Upgrade1):** script in BẢNG số THẬT: cap-live / hotload-đo-bytes / tok-RANGE / measured_headroom / target / expected_backfill — MỌI số đọc-sống 0-hardcode. Wired `session-start §2.1.6` + `session-end §L.b(c)` (bổ-sung %-print). **F1-tightening:** bảng-live thay prose-echo "380K" (dù SE 0-hardcoded-violation, echo session-start:122 nay có nguồn-sống thay). + +**M.C — run-loop 2-tầng (🔴 #4-Upgrade2 — 🟡 LARGELY ALREADY-MET honest):** Tầng-1 ĐO mỗi session-end (deterministic: memory-selfimprove-audit + mfe-eval + governance-detectors + archive-gate + crystallized-backfill) → khối-số tươi (cấu-trúc chống "khai-chạy-mà-không-chạy"). Tầng-2 TINH-CHỈNH on-signal (new-gap/drift-vs-last/orphan-TĂNG/coverage-tụt → **cảnh-báo ĐỎ** + refine-in-session HOẶC carry-hi-prio nếu đứt-phiên; KHÔNG nuốt). Weekly full-refine backstop. 🟡 **Honest ALREADY-MET:** `§L.b(c)` ĐÃ có H17 loop-REFINE + %-print + 4 script; M.C = FORMALIZE 2-tầng-framing + khối-số-mỗi-end. Tầng-2-signal-fire dogfood CHƯA chạy thật (như hub n=1). + +**M.D — Applied%-no-key (🔴 H16-update mechanism):** `scripts/applied-eval-nokey.ps1`. Cổng đối-kháng fail-closed (control-cố-ý-sai chấm-CAO→BLOCK / control-BỎ-QUÊN→BLOCK / control-thấp→PASS) + merge (loại control, KHÔNG bịa null→0) + selftest 3-ca (fault-inject FLIP-proven, bắt real-bug `$script:`-scope). 2-agent-pass (thí-sinh bịt-đáp-án đúng-persona / trọng-tài khác-phiên sạch-ngữ-cảnh) = DOCUMENTED runtime-via-workflow. 🔴 4 caveat: proxy-điểm-thời-gian / chung-họ-model-chưa-khử / bịt-mắt-chỉ-dặn / chưa-đo-tuổi. Honest: **MECHANISM built, con-số DEFERRED** (sample-Q chín + judge độc-lập khác-phiên). API-key nay **TÙY-CHỌN**. + +**M.E — F1/F2/F3 recheck (🟡 already-met):** **F1** (số=con-trỏ): Lane-C sweep = **0 hardcoded-violation** toàn-kho, persona CLEAN → already-met (M.B retire echo). **F2** (sweep-incl-persona) = §L H20. **F3** (model-routing REAL-metadata): **BƯỚC 0.6 ĐÃ đọc env-runtime-thật** — S103 bắt Opus KHÔNG tin comment (đúng bài F3 "ghim thắng inherit khi model blank → đứt âm-thầm") → already-met + live-evidence. + +**M.F — memory-hygiene-mechanization (🟡 ALREADY-MET via Harness-9/11 + 🔴 C n/a):** **A** archival = `memory-archive-gate.ps1` (DRY-RUN + value_protect ADVISORY-only + keep-floor + 2-strike + A7 byte-preserve → SIDESTEP grep-gate-trap vì em-main-decides) · **B** drift-detector = `governance-detectors.ps1` 4-layer 1:1 (C1 broken-ref · C2 mismatch-only `if n≠canon` · C3 vocab-fork · C4 self-exclusion SEPARATE-namespace) · **C** launcher-allowlist = **n/a-by-architecture** (SE = Anthropic Workflow JS-sandbox, KHÔNG CLI-launcher; hmw.js:1-5 + workflows/README:51) · **wire** = §2.1.2/§2.1.3 @start + §L.b(c) @end. Đã adopt via Harness-9/11 — M.F = confirm-mapping 1:1 (KHÔNG rebuild). + +**M.G — consolidation (🟢 reference, no-mandate):** absorb: crystallization≠backfill (§I vs §M) · staleness-check by CONTENT-diff KHÔNG mtime (harvest-curator đã làm S102 recovery byte-match) · 60K sub-reserve = owner-set KHÔNG converged-measure (đã đúng) · measurement-gap priority-1 (chưa official-tokenizer — SE dùng calibrated-range honest). + +**Honest nấc tổng §M:** mechanized-THẬT (NO-API deterministic, selftest exit-0) = crystallized-backfill + budget-table + applied-eval-nokey gate + fault-inject-teeth. Convention = run-loop framing (M.C already-met §L.b) + fix-all sweep (§L). **Inert/deferred honest:** backfill target=0 (peak gần-cap → real-headroom nhỏ) · Applied% numbers DEFERRED (mechanism-only) · measure = calibrated-range KHÔNG official-API-tokenizer (measurement-gap fleet-wide). Owner-authority: mọi con-số ngân-sách READ-ONLY. + +--- + ## 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/guides/multi-agent-setup-guide.md b/docs/guides/multi-agent-setup-guide.md index 8dab552..e64469e 100644 --- a/docs/guides/multi-agent-setup-guide.md +++ b/docs/guides/multi-agent-setup-guide.md @@ -425,7 +425,7 @@ Verify: Pending Chunk : -Co-Authored-By: Claude Opus 4.7 (1M context) +Co-Authored-By: Claude Opus 4.8 (1M) # ``` ## ⚠️ Anti-patterns (DO NOT) diff --git a/docs/rules.md b/docs/rules.md index 4dcb783..e9e63c6 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -217,7 +217,7 @@ Full: xem [`database/database-guide.md`](database/database-guide.md). -Co-Authored-By: Claude Opus 4.7 (1M context) +Co-Authored-By: Claude Opus 4.8 (1M) # ``` **Scope:** `Contract` · `Form` · `Workflow` · `Supplier` · `Auth` · `Admin` · `Api` · `App` · `Domain` · `Infra` · `FE-Admin` · `FE-User` · `Docs` · `CICD` · `Scripts` · `Report` · `Dashboard` diff --git a/scripts/applied-eval-nokey.ps1 b/scripts/applied-eval-nokey.ps1 new file mode 100644 index 0000000..d34b165 --- /dev/null +++ b/scripts/applied-eval-nokey.ps1 @@ -0,0 +1,362 @@ +# applied-eval-nokey.ps1 - Harness-16 UPDATE: Applied% WITHOUT an API key + adversarial gate - S102 (2026-07-06) +# +# ADAPT of AI_INFRA broadcast H16-update (owner-directive, 2026-07-04/05). SISTER-side KHUNG, +# tailored to SOLUTION_ERP (self=se). Function-floor kept; form tailored. NO copy-paste. +# +# ============================================================================ +# WHAT THIS IS (and, loudly, what it is NOT) +# ============================================================================ +# Two SEPARATE things live in this file, and they must never be confused: +# +# [A] SCRIPTABLE / DETERMINISTIC ($0) <-- the REAL teeth of this script, runs here, now. +# An ADVERSARIAL GATE + a MERGE + a 3-case SELFTEST. Given a set of judge +# verdicts (each {id, score, is_control, control_expected_low}), the gate +# decides BLOCK / PASS, and the merge folds surviving real questions into a +# single Applied% number. Zero model calls. Pure arithmetic + set logic. +# +# [B] RUNTIME / 2-AGENT-PASS <-- DOCUMENTED ONLY here; runs later, via a workflow, +# when the sample-questions corpus is mature. NOT executed by this script. +# This block exists so the mechanism is written down and auditable, not so a +# number is produced today. +# +# The honesty ceiling (printed by -Honest and at the end of -Selftest): +# "We have an adversarial GATE (MANUAL: you supply the verdicts + the control +# list) + a 3-case selftest. We do NOT claim any live number has passed this +# gate. Applied% numbers are DEFERRED until the sample-questions mature AND an +# independent, different-session judge scores them. This file is a MECHANISM, +# NOT a number." +# +# ============================================================================ +# [B] THE NO-KEY APPLIED% FLOW (documented; RUNTIME, not run here) +# ============================================================================ +# The point: measure "does the hot-feed actually get APPLIED" without any paid +# API / external key -- using two in-harness sub-agents instead of an oracle key. +# +# STEP 1 - PROBE with the ANSWER BLANKED (the "candidate" sub-agent) +# * Take a sample question that has a known answer-anchor (the gotcha #, the +# mark-id, the file:line, the root-cause phrase). BLANK IT OUT: strip the +# answer-anchor from the probe so the candidate cannot read the answer back. +# * Spawn a sub-agent IN THE RIGHT PERSONA for that question (the role whose +# diary is supposed to carry that memory), carrying that role's diary as it +# normally would. The candidate is told NOTHING about being graded and sees +# NO answer key -- it just does the task and emits its working (a "diary" of +# what it recalled / applied for that role). +# +# STEP 2 - JUDGE in a CLEAN, SEPARATE CONTEXT (the "referee" sub-agent) +# * A DIFFERENT sub-agent, in a FRESH context window, DIFFERENT session/turn +# from the candidate (no shared scratch, no candidate's chain-of-thought), +# is GIVEN the ground-truth answer-anchor and scores the candidate 0..1 on +# whether the required memory was actually recalled/applied. +# * Control/sentinel probes are mixed in (see below): questions the referee +# SHOULD score low (answer deliberately absent from any diary). They are the +# adversarial tripwire for a too-lenient judge. +# +# STEP 3 - MERGE LOCALLY ($0) -> Applied% +# * The verdicts come back here. The GATE (block A, deterministic) runs FIRST: +# drop the whole batch if any control scored high, or if any control was +# silently skipped. Only then MERGE: strip controls, average the real +# scores, Applied% = round(mean * 100). Unscored (null) real questions are +# NOT invented -- excluded + counted (N excluded). +# +# ============================================================================ +# 4 CAVEATS (MANDATORY -- this measurement is weak in exactly these 4 ways) +# ============================================================================ +# (a) POINT-IN-TIME PROXY, not real behavior. A judged score at one instant is a +# proxy for "was it applied", NOT observed downstream behavior over a real +# task. High Applied% != the memory changed what the system actually did. +# +# (b) SHARED MODEL-FAMILY NOT NEUTRALIZED. Candidate and referee share the same +# base model + the same corpus/RAG. Blanking the ANSWER-ANCHOR does NOT blank +# the WHOLE CORPUS -- the referee (and even the candidate) may reconstruct the +# answer from common training / shared store rather than from the diary under +# test. The ONLY model-independent signal is RECURRENCE-FREQUENCY anchoring +# (does the SAME bug/mark stop recurring over sessions) -- that lives in the +# OLD measurable-now block (recurrence tokens / AS-class registry), NOT here. +# This no-key score is the WEAKER, model-entangled cousin of that. +# +# (c) BLINDING IS AN INSTRUCTION, NOT AN ENFORCEMENT. "Candidate doesn't see the +# answer / doesn't know it's graded" and "referee is a clean separate context" +# are DIRECTIVES to the spawn, not a sandbox that makes leakage impossible. A +# shared file, a chatty prompt, or a resumed session can defeat it. Treat the +# separation as best-effort, and prefer the control tripwire over trusting it. +# +# (d) NO AGE DIMENSION YET, SMALL SAMPLE. This does not measure retention-over-age +# (does an OLD memory still get applied), and the sample-question set is small. +# So even a clean pass is a thin, young signal -- a FLAG, never a grade. +# +# ============================================================================ +# NON-NEGOTIABLES (Harness-11 / Harness-16 house rules) +# ============================================================================ +# (1) NO-API : deterministic arithmetic + set logic ONLY. NEVER calls a model. +# (The 2-agent pass in block [B] is RUNTIME via a workflow, not here.) +# (2) READ-ONLY on the budget : this script NEVER reads-to-tune nor writes the +# memory-budget.json caps. Budget numbers are the OWNER's authority (anh / +# chu-du-an); scripts only ever measure-and-report. This file does not even +# need the budget -- it touches NO owner-set number. +# (3) PS 5.1, ASCII-only script body (gotcha #30). Any glyph via [char]0xXXXX +# code-point; any target file read with -Encoding UTF8 explicitly. +# (4) Exit 0 in normal + -Honest runs (measure-and-report, NOT a build gate). +# -Selftest is the ONE exception: it exits 0 only if all 3 cases behave as +# specified, non-zero otherwise, so CI/a human can trust the gate has teeth. +# +# Usage: +# powershell.exe -ExecutionPolicy Bypass -File scripts\applied-eval-nokey.ps1 -Selftest +# powershell.exe -ExecutionPolicy Bypass -File scripts\applied-eval-nokey.ps1 -Honest +# powershell.exe -ExecutionPolicy Bypass -File scripts\applied-eval-nokey.ps1 # prints honesty rung + usage + +param( + [switch]$Selftest = $false, + [switch]$Honest = $false +) + +$ErrorActionPreference = 'Stop' +$CHECK = [char]0x2705 # green check, kept as code-point (ASCII body, gotcha #30) +$CROSS = [char]0x274C # red cross, kept as code-point + +# --------------------------------------------------------------------------- +# Constant: a control (sentinel) probe should score BELOW this to be "correctly +# rejected". At-or-above = the referee wrongly credited a control = too lenient. +# --------------------------------------------------------------------------- +Set-Variable -Name CONTROL_HIGH_THRESHOLD -Value 0.5 -Option Constant + +# =========================================================================== +# [A] ADVERSARIAL GATE (deterministic -- the real, tested teeth) +# =========================================================================== +# INPUT : array of verdict objects (PSCustomObject or hashtable), each with +# id : string, probe id +# score : double 0..1, OR $null = judge did not score it +# is_control : bool, true = sentinel/control probe +# control_expected_low : bool, (advisory) a control is expected low +# OUTPUT : PSCustomObject { Decision = 'BLOCK'|'PASS'; Reasons = string[]; +# Controls = int; ControlsHighOrMissing = int } +# +# LOGIC (fail-closed -- any doubt about the referee's rigor => BLOCK the batch): +# * If ANY control has a null/missing score -> BLOCK +# (a control that was silently dropped means the judge quietly skipped the +# tripwire; we do NOT let a batch through with an un-checked control.) +# * If ANY control scored >= CONTROL_HIGH_THRESHOLD -> BLOCK +# (the judge credited a probe whose answer is deliberately absent = too +# lenient => every real score from this same judge is suspect => drop all.) +# * Else (every control present AND every control < threshold) -> PASS. +# --------------------------------------------------------------------------- +function Get-ScoreOrNull($v) { + # Read .score whether $v is a hashtable or a PSCustomObject; return $null if + # absent or explicitly null. Do NOT coerce a missing key into 0 (that would + # hide a skipped control). + if ($null -eq $v) { return $null } + if ($v -is [System.Collections.IDictionary]) { + if (-not $v.Contains('score')) { return $null } + $s = $v['score'] + } else { + $prop = $v.PSObject.Properties['score'] + if ($null -eq $prop) { return $null } + $s = $prop.Value + } + if ($null -eq $s) { return $null } + return [double]$s +} + +function Get-BoolField($v, [string]$name) { + if ($null -eq $v) { return $false } + if ($v -is [System.Collections.IDictionary]) { + if (-not $v.Contains($name)) { return $false } + return [bool]$v[$name] + } + $prop = $v.PSObject.Properties[$name] + if ($null -eq $prop) { return $false } + return [bool]$prop.Value +} + +function Invoke-AdversarialGate { + param([object[]]$Verdicts) + + $reasons = New-Object System.Collections.Generic.List[string] + $controls = 0 + $controlsHighOrMissing = 0 + + foreach ($v in $Verdicts) { + $isControl = Get-BoolField $v 'is_control' + if (-not $isControl) { continue } + $controls++ + $id = if (Get-BoolField $v 'id') { $v.id } else { $v.id } # id passthrough (may be $null) + $score = Get-ScoreOrNull $v + + if ($null -eq $score) { + $controlsHighOrMissing++ + $reasons.Add("control '$($v.id)' has NO score (silently skipped) -> BLOCK") + continue + } + if ($score -ge $CONTROL_HIGH_THRESHOLD) { + $controlsHighOrMissing++ + $reasons.Add("control '$($v.id)' scored $score >= $CONTROL_HIGH_THRESHOLD (judge too lenient) -> BLOCK") + } + } + + if ($controls -eq 0) { + # No tripwire at all: cannot certify the judge's rigor. Fail-closed. + $reasons.Add("no control probes present -> cannot certify judge rigor -> BLOCK") + return [pscustomobject]@{ + Decision = 'BLOCK'; Reasons = $reasons.ToArray() + Controls = 0; ControlsHighOrMissing = 0 + } + } + + $decision = if ($controlsHighOrMissing -gt 0) { 'BLOCK' } else { 'PASS' } + return [pscustomobject]@{ + Decision = $decision; Reasons = $reasons.ToArray() + Controls = $controls; ControlsHighOrMissing = $controlsHighOrMissing + } +} + +# =========================================================================== +# MERGE (deterministic -- only reached AFTER the gate returns PASS) +# =========================================================================== +# Strip controls, average the REAL scores, Applied% = round(mean * 100). +# A real question the judge did not score (null) is NOT invented -> excluded + +# counted in ExcludedNull. If, after excluding controls + nulls, no real scored +# question remains, AppliedPct = $null (report "no scored real questions"), +# NEVER a fabricated 0. +# --------------------------------------------------------------------------- +function Merge-AppliedScore { + param([object[]]$Verdicts) + + $realScores = New-Object System.Collections.Generic.List[double] + $excludedNull = 0 + $controlCount = 0 + + foreach ($v in $Verdicts) { + if (Get-BoolField $v 'is_control') { $controlCount++; continue } + $score = Get-ScoreOrNull $v + if ($null -eq $score) { $excludedNull++; continue } # do NOT fabricate a number + $realScores.Add($score) + } + + if ($realScores.Count -eq 0) { + return [pscustomobject]@{ + AppliedPct = $null; RealN = 0; ExcludedNull = $excludedNull + ControlN = $controlCount; Mean = $null + } + } + $mean = ($realScores | Measure-Object -Average).Average + return [pscustomobject]@{ + AppliedPct = [int][Math]::Round($mean * 100) + RealN = $realScores.Count + ExcludedNull = $excludedNull + ControlN = $controlCount + Mean = [Math]::Round($mean, 4) + } +} + +# =========================================================================== +# Honesty rung (printed on plain run + at end of -Selftest) +# =========================================================================== +function Write-HonestyRung { + Write-Host "" + Write-Host "--- HONESTY RUNG (applied-eval-nokey) ---" + Write-Host "We HAVE : an adversarial GATE (MANUAL -- you supply the verdicts + the control list)" + Write-Host " + a 3-case selftest proving the gate BLOCKs a lenient/dropped control." + Write-Host "We do NOT claim any live number has passed this gate." + Write-Host "Applied% numbers are DEFERRED until (a) the sample-questions mature AND" + Write-Host " (b) an independent, DIFFERENT-SESSION judge scores them." + Write-Host "This file is a MECHANISM, NOT a number." + Write-Host "" + Write-Host "4 CAVEATS baked in: (a) point-in-time proxy != real behavior; (b) shared model-family" + Write-Host " not neutralized (blank-ANSWER != blank-CORPUS; only recurrence-freq anchoring" + Write-Host " is model-independent, and that lives in the OLD measurable-now block);" + Write-Host " (c) blinding is an instruction, not an enforcement; (d) no age dimension yet," + Write-Host " small sample -- a FLAG, never a grade." +} + +# =========================================================================== +# SELFTEST (3 cases, internal fake data -- the ONE path that may exit non-zero) +# =========================================================================== +function Invoke-Selftest { + # $script:-scoped so the nested Assert-Case can flip it and the flip survives + # back here (a plain local would NOT propagate from the nested function -- + # caught by fault-injection: a sabotaged gate printed CASE FAIL yet the summary + # still said ALL PASS + exit 0 when this was function-local). + $script:allPass = $true + + function Assert-Case { + param([string]$Name, [bool]$Condition, [string]$Detail) + if ($Condition) { + Write-Host ("{0} CASE {1}: PASS ({2})" -f $CHECK, $Name, $Detail) + } else { + Write-Host ("{0} CASE {1}: FAIL ({2})" -f $CROSS, $Name, $Detail) + $script:allPass = $false + } + } + + Write-Host "=== applied-eval-nokey SELFTEST (3 cases) ===" + + # -- Case (a): a control scored HIGH (0.9) -> MUST BLOCK ------------------- + $caseA = @( + [pscustomobject]@{ id='q1'; score=0.8; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='q2'; score=0.7; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='ctlA'; score=0.9; is_control=$true; control_expected_low=$true } + ) + $rA = Invoke-AdversarialGate -Verdicts $caseA + Assert-Case -Name 'a-control-HIGH' -Condition ($rA.Decision -eq 'BLOCK') ` + -Detail ("control 0.9 -> Decision=$($rA.Decision) (expect BLOCK); reason=" + ($rA.Reasons -join '; ')) + + # -- Case (b): all controls LOW (0.1) -> MUST PASS + produce Applied% ------ + $caseB = @( + [pscustomobject]@{ id='q1'; score=0.8; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='q2'; score=0.6; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='ctlB'; score=0.1; is_control=$true; control_expected_low=$true } + ) + $rB = Invoke-AdversarialGate -Verdicts $caseB + $mB = $null + if ($rB.Decision -eq 'PASS') { $mB = Merge-AppliedScore -Verdicts $caseB } + # real scores 0.8,0.6 -> mean 0.7 -> Applied% = 70; control excluded. + $bOk = ($rB.Decision -eq 'PASS') -and ($null -ne $mB) -and ($mB.AppliedPct -eq 70) -and ($mB.ControlN -eq 1) + $bDetail = if ($null -ne $mB) { + "Decision=$($rB.Decision); Applied%=$($mB.AppliedPct) (expect 70); RealN=$($mB.RealN); ControlN=$($mB.ControlN)" + } else { + "Decision=$($rB.Decision) (expect PASS) -- merge not reached" + } + Assert-Case -Name 'b-control-LOW' -Condition $bOk -Detail $bDetail + + # -- Case (c): a control was FORGOTTEN (null score) -> MUST BLOCK ---------- + $caseC = @( + [pscustomobject]@{ id='q1'; score=0.9; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='q2'; score=0.8; is_control=$false; control_expected_low=$false } + [pscustomobject]@{ id='ctlC'; score=$null; is_control=$true; control_expected_low=$true } + ) + $rC = Invoke-AdversarialGate -Verdicts $caseC + Assert-Case -Name 'c-control-FORGOTTEN' -Condition ($rC.Decision -eq 'BLOCK') ` + -Detail ("control score=null -> Decision=$($rC.Decision) (expect BLOCK); reason=" + ($rC.Reasons -join '; ')) + + Write-Host "" + if ($script:allPass) { + Write-Host ("{0} SELFTEST: ALL 3 CASES PASS" -f $CHECK) + } else { + Write-Host ("{0} SELFTEST: FAILURE -- at least one case did not behave as specified" -f $CROSS) + } + + Write-HonestyRung + return $script:allPass +} + +# =========================================================================== +# Entry point +# =========================================================================== +if ($Selftest) { + $ok = Invoke-Selftest + if ($ok) { exit 0 } else { exit 1 } +} + +if ($Honest) { + Write-HonestyRung + exit 0 +} + +# Plain run: no live data path exists yet (numbers DEFERRED). Print the rung + usage. +Write-Host "applied-eval-nokey.ps1 -- MECHANISM for a no-API Applied% measurement (adversarial gate + merge)." +Write-Host "No live numbers are produced: the 2-agent probe/judge pass is RUNTIME (via a workflow) and" +Write-Host "runs only when the sample-questions corpus matures. This script contributes the DETERMINISTIC" +Write-Host "gate + merge + selftest that the runtime verdicts flow through." +Write-HonestyRung +Write-Host "" +Write-Host "Run the selftest: powershell.exe -ExecutionPolicy Bypass -File scripts\applied-eval-nokey.ps1 -Selftest" +exit 0 diff --git a/scripts/crystallized-backfill.ps1 b/scripts/crystallized-backfill.ps1 new file mode 100644 index 0000000..6095d77 --- /dev/null +++ b/scripts/crystallized-backfill.ps1 @@ -0,0 +1,254 @@ +# crystallized-backfill.ps1 - Harness-... crystallized-backfill = "measure-then-fill" +# Adopt: AI_INFRA broadcast F4 + session-cmd-budget-display Upgrade-1 (SE adapt 07-06). +# +# WHAT THIS IS +# A PLANNER (DRY, NO-API) that answers ONE question for the LEAD hot-feed: +# "After the always-loaded hot-load sources are in Tier-1, how much REAL-TOKEN +# headroom is left under the live cap, and how many tokens of crystallized +# (value-gated) backfill may we pull in WITHOUT over-stuffing?" +# It MEASURES (byte-count the live hot-load files) then computes an EXPECTED +# backfill under a hard precondition. It does NOT pour anything (no memory write, +# no context change) - exactly like memory-archive-gate.ps1 it is a DRY planner. +# +# NON-NEGOTIABLES +# (1) OWNER-READ-ONLY : every budget number (lead cap + backfill target) is the +# OWNER's (chu-du-an) to set in memory-budget.json. This +# script ONLY reads them LIVE. It NEVER computes, writes, +# auto-tunes, or persists a budget number. (role_boundary_note) +# (2) DEFAULT 0 = OFF : if the optional crystallized_backfill block is ABSENT (or +# target<=0) the expected backfill is 0 (TAT / turned-off). +# Backfill only "opens" when owner sets target>0 AND measured +# headroom>0 (precondition). Standalone default = OFF. +# (3) NOT-FOR-SUB : this measures the LEAD hot-feed only. Sub packs are +# hand-distilled by em-main per task; blind-pouring backfill +# into a sub dilutes relevance. If invoked -Tier sub => WARN. +# (4) CALIBRATED RANGE: token headroom is a RANGE [bytes/4 .. bytes/3.0], NOT the +# false-precise byte/4. VN-diacritic hot-memory ~3.0-3.5 +# byte/tok, so bytes/3.0 = worst-case (fewest tokens hidden +# behind the bytes). measured_headroom uses the worst case. +# (5) NO-API : Select-String + byte/file measure ONLY. NEVER calls a model. +# (6) PS 5.1 / ASCII : script BODY is ASCII-only (gotcha #30); any glyph via +# [char]0xXXXX code-point; target files read -Encoding UTF8. +# (7) exit 0 ALWAYS : measure-and-report, NOT a build-gate. +# +# Usage: +# powershell.exe -ExecutionPolicy Bypass -File scripts\crystallized-backfill.ps1 +# powershell.exe -ExecutionPolicy Bypass -File scripts\crystallized-backfill.ps1 -Json +# +# See [TAILOR] block at the bottom for the honest simplifications vs the maximal spec. + +param( + [string]$RepoRoot = "$PSScriptRoot\..", + [switch]$Json = $false, + [string]$Tier = "lead" # NOT-for-sub guard: anything but 'lead' => WARN (still measures lead) +) + +$ErrorActionPreference = 'Stop' + +# ---- glyphs as code-points (ASCII body, gotcha #30) ----------------------- +$WARN = [char]0x26A0 # warning sign +$ARROW = [char]0x2192 # rightwards arrow (source-order display) + +# ---- resolve paths -------------------------------------------------------- +$RepoRoot = (Resolve-Path $RepoRoot).Path +$memRoot = Join-Path $RepoRoot '.claude\agent-memory' +$budgetPath = Join-Path $memRoot 'memory-budget.json' + +if (-not (Test-Path $budgetPath)) { Write-Error "memory-budget.json not found: $budgetPath"; exit 1 } + +# ---- load LIVE budget ----------------------------------------------------- +$budget = Get-Content $budgetPath -Raw | ConvertFrom-Json + +# (a) lead cap : LIVE-read, never hardcode (owner authority). +$tg = $budget.token_governor +if ($null -eq $tg -or $null -eq $tg.tier1_hotfeed_tokens) { + Write-Error "memory-budget.json missing token_governor.tier1_hotfeed_tokens (lead cap source)"; exit 1 +} +$leadCap = [int]$tg.tier1_hotfeed_tokens.lead_tokens # LIVE. owner-set. read-only here. + +# (b) crystallized_backfill : OPTIONAL block. Absent => SAFE DEFAULT (target=0=OFF, +# default hotload list). em-main adds the config block later; script runs +# standalone with defaults now. +$cb = $budget.crystallized_backfill +$defaultHotload = @( + 'docs/STATUS.md', + 'docs/HANDOFF.md', + '.claude/governance/ACTIVE-MARKS.md', + 'docs/changelog/migration-todos.md' +) +if ($null -eq $cb) { + $target = 0 # DEFAULT OFF (TAT) + $hotloadSources = $defaultHotload + $cfgState = "ABSENT (safe default: target=0=OFF, default hotload list)" +} else { + # target : owner number. Read LIVE; default 0 if the field is missing. + if ($null -ne $cb.target) { $target = [int]$cb.target } else { $target = 0 } + # hotload_sources : owner list; fall back to default if missing/empty. + $hotloadSources = @() + if ($cb.hotload_sources) { foreach ($h in $cb.hotload_sources) { if ($h) { $hotloadSources += [string]$h } } } + if ($hotloadSources.Count -eq 0) { $hotloadSources = $defaultHotload } + $cfgState = "present (target + hotload_sources read LIVE)" +} + +# ---- NOT-FOR-SUB guard (invariant 3) -------------------------------------- +$subWarn = $false +if ($Tier -ne 'lead') { + $subWarn = $true +} + +# ========================================================================== +# MEASURE : byte-count each LIVE hot-load source (UTF8), sum, derive RANGE. +# ========================================================================== +$srcRows = @() +$totalBytes = 0 +$utf8 = New-Object System.Text.UTF8Encoding($false) +foreach ($rel in $hotloadSources) { + $full = Join-Path $RepoRoot ($rel -replace '/', '\') + if (Test-Path $full) { + # measure via UTF8 decode-length-in-bytes = on-disk byte size (explicit UTF8, gotcha #30) + $b = ([System.IO.File]::ReadAllBytes($full)).Length + $totalBytes += $b + $srcRows += [pscustomobject]@{ src = $rel; bytes = $b; state = 'ok' } + } else { + $srcRows += [pscustomobject]@{ src = $rel; bytes = 0; state = 'MISSING' } + } +} + +# calibrated RANGE (invariant 4): tok_low = optimistic (bytes/4), tok_high = worst (bytes/3.0) +$tokLow = [int][math]::Round($totalBytes / 4.0) +$tokHigh = [int][math]::Round($totalBytes / 3.0) + +# measured_headroom = cap - worst-case-load (can be NEGATIVE = hot-feed near full) +$measuredHeadroom = $leadCap - $tokHigh + +# ---- expected_backfill (invariant 2 + precondition) ----------------------- +# precondition: only OPEN backfill when headroom>0 AND target>0. Else 0. +if ($target -gt 0 -and $measuredHeadroom -gt 0) { + $expectedBackfill = [math]::Min($target, $measuredHeadroom) + $preconditionMet = $true +} else { + $expectedBackfill = 0 + $preconditionMet = $false +} + +# reason string (why backfill is what it is) +if ($target -le 0) { + $backReason = "target=0 => OFF (TAT, default until owner sets target>0)" +} elseif ($measuredHeadroom -le 0) { + $backReason = "measured_headroom<=0 => NO room (hot-feed at/over worst-case cap)" +} elseif ($expectedBackfill -eq $target) { + $backReason = "min(target,headroom)=target => full target fits under headroom" +} else { + $backReason = "min(target,headroom)=headroom => headroom binds (target exceeds room)" +} + +# ========================================================================== +# -Json : one machine-readable line, then exit. (numbers all live-derived) +# ========================================================================== +if ($Json) { + $out = [ordered]@{ + cap = $leadCap + bytes = $totalBytes + tok_low = $tokLow + tok_high = $tokHigh + headroom = $measuredHeadroom + target = $target + backfill = $expectedBackfill + } + Write-Output (($out | ConvertTo-Json -Compress)) + exit 0 +} + +# ========================================================================== +# HUMAN REPORT +# ========================================================================== +$dash = [string]([char]45) # '-' as a value, never a bare '--' run (PS 5.1 decrement-op trap) + +Write-Output "============================================================" +Write-Output " crystallized-backfill.ps1 - measure-then-fill (DRY planner)" +Write-Output " tier : $Tier" +Write-Output " budget.json : $budgetPath" +Write-Output " cb config : $cfgState" +Write-Output "============================================================" + +if ($subWarn) { + Write-Output "" + Write-Output (" {0} NOT-FOR-SUB: -Tier '$Tier' requested. This planner measures the LEAD" -f $WARN) + Write-Output " hot-feed ONLY. Sub packs are hand-distilled by em-main per task; blind" + Write-Output " backfill into a sub dilutes relevance. Reporting LEAD numbers regardless." +} + +# ---- source measure table ------------------------------------------------- +Write-Output "" +Write-Output "### hot-load sources (LIVE byte-measure, UTF8)" +Write-Output "" +Write-Output ("{0,-44} {1,10} {2,8}" -f 'source', 'bytes', 'state') +Write-Output ("{0,-44} {1,10} {2,8}" -f ($dash*44), ($dash*10), ($dash*8)) +foreach ($r in $srcRows) { + Write-Output ("{0,-44} {1,10} {2,8}" -f $r.src, $r.bytes, $r.state) +} +Write-Output ("{0,-44} {1,10} {2,8}" -f 'TOTAL', $totalBytes, '') + +# ---- the budget number table (Upgrade-1) ---------------------------------- +# ALL numbers read-live; ZERO hardcoded budget values. +Write-Output "" +Write-Output "### budget numbers (Upgrade-1) - ALL live-read, 0 hardcoded" +Write-Output "" +$hr = if ($measuredHeadroom -ge 0) { "$measuredHeadroom" } else { "$measuredHeadroom (NEG=near-full)" } +Write-Output ("{0,-22} : {1}" -f 'Tran tong (live cap)', "$leadCap tok") +Write-Output ("{0,-22} : {1}" -f 'hotload measured', "$totalBytes bytes") +Write-Output ("{0,-22} : {1}" -f 'tok RANGE [low..high]', "[$tokLow .. $tokHigh] tok (bytes/4 .. bytes/3.0)") +Write-Output ("{0,-22} : {1}" -f 'measured_headroom', "$hr tok (cap - tok_high, worst-case)") +Write-Output ("{0,-22} : {1}" -f 'target (owner)', "$target tok") +Write-Output ("{0,-22} : {1}" -f 'expected_backfill', "$expectedBackfill tok ($backReason)") + +# ---- value-gated source-order plan (invariant, inert while target=0) ------ +# When backfill>0 we would PULL crystallized content in this priority order, +# dedup vs the hot-load already counted. We NEVER actually pour it here (DRY, +# like archive-gate) - we only PRINT the order the fill WOULD follow. +Write-Output "" +Write-Output "### value-gated backfill source-order (planner / DRY - no pour)" +Write-Output "" +if ($preconditionMet) { + Write-Output (" precondition MET (target>0 AND headroom>0): would pull up to $expectedBackfill tok in order:") + Write-Output (" 1. gist {0} archive/*.gist.md (4-field distilled)" -f $ARROW) + Write-Output (" 2. value-marked {0} archive lines carrying gotcha# / anti-pattern / root-cause" -f $ARROW) + Write-Output (" 3. curated RAG {0} search_memory high-value hits" -f $ARROW) + Write-Output " (each stage DEDUP vs the hot-load sources above; stop at expected_backfill)" +} else { + Write-Output (" precondition NOT met -> source-order INERT (no pull). Opens only when target>0 AND headroom>0.") + Write-Output (" order (for reference): 1.gist {0} 2.value-marked-archive {0} 3.curated-RAG (dedup vs hot-load)" -f $ARROW) +} + +# ---- honest caveat (invariant, always printed) ---------------------------- +Write-Output "" +Write-Output "------------------------------------------------------------" +Write-Output " HONEST CAVEAT" +Write-Output " char/4 is NOT a real token count; VN-diacritic hot-memory ~3.0-3.5 byte/tok." +Write-Output " Headroom is a RANGE [bytes/4 .. bytes/3.0]; this planner uses bytes/3.0 (worst)." +Write-Output " backfill defaults to 0 = TAT until the OWNER sets target>0 AND measured headroom>0." +Write-Output " Every budget number is the OWNER's authority; this script is READ-ONLY (never tunes/writes)." +Write-Output " HEADROOM is measured over a STABLE FILE-FLOOR (the configured hotload_sources) = an UPPER BOUND." +Write-Output " The PEAK hot-feed also loads session-variable task-context NOT in this list; real headroom is SMALLER." +Write-Output "------------------------------------------------------------" + +# measure-and-report; NEVER a build-gate. +exit 0 + +# ========================================================================== +# [TAILOR] honest simplifications vs the maximal spec: +# * headroom uses the WORST-CASE end of the RANGE (bytes/3.0 => fewest tokens +# hidden behind the bytes => smallest headroom => most conservative "open" +# decision). The optimistic bytes/4 is printed for context only. +# * byte-measure = [IO.File]::ReadAllBytes(...).Length (true on-disk size); +# NOT Get-Content length (which mangles VN/em-dash under PS 5.1 ANSI, gotcha +# #30) and NOT a re-encode estimate. Exact bytes, honest tokens-as-range. +# * the value-gated source-order is a PRINTED PLAN only (gist -> value-marked +# archive -> curated RAG, dedup vs hot-load). It performs NO pull and changes +# NO context - identical DRY-planner stance to memory-archive-gate.ps1. +# * crystallized_backfill block is OPTIONAL: absent => target=0 (OFF) + the 4 +# default hotload sources, so the script is fully standalone before em-main +# adds the config. Present => target + hotload_sources are read LIVE. +# * NOT-FOR-SUB is a WARN (not a hard-exit): -Tier sub still prints LEAD numbers +# but flags that sub-packs are hand-distilled, never blind-backfilled. +# ==========================================================================