Skip to the content.

LDL — LLM Delivery Loop

A delivery methodology for AI agents: contract first, gated delivery loop, compounding second brain.

LDL (LLM Delivery Loop) is a pattern for delivering real results with AI agents. In one sentence — humans govern through contracts and gates, agents execute through loops, and every project compounds into a second brain. Three elements: (1) contract & gates (governance) (2) loop execution (delivery) (3) compounding assets. If the LLM Wiki compounds knowledge, LDL compounds delivery.

Quick start — paste this document into your agent and ask: “Install this into my workspace.” Works with Claude Code, Codex, Cursor, Gemini CLI, or any agent that can read and write files. Nothing to install, no dependencies — in LDL the methodology is the folder structure.

What’s inside: the double loop (inner delivery loop + outer knowledge loop) · seven phases from contract to verification · four human approval gates · the Ingest / Query / Lint protocol for a compounding wiki · a folder tree you can install today.

If you are looking for an AI agent workflow that survives real projects, a way to stop re-explaining context to your agent every session, contract-first prompting, human-in-the-loop quality gates, or a second brain that agents actually maintain — that is what LDL is for.

Core

Agree the goal and criteria first, as a contract → enforce them through structure → delegate → humans verify at the gates → feed the results back into criteria and rules.

Contract = Phase 0–1 (goal, requirements) / structure = Phase 2 / delegation = Phase 3–5 (research, scoping, execution) / verification = the four gates + the Phase 6 loop / feedback = at Phase 6 completion → the outer loop.

Structure — double loop

┌─ Outer loop: compounding assets ──────────────────┐
│  Ingest · Query · Lint — wiki · rules · templates    │
│  ┌─ Inner loop: delivery ──────────────────┐       │
│  │ Phase 0  goal setting (the contract)     │       │
│  │ Phase 1  requirements definition         │       │
│  │ Phase 2  scaffolding structure design    │       │
│  │ Phase 3  problem research                │       │
│  │ Phase 4  solution scoping & priorities   │       │
│  │ Phase 5  engineering execution           │       │
│  │ Phase 6  the loop (verify·iterate·feed back) │   │
│  └─────────────────────────────────────────┘       │
│  at project end, promote lessons/rules/templates out │
└─────────────────────────────────────────────────────┘

Phase 0 — Goal setting (the contract)

This phase’s deliverable is a contract between the user and the AI. Agree on what problem to solve, why, how, and how the whole flow will run; every later phase is execution of the contract. Scope changes are handled as contract changes. Keep the contract as a separate file from the constitution (00_CONTRACT.md) — the constitution holds immutable principles; the contract is a project document updated through contract changes.

Deliverable: 00_CONTRACT.md — preceded by the interview record in raw/.

The interview comes first

The contract is not what the agent inferred — it is what the human said. Before writing the contract, interview the user and preserve the answers verbatim in the project’s raw/ (one file, IDs IV-01, IV-02, …). The contract then cites those IDs, and any field with no citation is agent inference and carries a [hypothesis] label. This applies Phase 1’s primary-utterance rule at Phase 0, where it decides everything downstream.

Ask three or four at a time. Offer choices — including your own guess — and allow free text; a wrong guess is itself information.

Question The contract field it fills
What is the real problem behind this request? Why
What exactly is in your hands when this is done? What
How will you check that it was done? How · evaluation criteria
By when, at what cost, with how many people? Constraints
Who decides pass or fail — a person, or code? Criteria judge
Is there work here that cannot be undone? Permission tiers
Do you know this domain? Where are the primary sources? Phase 3 depth · raw/
Verified once at a deadline, or continuously? Scope mode
What would you look at and call this a failure? Failure conditions

A question that fills no field is not asked — it only spends the user’s attention.

Go deeper only on a trigger: a vague word (“fast”, “properly”) → ask for the number and the instrument; Why and What don’t connect → “how does that deliverable remove that problem?”; a criterion can’t decide pass or fail → “what would you look at and call it failure?”; irreversible work exists → approval path and rollback; no domain expertise → who to ask, which document is primary; the constraints make the What impossible → “what do you drop first?”; raw/ is empty → ask for the material before asking more questions — one document can remove five of them.

