Learning Atlas field guide · Stanford CS329A

Build the loop, not the myth

A field guide to agents that become more reliable through search, evidence, verification, memory, and a disciplined way to keep only what worked.

Stanford CS329A course overview lectureSource courseNine public lectures on self-improving AI agentsOpen the course overview ↗

Working definition

Self-improvement is a governed feedback loop—not an agent secretly rewriting itself.

A raw language model is a generator. It can propose code, plans, explanations, searches, and actions, but it does not automatically know which proposal is correct. A self-improving agent surrounds that generator with an environment that produces evidence and a learning policy that decides what deserves to survive.

That distinction matters because “self-improving” is often used for three very different things. A fixed model can spend more effort on one answer. A harness can remember a verified lesson for the next run. A training system can change model weights. The public Stanford course moves across all three; builders should keep them separate so that improvement remains measurable and reversible.

01 / Inside one attempt

Spend inference deliberately

The model samples alternatives, searches, calls tools, checks intermediate work, or revises an answer. The weights stay fixed; the system gets a better result by doing more useful work before it stops.

02 / Across attempts

Keep operational memory

The harness retains verified examples, failure signatures, rubrics, tool instructions, and decisions. The next run starts with better context even though the underlying model may be unchanged.

03 / Across training cycles

Distill verified experience

Successful trajectories become supervised or reinforcement-learning data. This changes the policy itself, but it also introduces the hardest risks: reward hacking, diversity collapse, and learning the verifier instead of the real task.

The operating model

The agent only learns when evidence changes what happens next.

Read in numbered order. Every step should leave an inspectable trace, and every return to the beginning should be justified by new evidence—not by hope that another attempt will somehow be better.

  1. 01Generate

    Produce one or more candidate plans, answers, or trajectories.

  2. 02Act

    Search, retrieve, run code, inspect files, or change a bounded environment.

  3. 03Verify

    Collect tests, citations, screenshots, execution results, or human judgment.

  4. 04Select

    Choose the candidate supported by the strongest evidence—not the smoothest prose.

  5. 05Retain

    Save the useful trace, failure pattern, rubric change, or test that should survive this run.

  6. 06Update

    Improve the prompt, harness, memory, evaluator, fixture, or model, then run the loop again.

The practical loop synthesized from test-time scaling, verification, tool feedback, planning, RL, retrieval, evaluation, and continual-learning lectures.

What actually improves

Name the layer before you say the agent learned.

This field guide changes the working system, not the underlying model weights. Every claim of improvement should identify its layer and the evidence that would prove the change survives a fresh run.

LayerWhat changesWhat would count as proof
Context

The next run receives a clearer task packet, better examples, or more relevant repository state.

A fresh run succeeds with the revised context while the task, model, and verifier stay fixed.

Curated memory

A reviewed lesson, failure signature, or counterexample becomes available across runs.

The memory has provenance, a scope, a review date, and repeated evidence that it transfers.

Harness

The workflow gains a better tool sequence, retry policy, routing rule, sandbox, or human gate.

The same model completes more end-to-end tasks without added regressions or hidden intervention.

Verifier

Tests, rubrics, citation checks, screenshots, or independent review reject more bad work.

Audits show fewer false accepts without an unacceptable rise in false rejects.

Model weights

Nothing in the workspace loop changes them. Weight learning requires a separate training pipeline.

Do not claim it happened unless a documented training run produced and evaluated a new checkpoint.

Eight applied lessons

What to carry from the course into actual agent work.

The papers differ in models, tasks, and training regimes. Their durable value is the architecture they reveal: useful agents explore, touch reality, preserve evidence, and learn under explicit rules.

01

Treat generation and verification as different capabilities

A model can contain the right answer in its distribution without being able to produce—or recognize—it reliably.

The Large Language Monkeys work makes the distinction visible. Ask a model once and you measure its default behavior. Ask it hundreds of times and you measure whether a workable solution exists somewhere in the long tail. Those are not the same kind of capability. Pass-at-k is evidence that the generator can occasionally reach the answer; pass-at-one is evidence that the system can deliver it reliably.

