A Space is a persistent, named canvas of widgets that belongs to a single user. Unlike a route or a view, a Space survives page reloads and sessions — it is a real set of files stored under the authenticated user’s home directory. Each Space can contain multiple widgets, each with its own renderer, metadata, and optionally its own data files and shared scripts. The agent works with Spaces and widgets through a staged tool workflow, reading and patching widget source across turns rather than all at once.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/agent0ai/space-agent/llms.txt
Use this file to discover all available pages before exploring further.
Storage Layout
Every Space is stored under the current user’s~/spaces/<spaceId>/ folder:
widgets/*.js files are treated as migration input only. Widget IDs come from their filenames under widgets/.
The
space.yaml manifest owns the space title, icon, color, agent instructions, layout grid state, and the list of minimized widgets. It should never contain invented or untitled widget names.Runtime Namespaces
The_core/spaces module publishes two helper surfaces on globalThis.space:
space.current
Helpers for the currently open space: list, read, patch, render, reload, reposition, and remove widgets.
space.spaces
Helpers for cross-space CRUD: create, open, duplicate, remove spaces, and lower-level widget storage operations.
space.current helpers:
space.spaces helpers:
Skills for Space Work
The agent loads space-related guidance through two dedicated skills:The
spaces skill is top-level and auto-loaded unconditionally. The space-widgets skill is top-level and auto-loaded only while the page exports the space:open context tag — that is, while a Space is actively open in the route.Context Tags
While a Space is open, the_core/spaces route exports hidden <x-context> elements that gate skill visibility and prompt context:
| Tag | When present |
|---|---|
space:open | Any time a Space is mounted as the current route |
space:id:<id> | Identifies the specific open Space by ID |
space-widgets skill becomes eligible only when space:open is in the current document’s tag union.
Agent Workflow
The spaces runtime is designed for staged turns — the agent reads before it writes, and each mutation happens after seeing the current state.Discover
Call
space.current.listWidgets() when the live widget catalog is unknown. The transient section Current Space Widgets also provides a compact id|name|col|row|cols|rows|state|render status table on every prompt turn.Read
Call
space.current.readWidget(widgetIdOrName) to load the latest numbered renderer source. Numbered line prefixes are display-only targets for patch operations — they are not stored source text.Mutate
On the next turn, call
space.current.patchWidget(...) for bounded edits or space.current.renderWidget(...) for a full renderer rewrite.Widget Renderer Contract
The preferred widget renderer shape is a plain async function:context exposes useful paths and a module loader:
<x-browser> rather than a plain iframe:
space.browser and enables agent-driven navigation, DOM inspection, and interaction.
First Login: Big Bang Onboarding
On first login,_core/spaces uses the _core/login_hooks/first_login seam to copy or reuse the bundled onboarding space template. This space carries the Big Bang title, icon, color, and onboarding instructions. The router is rewritten to open that space as the initial route instead of the default dashboard.
Share Modal
The Share button on an open Space opens a modal with local and optionally hosted sharing:Download ZIP
Download ZIP
Always available. Exports the current
~/spaces/<spaceId>/ folder through the authenticated backend folder_download endpoint. The browser receives the archive as an attachment.Upload ZIP
Upload ZIP
Always available. Validates through the backend import endpoint. If the current space already has content, the modal asks whether to overwrite it or import the archive as a new
imported-N space.Cloud Share (when CLOUD_SHARE_URL is set)
Cloud Share (when CLOUD_SHARE_URL is set)
Local ZIP export and import remain available even when hosted sharing is disabled or the remote receiver rejects uploads.