Skip to main content
These commands set up OuterLayer on a machine and in a repository, and check the setup. Run outerlayer setup to set up a new factory from start to end, or outerlayer init once in each repository. Run outerlayer doctor when something does not work.

outerlayer setup

Sign in, connect this repository and install OuterLayer in it, and open the setup pull request. Then say how to start a runner or add a model key. Setup does one step at a time.
The setup panel’s prompt runs this command for your coding agent. It is written for an agent, and works the same for a person. Setup sets up the repository for Claude Code or Codex. It asks no question. It takes the first rule that gives an answer:
  1. The --agent flag.
  2. The agent key of .outerlayer/config.json.
  3. The agent whose session runs setup. Setup finds Claude Code by CLAUDECODE, and Codex by CODEX_THREAD_ID.
  4. Claude Code.
Each run prints the agent, the rule that chose it, and how to choose the other agent. For Codex, a new .outerlayer/config.json names codex as its only target and as its agent. So the repository’s builds run Codex, whatever the factory’s Default agent is. For Claude Code, the config is the same as before. Setup keeps a config that the repository already has. Each run does each step it can, then stops at the first step that waits on you. It prints what you do next. Run it again when that is done, and it continues from that step. It does these steps in this order:
  1. Sign in. With no saved login, setup starts a sign-in and prints its link and code. Approve it in your browser. The next run saves the login.
  2. Connect and install. Setup runs init once with the factory. When the repository is not linked to the factory, it prints the factory’s Work page link.
  3. Merge the setup. Setup reads the base branch from origin. When the setup files are not there, it stops and asks you before it pushes anything. With --open-pr it opens the pull request. Merge it. Setup reports the setup merged only when the base branch holds .outerlayer/config.json and the build skill. Every build loads that skill. When the base branch holds the config and no build skill, setup names the missing file and the reason. It prints the commands that add the file, and exits with code 1.
  4. Start a runner. When no runner has checked in, setup prints the runner init command for this machine. Run it in your own terminal. It asks you to approve a personal runner key in your browser, and asks for a Claude token or gets one from claude setup-token. It shows neither. When OuterLayer provides managed sandboxes to the factory, the command is runner init --sandbox, and the machine needs no Docker, KVM or Linux VM. See Build in a managed sandbox.
A factory that builds on OuterLayer’s managed runners has no runner step. Step 4 checks the model key of the agent that setup chose instead. Claude Code needs the Anthropic API key, and Codex needs the OpenAI API key. While that key is not set, setup prints it and the setup panel’s link, and exits with code 75. You type the key on the panel. Setup never asks for it. When the key is set, setup says that setup is done. Setup never prints a secret. A login cannot create a runner key, so runner init asks you to approve one in your browser. --open-pr creates the outerlayer-setup branch from the base branch, and commits the setup files only. It pushes the branch, and opens the pull request with gh when gh is signed in to github.com. It commits nothing, and prints the git commands, when the checkout is on another branch, or when the base branch has commits that origin does not have. A .gitignore rule can match a file that setup wrote. For example, the rule build/ matches .agents/skills/build/SKILL.md. --open-pr commits each such file with git add -f. It names the file and the rule in the form that git check-ignore -v prints, such as .gitignore:3:build/. After git tracks a file, ignore rules do not apply to it. A rule that names a whole setup path, such as .mcp.json, keeps that path out of the commit. When gh cannot open the pull request, setup prints the reason, then GitHub’s page to open the pull request. The reason is one of these:
  • gh is not installed.
  • gh is not signed in to github.com. Setup prints what gh auth status says. Only the account that gh uses for github.com counts.
  • gh could not create the pull request. Setup prints the first line of what gh says.

outerlayer init

Connect a repository to a factory, install OuterLayer’s hooks, add the starter skills and MCP servers, and run doctor.

What init does

