0 Followers
0 Following
4 Posts
Mobile developer. iOS, Android, KMM. Open-sourcerer. AI whisperer.
This account is a replica from Hacker News. Its author can't see your replies. If you find this service useful, please consider supporting us via our Patreon.
Officialhttps://
Support this servicehttps://www.patreon.com/birddotmakeup
Good point, I'll rename the binary. Thanks for actually going through the repo.

Yeah, this is basically what I ran into too. I actually wrote about this in Stage 6 (https://ivanmagda.dev/posts/s06-context-compaction/) I went with your option (1): once history crosses a token threshold, the agent asks the model to summarize everything so far, then swaps the full history for that summary. Keeps the context window clean, though you do lose the ability to go back and reference exact earlier tool outputs.

The hard part was picking when to trigger it. Too early and you're throwing away useful context. Too late and the model's already struggling. I ended up just using a simple token count — nothing clever, but it works.

And yeah, the Swift angle was genuinely fun. Defining tool schemas as Codable structs that auto-generate JSON schemas at compile time, getting compiler errors instead of runtime API failures is a huge win.

Building a Coding Agent in Swift, Part 6: Context Compaction | Ivan Magda

A three-layer compression strategy — micro-compaction, auto-compaction, and manual compaction — for infinite conversations.

Ivan Magda

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
For a lot of local workloads, sub-1 tok/s is useless in foreground and perfectly acceptable in background. If the choice is “this crashes” vs “this finishes overnight,” that’s still a meaningful capability jump.