Fregoli
A web application an agent can rewrite while it is running: capabilities are Cordis plugins mounted and unmounted in a live Node process.
· releases tagged
fregoli/vX.Y.Z
#What it is
Fregoli is a web application an agent can rewrite while it is running. Instead of editing files and restarting the process, capabilities are Cordis plugins that are mounted and unmounted in a live Node process. The name comes from Leopoldo Fregoli (1867–1936): one performer, many appearances, no restart of the show.
On start you get a canvas on port 8080 and an assistant chat in the lower right. Chat goes to the Grok CLI over ACP when grok is on PATH, otherwise to an in-process stub. Grok receives an MCP server that lets it observe the page, load and unload plugins, highlight elements and wait for the user to click.
The CLI is always fregoli in full, never freg.
#Current status
Last updated 26 September 2026 · main@95f9711
All 25 automated tests pass on the main branch in continuous integration, and the same suite passes on a local machine apart from the Docker build, which needs Docker. The tests show that Fregoli starts with its web page, agent connection and chat panel, and that chat messages reach a connected agent, or a simple built-in stand-in when none is available. New plugins can be loaded while the app runs and change the page without a restart, and a broken plugin is refused without disturbing what is already there. The agent can read the live page, highlight elements and wait for the user to click one. The latest release is fregoli/v0.3.2.
The tests use a stand-in for the Grok command-line tool, so chat with the real Grok CLI is not covered. There is no login on the web page or its HTTP interface, and the app always listens on port 8080 on the local machine only. Running it inside Hermetarium is recommended but untested end to end. Releases are source archives only. Seven issues are open. Three concern the container: the server is likely unreachable from outside it, the image leaves out some files, and a network tool Hermetarium needs is unverified. Two are small mismatches between the docs and the command line. One notes that the settings file is never written, so plugins loaded at runtime are gone after a restart. One notes that the spec says the agent's tool server is started differently than the code does it.
#Key concepts
Cordis kernel
The kernel is Cordis (npm cordis). Every capability is a plugin, or “fiber”, that can be mounted and disposed at runtime.
Web plugin
HTTP on TCP 8080: the canvas, the assistant slot, a JSON API and the page bridge (DOM snapshot, highlight, user click).
Agent plugin
Spawns grok agent --always-approve stdio and speaks ACP. Falls back to a stub without grok. Unloading the plugin kills the child.
Assistant plugin
Lower-right chat panel. A separate plugin: replaceable and removable. Starting with --assistant forces the stock one for that start.
Loader gate
Mounts extra plugins from fregoli.json or POST /load. A plugin whose apply fails does not become ACTIVE and does not replace the canvas.
MCP tools for Grok
src/mcp.ts: list_plugins, load_plugin, unload_plugin, observe_page, highlight, wait_click, reload_page.
#Getting started
Needs Node 22+. For a real agent, the Grok CLI on PATH (authenticated via Grok CLI login or XAI_API_KEY).
git clone https://github.com/pihme/fregoli.git
cd fregoli
npm ci
npx tsx src/cli.ts # http://127.0.0.1:8080/
npx tsx src/cli.ts --assistant # force the stock assistant UI
npx tsx src/cli.ts --versionRun the tests (the merge gate):
npm testContainer image (Hermetarium is a recommended habitat, not a requirement):
docker build -t fregoli:local .
docker run --rm -p 8080:8080 fregoli:localNote: the server currently listens on 127.0.0.1 inside the container, so the published port is likely unreachable from the host (see Current status).
Saved config lives in fregoli.json in the process working directory:
{ "assistant": true, "plugins": [] }Full CLI and HTTP reference: usage guide.
#HTTP API
Base http://127.0.0.1:8080. Selected endpoints:
| Path | Method | What |
|---|---|---|
/ | GET | Canvas + assistant slot |
/chat | POST | {"text":"…"} → reply (ACP or stub) |
/plugins | GET | Mounted fibers |
/load | POST | {"file":"/abs/path/plugin.ts"} |
/unload | POST | {"name":"draw"} |
/observe | GET | Serialized DOM of the most recently focused tab |
/bridge/* | GET/POST | Page bridge: snapshots, highlight, actions, reload, wait for user click |
#Architecture & layout
The agent plugin spawns grok agent --always-approve stdio and passes the MCP server spec in ACP session/new; Grok starts src/mcp.ts with FREGOLI_URL pointing back at this process. Shipped plugins (plugins/shipped/) mount at boot; runtime plugins via fregoli.json or POST /load.
| Path | Contents |
|---|---|
src/cli.ts, src/boot.ts, src/kernel.ts | CLI entry, boot sequence, Cordis context |
src/loader.ts, src/config.ts | Plugin loader/unloader, fregoli.json handling |
src/mcp.ts | MCP server handed to Grok |
src/plugins/{web,agent,assistant}/ | Boot plugins (tracked) |
plugins/shipped/ | Canvas plugins shipped with the repo; every *.ts mounts at boot |
plugins/runtime/ | Plugins the agent writes at runtime (gitignored) |
.grok/skills/fregoli-app/ | Grok skill: how to change the running app |
tests/ | node:test suites run via tsx |
docs/images/ | Diagrams used in the readme and on this site |