Skip to content

Use macOS 27's fm CLI as a free local LLM for housekeeping - #368

Merged
currentbits merged 6 commits into
mainfrom
coder/use-macos-27-s-fm-cli-as-a-free-local-ll-78ef98
Aug 17, 2026
Merged

currentbits merged 6 commits into
mainfrom
coder/use-macos-27-s-fm-cli-as-a-free-local-ll-78ef98

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #340.

macOS 27's fm CLI gives on-device / Private Cloud Compute inference from the shell with no key, no account and no bill. This wires it in as the preferred backend for housekeeping prompts, falling back to what we do today whenever it is not there.

The seam

electron/fm.js — fmAvailable(env) and fmRun(prompt, { env, timeoutMs }). fmRun returns trimmed stdout, or null off-Mac, pre-macOS-27, on timeout, on non-zero exit and on empty output. It never throws and never rejects, so every caller keeps its existing path unchanged.

Deliberately not a providers.js entry: fm has no tool loop and no resumable session, so listing it there would surface it in the model picker as an agent it is not. It borrows providers.isBinAvailable so PATH/which resolution matches every other CLI we spawn.

Consumers

Commit messages (electron/commitmsg.js) — the only housekeeping call that was already billing a cloud CLI. fm is tried before the provider is resolved, so a Mac with no billed CLI installed now gets a subject instead of "<provider> CLI is not installed". Every existing error message survives, just reached later on the fallback path.

Thread titles (electron/fm-title.js, hooked into afterSuccessfulTurn in runner.js) — fire-and-forget, so it never blocks checkpoint or verify. Replaces the "New Thread" / first-prompt-line stamp with a short generated title, once per thread, and never overwrites a title the user set. Reuses cleanSubject and THREAD_TITLE_MAX rather than reinventing them. The run-once marker is written only when a title actually lands, so a machine without fm today is not permanently opted out after the macOS 27 upgrade.

Verification

1025 pass / 1 fail on the electron suite; the failure is the known web-integration reconnect baseline, present on main. npm run typecheck clean.

Known gap

buildFmArgs could not be run against the real binary — this machine is macOS 26.5.2 and fm ships in September. The guess (prompt positional, last, matching the convention every provider follows) is isolated to that one function, with CODER_FM_ARGS to prepend flags so a wrong guess is an env var rather than a release. #366 tracks verifying it, including whether fm's offline path prints an error string our first-line-only callers would happily commit as a subject.

Scope

Of the five targets in #340, only commit messages were an existing billed call. Notification batching and kanban triage do no LLM work today, and memory consolidation (#301) has no code yet — those would be net-new features, so they are left alone and the seam will be waiting.

🤖 Generated with Claude Code

Willem and others added 6 commits August 17, 2026 20:27
electron/fm.js wraps macOS 27's fm CLI as a best-effort, never-throwing
one-shot prompt runner. Not a providers.js entry: fm has no tool loop and no
resumable session, so listing it there would surface it in the model picker as
an agent it is not.

Returns null off-Mac, pre-macOS-27, on timeout and on non-zero exit so every
caller keeps its existing fallback path.

Co-Authored-By: Claude Opus 5 <[email protected]>
suggestCommitMessage now runs the housekeeping prompt through fmRun
before spawning the thread's billed provider CLI. A usable fm subject
is cleaned and returned with no provider spawn; any fm miss, timeout,
or non-zero exit is invisible and the existing print-mode path is
unchanged. Provider-path tests pin CODER_FM_DISABLE=1 so a real fm
cannot hijack them.
fm needs no CLI, no key and no account, so a thread whose provider binary is
missing or has no print mode should still get a free subject rather than
"CLI is not installed". Provider resolution now happens only on the fallback
path; every existing error message survives, just reached later.

The not-installed test gets CODER_FM_DISABLE=1 — without it a real macOS 27
fm would answer and leave nothing to reject.

Co-Authored-By: Claude Opus 5 <[email protected]>
After the first completed assistant reply, ask the on-device fm CLI for a
short title when the thread still has the default or first-prompt-line
stamp. Reuses cleanSubject; never overwrites a user-set title; degrades
to a no-op when fm is missing.
…into coder/use-macos-27-s-fm-cli-as-a-free-local-ll-78ef98
maybeApplyFmTitle stamped fmTitleAt on the failure path, so the first
successful turn on any pre-macOS-27 or non-Mac machine permanently opted the
thread out — every existing thread would stay untitled after an OS upgrade,
and every thread paid a store write for a feature that did nothing.

The marker is now written only when a title is actually applied. Retrying
costs one uncached `which` miss per successful turn.

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 3a88763 into main Aug 17, 2026
1 check failed
@currentbits
currentbits deleted the coder/use-macos-27-s-fm-cli-as-a-free-local-ll-78ef98 branch October 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use macOS 27's fm CLI as a free local LLM for housekeeping

1 participant