← Back to list

What If a Document Could Think?

By: Gregory Betti

Gregory Betti · 2025-12-18 07:42 · 9 claps · 3.3 min read
#computer-science #tecchnology #html5 #artificial-intelligence
Open on Medium ↗
Wiki topics: AI · AI · General 🌐 · Web Development 🔬 · Science · General

What If a Document Could Think?

By: Gregory Betti

We usually think of documents as passive things.

They store information. They preserve snapshots. They wait to be read.

But what happens when a document can act?

I recently published a paper titled Portable HTML Agents: Deterministic Autonomy Inside a Single File. On the surface, it describes an autonomous agent implemented entirely inside one self-contained HTML document. No servers. No cloud. No external dependencies.

What surprised me while building and formalizing this system is that the technical result was not the most important part.

The important part was realizing that the file itself became the agent.

The Core Claim

Most modern AI agents are distributed by default. Their logic lives in one place, their memory in another, their execution somewhere else entirely. That fragmentation makes them powerful, but it also makes them hard to archive, audit, migrate, or reason about as complete entities.

This work explores the opposite constraint.

What if an autonomous agent could exist as a single artifact, where its identity, logic, and state are inseparable?

In the system described in the paper, the HTML file is not just a container. It is the canonical source of truth. The agent’s memory is embedded directly inside the document as human-readable JSON. When the file is opened, that embedded state overrides any residual state in the execution environment.

This principle is formalized as artifact authority.

If the file moves, the agent moves. If the file is archived, the agent is archived. If the file is inspected, the agent is inspectable.

Nothing else is required.

Determinism by Design

The agent operates according to a strict and observable lifecycle:

boot load think act persist

Each cycle is logged. Each action increments a deterministic internal clock. Execution sessions are grouped into epochs so behavior can be audited across runs, even when the agent migrates between environments.

This is not about creating intelligence that feels unpredictable or magical. It is about making autonomy transparent.

Given the same initial state and inputs, the agent behaves the same way every time. That property is rare in modern agent systems, which often rely on opaque infrastructure and non-deterministic components.

Here, determinism is not an optimization. It is the point.

Why Single-File Matters

A single-file constraint sounds trivial until you actually enforce it.

No build steps. No package manager. No backend. No network dependency.

Just a file that can be emailed, versioned, forked, or archived, and still function as a complete autonomous system.

This has consequences.

It means an agent can be preserved exactly as it existed at a point in time. It means its behavior can be audited with nothing more than a browser or a text editor. It means knowledge can be stored not just as static text, but as executable reasoning.

The document stops being a record of thought and becomes a participant in it.

What This Is Not

This is not a replacement for large language models. It is not a secure enclave. It is not designed to resist a malicious host.

The paper is explicit about these limitations.

The transparency that enables auditability also enables tampering. The determinism of the system depends on the determinism of the logic embedded within it. The browser sandbox constrains what the agent can do.

Those tradeoffs are intentional.

The goal is not maximum power. The goal is maximum inspectability and portability.

Why This Framing Matters

There have been executable papers before. There have been browser-based tools. There have been offline web applications.

What is different here is the framing.

The agent is treated as a file-native entity. Its identity does not extend beyond the artifact. Its state is inseparable from its representation.

That reframes how we think about autonomy, reproducibility, and preservation.

If an agent can be archived like a document, then autonomy becomes something that can be versioned, cited, and shared without infrastructure.

That is a subtle shift, but a meaningful one.

Where This Leads

Portable HTML agents open up new possibilities:

Offline educational artifacts that explain themselves Auditable autonomous workflows Reproducible agent experiments Censorship-resistant knowledge preservation

This work is not the final word. It is a foundation. The paper outlines future directions including formal verification, richer deterministic toolsets, and multi-agent composition through file-based handoffs.

But the core idea stands on its own.

Sometimes the most interesting progress does not come from adding more layers, but from collapsing boundaries.

In this case, the boundary between document and agent disappeared.

Paper and Explainer

The full paper is available here: https://www.academia.edu/145460977/Portable_HTML_Agents_Deterministic_Autonomy_Inside_a_Single_File

I also published a short video explainer generated with NotebookLM for a more accessible walkthrough. https://notebooklm.google.com/notebook/3b9e5bef-6aa3-4bb7-a94d-915f4080b9f6?artifactId=c68cace1-12a1-4cee-a30b-feee2b436095

This started as a technical experiment. It ended as a reframing of what a document can be.

And I suspect we are only beginning to see where that leads.


메타데이터
post_id
8bb5e69b3fb2
slug
what-if-a-document-could-think-8bb5e69b3fb2
url
https://medium.com/@GregoryBetti/what-if-a-document-could-think-8bb5e69b3fb2
canonical_url
https://medium.com/@GregoryBetti/what-if-a-document-could-think-8bb5e69b3fb2
author_url
https://medium.com/@GregoryBetti
status
ok
fetched_at
2026-08-01 08:10:55