Imported from lohbe/lfb (
AGENTS.md). Install upstream withnpx skills add lohbe/lfb. Copyright stays with the author.
AGENTS.md
Guidance for AI coding agents working in this repository.
What this repo is
A build-automation repo (no application code) that produces a single self-contained
llamafile executable bundling the Gemma 4 E4B (it, QAT, Q4_0) GGUF model into the
llamafile launcher, installed at ~/.local/bin/gemma-4-E4B-it-qat-q4_0.llamafile.
The entire build is driven by justfile. There is no src/, no package manager,
no CI. The only deliverables are justfile, this file, and README.md.
Layout
lfb/
├── justfile # all build logic — the only "code" in this repo
├── README.md # human docs
├── AGENTS.md # this file
├── .gitignore
├── cache/ # (generated) downloaded model + llamafile binary — ~5.5 GB
├── build/ # (generated) .args and the packed <name>.llamafile — ~6.2 GB
└── vendor/zipalign # (generated) shallow clone of jart/zipalign + its `zipalign` binary
cache/, build/, vendor/ are always regenerable; never hand-edit or commit them.
Upstream facts (verified 2026-09)
| Input | Location | Size |
|---|---|---|
| model | https://huggingface.co/google/gemma-4-E4B-it-qat-q4_0-gguf/resolve/main/gemma-4-E4B_q4_0-it.gguf |
5,154,941,280 B |
| optional vision projector | same repo: gemma-4-E4B-it-mmproj.gguf |
991,552,256 B |
| launcher binary | https://github.com/mozilla-ai/llamafile/releases/download/0.10.5/llamafile-0.10.5 |
350,768,862 B |
| zipalign | git clone https://github.com/jart/zipalign → make (C, links -lz; make check runs tests) |
— |
llamafile also ships a llamafile-0.10.5-thin (42 MB) asset; we deliberately use the full
universal binary because the embedded TUI/Web-UI assets are needed. Do not "upgrade" to -thin
without verifying the UI still works.
justfile contract
- All config lives in the variable block at the top; every variable is CLI-overridable
(
just all include_mmproj=1). Keep new config there, not inlined in recipes. all(default) =package+verify;buildis an alias ofpackage.cleanmust remove exactlycache/,build/,vendor/.uninstallremoves only the installed binary. Don't merge them.
Non-negotiable build constraints (why the recipe looks the way it does)
.llamafileis a ZIP (APE) whose first asset is the launcher. We thereforecp cache/llamafile <name>.llamafileand append the other assets — neverzipfrom scratch.zipalignis append-only and never reflows. Each invocation leaves the old central directory as junk. Always start from a fresh launcher copy and pass all files in a singlezipalign -j0invocation (binary, model [, mmproj],.args). Never call zipalign twice on the same target.-j0is required for the model: store (uncompressed) + strip path components. Compressed weights cannot bemmap()ed by the launcher. Asset names in the archive are the basenames (e.g.gemma-4-E4B_q4_0-it.gguf,.args), which is why.argsreferences/zip/gemma-4-E4B_q4_0-it.ggufwith the/zip/prefix..argsformat: one argument per line; the final line must be the literal token...(replaced at runtime by user-supplied CLI args).-m <model>is the only required arg.- Downloads are idempotent: a non-empty cached file skips re-download (
test -s), andcurl -C -resumes partial files. Preserve this when editingcache-*tasks. - macOS Gatekeeper: keep the
xattr -d com.apple.quarantinestep (guarded, best-effort) after install, or the installed binary won't launch on a fresh copy.
Conventions
- Shell in recipes is POSIX
sh -eu(just default); no bashisms. - Every step prints a
✓/↓status line; keep output greppable and quiet. - Pinned versions (
llamafile_version) are intentional for reproducibility — bump them deliberately, with a note inREADME.mdProvenance. - Do not add runtime behavior to the model (system prompts etc.) unless asked;
.argsstays minimal (-m, optional--mmproj,--no-mmap,...).
Common commands
just --list # task overview
just all # full build + verify
just all include_mmproj=1 # multimodal bundle (+~1 GB)
just verify # check archive entries + installed binary
just clean && just all # from-scratch rebuild
just uninstall # remove installed binary only