rulesync icon indicating copy to clipboard operation
rulesync copied to clipboard

generate --check for codexcli rules fails when another target owns AGENTS.md

Open jitendravyas opened this issue 5 months ago • 0 comments

Problem

When two targets both emit the root AGENTS.md rule file, rulesync generate --check for one target can fail even when that target's non-root outputs (for example .codex/memories/*.md) are already up to date.

We use target order so one IDE target (last in config) owns AGENTS.md. Codex topic rules live under .codex/memories/. Full rulesync generate works. A split verify for Codex rules alone does not.

Example setup

{
    "targets": {
        "claudecode": ["rules", "ignore", "mcp", "skills", "subagents", "permissions"],
        "cursor": ["rules", "ignore", "mcp", "skills", "subagents"],
        "agentsskills": ["skills"],
        "codexcli": ["rules", "mcp", "subagents"],
        "devin": ["rules", "ignore", "mcp", "skills"],
        "antigravity-ide": ["rules", "mcp"]
    },
    "delete": true,
    "gitignoreTargetsOnly": true
}
  • Root overview.md has root: true, targets: ["*"].
  • antigravity-ide is last so it wins AGENTS.md (per target-order docs).
  • Codex non-root rules go to .codex/memories/.

Reproduction

  1. Run full generate (succeeds):

    rulesync generate
    
  2. Confirm .codex/memories/*.md exists and looks correct.

  3. Run check for Codex rules only (fails):

    rulesync generate --check -t codexcli -f rules
    

Actual output (example):

[DRY RUN] Would write: AGENTS.md
[DRY RUN] Would write 1 rule
    AGENTS.md
Files are not up to date. Run 'rulesync generate' to update.

Exit code: 1

Expected (one of):

  • Check passes when .codex/memories/ is up to date, even if on-disk AGENTS.md matches another target's root output, or
  • A flag to verify non-root outputs only for a target, or
  • A built-in verify command that understands shared files and target order.

Why this hurts

We split verify to avoid other target conflicts:

rulesync generate --check -t claudecode,cursor,devin,antigravity-ide \
  && rulesync generate --check -t agentsskills -f skills \
  && rulesync generate --check -t codexcli -f mcp,subagents

We cannot add rules to the codexcli check without it failing on AGENTS.md, so .codex/memories/ drift is not caught by rulesync's built-in check.

Current workaround

A small custom script that:

  1. Runs rulesync generate -o <temp-dir> -t codexcli -f rules
  2. Compares only <temp-dir>/.codex/memories/*.md to the local .codex/memories/
  3. Ignores AGENTS.md

This works but is easy to get wrong and should not be required in every multi-target repo.

Suggested solutions

Any of these would help:

  1. --check scope — verify only non-root rule outputs for a target.
  2. Shared-file-aware verify — when multiple targets write the same path, respect target order / "owner" and do not fail other targets' checks.
  3. rulesync verify — documented or built-in multi-target verify for repos using agentsskills, antigravity-ide, codexcli, etc.
  4. Docs — official recipe for "one target owns AGENTS.md, Codex memories verified separately".

Environment

  • rulesync: 8.29.0
  • Node: 24.x
  • OS: macOS
  • Repo: multi-target setup; generated AI tool outputs gitignored (gitignoreTargetsOnly: true)

jitendravyas avatar Jun 16 '26 08:06 jitendravyas