The AI-friendly HTML file
Connect an HTML file to a program, read its content as JSON, and ask your agent to edit it from within the page.
My agents were creating about 5 files a minute in my projects folder. Spotlight couldn't keep up. Its indexing was burdening my whole system.
I couldn't even use Spotlight to search. It was too slow.
So I turned off Spotlight and built my own search app, with ripgrep searching file contents and fd finding filenames. The problem was it didn't have a good UI.
So I built a UI in... an HTML file :)

Now I can type into a search box and the matching files appear after a short pause. It's soooo much better than Spotlight.
I've been coding so much with AI lately that I want HTML files to work better with agents. I built three features so you can work better with AI agents locally too:
Connect a page to a program on your computer
The search app is one HTML file that talks to a program on my computer through HTML Clay.

The page lives in search.htmlclay. It sends my query and chosen folder through HTML Clay to a program called clay-search, which returns the results as JSON.
One tag in the page names the program it wants to use:
<meta name="htmlclay-helper" content="search">
The tag says search, but I get to choose which program on my system answers to that name.
HTML Clay asks permission before a page can use a program on your computer. An approved program runs as you and can read or change any file your account can access, so only allow programs you trust.
Get the search app to try it on macOS or Linux. The programs guide covers permissions and connecting a page to your own script.
Get structured data from HTML files
As a person, I want a page that looks nice and is easy to read. My computer just wants the data.
When it's easy to extract JSON from an HTML page, you get both.

For a personal page with a heading and a list of hobbies, these rules select the heading and each hobby:
{
"title": "#hobby-title",
"hobbies": ".hobby-name[]"
}
Send those rules with a request to the page's address, and HTML Clay returns:
{
"title": "My hobbies",
"hobbies": ["Building model towns", "Blending herbal tea", "Tracking bird migration", "Proposing new public holidays"]
}
You send the rules with your request, so you don't have to change the page.
A program or agent can also write changes back with the same rules. These rules change text. Other rules can change allowed attributes, but writes cannot insert scripts, styles or event handlers.
A page can also read and write its own JSON. Download the JSON demo and open it with HTML Clay. Edit the hobbies and click Get JSON to read the saved content. Switch to Set JSON, then click Change the title or Add a hobby. The JSON request updates the page. The JSON API guide covers the rest.
Talk with your agent inside an HTML file
It should be easy to integrate your agent's chat with any app on your computer.

An HTML file can talk to your AI agent through HTML Clay.
You need an HTML file that loads ClayJS with the ai-edit plugin, and Claude Code or Codex installed and signed in locally. Open the file in HTML Clay or Hyperclay Local and make sure AI Editing is checked in the app's menu.
- Select a phrase in a paragraph and press ⌘J on macOS or Ctrl+J on Windows and Linux.
- Type what you want changed, such as "Shorten this sentence", then press Send. The panel closes and a bottom bar shows progress and Stop.
- The rewrite appears in place. Click Keep to save it into the file, or Revert to put the old words back.
Download the AI editing demo and click Edit with AI. The suggested request is “Make a chart of this table's data and place it above the table”. Send it, then click Keep to save the result or Revert to restore the original. The AI edit guide covers setup.
Your agent can also edit the file directly while you have it open. When it changes a task, the page updates without a reload. Live updates preserve your cursor and unrelated edits. If another writer changes the same text, its change can replace unsaved text.

This all works because of the ClayJS sync and ai-edit plugins. Check out the live updates guide to see how live-syncing works.
It runs on your computer
HTML Clay runs on your own computer. It works on macOS, Linux, and Windows. AI editing sends the selected HTML, your request and any included context to your agent, which may contact its model provider.
I write these programs that can be called from an HTML file myself, for tools on my own system. I'd think hard and be careful before running one written by someone else.
Start with a working example: download the JSON demo or the AI editing demo. Open it with HTML Clay and try the buttons. Then change the file to make it your own.