Skip to content

dkyazzentwatwa/apple-code

Repository files navigation

apple-code

apple-code banner

Local-first coding shell for Apple Foundation Models and Ollama.

CI Swift 6.2 macOS 26+ License: MIT

apple-code screenshot 1 apple-code screenshot 2

apple-code is a Swift CLI assistant for local coding workflows on macOS. It runs on-device with Apple Foundation Models by default, and can switch to local Ollama models (including Qwen variants) with no cloud API dependency.

Highlights

  • Local providers only: apple and ollama
  • Fast settings menu in REPL: /settings or Ctrl+P
  • Dynamic local Ollama model picker using ollama list
  • Tool-calling support for filesystem, shell, web, browser, PDF, and Apple apps
  • Session persistence, transcript history, and quick session switching
  • Two UI modes (classic, framed) and multiple built-in themes

Requirements

  • macOS 26+ (Tahoe) on Apple Silicon
  • Xcode 26+ command line tools
  • Swift toolchain with FoundationModels support
  • Ollama installed locally for --provider ollama

Install

Recommended

./scripts/install.sh

Then:

export PATH="$HOME/.local/bin:$PATH"
apple-code

Installer options:

./scripts/install.sh --help

Run from Source

swift run apple-code
swift run apple-code "summarize this repo"

Quick Start

# REPL
apple-code

# One-shot
apple-code "summarize this repo"

# Specific project directory
apple-code --cwd ~/projects/myapp

Providers

Apple Foundation Models (default)

apple-code --provider apple

Ollama (local)

export OLLAMA_BASE_URL="http://127.0.0.1:11434"
export OLLAMA_MODEL="qwen3.5:4b"

apple-code --provider ollama --model qwen3.5:4b

If a model is missing:

ollama pull qwen3.5:4b

In REPL, /settings can prompt and run pulls for you.

CLI Options

apple-code [options] ["prompt"]

--system "..."          Custom system instructions
--cwd /path/to/dir      Working directory for file/command tools
--provider <name>       Model provider: apple | ollama
--model <id>            Model ID (ollama)
--base-url <url>        Base URL for ollama (default: http://127.0.0.1:11434)
--ui <mode>             UI mode: classic | framed
--timeout N             Max seconds (default: 120)
--no-apple-tools        Disable Apple app tools (Notes, Mail, etc.)
--check-apple-tools     Run Apple app diagnostics and exit
--no-web-tools          Disable dedicated web search/fetch tools
--no-browser-tools      Disable browser automation tools
--run-web-fetch <url>   Run webFetch tool directly and exit
--run-web-search "q"    Run webSearch tool directly and exit
--run-web-limit N       Result count for --run-web-search (default: 5)
--run-notes-action a    Run notes tool directly and exit
--run-notes-query q     Query/title for --run-notes-action
--run-notes-body b      Body text for --run-notes-action
--security-profile p    Security profile: secure | balanced | compatibility
--allow-path /path      Additional allowed filesystem root (repeatable)
--allow-host host       Allowed web host/domain (repeatable)
--allow-private-network Allow localhost/private network URLs
--dangerous-without-confirm Allow dangerous mutating actions without extra gate
--allow-fallback-execution  Allow automatic refusal fallback tool execution
--verbose               Show full output (disable summary mode)
-i, --interactive       Force interactive mode
--resume <session-id>   Resume a session
--new                   Start a new session
-h, --help              Show help

REPL Commands

Core:

  • /new, /n
  • /sessions, /s
  • /resume <id>
  • /delete <id>
  • /history [n]
  • /show <id>
  • /quit, /q

Settings and model control:

  • /settings
  • /model, /m
  • /ui [classic|framed]
  • /theme <wow|minimal|classic|solar|ocean|forest>
  • /session <id|next|prev>

Utility:

  • /cd <path>
  • /clear, /c
  • /help, /h

Compatibility:

  • :commands are still supported

Hotkeys:

  • Ctrl+P open settings
  • Esc (Ctrl+[) previous session chip
  • Ctrl+] next session chip
  • Arrow keys for inline editing/history
  • Ctrl+J insert newline in input

Built-in Tools

Category Tools
Filesystem readFile, writeFile, listDirectory, searchFiles, searchContent, createPDF
Shell runCommand
Apple apps notes, mail, calendar, reminders, messages
Web webSearch, webFetch
Browser automation agentBrowser

Troubleshooting

Check installed binary:

which apple-code
apple-code --help

Validate Apple app integrations:

apple-code --check-apple-tools

Validate Ollama:

ollama list
curl http://127.0.0.1:11434/api/tags

If --provider ollama fails:

  • Confirm Ollama is running locally
  • Verify model exists with ollama list
  • Set OLLAMA_BASE_URL if using a non-default host/port

Development

swift build
swift build -c release
swift test
./scripts/coverage.sh

./scripts/coverage.sh enforces an 80% line-coverage gate on the unit-testable core modules and also prints full-project coverage for visibility.

License

Released under the MIT License. See LICENSE.

About

Apple Intelligence CLI

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors