Skip to content
space-env (inside a machine)

space-env reference (inside a machine)

space-env runs inside a machine; Building blocks explains what it is for. This page is the --help of every command, as the binary prints it in the machine, and the socket API it is a client of.

Exit status

CodeMeaning
0Success
1Error (the message says why; “temporary; try again” when a retry may work); schema compare: the space differs from the file
2Usage error: unknown command or flag, missing or invalid value; schema compare: any error (a bad file, another space, the platform unreachable)
3receive: no matching message within the timeout; sessions wait: the session hasn’t finished in time
5export: the archive would be larger than --max-bytes

space-env

Act on the platform from inside an AgentSpaces machine: message the other machines of your project,
schedule messages to yourself, publish metadata, fork this machine and keep services running.

Messages are like email between colleagues: big, slow, read when the receiver is ready. They are not
for quick back-and-forth (not RPC); put everything the receiver needs in one message. Unclaimed
messages are erased after 24 hours.

Usage: space-env <COMMAND>

Commands:
  whoami          Print this machine's name and id, its project, who created it and which user it
                  acts for
  send            Send a message to a machine or an agent of your project, or to your owner on a
                  chat app
  agents          Your project's agents as a tree; spawn, change, stop and delete the agents below
                  you (agent machines)
  notify          Write to your human, the person your machine works for, whether or not they have a
                  chat with you (agent machines)
  receive         Take the oldest matching message from your inbox, waiting for one
  waiting         List the messages waiting in your inbox, without taking them
  fork            Checkpoint this machine, create machine NAME from it, and queue a task as its
                  first message
  checkpoints     List, create and tag this machine's checkpoints
  sessions        Your sessions (agent machines): list them, start one on yourself for a task, wait
                  for its result
  forks           List the forks this machine created, or delete one when you are done with it
  machines        Manage the ordinary machines of your project (an agent's or a Claude Code
                  session's machine): list, show, create, fork, label, sleep, wake and delete them
  resize          Resize this machine: its vCPUs, memory or disk (the rest stays). It answers first,
                  then restarts into the new size a few seconds later: what runs here stops, the
                  disk is kept. The disk only grows. Needs the resize_self grant
  schedule        Schedule messages to yourself: once, or on a cron expression
  topic           Create, remove and list topics: names that machines and agents publish to and
                  subscribe to
  publish         Publish JSON to a topic you own: every subscription that matches gets it as a
                  message
  subscribe       Subscribe to a topic or a wildcard: what is published there arrives in your inbox
  unsubscribe     End one of your subscriptions
  subscriptions   List your subscriptions: filter, QoS, once, since when, delivered, dropped, reason
  meta            Publish facts about this machine and find machines of your project by theirs
  services        Manage this machine's services: programs kept running, also across sleep and
                  reboots
  artifact        Share files with people and other agents: upload one, get a URL to hand out
  bucket          Public buckets: publish a static site and serve it from your web portal
  share           Show artifacts to the people of your organization: a page they open after signing
                  in
  wakelock        Keep this machine awake while you work: it sleeps after a while with no activity
  status          Show why this machine is awake, or when it goes to sleep if nothing happens
  credential      Use your project's credentials: read one, list them, or ask your user for one
  run             Run a command with credentials in its environment; exit with its status
  git-credential  git's credential helper: a token for a git host from your project's credentials
  gateway         Use the model gateway: coding agents reach Anthropic, OpenAI and Mistral with your
                  project's keys, which stay out of the machine
  git             The org's git service at http://git.space: Forgejo, with its CLI fj behind the pr,
                  issue, repo and whoami commands. No login: the platform signs this machine in as
                  the user it works for
  bugreport       Report a bug in the platform (space-env, the machine, the portal) to the
                  AgentSpaces team, or request a feature
  acp             The machine's agent over ACP (agent machines): attach a client to its session
  layers          An agent's layers: its project's, its owner's and its own repo, checked out in
                  /space and laid out as its instructions, skills and memory
  export          A copy of exactly what this machine's agent reads: its instructions, skills,
                  memory and settings, and a manifest (.tar.zst)
  tools           Run this machine's agent's tools in another machine of its project (the tool link)
  web-portal      Put this machine on the internet behind a web portal (a sign-in gate), change it,
                  and manage its users
  screens         Write the project's screens (.screens/ of its repository): check them as the
                  portal does, with a sketch of each layout, and start from a worked example or the
                  schema
  schema          Print the entities of a space; write the space as a space.toml, or compare it with
                  one
  docs            Print the agents' handbook: how to work in a space, and each command in a line
  help            Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Examples:
  space-env whoami
  space-env send issue-1 --context issue-1 --text "Fix issue 1; reply when pushed."
  space-env receive --type agent --timeout 1

In a machine an agent's tools are attached to, a command acts as the agent when it is about the
agent and as the machine when it is about the machine (space-env tools --help); --as-agent or
--as-machine, with any command, overrides that.

Exit status: 0 ok, 1 error, 2 usage, 3 no matching message in time.

space-env whoami

Print this machine's name and id, its project, who created it and which user it acts for

Usage: space-env whoami

Options:
  -h, --help
          Print help

project is the slug of this machine's project: it reaches (messages, metadata, forks) only machines
of the same project. created_by is user:ID (a person, from the portal or space), vm:ID (this machine
is a fork of that machine) or operator; on_behalf_of is the user this machine works for (a fork has
its parent's). Both are ids, never names; "unknown" for machines older than the record.

On an agent's machine the machine is the agent: then it also prints the agent (agent:NAME, the name
others send to), its kind, role and supervisor (none for your human's root agent), and the chats
your human has with it (telegram, google chat; none).

Example:
  space-env whoami

space-env send

Send a message to a machine or an agent of your project, or to your owner on a chat app

Usage: space-env send [OPTIONS] [MACHINE]

Arguments:
  [MACHINE]
          The receiving machine's name, or agent:NAME for an agent (none for a channel message)

Options:
      --text <TEXT>
          A text part (repeatable; parts keep their order)

      --data <JSON>
          A JSON data part (repeatable)

      --context <ID>
          Conversation id; copy it from the message you answer

      --reply
          This answers a request (role ROLE_AGENT) instead of making one (ROLE_USER). An agent's
          answer goes back to the session that asked

      --session <ID>
          The receiving agent's session it is for (`main` or `s-<12 hex>`; default: main, or for an
          answer the session that asked)

      --info <TEXT>
          A status line that needs no answer (type info), instead of --text/--data

      --type <TYPE>
          A channel message to your owner, of this type (channel.<kind>.<method>), with --payload
          instead of --text/--data/--info

      --payload <JSON>
          The channel message's payload: a JSON object

      --qos <QOS>
          How hard to get the receiver's attention: whenever, notify (wakes it) or urgent (wakes it
          and interrupts its agent)

          [default: whenever]
          [possible values: whenever, notify, urgent]

  -h, --help
          Print help

Examples:
  space-env send issue-1 --context issue-1 --text "Fix issue 1; reply when pushed."
  space-env send parent --reply --context issue-1 --text "done: issue-1 pushed"
  space-env send parent --info "tests green on issue-1"
  space-env send issue-1 --context issue-1 --text "see:" --data '{"issue": 1}'
  space-env send parent --qos urgent --info "blocked: the build needs a secret"
  space-env send agent:dev --qos notify --info "web is up: add the /health page"
  space-env send --type channel.telegram.sendMessage --payload '{"text": "Deployed."}'

A channel message (--type channel.<kind>.<method>) goes to your owner on the chat app their
conversation with you is on, not to a machine: give no MACHINE. Its payload is the app's own (for
Telegram, the Bot API method's parameters without chat_id). Messages from your owner arrive as
channel.chat.<event> (receive --type channel.chat.message); a refused one comes back as
channel.<kind>.error.

QoS: whenever (default) waits for the receiver's next receive; notify also wakes a sleeping receiver
and announces the message at once; urgent wakes it and interrupts its agent. Use urgent only when
the receiver must stop what it does.

An agent of the project is agent:NAME: it gets the message on its machine as a prompt that names
you, once it is idle. An agent's messages go out as agent:NAME.

Prints the message's id.

space-env agents

Your project's agents as a tree; spawn, change, stop and delete the agents below you (agent
machines)

Usage: space-env agents [COMMAND]

Commands:
  list    The project's agents as a tree under each human's root agent, you marked (the default)
  spawn   Start a subagent under you, on a machine of its own: it works for the same human and
          reports to you
  role    Change the role (and description) of an agent below you
  stop    Stop an agent below you: it keeps its record and its machine
  delete  End an agent below you for good: it, the agents below it, their machines and the machines
          they created are deleted
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

On an agent's machine the machine is the agent: these act as it, and the platform lets it change
only the agents below it. A subagent works for the same human, on a machine of its own, and reports
to you: give it its task with space-env send agent:NAME --qos notify. It counts against your human's
agents in the project.

Examples:
  space-env agents
  space-env agents spawn dev --role "Builds the web app" --harness claude
  space-env agents role dev "Reviews the web app's MRs"
  space-env agents stop dev
  space-env agents delete dev

space-env agents list

The project's agents as a tree under each human's root agent, you marked (the default)

Usage: space-env agents list

Options:
  -h, --help
          Print help

space-env agents spawn

Start a subagent under you, on a machine of its own: it works for the same human and reports to you

Usage: space-env agents spawn [OPTIONS] --role <ROLE> <NAME>

Arguments:
  <NAME>
          Its name: 1-40 of a-z 0-9 -, unique in the project

Options:
      --role <ROLE>
          One line: what it is for

      --description <DESCRIPTION>
          What it should know and do, at most 4 KiB

          [default: ""]

      --harness <HARNESS>
          Its harness: vibe (the default), claude, codex or pi

          [possible values: vibe, claude, codex, pi]

  -h, --help
          Print help

space-env agents role

Change the role (and description) of an agent below you

Usage: space-env agents role [OPTIONS] <NAME> <ROLE>

Arguments:
  <NAME>
          The agent's name

  <ROLE>
          Its new role, one line

Options:
      --description <DESCRIPTION>
          Its new description

  -h, --help
          Print help

space-env agents stop

Stop an agent below you: it keeps its record and its machine

Usage: space-env agents stop <NAME>

Arguments:
  <NAME>
          The agent's name

Options:
  -h, --help
          Print help

space-env agents delete

End an agent below you for good: it, the agents below it, their machines and the machines they
created are deleted

Usage: space-env agents delete <NAME>

Arguments:
  <NAME>
          The agent's name

Options:
  -h, --help
          Print help

space-env notify

Write to your human, the person your machine works for, whether or not they have a chat with you
(agent machines)

Usage: space-env notify [OPTIONS] <TEXT>

Arguments:
  <TEXT>
          What to tell them, in Markdown; short: they read it on a phone. `-`: read it from stdin

Options:
      --qos <QOS>
          notify (the default), whenever (kept for them, nothing sent) or urgent (reaches them at
          once, also at night; 3 a day)

          [default: notify]
          [possible values: whenever, notify, urgent]

      --channel <CHANNEL>
          A route to try first: an app the owner talks to you on (`whoami` lists them), app or mail
          (default: the portal picks)

      --artifact <NAME>
          An artifact of your project to send along (a photo or a file; `space-env artifact put` it
          first)

      --json
          Print the portal's answer as JSON instead of its line

  -h, --help
          Print help

The portal keeps every notification for them and sends it by its QoS: notify, the default, to their
app and the chat they have with you (mail when neither took it); whenever nowhere, kept only (when
you worked mostly on your own and nothing waits on them); urgent everywhere at once, also at night,
repeated until they saw it (3 a day: a fourth is refused, send it again as notify).

It waits for the portal's answer (up to 20 s) and prints its line: where it went. When they have a
chat with you, a second line says so: talk to them there, by answering; notify is for when they
aren't talking to you. Without one, use it sparingly, for what only they can answer or must know.

Examples:
  space-env notify "Done: the **build** is green, MR !17 waits for your review."
  space-env notify "Nightly run done." --qos whenever
  space-env notify "Which of the two designs?" --channel app

Exit status 1: the portal refused it or it failed (the line says why); 0 when it was kept or sent,
also when the portal hasn't answered in time (submitted, whether it was delivered is unknown).

space-env receive

Take the oldest matching message from your inbox, waiting for one

Usage: space-env receive [OPTIONS]

Options:
      --type <TYPE>
          Only messages of this type: agent, info, or a channel type such as channel.chat.message
          (repeatable)

      --context <ID>
          Only messages of this conversation

      --timeout <SECONDS>
          Wait up to this many seconds (0: don't wait; at most 3600)

          [default: 60]

  -h, --help
          Print help

It is then gone from your inbox: act on it or note it. Messages that don't match stay for later.

In a machine with an agent service, don't wait here for messages to come: each one that arrives is
announced in the agent's session (a line starting with [space-env] A message is waiting), which
starts a turn. End your turn instead, and receive with --timeout 0 when the line comes. --timeout is
for scripts.

Examples:
  space-env receive --timeout 0
  space-env receive --type agent --timeout 1
  space-env receive --context issue-1 --timeout 1

Prints the message (JSON). Exit status 3: nothing matched in time. A message is taken once it is
printed: if receive is killed first, or can't write it out, the message is handed out again within
30 seconds.

space-env waiting

List the messages waiting in your inbox, without taking them

Usage: space-env waiting [OPTIONS]

Options:
      --older-than <SECONDS>
          Only messages that have waited at least this many seconds

          [default: 0]

  -h, --help
          Print help

Example:
  space-env waiting --older-than 5

One message (JSON) per line, oldest first.

space-env fork

Checkpoint this machine, create machine NAME from it, and queue a task as its first message

Usage: space-env fork [OPTIONS] <NAME>

Arguments:
  <NAME>
          The new machine's name

Options:
      --text <TEXT>
          A text part of the task (repeatable; parts keep their order)

      --data <JSON>
          A JSON data part of the task (repeatable)

      --context <ID>
          Conversation id (default: NAME)

      --hot
          Copy this machine's memory too: the fork starts with its programs running

  -h, --help
          Print help

The fork has this machine's disk (files, repos, tools) as it is now, not your conversation: write
the task so a newcomer can do it, and say that it should reply to you. Commit what it needs first.
The command returns when the fork runs; it counts against your org's quota.

--hot copies this machine's memory too, so the fork starts with its programs running; this machine
pauses while it is copied. Not on a machine that runs an agent. When a hot fork can't be made, the
fork is an ordinary one and says why.

Example:
  space-env fork issue-2 --text "Fix issue 2 on branch issue-2, push, reply to me."

space-env checkpoints

List, create and tag this machine's checkpoints

Usage: space-env checkpoints [COMMAND]

Commands:
  list    List this machine's checkpoints: name, tags, time (the default)
  create  Checkpoint this machine, under NAME (none: named after the snapshot) and with tags
  tag     Add tags to one of this machine's checkpoints
  untag   Remove tags from one of this machine's checkpoints
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A checkpoint is a copy of this machine's disk under a name, unique in the org; the owner restores
the machine to it or creates new machines from it (space machines restore, space machines create
--from). Tags label checkpoints: a checkpoint has any number, and a tag may be on several. With
--unique a tag moves: it comes off this machine's other checkpoints, so it always names one (latest,
good). A tag that only one checkpoint has stands in for its name. Tags have the format of names and
never equal one. Creating a checkpoint pauses this machine for a moment.