The gap between those numbers is where agent engineering begins. Sampling more candidates helps only if the system can identify the good one. A perfect unit test can turn rare code into usable code. Majority voting is weaker: the most common answer can still be wrong, especially on hard problems. An LLM judge is useful but fallible, and it may share the generator’s blind spots.

This reframes the usual model-selection question. The best system is not automatically the one with the largest generator. It may be the system that pairs an adequate generator with a much better evaluator, stronger tests, or a more informative environment.

Practice move

Take one task your agent often gets partly right. Produce three candidates and define an acceptance test that can reject all three. Do not let the generator write the only test it must pass.

Failure to watch

Calling oracle pass-at-k performance “agent performance” even though no real selector can recover the winning sample.

02

Allocate thinking according to difficulty

More compute is a budget, not a ritual. Easy tasks need less; uncertain, consequential tasks deserve more.

Test-time scaling turns inference into an adaptive process. An agent can sample in parallel, revise sequentially, branch through a search tree, or call a stronger model only when the task warrants it. The Stanford course repeatedly returns to the same operational question: where should the next unit of compute go?

Fixed best-of-N sampling wastes work on easy prompts and can keep spending after the candidates stop improving. It also cannot rescue a problem that lies beyond the generator’s current reach. A better controller estimates difficulty from disagreement, verifier scores, failed tests, uncertainty, or novelty, then routes the task to the smallest useful escalation.

For builders, the useful pattern is a compute ladder: one direct attempt, one evidence check, a bounded repair, a small parallel branch, and finally human escalation. Every rung has a cost limit and a stop condition. This is more dependable than telling the model to “think harder” without specifying how improvement will be recognized.

Practice move

Write a five-rung escalation ladder for one workflow. Attach a trigger, maximum retries, and evidence requirement to every rung.

Failure to watch

Equating longer reasoning traces with better reasoning, then paying for verbose loops that never obtain new evidence.

03

Design the feedback before designing the agent

The feedback signal defines the ceiling of the improvement loop.

The course presents a spectrum of feedback. ReAct obtains observations from tools and external sources. Code agents receive execution feedback from compilers and tests. Constitutional AI turns written principles into critique and preference signals. Outcome reward models score the final answer; process reward models inspect intermediate steps.

These mechanisms are not interchangeable. Execution feedback is precise but narrow. Human review is rich but expensive. Process feedback improves credit assignment but requires trustworthy step labels. A learned reward model scales, yet it creates a proxy that the agent may exploit. If the metric rewards polished citations rather than supported claims, the system will learn citation theater.

A mature agent therefore uses a verifier portfolio. Deterministic checks prove what can be proven. Retrieval grounds factual claims. Independent judges examine ambiguity. Human review covers taste, meaning, and irreversible decisions. Disagreement between signals is treated as information, not averaged away automatically.

Practice move

Create a verifier matrix with four columns: claim, automatic evidence, human judgment, and known blind spot. If a major claim has no credible signal, narrow the agent’s authority.

Failure to watch

Letting the same model propose, judge, and approve its work with no external evidence or adversarial check.

04

Make reasoning touch the environment

An agent becomes useful when plans encounter reality and observations can change the next action.

A chatbot can describe a plan. An agent must decide what to do, act through a tool, inspect what happened, and know whether to continue. ReAct’s interleaving of reasoning and action is the foundational move: internal knowledge gaps become searches, assumptions become commands or queries, and plans can change when the environment disagrees.

This is also why most dependable production agents remain structured workflows. Prompt chains, routers, parallel workers, orchestrators, and evaluators constrain what happens next. The graph is often designed by a human because completely open-ended loops are difficult to observe and harder to stop.

Tool access should be shaped around meaningful state transitions. A file-reading tool provides evidence. A test runner provides feedback. A browser provides rendered reality. Each write tool also introduces authority, so permissions, previews, and rollback paths are part of the learning architecture rather than administrative details.

Practice move

Diagram one agent as goal → action → observation → decision → done signal. Remove any tool whose output cannot change the next decision.

Failure to watch

Adding many tools but giving the agent no state model, permission boundary, or criterion for choosing among them.

05

Search only where the world is reversible

Branching, backtracking, and self-critique assume the agent can safely explore alternatives.

Language Agent Tree Search and related planning methods let a model explore multiple trajectories, score partial states, and return to earlier choices. Parallel planning can reduce sequential depth when subtasks are independent. These ideas work naturally in mathematics, code sandboxes, and simulated environments.

Real work is less forgiving. Sending three alternative emails is not search. Charging three credit cards is not exploration. Editing a shared production database and then selecting the best outcome is an incident. The system needs to know which actions are informational, reversible, transactional, or irreversible.

Strong harnesses create a safe search surface: temporary branches, preview environments, dry runs, drafts, mocked APIs, permission scopes, and explicit approval gates. The agent is allowed to explore freely inside that surface and must stop at its boundary.

Practice move

Label every tool action read-only, reversible write, expensive computation, external communication, or irreversible change. Require approval for the last two until evidence supports broader autonomy.

Failure to watch

Copying a tree-search architecture into a workflow with real side effects and assuming failed branches can simply be forgotten.

06

Preserve exploration while improving reliability

Training on selected successes can make the model more dependable and less inventive at the same time.

STaR captures an appealing flywheel: generate rationales, retain the trajectories that reach correct answers, fine-tune, and repeat. Modern reinforcement-learning systems scale this idea with group-relative rewards and large batches of synthetic reasoning. The best traces become the next model’s curriculum.

Selection changes the distribution. If the system repeatedly promotes one familiar strategy, entropy can collapse. Pass-at-one rises because the preferred path becomes more likely, while pass-at-k may stagnate because alternative paths disappear. A loop can therefore appear to improve while losing the diversity needed to solve tomorrow’s unfamiliar problems.

A practical memory system faces the same issue even without weight training. Saving every accepted pattern creates a monoculture of instructions. Retained lessons need provenance, expiration, counterexamples, and periodic challenges that test whether the rule generalizes beyond the run that produced it.

Practice move

For every promoted lesson, keep one counterexample and one condition under which the lesson should not apply. Track whether candidate diversity falls over repeated runs.

Failure to watch

Optimizing only the average accepted answer until the agent becomes confidently brittle under distribution shift.

07

Evaluate complete tasks, not impressive moments

Long-horizon reliability is its own capability because small errors compound across dependent steps.

An agent that succeeds on 95 percent of individual steps completes a fifty-step chain only about 7.7 percent of the time if every step depends on the previous one. That simple calculation explains why benchmark fluency and autonomous work can feel like different technologies.

The course’s evaluation lecture moves from isolated questions toward task horizons, economically valuable work, and research synthesis. The recurring failures are operational: weak planning, wrong tool choice, incorrect mental math, premature abandonment, repeated actions, missing citations, and an inability to recognize that the task is no longer progressing.

End-to-end evaluation should record recovery as well as success. How many times did the agent retry? Did it detect the failure or did a human? Did the verifier catch a regression before the final answer? How much human editing was required? A useful system improves those curves, not only its demo output.

Practice move

Choose one 20–40 minute task and record the full trajectory. Score completion, interventions, retries, verifier coverage, elapsed time, and the amount of human repair needed.

Failure to watch

Reporting a strong component benchmark while ignoring that the complete workflow frequently stalls, loops, or ships the wrong artifact.

08

Build a governed learning system, not a self-editing prompt

The practical frontier is controlled continual learning: deciding what experience deserves to survive and in what form.

The final lecture identifies three human bottlenecks: diversity of synthetic reasoning, verification without reference answers, and selection of the next useful training task. Multi-agent generation can broaden the candidate pool. Meta-verification can inspect whether a critic’s objection is real. Self-proposed curricula can target problems at the edge of current competence.

But adding another model does not eliminate governance. A verifier can hallucinate flaws; a meta-verifier can inherit the same blind spot; a task proposer can generate work that is easy to score rather than useful. Every learned rule needs provenance: which run produced it, what evidence supported it, where it applies, who approved it, and how it can be rolled back.