init never signs in. Run outerlayer login first. init then runs these steps in order:
  1. Connect. Runs outerlayer connect. With no saved credential, or no git remote, init skips this step. It then says to run outerlayer login and outerlayer init again.
  2. Hooks. Backs up Claude Code’s settings file, then writes OuterLayer’s hooks into it. init sets up no other agent.
    • SessionStart, SessionEnd, Stop and PostToolUse hooks. They link a session to its work item, renew the session’s claim on the item, and start the background sync.
    • A status-line segment. init keeps an existing statusLine command and prints its output first.
    • Wrappers around your existing PreToolUse and PostToolUse hooks. See hooks wrap.
  3. Shell function. On a terminal, asks whether plain claude should start through outerlayer claude. See Make plain claude start the launcher.
  4. Agent setup. Writes each of these files only when it is missing, and leaves them uncommitted. init skips this step outside a git repository, and in a repository that a control plane governs.
    • The four starter skills, in .agents/skills/.
    • AGENTS.md, when the repository has no AGENTS.md or CLAUDE.md.
    • .outerlayer/config.json with "layout": 2.
    • A link from .claude/skills to ../.agents/skills, so Claude Code finds the skills.
    • The outerlayer and outerlayer-docs MCP servers, in .mcp.json. When OpenCode is installed on the machine, init also adds them to opencode.json. When Codex is installed, init also adds them to .codex/config.toml. init keeps the other servers in a file, and an entry that already has either name.
  5. Check. Runs doctor and prints its lines.
A failed step does not stop the later steps. The one exception: doctor does not run when init could not install the hooks. init also installs the maintained skills once for the machine, in ~/.agents/skills/, with a link to each in ~/.claude/skills/. Every later outerlayer command updates them when they come from an older CLI version, and never replaces them with an older one. See Set up agent instructions and skills for what each file is for. The outerlayer MCP entry runs npx -y @outerlayer/cli mcp serve, so it starts on any machine with Node. The outerlayer-docs entry is the docs MCP server at https://docs.outerlayer.ai/mcp. It lets your agent look up how OuterLayer works, and it carries no credential. A repository that has not moved to the AGENTS.md layout keeps its skills in .outerlayer/skills/. Run init --update to move it.

Commit what init wrote

When agent setup wrote files, or a setup file is not committed, init prints git add, git commit and git push commands. Run them in the directory where you ran init. A build reads the repository from the git host, so a file you never commit never reaches a build. The judges apply to a pull request only once they are on its base branch. init prints a line for each setup path that git ignores. The commit leaves that path out. When every step passed and the repository is linked, init ends with a line that says to start a runner. See Choose how to run the runner. If the repository is not linked yet, init prints the link to follow instead. See also: Quickstart.

Make plain claude start the launcher

A governed repository gets its control plane through outerlayer claude. init can make plain claude start it. On a terminal, init asks. On yes, it adds a block marked # BEGIN outerlayer claude to ~/.zshrc or ~/.bashrc, chosen from $SHELL. The block defines one function:
  • For another shell, init prints the line for you to add.
  • With no terminal and no flag, init writes nothing to your shell startup file.
  • init --no-shell-function and init --remove take the block out and leave the rest of the file as it was.
  • init --local changes the startup file only with --shell-function or --no-shell-function.

Update the files init wrote

init writes some files once and never overwrites them: the starter skills and the two MCP entries. A later CLI can ship a newer version of one. outerlayer init --update brings them up to date and keeps your edits.
Each file is in one of four states: In an MCP file, --update changes only the outerlayer and outerlayer-docs entries. It never writes .outerlayer/policy.yaml, and it leaves an existing one as it is. OuterLayer does not read that file. --update also does two more things:
  • It moves a repository to the AGENTS.md layout when the repository has not moved. The move never deletes a file you edited. With --no-skills-link or --control-plane, it makes no .claude/skills link. See Move a repository to this layout.
  • It removes maintained skills that the repository commits. The CLI keeps the maintained skills in ~/.agents/skills/ on each machine, so the repository needs no copy. Each path to a removed folder changes to ~/.agents/skills/<skill>/. Before you commit the removal, see Remove maintained skills from a repository.
--update leaves every change uncommitted. It makes no network call, with one exception. When it removes maintained skills and you have a credential, it asks OuterLayer which runner hosts run a CLI older than 0.27.0. It prints their names. --update does nothing outside a git repository, or in a repository that a control plane governs. It cannot be combined with --remove, --org, --local, --template or --factory. The exit code is 1 when a write failed.

JSON output of init

