Skip to content

ehamiter/afm

Repository files navigation

afm (Apple Foundation Models CLI)

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.

Features

  • 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).

Requirements

  • macOS 15.1+ (with Apple Intelligence support): This tool requires the FoundationModels framework and a device compatible with Apple Intelligence (Apple Silicon Mac).
  • Swift 6.0+: To build from source.

Installation

./install.sh

Ensure that ~/.local/bin is in your PATH.

Usage

Interactive Mode

Start a new conversation:

afm

One-Shot Prompts

afm -p "What is the best way to cook an egg?"

Piping and Redirection

echo "Summarize this: $(cat README.md)" | afm
afm -p "What does this code do?" < Sources/afm/main.swift

Session Management

List recent matches:

afm --list-sessions

Resume the most recent session:

afm --resume

Resume a specific session:

afm --resume <session-id>

Options

  • -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.

Configuration

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"
}

License

MIT

About

command-line interface for interacting with Apple's system-level Foundation Models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages