How I built a multi-agent simulator as a native SwiftUI app
说明与用途
Sorcerer 是一款免费的 macOS 应用,使用现有 CLI 工具和纯函数模拟 AI 角色互动,无需 API 密钥。
问题
Develop a free, open‑source macOS app that simulates a community of AI characters reacting to user‑defined hypotheses without requiring API keys.
结果
Sorcerer enables rapid, key‑free simulation of AI communities, with testable logic and live streaming feedback.
工作流
- 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
证据
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."
- 记录日期: 2026-10-19T18:41:40.780Z