With --json, init prints one JSON document instead of text. The document never holds a credential. With --local or --remove, init prints the result of the hooks step alone. --local with a shell function flag adds shellFunction, with that step’s outcome and reason. With --update, the document has status (done, skipped or failed), reason, dryRun and items. Each item has path, state and action (update, write, remove, keep or none).

outerlayer doctor

Check the setup of this machine and of the repository you run it in. A check that warns or fails prints its fix on the next line.
Each line starts with a mark: ✓ passes, ! warns, ✗ fails and - is skipped. Doctor leaves out a check that does not apply. It prints the laptop checks, the gateway checks, then the runner host checks.
On a new machine right after init, these checks warn. That is expected:

Laptop checks

These check a machine where a person runs sessions. The earlier skill names are amend, emitting-evidence, reporting-findings and outerlayer. The names in use are outerlayer-amend, outerlayer-evidence, outerlayer-findings and outerlayer-cli. In a repository that a control plane governs, doctor leaves out Starter files and every skill check except Skills.

Gateway checks

These checks read from OuterLayer and change nothing. They run on a laptop and on a runner host. Doctor names the first line for the credential a command would send. See Credential resolution. With no credential or no gateway address, doctor shows one skipped Credential line. It skips Factory and Repository, and leaves out the other gateway checks. A login outside a git repository, with no OUTERLAYER_APP_ID, skips Factory and Repository. The GitHub App, Governance and Runner hosts checks run only when the credential check passes.

Runner host checks

A runner host is a machine whose config file has a runner block. outerlayer runner init writes that block. On a runner host, doctor changes the laptop checks:
  • One skipped Laptop checks line replaces the checks for the Claude Code home, transcripts, hooks, spool, daemon and status line.
  • Doctor leaves out Starter files, MCP server, Renamed skills and Skill names.
  • With builtin:container or builtin:vm hooks, doctor also leaves out Claude Code version and Cloud sync. Each build runs Claude Code and sends its sessions from inside its own image.
Doctor then adds the runner’s own checks. A config file that does not load leaves out every check that needs it. Every runner host has these checks: A runner with builtin:container or builtin:vm hooks also has these: A runner with builtin:container hooks also has these: A runner with builtin:vm hooks also has these: runc, Nested virtualization, VMScape and Disk I/O sharing report what a build can reach on the host. They warn and never fail, so doctor exits 0 when all four warn. The runners that OuterLayer operates have five more checks, each named Managed runner. They do not appear on a runner of yours. See Managed runners. On a Mac whose runner runs in a Lima VM, one Runner VM line replaces the runner host checks. It fails when limactl is missing, or the VM is missing or stopped. Run brew install lima, or limactl start <instance>. See Run the runner on a Mac and Run the runner on Windows.

MicroVM jailer problems

The root helper runs each microVM build under Firecracker’s jailer. Without the helper, a build that escaped its microVM would reach the runner’s account. See The microVM helper. The MicroVM jailer line names the first of these that holds:

JSON output of doctor

With --json, doctor prints { "checks": [ ... ], "summary": { ... } }. See also: Troubleshoot the CLI.

outerlayer daemon

Run the daemon in the foreground. Claude Code deletes a transcript after about 30 days. The daemon copies each transcript before that happens.
The daemon also does two more things while it runs:
  • It keeps the status line’s data up to date.
  • With a saved credential, it uploads the new turns of a session started with OUTERLAYER_WORK set. The session’s page then updates before sync runs.
init does not start the daemon. Run it in a terminal you keep open, or under a login agent. outerlayer watch is a deprecated name for daemon, and prints a warning. See also: What leaves your machine.

outerlayer hooks status

List the hooks in the user and project settings, and mark the wrapped ones.
When a settings file is not valid JSON, the command reports it and lists the other file. It exits 0.

outerlayer hooks wrap

Wrap hook commands so that a hook that hangs or is killed leaves a record. init already wraps PreToolUse and PostToolUse hooks. Run this for other events, for hooks you added later, or after init --no-wrap-hooks.
Each wrapped hook starts one more Node process every time it fires.

outerlayer hooks unwrap

Restore wrapped hooks to their original commands. Use it when a wrapper causes a problem.