# Set up Mach 1 Tower

**For the agent following this guide:** Set up Tower in the host the user is
already using. Follow the shared steps and that host's section. Do each step
yourself when the host provides an authorized tool. When the user needs to act,
give them the exact control to use and wait for the result before continuing.
Keep setup read-only in Mach 1. Local folder creation and sync are part of setup.

## Connect and choose a bot

1. Use production at `https://agents.mach1ai.com/mcp/tower`. Use
   `https://agents.dev.mach1ai.com/mcp/tower` only if the user explicitly asks
   for development. Reuse a connection only if its endpoint matches exactly.
   Use Streamable HTTP with OAuth. Let the user complete browser sign-in and
   consent. Keep credentials and download tickets out of user-facing messages.
   Name the connection **Tower**. If the name is taken, use an unused name
   such as **Tower Dev** for development or **Tower Prod** for production.
   When reusing a matching connection, update its display name if the host
   allows it and the new name is free.
2. Check that the current host can call `tower_list_bots` on the selected
   connection. Let the user choose from that list unless they already named an
   unambiguous bot. Call `tower_open_workspace`. Read its instructions and
   guidance catalog. Check that its `mcp_url` matches the selected endpoint.
3. Ask the user to select or approve a writable local folder for Mach 1. Reuse
   the same folder on subsequent opens. Run setup from that folder. The
   installer creates `production/<bot-id>/` or `development/<bot-id>/`
   underneath it. If reopening from inside a bot project, use the original
   Mach 1 folder for the installer and obtain host access to it if needed.
   If an earlier Tower setup used `<bot-id>/` directly under that folder,
   point it out before creating the new folder. If the user wants to carry
   over unfinished work, have them move the whole folder before syncing.
   First confirm the old bot folder, its `.mach1/` directory, the manifest,
   and the destination parent are real paths within the approved root with
   no symlinks. The manifest must match the exact selected connection and
   bot, and the destination must be absent. Otherwise keep the old folder
   and point out where to find those edits.

## Host steps

### ChatGPT Work

