Skip to content

feat(agents): bridge the skills and CLAUDE.md to Codex, and say what cannot be bridged - #822

Merged
athvin merged 2 commits into
mainfrom
bm/setup-for-codex
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
bm/setup-for-codex

Conversation

@athvin

@athvin athvin commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #823

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Makes this repo's agent configuration readable by Codex — Kimi K3 included,
since that is the same codex binary under --profile kimi. The 28 skills and
CLAUDE.md are still authored once and bridged by symlink
(.agents/skills/<name>, AGENTS.md), with agent-bridge-check failing a
missing or forked bridge in either direction. The one piece no symlink can carry
— the MCP servers — gets scripts/codex-mcp-sync.sh, which derives
codex mcp add from .mcp.json. Three .claude/settings.json pieces have no
repo-scoped equivalent at all and are now recorded as such rather than assumed.

Why

Codex reads .agents/skills/ and AGENTS.md, and reads neither
.claude/skills/ nor CLAUDE.md — probed, not inferred: CLAUDE.md appears
nowhere in the 0.167.0 binary. A second agent on this clone therefore started
with no project instructions and no project skills. The failure is silent in
whichever tool nobody is looking at, which is why the bridge is a gate rather
than a paragraph — and why it runs ungated, since a skills-only pull request is
exactly the shape detect skips.

Proof

make check green, including the new agent-bridge-check target. Both gates
were then observed failing on the real tree before being trusted:

$ mv AGENTS.md /tmp/ && bash scripts/ci/agent-bridge-check.sh
FAIL: missing bridge: AGENTS.md (Codex would start with no project instructions)
agent-bridge: FAILED (56 skill checks + the instruction bridge)   exit=1

$ mv .agents/skills/land-pr /tmp/ && bash scripts/ci/agent-bridge-check.sh
FAIL: missing bridge: .agents/skills/land-pr (Codex would not see this skill)
agent-bridge: FAILED (55 skill checks + the instruction bridge)   exit=1

End state measured from Codex's side with codex debug prompt-input, which
renders exactly what the model was given: skill root
r2 = <repo>/.agents/skills with all 28 skills listed, and an
agents_md.instructions block carrying CLAUDE.md through the symlink.
codex mcp list shows the aws server with --read-only and
--profile er-readonly intact.

Suites: agent-bridge-check-test.sh 15 cases, codex-mcp-sync-test.sh 15,
detect-paths-test.sh 39, skills-check-test.sh 16 — each mutation-tested, see
Context.

Risk & rollback

Risk is confined to the gate: a false failure blocks pull requests on a symlink
rather than on code. It is pure bash over the checked-out tree with no network
and no toolchain, and the two symlink sets it reads are the only thing it
touches. scripts/codex-mcp-sync.sh writes to $CODEX_HOME, never to the repo,
and is never run by CI.

Rollback: git revert <merge-sha>. The .agents/ symlinks and AGENTS.md
revert with it; a developer who has already run codex-mcp-sync.sh undoes it
with codex mcp remove aws.

Post-merge ledger

