Trigger
- User runs
/update-litert-models - User asks to bump a catalog model to a newer HuggingFace revision
- models.md
stale_afteris today or in the past - A catalog download fails integrity (length or SHA-256)
Preconditions
- Read index.md for scope (pins only; no silent bump).
- Read pin-policy.md.
- Default mode is verify. Bump only when the user said to bump a named model (or “bump all that have a newer main”).
Steps
1. Read the current catalog
Read composeApp/src/commonMain/kotlin/com/inspiredandroid/kai/inference/LocalModelCatalog.kt (MODEL_CATALOG).
For each row parse downloadUrl into repo, commit, fileName. Fail the refresh if any URL uses main or another non-hex ref.
2. Fetch HuggingFace
For each model:
https://huggingface.co/api/models/<repo>—shais currentmain.https://huggingface.co/api/models/<repo>/tree/<pinned-commit>?recursive=true— findfileName; take.lfs.oidand.lfs.size.- Optional:
https://huggingface.co/api/models/<repo>/tree/main?recursive=truewhenmain≠ pin, to record the available newer digest/size. - Optional cross-check:
curl -sI -L <downloadUrl>x-linked-etag.
3. Diff
Show before writing:
- pins whose commit+digest+size still match (attested)
- pins whose
mainhas moved (available newer revision — do not bump unless asked) - pins whose commit is missing or digest mismatches (broken — do not invent a replacement)
4. Apply
Verify-only (default): do not change Kotlin URLs, SHA-256, or sizes. Update this bundle’s snapshot table, generated, stale_after, and log.md.
Bump (only if asked): for each named model, set commit + SHA-256 + sizeBytes together from the tree API of the target commit (usually current main). Leave GPU baseline, context defaults, and isRecommended alone unless product said otherwise. Never write /resolve/main/.
Update:
composeApp/src/commonMain/kotlin/com/inspiredandroid/kai/inference/LocalModelCatalog.kt
If sizes or display names used in docs/features/on-device-inference.md changed, update that table and Last verified.
Update this bundle:
- Replace the pin table in models.md
generated: { by: process:update-litert-models, at: <ISO-8601 UTC> }stale_after~30 days ahead (YYYY-MM-DD) — pins change on product release, not biweekly- After tests pass, set
verified
Append a dated entry to log.md (newest first under today’s heading).
5. Verify
./gradlew :composeApp:compileKotlinDesktop./gradlew :composeApp:desktopTest --tests '*LocalModel*'./gradlew spotlessApply- On green tests, set on models.md:
verified: { by: process:desktopTest-LocalModel, at: <ISO-8601 UTC> }
Hard rules
- Do not add runtime HuggingFace calls to decide which bytes to download.
- Do not write a branch ref into a download URL.
- Do not bump unless the user asked.
- Bundle and Kotlin must not drift: every refresh updates the bundle; Kotlin only on bump.