gemma4-local-deploy

gemma4-local-deploy is a skill for Claude Code, Codex from majiayu000/spellbook. It costs 172 tokens per session (1,778 once invoked), scanned A, original, MIT.

A guide for running Gemma 4 12B, an AI language model, locally on a Mac or Apple Silicon computer. It uses downloaded model files and a local service that provides an OpenAI-compatible API or Ollama access when requested.

In plain words
What is it for?
Installing or upgrading the local runtime, downloading a GGUF model, starting a local model server, checking its health, testing questions, and diagnosing common setup problems.
Why use it?
Setting up a large local model involves choosing a compressed model version, context size, memory use, and service method. This defines deployment profiles and checks that the local service actually works.

Skill for Claude CodeCodex

Written for Claude Code and Codex: allowed-tools in frontmatter, but also agents/openai.yaml present.

Good fit Installing or upgrading the local runtime, downloading a GGUF model, starting a local model server, checking its health, testing questions, and diagnosing common setup problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiayu000/spellbook/gemma4-local-deploy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add majiayu000/spellbook --skill gemma4-local-deploy
Clone the repo
git clone --depth 1 https://github.com/majiayu000/spellbook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gemma4-local-deploy

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiayu000/spellbook/gemma4-local-deploy/github.svg)](https://agentmods.dev/skills/majiayu000/spellbook/gemma4-local-deploy)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/spellbook/gemma4-local-deploy"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/gemma4-local-deploy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gemma4-local-deploy

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiayu000/spellbook/gemma4-local-deploy"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/gemma4-local-deploy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 172 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00172 $0.01778
Opus 5 $0.00086 $0.00889
Sonnet 5 $0.00034 $0.00356
Haiku 4.5 $0.00017 $0.00178

Measured 10d ago against content hash 022825c3434c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

gemma4-local-deploy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gemma4-local-deploy/SKILL.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Gemma 4 12B 本地部署

把 Gemma 4 12B 的 GGUF 版本部署成本机模型服务。默认使用 llama.cpp / llama-server、Apple Metal、Q4_K_Mtmux,只监听 loopback;用户明确要求 QAT、256K、对比演示或 Ollama 时才切换路线。

Operating Contract

  • Direct actions: 读取本机硬件、磁盘、端口、进程和模型缓存;在用户已要求本地部署时,安装或升级明确的软件包、下载选定模型、创建专用模型目录和 tmux 会话,并只绑定 127.0.0.1
  • Escalate before: 停止不属于本 Skill 的现有进程、覆盖已有模型或配置、删除用户数据、监听公网地址、改变防火墙,或下载用户未选择的大型模型变体。
  • Evidence-backed pushback: 如果用户指定的模型标签、上下文、内存预算或本机能力与当前可验证状态冲突,先展示命令输出并提出可运行的 profile,不伪造支持状态。
  • Feedback loop: 现状检查 → 选择并复述 profile → 执行一条部署路线 → 当前会话完成健康、模型和聊天验证 → 报告端点、资源与限制。

默认选择

  • 默认模型仓库:ggml-org/gemma-4-12B-it-GGUF
  • 默认量化:Q4_K_M
  • 默认模型名:gemma-4-12b-it
  • 默认端点:http://127.0.0.1:8080
  • 默认上下文:32768
  • 12B 长上下文:用户明确要求时选择 65536131072
  • QAT 仓库:google/gemma-4-12B-it-qat-q4_0-gguf
  • QAT profile:Q4_0262144 上下文
  • 默认后台会话:gemma4-12b
  • 默认关闭 thinking:--reasoning off,避免 OpenAI API 的 message.content 为空
  • Ollama:只在用户明确要求 Ollama 或需要 Ollama 生态时使用

QAT 是训练时模拟量化,不等于无损。关键任务仍要用当前会话的真实响应验证。用户明确要更高质量时,优先建议 Q6_KQ8_0;除非用户接受更高内存和更慢加载,不默认使用 bf16

Profile 选择

Profile 适用场景 Model / quant Context Port / alias
daily-q4km-32k 默认日常聊天、编码、低风险本地 API ggml-org/...:Q4_K_M 32768 8080 / gemma-4-12b-it
long-q4km-128k 明确需要更长上下文,但保留默认 GGUF 路线 ggml-org/...:Q4_K_M 65536131072 8080 / gemma-4-12b-it
qat-q4_0-256k 明确要求 QAT、Q4_0、256K 或低内存长上下文 google/...qat-q4_0-gguf:Q4_0 262144 8080 / gemma-4-12b-it-qat-q4_0
compare-32k-vs-256k 录屏、演示或 A/B 比较资源与速度 Q4_K_M,右 QAT Q4_0 32768 + 262144 8080 + 8081

最终回复必须说明选定 profile、端口、上下文和选择依据。不要把 256K 当作日常默认值。

执行流程

1. 搜索并确认现状

先检查已有安装、进程、端口、缓存、硬件和磁盘,避免重复部署:

command -v llama-server || true
llama-server --version || true
tmux has-session -t gemma4-12b 2>/dev/null && tmux display-message -p -t gemma4-12b '#S #{pane_pid}' || true
lsof -nP -iTCP:8080 -sTCP:LISTEN || true
ls -lh "$HOME/Library/Caches/llama.cpp/"*gemma-4-12B-it*Q4_K_M*.gguf 2>/dev/null || true
find "$HOME/Library/Caches/llama.cpp" "$HOME/Models" \( -name '*gemma-4-12b-it-qat-q4_0*.gguf' -o -name '*gemma-4-12B-it-qat-q4_0*.gguf' \) 2>/dev/null || true
system_profiler SPHardwareDataType | sed -n '1,30p'
df -h "$HOME"

Read the full file on GitHub · 98 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 98 lines · 172 tokens per session scan A 022825c3434c

Subscribe to this mod's changes

gemma4-local-deploy is a skill published in the GitHub repository majiayu000/spellbook (277 stars, last pushed 2d ago), licensed MIT. It adds 172 tokens to every session and 1,778 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pneuma-session

Instructions for renaming an active Pneuma session and replacing its default preview with a useful title and summary. A Pneuma session is one work area inside a larger project.

pandazki/pneuma-skills · 127 tokens

feishu-openapi-skill

Operate Feishu or Lark IM APIs through UXC with a curated OpenAPI schema, tenant-token bearer auth, and chat/message guardrails.

holon-run/uxc · 36 tokens

slack-openapi-skill

Operate Slack Web API through UXC with a curated OpenAPI schema, bearer-token auth, and messaging-core guardrails.

holon-run/uxc · 31 tokens

spring-shell

Spring Shell for building interactive CLI applications. Covers @ShellComponent, @ShellMethod, input validation, tables, and command groups. USE WHEN: user mentions "spring shell", "@ShellComponent", "@ShellMethod", "CLI application Spring", "interactive shell", "command line tool Spring" DO NOT USE FOR: simple scripts…

claude-dev-suite/claude-dev-suite · 96 tokens

huggingface-community-evals

Run evaluations for Hugging Face Hub models using inspect-ai and lighteval on local hardware. Use for backend selection, local GPU evals, and choosing between vLLM / Transformers / accelerate. Not for HF Jobs orchestration, model-card PRs, .evalresults publication, or community-evals automation.

waybarrios/opencode-power-pack · 71 tokens

session-handoff

Use when the user wants to hand off, transfer, pause, or continue the current session in a new session or with another agent — asks for a "session handoff", a "prompt para a próxima sessão", to "continuar de onde paramos", or invokes /session-handoff; also when context is running low and in-flight work must survive a…

will-pagane/claude-superdev-harness · 91 tokens