afm is a command-line interface for interacting with Apple's system-level Foundation Models (Apple Intelligence). It provides both an interactive REPL and a one-shot mode for piping text through local LLMs on macOS.
- Interactive REPL: A full-featured terminal interface with syntax-highlighted streaming output.
- One-Shot Mode: Send a single prompt via arguments or pipe content through standard input.
- Session History: Persistent session storage allows you to list and resume previous conversations.
- Local & Private: Leverages macOS
FoundationModels(Apple Intelligence), keeping your data on-device. - System Integration: Optional tool support (provided by the system model) for tasks like calendar access, mail, etc. (depending on model capabilities).
- macOS 15.1+ (with Apple Intelligence support): This tool requires the
FoundationModelsframework and a device compatible with Apple Intelligence (Apple Silicon Mac). - Swift 6.0+: To build from source.
./install.shEnsure that ~/.local/bin is in your PATH.
Start a new conversation:
afmafm -p "What is the best way to cook an egg?"echo "Summarize this: $(cat README.md)" | afm
afm -p "What does this code do?" < Sources/afm/main.swiftList recent matches:
afm --list-sessionsResume the most recent session:
afm --resumeResume a specific session:
afm --resume <session-id>-p, --prompt <string>: Run in one-shot mode with the given prompt.--resume [id]: Resume a session (defaults to most recent).--list-sessions: Show a table of saved sessions.--no-save: Run without persisting the session to history.--config <path>: Use a custom JSON configuration file.--version: Show version information.-h, --help: Show usage help.
afm looks for a configuration file at ~/.config/afm/config.json by default.
Example config.json:
{
"systemPrompt": "You are a helpful coding assistant.",
"saveSessions": true,
"sessionsDir": "~/.local/share/afm/sessions"
}MIT