“I don’t know” is a valid answer. If the unknown does not move the pass line (a tool, a method, a nice-to-have), it enters the contract as [hypothesis] and becomes a Phase 3 research item. If the unknown is the pass line (a missing law, policy, or primary source that decides what counts as done), no contract can honestly form yet — that is what pre-contract research below is for. An interview that stalls on unknowns is a bad interview.

Cost ceiling: three rounds. If the exit tests still fail after three, this is not a problem an interview can solve. Two legal exits — “hand it to Phase 3” is not one of them, because Phase 3 sits behind gate ① and gate ① is exactly what you cannot pass:

The five exit tests — the interview ends when all five pass

Each failed test is the next question. The interview is a loop, not a form — so give it what every loop needs: a verifier (the tests), a cost ceiling (three rounds), and a termination condition (all five pass).

Phase 1 — Requirements definition

Deliverable: 01_REQUIREMENTS.md

Phase 2 — Scaffolding structure design

The workspace harness (constitution, rules, wiki, templates) was installed once; the project skeleton (the project part of the default tree) was created at project start. Phase 2 designs not folders but this project’s enforcement devices. Build the harness before delegating research and execution — delegating without structure scatters evidence and outputs.

Deliverable: the project constitution + the delegation and permission structure

Phase 3 — Problem research

Deliverable: 03_EVIDENCE.md (the evidence ledger)

Phase 4 — Solution scoping & priorities

Deliverable: 04_SCOPE.md

Phase 5 — Engineering execution

Deliverable: the results accumulating in 05_engineering/ (delivered versions point-in-time frozen)

Phase 6 — The loop (verify · iterate · feed back)

Deliverable: 06_VERIFICATION.md (the verification report — updated cumulatively per increment)

Four human gates

Contract approval (Phase 0) / problem finalized (Phase 3) / solution finalized (Phase 4) / final delivery (Phase 6). At each gate, the head of the phase document carries a four-line review summary (what was done / key conclusion / the judgment being requested / where the detailed evidence lives), so the human opens one file and judges in minutes. Everything else belongs to the loop. Record every gate pass in the event log and PROGRESS.md.

Outer loop — Ingest · Query · Lint

The operation of the workspace root (raw/ · wiki/ · index.md · RULES.md · templates/ · logs/). As the wiki accumulates, it becomes a second brain.

Logs and progress

The three-sentence pattern — the basic language of delegation

① “Don’t do X — go only as far as Y” (scope first) ② “Attach a source to every claim” (demand evidence) ③ Instead of “do it again”: “from now on, judge by this criterion and do it again” (feedback via criteria)

Installation procedure — executed by the agent

Install only what is listed below. Add further devices only when the need is proven.

Step 0 — Preflight, then the global constitution. First, probe the host: can the agent write agent-instruction files (CLAUDE.md and its kin) unattended? Some hosts protect them behind per-file live approval, and an unattended install will stall there. If they are protected, either present the human one approval packet up front listing every instruction file the install will write, or fall back to plain filenames (CONSTITUTION.md, PROJECT_PROTOCOL.md) — and state explicitly that fallback files are not auto-loaded: the agent must be told to read them at each session start.

Then the global constitution (first-time users): if there is no user-level global config file (~/.claude/CLAUDE.md or your tool’s equivalent), create it first. Five base principles:

