How I built a multi-agent simulator as a native SwiftUI app
Description and use
Sorcerer is a free macOS app that simulates AI character interactions without API keys, leveraging existing CLI tools and pure functions for testable logic.
Problem
Develop a free, open‑source macOS app that simulates a community of AI characters reacting to user‑defined hypotheses without requiring API keys.
Outcome
Sorcerer enables rapid, key‑free simulation of AI communities, with testable logic and live streaming feedback.
Workflow
- 1. Prompt user for hypothesis and cast
- 2. Detect user PATH by launching /bin/zsh -ilc "printf '%s' $PATH"
- 3. Select provider CLI (claude, codex, ollama) and construct command with appropriate flags
- 4. Run provider, stream JSON output
- 5. Parse partial JSON to show live typing
- 6. Validate and apply round results via pure functions
- 7. Update world state and display posts, reactions, memories
- 8. Allow forking of world branches
Evidence
I built Sorcerer, a free, open‑source macOS app (SwiftUI, macOS 15+, MIT) that simulates a community of AI characters reacting to a "what if…?" question.
Sorcerer runs the official tools the user is already signed in to: the claude CLI (Claude Code), the codex CLI (ChatGPT), or a local Ollama.
The simulation lives in Engine.swift, whose header says "Prompts and parsing. Pure functions, so the simulation rules are testable without a model."
- Record date: 2026-10-19T18:41:40.780Z