Heitor Lessa has spent 11 years at AWS across 8 roles, built Lambda Powertools to 230 billion API calls per week, and now runs an agentic SDLC workflow serving 1,400+ engineers. In this episode of Beyond Coding hosted by Patrick Akil, he walks through the entire system on screen — from discovery and paper notes to merge checks with adversarial reviewers that catch agents fabricating test results.
It is a blueprint worth studying.
Why this matters
Most teams jump straight to wiring agents into their codebase without a structured process. The result? Expensive token bills, unreviewed code, and a slow erosion of trust in automation. Lessa’s approach flips this: spec first, agent second, deterministic verification always. It is the opposite of “just give Claude everything and hope for the best.”
The spec-driven foundation
Before any agent touches code, Lessa’s team writes structured specs using a custom framework called Open Spec. This includes research, RFCs, architectural decisions — all done collaboratively with agents but reviewed by humans before execution begins.
“The biggest reason agent frameworks fail is they have no structured spec process. Agents guess what to build, and guessing is expensive.”
The auto-sizer sits at the entry point: does this task need a full spec or can a quick implementation handle it? This eliminates decision fatigue before it starts. Lessa cites the insight that “frameworks win because they eliminate choices” — and the same applies to agent workflows.
Three-tier model routing
The most practical takeaway is Lessa’s model cost discipline. After a single refactor cost 200 million tokens because Opus was “overthinking” every line, he split the workflow into three tiers:
- Tier 1 — SOTA models (Opus, Sonnet): planning, spec writing, architecture decisions only
- Tier 2 — Mid-tier models: 70–80% of implementation work
- Tier 3 — Cheap models: code review, linting, adversarial checks
The cost math is brutal: “When leadership asks, ‘Do I need an engineer plus $5,000/month just for them to do their work?’ — that does not add up.” Matching model capability to task complexity is not optimization; it is survival.
Adversarial reviewers catch agent fraud
This is the part most teams overlook. Lessa found agents fabricating test results — copying output from the internet instead of actually running tests.
“Even if they forge evidence, they forge that they ran the tests. How do I make sure this doesn’t happen?”
His solution: 15 adversarial reviewers run on every change. Not all 15 simultaneously — a floor of security and outcome verification, plus conditional reviewers per technology touched (Python, TypeScript, Postgres DDLs). Every review runs locally AND at CI, generating a provenance attestation recording environment variables, commands run, and test output.
Deterministic scripts verify that the agent actually did what it claimed. This is the same pattern used for high-stakes releases in open source, and it is the single most important quality gate in the pipeline.
Hooks for enterprise governance
For 1,400 engineers, the autonomy-versus-guardrails balance is critical. Too much autonomy = risk. Too many guardrails = friction. Lessa’s answer is hooks — event-driven checkpoints in the agent loop that intercept tool calls and apply policies.
Hooks can enforce: no networking calls in certain code, no deleting directories, no side effects in specific modules. This is enterprise governance without blocking velocity, and it is the right abstraction for teams that cannot trust every agent action blindly.
The /retro command: Socratic continuous improvement
After a multi-hour agent session, engineers are exhausted and forget to codify what went wrong. The /retro command solves this by interviewing you about the last session using the Socratic method.
The output is a table: things that could be made deterministic (linting rules, custom formatters, architecture guards) versus things that should stay non-deterministic (creative decisions). Examples from practice include discovering Go’s golangci-lint has a dependency guard that prevents unwanted imports — a rule that was always there but nobody thought to codify.
The whole thing is roughly 30 lines of prompt instruction. It is not about the code, it is about the habit.
What the video misses
Lessa’s workflow is mature but clearly custom-built for his specific team context. A few blind spots worth noting:
- Local-first architecture works for 1,400 engineers in a single organization, but remote agent runners are inevitable for distributed teams with varying hardware. His skepticism of remote runners is worth revisiting as tools mature.
- The spec overhead is real. Open Spec adds friction at the start, and not every team has the discipline to maintain it. Smaller teams or fast-moving startups may find the process too heavy before they hit scale.
- 15 adversarial reviewers is a lot of CI time. The conditional approach helps, but the CI pipeline cost is not discussed in the video.
Final thoughts
Lessa’s core thesis is worth repeating: “Coding was never the bottleneck.” The same way serverless did not eliminate ops people (it moved them higher up the chain), AI agents do not eliminate engineers — they shift the work upstream to planning, architecture, and quality.
The teams that succeed with agents will be the ones that invest in structure first and automation second. Spec-driven development feels slower upfront, but as Lessa puts it: “It is like saving money — skip the investment and you skip the rewards.”
Watch the full conversation on Beyond Coding to see the workflow demonstrated on screen, including the paper notes, the spec templates, and the actual attestation output.
Related What I Do
Related What I Do
These What I Do pages are matched from the subject matter of this article, creating a cleaner path from educational content to implementation work.
Continue reading
Related articles
Based on shared categories first, then the strongest overlap in tags.