- If Tower is missing, guide the user to [ChatGPT Plugins](https://chatgpt.com/plugins)
  in the web app. Select **+ → Add custom MCP server**, enter the connection
  name from step 1, paste the selected Server URL, choose **OAuth**, and
  select **Create as a plugin** after reviewing the
  connection. Install the resulting connection. If workspace policy hides the
  control, ask a workspace admin to add or enable it. This is ChatGPT's
  custom-connection UI for the existing Tower server.
- In the ChatGPT desktop app, choose **Work**, open the approved Mach 1
  folder as a local project, and select the connection with **@** in a new
  Work task if it is not already available. Give the user the next prompt:
  “Continue Mach 1 Tower setup using this guide.” [Custom MCP setup](https://developers.openai.com/api/docs/guides/custom-mcp-server)
  · [Local projects](https://learn.chatgpt.com/docs/projects)
- Run the install steps below from the local Work task using the host's file
  and execution tools. If the probe fails, check where the command executed.
  Use **Local** where available for work on the computer. In **Settings →
  Data controls → Work network access**, check **Allow public internet access**
  if that setting is available and policy permits it. Retry after the current
  run finishes and Work refreshes its execution environment. If an admin
  restriction still applies, report it. [Work network access](https://learn.chatgpt.com/docs/enterprise/chatgpt-work-overview)
- Use `harness: openai`. After sync, use the selected bot folder for all Tower
  file operations. Open and read `AGENTS.md` and `.mach1/AGENT.md` in Work.
  For a Tower command, read its downloaded command skill and the command
  body it points to. For delegation, load the relevant `.mach1/agents/` role
  contract and follow its restrictions using Work's supported delegation.
  Verify the delegate has the required tools and access to the same bot
  folder before assigning it file work. Report a missing required capability.
  For a reusable Work entrypoint, guide the user through `@skill-creator`
  to create a **Tower command** skill that reads the selected bot's current
  instructions and command files. Verify it is available in Work before
  claiming native registration. [Work skills](https://learn.chatgpt.com/docs/build-skills)

### Codex

- Check **Settings → MCP servers** or run `codex mcp list` before adding
  a connection. If the URL is new and `tower` is free, run
  `codex mcp add tower --url <selected-url>` and `codex mcp login tower`.
  If `tower` is taken, use an unused name such as `tower-dev` or
  `tower-prod` in both commands. Keep the configured name when reusing
  an existing CLI connection. Start a new Codex session if the tools are
  missing after adding the server.
  [Codex MCP](https://learn.chatgpt.com/docs/extend/mcp)
- Open the Mach 1 folder in Codex. Use `harness: openai`. If access is
  restricted, use the host's permission prompt for the required network or
  folder access. Sync from the approved parent folder. Then open the bot folder
  as the Codex project to discover its `AGENTS.md` and `.agents/skills/`.
  [Codex permissions](https://learn.chatgpt.com/docs/agent-approvals-security)
  · [Skill discovery](https://learn.chatgpt.com/docs/build-skills)

### Claude Cowork

- Open **Customize → Connectors → Add custom connector**, enter the connection
  name from step 1 and the selected URL, and complete OAuth. On managed plans,
  ask the organization owner to add the connector if it is unavailable.
  In desktop Cowork, select the approved local folder and make sure Tower
  is enabled for the task.
  [Cowork custom connectors](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp)
- Use `harness: claude`. After sync, select the bot folder in Cowork and read
  `CLAUDE.md`, `.mach1/AGENT.md`, and relevant command, skill, and role files
  there. Use folder instructions to point subsequent tasks at those files.
  Verify any native skill registration in Cowork itself.
  [Cowork folder instructions](https://support.claude.com/en/articles/13345190-get-started-with-claude-cowork)

### Claude Code

- Run `claude mcp add --transport http --scope user tower <selected-url>`
  if the exact endpoint is missing and `tower` is free. If it is taken,
  use an unused name such as `tower-dev` or `tower-prod`. Run `/mcp` to complete OAuth.
  [Claude Code MCP](https://code.claude.com/docs/en/mcp)
- Run the install steps from the approved Mach 1 folder with `harness: claude`.
  Open Claude Code in the bot folder after sync so it can discover
  `CLAUDE.md` and `.claude/skills/`.
  [Claude Code skills](https://code.claude.com/docs/en/skills)

## Install or refresh the selected bot

1. Confirm the shell's working directory is the approved Mach 1 folder on
   the user's computer. From that folder, check for a POSIX shell, POSIX Python 3,
   and curl 7.63 or newer. Probe the selected MCP URL without a ticket or
   token. Use the matching literal URL from this guide in place of
   `<selected-url>`.

   ```sh
   curl -q --silent --show-error --max-time 8 --output /dev/null --write-out '%{http_code}\n' '<selected-url>'
   ```

   A `401` from Tower is expected and confirms shell reachability. Verify MCP
   separately with `tower_list_bots`. If host policy blocks the download,
   use the host's supported permission flow and scope it to the selected
   hostname where available. If the policy cannot be changed, report local
   sync as blocked and use authorized MCP guidance and source reads as needed.

2. Download the installer from the selected MCP URL plus
   `/workspace-installer-v1.py`. Use the same executor and substitute the
   selected MCP URL below. Save the printed path for the next step. Review
   the script and resolve host permissions before requesting a ticket.

   ```sh
   installer_dir=$(mktemp -d) &&
     curl -q --fail --silent --show-error --max-time 30 \
       --output "$installer_dir/workspace-installer-v1.py" '<selected-url>/workspace-installer-v1.py' &&
     printf '%s\n' "$installer_dir/workspace-installer-v1.py"
   ```

3. Decide how to supply stdin before requesting a ticket. Use the executor's
   stdin input when available. Otherwise, use `mktemp` inside the approved
   Mach 1 folder and confirm that the file is accessible only to its owner.
   Use the host's file tool to write the ticket into that existing file.
   If the host offers neither option, report that local sync is blocked.

   Call `tower_prepare_workspace_sync` with the selected `workspace_id`,
   current `policy_version`, and host harness. Pass the JSON object returned
   by the tool on stdin. If the tool wraps it in a text block, use the JSON
   inside that block. Run the installer promptly from the approved folder.
   If the host asks for tool approval, tell the user it issues a temporary
   download ticket and wait for approval.
   For development append `--development` to the Python invocation.

   ```sh
   python3 -I '<absolute-path-to-installer>' < '<private-ticket-file>'
   ```

   Remove the temporary ticket file immediately after the attempt, including
   on failure. Keep the ticket out of shell command text and user-facing
   output. A ticket expires after two minutes. Prepare a new
   one if it expires before the command runs. On a policy conflict, refresh
   core guidance with `tower_get_guidance` and prepare a ticket for the new
   version. Remove the temporary installer and its empty directory after use.

4. Use the bot folder printed by the installer. Read the installed guidance
   and verify the commands the host actually exposes. Verify the local
   policy version and command checksum before following a command skill, or
   fetch the current command with `tower_get_guidance`. Role definitions are
   available under `.mach1/agents/`; downloading them does not register native
   subagents. Report the environment, bot, folder, and any conflicts or
   unavailable sources. The snapshot includes guidance, bot prompts, context,
   and draft workflow files that Tower could retrieve. Refresh the same bot
   folder on reopen, before using cached sources, and after a server write.

## Upload workflow drafts

Use `prepare_workflow_create` or `prepare_workflow_upload`, then run the
returned curl command from the directory containing `main.py` and
`flight_plan.md`. Keep the ticket private. If the result is
uncertain, use the returned status command before preparing another upload.
If this host cannot run curl or reach Tower, report that upload is blocked.

## Upload prompt drafts

Use `prepare_prompt_upload` with the prompt directory, then run the returned
command from that directory. It uploads `manifest.json` and every `.md` file
there, so move stray `.md` files out first. The command needs a POSIX shell
(bash or zsh). Keep the ticket private and use the returned status command if
the result is uncertain.

## Upload context entries

Use `prepare_context_create` or `prepare_context_update` with the context file
paths relative to the bot folder, then run the returned command from the bot
folder. The result lists each file with `ok` or `error`. An error ending in
`returned 4xx` wrote nothing; verify any other failed entry before retrying it.
