Building a coding agent in Swift from scratch
vanyaland
81 points
18 comments
March 25, 2026
Related Discussions
Found 5 related stories in 52.9ms across 3,471 title embeddings via pgvector HNSW
- I built a programming language using Claude Code GeneralMaximus · 110 pts · March 10, 2026 · 59% similar
- Agents that run while I sleep aray07 · 288 pts · March 10, 2026 · 54% similar
- How I'm Productive with Claude Code neilkakkar · 161 pts · March 23, 2026 · 53% similar
- The Claude Code Source Leak: fake tools, frustration regexes, undercover mode alex000kim · 1057 pts · March 31, 2026 · 51% similar
- AI Team OS – Turn Claude Code into a Self-Managing AI Team cronus1141 · 40 pts · March 21, 2026 · 51% similar
Discussion Highlights (8 comments)
mark_l_watson
I think this is a good learning project, based in a long perusal of the github repo. One suggestion: don’t call the CLI component of the project ‘claude’ - that seems like asking for legal takedown problems.
nhubbard
How practically could we drop in Apple Intelligence once it's using Gemini as its core for a 100% local AI agent in a box?
lm2s
Interesting, I'm also building one in Swift :D Seems like a good learning experience.
bensyverson
I built a Swift library called Operator [0] to run the core agent loop, if it would save anyone time. [0]: https://github.com/bensyverson/Operator
maxbeech
the interesting design tension i ran into building in this space is context management for longer sessions. the model accumulates tool call history that degrades output quality well before you hit the hard context limit - you start seeing "let me check that again" loops and increasingly hedged tool selection.a few things that helped: (1) summarizing completed sub-task outputs into a compact working-memory block that replaces the full tool call history, (2) being aggressive about dropping intermediate file read results once the relevant information has been extracted, and (3) structuring the initial system prompt so the model has a clear mental model of what "done" looks like before it starts exploring.the swift angle is actually a nice fit - the structured concurrency model maps well to the agent loop, and the strong type system makes tool schema definition less error-prone than JSON string wrangling in most other languages.
brumbelow
This is a cool idea. The stage-by-stage build makes the failure modes legible: first the loop, then tool dispatch, then persistence, then subagents/skills/compaction. A nice reminder that most of the magic is in state management and control flow
faangguyindia
I built my agent in python since agent is CLI. I used python+rich, but window resize wrecks UI layout This isn't the issue with nodejs based stuff.
dostick
It’s not quite clear that this project is- there’s no “Claude code” a program. There’s tui/gui app, harness, prompts, and LLM. so this is a harness part?