Back to website
Mayank Aggarwal Learning Center

Phase 07 · AI-Assisted Engineering with Claude CodeLesson 3 of 4

Harness & Loop Engineering

Results depend on the system around the model, not just the model.

  • 27:53 video
  • 2 min read
  • Intermediate
01

The problem

Two developers can use the exact same AI model and get completely different results. The difference is rarely the model; it's everything around it. Harness engineering is the practice of designing that surrounding system (context, tools, permissions and feedback loops) so the agent reliably produces good work.

02

The concept

Model + harness = results#

PartWhat it includes
ModelThe LLM's raw capability
ContextWhat the agent knows: instructions, project notes, relevant files, examples
ToolsWhat it can do: read and edit files, run tests, search, call APIs
PermissionsWhat it's allowed to do without asking
Feedback loopsHow it finds out whether its work is correct

Feedback loops: the biggest lever#

An agent that can check its own work is dramatically more reliable than one that can't. Give it ways to verify:

  • Tests: "run uv run pytest after every change and fix failures"
  • Type checkers and linters: catch whole classes of mistakes instantly
  • Running the app: start the server and request the endpoint
  • Screenshots for UI work: compare what's on screen with what was intended

Loop engineering: act → check → fix#

Instead of hoping for a correct answer in one shot, design a loop:

The check-and-fix loop

  1. Make a change
  2. Run the checkstests, lint, build
  3. Read the results
  4. Fix what failedthen run the checks again

Stop when all checks pass, or after N attempts, then ask a human

This turns "the model guesses" into "the model converges". Each iteration uses real evidence, not assumptions.

Good context beats long prompts#

  • Specs over vibes: "Return 404 with {"error": "not found"} when the ID doesn't exist" beats "handle errors properly".
  • Point to examples: "Follow the pattern in routes/users.py."
  • Small tasks: a focused task with clear acceptance criteria is easier to get right than a vague large one.
  • Persistent notes: project conventions in CLAUDE.md so you don't repeat them.

Permissions: safe by default#

Let the agent freely read files and run tests, but require confirmation for risky actions: deleting files, pushing to production, running database migrations, spending money. Good harnesses make the safe path the easy path.

03

Try it

Your task · about 10 minutes

Add one feedback loop to your agent setup, such as a test command or a linter, and ask Claude Code to keep going until it passes.

04

Recap & next

Key takeaways

  1. An agent's results depend on the model plus its "harness": tools, context, permissions and feedback loops.
  2. Give agents a way to check their own work, such as tests, linters, type checks or screenshots.
  3. Clear specs and small tasks beat long, vague instructions.
  4. Loops (act → check → fix) let agents converge on correct results instead of guessing once.

Quick check

2 questions · instant feedback

1What most improves an agent's reliability?
2An agent "harness" refers to…

Finished this lesson?

Mark it complete to track your progress and keep your streak going.

Next