Model Mechanics Explainer 4

Loops and skills

A harness lets the model act one step at a time. Skills give that loop the right procedure only when it needs it.

A loop doesModel, tool, result, repeat
Each lap costsNew tokens plus the context read again
A skill savesAlways-on instructions and rework

The language model reads tokens and produces tokens. It does not run a test or edit a file by itself. Software around the model, called the harness, reads a requested tool call, runs it, and gives the result back to the model.

That cycle turns one prediction into a worker: ask, act, inspect the result, and decide what comes next. The context grows on every lap because the tool call and its result both become more tokens.

See the loop as code
context = [system_prompt, tools_schema, user_request]
while True:
    output = model(context)          # one forward pass per token
    if output.is_answer:
        return output                # the model chose to stop
    result = execute(output.tool_call)
    context += [output, result]      # both are tokens
1
Follow three tool laps.

Watch the result return to context each time. Track the meter until the model chooses an answer.

45 seconds
Figure 1The agentic loop
Context
4%
Each lap adds the tool call and result to the context. The model ends the loop by answering instead of asking for another tool.
Cost link: the model rereads the growing context on each lap. A short result and an early test can save tokens on every step that follows.

Put verification inside the loop. An agent that tests after each edit gets useful feedback on the next lap. Waiting until five files have changed makes the next step sort through several guesses at once.

Give the loop a stop condition and a budget. Without them, a model can keep finding one more check to run.

Loops that outlive the session

A scheduled loop starts with a fresh context on each run. It remembers last night only if it wrote useful state to a file and reads that file when it wakes. The harness owns the schedule; the file carries the history.

Match the check rate to the signal. Polling every minute for a change that happens daily spends tokens on repeated "nothing changed" results. Use an event trigger when the system can provide one.

Skills: procedure as files

Teams repeat procedures: how to deploy, how to run a difficult test suite, or how to handle an incident. Putting every procedure in every prompt wastes context on instructions the current task does not need.

A skill stores one procedure in a named file. The model always sees a short description, then loads the full instructions only when the task matches. Forty short descriptions can replace forty full procedures in the starting context.

2
Watch the task choose one skill.

Notice what stays small before the match, then watch one full procedure enter the context.

30 seconds
Figure 2A skill loads on demand
Incoming task
Context
Short descriptions stay in context. One full procedure loads after its description matches the incoming task.

A skill lives in a repository, so a team can review, version, and change it without retraining the model. The next matching run reads the new file.

Keep instructions in the right place. The request states today's job. Memory stores durable facts. A skill stores a reusable procedure.

Try the decision

3
Current request or reusable skill?

Choose where each instruction belongs, then check the reveal.

1 minute
DECISION 1 OF 3 · REQUEST OR SKILL

Loops and skills compose

A recurring agent combines a schedule with a skill. The schedule says when to run. The skill says which files to check, what counts as urgent, and what state to save for the next run.

Working defaults

Leave with this
  • The harness runs tools; the model chooses the next token or tool call.
  • Each lap grows the context, so verification and stopping rules control cost.
  • Skills keep reusable procedures out of unrelated requests.