For today’s Codex, Claude, or Gemini workflows, the safest form of self-improvement is a promotion pipeline. Runs produce candidate lessons. Tests and human review decide which candidates become prompt changes, rubrics, fixtures, examples, or regression tests. Nothing edits the standing instructions silently. The system gets better, but authority remains legible.

Practice move

Create a candidate → reviewed → promoted → challenged → retired lifecycle for agent memory. Require evidence and an owner at every transition.

Failure to watch

Allowing the agent to rewrite its own instructions after a single successful run, turning accidental behavior into permanent policy.

Stress-test the claim

Before you call an agent self-improving, ask four harder questions.

Did the system improve, or did it simply spend more?
Separate quality gains from added samples, tokens, latency, tool calls, and human review. Cost-normalized improvement is the meaningful comparison.
Does the verifier measure the real outcome?
A passing test may have weak coverage; a citation may not support its sentence; an LLM judge may prefer confident prose. Audit false positives explicitly.
Is the reasoning trace trustworthy?
Treat visible reasoning as a useful work surface, not guaranteed access to the model’s causal process. Prefer externally checkable intermediate artifacts.
Will the lesson survive a different task?
Challenge promoted memory on adjacent tasks and counterexamples. A local optimization is not yet a reusable rule.

Prompt workshop

Give your agent a learning protocol, not a motivational slogan.

These prompts deliberately define improvement as better harnesses, evidence, memory, and controlled retries. They do not pretend that a normal coding or research session retrains the underlying model.

Codex

Create a repository improvement loop

A coding agent that can inspect a workspace, change files, run project-native checks, and turn verified failures into reusable engineering standards.

Act as the architect and first operator of a bounded self-improving coding agent in this repository.

Operating definition:
"Self-improving" means the system gets better through verified run artifacts, curated memory, improved tests, revised rubrics, and controlled retries. Do not claim to retrain or modify model weights.

Safety boundaries:
- Preserve existing work and inspect the current state before changing anything.
- Never perform destructive cleanup or any irreversible action—publishing externally, sending messages, spending money, or changing production state—without my explicit approval.
- Keep generated lessons as candidates until a human reviews them.
- Never collect or persist secrets in experiment logs.
- Stop when the verifier cannot distinguish progress from repetition.

Goal:
Build the smallest useful learning loop for this repository. The loop must improve future runs by preserving verified lessons, not by silently rewriting itself.

Start with discovery:
1. Read every applicable AGENTS.md and the project workflow documentation.
2. Inspect git status and preserve unrelated or uncommitted work.
3. Identify one representative task that can be completed and verified in under 45 minutes.
4. Find the project-native commands for typecheck, tests, build, lint or policy checks, and local UI validation.

Before implementation, create:
- a one-paragraph hypothesis;
- a baseline task packet;
- an acceptance checklist;
- a verifier matrix with deterministic checks, evidence checks, and human judgment;
- a run manifest that records prompt version, files touched, commands run, failures, retries, evidence, elapsed-time proxy, human edits, and candidate lessons;
- explicit maximum retries and a stopping rule.

Implement one baseline run and one improved run on comparable work. For the improved run, change only one variable: prompt, context packet, verifier, memory example, or retry policy. Do not change several things and then claim causality.

Verification requirements:
- run the narrowest relevant tests and typecheck;
- inspect the git diff for scope and accidental edits;
- for UI work, run the project through its documented lifecycle command, check browser console errors, and capture desktop and mobile screenshots;
- record both passing and failing verifier results;
- ask for human review on correctness, editorial value, and taste where automation is insufficient.

Learning policy:
- Convert each observation into a candidate lesson containing evidence, scope, counterexample, confidence, and rollback instruction.
- Promote a lesson only if it succeeds twice, does not cause a regression, and receives human approval.
- Prefer converting lessons into a regression test, fixture, checklist, or narrow instruction instead of adding broad prose to standing context.
- Keep rejected lessons and explain why they were rejected.

Deliverables:
1. The pilot artifact.
2. Baseline and improved run manifests.
3. Verifier output and screenshots where applicable.
4. A comparison table with reliability, retries, regressions, verifier coverage, human edit distance, and time-to-acceptance.
5. A promotion decision for every candidate lesson.
6. A recommendation to continue, revise, or abandon the loop.

