# sub-task-1 — 4a: ha-nhan C1 'calibrated' -> 'heuristic' (crystallized-backfill.ps1)

> Worker: implementer (Write/Edit) · Wave-1 item 2 · run S127-adap-dot-16-07 · 2026-07-16
> VERDICT: **PASS 3/3 verify** · COMMENT-ONLY · code :118-119 GIU byte-exact · file van pure-ASCII + LF
> File dich DUY NHAT: `scripts/crystallized-backfill.ps1` (+ sub-md nay). Isolation OK.

## 1. Pre-condition EXACT-EDIT (doi chieu DIA truoc edit)

Byte-level inspect (python, whole file):
- total 13394 byte · **non-ASCII = 0** · CRLF = False (LF-only) · 255 dong.
- `:25` DIA = `#   (4) CALIBRATED RANGE: token headroom is a RANGE [bytes/4 .. bytes/3.0], NOT the` -> KHOP draft before-text 1/1.
- `:117` DIA = `# calibrated RANGE (invariant 4): tok_low = optimistic (bytes/4), tok_high = worst (bytes/3.0)` -> KHOP draft before-text 1/1.
- `:118` = `$tokLow  = [int][math]::Round($totalBytes / 4.0)` · `:119` = `$tokHigh = [int][math]::Round($totalBytes / 3.0)` (code hardcode, GIU nguyen tuyet doi).

Ket luan: 2 before-text khop dia exact -> duoc phep apply (khong DUNG task).

## 2. Edit da ap (2 cho, ca 2 la COMMENT)

**Edit-1 (:25)** — chi doi nhan, phan con lai dong GIU:
```
- #   (4) CALIBRATED RANGE: token headroom is a RANGE [bytes/4 .. bytes/3.0], NOT the
+ #   (4) HEURISTIC RANGE (convention, NOT measured): token headroom is a RANGE [bytes/4 .. bytes/3.0], NOT the
```

**Edit-2 (:117)** — after-text draft §4a, F6 ap: em-dash '—' draft -> '--' (pure-ASCII #30); chu da ASCII-stripped san ('CHUA'/'tai'/'dinh-chinh'):
```
- # calibrated RANGE (invariant 4): tok_low = optimistic (bytes/4), tok_high = worst (bytes/3.0)
+ # heuristic RANGE (invariant 4): divisors = convention char/4 + VN ~3.0-3.5 byte/tok -- CHUA do tokenizer that tai SE (see dinh-chinh letter 58f5afd8 2026-07-16). tok_low = optimistic (bytes/4), tok_high = worst (bytes/3.0)
```

**git diff --stat:** `1 file changed, 2 insertions(+), 2 deletions(-)` — CHINH XAC dong 25 + 117, khong dong nao khac.
**Post-edit byte check:** total 13549 byte · non-ASCII = 0 · CRLF = False · 255 dong (khong doi) · :118/:119 repr byte-identical voi truoc edit.

## 3. Verify 3/3 (output THAT, khong mo ta suong)

### (a) Select-String -Path calibrat -> 0 hit  [PASS]
```
$ Select-String -Path scripts\crystallized-backfill.ps1 -Pattern "calibrat"
calibrat hit count: 0
```
(giu dang `Select-String -Path` per F5 — KHONG cai tien sang Get-Content | Select-String; default case-insensitive -> phu ca 'CALIBRAT'/'calibrat', 0 hit = ca 2 cho da het nhan cu.)

### (b) chay script -> exit 0 + dong 'tok RANGE'  [PASS]
```
$ powershell.exe -ExecutionPolicy Bypass -File scripts\crystallized-backfill.ps1
EXIT CODE: 0
...
tok RANGE [low..high]  : [118424 .. 157898] tok  (bytes/4 .. bytes/3.0)
```
Live-measured range **[118424 .. 157898]** == baseline C **[118424 .. 157898]** (0 drift luot nay). Dong hien dien PASS. (script van in day du bang: hotload 473694 byte, cap 380000, headroom 222102, target 210000, backfill 210000.)

### (c) python strict encoding='ascii' first 130 lines -> OK  [PASS]
```
VERIFY (c): read first 130 lines with strict encoding=ascii -> OK, count= 130
line 25 : #   (4) HEURISTIC RANGE (convention, NOT measured): token headroom is a RANGE [bytes/4 .. bytes/3.0], NOT the
line 117: # heuristic RANGE (invariant 4): divisors = convention char/4 + VN ~3.0-3.5 byte/tok -- CHUA do tokenizer that tai SE (see dinh-chinh letter 58f5afd8 2026-07-16). tok_low = optimistic (bytes/4), tok_high = worst (bytes/3.0)
line 118: $tokLow  = [int][math]::Round($totalBytes / 4.0)
line 119: $tokHigh = [int][math]::Round($totalBytes / 3.0)
```
(strict-ascii decode 130 dong dau khong raise -> chung #30 pure-ASCII con giu.)

## 4. Isolation / compliance
- Chi cham: `scripts/crystallized-backfill.ps1` (target giao) + file nay `sub-task-1.md`. KHONG dung sub-task-0.md, KHONG dung MD canonical / MEMORY / agents.
- KHONG store_memory / RAG-write / curl Qdrant. KHONG ghi ngoai repo/run-folder.
- Code behavior 0 thay doi (comment-only); F6 em-dash -> '--' da ap; F5 verify-pattern giu dang -Path.
