Skip to content

codexRig commands

The lifecycle

CommandWhat it does
codexrig initWrite the config, pick a private remote, install the hooks.
codexrig syncCapture this machine's Codex setup and push it.
codexrig pullBring down what another machine synced.
codexrig restoreWrite the synced setup onto this machine.
codexrig statusWhere this machine stands. --json for scripts.
codexrig doctorCheck it is actually working. --fix repairs what it can.

sync takes --dry-run to capture without publishing, --hook to mark a hook-driven run (which debounces, and never blocks), and --flush to capture the rollout named on stdin immediately.

restore takes --dir to unpack somewhere harmless first, --force to write over an established machine without asking, and --prune to remove skills, prompts and rules that were deleted elsewhere.

Accounts

CommandWhat it does
codexrig account addTrack the login you are signed in as.
codexrig account listWhat is tracked, and which is live. --json.
codexrig account run [ref]Start Codex under one account, in its own home.
codexrig account prepare [ref]Ready that home and print its path, without launching.
codexrig account switch [ref]Change which login plain codex uses.
codexrig account alias <ref> <name>Give an account a short name.
codexrig account disable <ref> / enable <ref>Hold it out of automatic selection, and put it back.
codexrig account remove <ref>Forget an account and delete its isolated home. Does not log it out.
codexrig account purgeForget every account. Does not log any of them out.
codexrig account doctorCheck the live login and codexrig's record agree.
codexrig account sessionsWhich Codex processes are running.
codexrig account map [ref] [dir]Bind a directory to an account.
codexrig account unmap [dir]Remove that binding.

A bound directory answers a bare reference, and the nearest binding wins — so one binding on a repository covers every worktree under it. With several accounts and no binding, the refusal is unmapped-directory, which is something a launcher can act on rather than a generic failure.

prepare is the machine-readable half of run: stdout carries the directory and nothing else, so it can be captured directly.

sh
CODEX_HOME=$(codexrig account prepare work) codex

With --json it emits one object including a stable reason when it refuses, so another program can tell "no such account" from "that account cannot authenticate".

Hooks

CommandWhat it does
codexrig global installThe backup hooks, in your own Codex home.
codexrig global trustRecord them as trusted, so Codex runs them.
codexrig global statusInstalled? Up to date? Trusted?
codexrig project installThe branch guard, in this repository's .codex/.
codexrig project trustSame, for the repository's hooks.

Install and trust are separate because they are different acts: one writes a file, the other tells Codex to trust a file. trust asks Codex for the hash rather than computing one, and makes the edit through Codex so config.toml keeps its own formatting.

Sessions

CommandWhat it does
codexrig recent [text]What you were working on lately.
codexrig search <text>Find a session by what was said in it.
codexrig ledgerWhat is remembered, including sessions that have aged out.
codexrig peek listSessions in the repo, whichever machine put them there.
codexrig peek show <id>Print one, straight from the git object store.
codexrig peek get <id>Copy one onto this machine so codex resume can open it.

recent and search take --since, --until, --cwd, --limit, --live, --repo and --json. A session found only in the backup says so: codex resume reads your own Codex home, so it has to be restored first — peek get is the quick way to bring one across without restoring anything else.

A session whose rollout has aged out of the retention window is still listed, marked as remembered rather than resumable, with the git log command that recovers its body from history.

Configuration

KeyMeaning
remoteThe private git repo this machine syncs to.
syncSessionsCarry session rollouts as well as configuration.
redactTranscriptsScrub credential-shaped tokens out of staged rollouts.
chunkRolloutsStore a large rollout as parts, so an append costs a chunk not a copy.
autoRestoreRestore automatically on a machine with no Codex setup.
alwaysPruneMake restore prune by default.
hookIntervalMinutesHow long a hook-driven sync waits before working again.
sh
codexrig config get
codexrig config set syncSessions true
codexrig config edit

The rest

CommandWhat it does
codexrig repo statusWhat the backup holds, by category and size.
codexrig repo gcRepack the history. Loses nothing, usually reclaims a lot.
codexrig device listThe machines syncing into this repo.
codexrig device forget <name>Drop a machine's entry. Its files stay.
codexrig guide installWrite codexrig's blocks into AGENTS.md.
codexrig mcp listWhich MCP servers survive a restore, and what each needs.
codexrig mcp get <name>One server in full. --json emits the same object list --json uses per server — name, transport, enabled, target (credentials redacted), envKeys (names only, never values), portability — and a missing name yields one {"found":false,…} object with a non-zero exit.
codexrig uiThe interactive dashboard, which a bare codexrig opens.
codexrig guardThe PreToolUse hook. Codex calls it; you do not.

Released under the MIT License.