Work autonomously inside these boundaries. Give short progress updates, surface blockers with evidence, and finish by telling me exactly what to inspect.

Claude Code

Create a reflective worker with an independent critic

A long-form implementation or research workflow where the worker must preserve context, critique its own trajectory, and learn through a reviewed project memory.

Design and run a bounded self-improving agent workflow in this project. You are the primary worker, but you must separate creation from criticism even if both roles use the same underlying model.

Operating definition:
"Self-improving" means the system gets better through verified run artifacts, curated memory, improved tests, revised rubrics, and controlled retries. Do not claim to retrain or modify model weights.

Safety boundaries:
- Preserve existing work and inspect the current state before changing anything.
- Never perform destructive cleanup or any irreversible action—publishing externally, sending messages, spending money, or changing production state—without my explicit approval.
- Keep generated lessons as candidates until a human reviews them.
- Never collect or persist secrets in experiment logs.
- Stop when the verifier cannot distinguish progress from repetition.

Objective:
Complete one real project task while creating an evidence-backed improvement loop that makes a comparable second run more reliable.

Use these roles:
- Worker: interprets the task, plans, acts, and produces the artifact.
- Critic: examines the plan, diff, evidence, and failure modes without rewriting the artifact immediately.
- Verifier: runs deterministic project checks and records raw results.
- Curator: proposes what should be remembered, challenged, or discarded after the run.

The roles must exchange structured artifacts rather than vague approval. Create:
- task-contract.md: outcome, constraints, non-goals, permissions, expected artifact, and done signal;
- plan.md: bounded steps, uncertainties, expected tool calls, and stop conditions;
- evidence.md: commands, outputs, citations, screenshots, and unresolved claims;
- review.md: critic findings ranked by severity and confidence;
- memory-candidates.md: proposed lessons with scope, evidence, counterexample, and expiry or challenge date;
- run.json: prompt version, task class, retry count, verifier coverage, interventions, and result.

Protocol:
1. Establish a baseline before introducing memory or reflection.
2. Let the worker complete the task using project-native instructions.
3. Freeze the output long enough for the critic and verifier to inspect it independently.
4. Repair only actionable findings supported by evidence.
5. Run a comparable second task or controlled replay using exactly one promoted candidate lesson.
6. Compare the two runs. Do not call the second run better unless the acceptance rate improves without higher regression rate or unreasonable additional cost.

Verifier design:
- Prefer compilers, tests, schemas, execution output, source links, and rendered UI evidence.
- Treat aesthetic or editorial judgment as a named human review step.
- Sample verifier false positives by manually inspecting at least one passing result.
- If worker and critic agree but external evidence disagrees, external evidence wins.

Memory rules:
- Do not save raw conversation as memory.
- Save compact decisions that change future action.
- Never promote a lesson from one anecdote.
- Preserve disagreement and rejected alternatives when they reveal a boundary condition.
- Ask me before changing standing project instructions.

Finish with:
- the completed artifact;
- a baseline-versus-improved comparison;
- critic and verifier findings;
- promoted, deferred, and rejected lessons;
- the exact next experiment;
- a clear continue, revise, or stop recommendation.

Gemini

Create an evidence-learning research agent

A research and synthesis agent that must reason across a large source packet, keep a claim ledger, and improve its retrieval and citation policy over repeated briefs.

Create a bounded self-improving research agent for this workspace. If workspace tools are available, create the artifacts directly; otherwise, produce an exact file plan and runnable protocol for an implementation agent.

Operating definition:
"Self-improving" means the system gets better through verified run artifacts, curated memory, improved tests, revised rubrics, and controlled retries. Do not claim to retrain or modify model weights.

Safety boundaries:
- Preserve existing work and inspect the current state before changing anything.
- Never perform destructive cleanup or any irreversible action—publishing externally, sending messages, spending money, or changing production state—without my explicit approval.
- Keep generated lessons as candidates until a human reviews them.
- Never collect or persist secrets in experiment logs.
- Stop when the verifier cannot distinguish progress from repetition.

Research mission:
Turn a source packet into a useful field guide while learning which retrieval, synthesis, and citation rules improve factual support and reduce human repair.

Agent architecture:
- Planner: decomposes the research question and identifies uncertainty.
- Retriever: gathers only sources needed to resolve the uncertainty.
- Synthesizer: drafts claims and practical implications.
- Evidence auditor: checks whether every material claim is supported by the linked source.
- Curator: proposes changes to the research rubric for the next run.

Required artifacts:
1. source-inventory.md with source type, authority, date, relevance, and limits;
2. claim-ledger.csv or an equivalent table with claim, source, supporting passage or timestamp, confidence, inference label, and contradiction status;
3. draft.md with clear separation between source-backed findings and interpretation;
4. audit.md listing unsupported claims, citation mismatches, missing counterevidence, and overconfident language;
5. run-manifest.json with prompt version, queries, sources opened, claims checked, audit failures, revisions, human edits, and candidate lessons;
6. memory-candidates.md with evidence, scope, counterexample, and review status.

Experiment design:
- Run a baseline synthesis using the initial rubric.
- Measure citation coverage, citation correctness on a manual sample, unsupported-claim count, contradiction handling, retrieval precision, human edit distance, and time-to-accepted-draft.
- Change one policy for the second run, such as uncertainty-triggered retrieval, mandatory contradiction search, or claim-level citation checks.
- Use a comparable question or a controlled replay.
- Keep the policy only if support quality improves without making the result materially less useful or disproportionately expensive.

Operational rules:
- Search when the model expresses a knowledge gap; do not retrieve indiscriminately.
- Prefer primary sources for technical claims.
- Label inference instead of laundering it into fact.
- Do not use citation count as a proxy for citation quality.
- Ask for human review on significance, taste, and recommendations.
- Stop after two repair cycles if the same unsupported claim pattern remains; report the limitation instead of polishing around it.

At the end, deliver the field guide, the full evidence ledger, baseline comparison, verifier false-positive sample, promoted and rejected research rules, and a recommendation for the next controlled experiment.

Seven-day practice

Run one small learning loop before you build an agent platform.

Keep the task class stable, change one variable at a time, and refuse to promote a lesson without evidence. The purpose of the week is not maximum autonomy. It is trustworthy improvement.

  1. Day 1

    Choose one repeatable task and write its exact done signal.

  2. Day 2

    Run a baseline with the current prompt and preserve the full trajectory.

  3. Day 3

    Build a verifier matrix and manually audit one passing check.

  4. Day 4

    Introduce a bounded retry or parallel-sampling step only where uncertainty is high.

  5. Day 5

    Turn failures into candidate lessons with scope and counterexamples.

  6. Day 6

    Replay a comparable task with one—and only one—candidate lesson.

  7. Day 7

    Compare the runs, promote cautiously, and choose continue, revise, or stop.

Source shelf

Read the claims at their source.

Start with the course and playlist, then use the papers to separate measured results from this field guide’s interpretation.

Course syllabus ↗Nine-lecture playlist ↗
01Stanford CS329A: Self-Improving AI Agents

Official Autumn 2025 course schedule and reading list.

Open source ↗
02Large Language Monkeys

Repeated sampling, inference scaling, and the generation-verification gap.

Open source ↗
03Scaling LLM Test-Time Compute Optimally

Adaptive compute allocation and prompt-difficulty effects.

Open source ↗
04Let’s Verify Step by Step

Outcome supervision, process supervision, and step-level reward modeling.

Open source ↗
05ReAct

Interleaving reasoning with actions and environmental observations.

Open source ↗
06Language Agent Tree Search

Search over reasoning and acting trajectories.

Open source ↗
07STaR: Bootstrapping Reasoning With Reasoning

Iterative rationale generation, filtering, rationalization, and fine-tuning.

Open source ↗
08Measuring AI Ability to Complete Long Software Tasks

Task-completion horizons and long-horizon reliability.

Open source ↗
09Measuring Faithfulness in Chain-of-Thought Reasoning

Why visible reasoning should not be assumed to be a faithful causal explanation.

Open source ↗