The web client¶
Open the client, choose a project, create a session, and follow its work without leaving your browser. This tour walks through Sessions · Tasks · Config using stills from a recorded demo. The demo agent's output is scripted; the controls are the web client's own.
Open it in a browser¶
With the daemon running, open http://127.0.0.1:8443 on the same machine.
The default listener needs no configuration or token. If nothing answers,
af daemon status reports whether the daemon is running without starting it.
Run af in a git repository to open the TUI and start the daemon. A port conflict
can leave the daemon running without the web listener; af doctor and
af daemon status name the conflict and the fix if the browser still cannot
connect. For automatic startup at login, use af daemon install.
For another machine or a shared host, read Beyond localhost after the tour. Remote daemon access is the full setup guide.
A tour of the app¶
Sessions view¶

The app bar's Sessions, Tasks, and Config buttons switch views. The project switcher scopes Sessions and Tasks to one repository and remembers that choice across reloads. Its menu shows session and working counts per project. Config's This browser section holds settings saved only in this browser. Theme chooses Light, Dark or System; System follows your operating system. Log out forgets the browser's saved daemon token and returns to the login screen. Install app, when offered by the browser, opens its installation prompt; its × dismisses the offer. See Install it as an app.
If the project list is empty, choose + Add project in the switcher. Browse the
filesystem on the daemon's host: click directories to descend, Up for the
parent, and Home for its home directory. Use on a git checkout fills
Repository path or git URL; you can also type an absolute or ~-prefixed
path on the daemon host, or a git URL (https://host/owner/repo,
ssh://host/owner/repo, or git@host:owner/repo) for the daemon to clone and
register — a clone can take a while, so the dialog closes and the project
appears when it finishes. Click Add project to register it. Cancel
leaves it unchanged. The switcher's
Delete project asks for confirmation, then archives ordinary live sessions
(restorable) and tears down in-place or external-worktree sessions, including
the root agent, removing their session records (not restorable). Those in-place
worktrees, branches, and uncommitted changes stay where they are. It removes the
project registration while preserving the real repository.
The rail lists the selected project's sessions. Click a row to select it and attach its terminal. The main pane shows that session's title and tabs. The rail count is the number of rows currently shown. The root agent is pinned first, then live sessions oldest first, then archived sessions newest first.
The rail shows state by glyph only. Hover a row to read its state in words.
| Rail signal | Meaning |
|---|---|
| Blinking yellow circle | The session needs you — the agent ran af sessions attention, or the daemon flagged a prompt whose delivery it couldn't confirm (sent-unverified or could-not-confirm) still staged in the composer, or the daemon found Claude Code stopped on a launch dialog af won't answer by itself (a folder-trust dialog in a pane too narrow to read, for example). Hover the row for its reason |
| No glyph | The agent is idle |
| Muted spinner | Work is in progress |
| Hollow circle | The agent process is dead, or a prompt was not delivered |
| Dashed circle | The session is lost |
| Diamond | A usage limit has been reached |
| Archive icon and dimmed row | Archived session |
The secondary line shows the branch when available. The selected row also shows
idle detail, such as pane changed · 12m ago. These are observations of terminal activity,
not a claim that the agent finished or asked a question. Diagnostic title prefixes
such as [lost], [deleting], [limit], and [remote] add context.
Agents learn af sessions attention --self from the af skill, and run it only when
they are blocked on a decision or question that only you can answer. The yellow
circle clears when you submit a line in the agent pane, dismiss it with the × on
the Attention chip in the session header, or when the agent starts work again
after it went idle. Typing a draft or just viewing the tab does not clear it. On a phone, a count on Toggle sessions shows how many other sessions need attention, and the open drawer says so in words ("1 session needs attention"), so you do not need hover to find out. While
any session in the selected project needs attention, the browser tab's favicon also
swaps its tile and mark colors every second, so you can see it from another tab.
When your system asks for reduced motion, neither the circle nor the favicon blinks,
the circle has a ring around it, the working spinner does not turn, and the chip's bell is still.
When the browser loses its connection to the daemon (the event stream or the focused terminal's socket) for more than about two seconds, the pane header shows Reconnecting… with the time of the next retry, and the rail says the same on desktop. It is a static glyph plus words, with no animation, and it clears when the connection returns. Keystrokes typed meanwhile are queued, in order, and delivered on reconnect; only past a 64 KiB backlog does the terminal say "typing was not delivered".
The funnel opens state checkboxes: Needs attention · Idle · Working · Waiting on a limit · Broken · Archived. Archived sessions start hidden. The filter applies inside the selected project and is remembered by this browser; a dot on the funnel marks a non-default filter. If it hides everything, the empty state reports hidden rows.
On a phone, selecting a terminal gives it the screen: one compact row holds Toggle sessions, the truncating session title, the Terminal and VS Code icon buttons, and …. The menu contains project choices, Sessions · Tasks · Config, session actions and tabs. Escape closes it and returns focus. Toggle sessions opens the rail drawer; selecting a session or tapping its backdrop closes it. Opening the drawer leaves the terminal in place at the same size. Tasks and Config keep their phone layouts.
While the terminal owns the keyboard, one bottom row provides Ctrl, Alt, Esc, Tab, ^C, Paste and Arrows, with 44px targets. Arrows replaces that row with arrow keys, A−/A+ and More keys. The A−/A+ pair steps the terminal's text size by half a pixel per press and is display state, not input — it sends no keys to the session. Tap Ctrl or Alt to modify the next key, including the bar’s own keys; double tap to lock (shown by ▸ and an outline), then tap again to release. IME composition is sent unchanged and leaves armed modifiers for the next key. Keys retain terminal focus and the terminal resizes above the soft keyboard. With that keyboard closed, the terminal occupies at least 85% of the visual viewport at the verified phone widths.
Terminal text size. At desktop width the terminal header carries the same
A−/A+ pair (one-pixel steps); on a phone it lives in the keybar's arrow
row. Each device class keeps its own size — stepping one never touches the
other — and both persist in the daemon's [web] config table
(web.terminal_font_size_phone, web.terminal_font_size_desktop, each a
number in [4, 32]) so the size survives a reload and follows every browser
attached to this daemon.

Share a link to a session. Open … in the pane header and choose Copy link,
or copy the address bar: it follows your selection.
Links use the stable session ID (/#/session/<id>) and open on this daemon,
switching projects and revealing Archived when needed. Login preserves the target;
a missing session shows a notice and returns to the dashboard.
| Control | Action |
|---|---|
| Copy link | Copy the selected session's URL to the clipboard |
Create a session¶
Click + New in the rail. If there are no projects, add one through the project switcher first; creation stays disabled until a project is available.

| Field | What to choose |
|---|---|
| Title | A session name. Leave it empty to use the suggested name, if one has loaded. |
| Project | The repository to work in; starts with the selected project. |
| Program (Defaults) | The agent to run, or Repo default. Choices come from the project's agent catalog. |
| Backend (Defaults) | Where the session runs, or Repo default. Unavailable choices explain why they cannot be used. |
| Account | A registered identity for the selected agent. The project's default is preselected when offered; changing Program refreshes the account list. Use configured default (…) inherits the named default; Use agent login (no default) uses the agent’s own login when none is configured. Use daemon default leaves resolution to the daemon. These rows send no account override. |
| Prompt | Optional initial instructions to send to the agent. |
An account without a credential is labelled but still selectable. A
registration-only account explains why it cannot scope a session and blocks
creation if selected. Register and sign in to accounts in Config.
Create checks required fields in the browser; missing values show inline
errors and leave the form and its values open. After those checks pass, the modal
closes before sending the request. A pending row tracks creation, then the session
opens attached on success. A confirmed daemon refusal reopens the retained form
with an inline error when no newer form is open; otherwise it shows a notice.
If the outcome is uncertain, check the session list before retrying. Cancel, the backdrop, or Escape
closes the form before submission.
Watch and interact with the agent¶

The Agent tab streams the agent's terminal output. Click the terminal to give
it keyboard focus and type a follow-up prompt. While attached, ordinary keys go
to the agent, including Escape; the agent decides what they do. Press ctrl+]
to return keyboard focus to navigation. Clicking the rail or opening its mobile
drawer also returns to navigation.
With navigation focused, j and k (or the arrow keys) move the rail selection
without attaching. Enter attaches the selected session. The pane's accent border
marks the pane you are driving. See the keyboard reference
for tab and view navigation.
The pane header's Retry limit appears for a session waiting on a usage limit and requests another attempt. If an agent or account handoff could not confirm mission delivery, inspect the pane first; the same place shows Retry handoff as the explicit override while automatic redelivery stays suppressed, Queue for limit resume when the unconfirmed handoff is parked at its usage-limit wall with an unknown startup state — the daemon queues the mission for the next resume rather than resending or restarting — and Mark delivered to retire it without resending when the pane shows the mission already landed. If that retry delivers the mission while its final disk settlement remains pending, the web keeps a confirmed-mutation warning on screen because the mission has already landed and must not be retried. Open … in the pane header for Handoff, which appears when the session supports swapping agents in place. Choose New agent in its modal and confirm Hand off to stop the current agent and continue with the replacement. A limit-blocked local session can offer both; see usage limits.
Open a rail row’s … menu for Archive and Delete session. Other actionable rows
reveal the menu on hover, or by keyboard: with navigation focused, j/k
selects the row and Tab reaches its actions trigger, then Enter opens the
menu. A kill-only recovery row that j/k skips — such as one in
startup_state_unknown or awaiting an account swap — keeps its actions
trigger in the Tab order directly, so Tab to it and Enter open the menu
without selecting the row first. Archive and Delete session each open a
confirmation:
- Archive tears down a local session's terminal and moves its worktree into
the archive. Docker and remote-hook sessions push the branch to
originand tear down the remote sandbox (no local worktree to move); an SSH or sandbox session stops the agent and leaves the workspace on its host. - Restore, in the archive action's place on an archived row, moves a local worktree back and respawns the agent. A local restore starts at once, with no confirmation: a dialog shows its progress and offers Retry restore if the daemon refuses it. For a remote session, it asks for confirmation first, then provisions a fresh sandbox from the pushed branch and relaunches the agent; the old sandbox's conversation does not return. Restoring an SSH or sandbox session archived without a push reattaches its preserved workspace — the tree, index and ignored files come back exactly as archived and the agent resumes its conversation, unless it ran under a synced account (whose directory is removed on archive, so restore starts a fresh conversation). Reveal Archived in the filter first.
- Delete session permanently tears down the session and removes its record. It removes Agent Factory-managed worktrees and deletes only branches created by Agent Factory. In-place or external worktrees and pre-existing branches are preserved. The daemon-managed root is the exception: deleting it interrupts scheduled and watch-task delivery to the root session until it self-heals (usually about two minutes) or the daemon restarts; other scheduled and watch tasks keep running. Disable it in configuration to keep it down.
Pending creation rows have no destructive actions. An action belongs to the row whose button you clicked, even when a different session is selected.
Review the work in another tab¶

Click an existing process tab, such as diff in the still, to attach it. To
inspect changes yourself, click Terminal in the pane header and run git diff in
the shell. The still's diff is terminal output, not a separate diff-view control.
Tabs run in the session's worktree. Click Agent to return to the agent.
VS Code, beside it, opens an editor for the worktree; see VS Code tabs for the required host editor. The × on a deletable tab opens a confirmation naming the tab and session; the Agent tab cannot be deleted independently. Confirm with Delete tab or choose Cancel. Hiding a pane leaves the tab available; deletion requests runtime cleanup. Double-click a process, web, VS Code, or docs tab's label to rename it. Drag a tab onto a pane edge to split that pane, or onto its center to replace the displayed tab.
There is no nine-tab limit: the strip scrolls as it fills. In navigation mode,
t opens a terminal tab and T (shift) a VS Code tab, when the session supports
that kind. w asks to delete the active deletable tab, and 1–9 select a tab
without attaching. Clicking a tab selects and attaches it.
When a backend cannot create local tabs, the Terminal button is hidden, the
VS Code button stays when the backend offers the editor relay, and …
explains the restriction only when no menu kind remains available. The button
reflects the backend's capability, not whether an editor binary is installed: a
remote backend projects the vscode kind as long as its host supports it, and
the binary is detected only when the pane opens — a missing one leaves the tab
created and shows an install hint (see VS Code tabs).
Archived sessions must be restored before creating tabs. Agents can also create
web tabs for dev-server previews through the CLI or API; these do not
appear as a creation button in the pane header.
Tasks view¶
Choose Tasks in the app bar to manage automations for the selected project.

Each row shows its name, cron schedule or watch command, optional target session, arming or next-run information, and last-run outcome. The switch on the right shows whether the task is enabled. A health mark at the start of the row flags a problem, with explanatory text in the row.
| Control | Action |
|---|---|
| Switch | Turn the task on or off. |
| Edit (pencil) | Open the existing task's form to change it. |
| Trigger (play) | Run an enabled cron task now; greyed out for watch and disabled tasks. |
| Remove (trash can) | Delete the task after confirmation. |
| + Add | Open a form to create a task. |
On a phone, Edit, Trigger and Remove move into the row's … menu.
In the form, enter Name, choose Project, and choose a Trigger. A
Cron schedule uses a schedule picker with time, interval, or weekday controls
as appropriate; Custom (cron) accepts a raw cron expression. Watch command shows
a command field instead. Prompt supplies the instructions (required for cron);
a watch prompt may use {{line}} for the matched line. Target session is
optional; Program selects the agent for a new session. On done chooses
Keep, Archive or Kill for a session spawned by the task; its hint explains the
consequence. A task targeting an existing session cannot apply that cleanup.
Submit with Add or
Save, or leave with Cancel. Invalid values show an inline error.
See Tasks and automation for scheduling semantics.
Config view¶
Choose Config to edit global settings on the daemon's host. The header names
the config.toml being written, and every edit writes that global file.
The values shown are the selected project's: what af uses for sessions there,
the same values af config get --repo <path> prints. A banner under the header
names the project. A row whose value comes from a project or personal override
carries a line saying so, with the value the project uses, while the field
above it holds — and edits — the global value. Switching projects re-reads the
values. If the daemon cannot resolve the project, the banner says why and the
rows show global values.

Settings are grouped in the daemon's tier order. Each row explains the key's purpose and shows its current value. Click a key to see which config layer supplied the value; for a selected project, the trace is that project's. Show N advanced settings expands the advanced tier; Hide advanced settings folds it again.
Checkboxes and dropdowns save when changed. For text or structured values, edit
the field and click its Save button or press Enter; unchanged values leave
Save disabled. Each write affects one key. The row shows either the saved value,
an applicable restart notice, or the validation error.
Configure with assistant opens a terminal overlay for conversational setup. Type your request there and use × to close it and return to the settings.
The Accounts section groups registered identities by agent and shows their names, credential directories, and Logged in or Not logged in state. Logged in means a credential file exists; it does not verify that the credential is valid or unexpired. These identities are managed separately from config keys. See Accounts for login, project defaults, Docker mounting, and identity boundaries.
Type a name in an agent's account field and click Register to create its credential directory. Log in or Log in again opens the agent's own login flow in a terminal on this page, running on the daemon host. Follow that pane's URL in your own browser and complete the agent-specific code step. Codex takes the device code in the browser; Claude and Gemini may ask for an authorization code in the pane. The flow writes the credential on the host; there is no credential-entry field in the web form. Close the login overlay with × when finished.
Accounts supported for session scoping are available in the new-session form's Account field. A registration-only account displays a notice that sessions cannot yet be scoped to it. Registration and login failures appear beside the relevant row.
To opt a project out of a global account default, set an empty project entry as described in Project accounts.
Beyond localhost¶
Listener and remote access¶
The default network.listen_addr is 127.0.0.1:8443: the browser client and JSON
API share a plain-HTTP listener. An absent key inherits that default; explicitly
setting network.listen_addr = "" disables the listener. Listener settings are
global-only. af config set — or a save in either config pane — applies them to
the running daemon in place, no restart; a raw hand-edit still needs
af daemon restart.
For remote use, keep loopback and forward the port over SSH, or configure a network bind with authentication and transport protection. Follow Remote daemon access for the commands, CORS settings, reverse proxies, and TLS setup.
The auth model¶
By default, network.require_token = false, so any peer that can reach the
listener gets full control without a token. Loopback binding keeps that access
on the host; it does not separate the host's local users. A non-loopback
bind under this default is refused — the port never opens — unless
network.allow_unauthenticated_network = true accepts the exposure explicitly.
With network.require_token = true, network peers must authenticate. Loopback
peers are exempt only on a loopback-bound listener, unless
network.require_loopback_token = true too. A network-bound listener enforces
the token even for a loopback-origin connection.
When required, the login screen asks for the daemon token. On the host, use
af token show, then paste the value and click Connect. The browser stores
it for that origin and reuses it on reload. A rejected token is forgotten;
other connection errors keep it for a retry. Log out in Config clears it.
Security notes¶
On a shared machine, enable both network.require_token and
network.require_loopback_token, or disable the listener. Before binding a
routable address, enable network.require_token; otherwise af refuses the
listener — network.allow_unauthenticated_network = true is the explicit
opt-in that binds it anyway and serves the control API to anyone who can reach
it.
Use an SSH tunnel, private network, or TLS-terminating proxy for remote transport.
The daemon itself serves plain HTTP.
The token grants full access. Keep it private, use Log out on shared
browsers, and use af token rotate if it is exposed. Read the
remote access security notes before exposing
the listener or putting it behind a proxy.
Reference¶
Keyboard reference¶
These are the web client's bindings. Shortcuts for the rail and view switching
apply outside focused form controls and attached terminals. While attached, ctrl+]
detaches, and Alt+j, Alt+k, and Alt+w still act on panes. Other keys pass
through to the agent unless a modal or menu handles them.
| Key | Action |
|---|---|
j · k, ↓ · ↑ |
Move the Sessions rail selection without attaching |
Enter |
Attach the selected session in navigation mode |
ctrl+] |
Detach the terminal and return to navigation |
Escape |
Close an open modal or menu; otherwise pass through to an attached agent |
1–9 |
Select a tab in navigation mode |
t · T |
Open a terminal tab · a VS Code tab, when the session supports that kind |
w |
Ask to delete the active tab; confirm with Delete tab, or cancel; never the Agent tab |
[ · ] |
Cycle Sessions · Tasks · Config in navigation mode |
Alt+j · Alt+k |
Cycle pane focus in Sessions, including while attached |
Alt+w |
Close the focused pane in Sessions |
The web view-cycle and split-pane chords are defined by the browser client; the TUI has its own keyboard reference.
JSON API¶
The same listener serves the app at / and the API under /v1/. Use the
HTTP API guide for requests and authentication, and the
API reference for endpoints. A separate frontend server is
not needed.
Install it as an app¶
The client can be installed as a standalone app window. In a browser that offers installation, click Install app in the app bar to open its prompt. The button's × remembers a dismissal in this browser. You can also use the browser's own installation or add-to-home-screen controls where supported.
Why the install button is not showing¶
The button appears only when the browser offers an install prompt, the app is not already installed, and you have not dismissed the offer. A secure context is required: loopback HTTP and HTTPS qualify; plain HTTP on a LAN or Tailscale address does not. Use a TLS-terminating proxy for remote installation; see transport encryption.
What gets installed¶
The app uses the same daemon and page, with its own icon and standalone window. Browser chrome follows the Theme setting. The service worker caches the static shell, using the network first, so an unreachable daemon can show the app's connection-error screen. It does not cache API requests, event streams, terminal streams, or previews. Installing is optional.
Web tabs¶
The preview toolbar's Reload refreshes the frame; Open opens its target
in a separate browser tab. A preview reached through the web UI's own address
(the /v1/webtab/ mirror) opens there under the same sandbox as its frame: an
opaque origin, so it cannot read the web UI's storage or call its API as the web
UI. A preview on its own per-tab origin opens on that
origin. A stopped dev server offers Retry in the fallback panel after you
restart it.
Alongside terminal tabs, a session can hold web tabs — a tab that renders a site in an iframe instead of a terminal. The primary use is a live dev-server preview: an agent runs a dev server in its worktree and injects a tab pointing at it, so you watch the app render in the browser as the agent builds it.
Web tabs are created from inside a session (by an agent or by you) with the CLI/API — the pane header has no button for them, because their target comes from whatever the agent is running rather than from anything the UI could ask you for (a VS Code tab, which always targets the worktree, does have one):
# a local dev server on port 5173 (Vite/Next/CRA/…)
af sessions tab-create my-session --kind web --port 5173
# any URL (localhost or external)
af sessions tab-create my-session --kind web --url http://localhost:3000
af sessions tab-create my-session --kind web --url https://example.com/docs
# a target may point at a specific page, not just a server root
af sessions tab-create my-session --kind web --url http://localhost:8899/viewer.html
How the target is rendered depends on whether it is local or external:
- Local (
--port,localhost,127.0.0.1,::1): the daemon reverse-proxies it under a same-origin path (/v1/webtab/…), and the web UI iframes that. Because the daemon, not your browser, reaches the dev server, the preview works even when you view the web UI remotely (over Tailscale or an SSH-forwarded port) — a rawlocalhostiframe would otherwise hit your machine, not the daemon's. Same-origin also sidesteps the dev server'sX-Frame-Options. Only loopback targets are proxied — the daemon never proxies an external host, so it can't be turned into an open proxy. - External (
https://…): the web UI iframes it directly (never through the daemon). This is best-effort: many sites sendX-Frame-Options/frame-ancestorsand the browser blocks embedding. af does not try to defeat framing protections — every external web tab carries an always-present Open link (the guaranteed escape hatch), and if the site does not load in time (slow / unreachable) the tab shows a clean fallback panel with an "Open in a new tab" link.
In the TUI a web tab shows a placeholder (the target URL + a pointer to the
web UI) — a terminal can't render a browser. Tab navigation
(1–9, the sidebar tree) treats it like any other tab.
A web tab is pure metadata — a URL, with no process behind it — so it
outlives anything that tears processes down: it survives a daemon/af restart
and it survives archive → restore with its target intact (unlike
shell/process tabs, whose processes are torn down at archive time and do not come
back). If the target is down when you restore, the tab renders the same
unreachable-target fallback it would at any other time — start the dev server
again and reload.
While a session is archived its web tabs are preserved but inert: the tab
shows an "archived — restore it to load this web tab" placeholder instead of
loading, the daemon refuses to proxy its target, and the tab can't be deleted (so
the URL is still there when you restore). This is deliberate — the stored target
is a bare localhost:PORT from whenever the tab was created, and by the time you
come back that port may belong to something else entirely. af sessions restore
brings the tab back to life.
How the proxied URL maps to the dev server
The proxy serves the dev server under /v1/webtab/<session>/<tab>/, and the
browser-visible path mirrors the dev server's own path beneath it:
| target | browser URL | dev server sees |
|---|---|---|
http://localhost:3000 |
/v1/webtab/<s>/<t>/ |
/ |
http://localhost:8899/viewer.html |
/v1/webtab/<s>/<t>/viewer.html |
/viewer.html |
http://localhost:8899/app/viewer.html |
/v1/webtab/<s>/<t>/app/viewer.html |
/app/viewer.html |
Because the depth matches, the browser resolves the app's relative URLs
exactly where the dev server expects them — a sibling (x.css), a
parent-relative one (../shared.css), and a subdirectory target all
work, and a cookie the app scopes to a sub-path (Path=/app) rides on the
matching proxied requests. Requesting the tab's bare root redirects to the
target's path, so the URL mirrors from the first navigation on. WebSocket-based
hot reload is proxied on a best-effort basis.
Absolute asset paths need a per-tab preview origin
An app that hard-codes absolute asset paths (/assets/app.js,
/static/js/bundle.js) will not find them through the mirror path above. An
absolute path resolves against the origin root, so it escapes the tab's
prefix before the daemon ever sees which tab it belongs to, and the request
returns a 404 naming the problem rather than the web UI's own HTML (which
would be a silent, unexplained breakage).
It cannot be rerouted on this path, and not for a tunable reason: the mirrored
preview is framed with an opaque origin so a previewed dev server can never
reach the web UI or read its token, and a browser sends no Referer from such
a frame — there is nothing to attribute the request by.
There are two ways out:
- Turn on per-tab preview origins (below). Each tab gets its own origin whose root is the dev server's root, so absolute paths are correct by construction. Same-machine viewing only.
- Configure the dev server with a matching base path (Vite
base, CRA/webpackhomepage/publicPath, NextbasePath), or serve relative asset URLs. This is the option that also works remotely.
Per-tab preview origins¶
Set network.preview_listen_addr (for example
127.0.0.1:8444) and the daemon opens a second plain-HTTP port that serves
previews and editor origins only — never the control API. Each web tab is
then served from its own origin:
The tab's dev server owns that origin's root, so /assets/app.js resolves to
the dev server's own /assets/app.js with no base-path configuration and no
guessing. Because each tab is a distinct origin, the browser also
isolates them from each other and from the web UI: one preview's JavaScript cannot
read another's response (the preview port answers no CORS allow-origin header) and
cannot reach the web UI or its token. The hostname's opaque label is a per-tab
credential the daemon mints and verifies; it is held in memory and rotates on every
daemon restart, so preview URLs are not durable bookmarks.
What to know before turning it on:
- Same-machine only, and af checks rather than guesses.
*.localhostnames are resolved by the browser to its own loopback, so a per-tab origin only works when the browser can reach the preview port. Before switching a frame, the web UI loads a tiny probe page from that port and waits for it to report; if it does not, the tab silently keeps the same-origin mirror described above. That covers the case a location check alone gets wrong: underssh -L 8443:127.0.0.1:8443 remotethe browser's address ishttp://localhost:8443while the daemon is remote and the preview port is not forwarded. Forward the preview port too and per-tab origins start working through the tunnel; leave it unforwarded and nothing changes. - Browser support is handled the same way. Chromium- and Firefox-based browsers
resolve
*.localhostto loopback (RFC 6761); Safari does not. There the probe simply never reports and previews keep using the mirror — no configuration needed, and nothing to detect by hand. - Viewing remotely is unchanged. A Tailscale or SSH viewer keeps the
same-origin, sandboxed preview it has always had. Binding
network.preview_listen_addrto a network interface gains a remote browser nothing — it still resolves*.localhostto its own machine — but it is not therefore harmless.*.localhostis a browser convention, not a restriction on the port: anything that can reach the address can sendHost: <tab>.localhostitself, and on this listener a tab's hostname is the only credential checked. So a network bind turns every tab hostname into a network-reachable capability, and one that leaks through a log, a screenshot, or browser history stops being usable only from this machine. Editor tabs are withheld entirely while the listener is network-bound, and the daemon warns at start,af config setwarns on every exposed save, and the TUI and web config panes warn on a transition into exposure. Keep it on loopback unless you have a reason not to. - It is off by default. No second port opens unless you set the key, and a bind conflict is logged and skipped, never fatal.
Per-session editor origins for remote viewers¶
A VS Code editor keeps its workbench state, terminal history included, in the browser's
origin-scoped storage, so each session's editor needs its own origin. On the daemon's own
machine that is a *.localhost name; a viewer on another machine resolves *.localhost to
its loopback, so behind a single front-door hostname the only thing left to separate origins
is the port. Declare a pool and each session's editor gets one port from it:
The editor then lives at https://<same hostname>:<port>. The daemon persists each
session's port (editor-origin-ports.json in the af home), so the origin, and the storage
under it, survive daemon restarts; the port is taken back once the session is archived or
gone and the pool is full. It binds the ports on loopback only; you expose them the way you
expose the main UI, for example:
The credential is a per-session key, not network reachability. An editor is a shell in the
worktree, so a port anyone on the tailnet can open would be a side door around the operator
token. The web UI asks POST /v1/editor-origin?session=<id> (behind the operator token) for a
single-use bootstrap URL on the editor's origin; opening it sets an HttpOnly,
SameSite=Strict cookie (Secure behind an HTTPS front door) and redirects, so the key does not
stay in a URL. A port serves only its own session's editor and accepts only that session's
cookie: another session's key, a replayed bootstrap URL, or the key of an archived or killed
session is refused. Keys are in memory, so a daemon restart means the next editor open
bootstraps again. The path /_af/editor-bootstrap is reserved on these ports.
A reassigned port never shows a previous session's storage. Browser storage belongs to the
origin, and an origin is a port, so when a full pool hands the port of an archived or gone
session to a new one, every browser that visited the old editor still holds its localStorage,
IndexedDB, caches and service workers for that origin. Each assignment therefore gets a fresh
epoch, remembered per browser in a second HttpOnly cookie. A bootstrap from a browser whose
epoch is missing or older is answered with a page that clears the origin's storage before
entering the editor, using Clear-Site-Data where the browser honours it (secure contexts) and
a script everywhere else, including a plain-HTTP tailnet origin. A browser that already carries
the current epoch, for example after a daemon restart, keeps its storage. Reassignment prefers the
port that has been free longest, which shortens the window in which any browser can still hold an
old owner's state.
Unset (the default), nothing is bound and a remote viewer keeps the same-origin editor. If the
pool is full the editor stays on the same-origin mirror and the daemon's error names
network.editor_origin_ports. Both apply to a local session only: an off-box session's editor
is never served on the web UI's address, so without a port of its own its pane says which
setting to turn on. See network.editor_origin_ports.
An editor port answers only its own Host names, so a front-door name that
tailscale serve or Caddy forwards must be listed in network.allowed_hosts — one
entry covers the editor ports on any port. Behind a front door that rewrites Host,
forward the browser's for each of these ports too (X-Forwarded-Host $http_host), as
for the main UI: an editor's WebSocket is accepted only from the editor's own page,
judged the same way. See Host names the daemon answers
to and behind a reverse
proxy.
VS Code tabs get one too — per session¶
A VS Code tab moves onto a per-session origin, not a per-tab one: there is one editor per session, so both of a session's editors sit on the same origin and share one state store, as they should.
This is a confidentiality fix, not an ergonomics one. code-server is VS Code Web,
which keeps workbench state in the browser's IndexedDB — and its terminal history
(terminal.history.entries.commands) is global, not workspace-scoped. On one shared
origin that means one session's Terminal: Run Recent Command offers another
session's commands, and Go to Recent Directory offers another session's checkout.
Those command lines carry branch names, paths and sometimes secrets, and it looks
exactly like your own history, so it never gets reported. Giving each session's editor
its own origin is what partitions that store.
Two consequences worth knowing:
*.localhosteditor origins require a LOOPBACK, fixed preview port. Withnetwork.preview_listen_addrbound to a network interface (or to an ephemeral:0), web tabs still get per-tab origins but editors do not — they stay on the same-origin mirror. On that listener the hostname is the only credential, and a remote client can simply sendHost: <label>.localhostto the exposed port; behind an editor origin is a code-server running with auth disabled, i.e. a terminal. Since per-tab origins are same-machine only anyway, a network bind could never have served a remote viewer an editor, so nothing is lost by refusing.- A session's editor origin is stable across daemon restarts, unlike a web tab's.
It has to be: the editor's layout, open editors and history live behind that origin,
so a rotating name would wipe them on every restart. It is derived from a secret kept
at
~/.agent-factory/editor-origin-secret(0600, the same posture as the daemon token). Delete that file and every session's editor starts fresh. - Existing editor state does not migrate. Turning
network.preview_listen_addron moves editors to new origins, so layout and history start empty once. That old state is the shared store this fixes, so leaving it behind is the point.
The shared user-data directory is untouched — settings, extensions and themes still carry across every session's editor, which is why af shares it in the first place.
Previews over a token-protected listener
Over a token-protected network listener, iframe sub-resource requests on the mirror path are kept authorized via a path-scoped cookie (see Remote HTTP auth). If a preview loads only partially over a direct network listener, prefer an SSH-forwarded loopback port (which needs no token) — the common remote-preview path. Per-tab preview origins do not apply remotely.
A mirrored preview is sandboxed to an opaque origin, so it cannot reach the web UI
or read its token — framed, and opened on its own alike: the daemon sends a
Content-Security-Policy: sandbox … with every mirrored response, carrying the
same flags as the frame, so a mirror address opened in a browser tab, bookmarked
or pasted runs exactly as it does in the pane. A preview on its own origin is
sandboxed too, but with a real origin of its own (it needs one for localStorage, cookies and service workers) —
safe because the browser's own cross-origin rules already keep it away from the web
UI. A small reload control sits above every web tab for dev-preview refreshes.
VS Code tabs¶
A VS Code tab is a full VS Code editor, in the browser, opened on the session's worktree — so you can read and edit what an agent is building without leaving the web UI. It renders as a pane like any other tab, and works in splits and drag/drop.
Unlike a web tab it takes no target: the session's worktree is always what it opens. That is what makes it offerable from the pane header's VS Code button, next to Terminal. From the CLI:
code-server is not bundled — install it yourself
af detects an editor rather than shipping one. It looks for
code-server first, then
openvscode-server, on the
daemon's PATH. If neither is installed the tab still creates, and the pane
shows an install hint instead of an error — install the editor and reload the
pane. To point af at a binary outside PATH (or under another name), set:
This key is global-only: it names a binary the daemon executes, so a repo's checked-in config can never choose what af runs on your machine.
For an off-box session (docker, ssh, sandbox, or a remote-hook backend)
the editor is detected, started, and stopped on the session's host by the
agent-server running there — not on the daemon's machine — so the PATH
search runs on the workspace host: install code-server/openvscode-server
there, and the daemon only relays the editor's socket to the browser (see
Remote hooks). The
vscode_server_binary override is read from the host's
~/.agent-factory/config.toml only by an agent-server launched without
the install policy — a launch-style remote hook. The built-in docker,
ssh, and sandbox backends start the agent-server with --policy-file,
whose policy does not carry vscode_server_binary, so on those the editor is
selected by the PATH lookup alone, which only recognises the names
code-server and openvscode-server: to use a renamed or out-of-PATH binary
there, put it on the workspace host's PATH under one of those names (a
symlink or wrapper works).
How it runs. Locally the daemon starts one code-server per session — shared by
every VS Code tab and pane in it — the first time a pane renders, listening on
a 0600 unix socket in a 0700 directory under the af home (no TCP listener
at all). For an off-box session the agent-server on the session's host starts
that code-server instead, and the daemon relays its socket. A local editor is
reached through the daemon's /v1/webtab/ proxy when it has no origin of its own,
which is what makes it work for a remote viewer (Tailscale/SSH) and what puts
the daemon's auth policy in front of that route. On a cold start the pane briefly
shows "VS Code is still starting…" and resolves itself.
An off-box session's editor opens only on an origin of its own. Its bytes come
from the session's workspace, and VS Code cannot run sandboxed, so af never serves
it on the web UI's address: a compromised workspace would otherwise run script as
the web UI itself. It opens on the per-session editor
origin when network.preview_listen_addr is set to a
fixed loopback port and you view from this machine, or on an editor-origin
port when you view from
elsewhere. With neither, the pane says which one to turn on.
The editor is stopped when its last VS Code tab is closed, and when the session is archived or killed — and, locally, on daemon shutdown, so nothing is left running. For an off-box session the stop on tab close is best effort: if the agent-server is unreachable at that moment the tab still closes and the failure is only logged, so the host-side editor keeps running until the session is archived or killed (or the agent-server itself is torn down). An off-box editor is owned by the agent-server on the session's host, which uses a separate namespace from the daemon's, so a daemon restart does not stop it: it keeps running and is relayed again on the next render. If it ever dies, the next render starts a fresh one. Nothing about it is persisted: the tab survives a restart and simply starts a new editor when you next open it.
--auth none, and why that is safe here
The editor runs with authentication off, because it is only ever
reachable through its 0600 unix socket, which is gated to your account by
filesystem permissions — the same posture the daemon's own control socket
has. Anything running as you can dial that socket; that same-user boundary is
the protection, not the proxy. Your browser reaches it through the daemon's
/v1/webtab/ proxy, so the daemon's auth policy applies to that route. It
runs as you, with your PATH and your code-server settings/extensions.
That filesystem boundary is the protection only locally, where the
editor's socket never leaves the daemon host. For an off-box session the
editor is instead reached through the agent-server's /v1/agent/relay
route, which startTCPListener token-gates with the agent-server's bearer
token over the same plain-HTTP listener its other routes use — so the
boundary there is that token plus the private transport the agent-server
is reached over — the tunnel or network the built-in docker, ssh and
sandbox backends set up themselves, or, for a launch-style remote hook,
whatever your launch_cmd exposes it on — not a same-user socket.
Note that a VS Code pane is deliberately not origin-sandboxed the way a web
tab is: VS Code cannot run under an opaque origin. For a local session that
is acceptable because the daemon controls what is served there (a code-server it
started, on your worktree), and a local workspace already runs as you. Only the
editor's own workbench keeps a real origin: its shell, VS Code's own static
files and its sign-in callback. Everything else the editor serves answers as an
opaque-origin page, on every origin the editor is reached through. That covers
code-server's port forwarding (/proxy/<port>/, /absproxy/<port>/, in any
spelling) and VS Code's route for worktree files (vscode-remote-resource). So
a dev server or a repository's HTML file opened there runs neither as the web UI
nor as the editor, whose origin is its terminal.
Webviews are the exception. VS Code renders notebook outputs and extension
views inside its webview host, which is part of the workbench and gives them a
real origin, and code-server serves that host on the editor's own origin. So
a notebook's HTML output, or an extension's view, runs with the editor's origin.
For a local editor opened on the web UI's address, that is the web UI's origin,
with its token. Open notebooks only from repositories you trust there, or give
local editors an origin of their own: network.preview_listen_addr when you
view from this machine, network.editor_origin_ports from elsewhere (above).
af bounds who may load those pages as a class, not by name: an editor's static
documents are framed or navigated only by the editor's own origin. A page under
the editor's static tree loaded into a nested browsing context (an iframe,
frame, object or embed) from another origin — another editor-origin port shares
the hostname and differs only by port — is refused. So one session's editor
cannot hand its webview or extension-host channel to a page on another, and a
code-server version with a third such host page is covered without an update.
Editor routes also serve only a canonical path. A request whose path has an
empty segment (//), a ./.. segment, or an encoded separator (%2F, %5C)
is answered with 400 rather than left for the editor to collapse. One
user-visible effect: a code-server port-forwarded app (reached through
/proxy/<port>/ or /absproxy/<port>/) that requests a URL containing // or
an encoded slash now gets a 400; it must send the cleaned path. A dev server
reached as a web tab is unaffected.
The editor's WebSocket, which carries that terminal, is accepted
only from the editor's own page: af refuses a handshake whose Origin names any
other origin, on every address the editor is served on. It works behind the
same front doors the web UI's own streams do: the front-door name must be in
network.allowed_hosts, and a proxy that rewrites Host must forward the
browser's in X-Forwarded-Host (see Host names the daemon answers
to and behind a reverse
proxy). An off-box session's
editor is never served on the web UI's address at all (above). Do not expose the
daemon's listener to a network you do not trust.
In the TUI a VS Code tab shows a placeholder — a terminal can't render an
editor. Tab navigation (1–9, the sidebar tree) treats it like any other tab.
Proposal tabs¶
A Proposal tab edits a proposal: a set of markdown docs that you and the agent
write together. af proposal start and af proposal attach create it. From the
CLI:
- The strip at the top has one tab for each doc. + adds a doc from a template that the proposal does not use yet, or a blank doc.
- The editor shows markdown rendered. The line with the cursor shows its source.
Callouts
> [!question],> [!todo]and> [!decision]each get a colour. - Your edits save 500 ms after you stop typing. The header shows "Saved", "Saving…" or "Merged agent edits". The question count in the header goes to the next open question, in any doc.
- When the agent changes a doc that you have not edited, the tab reloads it and keeps your cursor. When you both changed the same lines, a banner asks you to keep yours, take the agent's, or show both. "Show both" puts both versions between conflict markers, and autosave waits until you remove them. If you close the tab or the page first, the doc saves with the markers in it, so no edit is lost and the agent sees both sides.
The editor loads the first time a Proposal tab opens. In the TUI a Proposal tab shows a placeholder.