Skip to content

perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28

Closed

Description

@thehoff

Empirical baseline

Today's codex job logs (~/.claude/plugins/data/codex-openai-codex/state/.../jobs/*.log) yielded a precise compliance measurement:

Window shell calls contextcrawler-prefixed compliance
Pre-#9 (before AGENTS.md hardening, < 04:25 UTC) 42 0 0%
Post-#9 (after hardening, ≥ 04:25 UTC) 261 209 80%

PR #10 / issue #9 took codex from 0 → 80% by replacing the advisory wording with MUST + WRONG/RIGHT examples. The remaining 20% gap is the highest-ROI lever left for codex's effective gain (currently 80% × 35% ≈ 28% effective; lifting to 95% adoption → ~33% effective).

What slips past (sampled from today's unwrapped 52 calls)

Three patterns dominate:

  1. rg -n "..." direct — ripgrep IS in AGENTS.md's apply-to list but NOT shown in the WRONG/RIGHT examples; low salience
  2. git -C /path status|log|diff — codex uses git -C <dir> to avoid cd. AGENTS.md examples show bare git status-style; the -C form doesn't trigger pattern-match
  3. nl -ba file | sed -n '1,80p' — code reading via shell pipes. Should arguably go through contextcrawler read --max-lines N but no example demonstrates that mapping

Proposed AGENTS.md template additions

Add to the WRONG/RIGHT block in hooks/codex/rtk-awareness.md:

- WRONG: rg -n pat src/             RIGHT: contextcrawler grep -n pat src/
- WRONG: git -C dir status          RIGHT: contextcrawler git -C dir status
- WRONG: nl -ba file | sed -n …     RIGHT: contextcrawler read --max-lines N file

(Plain contextcrawler everywhere — no upstream brand naming.)

"Is it actually hitting" — the empirical verification this issue must include

Documentation alone doesn't count as a fix. The PR must ship a way to keep measuring compliance over time so future templates can be evaluated the same way:

  1. Compliance measurement script (suggested at scripts/codex-compliance.sh or as a contextcrawler subcommand). Inputs: codex job logs dir + optional time window. Outputs: total / wrapped / compliance %, plus a sample of unwrapped commands for inspection. Usable as contextcrawler codex-compliance --since '2026-05-18 04:25'.

  2. A snapshot test comparing the new template's compliance against the old, run against a synthetic codex transcript fixture — to catch regressions in future AGENTS.md edits before they reach users.

  3. PR success criterion: re-run the measurement after deploying the new template, confirm compliance climbs from 80% baseline to ≥95% on a fresh codex review run before this PR is mergeable.

The measurement script is the actual deliverable — the template tweak is cheap, the discipline of "test it lands" is the durable improvement.

Out of scope

  • The 5% residual leak after the template update (probably edge cases like ad-hoc one-shot tools awk, jq, etc. that don't deserve enumeration). Acceptable.
  • Moving codex to a hook-based interception (would close the gap to ~100% like the Claude harness) — that's a much bigger architectural change tracked separately if pursued.

Test plan

  • Add the three new WRONG/RIGHT examples to hooks/codex/rtk-awareness.md
  • Ship the compliance measurement (script or subcommand)
  • Snapshot-test the template against a synthetic codex-log fixture
  • Deploy the new template (contextcrawler init -g --codex), run a real codex review/rescue, measure compliance, confirm ≥95%
  • If <95%, iterate on examples until the empirical bar is met

Activity

  1. thehoff commented on Jun 10, 2026

    @thehoff
    OwnerAuthor

    Closing — codex-compliance push (80→95%) not on the near-term roadmap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions