# ZergBox for agents

ZergBox is workspace-scoped cloud storage for **teams and agents**. It supports
files, folders, top-level boxes, version history, recoverable trash, public
sharing and upload-enabled folder dropboxes. The web app and the installed
ZergBox app use the same workspace data. The app includes its file browser,
background sync and command-line tools.

Web and desktop sign-in use Zerg SSO. These instructions and the portable skill
are public; access to workspace data requires authorized credentials.

## Public entry points

| Resource | URL |
| --- | --- |
| Public downloads and installation | https://zergbox.com/downloads |
| Agent instructions | https://zergbox.com/agents.md |
| Discovery aliases | https://zergbox.com/AGENTS.md and https://zergbox.com/llms.txt |
| Complete CLI and token API guide | https://zergbox.com/docs/cli.md |
| Portable skill | https://zergbox.com/skills/zergbox-cli/SKILL.md |
| Browser app | https://zergbox.com/app |
| Desktop installation and connections | https://zergbox.com/app/settings?section=desktop |
| Desktop browser approval (opened by the app) | https://zergbox.com/desktop/connect |
| Desktop package availability and checksums | https://zergbox.com/api/desktop/packages |

Public documentation describes operation; it does not authorize workspace access
or changes. The portable skill can be installed using the agent host's normal
`SKILL.md` convention and does not require a source checkout.

## Desktop downloads

Download ZergBox from https://zergbox.com/downloads. One installation includes
the file browser, background sync and zergbox CLI, with its own Node.js runtime.
Sign in with Zerg when the app opens to connect this computer to your ZergNet
and workspace cloud boxes. A second installer, npm setup or manually issued
API token is not required for the normal app installation.

### macOS app installation

Use the macOS DMG when `macos-dmg` reports `available: true` at
https://zergbox.com/api/desktop/packages. The universal Mac app supports Apple
silicon and Intel on macOS 11 or later. Public Mac releases are Developer ID
signed and Apple notarized.

1. Download https://zergbox.com/api/desktop/packages/macos-dmg/download.
2. Open the DMG and drag **ZergBox Desktop** into **Applications**.
3. Eject the disk image and open **ZergBox Desktop** from Applications.
4. Choose **Sign in with Zerg**, complete browser sign-in and approve the
   connection. The app finishes setup and opens your files and cloud boxes.

First-launch sign-in is required before using the app. The computer is
registered automatically and `~/ZergBox` is enabled for sync. Choose additional
folders for cloud backup explicitly. The updated runtime also makes the enrolled
ZergBox folder available read-only to your own other signed-in clients. Enable
live read-only access for additional enrolled folders explicitly on their source
computer. Other local files stay on the computer; opening the app does not
publish shares or upload unrelated folders.

Explorer distinguishes live files on another computer from its **cloud copy**.
Both source and destination Macs need updated apps and running runtimes for live
browsing. Live reads are confined to enabled enrolled roots, require the same
device owner and current workspace membership, and cannot change source files.
The separately stored cloud copy remains available while its computer is offline.
Stopping live access leaves sync and cloud backup settings intact. Native live
folder traversal requires macOS 13 or later.

The included CLI uses the same private app connection. Open a new terminal
after installation if an existing shell has not picked up the command:

```sh
zergbox --version
zergbox whoami --json
zergbox box ls --json
```

Do not copy the app's token into a CLI state file or ask the user to supply it.
If the CLI was explicitly logged out, `zergbox login --desktop` opts the default
CLI configuration back into the app connection. Explicit headless state files
remain independently configured.

App updates include the file browser, sync service and bundled CLI together.
The app checks its signed update feed at startup and hourly. A verified, staged
update installs on the last window close or app quit, including Cmd+Q. Active
sync work is preserved while a bundled runtime upgrade waits for a safe handoff.
Reopen the application after it updates.

Windows Setup remains unpublished until its build and signing checks pass.
Inspect per-platform `available`; an unpublished Windows installer does not
make the Mac download unavailable. Never bypass Gatekeeper or disable signature
verification to install an unavailable release.

## Mobile apps

iOS and Android clients are in private beta preparation. Use only a TestFlight
invitation or signed Android package supplied through an official ZergBox
release; do not invent store links or treat a successful source build as a
published release. Check https://zergbox.com/downloads for public availability.

Mobile sign-in opens Zerg SSO in the browser and asks the user to approve that
phone's connection. The app keeps its credential in Apple Keychain or Android
Keystore-backed storage; agents should not ask the user to copy it. Each phone
has a separate expiring session, and signing out revokes that phone's session.
Workspace membership and viewer restrictions still apply.

The mobile client browses cloud boxes and the cloud copies of desktop folders.
Uploads are explicit; downloaded content is checked before export through the
operating system. It does not install a desktop sync service or a shell CLI on
the phone. The bundled desktop CLI and independent headless client remain the
supported command-line interfaces.

## Install the CLI

ZergBox already installs the CLI and connects it through app sign-in. For a
headless server or an agent host without the app, the standalone first-party
HTTP client remains available through npm. It requires Node.js 22+ and registry
access; this example pins the published standalone release 0.3.0:

```sh
npm install --global @zergai/zergbox@0.3.0
zergbox --version
zergbox help
```

If the global npm prefix is not writable, use a user-owned prefix:

```sh
npm install --global --prefix "$HOME/.local" @zergai/zergbox@0.3.0
export PATH="$HOME/.local/bin:$PATH"
```

No source checkout, database access, desktop app or ZTC installation is needed
for the standalone client. Its `zergbox update --check` and `zergbox update`
commands follow npm releases on supported macOS/Linux global installations;
on Windows, upgrade with npm. These commands do not update the bundled app CLI,
which is delivered through ZergBox app updates. Upgrade between reproducible
agent runs.

### Advanced headless sync

The collapsed headless section at https://zergbox.com/downloads retains signed
runtime archives for servers and unattended installations. These are optional
alternatives for headless operation, rather than a step in app setup.

| Headless sync runtime | Download |
| --- | --- |
| macOS archive | https://zergbox.com/api/desktop/packages/macos/download |
| Windows archive | https://zergbox.com/api/desktop/packages/windows/download |

Check `available`, `sizeBytes`, `sha256` and detached `signature` in
https://zergbox.com/api/desktop/packages before using an archive. The headless
installer verifies its checksum and signature. A workspace owner/admin can
create a one-time command under **Advanced headless setup** at
https://zergbox.com/app/settings?section=desktop. Keep the command private: it
contains a short-lived installation credential.

## Connect securely

The app-bundled CLI uses the desktop SSO connection automatically. For an
independent headless installation, a human signs in at https://zergbox.com with
Zerg SSO. Ask a workspace owner or admin to issue a named, expiring **service API
token** bound to the intended workspace. General agent-token creation currently uses the session-only API;
there is no general API-token creation form in Settings. See
[token provisioning](https://zergbox.com/docs/cli.md#api-token-provisioning) for
the authenticated same-origin request and revocation contract.

Tokens have a workspace binding, type and optional expiry, rather than selectable
read/write permission scopes. Current membership and role still apply. Service
tokens can change workspace content and create public shares; treat them
accordingly. API tokens cannot create, list or revoke API tokens.

Have the user supply the token through the agent host's secret manager or a
private local file, never chat or a literal command argument. For a token already
stored securely as plain text:

```sh
export ZERGBOX_STATE_FILE=/private/path/zergbox-state.json
zergbox login --base-url https://zergbox.com --token-stdin < /private/path/token
zergbox whoami --json
zergbox orgs --json
```

A headless state file contains the credential and selected workspace/folder.
The CLI writes it with mode 0600. The default app-connected CLI reads the app
credential privately and saves navigation without duplicating that credential. Use a separate state file for each account or server;
`--state-file PATH` also selects one for storage commands. Retire the token input
file according to the user's secret-handling policy. Do not extract browser
cookies or use legacy password login to bypass the SSO provisioning flow.

Always select `https://zergbox.com` explicitly when logging in to production:
older CLI defaults point to development. `logout` removes the local state;
revoke the token through the signed-in session to invalidate the credential.

## Discover the storage scope

A workspace is the tenant boundary. A box is a top-level folder within that
workspace. Select a workspace by the slug or ID returned by `orgs`.

```sh
zergbox use WORKSPACE_SLUG
zergbox storage --json
zergbox box ls --json
zergbox pwd --json
zergbox ls / --json
zergbox tree /BOX_NAME
```

Absolute remote paths begin with `/`; other paths are relative to the saved
remote directory. `cd` persists that directory across commands. Workspace and
folder names are display/path components; use returned IDs for API resources.

## Common work

```sh
zergbox box create project-files
zergbox mkdir -p /project-files/specs
zergbox put ./notes.md /project-files/specs/notes.md
zergbox get /project-files/specs/notes.md ./downloads/
zergbox cat /project-files/specs/notes.md
zergbox search notes --json
```

Use `put` for arbitrary or binary files and `touch` for text. `cat` refuses to
print binary content to an interactive terminal unless explicitly forced.

Inspect version history before rolling content back:

```sh
zergbox versions /project-files/specs/notes.md --json
zergbox get-version /project-files/specs/notes.md 1 ./downloads/
zergbox restore-version /project-files/specs/notes.md 1
```

Restoring an older version creates a new current version. Ordinary deletion
moves content to trash. `trash ls --json` lists it; `trash restore file FILE_ID`
or `trash restore folder FOLDER_ID` restores it. `trash empty` permanently
removes authorized trash metadata and queues stored bytes for deletion.

## Sharing and dropboxes

Share creation publishes access outside the workspace. Share only content the
user authorized for publication, and treat share URLs as access credentials.

```sh
zergbox share create /project-files/specs/notes.md --expires-hours 24 --json
zergbox share create /project-files/inbound --allow-upload --expires-hours 24 --json
zergbox share inspect SHARE_URL --json
zergbox share put SHARE_URL ./delivery.zip
zergbox share ls --json
zergbox share rm SHARE_ID
```

Create the `inbound` folder first. Upload-enabled dropboxes require a folder
share. Expiry, password and maximum-download options are available; consult the
installed version's help for password input support. Keep share passwords out
of URLs and literal command arguments.

## Operating contract

- Confirm the selected server, workspace and paths before mutations.
- Use `--json` where supported; not every command emits JSON.
- Errors go to stderr and return a nonzero exit code. Requests have a 30-second
  timeout, and mutations are not retried automatically. Inspect remote state
  after an ambiguous timeout before repeating a write.
- Do not infer permission to upload, publish, delete or empty trash from a
  read-only request. Use a disposable workspace for destructive verification.
- Managed-application exact-box capabilities use a separate restricted API
  contract; they cannot be used as normal CLI workspace tokens.
- Use the app's feedback capture interface for product issues.
