# This AI Agent can actually self-evolve… just watch
<!--
ref: @content/youtube/david-ondrej/2026-04-27-space-agent-browser-native-self-evolving-agent
version: 3
updated_at: 2026-10-31T18:25:21.204Z
-->

Space Agent & Space Agent (David Ondrej, 2026-04-27): Jan argues that most agents are trapped in one layer of the stack: an agent on a VPS reachable through WhatsApp or Telegram can change its own backend but can never change how it presents itself to you, because the interface belongs to someone else.

*Synthesized from David Ondrej on David Ondrej, 2026-04-27.*

David Ondrej interviews Jan, creator of Space Agent and founder of Agent Zero, in a live walkthrough of Space Agent on its launch day.

## Core Thesis

Jan argues that most agents are trapped in one layer of the stack: an agent on a VPS reachable through WhatsApp or Telegram can change its own backend but can never change how it presents itself to you, because the interface belongs to someone else. Space Agent inverts this by running client-side in the browser's JavaScript runtime, so the agent can mutate the page it is rendered on — generating whatever UI a task needs, on demand, from scratch. David Ondrej frames this as a new category: agents that update markdown files or write skills are self-improving on the backend only; an agent that can build its own interface is self-updating all the way to the user.

## Key Insights

- The protocol is deliberately primitive. There is no JSON, no tool-calling schema. The model emits plain text; a special `__javascript` token (two tokens — underscore-prefix plus "javascript") marks everything after it as JavaScript to execute in the browser. No JSON escaping, no wrapper fields, no cost for a plain reply. A weather question plus response cost 97 tokens; generating the weather widget cost roughly 280.
- Browser control is equally lean. Pages are transcribed — not raw HTML or DOM — into a markdown-like format where every interactive element gets a reference number ("error button 51" for a red cancel button) and text stays text. A click is 19 tokens: open browser, click button 47. Jan adapted an HTML-to-markdown library heavily by hand, then had to inject hacks into the renderer to force-open shadow DOMs and iframes, which exist partly to defeat scraping.
- Page-state context is placed in a **transient** region after the last caching breakpoint, so it is replaced each turn instead of accumulating. Jan's reasoning: 2,000 tokens to show the agent a page is fine once, but kept in history it is 2,000 tokens forever — five page visits means 10,000 extra tokens on every subsequent turn. And deleting it later would invalidate the cache, so you pay again. A full session in the demo sat around 13,600 tokens.
- Jan wrote none of the system prompt by hand. He sketched an outline, then set up automated research in Codex to generate three variants per round — conservative, medium, and completely wild — plus test suites, and fed it failure scenarios to convert into new test cases. It iterated for days; the version shown was roughly number 250.
- Widgets persist because the agent never writes the widget directly — it writes a *function* that recreates the widget, and that function is stored. Refreshing the page rebuilds it identically, unlike an agent editing the live DOM.
- Every user directory and group directory is a standalone git repository with automatic change tracking, giving a time-travel control: roll the whole workspace back two hours, revert individual changes, or return to the present. Jan contrasts this with the usual repair path of pointing a second agent at the damage.
- An always-available admin mode covers total self-destruction: a fixed split view where the left pane is framework firmware that the agent cannot change, letting you talk to an agent, browse files, use time travel, and manage modules even when the main UI won't render.
- Architecture is modular all the way down — the agent writes its own modules on the fly, scoped per user, per group, or globally, so local inference and the file browser are just modules. Because execution is client-side, the demo server carries hundreds to thousands of users at roughly 2% CPU and 6% memory.
- Running in the user's browser sidesteps datacenter IP blocking: API and site requests originate from a residential connection rather than a VPS, which is a common failure mode for multi-step agent tasks.
- The backend is a thin Node.js layer handling permissions, accounts, and file storage — bundled into the native app so nothing leaves the machine, or self-hosted on a VPS for multi-user setups with group permissions. Jan advises against persisting anything on the demo server, where files get deleted.
- Model notes: the demo ran Opus 4.7. Jan built early versions on GPT 5.4 mini for near-instant responses (a "hi" answered in roughly 300ms) at lower reliability, and reports Gemma 4 evaluated at least on par with it — notable because Gemma 4 runs locally. Local inference accepts any MLX-format model from Hugging Face via a community repository of converted models; the one he started downloading was 10GB and needs a beefy GPU.
- David Ondrej ties the token-efficiency focus to pricing: with GPT 5.5 Pro around $180 per million output tokens, he expects harness choice to be judged on how efficiently it runs top models.
- Jan built Space Agent in about 25 days as one person without writing a line of code, versus three months of intensive manual work for Agent Zero's first CLI-only release — and estimates manual development would have taken a year or more, a 12-20x speedup by David Ondrej's math.
- Jan prefers Codex over Claude Code specifically because it follows an AGENTS.md hierarchy and keeps the files updated; he describes Claude Code drifting into fancy work and forgetting documentation, and one instance of it spending two hours and twenty iterations on a button alignment while repeatedly declaring it fixed. He notes he was on the $20 plan then and the $200 Codex plan since.
- Jan does not think coding is dead — he watches six Codex CLI windows and does nothing but hunt for bad decisions and inefficiencies, correcting the agent hundreds of times during the build.
- Stated limits: no OS-level access (can't install Linux packages or run a server — use Agent Zero for that), and no background jobs, because execution requires a live frontend. Agent Zero is instructed to run unattended and never stop to ask; Space Agent knows a human is present, so it will ask you to solve a CAPTCHA or log in, and its embedded browser is fully interactive for both parties.

## Actionable Takeaways

1. Try it with two clicks: space-agent.ai gives a temporary guest account; supply an LLM API key, which defaults to OpenRouter so one key reaches OpenAI, Anthropic, and Google models. Download the native app if you want persistence and local-only data.
2. Use a cutting-edge or one-step-below model. Jan and David Ondrej both warn off mini and flash models — writing correct JavaScript against a dense system prompt is not a lightweight task.
3. Adopt the AGENTS.md pattern regardless of tooling: a root file the agent always reads, plus a file at every level of the tree, documented as the code is written — how the module works, its core principles, and what not to do. This is the counter to the agent being unable to hold a growing codebase in context.
4. Put every preference in markdown in the repo. David Ondrej's rule: nothing unspoken should live in your head.
5. Structure long-lived agent context in two tiers — stable content before the caching breakpoint, volatile state (page transcriptions, widget source) after it — so repeated observations don't compound and you never invalidate the cache by pruning history.
6. Store generated UI as a builder function rather than as DOM mutations if you want it to survive a refresh.
7. Give any self-modifying system an escape hatch that it cannot modify: a fixed admin surface plus git-backed rollback beats debugging a broken agent with another agent.
8. Give each use case its own space — they cost nothing but a folder of text files on disk, a few kilobytes each, so there is no reason to consolidate.

## Notable Quotes

> "This is like a new paradigm of self-improving, self-updating agents." — David Ondrej

> "The agent can actually mutate the page that it's displayed on." — Jan

> "If you can tell your agent and it can rewrite the screen on the fly." — Jan

> "I didn't write a single line of code here. I used Codex for everything." — Jan

> "Everything needs to be in markdown files in the repo." — David Ondrej

> "If you break something you simply go back in time and undo it." — Jan

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*