---
title: "The Agentic Coding Loop, and the Markdown Memory It Needs"
description: "The agentic coding loop is the minutes-long cycle where an AI agent writes, tests, and fixes code to meet a spec — how it works, and where its markdown memory lives."
author: "MDflow"
date: 2026-07-02
reading_time: "14 min"
canonical_url: https://mdflow.cz/blog/agentic-coding-loop
md_url: https://mdflow.cz/blog/agentic-coding-loop.md
---

# The Agentic Coding Loop, and the Markdown Memory It Needs

*Published July 2, 2026 · 14 min read*


In June 2026, Andrew Ng gave a name to something every builder of AI coding agents had started to feel. Writing software, he argued, is no longer one loop — it is three, nested inside each other, each running at its own speed. The innermost one — the **agentic coding loop** — now belongs mostly to the machine: a coding agent that can write code, run it, notice what broke, and try again, over and over, for the better part of an hour, before it needs you at all.

That shift changes what the scarce resource is. The model is not the bottleneck anymore. The bottleneck is the durable stuff the loop reads and writes between turns — the spec it is coding against, the plan it is following, the notes it leaves itself. Get that memory right and the agent runs longer and drifts less. Get it wrong and it forgets, repeats itself, or confidently builds the wrong thing.

> **TL;DR** — The **agentic coding loop** is the minutes-long cycle where an AI agent writes code, tests it, and iterates until it meets a spec. Around it sit a **developer feedback loop** (hours, where a human steers) and an **external feedback loop** (days, where users respond). Every loop reads and writes durable **markdown** — specs, plans, progress notes. [MDflow](/) is where that markdown can live for agents and humans at the same time: readable by an MCP server and an API, editable and reviewable in the browser.

## What is the agentic coding loop?

The agentic coding loop is **the innermost, minutes-long cycle in which an AI coding agent writes code, tests its own work, and keeps iterating until the code is bug-free and meets its specification** — without a developer in every turn. In Andrew Ng's words:

> "Given a product specification and optionally a set of evals (that is, a dataset against which to measure performance), we can have an AI agent write code, test its work, and keep iterating until the code is bug-free and meets its specification."

That sentence is from Ng's essay [*Three Key Loops for Building Great Software*](https://www.deeplearning.ai/the-batch/issue-359) (The Batch, DeepLearning.AI, June 30, 2026). His larger point is that building an AI-native product means running three feedback loops at once, each on a different clock:

| Loop | Speed | Who acts | What happens each turn |
| --- | --- | --- | --- |
| **Agentic coding loop** | minutes | the coding agent | writes code, runs and tests it, iterates until it meets the spec |
| **Developer feedback loop** | hours | the human developer | examines the working product and steers the agent |
| **External feedback loop** | days | users / the market | real feedback from friends, testers, or production |

Crucially, the loops are **nested**: the fast one runs many times inside one turn of the slower one. And they all revolve around the same thing — a written specification and the artifacts the work produces.

![Three nested loops — the agentic coding loop in minutes, the developer feedback loop in hours, and the external feedback loop in days — all turning around a shared MDflow markdown store that agents read and write through MCP and the API, and that a developer steers through the editor, diffs, and comments.](/blog/agentic-coding-loop-diagram.svg)

*The three loops run on different clocks, but they all turn around the same durable markdown: the spec the agent codes against, the progress it writes back, the product the human reviews.*

Ng's own example was disarmingly small: over a weekend he built a typing-practice app for his daughter. The agent ran for roughly an hour on its own — using a web browser to check its work — while he stepped in only to make product calls, like adding unlockable cat costumes and a grown-up login flow. That is the three loops in miniature: the agent iterating in minutes, Ng steering in the gaps.

One clarification, because the vocabulary is getting crowded: this is *not* the same as the "three developer loops" (inner/middle/outer) framing that Gene Kim and Steve Yegge use in *Vibe Coding*, which describes different timescales. When we say "the agentic coding loop" here, we mean Ng's innermost, minutes-long, agent-run loop.

## Why the loop matters — for developers and for AI agents

