fm plugin for Claude Code
Use Apple's on-device Foundation Model from inside Claude Code, through the fm command-line tool that ships with macOS 27.
Everything runs locally on your Mac: no API key, no account, no network, no usage fees. Use it for a private second-opinion code review, summaries of long files or diffs, commit message drafts, and quick questions.
Unofficial. This project is not affiliated with, endorsed by, or supported by Apple. "Apple" and "Apple Intelligence" are trademarks of Apple Inc. Use of the fm CLI is governed by Apple's terms, which you accept yourself with fm license.
Requirements
- macOS 27 or later on Apple silicon, with Apple Intelligence enabled
- The
fm CLI (/usr/bin/fm, included with macOS 27), with its license accepted: run fm license once in a terminal
python3 3.9 or later. /usr/bin/python3 from the Xcode Command Line Tools works; the plugin uses only the standard library.
- Claude Code
Install
In Claude Code:
/plugin marketplace add tasict/fm-plugin-cc
/plugin install fm@fm-plugin-cc
/reload-plugins
/fm:setup
/fm:setup checks the macOS version, the fm binary, the license status, and model availability, and tells you what to fix.
Commands
| Command | What it does |
|---|
/fm:review [--scope auto|working-tree|staged|branch] [--base <ref>] [--focus <text>] [--background] | On-device review of your local git changes. Returns findings with file and line. |
/fm:summarize [--diff|--staged|--base <ref>] [--focus <text>] [path ...] | Summarizes files or a diff. Large inputs are summarized in parts and merged. |
/fm:commit-msg [--all] | Drafts a commit message for the staged changes in the style of your recent commits. It never commits. |
/fm:ask [--file <path>]... [--system <text>] <prompt> | One-shot question, optionally about a few small files |
/fm:status [job], /fm:result [job], /fm:cancel [job] | Inspect and control review and summary jobs |
/fm:setup [--enable-review-gate|--disable-review-gate] | Checks the environment and toggles the review gate |
Examples:
/fm:review
/fm:review --base main --focus "error handling"
/fm:summarize --diff
/fm:summarize logs/build.log --focus "why did it fail"
/fm:ask --file src/parser.py What inputs make parse_header return None?
Review gate (optional)
/fm:setup --enable-review-gate turns on a Stop hook. After a Claude turn that changed the working tree, it runs a short on-device review (at most 3 chunks) and shows a one-line summary with the top findings. The full report is available through /fm:result. It is advisory only. It never blocks Claude, and it runs again only when the diff has changed. Disable it with /fm:setup --disable-review-gate.
What to expect from the model
The on-device model is small and general-purpose. The plugin is designed around its limits:
- About 8K-token context, shared by input and output. Reviews and summaries are split into chunks of about 4–5K tokens and merged.
ask refuses prompts that are too large instead of silently truncating them.
- Findings are unverified. Expect false positives and line numbers that are off by a line or two. Every review is labeled as an unverified second opinion. Line numbers that don't match a changed line are dropped rather than guessed. An empty review is weak evidence that the change is correct.
- No tool use. The model can't read your repo or run commands. The plugin sends it exactly the content it should see. For that reason there is no "rescue" agent that edits code.
- Guardrails. Apple's guardrails occasionally decline benign content. Those files are listed under "Not reviewed" rather than silently skipped.
Treat it as a fast, private first pass, not a replacement for Claude's own review.
How it works
Every slash command is a thin prompt that runs plugins/fm/scripts/fm_companion.py, a Python 3.9 stdlib-only script that drives fm respond --no-stream:
- Reviews annotate each diff line with its new-file line number, label files as
File N: path, and request structured JSON (fm respond --schema). The model reports files by number. Asking it to write path strings in structured output can stall generation.
- Retries. Sampled decoding with a reasoning field finds the most bugs but sometimes stalls. Each chunk gets two short sampled attempts, then a greedy attempt.
- Oversized chunks. A chunk that overflows the context is split in half and retried.
- Job records. Reviews and summaries are recorded as jobs under
${XDG_STATE_HOME:-~/.local/state}/fm-plugin-cc/, so /fm:status, /fm:result, and /fm:cancel work for background runs.
Environment overrides: FM_PLUGIN_FM_BIN (path to the fm binary) and FM_PLUGIN_STATE_DIR (state directory).
Development