llm-offload — local LLM dispatch helpers #

Two binaries that implement anchor’s local-LLM offload path per policy/offload-to-llm v1 (engram topic_key policy/offload-to-llm).

BinaryPurpose
llm-offloadraw helper — routes by category to an Ollama model, validates output, emits telemetry
anchor-offloadpolicy-gated wrapper — applies hard disqualifiers from the policy before calling llm-offload; escalates to a Claude worker on disqualifier hit

Source: /tmp/llm-offload.sh, /tmp/anchor-offload.sh. Installed to ~/.local/bin.

Models routed #

CategoryModel
summarize, classify, extract, naming, commit-msg, translate, rewritegemma3:4b
code, refactor, test-scaffold, comment, explainqwen2.5-coder:7b
reason, plan, designgemma4:26b
embedbge-m3

Available models on this host (from ollama 127.0.0.1:11434): gemma3:4b · qwen2.5-coder:7b · gemma4:26b · gemma4:31b · qwen3-coder:30b · bge-m3 · nomic-embed-text

llm-offload usage #

llm-offload --health
llm-offload <category> <prompt>
llm-offload --json <category> <prompt>      # ollama format=json + temp 0

Exit codes:

Telemetry on stderr:

[offload] model=gemma3:4b category=classify tokens=5 duration_ms=395 validated=true

anchor-offload usage #

anchor-offload <category> <prompt> [--touches f1 f2 ...] [--for <audience>] [--security] [--json]

Hard disqualifiers (escalate, exit 10):

Other escalation paths:

Telemetry: every call appends a JSON line to /tmp/anchor-offload.log:

{"ts":"2026-04-08T02:43:34Z","category":"classify","decision":"offload","reason":"none","duration_ms":476,"exit_code":0}

Examples #

# Plain offload
llm-offload summarize "Reverie is a Rust local-first memory layer."

# Code generation
llm-offload code "write a Rust one-liner that returns the second element of a Vec<String> or empty"

# JSON extract
llm-offload --json extract "Return JSON with field 'crates': reverie-store, reverie-bench"

# Policy-gated (will escalate)
anchor-offload code "implement auth" --touches src/auth/jwt.rs
# stderr: ESCALATE: security path

# Policy-gated (will offload)
anchor-offload classify "this PR adds a new schema field"
# stdout: pr-schema

Hourly telemetry rollup #

A cron job (5 * * * *) runs /tmp/offload-rollup.sh which aggregates /tmp/anchor-offload.log and writes a per-hour summary to engram under metrics/offload/hourly/<hour>.

Ad-hoc inspection: /tmp/offload-stats.sh prints the same rollup to stdout.

Cross-references #

Caveats #