Add your own situational rules on top (response language, frequently used commands, recurring-task rules). The constitution has four layers: global → workspace constitution (outer-loop protocol) → shared project protocol projects/CLAUDE.md (inner-loop protocol) → the individual project constitution (Phase 2). Each layer stacks on the one above it, and in tools that load nested CLAUDE.md files hierarchically, this structure enforces itself. Step 1 — Scaffold first, then interview. The interview record has to land somewhere immutable, so the folders come first. Ask the user where to install (default: a folder in the current directory), create the workspace once, then create the first project skeleton under projects/. Afterwards every new project gets the same skeleton and starts from Phase 0. The default tree — these are the names the scaffolder writes; rename them if you like, but rename them in the script, not per project:

   llm-delivery-loop/             ← workspace = outer loop (installed once)
   ├── CLAUDE.md                  # workspace constitution — identity/principles + outer-loop (wiki) protocol
   ├── RULES.md                   # prevention rules (the ratchet) — each with its origin
   ├── index.md                   # workspace index — link-closed catalog (query entry point)
   ├── raw/                       # second-brain source layer — project-independent collections (read-only)
   ├── wiki/                      # knowledge layer — the cross-project second brain
   ├── templates/                 # task prompt & document templates
   ├── logs/                      # outer-loop log — collection purposes, ingest verdicts, lint (log.md)
   ├── tools/                     # reference scaffolder + lint (shipped with this repo)
   └── projects/                  ← inner loop = one folder per project
       ├── CLAUDE.md              # shared project protocol — Phase 0–6 gates, naming, document & log standards
       └── YYYY-MM-DD_<name>/     ← start date, never renamed
           ├── 00_CONTRACT.md     # Phase 0 · gate ①
           ├── 01_REQUIREMENTS.md # Phase 1
           ├── 03_EVIDENCE.md     # Phase 3 · gate ②
           ├── 04_SCOPE.md        # Phase 4 · gate ③
           ├── 05_engineering/    # Phase 5 deliverables (delivered versions frozen)
           ├── 06_VERIFICATION.md # Phase 6 · gate ④
           ├── CLAUDE.md          # project constitution (Phase 2 — scope constraint, project-specific rules)
           ├── PROGRESS.md        # progress — the review hub
           ├── raw/               # this project's sources + the interview record (immutable)
           └── logs/              # log.md (events) + sessions/ (session records)

Generate this with a script, not by hand — the naming convention is the first thing to drift. Naming is not cosmetics here: it is what makes the phase order survive a file explorer. Two scripts live in tools/: the scaffolder above, and the lint from the outer loop. Reference implementations ship in this repository (tools/scaffold.py and tools/lint.py) — copy them in and start from them. Your agent may rewrite them in any language, but a rewrite must keep the same verdicts: lint.py --selftest plants the step-4 negative fixtures plus a suite of hostile ones (empty sections, bare judges, non-UTF8 and unreadable files, raw deletion, malformed state, name traversal) and legit-input probes that must stay green — one at a time, each judged by its exact error at its exact path; the selftest’s own output names the full suite, so it, not this sentence, is the current list. Run it against any rewrite. Two installers that disagree on what passes are two different methodologies wearing one version number. And in every case the lint decides by exit code, not by prose.

The scaffolder pre-creates every numbered document as a headed skeleton — an empty 03_EVIDENCE.md in a fresh project is a to-do, not litter, and link-closure still applies to it: every phase document is reachable from the project’s PROGRESS.md.

Step 2 — Interview → contract. See Phase 0 above for the full question set, the triggers, and the five exit tests. Preserve the answers verbatim with IDs in the new project’s raw/, then organize them into the contract and confirm with the user. Do not skip this and write the contract from inference — that is the single most expensive shortcut in this document.

Additionally: set the three permission tiers (unattended = read-only, always; reversible = backup first; irreversible = explicit re-confirmation) and a measurement baseline (measure the current value once, now).

Step 3 — Engrave the constitutions. In the workspace constitution (skeleton of six parts — identity in one sentence / principles / how we work / permissions and limits / scope constraints / center), write the outer-loop protocol (Ingest·Query·Lint, wiki standards). In the shared project protocol (projects/CLAUDE.md), write the Phase 0–6 gate, document, and log standards, plus the instruction: “Read the active project’s contract (00_CONTRACT.md) before starting any work. Work outside the contract only after contract-change approval.” Transfer only the rules needed, rewritten in the user’s own language — never copy this document wholesale. Purpose: a future session’s agent behaves by the methodology without ever seeing this file. Step 4 — Verify the installation. Create the first project folder under projects/ and run Phase 0 once — the interview first, then a one-page contract (2W1H + constraints + evaluation criteria + failure conditions + execution plan), then T2 on that contract. Negative tests, all three: feed a below-criteria contract to the gate and confirm FAIL; create a document that no link reaches and confirm the lint catches it as an orphan; create a wrongly-named project folder and confirm the lint catches it. Report completion with this demonstrated behavior, not with words.

Principles


About LDL

LDL — LLM Delivery Loop. Maintained by @daniel-kjseo. MIT licensed — use it, fork it, rename it to fit your team.

Found this useful, or ran it on a real project? Open an issue with what broke — every failure becomes a rule in RULES.md, which is the whole point.