Swift reimplementation of the TypeScript-based pi-mono project, built with a strict parity-first migration strategy.
This repository aims to recreate the core functionality of pi-mono in Swift while preserving behavior and avoiding regressions.
Key goals:
- Feature parity with
../pi-mono - Regression-safe migration through tests
- Incremental delivery by phases
- Documentation-driven implementation (PRD, architecture, plan)
- Behavior parity over line-by-line translation
- Test-first implementation for each task
- Update task status only after tests + build + docs are complete
- Keep module docs in sync with code changes
- Use atomic commits (one coherent change per commit)
- Pick one unfinished task from
docs/PLAN.md - Read the corresponding
pi-monosource/tests - Write tests (or parity fixtures) first
- Implement in Swift
- Run tests and compile checks
- Update docs
- Only then mark the task as done
- PRD:
docs/PRD.md - Architecture:
docs/ARCHITECTURE.md - Execution Plan:
docs/PLAN.md - Project rules:
AGENTS.md
The migration is planned in dependency order:
pi-aipi-agent-corepi-tuipi-coding-agent- Peripheral modules (
mom,pods,web-ui)
Project bootstrapping/planning docs are in place, and P1 groundwork is underway:
P1-1SwiftPM/module skeleton: implemented and verifiedP1-2shared test infrastructure (fixtures/goldens): implemented and verifiedP1-3cross-module foundational core types: implemented and verified
P2 has started:
P2-1pi-aifoundational model registry: implemented and verifiedP2-2pi-aiunified context/message/event types: implemented and verifiedP2-3pi-aiutility foundations (SSE parsing, JSON parsing, validation, overflow detection): implemented and verifiedP2-4first provider adapter (OpenAI Responses, mock-driven event processor): implemented and verifiedP2-5Anthropic adapter (mock-driven thinking/text/tool mapping + OAuth tool-name normalization regression tests): implemented and verifiedP2-6Google/Vertex family adapter core (mock-driven Google stream mapping + thinking signature / empty-stream / missing-args regression tests): implemented and verifiedP2-7OAuth and provider credential helpers (registry, expiry-aware refresh, API key injection): implemented and verifiedP2-8pi-airegression/coverage push: implemented and verified (docs/reports/pi-ai-coverage.md)
P3 has started:
P3-1pi-agent-corestate/message/event foundational types: implemented and verifiedP3-2pi-agent-coresingle-turn agent loop (streamed assistant event -> agent event sequence): implemented and verifiedP3-3pi-agent-coremulti-turn tool execution loop (tool-call execution, tool-result injection, next-turn replay): implemented and verifiedP3-4pi-agent-coreruntime controls (continue/retry entrypoint, steering/follow-up loops, abort controller, request-options plumbing): implemented and verifiedP3-5pi-agent-coreregression test completion + coverage report: implemented and verified (/Users/anyuan/Development/pi-swift/docs/reports/pi-agent-core-coverage.md)
Next step: P6-2 (pi-mom Slack bot migration) in /Users/anyuan/Development/pi-swift/docs/PLAN.md.