outerlayer context show
Print the instructions and skills that a repository’s builds receive. Run it before a build to see what the build gets. It needscontext.read, which a factory’s read role holds.
The command prints:
- Which repository governs it, or that it governs itself.
- The commit a build gets. For a governed repository this is the control plane’s commit. For a repository that governs itself it is the head of the default branch.
- The instruction files that exist at that commit.
- The names of the skills under
.claude/skills/and.agents/skills/. - A warning when the skills include no
build. See When a build has nobuildskill.
--json, the document holds repository, state (governed or self), source (the governing repository, ref and commit, or null), commit, instructionFiles, skills and warnings.
The command uses your login or a factory key. It connects the repository to a factory on its own when exactly one factory fits. See Automatic connection.
outerlayer context emit
Compile the sources in.outerlayer/ into the files that each target reads. A target is a tool whose files emit writes.
Most repositories do not need this command. In the AGENTS.md layout, emit compiles only the slash commands in .outerlayer/commands/.
targets in .outerlayer/config.json. The command has no --target flag. The targets are claude-code, opencode and codex. The codex target writes the files that the opencode target writes, because Codex reads AGENTS.md and .agents/skills/ in a repository. A config that lists cursor, copilot or factory fails with an error that names the target. Delete that target from the config.
The .outerlayer directory lists the files each target gets.
What emit writes and deletes
emit writes each output. It deletes each orphaned output: a generated file whose source is gone. It never deletes a file without the generated-by header, such as .mcp.json.
In the AGENTS.md layout, emit never deletes an AGENTS.md, a CLAUDE.md or a skill file, and it rewrites no maintained skill.
In a repository that has not moved to that layout, emit also does these things:
- It writes the instructions, skills and MCP servers of each target.
- It prints a notice that names
outerlayer init --update, which moves the repository. See Move a repository to this layout. - It rewrites each maintained skill whose folder exists to the installed CLI’s copy. It never rewrites a template skill.
- It deletes a skill folder named
amend,emitting-evidence,reporting-findingsorouterlayerwhen itsSKILL.mdhas the “maintained by OuterLayer” line.
emit does not read inside a nested clone, a submodule or a clone that a control plane governs.
What —check reports
--check writes nothing and exits 1 when it finds drift. Each drift entry has one of these kinds:
JSON output of emit
With--json, the document has targets, files, copies, maintained, retired, orphaned, warnings and errors. files, copies, maintained, retired and orphaned hold the paths the run wrote or removed.
With --check --json, the document has targets, drift, warnings and errors. Each drift entry has a path and a kind.
See also: Set up agent instructions and skills, The .outerlayer directory.
outerlayer claude
Start Claude Code with the control plane that governs the checkout attached.--help included. It starts the first claude on PATH.
Before it starts Claude Code, it does these things:
- It installs the maintained skills in
~/.agents/skills/when they are missing. - It attaches the checkout’s own
.agents/skills/skills, so Claude Code loads them without a.claude/skillslink. - Where a control plane governs the checkout, it attaches the control plane’s copy. It adds
--add-dirand--settingsbefore your arguments, and setsOUTERLAYER_CONTROL_PLANE_DIR.
~/.outerlayer/context/<owner>/<repo>/<commit>/. It writes nothing from the control plane into the working tree. See What a laptop session does in a governed repository. To make plain claude start it, see Make plain claude start the launcher.
In a build, the runner supplies the control plane, and claude runs outerlayer claude. A command such as claude -p "Build the issue" needs no change. See A governed repository’s context.
In a governed checkout, it refuses to start a Claude Code older than 2.1.284. Older versions do not load a control plane’s instructions for subagents.
Hooks in a control plane must reach their scripts through OUTERLAYER_CONTROL_PLANE_DIR. See Hooks in a control plane.
outerlayer opencode
Start OpenCode with the control plane that governs the checkout attached.outerlayer claude does, and gives it to OpenCode as its config folder, in OPENCODE_CONFIG_DIR.
When the arguments are run and a message that is only /<name>, and the control plane has a skill of that name, it attaches the skill’s file. OpenCode does not load a skill from a slash command on its own.
outerlayer codex
Start Codex with the control plane that governs the checkout attached.codex on PATH. It finds the control plane as outerlayer claude does.
Codex has no flag that adds a folder of instructions or skills. So each launch makes a CODEX_HOME of its own in ~/.outerlayer/codex-home/, and sets CODEX_HOME to it. The launch writes nothing into the checkout. The folder holds these files:
AGENTS.md: the control plane’s instructions, then your own~/.codex/AGENTS.md.skills/: the control plane’s skills, and links to your own skills.hooks.json: OuterLayer’s hooks forSessionStart,PostToolUseandStop, after your own hooks and the control plane’s.config.toml: your~/.codex/config.toml, with theouterlayerMCP server added. If your ownproject_doc_max_bytesis larger than the deliveredAGENTS.md, your value stays. Otherwise the launch raises it.auth.json: a copy of your login.sessions,pluginsand.tmp: links to the same folders in~/.codex/. Socodex resumelists every session, and your installed plugins work in the launch.
auth.json back to ~/.codex/ if Codex refreshed it, and removes the folder. Your login, your config and your session history work the same outside OuterLayer.
The hooks and the MCP server run outerlayer from PATH, so install the CLI globally for them to work.
The launch adds --dangerously-bypass-hook-trust before your arguments. Without it, Codex skips hooks that you have not trusted, and says nothing.
When the last argument is only /<name>, and the control plane has a skill of that name, the launch changes it to $<name>. Codex does not load a skill from a slash command. It loads the skill’s text from $<name>.
It refuses to start a Codex older than 0.169.0, with or without a control plane. That is the version OuterLayer reads sessions from.
outerlayer mcp install
Write or update theouterlayer MCP server entry. It writes the entry to .outerlayer/mcp.json when that file exists, else to .mcp.json. When OpenCode is installed on the machine, it also writes the entry to opencode.json. When Codex is installed, it also writes the entry to .codex/config.toml. It never writes an API key.
mcp install replaces an entry of the same name. The entry’s command is outerlayer, so the CLI must be on the client’s PATH. Use --command when it is not. outerlayer init writes a different entry, npx -y @outerlayer/cli mcp serve, and keeps an entry that exists.
See also: Use the MCP server.
outerlayer mcp serve
Run a stdio MCP server that bridges to the gateway. The stdio.mcp.json entry runs this.
It reads a factory key, or your login, at start-up. See Credential resolution.
It exits 1 before reading any input when it cannot connect. The MCP client shows the message as the connect error:
Unlike
work and emit commands, the MCP server does not choose a factory on its own. See Automatic connection.
See also: Use the MCP server.