Keiji Kanazawa rebuilt his agent system after reading its code

A three-week refactor produced fake agents and expensive tests. He rebuilt around explicit goals and evaluations.

KKKeiji KanazawaSpeaker · Microsoft
Channel
AI Engineer
Published
Nov 9, 2026
Video
19:50
Read
4 min
Slides
8
Original
English
Open on YouTube
Scroll to read and the video shrinks to the bottom-right corner. Captions follow your reading language.
Reading languageAvailable in 2 languages
You're reading the original English.
SUMMARY

In 30 seconds

After three weeks of agent-led refactoring, Microsoft product manager Keiji Kanazawa found that his supposed agents were ordinary workflows, tests hit paid production inference, and a daily report was empty. He started over with explicit specifications and outcome rubrics while continuing to delegate coding. His video-analysis agent now selects keyframes and explains equations, but even its agent-written rubric overfit one lecture. He tests across examples, revises criteria and has coding agents review each other.

  1. 1The “agent” had no agent trace to inspectA misplaced sentence in a digest led Kanazawa to discover that labels in an approved design did not match the implementation.
  2. 2Unit tests called production inference roughly 30 times in one dayThe unexpected token bill was about five times his normal weekly spend, and a daily reflection job also produced empty reports.
  3. 3He restarted with explicit specifications and outcome rubricsHe retained coding agents but gave the rebuilt system clearer goals and compared four agent frameworks.
  4. 4A video agent pairs selected frames and equations with explanationsThe prototype extracted about 440 keyframes from a lecture and supports questions about individual sections.
  5. 5The rubric itself overfit the lectureIt performed poorly on five other videos until he directed the agent to generalize its criteria.
  6. 6He owns the goal while agents review each other’s codeKanazawa still delegates most implementation and iterates on evaluation criteria rather than reading every line.

Takeaways

  1. Check that implementation matches the meaning of its labels, not just an approved plan.
  2. Separate tests from paid production inference and watch spending alerts.
  3. Describe the outcome with evaluation criteria and revise them after inspecting real results.
  4. Test rubrics on multiple examples to catch overfitting.
  5. Use repeated adversarial reviews between coding agents while retaining ownership of the goal.
FULL TEXT

Read the edited text by chapter

Transcript only
01

A personal research workflow becomes an agent project

Kanazawa describes his preference for delegating code and how a podcast summarizer expanded into a scheduled research system.

I let coding agents refactor my codebase for three weeks, then read the result. There is a debate between letting agents spend tokens to do work and slowing down to read their code; I am strongly on the first side.

I am a product manager at Microsoft with a background in development and AI research. My busy day job left little time for podcasts, so I built skills to download, transcribe and summarize them. The project grew to crawl X and web pages, accept emailed links and run on a schedule, becoming an LLM-powered wiki.

The original steps were deterministic, such as downloading and transcribing a video. I added more agent-like tasks, including deep research and daily reflection on my Claude Code use, and wrote a specification for a runtime with a registry of scheduled agents.

I had Codex and Claude take turns implementing and reviewing each other's work. Then a digest put a sentence in the wrong section. I asked Claude Code where the agent's traces were so I could diagnose the error and build an evaluation; it replied that the system was not really an agent.

02

A misplaced digest sentence exposes the refactor

The intended agent was not implemented as one; production-backed tests generated an unexpected bill and a scheduled report was empty.

When I read the implementation, I disliked a design I had apparently approved. I had read plans and accepted familiar terms such as agents and skills, but the implementation did not match those names. The supposed skills lacked skill files and scripts, while the agents did not run on agent SDKs.

Labels in the refactored code
SLIDE 1 / 8Labels in the refactored codeThe code treats actions as skills, illustrating the mismatch Kanazawa found.

A provider then alerted me early in the month that I had exceeded my normal budget: about $100, or five times my usual weekly spend. Codex had connected unit tests to production inference, and around 30 test cycles in a day consumed paid tokens.

Production inference in unit tests
SLIDE 2 / 8Production inference in unit testsThe slide describes about 30 test runs against production in one day.

I also discovered that the daily reflection job was producing empty reports. During the refactoring, the prompts had stopped running, even though the scheduled task itself still ran.

03

Restart with explicit goals and compare tools

He rebuilt with a registry, specifications and outcome rubrics, comparing four coding frameworks for his needs.

After three weeks of asking agents to refactor, I did not trust either tool to repair the existing system. I started a new implementation with fresh specifications and outcome rubrics. I still used coding agents: as a product manager, I was not planning to write the system myself.

Starting the agent runtime again
SLIDE 3 / 8Starting the agent runtime againThe new design calls for an explicit agent, specification and outcome rubric.

The new runtime has a registry of agents and uses an agent SDK. I give the coding agent instructions for an agent that can produce output on a canvas. To choose tools, I asked four frameworks to build the same kind of experience.

