device: applegpu_g14s  |  34 GB RAM (25.4 GB reclaimable now), 22.9 GB Metal working set
model:  48 layers x 512 experts x 2.76 MB (24576 records = 67.9 GB streamed from SSD)
weights: present by size, 105.3 GB at ~/.slotstream/models/qwen38-flash-next-mlx-4bit (run pull --verify for hashes)

slotstream memory plan (auto)
  device: 34 GB RAM (25.3 GB reclaimable now), 22.9 GB Metal working set
  target: 20.9 GB total process budget, not a RAM usage goal   (adaptive limit: --memory-limit-gb N; fixed cache: --memory-gb N)
  cache:  ~75 of 512 experts per layer  (3617 global slots = 10.0 GB pool)
  plan:   ~19.9 GB full-workload envelope, ~9 tok/s warm decode (est. from M5 Pro anchors)
  memory: 10.0 GB expert cache at load; 9.9 GB allowed for runtime, context and workspace; 1.0 GB budget headroom. Short requests can use less.
  disk:   that estimate assumes an SSD like the one it was measured on (17.3 GB/s). A base-storage Mac mini M2 reads 1.5 GB/s and decoded at 1.41 tok/s against a ~4 estimate, so on base storage expect well under the number above — see docs/HARDWARE.md
  prefill: 1024 tokens per pass (~165 tok/s here; costs ~1.3 GB of the target)
  mtp:    draft head on — speculative decode (1.6 GB resident, charged above)
  vision: images accepted — first image reserves +0.9 GB inside the target; refused if it cannot fit
  context: up to 32768 tokens per request (prompt + reply); a full-length prompt takes ~3.3 min before its first token here, follow-up turns read only what is new
  reuse:  up to 32768 tokens across 4 conversations (~1.2 GB), so a follow-up turn re-prefills only what is new
  lookahead: on, expert prefetch with the draft head, router cache and a GPU barrier every 4 layers (409 MiB, charged above)
memory-feasible window: 262144 tokens; separate from the 30.0-minute request-to-first-token policy

context window: automatic, 32768 tokens on this machine's memory tier. Auto takes the largest
window that keeps speculative decoding, retains one complete conversation, and adds at most 10%
to the estimated time of a 2000-token prompt with a 400-token reply:
Cache reductions above the measured decode range are declined, even when the estimate is flat.
   window   experts/layer   draft   lookahead    pass   typical request   full-window wait
    32768          75/512      on          on    1024     57.8 s (+0.0%)   ~3.3 min   <- auto
    65536          63/512      on          on    1024     61.4 s (+6.1%)   ~7.8 min   (streams the draft head's experts, a cost the estimate does not price)
   131072          31/512     off          on     512    81.8 s (+41.4%)   not yet calibrated   (turns speculative decoding off)
   262144   does not fit with one complete conversation retained
  --max-context N chooses any window up to 262144. A larger window costs memory and
  reading time; it does not guarantee answer quality over very long context.

memory controls (with none, auto is the default):
  --memory-limit-gb G     adaptive ceiling; cache shrinks and recovers within it
  --memory-gb G           total process budget with a fixed cache
  --experts-per-layer N   precise: cache N of 512 per layer (pool = N x 0.133 GB)
  --pool-gb G             raw pool size (1 GB = 7.5 experts/layer)
Use the adaptive ceiling alone. Among fixed controls, experts-per-layer
takes precedence over pool-gb, then memory-gb.
min ~13/layer = 8.1 GB total. The pool is one global cache shared across
all layers -- per-layer is the unit of intuition (a token activates 10
of its 512 per layer), not a quota: hot layers borrow slots from cold.

what a memory target buys (conservative warm-decode estimate from
measured M5 Pro anchors: 30/layer = 6.0, 150/layer = 11.6; the last
column is the wait before the first token of a prompt filling the
whole context, follow-up turns read only what is new):
  target     experts/layer  est. warm decode   pass    full 32768-token prompt
     8.1 GB         13/512      ~ 3 tok/s     256   ~6.4 min
    10.0 GB         17/512      ~ 3 tok/s     256   ~6.4 min
    12.0 GB         28/512      ~ 6 tok/s     512   ~4.4 min
    16.0 GB         51/512      ~ 7 tok/s    1024   ~3.3 min
    24.0 GB   above this Mac's 22.9 GB Metal working set
    28.0 GB   above this Mac's 22.9 GB Metal working set
    36.0 GB   above this Mac's 22.9 GB Metal working set
    48.0 GB   above this Mac's 22.9 GB Metal working set
    73.0 GB   above this Mac's 22.9 GB Metal working set

time to first token at this plan, by prompt length (the pass shrinks past ~4k
tokens so its transient memory stays inside what was measured):
  2k ~12 s · 8k ~50 s · 16k ~1.7 min · 32k ~3.3 min (the cap)
  context state is ~27 KiB per token, up to the model's 262144-token limit.
  `slotstream context-check --tokens N` reads an N-token synthetic prompt on this Mac and
  stops early if reclaimable memory falls below its floor or its time limit passes.
