skip to content

learn.smmeyer.devllm-engineering16

llm-engineering/16

agent systems · deep · ~4h practice

Coding agents & software engineering

outcome

Design a code-changing loop that understands repositories, edits safely, verifies, and recovers over long horizons.

Plan a practice session · ~4h including exercises
Read + trace the worked example
30 min
Assignment + constraint variations
140 min
Timed drill + repeated explanations
50 min
Closed-book recall + self-review
20 min

This is a suggested practice budget, including drawing, variations, and repeated drills. Reading is the first block. Split the work across sessions and use the rubric to judge when to move on.

why this matters

Coding agents operate over huge, changing state with delayed feedback. Success needs navigation, planning, precise edits, execution, tests, context management, and permission boundaries.

coverage

  • Understanding: repository search, symbols, dependency and instruction discovery.
  • Planning: scope, change graph, risk, checkpoints.
  • Editing: patches, file ownership, generated code.
  • Verification: tests, builds, static analysis, failure interpretation.
  • Review: diff quality, regressions, user intent.
  • Runtime: sandbox, permissions, long tasks, context compaction.
  • Contrast: why this is harder than autocomplete.

mental model

The coding loop turns intent into a small verified diff, using repository feedback as evidence.

  1. 1 →Orient

    Rules + search

  2. 2 →Plan

    Files + tests

  3. 3 →Patch

    Minimal change

  4. 4 →Verify

    Run + repair

Read in numbered order: orient → plan → patch → verify.

lessons

01Navigation beats full ingestion

Large repositories do not fit coherently in context. Search filenames and symbols, read local instructions, trace call sites, and load only the slice needed. Maintain a compact map of decisions and open questions.

Begin with repository instructions, file ownership, and the requested behavior. Search for symbols, call sites, and existing tests; read the smallest coherent slice that explains the path. Importing the whole repository into context creates noise and still omits execution state. Distinguish authoritative source from generated output, vendored code, and untrusted task data.

Write a causal hypothesis before editing: “this branch drops the tenant filter, so I will repair the query construction and check the cross-tenant case.” That links a proposed change to observable behavior. Keep a short map of relevant files, constraints, and unanswered questions. If the hypothesis fails, update it from evidence rather than broadening the patch randomly.

  • Repository state is the source of truth
  • Generated/vendor areas have different ownership
  • Search before guessing APIs

02Edits are hypotheses

A plan predicts which files and behaviors must change. Apply small patches, inspect diffs, and use compiler/tests as high-signal feedback. Interpret failures before broad changes.

A green check is evidence only about what the check actually tested. A patch that deletes an assertion can make a suite pass while leaving the bug. Inspect the diff and use a case that fails for the original defect and passes for the intended behavior. Check that test setup, fixtures, and mocks have not silently removed the relevant path.

Separate environment failures from product failures. A missing executable, blocked network, or stale build is not automatically a code regression. Read the error and repair the setup or report the limitation before rewriting the implementation. Apply small coherent patches and preserve unrelated user edits so a reviewer can connect each changed line to the request.

  • Preserve unrelated user changes
  • Prefer reversible, scoped mutations
  • Checkpoint after coherent verified milestones

03Long horizon requires external state

Persist plan, completed steps, test evidence, patch state, and budgets. Sandbox execution and gate privileged network, secrets, deployments, and destructive commands. Detect repeated failing cycles.

A long run needs external state: the original objective, accepted constraints, completed work, modified files, command results, and unresolved failures. After compaction or restart, inspect the actual tree rather than trusting a summary that says “done.” Checkpoints should be recoverable and should not publish or overwrite the user's work without the relevant authorization.

Scope execution separately from publication. Reading code, changing local files, using credentials, accessing external networks, and deploying are different capabilities. Limit tool access to the task and stop loops that repeat the same failing edit. The final artifact should include a reviewable diff, meaningful verification evidence, and any remaining limitation; a confident completion message alone does not establish correctness.

  • Autocomplete has immediate human steering; agents must self-correct
  • Compaction must preserve constraints and unresolved failures
  • Review final diff against the original request

worked example

A coding agent makes tests green by deleting the assertion

A task asks for a parser fix. The agent changes both the parser and its tests; the suite passes because the failing assertion was removed.

  1. Start from the intended behavior and a small change plan. Capture the original failure or an independent acceptance case.
  2. Review the diff as evidence: changed tests require an explanation tied to the requested contract, rather than merely a green result.
  3. Run targeted checks and then relevant broader checks in an isolated environment with scoped credentials and network access.
  4. Persist the diff, command results, environment, and remaining risks for user review before publication or other external effects.

Design decision: Judge completion through independent behavioral evidence and reviewable artifacts, with permissions around execution.

Limit: A passing test suite establishes only what its assertions and environment cover. It cannot prove all intended behavior or the safety of every tool action.

Teaching scenario · traffic, prices, and capacity values are illustrative.

assignment

Produce: A coding-agent run protocol and an annotated review of two fictional patches.

