Cli Safe Flags + Codex Collector
Enforce Cli Safe Flags using data collected by Codex Collector. Automatically check devex build and ci standards on every PR.
How Codex Collector Powers This Guardrail
The Codex Collector gathers metadata from your systems. This data flows into Lunar's Component JSON, where the Cli Safe Flags guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the Codex Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/codex@v1.0.5
# with: ...
# Step 2: Enable the Codex Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/codex@v1.0.5
include: [cli-safe-flags]
# with: ...
What Codex Collector Collects
This collector gathers the following data that the Cli Safe Flags guardrail evaluates.
instruction-file
cicd
Detects OpenAI Codex CLI invocations in CI pipelines. Records the command string and version for policy-level flag analysis (dangerous flags, sandbox mode, approval mode).
Example Data Flow
Here's an example of the data that Codex Collector writes to the Component JSON, which Cli Safe Flags then evaluates.
{
"ai": {
"instructions": {
"all": [
{
"path": "CODEX.md",
"dir": ".",
"filename": "CODEX.md",
"lines": 60,
"bytes": 2400,
"is_symlink": false,
"symlink_target": null
}
]
},
"native": {
"codex": {
"instruction_file": {
"exists": true,
"path": "CODEX.md",
"lines": 60,
"bytes": 2400,
"is_symlink": false,
"symlink_target": null
},
"cicd": {
"cmds": [
{
"cmd": "codex exec --json 'review this PR'",
"tool": "codex",
"version": "0.1.0"
}
]
}
}
}
}
}
Configuration Options
Codex Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
dangerous_flags |
Optional |
--dangerously-bypass-approvals-and-sandbox,--yolo,--full-auto
|
Comma-separated dangerous flags for Codex CLI |
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 200+ built-in guardrails.