Hamburger Cross Icon
Cli Safe Flags
+
Codex Collector

Cli Safe Flags + Codex Collector

Guardrail Collector Experimental Devex Build And Ci

Enforce Cli Safe Flags using data collected by Codex Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Ensures Codex CLI invocations in CI do not use dangerous permission-bypassing flags. Flags like --full-auto remove safety guardrails that prevent the AI from executing arbitrary code without human approval.
Data Source: Detects OpenAI Codex CLI invocations in CI pipelines. Records command strings, versions, and flags for policy-level analysis. Writes to ai.native.codex under the unified ai.* namespace.

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.

1
Codex Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Cli Safe Flags Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# 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.

Collector code

instruction-file

Discovers CODEX.md instruction files across the repository. Records file path, line count, byte size, and whether it is a symlink to AGENTS.md. Writes to ai.native.codex.instruction_file and appends to ai.instructions.all[] for normalized cross-tool access.

Collector ci-after-command

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.

{ } component.json From Codex Collector
{
  "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.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo