Skip to content
docs/guides
Get started

Port forwards and directory shares

An agent that produces something you need to look at can publish it and hand you a URL — a dev server, a built site, a directory of screenshots — and the URL works even when the session is running on another machine.

You ask for it in words:

start the dev server and publish the port so I can see it

The agent calls a tool the daemon serves it, the daemon binds a listener, and a link appears on the session’s pane with a button to close it. The agent does not pick the public address and does not need to know how it is reached — the controller does that, which is why the link works from your phone as readily as from the browser beside the session.

You will rarely open a forward yourself. pm forwards lists and closes them from a shell when you want that.

A directory share is the same machinery pointed at files instead of a process. The worker running the session serves the directory, so the agent starts no server, picks no port, and has nothing to restart after a resume. A directory holding an index.html serves it at the root; one without gets a generated listing.

This is the right answer for anything an agent produces for you to read — a report, a set of images, a built page — because nothing has to stay running for the URL to keep working.

Published previews authenticate, raw TCP forwards do not. An HTTP forward or a published directory needs a signed-in dashboard user or a scoped token, so its URL is an address rather than a credential. A forward of a non-HTTP port is proxied with no check of its own, so bind those only where you would expose the service itself.

So: a published preview or directory is an address rather than a credential, and a raw TCP forward is exactly as exposed as the service behind it.

A directory share is confined the same way a scoped file read is. It must be a descendant of the session’s working directory, and the worker refuses:

  • any path reached by crossing a symlink on the way down
  • dot-files
  • key material
  • a repository root outright, with a message telling the agent to point at the subdirectory it actually meant

Choose the subdirectory containing the files you want to share.

Both survive a restart at the same URL. A share is the durable record — the port underneath it is ephemeral and moves on every rebind, while the id, the slug and the URL you already have stay put.

A worker announces the shares it is still serving when it registers, so a controller adopts them when it comes back up, and stops anything announced that no share claims. That is what keeps a directory from staying readable after its share was closed.

See remote access and previews for HTTPS and share-domain setup.