Essay

What is a mind? Taking iterate apart

After shipping two small apps on an iterate mind in an afternoon, I forked iterate/core to understand what I was standing on: one public door, event logs everywhere and code that deploys itself.

iteratecloudflareagentsarchitecture

All writing

How I got here

This work started small, with an iterate mind and two small apps. A coding agent connected over MCP gets exactly one tool, run, which takes a JavaScript function and runs it inside the mind with a handle called itx.

With that one tool, I asked for jokes on the homepage, and a few minutes later the homepage was a jokes page. Afterwards, I asked for a private, Gmail-style inbox for the mind’s email, which took longer, although not by much.

Both changes worked; however, I did not understand why they were so easy. So I forked iterate/core and started reading, and this post is my first map of it.

A mind at a glance

A mind is one deployment of iterate: a small stack of Cloudflare Workers that runs in your own Cloudflare account, at your own domain. It holds AI agents, their memory, git repositories, secrets and the web apps you write.

A Worker is a small program that runs on Cloudflare’s servers. Specifically, a mind is four of them, or five with the optional telemetry.

Essentially, everything below comes down to one idea: a mind is a set of event logs, plus code that reacts to them, behind one door.

One door in, one door out

all of it in your own Cloudflare accountVisitorbrowser, mailBoundarythe only publicway into the mindAuthsign-in, membersMindcontexts, your codeSecretsthe vaultOutside APIsGitHub, OpenAI
The boundary sees every request to the mind, and only the vault holds secrets. Optional telemetry has its own public workers.dev intake.

Each Worker has one job, as the table below shows:

WorkerJob
BoundaryThe only public way into the mind. Every request to the mind comes in through it, and it labels each request with who is calling. Every request that leaves with a secret also goes out through it.
AuthSign-in (passkeys or emailed codes), and the list of members.
MindThe mind itself: its contexts, its repositories, and the owner’s own code.
SecretsThe vault. It adds a secret to an outgoing request, after an approval if a rule asks for one.

The optional telemetry Worker has its own public workers.dev intake for telemetry.

From my perspective, the important word here is label. In other words, your code never decides who a visitor is. Instead, the boundary works that out and stamps it on the request before your code sees it, and a guard in your code then reads that stamp. For instance, an app is private because of one line in the case that serves its subdomain:

case "my-app":
  return app.open?.(request) || this.auth.require(request) || app.fetch(request, this);

this.auth.require lets a member through and turns anyone else away. Thus, a signed-out request to a guarded app gets 401 Sign in and nothing else.

Everything is a context with a log

The second idea took me longer to see: a mind does not have a database in the usual sense. Instead, it has contexts.

Specifically, a context is an address, such as /integrations/email or /agents/onboarding. Each one is a Cloudflare Durable Object, which is a small server with its own storage, and it keeps an append-only event log in SQLite. Thus, anything that happens in the mind is an event added to some context’s log.

Mail arrives/integrations/emailemail/receivedYou commit/repos/configcommit-completedYou message/agents/onboardingmessage-receivedworker.tsprocessEventsees everyevent
A mind is event logs plus code that reacts to them.

For instance, when an email reaches hello@ on the mind’s domain, nothing fetches it from a mail server; instead, the platform appends an email/received event to /integrations/email. Similarly, when I commit code, a commit-completed event lands. When I message an agent, an agent/message-received event lands on that agent’s log, and that log is the agent’s memory.

However, the event’s name depends on who writes it. The default template’s own code hands mail, Slack and X messages to an agent as a different event, agent/context-added. Thus, there are two names for incoming words today, and part two returns to them.

The owner’s code has one function, processEvent, that sees every event from every context and decides what to do. The default template, for example, uses it to hand each email thread from a member to an agent of its own.

Consequently, my mail app was easy. It reads one log and groups the events into conversations, and sending a message calls itx.email.send, which appends an email/sent event to the same log.

Your code is a repo that deploys itself

Rather than being deployed from a laptop, the owner’s code lives in a git repository inside the mind, at /repos/config.

the code lives inside the thing it runsedit, commit, repeatCommit/repos/configLoadWorker Loader,fresh isolateInit hookworker-updatedeventLivewithin seconds
A commit is a deploy. There is no build step and no separate pipeline.

In this setup, a commit to that repository is a deploy. The mind Worker loads the new code with Cloudflare’s Worker Loader, which runs code in a fresh, isolated sandbox. Then the platform appends a worker-updated event, which runs your init hook, and the site serves the new commit within seconds.

In addition, there is no build step. A file such as index.html is imported as text, and a folder import gives you every file in it. Thus, a whole app is a folder under apps/ and one case in worker.ts.

For the same reason, a coding agent can change a site with one tool: a script that reads a file, edits the text, commits it with the old tip as the parent and waits for the worker-updated event. Using the old tip as the parent means the commit is refused if someone else committed first.

Secrets your code never sees

A secret’s value never reaches the mind’s code; instead, your code writes a placeholder where the secret should go:

itx.fetch(
  new Request('https://api.github.com/user', {
    headers: { authorization: 'Bearer getSecret("/secrets/github", { field: "accessToken" })' },
  }),
)

On the way out, the boundary sees the placeholder and passes the request to the secrets Worker. The secrets Worker then fills in the real token, but only for the host that the secret is pinned to. Additionally, a member can add a rule that makes a request wait for their approval with a passkey before it goes. Thus, an agent with full access to the mind can use your GitHub token, yet it cannot read it, print it or send it to another host.

What I built on it in an afternoon

  • A jokes homepage. This needed a new home.html file and a three-line change in worker.ts.
  • A private mail app, for members only. It has an inbox, sent mail, conversations, replies in the same thread, and a composer that sends from any address on my domain. Additionally, formatted email is shown with scripts and remote images blocked, so a sender cannot track when I open it.

On 13 November, iterate published its own version of the mail app: Read your mind’s mail in a browser, with two files. It is a read-only inbox for members, made of a 4 KB page and about twenty lines of server. Furthermore, the post names three choices that make it safe to leave running:

iterate’s choiceWhat it prevents
The app answers GET and nothing elseNothing on it can send, delete or reply.
Every answer says no-storeThe browser keeps no copy of the mail.
The page has a strict content security policyA mail full of HTML cannot run anything in the page.

My app shares the third idea, since it blocks scripts and remote images in formatted mail. However, the first choice does not hold for it. Theirs cannot send at all, whereas mine has a composer that sends from any address on my domain. Consequently, my app carries a risk that theirs does not, and it has to stay behind the member guard. For the same reason, the checklist in part two starts with an approval rule for outbound mail.

Additionally, every email a mind sends carries an Auto-Submitted: auto-generated header. The header marks the mail as automated, including mail I write by hand.

Automated mail from another mind’s agent is a separate case. Part two’s routing section explains the peer allow-list and hop limit that control how minds exchange mail.

What I want to study next

  • The loop guard (core/itx/src/cause.ts). Each act carries a depth counter, and past a limit the mind may read but not act. In essence, this is how iterate stops agents from triggering each other forever.
  • The boundary’s stamp (core/boundary-worker/src/stamp.ts). This is where “who is calling” is decided; hence, it is where the security model starts.
  • Home lab (core/home-lab). It runs the real mind Worker on your own machine, while the door, sign-in and vault stay in the cloud.

Finally, a note on the repo itself: iterate/core is a read-only copy of iterate’s own repository, made with Copybara, so pull requests are turned off. My fork is for reading and experiments. As for licences, the SDK and the templates are Apache-2.0, and the rest is AGPL-3.0.

Part two, Inside a mind: agents, Cloudflare and trust, builds on this map.


References