Building a coding agent in Swift from scratch

https://github.com/ivan-magda/swift-claude-code

GitHub - ivan-magda/swift-claude-code: A Swift reimplementation of a Claude Code-style coding agent, built stage by stage to explore what makes coding agents work

A Swift reimplementation of a Claude Code-style coding agent, built stage by stage to explore what makes coding agents work - ivan-magda/swift-claude-code

GitHub
The stage-by-stage approach is really smart. Context management is the hardest part of building agents that do anything non-trivial. The compaction stage especially — deciding what to keep and what to discard as the context window fills up is where most agent architectures break down silently. You don't notice until the agent starts making subtly wrong decisions because it forgot something from 50 tool calls ago. Swift's type system enforcing tool schemas at compile time is a genuinely nice advantage over the JSON-schema-at-runtime approach most Python agent frameworks use.