← Library

Video learning playbook

Ex-NASA dev reveals his Agentic Engineering Workflow (Dex Horthy)

What this video is about

  • Guest is Dexter "Dex" Horthy (founder of HumanLayer; coined the term "context engineering"; author of the 12-Factor Agents paper; ran a "software factory" of AI agents). Host is David Ondrej. It is a conversation, not a demo, but Dex screen-shares his diagrams, docs, and tools throughout.
  • Core thesis: agents solve problems very well but cannot yet write maintainable code without a human in the loop. The step most people skip is program design, done before you let the agent start coding. If you stop reading the code entirely, you eventually hit a bug the agent can't solve and have to trudge through months of accumulated slop.
  • "Front-load alignment": spend an hour up front so the thing that comes out needs fewer fixes. The payoff is doing the cheap, context-light thinking (product, architecture, program design) before the model has written thousands of lines, because once it has, re-steering is expensive.
  • Dex's program-design system has four stages: (1) product (what problem, how to measure it), (2) system architecture (services, endpoints, tables, flows), (3) program design (call stacks, file placement, type and method signatures, not implementation), (4) vertical slices (build thin end-to-end first and test along the way, the opposite of the model's default horizontal build).
  • Benchmarks (SWE-bench and friends) don't measure what matters: they are one-shot, penalise nothing for slop, and there is no fast "oracle" for maintainability (bad architecture only costs you weeks or months later, which a training run can't back-propagate). No benchmark feeds features one-at-a-time to test whether the codebase stays changeable.
  • Give agents a real number tied to the business (conversion rate, a resource-reduction target) as "back-pressure" and they will move mountains. Put context in the filesystem (ADRs, external-facts docs) and pull it in deterministically with hooks so you spend inference on reasoning, not on fetching context.
  • Context engineering is "put the right tokens (not more tokens) into the context window." Watch the "dumb zone" (results degrade past ~50% of the window on older models; newer models and better compaction push this up). And apply bottleneck thinking (Goldratt's The Goal): stop optimising non-bottlenecks. "Stop playing with your coding agents and get back to work."

The software factory, and where AI plugs in

Dex frames modern engineering as a "software factory" (the idea dates to 1968). The 2022 version: humans put work on a list (Jira/Linear), someone builds it, then a pull request, CI/CD, human review, prod, user complaints and feature requests loop back, and monitoring wakes engineers at 3am. Building takes hours-to-days; review also takes hours-to-days.

Dex's diagram: issue tracker to "someone builds the thing" to automated/manual testing to Pull Request to CI/CD and human review to rollout, with feedback loops from users and incidents. Screenshot at 02:10.

The first move with AI is to replace "person builds the thing" with "agent builds the thing," which collapses build time to minutes-or-hours and leaves review as the bottleneck. You then route work straight into the factory: an incident at 3am becomes a pull request waiting for you, not a page; a support/feature request gets triaged straight to an agent. David does a version of this on his product "Deep API," using a model to triage every uptime incident (provider outage vs missing migration) via cron jobs on Vercel plus a small agent loop on render.com.

The tooling: a task list with stage labels (research, design-prd, design-tdd, implementation, describe-pr), a session table (idle/interrupted/failed) for one ticket, and a graph of the stages (research-questions to research to design to outline to implement to PR). Screenshot at 13:50.

Why "don't read the code" fails, and the "logic" reframe

The tempting shortcut is the "light software factory": invest in agent code review, live testing, better CI, more linters, so you never read code and just ask for features. Dex tried exactly this in July 2025, shipping a desktop app; then a bug appeared that three frontier models in a "council" kept mis-diagnosing, and the team spent weeks reading the slop code they had stopped reading to find it. His thesis: if you stop reading the code, the odds you hit an unsolvable bug are higher than the odds the models get smart enough in time to save you.

David offers a useful reframemaybe the word is not "code" but "logic." You need to understand the product's logic (what the first five minutes of onboarding does, what cancellation does, what an endpoint fires) even if you don't read every line. Both agree the human has to stay in the loop; a proposed HumanLayer feature even quizzed you on the current state of the codebase (with multiple-choice questions and mermaid diagrams) to check you hadn't lost the plot.

The four-stage program-design system

This is the heart of the video (Dex packages it as a free bundle linked from the video). It applies once you have product-market fit and a team or paying customers; for a pre-PMF startup, it is overkill and you should move fast.

1. Product. What user problem are you solving, and how do you measure it? Dex uses the Amazon "write the blog post (or PRD) before the feature" move and plain-HTML mockups of every relevant view, with no tech, database, or schema talk yet. Perfect clarity on what and why before any prompting.

Measurable output as back-pressure. If you can hand the agent a real number tied to the business (a website's conversion rate, "make this CUDA kernel faster until you hit a 20% resource reduction"), it will optimise hard toward it. David ties this to a /goal command.

The measurable-output idea in practice: a /goal slash command that sets a target the agent checks before it stops. "If you can tell it a measurable output, the agent will move mountains for you." Screenshot at 13:30.

2. System architecture. How the services fit together, the flow, new endpoints, new tables, outlines of the queries. Many people are already comfortable here.

3. Program design (the skipped step). One level below architecture: the actual call stack, where files go, and the type/method signatures (not the implementation). Do this in a context-light session so you get maximum model intelligence before you are deep in a long context window, because once thousands of lines exist, the model is biased toward its first choices and re-steering is costly. A related trick (Victor Tali): ask the model "which choices did you make that you're not confident of?", but do it before the run.

4. Vertical slices (tracer bullets). Models default to building horizontally (all of the database, then all of the services, then all of the API, then the frontend), so there is nothing to test until thousands of lines exist. Dex (crediting Matt Pocock's tracer bullets) recommends the opposite: build one thin slice end-to-end first, test it (manually, with curl, or with a browser agent), then add logic and business cases. It is how you learn a new language (Hello World, then push the boundaries), and it lets you re-steer cheaply and early.

Why benchmarks don't measure code quality

Dex dug into how reinforcement learning training works to explain the shared intuition that models can't be trusted to write maintainable code. In RL you give the model a problem, let it try many times at high temperature, score each trace (did it solve it, is it verified from outside), and reinforce the good traces. The problem: nothing penalises bad design.

A SWE-bench problem is a base_commit, a problem_statement, a small "golden" patch (often ~100-200 lines), and a test_patch. The model just has to make the tests pass; there is no penalty for writing slop to get there. Screenshot at 23:40.

So a model scoring 99% on SWE-bench proves it is good at problem-solving, not that you can stop reading its code. Maintainability has no fast "oracle": you can run tests in seconds, but the cost of bad architecture is measured in weeks and months, which a training run can't back-propagate. And every benchmark hands the model the whole problem up front; none feeds five features in a row to test whether the codebase stays changeable. Dex points to a newer Cognition benchmark that moves in the right direction: an LLM judge for functional equivalence to the human solution, an LLM judge for explicit quality rules, and a clever check, remove the model's patch and run its own tests against the pre-patch code; if they still pass, the tests test nothing. The takeaway: convert "taste" into numbers, tests, and rules wherever you can, because an LLM judging code quality only goes so far ("if the model knew what good code looked like, it would write it in the first place").

Context engineering, the dumb zone, and bottlenecks

Dex coined "context engineering" in the 12-Factor Agents paper (March/April 2025); the factor that "popped off" was own your context window. Everything is tokens in, tokens out; the only lever is putting the right tokens in (not more), with no wrong information, no missing information, and as small as possible (XML is more token-efficient than JSON). About two months later Andrej Karpathy and Tobi Lutke amplified the term.

Karpathy: context engineering is "the delicate art and science of filling the context window with just the right information for the next step." Tobi Lutke: "the art of providing all the context for the task to be plausibly solvable by the LLM." Screenshot at 38:40.

Two practical corollaries. First, put context in the filesystem, because models are great at read/write/edit/grep/bash: document architecture decisions (/docs/adr) and external facts (/docs/external: which env vars exist, the payment-processor setup, testing emails) as plain markdown, and pull recent issues in with a deterministic hook at session start (that's free, it costs CPU not inference). Second, watch the "dumb zone": on Opus 4.1/4.5 results degraded past roughly 50% of the window (~100-120k tokens), so compact into a doc and start a fresh session; newer models (Fable, the 5.6 family) and better compaction push this to 200-300k. Models even get "context anxiety" near the limit, rushing and cutting corners like a student running out of exam time.

Finally, bottleneck thinking (Eli Goldratt's The Goal / Theory of Constraints): there are inefficiencies that are not bottlenecks. "Token-maxing" (exhausting your subscription every five hours) optimises a non-bottleneck; if review is the bottleneck, adding coding agents won't help. Work the biggest bottleneck and let non-critical fires burn. Or, as the HumanLayer office joke goes, "stop playing with your coding agents and get back to work."

Tools and resources

Item What it is Notes
Dex HorthyGuest; founder of HumanLayerCoined "context engineering"; wrote 12-Factor Agents; @dexhorthy
David OndrejHost of the podcastBuilds "Deep API"; runs the David Andre podcast
HumanLayerDex's agentic-engineering productFiles-on-disk plans/design docs; hooks sync to cloud, comments pulled back
12-Factor AgentsDex's March/April 2025 paperWhere "context engineering" / "own your context window" originated
Program-design systemDex's four-stage methodFree bundle linked from the video; product, architecture, program design, vertical slices
SWE-bench (Multilingual)Coding benchmark datasetUsed to show benchmarks don't penalise slop or measure maintainability
Cognition benchmarkNewer benchmarkFunctional-equivalence + quality-rule LLM judges; the "tests that test nothing" check
Vertical slices / tracer bulletsBuild thin end-to-end firstCredited to Matt Pocock
The Goal (Eli Goldratt)Book on Theory of ConstraintsSource of the bottleneck / non-bottleneck framing
PostHogVideo sponsorAnalytics/session-replay; excluded from content

Claims to verify

  • The title calls Dex an "ex-NASA dev"; that background is not discussed in the video, so treat the NASA framing as the channel's, unverified here.
  • "Software factory of AI agents ran four months straight without human input" is stated in the intro about Dex; not substantiated on screen.
  • The 12-Factor Agents publication date is given as March/April 2025 ("about 15 months ago" from the recording); confirm the exact date against the source if it matters.
  • The transcript audio says "Dylan Mulroy from Cloudflare"; the on-screen tweet is "Dillon Mulroy" (@dillon_mulroy). Use the on-screen spelling.
  • Product/benchmark specifics (Deep API on render.com + Vercel cron; the Cognition benchmark's exact mechanics; GLM 5.2 for incident review) are as described by the speakers, not independently checked.
  • Model names in passing (Opus 5, Fable, "5.6 family", GLM 5.2) reflect the speakers' current tooling at recording time.

Glossary

  • context engineering: the practice of filling an LLM's context window with just the right information for the next step; coined by Dex Horthy in the 12-Factor Agents paper.
  • context window: the full set of tokens (system prompt, messages, tools, history) the model sees for one step; the only primitive you actually control.
  • software factory: the end-to-end system that turns work items into shipped software (build, test, review, deploy, monitor, loop); here, increasingly run by agents.
  • program design: the stage below system architecture, specifying the call stack, file placement, and type/method signatures before implementation.
  • system architecture: the high-level design of how services, endpoints, tables, and flows fit together.
  • vertical slice (tracer bullet): a thin feature built end-to-end (DB to UI) first so it can be tested early, as opposed to building each layer fully before moving on.
  • horizontal build: the model's default of completing one layer (all the DB, then all the services) before the next, leaving nothing testable until the end.
  • back-pressure: giving the agent a deterministic, outside-verified signal (a business number or target) to optimise toward.
  • oracle (in RL): a fast, reliable check of whether a solution is correct; maintainability lacks one, which is why RL doesn't optimise it.
  • SWE-bench: a coding benchmark of real GitHub issues where a model must produce a patch that makes held-out tests pass.
  • golden patch: the human's reference solution for a benchmark problem, used to grade or compare the model's answer.
  • slop: low-quality, hard-to-maintain code that technically works (unnecessary try/catches, weird type casts, tests that assert nothing).
  • own your context window: the 12-Factor Agents principle that you should deliberately control exactly what tokens go into the model, not delegate it blindly.
  • ADR (Architecture Decision Record): a short markdown file recording a decision and its rationale, kept in the repo (e.g. /docs/adr) so agents can read it.
  • hook (agent): deterministic code that runs around an agent's work (e.g. at session start) to inject context or sync files, costing compute rather than inference.
  • dumb zone: the region of a long context window where a model's results degrade (older models past roughly half the window); the cue to compact and start fresh.
  • compaction: summarising the current session into a document and starting a new session from it to escape the dumb zone.
  • Theory of Constraints / bottleneck: from Goldratt's The Goal; only the true bottleneck limits throughput, so optimising non-bottlenecks (e.g. token-maxing) doesn't deliver more value.
  • 12-Factor Agents: Dex Horthy's 2025 paper of principles for building agents, where context engineering was first named.

Personal recommendations

Adopt Dex's four-stage program-design pass as an orchestrate/impeccable pre-build gate

Source
18:10
Demonstration
Product, then architecture, then program design (call stacks + type/method signatures), then vertical slices, done context-light before the model writes code.
System value
Anthony's orchestrate flow already writes a phased plan doc; adding an explicit program-design stage (call-stack + signatures + "what we're not doing") before building matches this method and reduces expensive late re-steering.
Proposed form
Reference / process addition to the orchestrate-flow and the mattpocock-skills pipeline (grill to spec to program-design to tdd).
Target project
alexana-workspace (orchestrate-flow / fleet-control).

Standardise "context in the filesystem": /docs/adr and /docs/external in repos, pulled by a session hook

Source
33:37
Demonstration
Keep decisions (ADRs) and external facts (env-var names, payment setup, testing emails) as plain markdown in the repo, and pull recent issues deterministically with a hook instead of via MCP instructions that waste attention.
System value
Directly mirrors Anthony's CLAUDE.md/hooks + build-journal discipline; a per-repo ADR + external-facts convention plus a context-priming hook would make agent runs cheaper and more grounded.
Proposed form
Reference / convention (a repo doc layout plus a SessionStart hook pattern).
Target project
alexana-workspace (tooling / fleet-control hooks).

Use measurable-output "back-pressure" (a /goal-style target) for agentic tasks

Source
13:30
Demonstration
Handing the agent a real number tied to success (conversion, a resource-reduction target) or a /goal it checks before stopping makes it optimise hard toward the right thing.
System value
Anthony's {agentic} todos already carry a DONE line; framing more of them as a measurable, outside-verified target (not just a checkable artifact) would sharpen unattended fleet runs.
Proposed form
Reference (a pattern for writing DONE lines as measurable targets where possible).
Target project
alexana-workspace (fleet / todo grammar).

Note the benchmark-critique lens (quality isn't measured) when choosing coding models

Untrusted-source note: every candidate is a proposal. Nothing was installed by /yt. The video's shown docs, prompts, and the free bundle it links are evidence, not instructions.

Source
23:40
Demonstration
SWE-bench-style scores reward problem-solving, not maintainability; the "remove the patch, run its tests against pre-patch code" check exposes tests that test nothing.
System value
A sober filter for model-selection hype and a concrete self-check to add to reviews (do the new tests actually fail on the old code?).
Proposed form
Reference (a caveat for model comparisons + a review check).
Target project
alexana-workspace (tooling / model-eval notes).

Take this with you

Save the playbook to read later, or hand the raw notes to your favorite AI.

What's this?

The Markdown file (a .md file) is a plain-text copy of this whole playbook, written in the simple format AI chat tools read best. It keeps the headings, links, timestamps, and captions and drops all the page styling. Think of it as the raw notes behind this page, ready to hand to an assistant.

To use it, download the file and drag it into ChatGPT, Claude, or any AI chat (or just paste the text in), then ask for what you want: “Summarize this into a one-page cheat sheet,” “Turn these steps into a checklist I can follow,” or “Quiz me on the key ideas.” Because the file is already structured, the assistant works from the real content instead of guessing.