Rebuild It to Understand It: From Network Protocols to LLM Agents A developer recounts how rebuilding systems from scratch—TCP, DNS, Modbus, and now LLM agents—transforms understanding from user to engineer. A colleague wrote a small agent in Go and finally grasped tooling and the context window, proving that rebuilding demystifies any system. TL;DR: you only truly understand a system once you rebuild it. I recoded TCP at school, then the DNS protocol, then Modbus, each time to understand it from the inside. A colleague just went through this with LLMs. He wrote a small agent in Go, and he finally understood tooling and the context window. An LLM is just one more system to demystify. Rebuild a tiny version, and you move from user to engineer. For developers who want to master LLMs, not just use them. This week, I am helping a colleague level up on LLMs. I explain the concepts. Context, tokens, tools. A token is a small piece of text the model reads and counts. He listens, but something does not click. Then he comes back, delighted. He wrote a small CLI in Go. A plain chat loop that calls a model and runs its tools. And now he gets it. The tooling, the context window, the loop. Not because I explained it. Because he rebuilt it. I know that click by heart. I have felt it many times, on other topics. Always the same method. To understand something, I rebuild it. Reading the docs gives you a map. Rebuilding gives you the terrain. They are not the same. The map says "there is a river here". The terrain lets you feel the current. When you rewrite a system, you can no longer bluff. Every byte has to sit in the right place. Every edge case lands on you. You do not think you understand. You understand, or your code fails. This is not an academic exercise. It is the opposite. You rebuild to act better afterward. To debug faster. To bend the tool. To build what no off-the-shelf library gives you. The very first time was at school, in C. I recoded pieces of TCP and UDP. The famous three-step handshake. And header parsing, field by field. TCP opens a connection in three messages. SYN, SYN-ACK, ACK. Before, that was one line in a lecture. After, it was bytes I placed into a packet myself. I invented nothing. The protocol had existed for forty years. But redoing it changed how I see the network. Since then, a packet capture is no mystery. It is a format I have written by hand. Later, I took on DNS. DNS turns a name like jrobineau.com into an IP address. I rewrote it myself, in Go. The header, the questions, the answers, byte by byte. Rebuilding it, you hit a detail the docs gloss over. A domain name is a series of labels. Each label is prefixed by its length. "www" is a 3, then w, w, w. And then an idea shows up. If I control the labels, I control bytes. I can slip my own data into a subdomain. That is the principle of DNS exfiltration, in an authorized security context. My server receives the query, parses the name, and recovers the data hidden inside. I even handled name compression, a nasty corner of the protocol. No ready-made library would have shown me that. Rebuilding it did. On a job with industrial hardware, we spoke Modbus. Modbus is an old protocol that drives controllers and sensors. The library we used was bad. Many bugs, much strange behavior. There was no way to tell where the pain came from. The protocol? The library? Our code? So I did the one thing that settles it. I recoded Modbus myself, in Go. The verdict: the protocol was fine. The culprit was the library. And once the protocol was rebuilt, the real payoff arrived. I could build tools around it, my way. I turned it into a small Go library with a Gin-like API. You declare a handler per register range. You add logging and recovery middleware. A 1979 industrial protocol, with the comfort of a web framework. That is bending knowledge to your need. Back to LLMs. In 2026, AI is sold as magic. A black box you talk to. And you stay a user, a bit passive, a bit at its mercy. But an LLM agent is not magic. It is a loop. You send messages to the model. It replies, sometimes asking for a tool. You run the tool. You send the result back. And you start again. The context window is everything the model sees right now. Your loop decides what goes in, and what to drop. The model remembers nothing. You are the one who feeds it the past on every turn. Here is the whole loop, in Go. Strip the varnish, and only this is left. func runAgent ctx context.Context, client LLM, tools map string Tool, goal string string, error { // The context window is this list. You alone fill it. msgs := Message{{Role: "user", Content: goal}} for { // 1. You send the whole context to the model. reply, err := client.Complete ctx, msgs, tools if err = nil { return "", err } msgs = append msgs, reply // 2. No tool requested? The model is done, you return. if len reply.ToolCalls == 0 { return reply.Content, nil } // 3. You run each tool yourself, not the model. for , call := range reply.ToolCalls { out := tools call.Name .Run ctx, call.Args // 4. You feed the result back into the context. Loop again. msgs = append msgs, Message{Role: "tool", Content: out} } } } Once you have written this, the fear fades. An "agent" is this loop plus a few good tools. Tool calling is just the model telling you which function to call. Nothing more. The goal is not to rewrite everything for life. I do not ship my own TCP stack to production. I use the system's, and I am right to. You rebuild once, to understand. Then you trust, because you know what is in the box. It is earned trust, not blind trust. Rebuild when the stakes are high. A protocol at the core of your product. A tool you will debug often. A new tech, like LLMs, where everyone stays on the surface. That is where understanding pays. The next tech that impresses you, do not just use it. Rebuild a piece of it. The dev mojo has not changed. Using a tool without understanding it means staying at its mercy. Rebuilding it, even as a toy, takes back control. TCP, DNS, Modbus, an LLM agent. Every time, the same method. Rebuild to understand. Understand to bend. LLMs are simply the next system on the list. Training a team on LLMs, or want Go backend that holds up? That is what I do. Write to me. https://jrobineau.com/contact.html We do not suffer our tools. We understand them. Sources: RFC 1035, DNS format https://www.rfc-editor.org/rfc/rfc1035 · RFC 9293, TCP https://www.rfc-editor.org/rfc/rfc9293 · Modbus Application Protocol https://modbus.org/docs/Modbus Application Protocol V1 1b3.pdf · Anthropic, Building effective agents https://www.anthropic.com/research/building-effective-agents