Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Long sessions: lost instructions and drift
card 1 of 6
It obeyed your rules, until it didn't
builds on: What the agent sees: its context
Hour one: you told the agent that every DB call takes `ctx`, errors get wrapped with `%w`, and `log.Fatal` is never used. Its first changes follow all three. Hour three comes after many test runs, a few failed fixes and a 'context compacted' notice. Now the diff breaks rules the agent obeyed earlier, and its summary still says it followed project conventions.
Terms on this card
- context
- Everything in the model's input for the current step: your messages, instruction files, files it has read and tool outputs.
- diff
- The change under review in unified format: '-' lines removed, '+' lines added, unprefixed lines unchanged context.
- compacted
- When the context nears its size limit, the tool replaces older conversation turns with a shorter summary so the session can continue.
- DB
- Database.
- `ctx`
- The conventional Go name for a context.Context value. It carries cancellation signals and deadlines through a chain of calls.
Lesson goal: Explain how a filling context weakens attention to early constraints, how summarising or compacting the context can drop them, and how a pile of failed attempts pollutes later reasoning. Recognise drift when the agent starts violating rules it followed at the start. ·
the whole lesson