Skip to main content

Module manage

Module manage 

Source
Expand description

Model weight management: pinned specs, RAM-based selection, checksum verification, and (feature download) the single permitted network fetch.

Security spine: weights are pinned by SHA-256. A spec with an empty hash is treated as not-yet-pinned and refused, so Kintsugi never loads an unverified blob. The download is the only network egress Kintsugi ever performs.

Structs§

ModelSpec
A pinned model: where to fetch it, its checksum, and the RAM it needs.

Constants§

MODEL_FALLBACK
Low-RAM fallback: Qwen3-1.7B-Instruct, Q4_K_M (~1.1 GB), auto-selected on machines with less RAM. URL/sha must be pinned before enabling download.
MODEL_PRIMARY
Primary model: Qwen3-4B-Instruct, Q4_K_M (~2.5 GB), used when RAM ≥ ~6 GB.

Functions§

detect_ram_mb
Best-effort total system RAM in MB. Falls back to a conservative 4096.
ensure_weights
Ensure the weights for spec exist and verify under dir, returning the path.
select_spec
Choose the largest model that comfortably fits in the available RAM.
sha256_file
Compute the SHA-256 of a file as a lowercase hex string.
verify
Verify a file matches the spec’s pinned checksum.