**For developers, the loop moves your job up a level.** You are no longer typing most of the code; you are writing the spec the agent codes against and reviewing what it produces. That is higher-leverage work, and it is also higher-stakes: as the team at HumanLayer [puts it](https://github.com/humanlayer/advanced-context-engineering-for-coding-agents/blob/main/ace-fca.md), "a bad line of code is just a bad line of code, but a bad line of a plan could lead to hundreds of bad lines of code." The winning move is to steer by editing durable artifacts — the spec, the plan, the folder of context the agent reads — rather than by babysitting each keystroke. This is the heart of [spec-driven development](https://github.github.com/spec-kit/): write the specification first, review the plan, then let the loop run.

**For AI agents, the loop only closes autonomously if two things exist.** First, a target the agent can check itself against — a spec, and ideally evals or a test suite — so "am I done?" is a question the agent can answer without you. Second, somewhere to keep its working state *outside* the context window. Context windows are finite and, past a point, [attention degrades as they fill](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) — so agents externalize their plan and progress to files and reload them just in time. Anthropic calls this structured note-taking; in practice it is a `spec.md`, a `plan.md`, and a `todo.md` the agent reads and rewrites each turn. Externalized markdown memory is exactly what lets an agent work for an hour instead of a minute. (We went deep on this in [Context Engineering for AI Agents](/blog/context-engineering-for-ai-agents).)

## Which projects benefit most

The loop is general, but it pays off fastest in a few places:

1. **AI coding assistants.** Claude Code, Cursor, and Codex already live on repo-local markdown context. A clean spec and a durable progress file are the difference between a five-minute session you must watch and an hour-long one you can walk away from.
2. **Spec-driven teams.** Anywhere requirements are written down first — `spec.md` → `plan.md` → `tasks.md` — the agentic loop slots straight in, because the target is explicit and reviewable.
3. **Multi-agent orchestration.** Research-and-build systems that fan work out to several agents (a planner plus workers) need a shared place to drop briefs and collect results. [Anthropic's multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system) does exactly this: subagents store outputs in an external store and pass back lightweight references.
4. **Solo and weekend builders.** Ng's typing app is the archetype — one person, a clear spec, an agent doing the grind, a human making the product calls.
5. **Agent-maintained knowledge bases.** The same loop that writes code can maintain a wiki. We covered that pattern in [The Karpathy-Style Wiki](/blog/karpathy-style-wiki).

The common thread: wherever an agent needs **a fixed target and a durable place to keep its work**, the loop rewards you — and both of those are markdown.

## How MDflow fits

The loops do not just pass messages; they pass **durable markdown** — and that markdown needs to be readable by an agent *and* editable by a human at the same time. That is precisely the shape of [MDflow](/): a markdown workspace that exposes the same documents through two control surfaces. An **agent surface** — an [MCP server](/docs/mcp) and an [HTTP API](/docs/api), authenticated with a Personal Access Token — and a **human surface** — a browser editor, automatic version history, comments, and sharing. One store, two doors. Map that onto Ng's three loops and each role lines up with features that exist today.

### The store the inner loop reads and writes

This is the tightest fit. The agentic coding loop needs to reload its spec each turn and write progress back, and MDflow gives an agent full read/write over a markdown store through both MCP and the API:

- **Read the spec and notes** — `mdflow_get_document` returns a document's markdown body plus its *compounded description*: the labeled chain of context running from your workspace down through every parent folder. The agent gets the grounding for free.
- **Find context by topic** — [`mdflow_get_context`](/docs/mcp) scores your **folder descriptions first**, then folder names and document titles, and returns the most relevant markdown bodies. Describe a folder well and everything inside it becomes easier for an agent to retrieve.
- **Write results back** — `mdflow_create_document` and `mdflow_update_document_body` are the store side of the loop: the agent appends what it did and what is still failing.
- **Fetch and cite in one request** — append `.md` to any shared link and you get plain markdown with YAML frontmatter (`title`, `canonical_url`, `md_url`, `visibility`) over open CORS.

In practice, you give the agent a folder and point it at the same workspace your editor uses:

```text
Typing App/               ← folder description: the product's north star
  spec.md                 ← what to build; the agent reads this every turn
  evals.md                ← how "done" is measured
  progress.md             ← the agent appends what it did / what's failing
```

```bash
claude mcp add --transport http mdflow https://mdflow.cz/api/mcp \
  --header "Authorization: Bearer mdf_your_token_here"
```

And because MDflow captures **automatic version history on every write path — the editor, the API, and the agent** — each autonomous edit is recoverable with a line diff and one-click restore. That safety net (more on it in [Version Control for Documents](/blog/version-control-for-documents)) is what makes it comfortable to let the loop run unattended.

### The surface the human steers from

Ng's second loop is you, on an hourly cadence, examining the product and steering the agent — and the highest-leverage way to steer is to **edit the artifact the agent reads and review the artifacts it wrote**. MDflow's human surface is built for exactly that:

- **Author and adjust the spec** in the browser editor, with Edit, Split, and Preview views and a live rendered preview, so the document the agent obeys is always one edit away.
- **Review what changed** between turns with version history — browse versions, read a line-by-line markdown diff, and restore a prior version non-destructively if the agent went sideways.
- **Annotate and hand off** with passage-anchored comments and one-click [sharing](/faq) — a public link or a private, email-based share — to put a draft in front of a teammate.
- **Re-steer retrieval** by editing a folder's description. Because that description ranks first in `mdflow_get_context`, changing it changes what every later agent turn retrieves and how it is grounded.

The move that ties it together: edit `spec.md` in MDflow, and the agent picks up your change on its next read. No new pipeline, no redeploy — the steering surface and the agent's memory are the same document.

### The shared space many agents coordinate through

The third fit is orchestration. Multi-agent systems coordinate through a **shared store** — a "blackboard" agents read from and write to — rather than by wiring every agent to every other. MDflow can be that store:

- **One token, many clients.** A single Personal Access Token authenticates the MCP server and the API, so Claude Code, Cursor, and the OpenAI Responses API can all point at the *same* workspace at once — one agent writes a brief, another reads it.
- **Namespaces.** Workspaces and nested folders give each agent its own area, and every listing returns a document's full path so work is unambiguous to address.
- **A shared context contract.** An orchestrator can write a task's goal and conventions into a **folder description**; because that ranks first in retrieval, every worker that reads the folder inherits the same instructions.
- **Handoff by URL or email.** Raw `.md` twins let one agent publish a document another fetches in a single cross-origin request; private email shares hand a document to a *different* account entirely.
- **Discovery so a fresh agent self-configures.** MDflow ships an [`llms.txt`](/llms.txt) index, a self-contained `docs.md` manual, an A2A agent card, and an OpenAPI spec — the same discovery/transport layers we unpacked in [MCP and A2A](/blog/mcp-and-a2a-agentic-interfaces).

Two honest notes keep this grounded. MDflow is the shared *store* agents coordinate through, **not a message bus** — they talk by reading and writing documents and descriptions, not by sending each other live messages. And there is no locking, so the practical pattern is to give each worker **its own document** and let the orchestrator read the results back. Within those lines, it is a capable coordination surface today.

### Where we are headed

OKF, MCP, and the agentic loop all point the same direction, and MDflow's roadmap follows it. This is **direction, not a dated commitment**, but it is the shape of our thinking:

- **OAuth sign-in for agents**, so ChatGPT and Claude on the web can connect to a workspace without a hand-managed token — lowering the bar to point an agent at your markdown.
- **A collections API and a richer remote MCP**, so an agent can pull a *whole curated bundle* — a task's spec, evals, and notes together — in one call, instead of a document at a time.
- **Scoped, email-based access on files and collections**, so you can hand one teammate (or one agent) exactly the set it should see, and no more.

## The bottom line

The agentic coding loop reframes building software as three nested loops — the agent iterating in minutes, the developer steering in hours, users responding in days. What holds them together is not a smarter model; it is durable, portable markdown that both the agent and the human can read and write: the spec the loop codes against, the progress it leaves behind, the product you review.

MDflow is where that markdown can live for people and agents at the same time — write and steer in the browser, let your agents read and write through MCP and the API, and keep a version-history safety net under every autonomous edit. That is the memory and the control surface the loop turns around.

[Start free](/login) · [Connect an AI agent](/docs/mcp) · [Read the API docs](/docs/api)

## Frequently asked questions

### What is the agentic coding loop?

The agentic coding loop is the innermost, minutes-long cycle in which an AI coding agent writes code, tests its own work, and keeps iterating until the code is bug-free and meets its specification — without a human stepping in on every turn. Andrew Ng described it in June 2026 as the fastest of three nested loops for building software with agents.

### What are Andrew Ng's three loops for building software?

In his June 30, 2026 essay "Three Key Loops for Building Great Software," Andrew Ng describes three nested feedback loops running at different speeds: the agentic coding loop (minutes, where the agent writes and tests code against a spec), the developer feedback loop (hours, where a human examines the product and steers the agent), and the external feedback loop (days, where real users and the market respond). Each loop reads and writes durable artifacts — usually markdown.

### How is the agentic coding loop different from the developer feedback loop?

They run on different clocks and involve different actors. The agentic coding loop is the agent's own minutes-long write-test-fix cycle against a fixed spec, largely autonomous. The developer feedback loop is the human's hours-long cycle of looking at the working product and steering the agent — changing the spec, redirecting the approach, approving or rejecting a plan. The inner loop closes on its own; the outer loop needs a person.

### Where do AI coding agents store their specs and memory?

Because model context windows are finite and degrade as they fill, agents externalize their working state to durable files — a specification, an eval set, a plan, and a running progress or todo file — and reload them just in time each turn. The 2026 convention is plain markdown (spec.md, plan.md, todo.md, plus standing files like CLAUDE.md and AGENTS.md), because markdown is human-readable, versionable, and portable across every agent.

### How does MDflow fit into the agentic coding loop?

MDflow is a markdown workspace that exposes the same documents through an agent surface (an MCP server and an HTTP API, authenticated with a token) and a human surface (a browser editor, automatic version history, comments, and sharing). Agents read the spec and write progress back through MCP; the developer edits and reviews the same markdown in the browser; and many agents can share one workspace. It is the durable memory and control surface the loops turn around.

## Further reading

- Andrew Ng — [Three Key Loops for Building Great Software](https://www.deeplearning.ai/the-batch/issue-359) (The Batch, DeepLearning.AI) · [mirror](https://charonhub.deeplearning.ai/three-key-loops-for-building-great-software/)
- Anthropic — [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) · [How we built our multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system)
- [Spec Kit](https://github.github.com/spec-kit/) and [AGENTS.md](https://agents.md/) — durable artifacts that steer coding agents
- MDflow — [Markdown for AI agents](/markdown-ai) · [MCP documentation](/docs/mcp) · [API documentation](/docs/api) · [Context Engineering for AI Agents](/blog/context-engineering-for-ai-agents) · [The Karpathy-Style Wiki](/blog/karpathy-style-wiki)

