Skip to main content
These commands sign a machine in, choose the factory a repository’s work goes to, and upload the sessions you start on a work item.

outerlayer login

Sign in to your account, and save the login and the gateway address to ~/.outerlayer/config.json.

Sign in by browser

With no key on stdin, you sign in to your account by browser approval:
  1. login prints an approve link and an 8-character code, such as K7QM-2XPD, and opens the link.
  2. Sign in to the dashboard if needed. Check that the code on the approve page matches your terminal.
  3. Select Approve. There is no factory, organization or permission to choose. login prints Logged in as <your email>.
The link and code expire after 10 minutes. If they do, run login again. A login picks no factory. Run outerlayer init in a repository next. It runs connect, which chooses one. What a login can do:
  • The login acts with your role on the factory a command names. After a role change, the login has the new permissions within about five minutes.
  • A login cannot create or revoke factory keys, change members, roles, billing or single sign-on, or delete a factory.
  • A second login on the same machine revokes the token it replaces.
  • To see or revoke every machine signed in to your account, open Security on your profile (/profile/security). The CLI logins list has a Revoke button for each.
  • A factory key wins over a login, so CI and runners keep acting as their key. A runner’s key is the exception: with a login saved, every command except the runner uses the login. See Credential resolution.

Sign in from an agent or a script

When stdout is not a terminal, login does not wait. It prints one JSON document and exits 75:
Give the url to the person. Run the command in check until it stops exiting 75. It then exits 0 when the person approved, or 1.

Save a factory key

Pipe a factory key on stdin. Use this in CI and on runners.
login saves the key as apiKey. It never takes the key as a flag and never prints it.
  • login reads stdin to the end, so a secret manager that asks for a password first works.
  • A pipe that sends nothing for 30 seconds counts as nothing piped, and login starts a browser login.
  • login does not send the key anywhere. The first command that calls OuterLayer proves it.
See also: Quickstart, API keys, What leaves your machine, Troubleshoot the CLI.

outerlayer connect

Choose the factory this repository’s work goes to.
Run it in a repository after login. outerlayer init runs it for you. With a login, it takes the first rule that gives one answer:
  1. --factory.
  2. The repository’s saved connection, while you can still use that factory.
  3. The one factory the repository is linked to.
  4. The factory that appId in the config file names. When several factories are linked to the repository, it counts only if it is one of them.
  5. The factory that owns the repository. Among the factories of one organization that link it, that is the factory with the oldest link.
  6. The one factory you can use.
  7. On a terminal, it asks. With no terminal, it exits 1 and lists each factory with the --factory value to pass.
connect prints what it chose, why, and how to change it. connect never links a repository. When the repository is not linked to the chosen factory, connect saves the connection and exits 2. It prints where to link the repository:
If connect cannot check the link, it says so and exits 0. A connect that succeeds can end with a line that tells you to commit and push. It does so when .outerlayer/, AGENTS.md, .agents/, .mcp.json or .claude/skills holds a change that is not committed. The judges apply to a pull request only once they are on its base branch.

With a factory key

The key decides the factory. connect changes nothing, makes no network call and exits 0. A --factory value that names another factory exits 1.

Where the connection is stored

connect saves the connection in the repository’s git directory, at outerlayer/connection.json. Every worktree of the clone shares it, and git never commits it. Two repositories on one machine can go to two factories. Credential resolution says what overrides the connection.

Automatic connection

These commands connect automatically when exactly one factory fits:
  • outerlayer work build, work list, work status, work remove and work pr
  • outerlayer emit artifact, emit criteria, emit demo, emit finding, emit findings and emit step
  • outerlayer findings show and findings result
  • outerlayer spec target, spec search, spec file and spec edit
  • outerlayer context show
They connect when all three hold:
  • You are logged in.
  • The repository has no saved connection.
  • Exactly one factory fits by rules 2 to 6 above.
They never ask. They save the connection, print one line on stderr and carry on:
They do not check the link, and they never link a repository. outerlayer doctor reports a missing link. When more than one factory fits, they refuse and list each factory with the --factory value to pass to outerlayer connect. A command given --repo, such as work build --repo acme/app, chooses the factory by the links of the repository it names. It saves the connection for the checkout you ran it from. No other command connects on its own. With a login, run outerlayer connect before the other work commands, sync, outerlayer daemon and mcp serve. See also: Quickstart, Connect a repository, outerlayer init, Troubleshoot the CLI.

outerlayer logout

Revoke this machine’s login and remove it.
logout deletes accountToken and dashboard from the config file. It keeps a factory key (apiKey), its appId and every repository’s saved connection. See also: What leaves your machine.

outerlayer sync

Upload the sessions that you started with OUTERLAYER_WORK set. Each run sends only what is new since the last one.
sync also uploads the artifacts outerlayer emit artifact queued inside a session. It prints one line for each, with its file name, caption and link:
A sync prints the link only on the run that uploads the artifact, and a background sync can upload it first. To print the link of an artifact that is already uploaded, run outerlayer sync --link <artifact id> with the id that emit artifact printed. The gateway limits how many session requests one caller sends each minute. See Rate limits. When sync reaches the limit, it prints how many seconds it waits. Then it sends the same batch again, up to 6 attempts. If every attempt fails, sync exits 1 with an error that names the rate limit. Run outerlayer sync again later. The next run sends every session that did not upload. The background process that sends the new turns of a running session waits and sends again in the same way. The summary line counts the sessions uploaded and skipped, with the reason:

Background sync

The hooks that init installs start sync --quiet after an agent turn and at session end, at most once every five minutes. They need a saved gateway address and a credential. A factory key needs its factory id. A login needs the repository’s saved connection from connect or init. Set "autoSync": false in the config file to stop the background sync.

JSON output of sync

With --json, sync prints one document: Each entry of uploadedArtifacts has artifactId (the id that emit artifact printed), filename, caption, id (the server’s id) and url. url is null when the gateway returned no link. See also: Debug a build in your own session, What leaves your machine, Troubleshoot the CLI.