apfel: Agent for Claude Code

.claude/agents/fable5-apfel-engineer.md

fable5-apfel-engineer is an agent for Claude Code from Arthur-Ficial/apfel. It costs 130 tokens per session (1,422 once invoked), scanned A, original, MIT.

A software engineer specialized in the apfel project, which runs Apple's on-device language model through a command-line tool, an OpenAI-compatible server, and a Swift library.

In plain words
What is it for?
Use it to investigate issues, implement or review fixes, and test apfel's command-line interface, HTTP endpoints, tool calling, response formats, or Swift code.
Why use it?
It provides focused help for substantial apfel engineering work, where command-line behavior, server compatibility, Swift concurrency, and token handling must remain correct.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions subagents.

This is Arthur-Ficial/apfel's own configuration. It tells Claude Code how to work on apfel itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything apfel configures →

About the project

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.

Arthur-Ficial/apfel · 6,359 stars · on GitHub · apfel.franzai.com

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/Arthur-Ficial/apfel/main/.claude/agents/fable5-apfel-engineer.md
Clone the repo
git clone --depth 1 https://github.com/Arthur-Ficial/apfel

Made for: Claude Code.

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 fable5-apfel-engineer

README.md
[![agentmods](https://agentmods.dev/badge/agents/arthur-ficial/apfel/fable5-apfel-engineer/github.svg)](https://agentmods.dev/agents/arthur-ficial/apfel/fable5-apfel-engineer)
Your own site
<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.

agentmods 80×15 button for fable5-apfel-engineer

Your own site · 80×15
<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>
Per session 130 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,422 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.
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.00130 $0.01422
Opus 5 $0.00065 $0.00711
Sonnet 5 $0.00026 $0.00284
Haiku 4.5 $0.00013 $0.00142

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

Security

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.

.claude/agents/fable5-apfel-engineer.md · 72 lines

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.

  1. UNIX toolapfel "prompt", echo text | apfel, apfel --stream. Pipe-friendly, correct exit codes, -o json.
  2. OpenAI-compatible HTTP serverapfel --serve on 127.0.0.1:11434: /v1/chat/completions (stream + non-stream), /v1/models, /health, tool calling, response_format, honest 501s.
  3. (byproduct) Interactive TUI chatapfel --chat. A quick-test convenience, never the pitch.
  4. (byproduct) Swift libraryimport 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 PrivateCloudComputeLanguageModel cloud path is deliberately NOT used.)
  • Context window is dynamic — never hardcode it. Read SystemLanguageModel.contextSize at runtime via TokenCounter (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 inside actor 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:), so ToolCallError is unreachable (see #119). Dead branches are a permanent public-API liability.

Read the full file on GitHub · 72 lines

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. 9d ago First seen · 72 lines · 130 tokens per session scan A c9f5211e0f28

Subscribe to this mod's changes

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.

Related

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.

echoVic/blade-code · 51 tokens

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.

affaan-m/ECC · 48 tokens

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.

bug-ops/zeph · 41 tokens

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.

bug-ops/zeph · 53 tokens

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.

bug-ops/zeph · 60 tokens

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…

bug-ops/zeph · 109 tokens