Expand description
A workspace as a file (docs/specs/SPEC_WORKSPACES_2026_10_23.md §3.2, §4.2): ☰ → Workspaces → Export… and Import….
- Export writes the open workspace, every window of it with its name and
whether it is closed, as an
agentmux.layoutdocument withscope: "workspace"(layout_file::export_workspace) to a*.agentmux-workspace.jsonfile the host’s Save dialog picked. The same per-view allowlist as a layout file: no session ids, and the machine-localresumereferences only when asked for. - Import reads an exported workspace, or an older
*.agentmux-layout.json, as a new workspace and switches to it. It is opened as a template, as Open layout… opened a layout: every pane is new, each agent pane starts its agent afresh, and a terminal’s command runs only for a trusted file or when the user said so in the preview. The new workspace’s record holds the windows to build; the switch builds them (session_windows::restore_all, as for a record whose contents are gone).
Structs§
- Import
Trust 🔒 - What decides whether a file is trusted (layout files spec §3.5): saved by this install, in one of its own folders. Injected for tests.
Functions§
- agent_
placeholders 🔒 - The agent panes a layout’s plan made in contents
ws_id, waiting for their agent:(tab, block, agent definition). - definition_
id 🔒 - The id of the agent definition a layout names (its id, or a user agent’s
name as
agent.openreads it); what it names, as written, when none matches. - export 🔒
- Export the open workspace to
path(*.agentmux-workspace.json). Returns{path, warnings}: what the user should check before sharing it. - handle_
export 🔒 workspace.ExportUserWorkspace(path, includeResume).- handle_
import 🔒 workspace.ImportUserWorkspaceon the HTTP service route: refused. Whether the file’s commands run and its agents start is the person’s answer in the preview, and this route cannot tell the person’s window from any other caller, so the import is the websocket commandworkspace.importuserworkspace, which only the window may call.- handle_
preview 🔒 workspace.PreviewImport(path).- has_
agent 🔒 - import 🔒
- Import the file at
pathas a new workspace and switch to it from windowwindow_id.run_commandsNonemeans “as trusted”. Returns the switch and what the user should know. - import_
for_ 🔒window workspace.importuserworkspace, after the caller was proven to be the person’s window: the switch plusnotes, and the client’s new state sent to every window (the service route’s reply carried it back to the caller itself).- import_
name 🔒 - The name an imported workspace gets: the file’s, else its file name.
- import_
record 🔒 - The record a new workspace starts with: one entry per planned window, in
the session record’s shape without contents ids, so the switch builds each
one (
session_restore::restore_workspace). A plan with no open window opens its first. - plan_of 🔒
- preview 🔒
- What Import… shows before it opens a file:
{name, trusted, windows, closed, tabs: [{name, panes}], commands, notes}, the shape of a layout preview plus the windows. - read_
doc 🔒 - Read a file Import… accepts: an exported workspace or a layout file.
- start_
agents 🔒 - Start each agent the shown windows’ panes wait for (the window that asked, and those waiting to open beside it). Returns a note per agent that didn’t.
- unique_
name 🔒 name, orname 2,name 3, … when a workspace has it already.