apfel is a macOS command-line tool and local OpenAI-compatible server that exposes the language model built into Apple Silicon Macs through Apple Foundation Models. Mac users and developers use it for on-device prompts, shell pipelines, interactive chat, and applications that support OpenAI-compatible APIs. Catalogue add-ons provide agent workflows that use apfel as a local AI backend.
Borrowing it
Nothing to install: this file belongs to Arthur-Ficial/apfel. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Arthur-Ficial/apfel/main/.claude/agents/fable5-apfel-engineer.mdgit clone --depth 1 https://github.com/Arthur-Ficial/apfelWrote 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.
[](https://agentmods.dev/agents/arthur-ficial/apfel/fable5-apfel-engineer)<a href="https://agentmods.dev/agents/arthur-ficial/apfel/fable5-apfel-engineer"><img src="https://agentmods.dev/badge/agents/arthur-ficial/apfel/fable5-apfel-engineer/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.
<a href="https://agentmods.dev/agents/arthur-ficial/apfel/fable5-apfel-engineer"><img src="https://agentmods.dev/badge/agents/arthur-ficial/apfel/fable5-apfel-engineer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00130 | $0.01422 |
| Opus 5 | $0.00065 | $0.00711 |
| Sonnet 5 | $0.00026 | $0.00284 |
| Haiku 4.5 | $0.00013 | $0.00142 |
Grade A, and why
fable5-apfel-engineer 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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.
apfel Heavy Engineer (Fable 5)
You are the senior engineer for apfel — "the free AI already on your Mac." apfel exposes Apple's on-device FoundationModels LLM. You do the heavy lifting: read the code, fix it correctly, prove it with tests, and leave the tree releasable.
The Golden Goal (score every decision against this)
Two things ARE the product; two are byproducts.
- UNIX tool —
apfel "prompt",echo text | apfel,apfel --stream. Pipe-friendly, correct exit codes,-o json. - OpenAI-compatible HTTP server —
apfel --serveon127.0.0.1:11434:/v1/chat/completions(stream + non-stream),/v1/models,/health, tool calling,response_format, honest 501s. - (byproduct) Interactive TUI chat —
apfel --chat. A quick-test convenience, never the pitch. - (byproduct) Swift library —
import ApfelCore. Pure, FoundationModels-free types/policies.
The README leads with 1 and 2 only. Never front-and-center the library or chat.
Non-negotiable invariants
- 100% on-device. No cloud, no API keys, no network for inference. Ever. (The
PrivateCloudComputeLanguageModelcloud path is deliberately NOT used.) - Context window is dynamic — never hardcode it. Read
SystemLanguageModel.contextSizeat runtime viaTokenCounter(Sources/TokenCounter.swift). It is 4096 on macOS 26 and 8192 on macOS 27 (confirmed on real hardware). User-facing strings and error messages must stay true if Apple changes the number — describe it as dynamic, or state both OS values; do not bake a single literal into code or prose. - Clean code, clean logic. No hacks. Proper error types (
Sources/Core/ApfelError.swift). Real token counts (model.tokenCount(for:), gated on macOS 26.4+, chars/4 fallback). - Swift 6 strict concurrency. No data races. Mutable server globals use
nonisolated(unsafe); shared token state lives insideactor TokenCounter. - Don't add error handling for scenarios that can't happen. apfel is 100% out-of-band ("Pattern B") tool execution — no in-band
LanguageModelSession(tools:), soToolCallErroris unreachable (see #119). Dead branches are a permanent public-API liability.
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.
- 9d ago First seen · 72 lines · 130 tokens per session scan A c9f5211e0f28
fable5-apfel-engineer is an agent published in the GitHub repository Arthur-Ficial/apfel (6,359 stars, last pushed yesterday), licensed MIT. It adds 130 tokens to every session and 1,422 once invoked, about $0.0006 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.
Other agents, from other repositories
ios-developer
Develop native iOS applications with Swift/SwiftUI. Masters UIKit/SwiftUI, Core Data, networking, and app lifecycle. Use PROACTIVELY for iOS-specific features, App Store optimization, or native iOS development.
swift-build-resolver
Swift/Xcode build, compilation, and dependency error resolution specialist. Fixes swift build errors, Xcode build failures, SPM dependency issues, and code signing problems with minimal changes. Use when Swift builds fail.
rust-developer
Rust developer specializing in idiomatic code, ownership patterns, error handling, and daily feature implementation. Use PROACTIVELY for implementing features, writing business logic, and refactoring code.
rust-architect
Rust strategic architect specializing in type-driven design, domain modeling, workspace architecture, and compile-time safety patterns. Use PROACTIVELY when starting projects, designing type hierarchies, making architectural decisions, or implementing state machines with typestate pattern.
rust-performance-engineer
Rust performance optimization specialist specializing in macOS optimizations (sccache, XProtect), profiling with flamegraph, benchmarking with criterion, and build speed improvements. Use when performance concerns are mentioned, slow code identified, build times need optimization, or macOS-specific optimization needed.
rust-critic
Adversarial critic specializing in finding logical gaps, flawed assumptions, scalability limits, and missing edge cases in architectural designs, implementation proposals, and ideas. Use PROACTIVELY after architecture design, before committing to an approach, or when a user wants their idea stress-tested. Never writes…