Repository navigation
Description
Measurement-first context
Post-v0.1.8 measurement (2026-05-18 ~19:00 local) on
~/Library/Application Support/rtk/history.db and
~/.claude/plugins/data/codex-openai-codex/state/*/jobs/*.log:
| Metric | Baseline (pre-v0.1.8) | Now | Δ |
|---|---|---|---|
| Global savings (24h) | 24.8% | 70.6% | +45.8pp |
| Codex compliance | 80.0% | 84.3% | +4.3pp |
84.3% compliance = 503 wrapped / 597 total commands across 21 recent codex review job logs. 94 raw commands cluster into 3 patterns that AGENTS.md doesn't currently cover.
The 3 gap patterns
nl -ba <path> | sed -n 'A,Bp'— ~35 calls. Codex's "read with line numbers + range" pattern. Composed pipe defeats thecontextcrawlerprefix rule because codex treats the whole pipe as one shell composition.git -C <project-dir> ...— ~25 calls. Codex uses-Cfor cross-directory git ops; treats it as "different" from plain git.rg -n ...— ~11 calls. Short form not represented in current RIGHT examples.
Scope (single PR, four commits)
1. contextcrawler discover --codex
Add codex log scanner that mirrors the existing Claude discover output: total commands, wrapped %, raw % bucketed by pattern. Reads ~/.claude/plugins/data/codex-openai-codex/state/*/jobs/*.log. Ships the measurement alongside the fix per the project's metrics-before-claims rule.
2. AGENTS.md WRONG/RIGHT additions
Strengthen hooks/codex/rtk-awareness.md with explicit pairs:
nl -baandnl -ba file | sed -n→contextcrawler read -n <path>(orcontextcrawler proxy nl -ba ... | contextcrawler proxy sed ...if range matters)git -C <path> <subcmd>→contextcrawler git -C <path> <subcmd>rg -n pattern→contextcrawler rg -n pattern(explicit short-form example)
3. Proxy bypass nudge
When contextcrawler proxy <wrapped-tool> is invoked (sed/nl/grep/awk/rg/find/cat/head/tail/ls/wc — i.e. tools we have a wrapper for), emit a one-line stderr note pointing at the wrapped equivalent. Don't auto-rewrite — measure adoption first, then upgrade to auto-rewrite in a follow-up if the nudge isn't enough.
Background: proxy is now the #1 token leak — 307K input @ 0% savings on 394 calls/24h. The biggest source is codex using proxy sed/proxy nl for the read-with-line-numbers pattern.
4. Pinning regression test
codex_template_contains_gap_patterns — fails if any of the three gap patterns (nl -ba, git -C, rg -n) disappears from the template.
Success criteria (measure before close)
cargo testgreen- After PR merges + deploy + 24h of codex use: re-measure compliance via
contextcrawler discover --codexand confirm ≥95% (target +10.7pp from current 84.3%) - After 24h: re-measure
proxyrow in dashboard and confirm the absolute token leak shrinks (success even if % stays 0% — the volume is what matters)
Deferred (not in this PR)
contextcrawler read --range A,B[;C,D]to fully replacenl|sedcomposed pipes (codex composes multi-range selectors — non-trivial)- Auto-rewrite (vs. nudge-only) for proxy-wraps-wrapped-tool — unlock once nudge adoption is measured
Trace
- Measurement memory: contextcrawler-state-2026-05-18-post-v0_1_8 (local memory file)
- Discipline: feedback-metrics-before-claims (measurement ships with fix, no claim without a number)
- Parent: perf(codex): lift codex compliance from 80% → 95%+ — add missing patterns to AGENTS.md template + ship a compliance measurement #28 (codex compliance lift); this PR is the first concrete attack on the gap
Activity
review: address 4 pre-PR findings on #53
Merge pull request #54 from thehoff/feat/codex-compliance-gap-53
feat(codex): discover --codex + AGENTS.md gap patterns + proxy nudge (t…