A talk for engineers · 29 minutes · source: aihero.dev
The basics of agentic development, from Matt Pocock’s AI Hero. What an agent is, why it fails, and the flow that keeps it honest.
→ / space to advance
Before we start · two things to hold
This is not a machine learning topic. The agent writes the code. You decide what is worth building, and whether what came back is right. Your engineering judgement is the asset. It transfers directly.
“AI is not a super-powered developer. It’s a new starter with no memory.”
aihero.dev/how-to-make-codebases-ai-agents-love
No memory between sessions. Every session starts empty.
The mechanism · start here
“An agent, though, doesn’t use predetermined steps. It calls an LLM and gives it a bunch of tools, different options of things that it can do next.”
aihero.dev/what-is-an-agent
A tool is one action it can ask for: read a file, run a command.
A model, a set of tools, and a loop. That is the whole machine.
A real session, cropped · nothing here is mocked up
❯ the test in sum.test.js fails - find out why and fix it ↑ you typed this once ● Bash(ls -la …/demo) ← the model asks for a tool ⎿ total 16 ← the harness runs it -rw-r--r-- 1 root root 164 Aug 29 18:54 sum.js -rw-r--r-- 1 root root 198 Aug 29 18:54 sum.test.js ● Read(…/sum.js) ⎿ Read 10 lines ● Update(…/sum.js) 3 - for (let i = 0; i < numbers.length - 1; i++) { 3 + for (let i = 0; i < numbers.length; i++) { Do you want to make this edit to sum.js? ❯ 1. Yes 2. Yes, and allow … 3. No ↑ it stops and asks
One prompt. Five tool calls. It ran the shell on my machine, and waited.
Slide 3 said “run the tests” · here is one, with the code it checks
sum.js ← the code function sum(numbers) { let total = 0; for (let i = 0; i < numbers.length - 1; i++) { ← the bug total += numbers[i]; } return total; } sum.test.js ← the test test('sums all the numbers', () => { assert.equal(sum([1, 2, 3, 4]), 10); ← must give 10 });
A test runs your code and checks the answer. It ends in one word.
Run it · the real output, cropped · nothing here is reworded
❯ node --test not ok 1 - sums all the numbers ← one word: not ok error: '6 == 10' expected: 10 actual: 6 ← it got 6, not 10 # pass 0 # fail 1
“When working with AI coding agents, especially those operating independently, you need feedback loops so the AI can verify its own work.”
aihero.dev/essential-ai-coding-feedback-loops-for-type-script-projects
Nobody told the agent it was wrong. It ran the test and read the answer.
The same session as slide 4, further down · still not mocked up
● Bash(node --test 2>&1 | tail -20) ⎿ ok 1 - sums all the numbers ← the same test, now passing # pass 1 # fail 0 ● Off-by-one in the loop: sum.js:3 stopped at numbers.length - 1, so it skipped the last item and returned 6. I changed the bound to numbers.length; the test passes.
“Tests and feedback loops are essential — they’re how your AI new starters know if their changes work.”
aihero.dev/how-to-make-codebases-ai-agents-love
That is the done arrow on slide 3. A pass is what ends the loop.
Why a loop beats a reminder
“AI agents don’t get frustrated by repetition. When code fails type checking or tests, the agent simply tries again.”
aihero.dev/essential-ai-coding-feedback-loops-for-type-script-projects
“Poor feedback loops. The AI doesn’t receive feedback fast enough, so it doesn’t know if what it changed actually did what it intended.”
aihero.dev/how-to-make-codebases-ai-agents-love
A person gets bored of running the same check. The agent does not.
The fact behind every failure you will hit this week
“An agent can only work with what’s in its context window.”
aihero.dev/plan-mode-introduction
“Agents often work in fresh context windows.”
aihero.dev/my-7-phases-of-ai-development
It never read your codebase. It read what fitted in the window.
What is actually in the window
Measured in tokens — chunks of text. A thousand tokens is roughly 750 words. A full window is about a short novel.
“Whatever isn’t in the session doesn’t exist for the agent.” — aihero.dev
“Same model, same harness — just more context.”
“The zones don’t track the context window limit. A session can be deep in the dumb zone with most of the window still free”
aihero.dev/ai-coding-dictionary/smart-zone
“Plan around the smart zone, not the window”
Why quality falls · the attention budget
Attention is a fixed budget, spread across everything in the window.
“Like humans, who have limited working memory capacity, LLMs have an “attention budget” that they draw on when parsing large volumes of context.”
anthropic.com/engineering/effective-context-engineering-for-ai-agents
A gradient, not a cliff. Ten times as much in, a tenth of the notice each.
What to do · spend the window on one task
“Use
code.claude.com/docs/en/best-practices/clearfrequently between tasks to reset the context window entirely”
/clear is a slash command. You type it into the agent.
When it drifts from what you told it, do not paste in more documentation. That makes it worse. Clear it, and start again.
Three ways a session goes bad · from the official docs
“If you’ve corrected Claude more than twice on the same issue in one session… Run
code.claude.com/docs/en/best-practices/clearand start fresh with a more specific prompt that incorporates what you learned.”
No memory · so where do you write it down?
“CLAUDE.md is a special file that Claude reads at the start of every conversation… This gives Claude persistent context it can’t infer from code alone.”
code.claude.com/docs/en/best-practices
“For each line, ask: ‘Would removing this cause Claude to make mistakes?’ If not, cut it. Bloated CLAUDE.md files cause Claude to ignore your actual instructions!”
code.claude.com/docs/en/best-practices
The file costs context too. Run /init to start one; keep it under 200 lines.
When a fact becomes a procedure · move it out of CLAUDE.md
“If an entry is a multi-step procedure or only matters for one part of the codebase, move it to a skill… instead.”
code.claude.com/docs/en/memory
“Only the name and description sit in context by default. When the agent’s task matches, it loads the rest. Until then, the skill takes up almost no room — a sentence or two of tokens, however large its full instructions are.”
aihero.dev/ai-coding-dictionary/skill
“A teachable capability bundled as a unit” — a SKILL.md file.
The session ends. Everything you agreed dies with it.
“The spec exists because context windows end.”
aihero.dev/skills-to-spec
“the tickets are disposable and the spec isn’t” — a session dies in the dumb zone, and the spec is what survives into the next window.
Matt’s pipeline · five skills you type, in order
/tdd is the engine inside this step.Verbatim from aihero.dev/skills · /ask-matt picks one for you.
The same ticket, twice
Prompt the agent. It builds the wrong thing. Correct it twice. /clear. Type the whole brief again from memory.
Grill once. A spec file. Three tickets. Each ticket is a fresh session that reads the spec.
You write the brief once. Every later session reads it.
Stage one · the grilling · plan before any code
“You wouldn’t chuck vague requirements at a human colleague and expect good results. Without plan mode, that’s exactly what you’re doing to an AI.”
aihero.dev/plan-mode-introduction
“In plan mode, you iterate with the agent on what you want to build before any code gets written.”
aihero.dev/plan-mode-introduction
Enter plan mode with Shift+Tab. Also --permission-mode plan.
Inside implement · the loops · cheapest first
aihero.dev/essential-ai-coding-feedback-loops-for-type-script-projects
/tdd is these loops as a skill: “The rules of the red-green-refactor loop.”
Your first skill · the whole of /grill-me
“Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one by one. And finally, if a question can be answered by exploring the code base, explore the code base instead.”
aihero.dev/5-agent-skills-i-use-every-day
“Skills don’t have to be long to be impactful. You just need to choose the right words at the right time.”
aihero.dev/5-agent-skills-i-use-every-day
That is the whole skill. /grill-me talks; /grill-with-docs writes it down.
Do this
Shift+Tab. No code until the plan is right./grill-with-docs on the next ticket. Keep the file it writes.Thank you
“You have access to a fleet of middling to good engineers that you can deploy at any time. But these engineers have a critical flaw: they have no memory. They don’t remember things they’ve done before.”
aihero.dev/5-agent-skills-i-use-every-day
All quotes verbatim from aihero.dev and code.claude.com/docs