Codex
What a Codex session materialises, the trust Codex needs before it runs the guard, and how a session starts there.
Setup is harness-agnostic — see the quickstart for creating a hall and opening your first session. This page covers what is specific to Codex once you're there.
For the end-to-end flow with this harness across repos, see Use Codex with multiple repositories.
What ivar sync writes
A Codex hall carries its config at the hall root, and its skills under
.agents/skills:
.codex/config.tomlis Codex's project config — model, sandbox — andivarowns only the[mcp_servers.<hall>-<name>]tables it marks with a# managed by ivar (hall: <hall>)comment. Your own keys, comments and servers survive every sync. See MCP servers..codex/hooks.jsoncarries the hooks.ivarowns the handlers whose command it wrote and leaves yours alone..agents/skills/carries every skill from both roots — the hall's committed skills and your personal ones — materialised under its bare id. It is gitignored because each child is a derived symlink back into.ivar/. It is not.codex/skills, which is Codex's own system-skill cache.AGENTS.mdis the provider-native instructions file Codex reads at startup.
Codex has no project-level slash commands: it reads custom prompts only from
$CODEX_HOME/prompts, a directory every hall on the machine shares. ivar
writes no /ivar-* commands for Codex, so its workflows reach it as skills.
Start a session
ivar session start --provider codexThis launches codex in the session's view directory. To continue the last
Codex conversation, ivar session start --resume runs codex resume --last.
Trust Codex before the first session
Codex loads a project's .codex/ only when it trusts the project, and it
starts without the guard and says nothing when it does not. So ivar session start checks first and refuses to launch when:
- Codex does not trust the hall root. Run
codexin the hall once and trust the folder when it asks. - The guard hook is missing from
.codex/hooks.json. Runivar sync. - Codex has not trusted the guard hook as it is now. Review and trust it in
Codex. A hook's trust lapses when
ivarchanges the guard hook, so repeat this after anivarupgrade that rewrites it. - A
.codex/config.tomlor.codex/hooks.jsonsits in a directory between the session and the hall root. Codex would load it over the hall's own config, outside the guard.
IVAR_CODEX_BYPASS_HOOK_TRUST=1 makes ivar session start pass
--dangerously-bypass-hook-trust to Codex. That skips Codex's hook review for
every hook, yours and any that arrive with a cloned hall repo, so it is
opt-in. It does not skip the project trust.
The guard
The read-only guard for repos you haven't promoted is a PreToolUse hook in
.codex/hooks.json that runs ivar guard --provider codex before each tool
call. A denial is a JSON verdict with permissionDecision: "deny" and a
reason, which Codex shows the model as a blocked call. Codex reads
.codex/config.toml and hooks.json from every directory between its working
directory and the project root, so the guard also denies writes to those names
anywhere but a promoted worktree, and the session's own .codex/ is read-only.
See Guards.
Memory hooks
ivar sync also writes the memory hooks into .codex/hooks.json:
ivar memory brief --provider codex on SessionStart, and, while capture is
on, ivar memory capture --provider codex on SessionStart,
UserPromptSubmit, PostToolUse and SessionEnd.
When memory.capture is false in ivar.json, ivar sync writes no
capture hook; while capture is on, ivar doctor reports a missing one as
provider.capture_hook_missing. See Hall memory.
Add it to an existing hall
The quickstart covers ivar init. If
the hall already exists with a different provider, add Codex alongside it:
You: Add Codex to this hall alongside the current provider.
Bash(ivar provider add codex)
Agent: Codex is registered, with its config and skills materialised.
Run it by hand
ivar provider add codexWhere ivar-explore comes from
It is a skill materialised into .agents/skills/ivar-explore/, so Codex loads
it from your request; there is no slash command to type.
You: I want to understand how billing works before we change it.
Bash(ivar session start)
Agent: I'm in a discovery session: every repo is mounted read-only on its default branch.