The Agent is the Model. The Code is Just a Vehicle.

4 min read Tiếng Việt
Featured image for shareAI-lab/learn-claude-code — The Agent is the Model. The Code is Just a Vehicle.

⚡ TLDR

  • Stop Engineering Intelligence: Most agent frameworks try to code intelligence with massive rule trees; this teaches you to build the “harness” and let the model do the thinking.
  • The Price of Plumbing: If you rely on complex prompt-chain orchestration, your agent becomes fragile, unscalable, and incapable of true generalization.
  • Bare-Metal Architecture: Built for engineers who want to understand the architecture of systems like Claude Code without the abstraction layers.
  • No Drag and Drop: It completely ignores no-code logic and drag-and-drop workflows, boiling the agent down to a single loop computing tool calls.
  • Universal Pattern: If you need an AI that manages a farm, you don’t rewrite the agent; you write the API tool handlers for sensors and give them to the model.

I asked for one feature. It gave me five. The code compiled. For a moment I felt clever. A little later, the bill arrived.

We have spent the last year convincing ourselves that if we just write enough glue code, an autonomous agent will magically emerge. We stack procedural logic, build node graphs, and chain prompts into waterfalls. We wedged a multi-billion parameter neural network into an if-else statement and called ourselves AI developers.

[learn-claude-code] is a collection of 12 progressive Python scripts. It strips away the delusion. It is a bare-metal deconstruction of how Anthropic’s Claude Code actually works under the hood.

The mental model is simple. A human is the driver. A car is the harness. You do not code the human; you build the steering wheel, the pedals, and the dashboard.

Two builders. One grabs the saw immediately and builds a massive decision tree to parse every possible AI response error. The other writes a single tool handler that executes a command and feeds the standard output back to the model. The first feels faster. The second’s agent is still running six months later.

Bash Is All You Need

When you strip away the marketing, every true agent operates on one fundamental loop. The model decides. The code simply executes.

# The absolute minimum agent harness (Session 01)
def agent_loop(messages):
    while True:
        # 1. The model observes and reasons
        response = client.messages.create(model="claude-3", messages=messages, tools=[bash_tool])
        messages.append({"role": "assistant", "content": response.content})

        # 2. It chooses to act or stop
        if response.stop_reason != "tool_use":
            return

        # 3. The harness executes
        for block in response.content:
            if block.type == "tool_use":
                output = subprocess.run(block.input["command"], shell=True, capture_output=True)
                messages.append({"role": "user", "content": [{"type": "tool_result", "content": output}]})

A developer who has never seen this repo should think “oh, I get it.” The agent is just a while loop that refuses to terminate until the neural network decides it has no more tools to call.

The Evolution of a Harness

The repository walks through 12 stages of “Harness Engineering”:

FeatureThe ProblemThe Harness Solution
SubagentsThe context window fills with garbage.Spawn a new messages array for a specific sub-task.
PersistenceThe agent forgets what it was doing.Write a task_1.json file to the disk.
BackgroundingOperations like npm install take 40 seconds.Run in a daemon thread, inject completion into the event loop.

An estate management agent is a model connected to property sensors and tenant communications. An agricultural agent is a model connected to irrigation controls. The intelligence is a solved problem. The harness is your job.

But there are tradeoffs. This is a teaching tool, not a production-ready framework. You will not find advanced resource polling, OAuth workflows, or robust sandboxing here. If you unleash the full script on your machine without a Docker container, you are one hallucinated command away from an extended weekend. The plugin ecosystem does not exist. You have to write your own subagent loops.

In the end, it makes you realize how much time we waste trying to outsmart a system that has read more code than humanity has ever produced. The word “agent” has been hijacked by a cottage industry of prompt plumbing. Just give it hands. It knows what to do.

Hoang Yell

Hoang Yell

A software developer and technical storyteller. I spend my time exploring the most interesting open-source repositories on GitHub and presenting them as accessible stories for everyone.