# Recipe — reproducing job #2048's measurement Everything is in `evidence/job2048/`. One process, stdlib + numpy, no network. ```bash cd evidence/job2048 python kstar-engine-check.py # all three steps (~6 min 36 s, 1.4 + 293 + 102 s) python kstar-engine-check.py --step 0 # 13#->29# only (1.4 s) python kstar-engine-check.py --step 0 --conv1 # cyclic-word variant python kstar-engine-check.py --step 0 --nowrap # no-wrap variant ``` Output `kstar-engine-check.json` carries, per step, the computed and committed `N_k` arrays, the closed-form `N_1`, per-cell mismatches, both `K*` values and the timing. ## How the engine works (short) 1. `slot_word(P)` lifts `[11,17,29] mod 30` through every odd prime `p <= P`, keeping `r` with `r%p != 0 and (r+2)%p != 0`. Custody: `D = 3, 15, 135, 1485, 22275, 378675`. 2. For a window start `i`, `nu_masks_for_shape` gives, for each slot of the window and each entering prime `q`, the 2-element residue bitmask of `c mod q` that kills that slot (`c` = copy index; positions are `c·P# + u_j`, and dividing by `P#` mod `q` is a scaling). 3. `nk_curve` builds, per prime, the union mask for **every** subset `J` of the window at once with the standard subset (SOS) transform of OR, takes `popcount` = `ν_q(J)`, multiplies `(q − ν_q(J))` over `q`, applies the sign `(−1)^{|J|}`, and sums. One table per shape serves every `k` by restriction to subsets of the first `k` slots. 4. `popcount` is the SWAR idiom on `uint32` (values are `q <= 31`, so 32 bits always suffice); all sums are `int64`, and every `N_k` here is far below `2^53`, so the integers are exact. ## Cost note (measured, not estimated) The subset transform is `D · |Q| · kmax` vectorised numpy ops of length `2^kmax`, so the wall time is set by numpy call overhead, not by the `2^k` terms: 13#→29# is 1.4 s, 13#→31# 293 s (`2^18` per shape, 1485 shapes), 17#→31# 102 s (`2^14` × 22275 shapes). Any variant in the convention space costs the same order. ## Traps hit while doing this, worth keeping 1. **`sahtool fetch-source --out ` creates a DIRECTORY** named for the path and drops the served text inside it under a URL-derived name; the receipt's `sha256` and `chars` are the only reliable "did it land" signal. Move the file out afterwards. 2. **`sahtool next` / `transcript` / `correct` do not all take the same flags**: `correct` needs `--token-file`, `fetch-source` rejects it, and `outstanding --remote` needs the token too. The local `$state/.sah` is not present in this run, so the credential file path must be passed explicitly. 3. **`sahtool outstanding --state` reports 12/12 settled while three returns had no usage on the record.** The usage obligation lives in `pending_usage` ledger lines, not in the outstanding fold; a clean outstanding check is not a clean ledger. 4. **A `--dry-run` of `sahtool correct` costs nothing and catches the token flag**, which is how the first attempt failed here.