This guide deploys the highest-priority AI SAFE2 controls for Codex with the current Codex runtime surface.
Default deployment mode: wrapper-first.
Do not start by replacing your live global ~/.codex/config.toml unless you are explicitly testing global integration on a non-production machine.
codex --version
where.exe codex
Get-Command codex | Format-List Source,Version
If codex resolves from more than one location, treat that as inventory drift and audit before continuing.
Install the external monitoring sink:
New-Item -ItemType Directory -Force -Path "$HOME\\.codex" | Out-Null
New-Item -ItemType Directory -Force -Path "$HOME\\.codex\\monitoring" | Out-Null
Copy-Item ".\\monitoring\\codex-notify.ps1" "$HOME\\.codex\\monitoring\\codex-notify.ps1" -Force
Install the project governance files into the repo you want to protect:
Copy-Item ".\\AGENTS.md" "C:\\path\\to\\your-project\\AGENTS.md" -Force
Copy-Item ".\\IDENTITY.md" "C:\\path\\to\\your-project\\IDENTITY.md" -Force
Copy-Item ".\\SOUL.md" "C:\\path\\to\\your-project\\SOUL.md" -Force
Copy-Item ".\\USER.md" "C:\\path\\to\\your-project\\USER.md" -Force
Copy-Item ".\\TOOLS.md" "C:\\path\\to\\your-project\\TOOLS.md" -Force
Copy-Item ".\\SUBAGENT-POLICY.md" "C:\\path\\to\\your-project\\SUBAGENT-POLICY.md" -Force
Copy-Item ".\\EVALUATION.md" "C:\\path\\to\\your-project\\EVALUATION.md" -Force
This is the project-local governance layer. It does not replace sandboxing or approvals; it shapes behavior and gives reviewers concrete artifacts to inspect.
On Windows, do not assume codex resolves from PATH.
& "C:\Users\CyberStrategy1\AppData\Local\OpenAI\Codex\bin\codex.exe" --version
If that path differs on your machine, update the wrapper or use the detected path from:
Get-ChildItem "$env:LOCALAPPDATA\OpenAI\Codex\bin"
Do not launch high-trust sessions with raw codex when you want sovereign runtime controls. Use the wrapper:
.\\scripts\\codex-jit-wrapper.ps1
Optional:
.\\scripts\\codex-jit-wrapper.ps1 -Profile strict
.\\scripts\\codex-jit-wrapper.ps1 -SessionTimeoutSeconds 3600
.\\scripts\\codex-jit-wrapper.ps1 -AdditionalArgs @("--search")
The wrapper blocks dangerous startup flags, creates session logs, enforces a timeout, and injects a notification sink for external evidence.
Current Windows note: timeout enforcement may be disabled in favor of stable launch behavior. Use session review and CI gates as the stronger enforcement layer for now.
.\\scripts\\audit-codex-install.ps1
.\\scripts\\scan-dangerous-config.ps1
These scripts identify:
Run a short Codex session through the wrapper, exit, then summarize the session:
.\\monitoring\\summarize-session.ps1
Expected outputs:
%USERPROFILE%\\.codex\\logs.codex-runtime-logs in the workspace| Control | What It Does |
|---|---|
Governance files (IDENTITY.md, SOUL.md, AGENTS.md, USER.md, TOOLS.md, SUBAGENT-POLICY.md) |
Define identity, constraints, tool surface, user data handling, and delegation rules |
codex-jit-wrapper.ps1 |
Blocks dangerous launch flags, enforces approval/sandbox mode, injects notification logging |
audit-codex-install.ps1 |
Inventories binaries, aliases, configs, and MCP surfaces |
scan-dangerous-config.ps1 |
Flags unsafe approvals, sandbox modes, and config overrides |
codex-notify.ps1 |
Captures external completion metadata for audit evidence |
EVALUATION.md |
Defines the verification model and known platform caveats |
If you suspect a Codex session operated unsafely:
Get-Process codex -ErrorAction SilentlyContinue | Stop-Process -Force
.\\scripts\\audit-codex-install.ps1
.\\scripts\\scan-dangerous-config.ps1
.\\monitoring\\summarize-session.ps1
Then:
%USERPROFILE%\\.codex\\logsIf you explicitly want to test global Codex config integration, use files in managed-settings/, but treat that as advanced deployment. Validate on a non-production machine first.
This quickstart documents the v2 wrapper-first deployment model.