@ai-agent-loop · live
The Agent Loop
Speed 1×
The harness — what every AI agent does, step by step
AI Agent · the harness ● running
~/repo · main
YOU
Context Window
12,288 tokens 38% full
THINK ACT OBSERVE the model
Activity Log
Steps 0 steps
Initialising… Click Step ⏭ or a phase pill to advance Loop #1 Step 0
Tools
Permissions
Tokens used — of 32k ctx
Context % — used
Test results — last run
Steps run 0 this loop
Loop count 1 completed
Fixes made 0 total

What is a Token?

Every word you type, every line of code, every response the model generates — it all flows through the same pipeline as tokens.

Live — this session

Tokens consumed right now

0
tokens used
of 32,768 context window

Each agent step reads files, generates plans, writes code — all consuming tokens from the context window.

Core concept

A token ≠ a word

"Hello world" = 2 tokens  |  "Tokenization" = 3 tokens  |  "🤖" = 3 tokens

On average, 1 token ≈ ¾ of an English word. Code tokens are shorter due to punctuation splitting.

Token types

Not all tokens are equal

📝
Word
"agent"
✂️
Sub-word
"tok" + "en"
⚙️
Special
<|end|>
💻
Code
"{" = 1
🌍
Unicode
多=3 tok
🔢
Number
1234 = 2
The tokenisation pipeline

Text → Tokens → Embeddings → Output

Raw text
your prompt
→
Tokeniser
BPE / WordPiece
→
Token IDs
[1342, 318, 257…]
→
Embeddings
768-dim vectors
→
Transformer
attention layers
→
Next token
sampled output

The agent repeats this for every tool call, every file read, every response — burning tokens until the task is done or the context window fills.

Context window — live view

What's filling the window right now

System prompt 38%
System prompt (~2k)
Conversation history
Tool results
Code / file contents
Available

🔧 Tools

The agent can only interact with the world through tools. No tool = no action.

Read

Read files

Reads any file from the repository. The agent uses this to understand context before making changes.

Grep

Search content

Searches for patterns across all files. Faster than reading each file individually.

Edit / Write

Modify files

Creates, updates, or deletes files. Every code fix, config change, or new file goes through here.

Bash

Run commands

Executes shell commands: npm test, git commit, build scripts — any terminal command.

📐 Context Window

The agent's working memory. Everything it has seen and done fits in here.

How it fills up

Every file the agent reads, every tool result, every thinking step — it all accumulates. When the window fills up, the agent can't take in more context without forgetting something.

In use 38%

🔒 Permissions

The harness controls what the agent is allowed to do without asking.

Allow

Auto-approve

Certain operations like reading files are always allowed. The agent doesn't need to ask.

Ask

Requires confirmation

Destructive or risky operations pause and wait for human approval before continuing.

Deny

Always blocked

Actions outside the defined scope are blocked entirely. The agent cannot override this.

This page 0:00
This session 0:00
Total (all pages) 0:00
Today 0:00
▶ Running
📊 View all study stats →
0:00 studying