General •

How are AI coding agents built in Go?

I've been writing Go for a few years and recently got interested in how AI coding agents work behind the scenes. I understand the basic idea of sending prompts to a model, but I'm curious about everything that happens around that, like reading project files, running commands, keeping track of a conversation, and deciding when to ask for permission. Most of the examples I've found are either tiny demos that only make API calls or large projects written in TypeScript. I'd like to study some actual Go code rather than build everything from scratch just to understand the architecture. Has anyone come across an open source coding agent written in Go that's worth exploring?

1
2
100%
Login to join the Conversation

Crush would give you plenty to read, though it'd be interesting to compare it with another Go agent. Once you've seen how two projects handle the same job, you've got more to go on when you're questioning why the authors made certain choices. You can check out Gopher Code here https://github.com/projectbarks/gopher-code . It's an independent project whose author tried to recreate Claude Code in Go. It's archived and unfinished, but the main agent loop is there to explore.

1
Reply

The permission handling is the bit I'd be curious about too. You tell an agent no, and it still has to work out how to continue the task, which a quick API demo won't show you. I'd suggest Crush from Charm. It's written in Go, and you can dig into the session handling and tool approvals in its source.

1
Reply
General

Dock for diverse discussions and topics.