Overview

The Workspace Files API exposes filesystem operations on the computer that runs the Allternit runtime. It resolves paths against the home folder (supporting the ~ shorthand), then checks every path against a scope before it reads or writes anything. What a request may reach depends on where it came from: the Desktop app on the same computer, or another device through the relay. See Path scoping.

Base URL

For local development:

Authentication

Requests are authorized through the platform auth middleware. The route also accepts a desktop-bootstrap header as a lenient fallback so Electron desktop sessions can operate without requiring the middleware to populate an AuthUser extension. Authentication says who is asking; path scoping decides which paths that request can reach.

Endpoints

Path resolution

Paths are resolved against the home folder of the computer running the runtime:
  • ~/Allternit/Inbox resolves to the Allternit/Inbox folder in the home folder.
  • /absolute/path is used as written, then checked against the scope.
  • relative/path resolves to relative/path inside the home folder.
The runtime then makes the path canonical before any check:
  • A path with a .. part is refused, wherever the .. appears.
  • Symbolic links are followed to where they really point. For a file that does not exist yet (a write or mkdir target), the deepest folder that does exist is resolved and the rest of the path is added to it. A link that points at nothing is refused.
  • /files/delete resolves the folder that holds the target but not the target itself, so deleting a link removes the link, never what it points at.
  • Folders match whole path parts only: a rule for ~/Allternit does not cover ~/AllternitX.
  • Responses carry the canonical path, so path fields may differ from what you sent (for example, the real letter case of a folder on a case-insensitive disk).

Path scoping

Every request is either local or relayed.
  • Local: the Desktop app on the same computer, reaching the runtime over loopback with no relay or proxy header.
  • Relayed: any request replayed by the cloud relay (it carries x-allternit-relayed), any request with a forwarding header (x-forwarded-for, forwarded, x-real-ip and similar), and any request from a non-loopback address. Requests from ai.allternit.com, the m.allternit.com PWA, and the iOS and Android apps to a computer are relayed.
Both kinds of request are refused for anything outside the home folder, for changes to the home folder itself, and for the secret locations listed below.

Relayed requests

The relay carries the signed-in owner, so a relayed request keeps the features the web app, the PWA and the iOS app use, and nothing more: | FOLDER/.allternit/shared-context.md, anywhere in the home folder (a code project’s shared notes) | Read and write this exact file. Nothing else in that .allternit folder or in the project opens. | | A file an agent wrote on this computer (see Agent-written files) | Read only | Anything else answers 403, for example other files in a code project folder such as ~/Desktop/my-app/package.json.

Agent-written files

When an agent’s tool (write, edit, apply_patch, notebook, workspace-edit in Gizzi Code) writes a file, Gizzi Code reports the path to the runtime on the same computer with POST /files/bot-writes and a JSON body of {"path": "...", "session_id": "..."}. The runtime keeps the canonical path in a ledger in its data folder (at most 5,000 paths, each kept 30 days). A relayed request may then read that exact file, so a bot thread’s file cards open on the web and phone. It can never write or delete it.
  • Only a local request can add a path. A relayed request to /files/bot-writes answers 403 with reason local_only.
  • Secret locations are never recorded and stay refused.
  • The record is the path, so a file changed after the agent wrote it is still readable. A path no agent wrote is not.
  • Gizzi Code sends reports only when its API base is this computer (127.0.0.1, localhost or ::1). A missing report keeps the file closed to other devices. The runtime does not create the ~/Allternit folders; a write inside them creates the parent folders it needs.

Local requests

A local request can reach the whole home folder except the secret locations below. Paths outside the home folder (such as /etc or /tmp) are refused. The Desktop app still reads and writes skills, plugins, commands and MCP folders such as ~/.claude/skills.

Secret locations

These are refused for every caller, matched without regard to letter case (so ~/.SSH is refused too):
  • SSH, GPG and password stores: ~/.ssh, ~/.gnupg, ~/.password-store
  • macOS Keychains: ~/Library/Keychains
  • Cloud and developer credentials: ~/.aws, ~/.azure, ~/.kube, ~/.config/gcloud, ~/.config/gh, ~/.config/stripe, ~/.docker/config.json, ~/.netrc, ~/.npmrc, ~/.pypirc, ~/.git-credentials
  • Agent CLI sign-ins: ~/.claude/.credentials.json, ~/.codex/auth.json, ~/.gizzi/credentials.json, ~/.local/share/gizzi-code/auth.json, ~/.local/share/gizzi-code/fabric-lease.key, ~/.local/share/tailscale
  • Allternit keys and private state: ~/.allternit/phone-gateway.json, ~/.allternit/subscriptions, ~/.allternit/incus-client, ~/.allternit/factory/fabric, ~/.allternit/factory/registry.json, ~/.allternit/session-caretaker, ~/.allternit/system-one, and any ~/.allternit entry whose name contains .env
  • The Allternit data folders: the folder named by ALLTERNIT_DATA_DIR, the platform data folder’s allternit and @allternit folders (on macOS, ~/Library/Application Support/allternit and ~/Library/Application Support/@allternit)
Recursive listings skip entries in secret locations, and for relayed requests they skip entries outside the allowed paths.

Names and races

  • Names are compared in Unicode NFC and without regard to letter case, the way APFS compares them, so an NFD spelling of a protected name is refused too.
  • Reads and writes open the file without following a symbolic link at the end of the path. They then check where the open file really is (on macOS and Linux) and refuse the request if that is outside the scope. A folder swapped for a link between the check and the open is caught this way. A write opens the file before emptying it, so a refused write never cuts a file short. Listing, exists, mkdir and delete check the path but don’t re-check after the action. On Windows only the check before the open applies.

Computer file transfer

The computer routes that move files to and from a cloud computer or VM (/computers/COMPUTER_ID/files/upload and /computers/COMPUTER_ID/files/download) check the path on that computer by its text: it must be absolute, must not contain .., and must not point into any of the secret locations above (for example /home/user/.ssh/authorized_keys or /root/.aws/credentials), and /etc/shadow, /etc/gshadow and /etc/sudoers are refused. Both routes go through the same confirmation policy as other computer control actions (computer.file_read and computer.file_write). The same check runs for the bot desktop file routes, because it lives in the shared upload and download code. Transfer uploads (/computers/COMPUTER_ID/transfer/file) always land in a folder the runtime chooses, and answer 403 if that folder resolves into a secret location.

List files

Query parameters

Response

Recursive listings are capped at a depth of 8 and a maximum of 1,000 entries. If the directory does not exist, the endpoint returns an empty entries array rather than an error.

Read a text file

Response

Read a raw file

The response is returned with the detected Content-Type header.

Check existence

JSON variant (always returns 200):

Response

HEAD variant:
Returns 200 OK if the path exists, otherwise 404 Not Found. Both variants answer 403 for a path outside the caller’s scope.

Create a directory

Response

Delete a file or directory

Response

Write a file

The path may be supplied either as a query parameter or in the JSON body. Parent directories are created automatically.

Response

Supported MIME types

The /files/raw endpoint detects the following common types from the file extension:

Error codes

  • Files — upload and reference files for LLM requests
  • Agent Workspaces — workspace directories and paths
  • ACI — computer-interface filesystem actions