I settled on alternating Claude Code and Codex for personal projects. At work I mostly use Copilot CLI. Pi built a good-looking experience quickly, but asked me engineering questions about database and API architecture that I did not want to decide as a product manager.

Comparing four coding tools
SLIDE 4 / 8Comparing four coding toolsKanazawa describes why he chose different tools for personal and work projects.
04

Extract video frames and evaluate the result

A video-analysis agent turns a technical lecture into an explorable canvas. Iteration on the rubric corrects layout and overfitting.

I rebuilt the transcription, summaries and email features. Earlier my YouTube workflow summarized transcript text alone; then I found a blackboard lecture by Reiner Pope about the mathematics of LLM inference, directly relevant to my day job, and wanted to understand the images too.

I built a video deep-dive agent that extracted about 440 keyframes from the lecture and used an evaluation rubric to select useful images and extract equations. Its canvas presents chapters, blackboard material and explanations. I can jump into the video or ask the agent to explain an equation.

The video deep-dive agent
SLIDE 5 / 8The video deep-dive agentThe example extracts lecture frames and creates an explorable canvas.
Criteria for evaluating the canvas
SLIDE 6 / 8Criteria for evaluating the canvasThe rubric asks about explanation, citations, coverage and further reading.

My old workflow gave an agent a specification and approved or rejected its plan. Now I also set a rubric describing the outcome I want. For the video canvas that includes clear explanations, simplicity and links to the correct moments.

I worked deeply on one lecture, then found that the approach could also handle presentations, coding demos and terminal recordings. Agents wrote the rubrics under my direction; I iterated on them and let the agents repeatedly improve the output against the criteria.

Initially the equations were grouped at the beginning followed by a wall of text. I wanted each equation placed alongside its explanation, so I told the agents to change the rubric. I inspect the result, change the criteria and let the agent improve again.

Improve output and test the rubric
SLIDE 7 / 8Improve output and test the rubricThe loop evaluates generated output and exposes an overfitted judge.

I discovered that an agent-written rubric had been tuned to succeed on that one lecture. It did poorly on five other videos. After I asked the agent to stop optimizing for that single example, the rubric generalized better and scores improved across the set.

05

Review loops and human ownership

Agents optimize against criteria and review one another. Kanazawa retains control of goals while continuing to delegate most code.

There are nested loops: agents help create the rubric, optimize the output against it, and I revise the rubric based on what I see. I also have Claude and Codex review one another's code and suggest fixes over several adversarial review rounds.

Coding agents review each other
SLIDE 8 / 8Coding agents review each otherA repeated review process has the agents find and fix problems.

I remain on the side of delegating implementation. I own the goal and tell agents what outcome and working approach I want, but still do not read most of the code. For me, spending tokens this way lets a product manager build experiences I had wanted for years.

More from this channel

7 slides19:41EN
AI Engineer· Nov 9, 2026A high-reliability automation starts by routing the hard cases awayMatthew Jewkes · Standard CyberneticsMatthew Jewkes describes separating critical errors, ambiguous decisions and unusual exceptions in a biopharma indexing workflow.Agent engineeringWorkflow automationEvals+1
7 slides22:01EN
AI Engineer· Nov 9, 2026Zach Lloyd: make the software factory measurable and editableZach Lloyd · WarpWarp’s CEO proposes recording agent runs, scoring failures and testing changes to the workflow on real tasks.Software factoriesCoding agentsEvals+2
12 slides27:35EN
AI Engineer· Nov 9, 2026Uber traded an always-green trunk for faster AI-scale mergesPreetam Dwivedi, Manjari Akella · UberIts merge queue now relaxes some conflicts and validates the combined state after landing, with a verified-good fallback.Developer workflows & testingCoding agentsInfrastructure & deployment+2
3 slides15:25EN
AI Engineer· Nov 9, 2026Hassan and Omar El Mghari: When an AI financial forecast is right for the wrong reasonsHassan El Mghari, Omar El Mghari · Together AIA Costco membership-fee model passed basic checks and landed close to reported results, but an audit uncovered offsetting assumptions.AI in financeEvalsAgent engineering
3 slides14:38EN
AI Engineer· Nov 9, 2026Jemima Abu: Give coding agents accessibility rules from the startJemima Abu · CAISA product engineer shows how semantic HTML, reusable components and explicit agent skills can help teams build more usable interfaces.Coding agentsProduct & UXAgent skills
4 slides21:12EN
AI Engineer· Nov 9, 2026Tom Moor: Give coding agents the product context that code cannot showTom Moor · LinearLinear’s workflow carries customer requests, past decisions, review history and human feedback from intake through implementation and review.Coding agentsProduct & UXAgent engineering