# "Quickstart: Codex"

Install the dsail package, register DSAIL once for Codex CLI, the IDE extension and the ChatGPT desktop app, and let Codex compile and check a policy from the repository — over MCP locally, over REST in a cloud task.

For Codex in a repository. Turn a written policy into rules a program can check; the rules live in the repo and every check runs on the hosted service.

## 1. Install and register

```bash
pip install dsail
dsail init
```

`dsail init` writes, idempotently: the DSAIL skill at `.agents/skills/dsail/SKILL.md`
(the path Codex reads; the same bytes go to `.claude/skills/dsail/SKILL.md` for
Claude Code), a marked `[mcp_servers.dsail]` table in `.codex/config.toml`
launching the stdio proxy `dsail mcp`, the `.mcp.json` entry, and a stanza in
`AGENTS.md`. Commit them.

Then register the server once. Codex CLI, the Codex IDE extension and the
ChatGPT desktop app share one MCP configuration, so this makes it visible in
all three; a project-level table alone may not be read:

```bash
codex mcp add dsail -- "$(command -v dsail)" mcp
```

(`dsail init` prints this line with the absolute path filled in. The absolute
path matters: Codex may spawn the server without your shell's PATH.) Check
with `/mcp` inside Codex: `dsail` should list ten `dsail_*` tools plus
`dsail_open_review`.

Or install the **Codex plugin**, one installable carrying the skill and the
MCP server. The public package repository is a Codex marketplace:

```bash
codex plugin marketplace add https://github.com/JaxonAI/dsail
```

Then `/plugins` in Codex and install **DSAIL**. The same plugin is also
installable from a checkout or a bundle you build yourself
(`dsail plugin-bundle dist/plugin-bundle`, then `codex plugin marketplace add
"$PWD/dist/plugin-bundle"`).

## 2. One command

```bash
codex "Encode our records-retention policy as rules a program can check: \
       customer files are kept seven years after account closure, and nothing \
       tagged legal-hold is deleted."
```

Codex reads the stanza and the skill, follows the authoring sequence — English
summary, your confirmation, then DSAIL — and compiles through the `dsail_compile`
tool. An evaluation credential is obtained automatically on the first call.

## 3. A result

```bash
dsail check policies/retention.dsail --claims claims.json --summary
```

```text
kept_seven_years   TRUE
legal_hold_kept    UNKNOWN   (legal_hold submitted as unknown)
```

The second line is the point: a fact the document did not settle is reported
as `UNKNOWN`, not guessed either way. Unknown is an answer, not a guess.

## Codex cloud tasks: no MCP layer, REST only

A Codex cloud task has no MCP layer at all — not a reduced one. There the
package's REST path carries the whole workflow: `dsail compile`, `dsail check`,
`dsail prompt-pack`, and `dsail.Client` in code, all the same operations on the
same hosted engine with the same results. The agent has no tool list to notice
DSAIL in, so the `AGENTS.md` stanza and the skill `dsail init` wrote are its
whole discovery; both say outright that the CLI and the client are the intended
path when no `dsail_*` tool is listed.

Two things the environment needs, both one-time, both in the environment's
settings (**Codex → Environments → Edit → Agent internet access**):

- the DSAIL API domain (`agents.jaxon.ai`) on the domain allowlist, with HTTP
  methods unrestricted — a check is a `POST`;
- `pip install dsail` in the setup script, which has internet access during
  setup; otherwise allow `pypi.org` and `files.pythonhosted.org` too.

If the domain is not allowlisted, the first call fails with a message that
names exactly that fix — and only that fix. The package detects Codex from the
environment it runs in (`CODEX_*` variables) and does not describe Claude
Code's connector or workspace allowlist there; `DSAIL_AGENT_ENV=codex` forces
the choice if detection cannot. Relay the message verbatim.

## Notes specific to Codex

- Codex CLI runs shell commands in a sandbox with no network, so `dsail
  compile` from the agent's shell fails on DNS while the `dsail_*` MCP tools,
  which Codex runs outside the sandbox, succeed. The failure text says so and
  points at the tools; an agent should prefer them whenever they are listed.
  Running the CLI yourself in a terminal is unaffected.
- Codex does not render MCP Apps. When the ruleset is ready, the agent calls
  `dsail_open_review`: the proxy starts the review UI on your machine, opens
  your browser, and the agent repeats the link. It is the same review
  component the chat clients render, and Approve there is recorded on the
  service against the exact hash, including for a ruleset created in claude.ai
  (`name`). The same page as a command is `dsail serve policies/retention.dsail`.
- The same ruleset and claim dictionary answer identical bytes through the
  proxy (Claude Code) and over REST (a Codex cloud task): payloads are pure
  over their inputs.

## Sharing with colleagues

Saved rulesets belong to a workspace — yours, plus one per team you are in.
`dsail team create`, `dsail team invite <team-id> <email>` (a single-use link
you pass on yourself, since the service sends no mail), and `dsail copy <name>
--to <team>` to put existing work into one. `dsail workspaces` says where you
are.

Anything about who is in a team needs a signed-in person rather than a stored
credential, so run `dsail login` once — one browser round trip, and your API key
is untouched, since that is what the programs you write should keep carrying. A
call refused for this reason names the command. Full walkthrough: [share policy
rulesets with colleagues](../guides/share-rulesets-with-colleagues.md).

Every error carries a `docs` URL ([Errors](../reference/errors.md)). Next:
[Quickstart: REST](rest.md).