Examples:
  space-env checkpoints
  space-env checkpoints create before-upgrade --tag good
  space-env checkpoints create --tag latest --unique
  space-env checkpoints tag before-upgrade stable --unique
  space-env checkpoints untag before-upgrade good

space-env checkpoints list

List this machine's checkpoints: name, tags, time (the default)

Usage: space-env checkpoints list

Options:
  -h, --help
          Print help

Example:
  space-env checkpoints list

space-env checkpoints create

Checkpoint this machine, under NAME (none: named after the snapshot) and with tags

Usage: space-env checkpoints create [OPTIONS] [NAME]

Arguments:
  [NAME]
          1-63 characters of a-z 0-9 . _ -, starting with a letter or digit; unique in the org

Options:
      --tag <TAG>
          A tag to put on it (repeat for more)

      --unique
          Take the tags off this machine's other checkpoints

  -h, --help
          Print help

The machine pauses while its disk is copied (a second or two), then carries on. Prints the
checkpoint's name.

Examples:
  space-env checkpoints create before-upgrade
  space-env checkpoints create --tag latest --unique

space-env checkpoints tag

Add tags to one of this machine's checkpoints

Usage: space-env checkpoints tag [OPTIONS] <CHECKPOINT> <TAGS>...

Arguments:
  <CHECKPOINT>


  <TAGS>...


Options:
      --unique
          Take the tags off this machine's other checkpoints

  -h, --help
          Print help

CHECKPOINT is its name, or a tag only one of this machine's checkpoints has. Prints the checkpoint's
tags.

Examples:
  space-env checkpoints tag before-upgrade good
  space-env checkpoints tag before-upgrade stable --unique

space-env checkpoints untag

Remove tags from one of this machine's checkpoints

Usage: space-env checkpoints untag <CHECKPOINT> <TAGS>...

Arguments:
  <CHECKPOINT>


  <TAGS>...


Options:
  -h, --help
          Print help

Example:
  space-env checkpoints untag before-upgrade good

space-env sessions

Your sessions (agent machines): list them, start one on yourself for a task, wait for its result

Usage: space-env sessions [COMMAND]

Commands:
  list  List your sessions, main first, then the others newest first (the default); `*` marks the
        one this runs in
  new   Start a session on yourself with TASK as its first prompt; prints its id. Its last answer
        comes back to this session as a report
  wait  Wait for a session you started to finish and print its last answer (then its report isn't
        given). Exit 3 when it didn't finish in time
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A session is one conversation with you, the agent: your main session and the others, on this
machine, sharing its disk. `sessions new` starts one for a task, as a cheap subagent that needs no
machine of its own; its last answer comes back to the session that started it as a report, or to
`sessions wait`. In a session other than main, change work kept in git only in a git worktree of
that session.

Examples:
  space-env sessions
  space-env sessions new "Count the TODOs in ~/web and list the files"
  space-env sessions wait s-3f9a0c12b7de --timeout 600

space-env sessions list

List your sessions, main first, then the others newest first (the default); `*` marks the one this
runs in

Usage: space-env sessions list [OPTIONS]

Options:
      --json
          As JSON, one session a line

  -h, --help
          Print help

space-env sessions new

Start a session on yourself with TASK as its first prompt; prints its id. Its last answer comes back
to this session as a report

Usage: space-env sessions new <TASK>

Arguments:
  <TASK>
          The task: everything it needs, as for a newcomer (it doesn't share this conversation)

Options:
  -h, --help
          Print help

space-env sessions wait

Wait for a session you started to finish and print its last answer (then its report isn't given).
Exit 3 when it didn't finish in time

Usage: space-env sessions wait [OPTIONS] <ID>

Arguments:
  <ID>
          The session's id (`s-<12 hex>`)

Options:
      --timeout <SECONDS>
          Wait up to this many seconds (at most 3600)

          [default: 600]

  -h, --help
          Print help

space-env forks

List the forks this machine created, or delete one when you are done with it

Usage: space-env forks [COMMAND]

Commands:
  list    List your forks: name, state, and how many forks each has (the default)
  delete  Delete a fork you created, with its disk and checkpoints
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

You can delete only the forks you created yourself, not your forks' forks, not other machines. A
fork that has forks of its own is refused unless --cascade, which deletes them too, deepest first.

Examples:
  space-env forks
  space-env forks delete issue-1

space-env forks list

List your forks: name, state, and how many forks each has (the default)

Usage: space-env forks list

Options:
  -h, --help
          Print help

Example:
  space-env forks list

space-env forks delete

Delete a fork you created, with its disk and checkpoints

Usage: space-env forks delete [OPTIONS] <NAME>

Arguments:
  <NAME>
          The fork's name

Options:
      --cascade
          Also delete its own forks (and theirs)

  -h, --help
          Print help

Delete a fork once you have acted on its result. It is gone for good: fetch what you need from it
first.

Examples:
  space-env forks delete issue-1
  space-env forks delete issue-2 --cascade

Prints each machine deleted, deepest first.

space-env machines

Manage the ordinary machines of your project (an agent's or a Claude Code session's machine): list,
show, create, fork, label, sleep, wake and delete them

Usage: space-env machines [COMMAND]

Commands:
  list      The project's ordinary machines: name, state, size, label (the default)
  show      One machine
  create    Create a machine from a guest image
  fork      Fork a machine: a new machine of its size from a copy of its disk
  label     Set a machine's label (what the canvas shows); without one, remove it
  timezone  Set a running machine's time zone
  sleep     Put a machine to sleep
  wake      Wake a machine
  resize    Resize a machine: its vCPUs, memory or disk (the rest stays). A running one restarts
            into it; a sleeping one takes it when it next wakes. The disk only grows
  delete    Delete a machine you (or an agent below you) created, with its disk and checkpoints:
            gone for good
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Only an agent's machine (or a Claude Code session's) manages machines, and only ordinary ones of its
own project: not agents' machines (each goes with its agent, and none is forked; your own neither)
and not the org's services. You delete only machines you (or an agent below you) created; the
project's other machines are refused. A Claude Code session's machine does the same as its member,
and also deletes the member's own machines. A machine you create works for your owner, holds no more
grants than yours and counts against the project's quota. To work on one, attach your tools to it
(space-env tools attach NAME).

Examples:
  space-env machines
  space-env machines create web --mem 4096
  space-env machines fork web web-try
  space-env machines label web "Web server"
  space-env machines sleep web-try
  space-env machines resize web --mem 8192
  space-env machines delete web-try

space-env machines list

The project's ordinary machines: name, state, size, label (the default)

Usage: space-env machines list

Options:
  -h, --help
          Print help

space-env machines show

One machine

Usage: space-env machines show <NAME>

Arguments:
  <NAME>
          The machine's name

Options:
  -h, --help
          Print help

space-env machines create

Create a machine from a guest image

Usage: space-env machines create [OPTIONS] <NAME>

Arguments:
  <NAME>
          Its name: 1-63 of a-z 0-9 -, unique in the org

Options:
      --image <IMAGE>
          A guest image name (default: the region's)

      --vcpus <VCPUS>
          vCPUs (default 2)

      --mem <MIB>
          Memory in MiB (default 2048)

      --disk <GIB>
          Disk in GiB (default 10)

      --asleep
          Create it sleeping: make its disk, don't start it

      --timezone <TIMEZONE>
          An IANA time zone, e.g. Europe/Amsterdam

  -h, --help
          Print help

space-env machines fork

Fork a machine: a new machine of its size from a copy of its disk

Usage: space-env machines fork [OPTIONS] <VM> <NAME>

Arguments:
  <VM>
          The machine to fork (not an agent's)

  <NAME>
          The new machine's name

Options:
      --hot
          Copy its memory too: the fork starts with its programs running

  -h, --help
          Print help

--hot copies its memory too, so the fork starts with its programs running; the machine pauses while
it is copied. When a hot fork can't be made, the fork is an ordinary one and says why.

space-env machines label

Set a machine's label (what the canvas shows); without one, remove it

Usage: space-env machines label <NAME> [LABEL]

Arguments:
  <NAME>
          The machine's name

  [LABEL]
          The label

Options:
  -h, --help
          Print help

space-env machines timezone

Set a running machine's time zone

Usage: space-env machines timezone <NAME> <TIMEZONE>

Arguments:
  <NAME>
          The machine's name

  <TIMEZONE>
          An IANA time zone, e.g. Europe/Amsterdam

Options:
  -h, --help
          Print help

space-env machines sleep

Put a machine to sleep

Usage: space-env machines sleep <NAME>

Arguments:
  <NAME>
          The machine's name

Options:
  -h, --help
          Print help

space-env machines wake

Wake a machine

Usage: space-env machines wake <NAME>

Arguments:
  <NAME>
          The machine's name

Options:
  -h, --help
          Print help

space-env machines resize

Resize a machine: its vCPUs, memory or disk (the rest stays). A running one restarts into it; a
sleeping one takes it when it next wakes. The disk only grows

Usage: space-env machines resize [OPTIONS] <NAME>

Arguments:
  <NAME>
          The machine's name

Options:
      --vcpus <VCPUS>
          vCPUs, 1-8

      --mem <MIB>
          Memory in MiB, 256-16384

      --disk <GIB>
          Disk in GiB, at least its current size

  -h, --help
          Print help

space-env machines delete

Delete a machine you (or an agent below you) created, with its disk and checkpoints: gone for good

Usage: space-env machines delete <NAME>

Arguments:
  <NAME>
          The machine's name

Options:
  -h, --help
          Print help

space-env resize

Resize this machine: its vCPUs, memory or disk (the rest stays). It answers first, then restarts
into the new size a few seconds later: what runs here stops, the disk is kept. The disk only grows.
Needs the resize_self grant

Usage: space-env resize [OPTIONS]

Options:
      --vcpus <VCPUS>
          vCPUs, 1-8

      --mem <MIB>
          Memory in MiB, 256-16384

      --disk <GIB>
          Disk in GiB, at least its current size

  -h, --help
          Print help

Examples:
  space-env resize --mem 8192
  space-env resize --vcpus 4 --disk 40

space-env schedule

Schedule messages to yourself: once, or on a cron expression

Usage: space-env schedule <COMMAND>

Commands:
  at      Send yourself a message once, at TIME
  cron    Send yourself a message on a cron expression (UTC)
  list    List your schedules
  cancel  Cancel a schedule
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Each firing puts an agent message (role ROLE_USER, from "schedule") in your own inbox; receive it
like any other. Times are UTC. A schedule outlives your session and reboots; it is deleted with the
machine.

Examples:
  space-env schedule at +30m --text "Check whether the deploy finished."
  space-env schedule cron "0 9 * * mon-fri" --context standup --text "Post the standup."
  space-env schedule list

space-env schedule at

Send yourself a message once, at TIME

Usage: space-env schedule at [OPTIONS] <TIME>

Arguments:
  <TIME>
          When: +DURATION (s, m, h, d) or an RFC 3339 time

Options:
      --text <TEXT>
          A text part (repeatable; parts keep their order)

      --data <JSON>
          A JSON data part (repeatable)

      --label <TEXT>
          The schedule's short name, one line of at most 40 characters: the portal's canvas shows
          it. Not part of the message

      --description <TEXT>
          What the schedule is for, in detail (at most 1000 characters, line breaks allowed): the
          portal shows it beside the label. Not part of the message

      --context <ID>
          Conversation id of every firing (default: schedule-<first 8 characters of the id>)

      --qos <QOS>
          whenever, notify (wakes this machine if it sleeps) or urgent (also interrupts the agent)

          [default: whenever]
          [possible values: whenever, notify, urgent]

  -h, --help
          Print help

TIME is +N followed by s, m, h or d (from now: +90s, +30m, +2h, +1d), or an RFC 3339 time
(2026-11-08T09:00:00Z). At most 366 days ahead.

Examples:
  space-env schedule at +30m --text "Check whether the deploy finished."
  space-env schedule at 2030-01-01T09:00:00Z --qos notify --text "Renew the cert."

Prints the schedule's id and when it fires.

space-env schedule cron

Send yourself a message on a cron expression (UTC)

Usage: space-env schedule cron [OPTIONS] <EXPR>

Arguments:
  <EXPR>
          The cron expression (quote it)

Options:
      --text <TEXT>
          A text part (repeatable; parts keep their order)

      --data <JSON>
          A JSON data part (repeatable)

      --label <TEXT>
          The schedule's short name, one line of at most 40 characters: the portal's canvas shows
          it. Not part of the message

      --description <TEXT>
          What the schedule is for, in detail (at most 1000 characters, line breaks allowed): the
          portal shows it beside the label. Not part of the message

      --context <ID>
          Conversation id of every firing (default: schedule-<first 8 characters of the id>)

      --qos <QOS>
          whenever, notify (wakes this machine if it sleeps) or urgent (also interrupts the agent)

          [default: whenever]
          [possible values: whenever, notify, urgent]

  -h, --help
          Print help

EXPR has five fields: minute hour day-of-month month day-of-week, each *, a number, a range (1-5), a
list (1,15) or a step (*/15); names such as mon or jan work. Shortcuts: @hourly, @daily, @weekly,
@monthly, @yearly. The finest interval is one minute. A run missed while the platform was down fires
once, late.

Examples:
  space-env schedule cron "*/30 * * * *" --context ci-watch --text "Look at CI; fix what is red."
  space-env schedule cron "0 9 * * mon-fri" --label "Daily standup" --text "Post the standup."
  space-env schedule cron @daily --label Logs --description "Keep a week." --text "Rotate the logs."

Prints the schedule's id and when it fires first.

space-env schedule list

List your schedules

Usage: space-env schedule list

Options:
  -h, --help
          Print help

Example:
  space-env schedule list

space-env schedule cancel

Cancel a schedule

Usage: space-env schedule cancel <ID>

Arguments:
  <ID>
          The schedule's id (from schedule list)

Options:
  -h, --help
          Print help

Example:
  space-env schedule cancel 5f0c2a8e-3b1d-4c7a-9e2f-6a8b0c1d2e3f

space-env topic

Create, remove and list topics: names that machines and agents publish to and subscribe to

Usage: space-env topic <COMMAND>

Commands:
  create  Create a topic of your own, under project/
  remove  Remove a topic you own: the subscriptions to exactly it end (wildcards stay)
  list    List the topics that exist and you may see, with their owners
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A topic is a path of levels: project/build/done. Your own topics start with project/ and belong to
your project; git/ topics are the org's git's (it creates and publishes them itself); env/ is
reserved. Only a topic's owner (the machine or agent that created it) publishes to it.

Examples:
  space-env topic create project/build/done
  space-env topic list
  space-env topic remove project/build/done

space-env topic create

Create a topic of your own, under project/

Usage: space-env topic create <NAME>

Arguments:
  <NAME>
          The topic: project/ and levels of A-Z a-z 0-9 . _ ~ - separated by /

Options:
  -h, --help
          Print help

You own it: only you publish to it and remove it. Creating one you own already does nothing; a name
someone else has is refused.

Example:
  space-env topic create project/build/done

space-env topic remove

Remove a topic you own: the subscriptions to exactly it end (wildcards stay)

Usage: space-env topic remove <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env topic remove project/build/done

space-env topic list

List the topics that exist and you may see, with their owners

Usage: space-env topic list [FILTER]

Arguments:
  [FILTER]
          Only the topics this filter matches (+ one level, a last # any number)

Options:
  -h, --help
          Print help

Examples:
  space-env topic list
  space-env topic list 'project/build/#'

space-env publish

Publish JSON to a topic you own: every subscription that matches gets it as a message

Usage: space-env publish <TOPIC> [JSON]

Arguments:
  <TOPIC>
          The topic (one of your own: space-env topic create first)

  [JSON]
          The payload: any JSON (default: read from stdin)

Options:
  -h, --help
          Print help

Each matching subscription (but your own) gets a message of type topic in its inbox: {"topic", "by",
"at", "subscription": {"filter", "reason"}, "data": YOUR JSON}. The JSON is the argument, or stdin
without one (or with -); at most 64 KiB. At most 60 publishes a minute. Prints how many
subscriptions got it, and how many dropped it (a subscriber over 60 topic messages a minute, or with
a full inbox).

Examples:
  space-env publish project/build/done '{"sha": "4f2a9c1", "ok": true}'
  jq -n '{sha: "4f2a9c1"}' | space-env publish project/build/done

space-env subscribe

Subscribe to a topic or a wildcard: what is published there arrives in your inbox

Usage: space-env subscribe [OPTIONS] --reason <REASON> <FILTER>

Arguments:
  <FILTER>
          A topic, or a filter with + and a last #. Quote it: # starts a comment in a shell

Options:
      --reason <REASON>
          Why you subscribe, in one line (1 to 200 characters): the canvas shows it

      --qos <QOS>
          whenever, notify (wakes this machine if it sleeps) or urgent (also interrupts the agent)

          [default: whenever]
          [possible values: whenever, notify, urgent]

      --once
          End the subscription after its first message (an exact topic only)

  -h, --help
          Print help

A filter is a topic in which a whole level may be + (exactly one level) or a last # (any number of
levels, none included): project/build/# hears project/build/done and project/build. A wildcard also
hears topics created later; an exact topic must exist. Receive the messages with space-env receive
--type topic. You are not sent what you published yourself.

--qos whenever (the default) leaves the message for your next receive; notify and urgent wake this
machine if it sleeps. --once ends the subscription after its first message (an exact topic only).
Subscribing again to the same filter changes its reason, QoS and --once. At most 50 subscriptions;
at most 60 topic messages a minute reach you, and the rest is dropped and counted (space-env
subscriptions).

Examples:
  space-env subscribe 'project/build/#' --reason "deploy what was built"
  space-env subscribe project/build/done --once --qos notify --reason "wait for the build"

space-env unsubscribe

End one of your subscriptions

Usage: space-env unsubscribe <FILTER>

Arguments:
  <FILTER>
          The filter, as you subscribed to it

Options:
  -h, --help
          Print help

Example:
  space-env unsubscribe 'project/build/#'

space-env subscriptions

List your subscriptions: filter, QoS, once, since when, delivered, dropped, reason

Usage: space-env subscriptions [OPTIONS]

Options:
      --json
          The answer as JSON

  -h, --help
          Print help

Example:
  space-env subscriptions

space-env meta

Publish facts about this machine and find machines of your project by theirs

Usage: space-env meta <COMMAND>

Commands:
  set    Set keys on this machine (replacing their values)
  unset  Remove keys from this machine
  get    Print a machine's metadata (this machine's without MACHINE), one KEY=VALUE per line
  query  Print the names of the machines of your project whose metadata matches SELECTOR
  help   Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Metadata is public inside your project: every machine of it can read it. Never put secrets or
personal data in it. Limits: 64 keys per machine, a key at most 63 characters (A-Z a-z 0-9 . _ - /),
a value at most 256. Keys under space/ are the platform's (space/state, space/created_at,
space/forked_from, space/last_seen, space/created_by, space/on_behalf_of) and read-only.

Examples:
  space-env meta set agent/status=working agent/status_text="fixing issue 42"
  space-env meta get issue-1
  space-env meta query "role=reviewer,agent/status!=working"

In a machine an agent's tools are attached to, set and unset write the agent/ keys on the agent
(they are what the agent says of itself) and any other key on that machine.

space-env meta set

Set keys on this machine (replacing their values)

Usage: space-env meta set <KEY=VALUE>...

Arguments:
  <KEY=VALUE>...
          KEY=VALUE pairs

Options:
  -h, --help
          Print help

Example:
  space-env meta set role=reviewer branch=fix-42
  space-env meta set agent/status=working agent/status_text="issue 42: fixing"

Your status: agent/status is one of idle, working, done or user_needed (blocked on your user),
agent/status_text one short line on what you do or need. label (under 30 characters) says what this
machine is for. space/ and cp/ keys are the platform's and the portal's, read-only. Every machine of
the project reads your metadata: never secrets or personal data.

Prints this machine's metadata after the change, one KEY=VALUE per line.

space-env meta unset

Remove keys from this machine

Usage: space-env meta unset <KEY>...

Arguments:
  <KEY>...


Options:
  -h, --help
          Print help

Example:
  space-env meta unset branch

space-env meta get

Print a machine's metadata (this machine's without MACHINE), one KEY=VALUE per line

