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:
- The
--agentflag. - The
agentkey of.outerlayer/config.json. - The agent whose session runs setup. Setup finds Claude Code by
CLAUDECODE, and Codex byCODEX_THREAD_ID. - Claude Code.
.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:
- 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.
- Connect and install. Setup runs
initonce with the factory. When the repository is not linked to the factory, it prints the factory’s Work page link. - 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-prit opens the pull request. Merge it. Setup reports the setup merged only when the base branch holds.outerlayer/config.jsonand thebuildskill. Every build loads that skill. When the base branch holds the config and nobuildskill, setup names the missing file and the reason. It prints the commands that add the file, and exits with code 1. - Start a runner. When no runner has checked in, setup prints the
runner initcommand 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 fromclaude setup-token. It shows neither. When OuterLayer provides managed sandboxes to the factory, the command isrunner init --sandbox, and the machine needs no Docker, KVM or Linux VM. See Build in a managed sandbox.
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:
ghis not installed.ghis not signed in to github.com. Setup prints whatgh auth statussays. Only the account thatghuses for github.com counts.ghcould not create the pull request. Setup prints the first line of whatghsays.
outerlayer init
Connect a repository to a factory, install OuterLayer’s hooks, add the starter skills and MCP servers, and rundoctor.
What init does
init never signs in. Run outerlayer login first. init then runs these steps in order:
- Connect. Runs
outerlayer connect. With no saved credential, or no git remote,initskips this step. It then says to runouterlayer loginandouterlayer initagain. - Hooks. Backs up Claude Code’s settings file, then writes OuterLayer’s hooks into it.
initsets up no other agent.SessionStart,SessionEnd,StopandPostToolUsehooks. 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.
initkeeps an existingstatusLinecommand and prints its output first. - Wrappers around your existing
PreToolUseandPostToolUsehooks. Seehooks wrap.
- Shell function. On a terminal, asks whether plain
claudeshould start throughouterlayer claude. See Make plain claude start the launcher. - Agent setup. Writes each of these files only when it is missing, and leaves them uncommitted.
initskips 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 noAGENTS.mdorCLAUDE.md..outerlayer/config.jsonwith"layout": 2.- A link from
.claude/skillsto../.agents/skills, so Claude Code finds the skills. - The
outerlayerandouterlayer-docsMCP servers, in.mcp.json. When OpenCode is installed on the machine,initalso adds them toopencode.json. When Codex is installed,initalso adds them to.codex/config.toml.initkeeps the other servers in a file, and an entry that already has either name.
- The four starter skills, in
- Check. Runs
doctorand prints its lines.
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 throughouterlayer 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,
initprints the line for you to add. - With no terminal and no flag,
initwrites nothing to your shell startup file. init --no-shell-functionandinit --removetake the block out and leave the rest of the file as it was.init --localchanges the startup file only with--shell-functionor--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.
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.mdlayout when the repository has not moved. The move never deletes a file you edited. With--no-skills-linkor--control-plane, it makes no.claude/skillslink. 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.
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 arunner 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:containerorbuiltin:vmhooks, doctor also leaves out Claude Code version and Cloud sync. Each build runs Claude Code and sends its sessions from inside its own image.
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_WORKset. The session’s page then updates beforesyncruns.
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.