[CLAUDE] Docs: S146 closeout — session-model 3 owner-decision + hook 4-path + H24 auto
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m25s

Ap spec-apply-hub-s145-v2 (5 axis, governance-only: 0 prod-code, 0 migration).
Workflow S145 chet giua chung -> /tiep §4 relaunch-cat-gon wf_3d803740-41d 3/3 DONE.

Owner-decision @S146:
- session_ctx_kb = 64 TUONG-MINH (giu nguyen caveat ghost-wire: 0 reader)
- session-model: scaffold IDEMPOTENT (tach cap-SO vs tao-THU-MUC) · closed.md WIRE
  (session-end §6.3-bis) · V2 AUTO (go cong NGUOI, GIU cong NHIP 6/15/3)

Landed: C7 §N.8 predicate 4-ve · hook wal-flush.ps1 4 path (+.claude/sessions/)
· San-3 tin-hieu ⑤ + ORPHAN-L · D2 KIEM end-only · §L.c completeness-gate co RANG.
LIVE-VERIFY hook 4-path PASS repo THAT (da7ee8a). Session-model chay TRON VONG dau
tien: pause-S146 -> resume-S146 -> ORPHAN-L can so.

H24 force-fire (P=8 pause >= 1, luat auto moi): 2 vai + h24-audit -> 7 FLAG, va het:
- sweep-consent sot 6 site (h24-audit.md:4 = frontmatter description)
- closed.md wired-but-declared-unwired (ghost-wire CHIEU NGUOC)
- owner-decision [7] BI GHI DE do tai-dung slot-index -> mat uy-quyen push
3/3 vai lane-H24 garble #53: ghi-dia-SOM cuu tron, ghi-MUON mat trang.

So: orphan run-folder 3->0 · carry 14->20 (co tag [carry:*]) · +E-013 +E-014
error-ledger · +memory feedback_absence_looks_like_clean · .gitignore +lock file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-23 00:16:37 +07:00
parent a1e2416f37
commit 8b6df0a396
86 changed files with 5683 additions and 113 deletions

View File

@ -0,0 +1,71 @@
# distill-shard-probe.ps1 — C11 (adap dot-11, S144 2026-07-22)
# Trigger nen-kết-tinh theo ĐẾM VẬT THẬT (so shard chua-gist), thay trigger ngay-lich.
# Owner: co-che = O-6 (anh chot) · so = min_pending_shards (anh chot 7 @S144).
#
# 🔴 SINGLE-SOURCE: nguong DOC TU memory-budget.json, KHONG hardcode o day (B1).
# 🔴 -RepoRoot = duong fault-inject (chay tren cay tam de chung script CO RANG, khong chi happy-path).
#
# SHARD = archive/<period>.md CHUA co <period>.gist.md cap doi.
# LOAI TRU tuong minh: _INDEX.md (muc-luc) + *.gist.md.
# Vi sao phai ghi ro: bo dem dau tien cua lead ra 20, trong do 5 la _INDEX.md => 25% duong-gia.
param(
[string]$RepoRoot = "$PSScriptRoot\..",
[switch]$Quiet
)
$ErrorActionPreference = 'Stop'
$root = (Resolve-Path $RepoRoot).Path
$budgetPath = Join-Path $root '.claude\agent-memory\memory-budget.json'
$memRoot = Join-Path $root '.claude\agent-memory'
# --- doc nguong LIVE tu single-source (UTF8 tuong minh — tranh bay encoding E-010) ---
if (-not (Test-Path $budgetPath)) { Write-Output "SHARD-PROBE: khong thay memory-budget.json -> probe-loi (khong chan)"; exit 0 }
$raw = [IO.File]::ReadAllText($budgetPath, [Text.Encoding]::UTF8) -replace "^", ""
$cfg = $raw | ConvertFrom-Json
$dt = $cfg.distill_trigger
if ($null -eq $dt) { Write-Output "SHARD-PROBE: thieu key distill_trigger -> FAIL-LOUD (khong gia dinh default)"; exit 0 }
$minShards = $dt.min_pending_shards
$bulkShards = $dt.bulk_note_shards
# --- dem shard chua-gist ---
$pending = @()
if (Test-Path $memRoot) {
Get-ChildItem -Path $memRoot -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$arc = Join-Path $_.FullName 'archive'
if (Test-Path $arc) {
Get-ChildItem -Path $arc -Filter '*.md' -File -ErrorAction SilentlyContinue | ForEach-Object {
$n = $_.Name
if ($n -eq '_INDEX.md') { return } # muc-luc, KHONG phai shard
if ($n -like '*.gist.md') { return } # ban nen, KHONG phai shard
$gist = Join-Path $arc ($n -replace '\.md$', '.gist.md')
if (-not (Test-Path $gist)) { $pending += $_.FullName }
}
}
}
}
$n = $pending.Count
# --- phan dinh ---
if ($null -eq $minShards) {
Write-Output "SHARD-PROBE: pending=$n | nguong=CHUA-DAT (null) => INERT, owner chua cho so"
exit 0
}
# 🔴 RANH `-gt` KHONG PHAI `-ge` — doi @S144 sau owner-decision lan 2.
# Vi sao: owner chot "lay 15, TANG DAN neu them vao" = nguong NEO VAO trang-thai hien tai
# (15 shard da-phu) => 15 phai IM, chi 16+ moi KEU. Voi `-ge` thi 15 keu ngay = vo nghia.
# 🔸 Toan-tu la thu CUA LEAD (lead viet sang nay), so 15 la thu CUA OWNER. Lead sua toan-tu
# cho khop y-dinh owner, KHONG dung con so. Owner veto duoc bat ky luc nao.
$fire = ($n -gt $minShards)
$state = if ($fire) { 'KEU' } else { 'IM' }
$bulk = ''
if ($null -ne $bulkShards -and $n -gt $bulkShards) { $bulk = " | BAO-TO: backlog $n > $bulkShards (van nen het, chi canh bao)" }
Write-Output "SHARD-PROBE: pending=$n | nguong=$minShards => $state$bulk"
if ($fire -and -not $Quiet) {
Write-Output " -> de xuat chay /sleep-recovery-memory-l2 (nen additive, KHONG de ban goc)"
$pending | Select-Object -First 8 | ForEach-Object { Write-Output " $($_.Substring($root.Length+1))" }
if ($n -gt 8) { Write-Output " ... +$($n-8) shard nua" }
}
exit 0