Usage: space-env meta get [MACHINE]

Arguments:
  [MACHINE]
          A machine of your project

Options:
  -h, --help
          Print help

Examples:
  space-env meta get
  space-env meta get issue-1

space-env meta query

Print the names of the machines of your project whose metadata matches SELECTOR

Usage: space-env meta query [OPTIONS] <SELECTOR>

Arguments:
  <SELECTOR>


Options:
      --long
          Print each machine's metadata too (one JSON object per line)

  -h, --help
          Print help

SELECTOR is comma-separated terms that must all hold: k=v, k!=v, k (has the key), !k (lacks it).
Platform keys work too (space/state=running).

Examples:
  space-env meta query "role=reviewer,agent/status!=working"
  space-env meta query space/state=sleeping --long

One name per line (with --long, the machine and its metadata as JSON).

space-env services

Manage this machine's services: programs kept running, also across sleep and reboots

Usage: space-env services <COMMAND>

Commands:
  list     List services and their state
  get      Show a service's definition and state (JSON)
  create   Define a service and start it; it also starts after every boot
  start    Start a service (also one stopped with stop)
  stop     Stop a service; it stays stopped, also across reboots, until started
  restart  Stop a service if it runs, and start it
  signal   Send a signal to a service (a name such as HUP, or a number)
  delete   Stop a service and remove its definition
  logs     Print the last lines of a service's log
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Logs are in /var/log/space-env/NAME.log (follow one with tail -f).

Example:
  space-env services list

space-env services list

List services and their state

Usage: space-env services list

Options:
  -h, --help
          Print help

Example:
  space-env services list

space-env services get

Show a service's definition and state (JSON)

Usage: space-env services get <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env services get ticker

space-env services create

Define a service and start it; it also starts after every boot

Usage: space-env services create [OPTIONS] <NAME> -- <COMMAND>...

Arguments:
  <NAME>
          The service's name: a-z 0-9 . _ -, starting with a letter or digit

  <COMMAND>...
          The program and its arguments, after --

Options:
      --restart <RESTART>
          When to restart it after it exits

          [default: always]
          [possible values: always, on-failure, never]

      --env <KEY=VALUE>
          An environment variable (repeatable)

      --cwd <DIR>
          Working directory

      --needs <SERVICE>
          A service to start before this one (repeatable)

  -h, --help
          Print help

Example:
  space-env services create ticker --restart on-failure -- sh -c "while sleep 30; do date; done"

space-env services start

Start a service (also one stopped with stop)

Usage: space-env services start <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env services start ticker

space-env services stop

Stop a service; it stays stopped, also across reboots, until started

Usage: space-env services stop <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env services stop ticker

space-env services restart

Stop a service if it runs, and start it

Usage: space-env services restart <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env services restart ticker

space-env services signal

Send a signal to a service (a name such as HUP, or a number)

Usage: space-env services signal <NAME> <SIGNAL>

Arguments:
  <NAME>


  <SIGNAL>


Options:
  -h, --help
          Print help

Example:
  space-env services signal ticker HUP

space-env services delete

Stop a service and remove its definition

Usage: space-env services delete <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env services delete ticker

space-env services logs

Print the last lines of a service's log

Usage: space-env services logs [OPTIONS] <NAME>

Arguments:
  <NAME>


Options:
      --lines <LINES>
          How many lines (at most 10000)

          [default: 100]

  -h, --help
          Print help

Example:
  space-env services logs ticker --lines 50

space-env artifact

Share files with people and other agents: upload one, get a URL to hand out

Usage: space-env artifact <COMMAND>

Commands:
  put   Upload FILE and print a URL anyone can download it from until the lease ends
  list  List the artifacts of your project (names, sizes, expiry; no URLs)
  get   Download an artifact of your project
  rm    Delete an artifact of your project: its URLs stop working at once
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

An artifact belongs to your project and outlives this machine; it is deleted when it expires, or
with its project. Its URL is a bearer link: anyone who has it can read the file until the lease
ends, so share it only where it should go (a message, an MR comment, a chat answer). Browsers
download HTML and SVG artifacts instead of showing them.

Examples:
  space-env artifact put report.html
  space-env artifact list

space-env artifact put

Upload FILE and print a URL anyone can download it from until the lease ends

Usage: space-env artifact put [OPTIONS] <FILE>

Arguments:
  <FILE>
          The file to upload

Options:
      --name <NAME>
          The artifact's name (default: the file's name): segments of A-Z a-z 0-9 . _ - separated by
          `/` (`runs/42/report.html`), at most 200 characters

      --ttl <DURATION>
          How long the artifact lives (default: your plan's maximum retention)

      --lease <DURATION>
          How long the URL works (default 7d)

      --type <MIME>
          Content type (default: from the file's extension)

      --json
          Print the whole artifact as JSON instead of the URL

  -h, --help
          Print help

Uploading to a name that exists replaces its content and keeps its id: links handed out earlier then
serve the new content. The artifact lives --ttl (default and maximum: your plan's retention); its
URL works for --lease (default 7d, at most the artifact's life). There is no way to get a new URL
for an existing artifact: upload again.

Examples:
  space-env artifact put report.html
  space-env artifact put build.log --name runs/42/build.log --ttl 30d --lease 2d
  space-env artifact put out.bin --type application/octet-stream --json

Durations: a number with s, m, h, d or w (90m, 12h, 30d); a bare number is seconds.

space-env artifact list

List the artifacts of your project (names, sizes, expiry; no URLs)

Usage: space-env artifact list [OPTIONS]

Options:
      --prefix <PREFIX>
          Only names starting with PREFIX (matched literally, e.g. `runs/42/`)

      --json
          One JSON object per artifact and line

  -h, --help
          Print help

Examples:
  space-env artifact list
  space-env artifact list --prefix runs/42/
  space-env artifact list --json

space-env artifact get

Download an artifact of your project

Usage: space-env artifact get [OPTIONS] <NAME>

Arguments:
  <NAME>


Options:
  -o, --output <FILE>
          Write to FILE instead of standard output

  -h, --help
          Print help

Examples:
  space-env artifact get report.html -o report-copy.html
  space-env artifact get runs/42/build.log

space-env artifact rm

Delete an artifact of your project: its URLs stop working at once

Usage: space-env artifact rm <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env artifact rm runs/42/build.log

space-env bucket

Public buckets: publish a static site and serve it from your web portal

Usage: space-env bucket <COMMAND>

Commands:
  create  Make a public bucket in your project
  edit    Change a bucket's limit, inline prefixes or not-found page
  delete  Delete a bucket and everything in it; a portal serving it stops at once
  list    List your project's buckets
  ls      List a bucket's files (path, size, type), optionally under PREFIX
  put     Upload files: one file, a directory (its files, relative paths), or a tar stream
  rm      Remove files by path, or all under --prefix
  diff    Compare a directory with the bucket: what a put would add, change and (with --prune)
          remove
  serve   Serve a bucket as the site of the web portal this machine is behind (--off: stop)
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A bucket holds files of your project, public by address. A web portal that serves one (space-env
bucket serve) answers its pages on the portal's own domain without waking this machine, to visitors
and search engines alike; images, styles and scripts load from the storage host. Paths the bucket
doesn't have still reach this machine.

Examples:
  space-env bucket create site
  tar -C dist -c . | space-env bucket put site --tar - --prune
  space-env bucket serve site

space-env bucket create

Make a public bucket in your project

Usage: space-env bucket create [OPTIONS] <NAME>

Arguments:
  <NAME>
          The bucket's name, unique in your project

Options:
      --max-bytes <MAX_BYTES>
          The most bytes it stores (default: only your plan's limit)

      --inline <PREFIX>
          A path prefix the edge serves itself (repeat for more)

  -h, --help
          Print help

Its files are public: anyone with a file's address can fetch it, and a web portal serves the bucket
as its site (space-env bucket serve). NAME is 1-63 of a-z 0-9 -. --inline names path prefixes the
edge serves on the site's own domain like HTML (a service worker: --inline sw.js); everything else
but HTML is redirected to the storage host.

Examples:
  space-env bucket create site
  space-env bucket create shop --max-bytes 500000000 --inline sw.js

space-env bucket edit

Change a bucket's limit, inline prefixes or not-found page

Usage: space-env bucket edit [OPTIONS] <NAME>

Arguments:
  <NAME>
          The bucket

Options:
      --max-bytes <MAX_BYTES>
          The most bytes it stores (0: only your plan's limit)

      --inline <PREFIX>
          Replaces the inline prefixes (repeat for more)

      --no-inline
          Clear the inline prefixes

      --not-found <PATH>
          The bucket's not-found page (a path in it, such as 404.html)

      --no-not-found
          No not-found page: paths the bucket lacks go to the machine

  -h, --help
          Print help

--not-found names a file in the bucket (a site's 404.html) that a portal serving the bucket answers,
with status 404, for GET and HEAD of paths the bucket doesn't have, without waking the machine:
those paths no longer reach it. Without one they go to the machine, as before.

Examples:
  space-env bucket edit site --max-bytes 0
  space-env bucket edit site --inline sw.js --inline workbox/
  space-env bucket edit site --no-inline
  space-env bucket edit site --not-found 404.html
  space-env bucket edit site --no-not-found

space-env bucket delete

Delete a bucket and everything in it; a portal serving it stops at once

Usage: space-env bucket delete <NAME>

Arguments:
  <NAME>
          The bucket

Options:
  -h, --help
          Print help

space-env bucket list

List your project's buckets

Usage: space-env bucket list [OPTIONS]

Options:
      --json
          One JSON object per bucket and line

  -h, --help
          Print help

space-env bucket ls

List a bucket's files (path, size, type), optionally under PREFIX

Usage: space-env bucket ls [OPTIONS] <NAME> [PREFIX]

Arguments:
  <NAME>
          The bucket

  [PREFIX]
          Only paths starting with PREFIX (matched literally, e.g. `assets/`)

Options:
      --json
          One JSON object per file and line (with its sha256 and time)

  -h, --help
          Print help

space-env bucket put

Upload files: one file, a directory (its files, relative paths), or a tar stream

Usage: space-env bucket put [OPTIONS] <NAME> [PATH]

Arguments:
  <NAME>
          The bucket

  [PATH]
          A file or directory (not with --tar)

Options:
      --tar <->
          Read a tar stream from standard input (`-`)

      --prefix <PREFIX>
          Put everything under PREFIX/ in the bucket

      --as <PATH>
          The path of a single file in the bucket

      --prune
          Then remove the bucket's files (under the prefix) that weren't uploaded

      --type <MIME>
          Content type for a single file (default: from its extension)

  -h, --help
          Print help

Paths in the bucket are relative: index.html, assets/app.css. A file keeps its name (--as gives
another path); a directory's files keep their paths below it; with --tar - a tar stream from
standard input does the same with its entries' names (a leading ./ dropped; directories, links and
devices skipped). PREFIX puts everything under PREFIX/. Unchanged files are not uploaded again.
--prune then removes files of the bucket (under PREFIX) that weren't in the upload.

A web portal serving the bucket answers / and dir/ with index.html, and /robots.txt with the
bucket's (without one: everything disallowed).

Examples:
  space-env bucket put site dist/ --prune
  tar -C dist -c . | space-env bucket put site --tar - --prune
  space-env bucket put site menu.pdf --as files/menu.pdf

space-env bucket rm

Remove files by path, or all under --prefix

Usage: space-env bucket rm [OPTIONS] <NAME> [PATHS]...

Arguments:
  <NAME>
          The bucket

  [PATHS]...
          Paths to remove

Options:
      --prefix <PREFIX>
          Remove every path starting with PREFIX instead

  -h, --help
          Print help

Examples:
  space-env bucket rm site old.html
  space-env bucket rm site --prefix drafts/

space-env bucket diff

Compare a directory with the bucket: what a put would add, change and (with --prune) remove

Usage: space-env bucket diff <NAME> <DIR> [PREFIX]

Arguments:
  <NAME>
          The bucket

  <DIR>
          The directory a put would upload

  [PREFIX]
          Compare under PREFIX/ of the bucket

Options:
  -h, --help
          Print help

Prints `+ path` (added), `~ path` (changed) and `- path` (only in the bucket).

Example:
  space-env bucket diff site dist/

space-env bucket serve

Serve a bucket as the site of the web portal this machine is behind (--off: stop)

Usage: space-env bucket serve [OPTIONS] [NAME]

Arguments:
  [NAME]
          The bucket of your project to serve

Options:
      --off
          Serve no bucket any more

  -h, --help
          Print help

GET and HEAD requests to the portal's hosts are answered from the bucket first, without signing in
and while this machine sleeps; paths the bucket doesn't have go to the machine as before.

Examples:
  space-env bucket serve site
  space-env bucket serve --off

space-env share

Show artifacts to the people of your organization: a page they open after signing in

Usage: space-env share <COMMAND>

Commands:
  create  Share an artifact, or a folder of them, and print the share's URL
  list    List the shares of your project: id, URL, prefix, title, expiry
  rm      Delete a share: its page stops working at once (the artifacts stay)
  title   Change a share's title (an empty title shows the prefix again) and print its URL
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A share is a page on share.agent-spaces.eu for one artifact or a folder of them (a prefix ending in
/, showing its index.html, or a list of its files). Members of your organization open it after
signing in; it is owned by the user this machine works for. It points at names, so later uploads
show on refresh. It lives 7 days unless you say otherwise (at most your plan's retention).

Examples:
  space-env share create proto/ --title "Checkout prototype"
  space-env share list

space-env share create

Share an artifact, or a folder of them, and print the share's URL

Usage: space-env share create [OPTIONS] <PREFIX>

Arguments:
  <PREFIX>
          An artifact name, or a folder: a name followed by `/`

Options:
      --title <TITLE>
          What the page is headed with (plain text, at most 200 characters; default: the prefix)

      --ttl <DURATION>
          How long the share lives (default 7d)

      --json
          Print the whole share as JSON instead of the URL

  -h, --help
          Print help

PREFIX is one artifact name (report.pdf) or a folder: a name followed by / (proto/). A folder's page
shows its index.html, or a list of its files when it has none. The share points at names, not
content: what you upload under the prefix later shows on the next refresh.

The share lives --ttl (default 7d, at most your plan's retention); the files keep their own expiry.

Upload a folder with one artifact put per file, under the same relative paths as on disk, the
index.html at its root (bash; it stops at the first upload that fails, and a rerun uploads again):
  (cd dist && find . -type f -print0) | while IFS= read -r -d '' f
  do space-env artifact put "dist/$f" --name "proto/${f#./}" || exit 1; done

HTML runs in a sandboxed frame with an opaque origin: use relative paths only (./app.js, never
/app.js; for Vite, base: './'); localStorage, sessionStorage, IndexedDB and cookies throw, so keep
state in memory or the URL; and no Content-Security-Policy meta tag that forbids inline scripts.
Members of your organization open the page after signing in; only a member can make it public.

Examples:
  space-env share create proto/ --title "Checkout prototype"
  space-env share create runs/42/report.pdf --ttl 3d
  space-env share create proto/ --json

Durations: a number with s, m, h, d or w (90m, 12h, 3d); a bare number is seconds.

space-env share list

List the shares of your project: id, URL, prefix, title, expiry

Usage: space-env share list [OPTIONS]

Options:
      --json
          One JSON object per share and line

  -h, --help
          Print help

Examples:
  space-env share list
  space-env share list --json

space-env share rm

Delete a share: its page stops working at once (the artifacts stay)

Usage: space-env share rm <ID>

Arguments:
  <ID>


Options:
  -h, --help
          Print help

Example:
  space-env share rm 3qA9xZ0bQm2Lw7Kd5Tn1Vg

space-env share title

Change a share's title (an empty title shows the prefix again) and print its URL

Usage: space-env share title <ID> <TITLE>

Arguments:
  <ID>


  <TITLE>


Options:
  -h, --help
          Print help

Example:
  space-env share title 3qA9xZ0bQm2Lw7Kd5Tn1Vg "Checkout, v2"

space-env wakelock

Keep this machine awake while you work: it sleeps after a while with no activity

Usage: space-env wakelock <COMMAND>

Commands:
  acquire  Take a wake lock, or refresh one you hold: the machine stays awake until it expires
  release  Give up a wake lock (no error if you don't hold it)
  hold     Hold a wake lock while COMMAND runs; exit with its status
  list     List the wake locks this machine holds, with when each expires (UTC)
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

The machine goes to sleep when nothing uses it for its idle timeout (10 minutes unless your operator
set another): no SSH or web traffic, no platform calls, no CPU, no network traffic. Sleep stops
every process; a message with --qos notify, a schedule or a web request wakes it, and its services
start again. A wake lock keeps it awake for a while even when it looks idle: take one before a long
quiet wait, and take it again (refresh) before it expires, or let hold do that for as long as a
command runs.

Examples:
  space-env wakelock acquire build --for 30m
  space-env wakelock release build
  space-env wakelock hold build -- sleep 1
  space-env wakelock list

space-env wakelock acquire

Take a wake lock, or refresh one you hold: the machine stays awake until it expires

Usage: space-env wakelock acquire [OPTIONS] <NAME>

Arguments:
  <NAME>


Options:
      --for <DURATION>
          How long it holds: N followed by s, m or h

  -h, --help
          Print help

NAME is 1-64 characters of A-Z a-z 0-9 . _ -. DURATION is N followed by s, m or h (default 15m, at
most 1h); acquire again before it ends to keep it. A holder that crashes stops refreshing and the
lock lapses, so nothing stays awake by accident.

Examples:
  space-env wakelock acquire build --for 30m
  space-env wakelock acquire claude-turn

space-env wakelock release

Give up a wake lock (no error if you don't hold it)

Usage: space-env wakelock release <NAME>

Arguments:
  <NAME>


Options:
  -h, --help
          Print help

Example:
  space-env wakelock release build

space-env wakelock hold

Hold a wake lock while COMMAND runs; exit with its status

Usage: space-env wakelock hold [OPTIONS] <NAME> -- <COMMAND>...

Arguments:
  <NAME>
          The lock's name: 1-64 characters of A-Z a-z 0-9 . _ - (one of its own)

  <COMMAND>...
          The program and its arguments, after --

Options:
      --for <DURATION>
          How long the lock lasts after the last renewal: N followed by s, m or h

  -h, --help
          Print help

Acquires NAME for DURATION (default 5m, at most 1h), acquires it again every third of DURATION while
COMMAND runs, and releases it when COMMAND exits. If the lock can't be taken, COMMAND doesn't run
(exit 1). The exit status is COMMAND's (128 + N when signal N ended it; 127 when it isn't found, 126
when it can't run). If space-env itself is killed, the lock lapses at most DURATION later. SIGTERM
and SIGHUP are passed on to COMMAND; SIGINT and SIGQUIT (Ctrl-C) reach it from the terminal, not
through space-env. COMMAND's input and output are yours; hold prints nothing of its own unless
something fails. Give the lock a name nothing else acquires: the release ends it.

Examples:
  space-env wakelock hold build -- sleep 1
  space-env wakelock hold download --for 2m -- sh -c "sleep 1 && echo done"

space-env wakelock list

List the wake locks this machine holds, with when each expires (UTC)

Usage: space-env wakelock list

Options:
  -h, --help
          Print help

Example:
  space-env wakelock list

space-env status

Show why this machine is awake, or when it goes to sleep if nothing happens

Usage: space-env status [OPTIONS]

Options:
      --json
          Print the status as JSON

  -h, --help
          Print help

Example:
  space-env status

Prints the idle timeout, since when the machine is idle and when it sleeps (or why it is awake: ssh,
tunnel, exec, console, guest, cpu, net, wakelock), and the wake locks. A machine running since
before a platform release says what it is behind on; a restart updates it. --json prints it as JSON.

space-env credential

Use your project's credentials: read one, list them, or ask your user for one

Usage: space-env credential <COMMAND>

Commands:
  get      Print a credential's value (readable credentials only)
  list     List your project's credentials, and whether each can be read in the machine
  capture  Store a credential an agent's sign-in produced in the project's credentials (write-only),
           and print its placeholder
  request  Ask the person this machine works for for a credential; they fill it in the portal or the
           AgentSpaces app
  cancel   Take back an open credential request that is no longer needed, saying why
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Credentials belong to your project and are added in the portal (or asked for with credential
request). Most stay out of the machine: a request header with the placeholder asp_env_NAME gets the
value on its way out (for the hosts the credential is bound to), so the value is never here.
Credentials marked readable in the machine can also be read with credential get or run
--credentials; a value you read is in this machine's memory, so in its snapshots and forks too.
Nothing is written to disk unless you do it. space-env secret is the same command.

Examples:
  space-env credential list
  space-env credential get DB_PASSWORD

space-env credential get

Print a credential's value (readable credentials only)

Usage: space-env credential get <NAME>

Arguments:
  <NAME>
          The credential's name: A-Z 0-9 _, starting with a letter

Options:
  -h, --help
          Print help

The value goes to stdout as it is: no newline is added unless stdout is a terminal, so
VAR="$(space-env credential get NAME)" and space-env credential get NAME > file are exact. Only
credentials marked readable in the machine can be read; provider keys and other proxy-only
credentials stay out of the machine and work through their placeholder (asp_env_NAME) instead. Every
read is logged in the project's audit log.

Example:
  space-env credential get DB_PASSWORD

space-env credential list

List your project's credentials, and whether each can be read in the machine

Usage: space-env credential list

Options:
  -h, --help
          Print help

One credential per line: its name, then "readable" (credential get and run --credentials work) or
"proxy only" (use its placeholder asp_env_NAME in a request header instead), then when it was last
set ("set" and the time, UTC), such as when a person filled your request. No values.

Example:
  space-env credential list

space-env credential capture

Store a credential an agent's sign-in produced in the project's credentials (write-only), and print
its placeholder

Usage: space-env credential capture [OPTIONS] --kind <KIND> <NAME>

Arguments:
  <NAME>
          The credential's name (one the kind allows)

Options:
      --kind <KIND>
          What it is: mistral_api_key, anthropic_api_key, openai_api_key, claude_subscription or
          chatgpt_subscription

      --email <EMAIL>
          The account's email, as the provider shows it

      --account-name <ACCOUNT_NAME>
          The account's or workspace's name

      --plan <PLAN>
          The plan (max, pro, plus, ...)

      --organization <ORGANIZATION>
          The organization

  -h, --help
          Print help

Reads the value from stdin and stores it as your project's credential NAME, of a known kind:
MISTRAL_API_KEY (mistral_api_key), ANTHROPIC_API_KEY (anthropic_api_key), OPENAI_API_KEY
(openai_api_key), CLAUDE_OAUTH_ACCESS and CLAUDE_OAUTH_REFRESH (claude_subscription),
CODEX_OAUTH_ACCESS and CODEX_OAUTH_REFRESH (chatgpt_subscription). The platform binds it to its
provider's host, so the placeholder it prints (asp_env_NAME) works in place of the value from every
machine of the project, and it can't be read back in a machine. It replaces the project's credential
of that name; the portal lists it under Agent accounts with the account it belongs to and this
machine. The sign-ins of agent machines call this for you.

Example:
  printf %s "$KEY" | space-env credential capture MISTRAL_API_KEY --kind mistral_api_key

space-env credential request

Ask the person this machine works for for a credential; they fill it in the portal or the
AgentSpaces app

Usage: space-env credential request [OPTIONS] --reason <REASON> <NAME>

Arguments:
  <NAME>
          The credential's name: A-Z 0-9 _, starting with a letter

Options:
      --label <LABEL>
          What it is in words, the request's title (at most 60 characters), e.g. "GitHub token"

      --reason <REASON>
          What it is for, in one line, impersonally ("Push the fix branch to ..."): the person
          decides on this

      --instructions <FILE|->
          Markdown (at most 8 KiB) telling the person how to get the credential; a file, or - for
          stdin

      --auth-url <URL>
          The https page where the person signs in or creates the credential

      --auth-url-label <TEXT>
          The text of the button to it (at most 40 characters; default "Open sign-in page")

      --logo-url <URL>
          An https URL of the service's logo, shown next to the request

      --kind <KIND>
          An agent account kind: mistral_api_key, anthropic_api_key, openai_api_key,
          claude_subscription or chatgpt_subscription

      --one-time
          A value only --wait gets, once, never stored (a sign-in code)

      --host <HOST>
          The host the credential is for: the proxy puts it in requests there

      --header <HEADER>
          With --host: the header it goes in (default authorization)

      --replace
          Ask for a new value of a credential this machine asked for and had filled (it was filled
          wrong); it stays as it was asked for (no --kind, --host, --header)

      --wait [<SECS>]
          Wait for the outcome, for ever or up to SECS seconds

  -h, --help
          Print help

The request goes to the user the machine runs on behalf of, who sees its label as the title, the
reason, the instructions and a button to the sign-in page, and chooses who the credential belongs
to: the project, or them personally (optionally transferable to another member). Filled, it is
stored as the credential NAME:
  - plain: readable here (space-env credential get NAME, space-env run --credentials NAME);
  - with --host: only through the proxy, in the --header (authorization) of requests to that host,
  from every machine that uses the credential: put the placeholder asp_env_NAME there;
  - with --kind: an agent account (MISTRAL_API_KEY, ANTHROPIC_API_KEY, ...), bound to its provider.
With --one-time the value is not stored: only --wait gets it, once (a sign-in code). Asking again
for the same NAME while a request is open answers that request. A request expires after 7 days; take
it back sooner with space-env credential cancel.

Filled wrong (a key that is refused, two values swapped)? --replace asks again for a credential this
machine asked for and had filled: the person is asked to replace its value, which goes into the same
credential (who it belongs to, its hosts and whether it is readable stay as the person has them
now). Say in --reason what is wrong ("The access key is refused with 403; it looks swapped with
RUNNER_CACHE_S3_SECRET_KEY"). You never see either value; for two swapped credentials, ask to
replace both. A credential you did not ask for can't be replaced this way: ask your user to change
it in the portal.

Write the label, reason and instructions impersonally, for someone reading them on a phone: "GitHub
token", "Push the fix branch to github.com/acme/api", "Create a token with the scope `repo` and
paste it" (not "I need you to ...").

--wait blocks until the request is filled or dismissed (up to SECS, default for ever) and prints the
outcome; with --one-time it prints the value. Exit 0 when filled, 4 when dismissed, cancelled or
expired, 5 when the wait ran out.

Examples:
  space-env credential request GITHUB_TOKEN --label "GitHub token" \
      --reason "Push the fix branch to github.com/acme/api" \
      --host api.github.com --auth-url https://github.com/settings/tokens \
      --auth-url-label "Create a GitHub token" --instructions - <<'EOF'
  Create a fine-grained token for **acme/api** with *Contents: read and write* and paste it.
  EOF
  space-env credential request DB_PASSWORD --label "Staging database password" \
      --reason "Run the migrations on staging" --wait 600
  space-env credential request S3_ACCESS_KEY --replace \
      --reason "The key is refused (403): it looks swapped with S3_SECRET_KEY"

space-env credential cancel

Take back an open credential request that is no longer needed, saying why

Usage: space-env credential cancel --reason <REASON> <NAME|ID>

Arguments:
  <NAME|ID>
          The credential's NAME, or the request's id

Options:
      --reason <REASON>
          Why it is no longer needed, in one line (at most 500 characters): the person sees it

  -h, --help
          Print help

Cancels this machine's open request for NAME (or the request with that id, as credential request
prints it): it leaves the person's list in the portal and the AgentSpaces app, which shows it as
cancelled with your reason, and a waiting credential request --wait ends (exit 4). Cancel a request
as soon as you no longer need the credential: you found it elsewhere, the task changed or was
dropped. Write the reason impersonally, for the person: "Found a deploy key in the repository", "The
migration was cancelled". Exit 1 when there is no such open request.

Example:
  space-env credential cancel GITHUB_TOKEN --reason "The fix was pushed over SSH instead"

space-env run

Run a command with credentials in its environment; exit with its status

Usage: space-env run --credentials <NAME,...> -- <COMMAND>...

Arguments:
  <COMMAND>...
          The program and its arguments, after --

Options:
      --credentials <NAME,...>
          Credentials to put in COMMAND's environment, by name, comma-separated (each becomes a
          variable of the same name)

  -h, --help
          Print help

Each credential becomes an environment variable of the same name for COMMAND (and what it starts),
not for your shell. Readable credentials only (space-env credential list). The exit status is
COMMAND's (127 when it isn't found, 126 when it can't run). --secrets is the same flag.

Example:
  space-env run --credentials DB_PASSWORD -- sh -c 'test -n "$DB_PASSWORD"'

space-env git-credential

git's credential helper: a token for a git host from your project's credentials

Usage: space-env git-credential <ACTION>

Arguments:
  <ACTION>
          What git asks: get, store or erase

          [possible values: get, store, erase]

Options:
  -h, --help
          Print help

For a host the project has a readable credential bound with header git (in the portal), get answers
username x-access-token and the credential as the password; for any other host it answers nothing,
so git asks its other helpers. store and erase do nothing. Turn it on for every https host:

  git config --global credential.helper "/usr/local/bin/space-env git-credential"

Example:
  printf 'protocol=https\nhost=github.com\n\n' | space-env git-credential get

space-env gateway

Use the model gateway: coding agents reach Anthropic, OpenAI and Mistral with your project's keys,
which stay out of the machine

Usage: space-env gateway <COMMAND>

Commands:
  on      Send this machine's coding agents to the model gateway, with the project's provider keys
  off     Stop using the model gateway: remove /etc/space/gateway.env
  status  Say whether the model gateway is on
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Off unless you turn it on, so a subscription you signed in to (/login) keeps working. On, the
agents' base URLs point at the platform's gateway and their API keys are placeholders it swaps for
the keys in your project's credentials (ANTHROPIC_API_KEY, OPENAI_API_KEY, MISTRAL_API_KEY).
Requests count against the project's budget.

Examples:
  space-env gateway status
  space-env gateway on

space-env gateway on

Send this machine's coding agents to the model gateway, with the project's provider keys

Usage: space-env gateway on

Options:
  -h, --help
          Print help

Writes /etc/space/gateway.env: ANTHROPIC_BASE_URL, OPENAI_BASE_URL, MISTRAL_BASE_URL and Mistral
Vibe's provider and managed config (VIBE_PROVIDERS, VIBE_VIBE_BASE_URL) point at the platform's
gateway, and ANTHROPIC_API_KEY, OPENAI_API_KEY and MISTRAL_API_KEY are placeholders it replaces with
your project's keys (added in the portal), so no key is ever in the machine. New login shells pick
it up, and the agent session when it starts again. It replaces a subscription you signed in to with
/login while it is on.

Example:
  space-env gateway on

space-env gateway off

Stop using the model gateway: remove /etc/space/gateway.env

Usage: space-env gateway off

Options:
  -h, --help
          Print help

Shells and agents started before keep the variables until they end. On an agent machine the gateway
is always on: it is on again when the agent starts.

Example:
  space-env gateway off

space-env gateway status

Say whether the model gateway is on

Usage: space-env gateway status

Options:
  -h, --help
          Print help

Example:
  space-env gateway status

space-env git

The org's git service at http://git.space: Forgejo, with its CLI fj behind the pr, issue, repo and
whoami commands. No login: the platform signs this machine in as the user it works for

Usage: space-env git <COMMAND>

Commands:
  repos   Your repos: this project's, your own and the org's, with their URLs
  create  Make a repo of the org, <org>/<name> (agents only): the agent writes it, the rest of the
          org reads it. Names as a project's: 3 to 40 of a-z, 0-9 and -. Prints its clone URL
  setup   Make `git clone space:<repo>` work (a URL rewrite in your global git config), and set your
          commit name and email where they aren't set
  pr      Pull requests (Forgejo's `fj pr`): create, view, comment, review, merge
  issue   Issues (Forgejo's `fj issue`): create, search, view, comment, close
  repo    A repo's details (Forgejo's `fj repo`): view, readme
  whoami  Who the git service signs this machine in as (Forgejo's `fj whoami`)
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

What you can reach:
  your project's repo   http://git.space/<org>/<project>   (git clone space:<project>)
  your own repo         http://git.space/~/home            (git clone space:~/home)
  (on an agent's machine ~/home is its owner's: what they see)
  the org's repos, which space-env git repos lists: the ones your user made
  (on an agent's machine, the agent or its owner) to write, the others to read.
  Other projects' repos don't exist for this machine; the web pages and admin API
  aren't served. You act as the user this machine works for (space-env whoami),
  or, on an agent's machine, as the agent.

What's on: code, issues and pull requests (from a branch of the same repo); an
agent makes repos of the org with `space-env git create <name>`.
What's off: forks, actions (CI), wikis, releases, packages, and deleting repos
(people do that in the portal). Pushes are at most 64 MB.

pr, issue and repo pass their arguments to Forgejo's fj (`space-env git pr --help`
shows fj's own help), with the host set to http://git.space.

Examples:
  space-env git repos
  space-env git setup && git clone space:web
  git switch -c fix && git commit -am "Fix it" && git push -u origin fix
  space-env git pr create --base main --head fix --body "fixes #1" "Fix it"
  space-env git pr view 2 && space-env git pr merge 2
  space-env git issue create --repo <org>/<project> --body "..." "Title"

space-env git repos

Your repos: this project's, your own and the org's, with their URLs

Usage: space-env git repos

Options:
  -h, --help
          Print help

space-env git create

Make a repo of the org, <org>/<name> (agents only): the agent writes it, the rest of the org reads
it. Names as a project's: 3 to 40 of a-z, 0-9 and -. Prints its clone URL

Usage: space-env git create <NAME>

Arguments:
  <NAME>
          The repo's name

Options:
  -h, --help
          Print help

space-env git setup

Make `git clone space:<repo>` work (a URL rewrite in your global git config), and set your commit
name and email where they aren't set

Usage: space-env git setup

Options:
  -h, --help
          Print help

space-env git pr

Pull requests (Forgejo's `fj pr`): create, view, comment, review, merge

Usage: space-env git pr [ARGS]...

Arguments:
  [ARGS]...

space-env git issue

Issues (Forgejo's `fj issue`): create, search, view, comment, close

Usage: space-env git issue [ARGS]...

Arguments:
  [ARGS]...

space-env git repo

A repo's details (Forgejo's `fj repo`): view, readme

Usage: space-env git repo [ARGS]...

Arguments:
  [ARGS]...

space-env git whoami

Who the git service signs this machine in as (Forgejo's `fj whoami`)

Usage: space-env git whoami

Options:
  -h, --help
          Print help

space-env bugreport

Report a bug in the platform (space-env, the machine, the portal) to the AgentSpaces team, or
request a feature

Usage: space-env bugreport [OPTIONS] [DESCRIPTION]

Arguments:
  [DESCRIPTION]
          What happened, what you expected, and the commands that show it; for a feature, what you
          would like to do and what for (5 to 10,000 characters)

Options:
      --feature
          A feature request (something the platform should do) instead of a bug

  -h, --help
          Print help

Examples:
  space-env bugreport "schedule cron fired twice at 09:00 UTC; expected once"
  space-env bugreport --feature "let schedule take a time zone"

Without DESCRIPTION (or with -) the report is read from stdin (space-env bugreport < report.txt). It
goes to the team as the user this machine works for (on_behalf_of), with this machine, its project,
its guest image and whether a newer image exists; their answer reaches that user as a notification.
Report bugs in the platform, not in your own task. At most 2 reports per 5 minutes per user. Prints
the message's id; a refused report comes back as channel.bugreport.error (receive --type
channel.bugreport.error).

space-env acp

The machine's agent over ACP (agent machines): attach a client to its session

Usage: space-env acp <COMMAND>

Commands:
  attach  Connect stdin and stdout to the agent's ACP session (newline-delimited JSON-RPC)
  login   Sign the agent in: run its own sign-in program in this terminal
  serve   Service: run the agent in ACP mode and share its session (agent machines run it)
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

On an agent machine the coding agent runs in ACP mode (Agent Client Protocol) under the service acp
(space-env acp serve). Its one session is shared by every client: the portal's chat, and any program
that runs space-env acp attach as its ACP agent command.

Example:
  PI_ACP_AGENT='space-env acp attach --client pi' pi -e /usr/local/lib/pi-acp

space-env acp attach

Connect stdin and stdout to the agent's ACP session (newline-delimited JSON-RPC)

Usage: space-env acp attach [OPTIONS]

Options:
      --client <CLIENT>
          The name the other clients see for your prompts

          [default: attach]

  -h, --help
          Print help

The session is shared: session/new returns it rather than a new one, session/load replays what
happened in it, and the other clients see your prompts (as user_message_chunk and _space/turn
notifications). Prompts run one at a time. Waits up to 30 seconds for the hub to start.

Example:
  space-env acp attach --client my-script

space-env acp login

Sign the agent in: run its own sign-in program in this terminal

Usage: space-env acp login [METHOD]

Arguments:
  [METHOD]
          The sign-in method (default: the first one offered)

Options:
  -h, --help
          Print help

When the agent needs a sign-in (metadata agent/auth=required; the portal's chat says so), this runs
the program the agent offers for it: Mistral Vibe's API key setup, Claude Code's claude auth login
(it shows a link; paste the page's code back), Codex's device code sign-in. What it stores goes into
the project's credentials (an API key, a subscription's tokens) and the machine keeps a placeholder.
The agent starts again when the program exits. The portal's chat signs Claude and Codex in without a
terminal (a link and a code), and opens a terminal running this for the others, or when that fails.

Example:
  space-env acp login
  space-env acp login vibe-setup
  space-env acp login claude-link

space-env acp serve

Service: run the agent in ACP mode and share its session (agent machines run it)

Usage: space-env acp serve

Options:
  -h, --help
          Print help

Runs the agent chosen in /etc/space-env/agent.conf (none until one is: clients are offered the
choice) through its ACP adapter (vibe-acp, claude-agent-acp, codex-acp, pi-acp), publishes it as
this machine's metadata agent/name, serves /run/space-env/acp.sock, links the session to the
platform's ACP gateway (the portal's chat), and holds wake lock acp-turn while a turn runs.

Example:
  space-env acp serve

space-env layers

An agent's layers: its project's, its owner's and its own repo, checked out in /space and laid out
as its instructions, skills and memory

Usage: space-env layers <COMMAND>

Commands:
  sync     Push what changed in /space/agent, fetch the others and lay them out now (JSON)
  show     The layering: every path in the harness's home, its layer and what hides it (JSON)
  session  A Claude Code session's machine, before its runner starts: sync, wait for it at most
           --wait-ms, and copy the layers into ~/.claude (one JSON line once laid out)
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

On an agent's machine, /space/project (the project's repo), /space/user (your owner's) and
/space/agent (your own) come from the org's git service. Each may have an AGENTS.md,
skills/<name>/SKILL.md and memory/*.md. They are laid out in your harness's home, the platform's
first and yours last: a later one wins, and a skill of the same name hides a lower one's. Your
instructions are /space/AGENTS.md, made from them.

The layers are synced when the agent starts and after every turn: what you changed in /space/agent
is committed and pushed, the others are fetched. A conflict leaves your commits on the machine and
goes to your owner's root agent (twice), then to your owner.

On a Claude Code on the web session's machine the layers are its member's: the project's repo, the
member's home and their Claude Code agent repo (claude-code, shared by all their sessions) as
/space/agent. They are copied into ~/.claude (CLAUDE.md, skills/) as each session's runner starts
(layers session); what a session wrote in /space/agent is pushed when its runner stops (layers
sync).

Examples:
  space-env layers sync
  space-env layers show

space-env layers sync

Push what changed in /space/agent, fetch the others and lay them out now (JSON)

Usage: space-env layers sync

Options:
  -h, --help
          Print help

space-env layers show

The layering: every path in the harness's home, its layer and what hides it (JSON)

Usage: space-env layers show

Options:
  -h, --help
          Print help

space-env layers session

A Claude Code session's machine, before its runner starts: sync, wait for it at most --wait-ms, and
copy the layers into ~/.claude (one JSON line once laid out)

Usage: space-env layers session [OPTIONS]

Options:
      --member <MEMBER>
          Who the session acts for, as its instructions name them (the work order's email)

      --wait-ms <WAIT_MS>
          How long to wait for the sync before laying out what the disk has

          [default: 2000]

  -h, --help
          Print help

space-env export

A copy of exactly what this machine's agent reads: its instructions, skills, memory and settings,
and a manifest (.tar.zst)

Usage: space-env export [OPTIONS]

Options:
  -o, --output <FILE>
          Where to write it; - is stdout

          [default: agent.tar.zst]

      --sessions
          Add the harnesses' sessions

      --max-bytes <BYTES>
          Refuse (exit 5) when the archive would be larger than this

  -h, --help
          Print help

On an agent's machine. The archive holds manifest.json; home/, every path of the harness's home it
reads for instructions, skills and settings (AGENTS.md, CLAUDE.md, each harness's skills,
settings.json, ...) with links resolved to their content; layers/<platform|project|user|agent>/,
each layer's AGENTS.md, skills/ and memory/; managed/, the managed settings (/etc/claude-code,
/etc/codex); and with --sessions, sessions/, the harnesses' sessions (they can be large and hold the
conversation).

manifest.json is the key to reproducing it: the guest image, the platform layer's digest and the
kernel, the harness chosen and every harness's and ACP adapter's version, each repo's commit, the
layering order, and for every path in the home the layer it comes from, what hides it and whether
the home has it as the layering says (layer machine: the machine's own). Sign-ins
(.claude/.credentials.json, .claude.json, auth.json, .vibe/.env) are never in it: the manifest only
says whether they are there. A link that leads out of what it belongs to is left out and named
(skipped).

From outside: space agents export NAME (its owner or an admin of the org).

Exit status 5: the archive would be over --max-bytes.

Examples:
  space-env export
  space-env export --sessions -o /tmp/dev.tar.zst
  space-env export -o - | zstd -d | tar -t

space-env tools

Run this machine's agent's tools in another machine of its project (the tool link)

Usage: space-env tools <COMMAND>

Commands:
  attach   Run the agent's tools in machine NAME (any machine of its project), waiting for the link
  detach   Run the agent's tools on this machine's own disk again, from its next command on
  status   Which machine the tools run in, the link's state and round trip, and the targets
  connect  stdin and stdout to the tool link (ssh's ProxyCommand; `ssh -F
           /var/lib/space-env/tools/ssh_config tools`)
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

The agent (an agent machine's ACP hub) runs here; its commands and files can run in another machine,
its tools machine: the code, the shells and the builds are there, the agent's config, sign-ins and
keys stay here. It attaches to any machine of the org, one at a time, and a machine serves one agent
at a time; each one it was attached to becomes one of its targets, which the portal offers. An
attach or detach takes effect before it returns: the agent's next command runs on the new machine.
Codex moves after its current turn (--now: at once) and is told so.

In the agent's commands on its tools machine, space-env acts as the agent for what is about the
agent (send, notify, agents, machines, tools, credential, ...) and as that machine for what is about
it (services, meta, wakelock, status, ...): each link forwards the agent's guest API there. What the
agent says of itself (meta set or unset of its agent/ keys, as agent/status) is the agent's too.
--as-agent and --as-machine override either way. Run from there, attach and detach take effect after
the agent's turn. Run attach and detach as a command of their own, not inside another (`a; space-env
tools detach; b`): there they refuse.

Examples:
  space-env tools status
  space-env tools attach web-1
  space-env tools detach

space-env tools attach

Run the agent's tools in machine NAME (any machine of its project), waiting for the link

Usage: space-env tools attach [OPTIONS] <NAME>

Arguments:
  <NAME>


Options:
      --now
          Codex: switch at once, cancelling the agent's running turn

      --wait
          Codex: switch after the running turn (its default)

      --json


  -h, --help
          Print help

It waits for the commands the agent runs, switches, and returns once the link is up and the agent's
files under /workspace are NAME's: from the agent's next command on, its commands run there. If it
can't, it fails and the tools stay where they were. Codex's ACP hub moves it after the turn that is
running instead (--now: it cancels the turn first). Refused when there is no machine NAME in the
org, or another agent uses it (the message names which). Makes this machine's key on first use.

Example:
  space-env tools attach web-1

space-env tools detach

Run the agent's tools on this machine's own disk again, from its next command on

Usage: space-env tools detach [OPTIONS]

Options:
      --now
          Codex: switch at once, cancelling the agent's running turn

      --json


  -h, --help
          Print help

space-env tools status

Which machine the tools run in, the link's state and round trip, and the targets

Usage: space-env tools status [OPTIONS]

Options:
      --json


  -h, --help
          Print help

space-env tools connect

stdin and stdout to the tool link (ssh's ProxyCommand; `ssh -F /var/lib/space-env/tools/ssh_config
tools`)

Usage: space-env tools connect

Options:
  -h, --help
          Print help

space-env web-portal

Put this machine on the internet behind a web portal (a sign-in gate), change it, and manage its
users

Usage: space-env web-portal [COMMAND]

Commands:
  attach       Put this machine behind a web portal of your project, and print its URL
  edit         Change the settings, sign-in methods and branding of the portal this machine is
               behind; print its URL
  show         Show the portal this machine is behind (the default), or "no web portal"
  invite       Invite someone to the portal by email: a one-time sign-up link
  invites      List the portal's open invites and sign-up links
  signup-link  Make a sign-up link anyone who has it may use once, and print it
  revoke       Revoke an invite or sign-up link: its link stops working
  users        List the portal's users
  disable      Disable a user: they can't sign in, and every session of theirs ends
  enable       Enable a disabled user again
  sign-out     Sign a user out everywhere: every session and API token of theirs ends
  reset-2fa    Turn off a user's two-factor sign-in (a lost authenticator)
  source       Show what this machine's site serves (the Spacebar), or name the checkout it serves
  webhook      Make, list and revoke webhooks: secret URLs whose calls wake this machine
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A web portal serves this machine at its own address to people who sign up and sign in there;
anonymous visitors never reach the machine unless the portal allows them. attach puts this machine
behind one and prints its URL, edit changes its settings and branding, show (the default) prints it.
Each acts as the user this machine works for, who must be an owner or admin of the organization.
There is no detach: a person takes the machine off the internet in the portal app.

invite, invites, signup-link and revoke hand out sign-up links; users, disable, enable, sign-out and
reset-2fa manage the portal's accounts. They work on the portal this machine is behind.

Examples:
  space-env web-portal
  space-env web-portal attach --port 3000
  space-env web-portal invite ann@example.com
  space-env web-portal users

Exit status 3: the portal did not answer in time (check with space-env web-portal).

space-env web-portal attach

Put this machine behind a web portal of your project, and print its URL

Usage: space-env web-portal attach [OPTIONS] [NAME]

Arguments:
  [NAME]
          The portal's name (default: this machine's name)

Options:
      --port <N>
          The guest port signed-in requests go to

      --approve <APPROVE>
          Who approves sign-ups: machine (this machine, machine protocol v1) or open (anyone may
          sign up)

          [possible values: machine, open]

      --anonymous
          Visitors without an account may use the machine too (and wake it with a button)

      --no-anonymous
          Only signed-in users reach the machine

      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

NAME (default: this machine's name) is a portal of your project. When it isn't in front of a
machine, this machine goes behind it, with the settings you give; when there is none by that name, a
new one is made (port 8080, sign-ups approved by the machine, no anonymous visitors unless you say
otherwise). A portal in front of another machine is refused: moving it would take that machine off
the internet, which a person does in the portal app. So is a second portal for this machine: change
the one it has with edit.

It acts as the user this machine works for: only an owner or admin of the organization can put a
machine on the internet.

Examples:
  space-env web-portal attach --port 3000
  space-env web-portal attach shop --approve open --anonymous

space-env web-portal edit

Change the settings, sign-in methods and branding of the portal this machine is behind; print its
URL

Usage: space-env web-portal edit [OPTIONS]

Options:
      --name <NAME>
          Rename the portal

      --port <N>
          The guest port signed-in requests go to

      --approve <APPROVE>
          Who approves sign-ups: machine (this machine, machine protocol v1) or open (anyone may
          sign up)

          [possible values: machine, open]

      --anonymous
          Visitors without an account may use the machine too (and wake it with a button)

      --no-anonymous
          Only signed-in users reach the machine

      --brand-color <COLOR>
          The sign-in pages' primary color, #rrggbb

      --brand-name <TEXT>
          Shown above the sign-in pages and in their title (at most 60 characters)

      --brand-description <TEXT>
          Shown under the brand name (at most 280 characters)

      --brand-css <FILE>
          Your own CSS for the sign-in pages, from FILE (- for stdin; an empty file clears it)

      --terms-url <URL>
          The terms of service linked under the sign-in card: an http(s) URL ('' for none)

      --privacy-url <URL>
          The privacy policy linked under the sign-in card: an http(s) URL ('' for none)

      --logo <FILE>
          A new logo: PNG, SVG or WebP, at most 64 KB

      --remove-logo
          Remove the logo

      --spacebar <on|off>
          The Spacebar on the site's pages, for the organization's members (on until the first
          custom domain)

      --languages <CODES>
          The sign-in pages' languages, comma separated (en,nl,de,fr,es,da,pt,sv)

      --default-language <CODE>
          The language for a browser that asks for none of them ('' for automatic)

      --agentspaces <on|off>
          Sign-in with an AgentSpaces account (on by default)

      --agentspaces-scope <org>
          Who may sign in with AgentSpaces: org, the organization's members (the only choice)

          [possible values: org]

      --password <on|off>
          Visitors sign up and sign in with an email address and a password

      --google <off|agentspaces|own>
          Sign-in with Google: off, agentspaces (the AgentSpaces client) or own (your client)

          [possible values: off, agentspaces, own]

      --google-client-id <ID>
          Your own Google OAuth client's id ('' clears it)

      --microsoft <off|agentspaces|own>
          Sign-in with Microsoft: off, agentspaces (the AgentSpaces client) or own (your client)

          [possible values: off, agentspaces, own]

      --microsoft-client-id <ID>
          Your own Microsoft (Entra) application's client id ('' clears it)

      --microsoft-tenant <TENANT>
          Your own Microsoft client's Entra tenant, an id or domain ('' for common)

      --magic-link <on|off>
          Visitors sign in (and sign up) with a link mailed to them

      --two-factor <off|optional|required>
          Two-factor sign-in: off, optional or required

          [possible values: off, optional, required]

      --signup-domains <DOMAINS>
          The email domains sign-ups are limited to, comma separated ('' for any)

      --signups <invite|machine|open>
          Who may sign up: invite (only people you invite), machine (this machine approves each
          sign-up) or open (anyone)

          [possible values: invite, machine, open]

      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

Only the portal this machine is behind; give at least one change. An empty --brand-*, --terms-url or
--privacy-url value clears that field. The CSS and the logo travel in one message of at most 100 KB:
when both don't fit, send them in two edits.

--languages sets the sign-in pages' languages (en nl de fr es da pt sv; a visitor gets their
browser's, or picks one: flags, a menu with more than two). --default-language is the one a browser
asking for none of them gets (one of the languages; '' for automatic: English if offered, else the
first).

The sign-in methods are those of the portal app's Sign-in tab; leave at least one way in (password,
AgentSpaces, Google, Microsoft or magic links). AgentSpaces sign-in is on by default, for the
organization's members only (people outside it sign in another way). For a test or preview
environment, AgentSpaces sign-in is the easy way in: you and your organization sign in with the
accounts you already have, no passwords or test users to make. Google and Microsoft are off, on with
the AgentSpaces client (agentspaces), or on with your own OAuth client (own). A client secret never
travels from a machine: set it once with space portals sign-in or in the portal app, then --google
own works here too.

--spacebar turns the Spacebar on or off: the development bar the organization's members see on the
site's pages while this machine serves a checkout of the organization's git. It is on until the
portal gets its first custom domain, which turns it off; turn it on again to have it on the custom
domains too.

Examples:
  space-env web-portal edit --port 4000
  space-env web-portal edit --spacebar off
  space-env web-portal edit --agentspaces on --password off --google off --microsoft off
  --magic-link off
  space-env web-portal edit --two-factor required --signup-domains example.com --signups open
  space-env web-portal edit --languages en,nl --default-language nl
  space-env web-portal edit --brand-color '#0b7285' --brand-name "Shop" --logo logo.png
  space-env web-portal edit --brand-css theme.css
  space-env web-portal edit --terms-url https://shop.example/terms
  space-env web-portal edit --privacy-url ''
  space-env web-portal edit --brand-description ''

space-env web-portal show

Show the portal this machine is behind (the default), or "no web portal"

Usage: space-env web-portal show [OPTIONS]

Options:
      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

Prints its name, URL, port, who approves sign-ups, whether anonymous visitors may use it, whether
the Spacebar is on, the sign-in pages' languages and default language, its branding (the CSS and
logo as sizes), its terms and privacy links, its sign-in methods, and its primary host and custom
domains (each with its state and the DNS records it needs). --json prints it as JSON (null without a
portal).

Examples:
  space-env web-portal show
  space-env web-portal show --json

space-env web-portal invite

Invite someone to the portal by email: a one-time sign-up link

Usage: space-env web-portal invite [OPTIONS] <EMAIL>

Arguments:
  <EMAIL>
          Their email address

Options:
      --data <JSON>
          A JSON object (at most 4 KB) this machine gets back with the sign-up

      --days <N>
          How many days the link works (1-30; default 7)

      --no-mail
          Don't mail the invite: print its link

      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

The portal mails EMAIL a link to sign up (in the portal's branding), valid --days (1-30, default 7).
With --no-mail nothing is sent and the link is printed: give it to them yourself. --data (a JSON
object, at most 4 KB) comes back to this machine with their sign-up (web portal protocol, "invite"),
so you know who signed up for what. An address that already has an account is refused.

Examples:
  space-env web-portal invite ann@example.com
  space-env web-portal invite ann@example.com --data '{"team":"sales"}' --days 3
  space-env web-portal invite ann@example.com --no-mail

space-env web-portal invites

List the portal's open invites and sign-up links

Usage: space-env web-portal invites [OPTIONS]

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

One line each: id, kind (invite or signup_link), expiry and data. No email addresses: you have
those.

Examples:
  space-env web-portal invites
  space-env web-portal invites --json

space-env web-portal signup-link

Make a sign-up link anyone who has it may use once, and print it

Usage: space-env web-portal signup-link [OPTIONS]

Options:
      --data <JSON>
          A JSON object (at most 4 KB) this machine gets back with the sign-up

      --days <N>
          How many days the link works (1-30; default 7)

      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

Like an invite without an address: whoever opens the link first signs up with an address of their
own. --days and --data as for invite.

Examples:
  space-env web-portal signup-link
  space-env web-portal signup-link --data '{"plan":"trial"}' --days 1

space-env web-portal revoke

Revoke an invite or sign-up link: its link stops working

Usage: space-env web-portal revoke [OPTIONS] <ID>

Arguments:
  <ID>
          The invite's or sign-up link's id (space-env web-portal invites)

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

Example:
  space-env web-portal revoke inv_3qA9xZ0b

space-env web-portal users

List the portal's users

Usage: space-env web-portal users [OPTIONS]

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

One line each: the user's id (sub, as in the x-agentspaces-identity header), whether their email is
confirmed, two-factor, disabled, their last sign-in, and their language (en, nl, ...: the sign-in
pages' when they last signed in or switched). No email addresses: your service has those from the
sign-up.

Examples:
  space-env web-portal users
  space-env web-portal users --json

space-env web-portal disable

Disable a user: they can't sign in, and every session of theirs ends

Usage: space-env web-portal disable [OPTIONS] <SUB>

Arguments:
  <SUB>
          The user's id, their sub (space-env web-portal users)

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

Example:
  space-env web-portal disable 8d0f6c1e-7f43-4a55-9d0e-2a1b3c4d5e6f

space-env web-portal enable

Enable a disabled user again

Usage: space-env web-portal enable [OPTIONS] <SUB>

Arguments:
  <SUB>
          The user's id, their sub (space-env web-portal users)

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

Example:
  space-env web-portal enable 8d0f6c1e-7f43-4a55-9d0e-2a1b3c4d5e6f

space-env web-portal sign-out

Sign a user out everywhere: every session and API token of theirs ends

Usage: space-env web-portal sign-out [OPTIONS] <SUB>

Arguments:
  <SUB>
          The user's id, their sub (space-env web-portal users)

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

Example:
  space-env web-portal sign-out 8d0f6c1e-7f43-4a55-9d0e-2a1b3c4d5e6f

space-env web-portal reset-2fa

Turn off a user's two-factor sign-in (a lost authenticator)

Usage: space-env web-portal reset-2fa [OPTIONS] <SUB>

Arguments:
  <SUB>
          The user's id, their sub (space-env web-portal users)

Options:
      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

They sign in with their password alone, and set up two-factor again (or must, when the portal
requires it). Make sure it is them asking.

Example:
  space-env web-portal reset-2fa 8d0f6c1e-7f43-4a55-9d0e-2a1b3c4d5e6f

space-env web-portal source

Show what this machine's site serves (the Spacebar), or name the checkout it serves

Usage: space-env web-portal source [OPTIONS] [DIR]

Arguments:
  [DIR]
          The checkout the site serves (made absolute)

Options:
      --auto
          Find the checkout from the listening process again

      --json
          Print the platform's answer as JSON

  -h, --help
          Print help

A web portal's site (https://<name>.agent-app.eu; on region lab https://<name>.polder-vm.eu) whose
machine serves a checkout of a repository of your organization's git shows the Spacebar: a bar
marking it as a development site, naming the commit it runs, with Report, which files an issue in
that repository.

The machine finds the checkout itself: the working directory of the process listening on the web
portal's port, when it is in a git checkout whose origin is http://git.space/<org>/<repo>, or
space:<repo> after space-env git setup (as the checkout's owner's git resolves it). It follows a git
checkout or commit within seconds. When your app runs from elsewhere (a container, a service started
in /), name the checkout: DIR is kept across boots. --auto finds it from the listener again.

Without DIR it prints what is served: the repository, branch and commit (+ when the tree has
uncommitted changes), or why there is no Spacebar: for a checkout of another git, the origin it
names.

Examples:
  space-env web-portal source
  space-env web-portal source /srv/app
  space-env web-portal source --auto

space-env web-portal webhook

Make, list and revoke webhooks: secret URLs whose calls wake this machine

Usage: space-env web-portal webhook <COMMAND>

Commands:
  add     Make a webhook and print its URL (shown this once)
  list    List the portal's webhooks, with when each was last used or missed a call
  revoke  Revoke a webhook: calls to its URL stop waking this machine within a minute
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

space-env web-portal webhook add

Make a webhook and print its URL (shown this once)

Usage: space-env web-portal webhook add [OPTIONS] <NAME>

Arguments:
  <NAME>
          What it is for, such as gitlab or payments (1-60 characters)

Options:
      --path <PATH>
          Your app's path, appended to the URL printed (such as /hooks/gitlab)

      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

A webhook is a secret URL of the portal, https://<portal>/_wake/<secret>/<path>: a POST or PUT to it
wakes this machine when it sleeps and reaches your app as a request for /<path>, without the secret
and without a signed-in user. Give it to a service that calls you (GitLab, a payment provider); your
app still checks that service's own signature or secret. Other methods are refused (405). At most 20
a portal.

NAME says what it is for. --path is your app's path, appended to the URL printed. The secret isn't
kept: when it is lost, revoke the webhook and make another.

It acts as the user this machine works for: an owner or admin of the organization.

Examples:
  space-env web-portal webhook add gitlab --path /hooks/gitlab
  space-env web-portal webhook add payments --json

space-env web-portal webhook list

List the portal's webhooks, with when each was last used or missed a call

Usage: space-env web-portal webhook list [OPTIONS]

Options:
      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

One line each: id, name, when it was made and by whom, when a call last woke or reached this
machine, and when one was last refused (capped: more than 30 wakes an hour; timeout: the machine
didn't wake in time; unavailable). Never the URL.

Examples:
  space-env web-portal webhook list
  space-env web-portal webhook list --json

space-env web-portal webhook revoke

Revoke a webhook: calls to its URL stop waking this machine within a minute

Usage: space-env web-portal webhook revoke [OPTIONS] <ID>

Arguments:
  <ID>
          The webhook's id (space-env web-portal webhook list)

Options:
      --json
          Print the portal as JSON

      --timeout <SECONDS>
          Wait up to this many seconds for the portal's answer

          [default: 60]

  -h, --help
          Print help

Example:
  space-env web-portal webhook revoke 3b1f5c2e-8a4d-4f7e-9c1a-2d3e4f5a6b7c

space-env screens

Write the project's screens (.screens/ of its repository): check them as the portal does, with a
sketch of each layout, and start from a worked example or the schema

Usage: space-env screens <COMMAND>

Commands:
  check    Check .screens/ files as the portal does, and sketch each screen's layout [alias: show]
  example  Print a worked screen to start from: fixed (splits and tabs) or scroll (a grid)
  schema   Print the JSON Schema of a screen (the default) or of screens.json
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

A project's screens are JSON files in .screens/ of its repository: screens.json (home and the
sidebar's order) and one <slug>.json per screen. The portal shows what main has, so check before you
commit, and propose a change on a branch with a pull request.

Examples:
  space-env screens example fixed > .screens/ops.json
  space-env screens check
  space-env screens schema

Exit status 1: a file fails the check. 3: the portal did not answer in time.

space-env screens check

Check .screens/ files as the portal does, and sketch each screen's layout

Usage: space-env screens check [PATHS]...

Arguments:
  [PATHS]...
          Directories or files (default: .screens)

Options:
  -h, --help
          Print help

PATH is a directory (all its .json files) or files; the default is .screens in the current
directory, else at the top of this git checkout. Send the whole directory: the check covers the set
too (a screen in screens.json's order with no file, a file the order doesn't list). Each error says
what is right instead. A valid screen prints a sketch of its layout: a box per stack (fixed) or per
panel (scroll), the active tab marked *.

Run it before every commit to .screens/: a screen the portal refuses keeps its last valid version,
and a new screen that fails is not shown at all. A .pages folder left from before screens were
called screens gets a warning: the portal reads .screens.

Examples:
  space-env screens check
  space-env screens check .screens/ops.json .screens/screens.json

Exit status 1: a file fails. 3: the portal did not answer in time.

space-env screens example

Print a worked screen to start from: fixed (splits and tabs) or scroll (a grid)

Usage: space-env screens example <KIND>

Arguments:
  <KIND>
          [possible values: fixed, scroll]

Options:
  -h, --help
          Print help

The screen's JSON goes to stdout, its sketch to stderr, so it can be saved as it is.

Examples:
  space-env screens example fixed > .screens/ops.json
  space-env screens example scroll

space-env screens schema

Print the JSON Schema of a screen (the default) or of screens.json

Usage: space-env screens schema [OF]

Arguments:
  [OF]
          [default: screen]
          [possible values: screen, index]

Options:
  -h, --help
          Print help

The schema says what each field takes; the portal checks a little more than a schema can (each panel
placed once, a $variable of the binding's type, grid items not overlapping): space-env screens check
checks it all.

Examples:
  space-env screens schema
  space-env screens schema index

space-env schema

Print the entities of a space; write the space as a space.toml, or compare it with one

Usage: space-env schema [COMMAND]

Commands:
  dump     Print the space as it is now, as a space.toml
  compare  Compare the space with a space.toml; print the space-env commands that make it match
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Without a subcommand it prints space.schema.toml: every entity of a space (machines, agents,
services, credentials, shares, ...) with what it is for, who owns it, its fields, and the space-env
commands and socket routes that reach it.

A space.toml says what one space should have: its machines and their metadata, this machine's
services, its credentials and shares. dump prints the space as it is now as one; compare reads one
and prints the space-env commands that would make the space match it. Neither changes anything.

Examples:
  space-env schema
  space-env schema dump > space.toml
  space-env schema compare
  space-env schema compare -f ops/space.toml --prune

Exit status: 0 ok; compare: 0 the space matches, 1 it differs, 2 an error (a bad file, another
space, the platform unreachable).

space-env schema dump

Print the space as it is now, as a space.toml

Usage: space-env schema dump

Options:
  -h, --help
          Print help

It lists the space's slug, its machines with their own metadata (not the platform's space/ and cp/
keys, nor agent/ ones, which change while an agent works), this machine's services, the credentials
by name (never a value) and the shares by prefix. Each entry gets an empty purpose and owner to fill
in. Schedules and artifacts are left out: they come and go while the space runs. A section space-env
can't list from here becomes a comment and is left out, so compare doesn't check it; one listed with
nothing in it is an empty table ([services]), which compare checks.

Example:
  space-env schema dump > space.toml

space-env schema compare

Compare the space with a space.toml; print the space-env commands that make it match

Usage: space-env schema compare [OPTIONS]

Options:
  -f, --file <FILE>
          The space.toml to compare with

          [default: space.toml]

      --prune
          Also print the commands that remove what the file doesn't list (services, shares)

  -h, --help
          Print help

It changes nothing: read the commands, then run the ones you want. It prints them under a # SECTION
heading, with notes as # comments, and nothing when the space matches. Each section of the file is
compared; a section left out isn't checked, an empty one ([services]) means none:

- space = "SLUG": the space (whoami's project); another space is an error.
- [machines.NAME] meta = { KEY = "VALUE" }: the keys listed, others left alone. A missing machine is
a note (machines are made in the portal). This machine's metadata becomes meta set (with
--as-machine or --as-agent where an agent's tools are attached, so it sets the machine compared),
another's a note naming that machine.
- [services.NAME] argv, restart, env, cwd, needs: this machine's services. A missing one becomes
services create, a changed one delete and create, a stopped one start.
- [credentials.NAME] reason, label, host: that it exists, by name (values are never in the file). A
missing one becomes credential request.
- [shares."PREFIX"] title: a missing share becomes share create, another title share title.

Every entry may carry purpose and owner: compare reads them but doesn't compare them. [secrets.NAME]
is the same as [credentials.NAME]. Schedules and artifacts aren't part of a space.toml.

What the file doesn't list is shown as a comment with the command that removes it, and doesn't count
as a difference; --prune prints those commands instead (services and shares: extra credentials are
removed in the portal). An extra machine is always a note and a difference.

Examples:
  space-env schema compare
  space-env schema compare -f ops/space.toml --prune

Its output, for a service whose command changed and a missing credential:
  # services
  # app: argv differs; replace it
  space-env services delete app
  space-env services create app --restart on-failure -- node server.js

  # credentials
  space-env credential request GITHUB_TOKEN --reason 'Push the fix branches'

Exit status: 0 the space matches, 1 it differs, 2 an error (a bad file, another space, the platform
unreachable).

space-env docs

Print the agents' handbook: how to work in a space, and each command in a line

Usage: space-env docs [OPTIONS]

Options:
      --skill
          Print it as the agentspaces-handbook skill's SKILL.md (with its frontmatter)

  -h, --help
          Print help

The handbook is the docs site's page, built into this binary:
https://docs.agent-spaces.eu/reference/space-env-handbook/. Your harness has it as your instructions
and as the agentspaces-handbook skill. A command's details are in its own --help.

Examples:
  space-env docs
  space-env docs --skill

The socket API

space-env is a client of /run/space-env/api.sock, which vmagent serves in every machine: HTTP/1.1 with JSON bodies, readable and writable by root. Any program can use it, for example:

curl -s --unix-socket /run/space-env/api.sock http://space-env/v1/whoami
Method and pathBody or queryAnswer
GET /v1/whoami{"vm", "vm_id", "project", "created_by", "on_behalf_of", "grants", "grants_limited"}
POST /v1/events{"kind", "level", "message"?, "data"?} (a machine event: level info, warning or error; data an object){}
POST /v1/messages{"to", "type", "qos"?, "payload"} (no to for channel.*)the message (envelope and payload)
POST /v1/messages/receive{"types"?, "context"?, "timeout_s"?, "lease_s"?} (at most 60 s per call; lease_s: held until acknowledged, at most 300 s){"message": … or null}
POST /v1/messages/ack{"id"} (a message received with lease_s){"acked": bool}
GET /v1/messages/waiting?older_than_s=N{"messages": […]}
POST /v1/fork{"name", "payload", "hot"?} (an agent request){"vm", "vm_id", "checkpoint", "context", "hot", "cold_because"?}
POST /v1/schedules`{“at”“in_s”
GET /v1/schedules{"schedules": […]}
DELETE /v1/schedules/{id}{"id"}
POST /v1/topics{"name"} (a project/ topic, owned by this machine or its agent){"topic", "owner", "created_at", "created"}
GET /v1/topics?filter=F (optional, URL-encoded){"topics": […]}: the topics this machine may see
DELETE /v1/topics/{name}({name} is the whole topic, slashes and all; one this machine or its agent owns){"topic", "ended"}
POST /v1/publish{"topic", "payload"} (any JSON, at most 64 KiB){"topic", "delivered", "dropped"}
POST /v1/subscriptions{"filter", "reason", "qos"?, "once"?}the subscription
GET /v1/subscriptions{"subscriptions": […]}
DELETE /v1/subscriptions?filter=F (URL-encoded){"filter"}
POST /v1/tools/attach{"vm"?, "pubkey"?} (no vm: detach){"tools_vm", "tools_vm_id", "targets", "attached_by"}
POST /v1/tools/key{"pubkey"} (this machine’s key, the attachment unchanged){"tools_vm", "tools_vm_id", "targets", "attached_by"}
GET /v1/tools{"tools_vm", "tools_vm_id", "targets", "attached_by"}
GET /v1/machines{"vms": [VM, …]}: the project’s ordinary machines (an agent’s machine only)
POST /v1/machines{"name", "image"?, "vcpus"?, "mem_mib"?, "disk_gib"?, "start"?, "timezone"?, "from_checkpoint"?}VM, the new machine
GET /v1/machines/{name}VM
POST /v1/machines/{name}{"label"?, "timezone"?}VM
DELETE /v1/machines/{name}?keep_checkpoints=true (its checkpoints stay)VM, deleted
POST /v1/machines/{name}/checkpoints{"checkpoint"?, "tags"?} (a running machine this one created)the checkpoint, with vm
GET /v1/machine-checkpoints?tag=TAG{"checkpoints": [{"checkpoint", "id", "status", "tags", "created_at", "vm", "vm_deleted"}]} (of the machines this one created, deleted ones too)
DELETE /v1/machine-checkpoints/{checkpoint}{"deleted": NAME}
POST /v1/machines/{name}/fork{"name", "hot"?} (the new machine’s name)VM, the new machine, with checkpoint, forked_from, hot and cold_because?
POST /v1/machines/{name}/sleepVM
POST /v1/machines/{name}/wakeVM
POST /v1/machines/{name}/resize{"vcpus"?, "mem_mib"?, "disk_gib"?}VM, at its new size (a running one restarted into it)
POST /v1/resize{"vcpus"?, "mem_mib"?, "disk_gib"?}{"vm", "vm_id", "from", "to", "restart_in_s"}: this VM restarts into it then
GET /v1/tools/peer{"harness", "harness_id", "pubkey"}: who is attached to this VM
POST /v1/tools/release{"released"}: the harness attached to this VM, now detached (null: none was)
GET /v1/agents{"caller", "agents"}: the project’s agents, and this VM’s agent
POST /v1/agents{"name", "role"?, "description"?, "harness"?} (a subagent of this VM’s agent)the new agent
POST /v1/agents/{name}{"role"?, "description"?, "state"?} (an agent below the calling agent)the agent
DELETE /v1/agents/{name}(an agent below the calling agent: with the agents below it, their machines and the machines they created){"deleted": [AGENT], "machines": [NAME]}, deepest first
GET /v1/meta{"vm", "meta"} of this VM
GET /v1/meta/{vm}{"vm", "meta"} of VM {vm}
POST /v1/meta{"set": {"KEY": "VALUE"}}{"vm", "meta"} after the change
POST /v1/meta/unset{"keys": ["KEY"]}{"vm", "meta"} after the change
GET /v1/forks{"forks": [{"vm", "vm_id", "state", "created_at", "forks"}]}
GET /v1/checkpoints{"checkpoints": [{"checkpoint", "id", "status", "tags", "created_at"}]} (this machine’s)
POST /v1/checkpoints{"name"?, "tags"?, "unique"?} (checkpoints this machine; unique: each tag comes off its other checkpoints)the checkpoint
POST /v1/checkpoints/{checkpoint}/tags{"add"?, "remove"?, "unique"?} (one of this machine’s checkpoints, by name or a tag only one has)the checkpoint
DELETE /v1/forks/{name}?cascade=true (also its own forks){"deleted": [NAME]}, deepest first
GET /v1/vms?selector=k=v,k2!=v,k3,!k4 (URL-encoded){"vms": [{"vm", "meta"}]}
POST /v1/artifacts/uploads{"name", "ttl_s"?, "lease_s"?}{"upload_url", "expires_at"}: PUT the content there (with Content-Length)
POST /v1/artifacts/requests`{“action”: “list”“get”
GET /v1/buckets{"buckets": [BUCKET]} of this project
POST /v1/buckets{"name", "visibility"?, "max_bytes"?, "inline"?}the bucket
PATCH /v1/buckets/{name}{"max_bytes"?, "inline"?, "not_found"?}the bucket
DELETE /v1/buckets/{name}{"deleted": NAME}
POST /v1/buckets/{name}/ls{"prefix"?, "after"?, "limit"?}{"objects": [{"path", "sha256", "size", "content_type", "updated_at"}], "next"?}
POST /v1/buckets/{name}/put{"files": [{"path", "sha256", "size", "content_type"?}]} (at most 200)`{“files”: [{“path”, “status”: “stored”
POST /v1/buckets/{name}/rm{"paths"?, "prefix"?}{"removed": N}
PUT /v1/uploadan upload’s bytes, its URL (an artifact’s or a bucket file’s upload_url) as X-Upload-Urlthe upload proxy’s answer: the upload sent from this machine (on a machine an agent’s tools are attached to, over the link: from the agent’s)
POST /v1/uploada request_url as X-Upload-Urlthe upload proxy’s answer (the content), the request sent from this machine
POST /v1/buckets/serve{"name"} (null or absent: none){"portal", "bucket"}: the static front of this machine’s web portal
POST /v1/wakelocks{"name", "for_s"?} (default 900, at most 3600; again to refresh){"wakelocks": [{"name", "expires_at"}]}
GET /v1/wakelocks{"wakelocks": [{"name", "expires_at"}]}
DELETE /v1/wakelocks/{name}{"wakelocks": […]} after the release
GET /v1/status{"timeout_s", "idle_since", "sleeps_at", "last_call", "reasons", "wakelocks"}
POST /v1/shares/requests`{“action”: “create”“list”
GET /v1/secrets{"secrets": [{"name", "guest_readable"}]} (no values)
GET /v1/secrets/{name}{"value_b64"} of a guest-readable secret (403 if it isn’t)
POST /v1/secrets/{name}/capture{"kind", "value_b64", "account"?} (an agent’s sign-in; write-only){"name", "kind", "placeholder"}
POST /v1/secrets/{name}/request{"reason", "label"?, "instructions"?, "auth_url"?, "auth_url_label"?, "logo_url"?, "kind"?, "one_time"?, "host"?, "header"?, "replace"?} (ask the VM’s user for it, or its agent’s owner; replace: a new value for one it asked for before){"request": {"id", "name", "label", "agent_id", "status", "scope", "close_reason", "one_time", "replace", "secret", "placeholder", "created_at", "expires_at"}}
POST /v1/credential-requests/{id}/wait{"timeout_s"?} (at most 60 s per call){"request": {…}} once it is not open or the time is up; "value_b64" once for a filled one-time request
POST /v1/credential-requests/{id}/cancel{"reason"} (id: the request’s id, or the NAME of the open request for it; take it back, saying why){"request": {…, "status": "cancelled", "close_reason"}}; 404 when there is no such open request
POST /v1/git-credential{"host"}{"username", "password"} for git on that host
POST /v1/web-portal/invites{"email", "data"?, "days"?, "mail"?} (data: a JSON object, at most 4 KB; days: 1-30){"id", "expires_at", "link"}; 409 already_member when the address has an account
GET /v1/web-portal/invites{"invites": [{"id", "kind", "expires_at", "data"}]} (kind: invite or signup_link)
POST /v1/web-portal/signup-links{"data"?, "days"?}{"id", "expires_at", "link"}
DELETE /v1/web-portal/invites/{id}{}: the invite or sign-up link is revoked
GET /v1/web-portal/users{"users": [{"sub", "inserted_at", "last_sign_in_at", "disabled", "two_factor", "verified", "locale"}]}
POST /v1/web-portal/users/{sub}/disable{}: they can’t sign in and are signed out
POST /v1/web-portal/users/{sub}/enable{}
POST /v1/web-portal/users/{sub}/sign-out{}: every session and API token ends
POST /v1/web-portal/users/{sub}/reset-2fa{}: two-factor sign-in is off until they set it up again
GET /v1/web-portal/source{"dir", "port", "web_portal", "found", "source", "refused"}: what the site serves (the Spacebar)
POST /v1/web-portal/source`{“dir”: “/path”null}` (null: find it from the listener again)
GET /v1/services{"services": […]}
GET /v1/services/{name}the service
PUT /v1/services/{name}{"argv", "restart"?, "env"?, "cwd"?, "needs"?, "on_demand"?}the service, started
DELETE /v1/services/{name}{}
POST /v1/services/{name}/startthe service
POST /v1/services/{name}/stopthe service
POST /v1/services/{name}/restartthe service
POST /v1/services/{name}/signal{"signal": "HUP"} or a number{}
GET /v1/services/{name}/logs?lines=Nthe lines, as text

A message is its envelope (id, type, from, from_kind, to, qos, sent_at, expires_at, set by the platform) and its payload. from_kind is vm when from is a machine of the project, platform when the platform sent it (a schedule, the portal, an operator). An agent payload has role (ROLE_USER or ROLE_AGENT), non-empty parts and optionally contextId; each part has exactly one of text, raw (base64), url or data, plus optional filename, mediaType and metadata. An info payload is {"message": "..."}.

A schedule is {"id", "cron", "next_at", "qos", "context", "label", "description", "fired", "last_fired_at", "created_at", "payload"} (cron is null for a one-shot, label and description null when not given). A service is {"name", "argv", "restart", "env", "cwd", "needs", "running", "stopped", "pid", "restarts", "last_exit", "log"}; the services routes are answered in the machine, without the platform.

Errors have a 4xx or 5xx status and the body {"error": {"code", "message", "retry"}}. retry is true when the same call may succeed later (the platform was briefly unreachable); repeat a receive, but check before repeating a send or fork, which may have taken effect.

Last updated on