Closed by: agent · session c19a9a1f-4446-4d2f-bd7d-5ac2d0f08eca on brians-MacBook-Pro · 2026-11-08T00:18:00Z

  • main is green with this change on it — merge SHA 89e4df96, rust
    push run 42428830430:
    23 jobs, 250 steps, 19 success / 0 failure (4 skipped). The step count is
    there deliberately — a starved or cancelled run sums to 0 steps, and that
    is what distinguishes this from the zero-job green. frontend, infra
    and devcontainer also succeeded on the same SHA. The three new steps
    ran: agent config bridge symlinks (Codex discovery),
    agent-bridge regression tests, codex-mcp-sync derivation tests.
  • images — n/a — correctly never ran. scripts/ci/images-detect.sh
    keys on the ^rust/ and ^frontend/ trees plus images.yml itself; this
    merge touched .agents/, .claude/, AGENTS.md, CLAUDE.md, Makefile,
    scripts/ and rust.yml and none of those. gh run list --commit 89e4df96 --workflow images.yml returns [] — the workflow did not
    trigger at all, rather than running and skipping.
  • deploy — n/a — nothing to deploy. deploy fires on workflow_run
    after images, which did not run, so no deploy run exists on 89e4df96.
    Nothing in this change reaches a container: no Rust source, no frontend
    source, no entity, no chart, no Terraform.
  • the push-only surface no pull request can pre-test is green:
    drift scheduled run 2026-11-07T06:01 success, kind scheduled run
    2026-11-07T06:44 success. One thing there is red and is not this
    change: the push-triggered deploy on 70f31c54 at 2026-11-07T21:37,
    ~2h37m before this merge, which is the known deploy.yml push-trigger
    defect — deploy.yml's push trigger was a misdiagnosis — remove it and gate what it was protecting #661 and deploy.yml: a mixed infra/k8s + image-input commit always produces one spurious red deploy #817.
  • the board card reached Done through the automation: Make the repo work with Codex: bridge the skills and CLAUDE.md, and say what cannot be bridged #823 reads
    CLOSED / COMPLETED, its card reads Done, and the ClosedEvent's
    closer.__typename is PullRequest — so the merge closed it, not a
    hand edit to Status (which would have attributed the close to
    ProjectV2).
  • follow-ups are open: Codex truncates skill descriptions at ~670 chars — every routing tail is invisible there #825 (Codex truncates every skill
    description at ~670 chars, so the routing tails do not exist there — it
    asks for the Codex-side selection to be measured before 27 descriptions
    are rewritten) and No PreToolUse guard under Codex: aws-write-guard and permissions.deny do not port #826 (no PreToolUse guard and no per-command deny
    list under Codex, so aws/terraform/kubectl/helm writes are
    unguarded on that path). Both were filed before the merge, carry
    ci-backlog, and are on the board as Todo.
  • what was learned is written down: the agent-skills standard gained a
    "The Codex bridge" section carrying the probe command
    (codex debug prompt-input) and a table of what does not port with the
    measurement behind each row; CLAUDE.md gained the short version that
    Codex itself now reads; the add-a-skill checklist gained the symlink step.
    Two memories were written: codex-agent-config-bridge (Kimi is the same
    binary under --profile kimi; the hook gap is live and owned by No PreToolUse guard under Codex: aws-write-guard and permissions.deny do not port #826) and
    probe-controls-that-prove-nothing (the two probes in this work that
    looked conclusive and were not).

Specific to this change

  • The Codex side re-probed against the merged main, not against the
    branch — run from the primary checkout at 89e4df96:
    codex debug prompt-input reports root
    r2 = <repo>/.agents/skills with 28 skills listed, and an
    agents_md.instructions block of 27,419 bytes whose first line is
    # Working in this repo — i.e. CLAUDE.md arriving through the
    AGENTS.md symlink. project-board's description now reaches Codex at
    650 characters against 117 before the YAML fix; the remaining cut
    is Codex's own ~670 cap, which is Codex truncates skill descriptions at ~670 chars — every routing tail is invisible there #825.
  • .agents/skills is still exactly the skill set after the merge:
    bash scripts/ci/agent-bridge-check.sh on main at 89e4df96 →
    agent-bridge: OK (28 skills bridged, AGENTS.md -> CLAUDE.md), exit 0.
Context — plan, discoveries, measurements, files

Plan

  1. Bridge the 28 skills to .agents/skills/ and gate it (was already on the
    branch when this body was written)
  2. Bridge AGENTS.md → CLAUDE.md and extend the gate to cover it
  3. Derive the MCP registration from .mcp.json instead of restating it
  4. Fix the description YAML was truncating, and add the lint rule
  5. Record what does not port, with the probe that establishes each claim
  6. make check, then land

Discoveries

Everything here came from codex debug prompt-input or from a two-sided probe;
none of it is from documentation.

  • CLAUDE.md is invisible to Codex. The string does not occur in the
    0.167.0 binary. AGENTS.md does, and loads as an agents_md.instructions
    item — through a symlink, which is what makes authoring-once possible.
  • Claude Code reads AGENTS.md too ("Claude Code hardcodes CLAUDE.md /
    AGENTS.md discovery" is in its binary), so the obvious worry with this bridge
    is 25KB of instructions loaded twice. It does not happen: with both present
    and one a symlink to the other, Claude Code listed one path and the body
    appeared once. Worth stating because the first version of that probe named the
    marker string in its own prompt and so counted it twice — the prompt was the
    second occurrence.
  • A project .codex/config.toml is merged, but its mcp_servers is
    ignored.
    The merge is real: sandbox_mode = "read-only" set there changed
    the session's permissions block. The exception is not. Declaring a working
    stdio MCP server in the project file → the tool is absent; the identical
    server injected with -c → present. The first attempt at this probe used a
    bogus server command and concluded "no error, so it loaded" — Codex
    tolerates a failing MCP server silently, so the control said nothing either.
    That is the trap this repo already has a memory note for.
  • Registered at $CODEX_HOME, an MCP server does reach a --profile kimi
    session
    (asked the Kimi model directly, with a hermetic probe server), so
    one sync serves every profile. Kimi's profile turns out to be
    $CODEX_HOME/kimi.config.toml, and top-level config.toml keys layer under
    it — model_reasoning_effort = "max" showed through.
  • Project-level hooks do not exist. .codex/hooks.json and
    .agents/hooks.json were both placed with a marker-touching SessionStart
    hook; neither fired, only $CODEX_HOME/hooks.json did. Both path strings are
    in the binary — inside its Claude-Code migration reader, which is what makes
    them look repo-scoped. → No PreToolUse guard under Codex: aws-write-guard and permissions.deny do not port #826
  • Codex truncates every skill description at ~670 characters, word-boundary
    cut, against this repo's 1,024 cap. 27 of 28 are over it and what gets cut is
    the routing tail. → Codex truncates skill descriptions at ~670 chars — every routing tail is invisible there #825
  • project-board's description was 88% missing, in both tools. It contained
    project #2, and YAML ends an unquoted scalar at # — no parse error, no
    warning. 117 of 989 characters survived: every trigger phrase and all four
    routing clauses were in the discarded part. The gate could not see it because
    frontmatter_value reads the raw line, which is also why the
    description-budget table reported the full 991. Fixed, with
    desc_truncated_by_yaml_comment added to the lint so it cannot return.

Measurements

What Command Result
skills Codex can see codex debug prompt-input 28, root r2 = <repo>/.agents/skills
instructions Codex can see same agents_md.instructions, via the symlink
description truncation same, vs. the authored frontmatter listed 612–672 chars vs. authored 680–996; 27 of 28 cut
project-board before the fix yaml.safe_load on its frontmatter 117 of 989 chars
project-board after same 977 of 977, raw == parsed
project mcp_servers honoured? probe server declared in .codex/config.toml vs. -c absent vs. present
project hooks honoured? marker hook in .codex/hooks.json and .agents/hooks.json neither fired
MCP under --profile kimi probe server at $CODEX_HOME, asked the model present

Each suite was mutation-tested rather than trusted for going green. Breaking
codex-mcp-sync.sh's registered-nothing guard turned 15 passes into 14 + 1
failure; forwarding only the first argument turned it into 12 + 3, naming
--read-only as the lost flag — which is the whole reason that script derives
instead of restating.

Files

  • AGENTS.md, .agents/skills/* — the bridges (symlinks)
  • scripts/ci/agent-bridge-check.sh + -test.sh — renamed from
    skills-bridge-check*, now covering the instruction bridge too
  • scripts/codex-mcp-sync.sh, scripts/ci/codex-mcp-sync-test.sh — the MCP
    derivation and its 15 cases
  • scripts/skills-check.sh, scripts/ci/skills-check-test.sh — the
    YAML-comment rule and its discriminating test
  • scripts/ci/detect-paths.sh + -test.sh — AGENTS.md exempted, three cases
  • Makefile, .github/workflows/rust.yml — the new target and the two steps
  • CLAUDE.md, .claude/skills/skill-writer/references/agent-skills.md,
    .claude/skills/ci-and-supply-chain/SKILL.md — the record
  • .claude/skills/project-board/SKILL.md — the truncated description

@athvin athvin changed the title bm/setup-for-codex feat(agents): bridge the skills and CLAUDE.md to Codex, and say what cannot be bridged Nov 8, 2026
Codex reads `.agents/skills/` and `AGENTS.md`, and reads NEITHER
`.claude/skills/` nor `CLAUDE.md` — `CLAUDE.md` does not occur in the 0.167.0
binary at all. The skills bridge was already here; the instructions were not, so
a Codex session (Kimi K3 included — the same binary under `--profile kimi`)
started with 25KB of project conventions it could not see.

`AGENTS.md` is now a symlink to `CLAUDE.md`, and the bridge gate covers both
sides. Claude Code discovers `AGENTS.md` too, so the obvious hazard is loading
the instructions twice; probed, and it does not — one path listed, body once.

The gate is renamed `agent-bridge-check` because it is no longer only about
skills. It refuses a missing bridge in either direction, a dangling link, a link
that resolves elsewhere, a bridge forked into a real copy, and an INVERTED
instruction bridge — every reference in the repo names `CLAUDE.md`, so making
that one the symlink leaves the authored file as the one nothing points at. It
is now in `make check` as well as ungated in rust.yml's `skills` job: the way
this breaks is `mkdir`ing a skill and forgetting the other side, and finding
that out from a red required check after the push is the whole failure it
exists to make local.

The MCP servers cannot be bridged, and that is measured rather than assumed. A
project-level `.codex/config.toml` IS merged into the session — a `sandbox_mode`
set there takes effect — but its `mcp_servers` table is ignored: a working stdio
MCP server declared in the project file is absent from the session, and the
identical server injected with `-c` is present. So `scripts/codex-mcp-sync.sh`
derives `codex mcp add` from `.mcp.json` instead, which is what keeps
`--read-only` and `--profile er-readonly` from going missing in a retyped
invocation. Its suite forces every refusal, because a sync that passes over a
server quietly reads as "synced" with the tool absent.

Hooks and `permissions.deny` have no project-scoped equivalent at all: neither
`.codex/hooks.json` nor `.agents/hooks.json` fires from a project directory
(only `$CODEX_HOME`'s does — those path strings live in Codex's Claude-Code
migration reader, which is what makes them look repo-scoped). So under Codex
nothing intercepts an `aws`, `terraform`, `kubectl` or `helm` write. Recorded in
the agent-skills standard with the probe behind each claim, and owned by #826.

Found on the way, and fixed here because it is the same defect class: a ` #` in
a `description` ends the YAML scalar, silently. `project-board` carried
`project #2` and was being selected on 117 of its 989 characters — every trigger
phrase and all four routing clauses were in the discarded part, in Claude Code
as much as in Codex. The gate could not see it because `frontmatter_value` reads
the raw line, which is also why the description-budget table reported the full
991. Reworded, with `desc_truncated_by_yaml_comment` added to the lint and
driven from both sides so it cannot return.

Codex also truncates every description at ~670 characters, cutting exactly the
routing tails this repo's skill standard relies on; 27 of 28 are over it. That
one needs a measurement before 27 descriptions are rewritten, so it is #825.

Closes #823

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 89e4df9 into main Nov 8, 2026
43 checks passed
@athvin
athvin deleted the bm/setup-for-codex branch November 8, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the repo work with Codex: bridge the skills and CLAUDE.md, and say what cannot be bridged

2 participants