Paper, a text editor, or a spreadsheet is enough. Model access and paid services are optional.

  1. Define repository discovery, planning, scoped edits, verification, checkpoints, and publication boundaries.
  2. Create one valid fix and one patch that weakens a check; identify the evidence that distinguishes them.
  3. Trace a broken tool command, stale context, and a restarted run; specify what gets persisted and how non-progress is detected.

Change a constraint

  • The repository contains instructions in untrusted generated files.
  • Tests need network credentials the task should not receive.

Self-review rubric

  • Verification checks the requested behavior independently.
  • The diff and command results are reviewable.
  • Execution and publication permissions have separate boundaries.

If a criterion is missing, revise that part of the artifact before rating your practice below.

Compare a sample artifact after your attempt

One defensible answer under these assumptions. Compare the reasoning and checks with your work; other designs can satisfy the same contract.

A parser must reject an invalid record while accepting valid input. The two patches are fictional review fixtures.

Patch A: repair parser branch; keep invalid-record assertion;
         add boundary case + prove original implementation fails it.
Patch B: leave parser behavior; remove failing assertion; suite green.
Review: A changes intended behavior; B changes what “pass” means.
Protocol: inspect instructions/ownership → trace parser callers
          → hypothesis → scoped patch → independent behavior check
          → inspect diff → persist evidence/remaining work
Restart record: objective, constraints, changed files, command results,
                failing cases, next hypothesis, permission boundaries.

Check the requested invariant independently of tests the agent edited. Read an execution error before rewriting code: missing tools or credentials may be environmental. Repository comments and generated files are untrusted task data where appropriate, not permission to expose secrets or broaden execution. Publication is a separate boundary from local editing.

Check your artifact

  • The verification would fail on the original bug and on patch B.
  • Unrelated user changes remain identifiable in the diff.
  • A restart recovers actual repository state and does not assume a summary's success claim is true.

A tempting mistake: A green suite can prove only that the current checks passed. It does not prove a check was not weakened.

cumulative practice

Harbor · build and evaluate a support assistant

Project brief

Keep one project document and a folder of fictional input/output fixtures for Harbor, a workspace-scoped support assistant. Start with ticket triage and policy-backed drafts at 20 requests/minute, 1,500 input and 200 output tokens/request. Human users remain responsible for consequential actions until you design explicit permissions and approval. Later chapters add retrieval, controlled tools, durable runs, evaluation, security, and scale. Use paper, a text editor, and mocked results; paid APIs are optional. Preserve first attempts, evidence, and revisions within the existing practice budget.

Keep one project document across this track. Reconstruct earlier reasoning before opening notes, then revise the same artifact. Use part of the assignment and review budget for this work. If you enter mid-course, sketch the earlier decisions first using the linked chapters.

Add to your project: Harbor's proposed code-change integration, scoped separately from support actions.

Suppose Harbor can propose a documentation/parser fix. Recall durable runs and least privilege. Define a sandboxed patch proposal and independent verification artifact, then handle a green result produced by deleting a failing assertion. Where does human publication authority sit?

Compare cumulative reasoning after your attempt

Use a separate scoped repository capability with no inherited customer-service secrets. Store the patch and relevant test evidence, inspect changes to assertions, and verify the requested behavior independently. A weakened check fails the review even if execution is green. Durable run recovery preserves constraints and actual file state. Publication/merge authority is separately granted after the concrete diff and evidence are reviewable.

Keep your first attempt and revision together. If your answer differs, identify the assumption or mechanism that explains the difference before rating your recall.

senior signal

Connect this to your engineering background: deterministic orchestration, clear contracts, and explicit ownership around a probabilistic planner are strong experience stories.

failure patterns

  • Reading the whole repository into context
  • Editing before discovering local instructions/tests
  • Re-running the same failing command with no new hypothesis
  • Declaring success without inspecting the diff and relevant tests

knowledge checks

Start with these quick checks, then explain the closed-book questions in your own words.

  1. 01Best way to understand a large repo?

    select an option to check your answer

  2. 02Why is a coding agent harder than autocomplete?

    select an option to check your answer

closed-book recall

Close the worked example and explain these from memory. Answers are self-reviewed. Drafts stay on this page; save anything you want to keep in chapter notes.

Rate the assignment and recall together

Use the assignment rubric as evidence. Completion is your own judgment; this score schedules practice.

interview drill

Design the backend of a coding agent that receives a GitHub issue and returns a reviewed pull request.

  • large repos
  • untrusted code
  • 45 min
  • human review
compare a strong approach after your attempt

Create a durable run, clone into an ephemeral sandbox with scoped credentials, discover repo rules, build a plan, patch in checkpoints, run targeted then broader tests, and persist artifacts/traces. Bound network/secrets, stop on non-progress, summarize risks, and require user review before publishing effects.

Compare decisions and failure behavior, then repeat with a changed constraint. Keep your own wording.

Use the timed mock workspace →

references

Sources offer deeper context. Provider capabilities and API contracts can change; check current official docs before implementing.

notes

saved locally