AI coding agents can write increasingly sophisticated software, but the quality of that software often comes down to decisions that happen before the code gets complicated.
In this episode of AI That Works, Dex, Vaibhav, Avery, and Kyle go deep on two problems that sit underneath modern AI coding systems: choosing the right data structures and synchronizing massive amounts of rapidly changing data across clients.
Avery starts with a deceptively simple Ticketmaster example to show how representation shapes implementation. As agents add features one at a time, seemingly small data structure mistakes create invalid states, duplicate sources of truth, and downstream complexity that compounds across the codebase. He then shares the results of an experiment where frontier coding agents built the system incrementally, revealing exactly where they make these mistakes and why good tests alone don't necessarily catch them.
The conversation then shifts to HumanLayer's sync architecture. Kyle explains why a simple WebSocket implementation quickly turns into a much harder distributed systems problem when clients need to synchronize tasks, agent sessions, conversation events, files, and rapidly changing data. They break down sync engines, Postgres, WebSockets, durable streams, client state, and the difference between normal data synchronization and high-frequency token streaming.
Along the way, they connect the engineering problems to familiar systems like multiplayer video games and explore an important product lesson: users don't necessarily care about the underlying latency if the interface makes the system feel instantaneous.
KEY TAKEAWAYS
• Good data structures can make algorithms simpler and prevent entire categories of invalid states
• Small AI coding mistakes become much more dangerous when they compound across many features
• Tests can stay green even when an agent has created a fundamentally worse representation
• Reviewing data structures may provide more leverage than reviewing every downstream line of AI-generated code
• Real-time synchronization is much harder when clients can request many different shapes of rapidly changing data
• WebSockets alone don't solve the problems of persistence, reconnection, buffering, and state
• Sync engines track what each client cares about and deliver only the updates that matter
• Token streaming needs a faster path than repeatedly writing tiny updates through Postgres
• Client-side optimism can make distributed systems feel dramatically faster to users
• The best architecture often comes from studying systems that have already solved similar problems
TIMESTAMPS
Why Data Structures Matter More Than Code
What This Episode Covers
Data Structures, AI Coding Agents, and Sync Engines
Why Good Data Structures Make Algorithms Obvious
Why Coding Agents Struggle With Data Representation
Testing AI Agents With Incremental Requirements
How Agents Handle New Data Structure Requirements
How New Features Create Downstream Coupling
Why AI Agents Create Invalid States
Why Passing Tests Doesn't Mean Good Architecture
How Small AI Mistakes Compound Into Slop
How HumanLayer Synchronizes AI Coding Sessions
Why WebSockets Aren't Enough for Real-Time Sync
The Difference Between Chat Sync and AI Agent Sync
The Architecture Behind a Production Sync Engine
Why Fast Data Access Is Harder Than Fast Writes
Keeping Rapidly Changing Agent Data in Sync
How Token Streaming Gets Around the Database
How the Sync Engine Knows Which Clients Need Updates
How Durable Streams Handle Thousands of Connections
Making Distributed AI Systems Feel Instant
Why Optimistic UI Matters for AI Coding Agents
How Clients Reconnect Without Losing State
TOPICS COVERED
• AI coding agents
• AI-generated code
• Data structures
• Software architecture
• Code quality
• AI slop
• Technical debt
• Agent evaluation
• Incremental development
• Rust
• B-tree maps
• Type systems
• Distributed systems
• Sync engines
• Real-time databases
• WebSockets
• Postgres
• Electric SQL
• Durable streams
• Token streaming
• Client synchronization
• Optimistic UI
• AI coding infrastructure
• HumanLayer
• Multiplayer systems
HASHTAGS
#AIThatWorks #AICoding #AIEngineering #CodingAgents #SoftwareEngineering #AIAgents #DataStructures #DistributedSystems #Postgres #WebSockets #ClaudeCode #DeveloperTools