Skip to content

fix(codexcli): fold non-root rules into root AGENTS.md instead of inert .codex/memories - #1979

Merged
dyoshikawa merged 1 commit into
mainfrom
resolve-issue-1765-codexcli-fold-nonroot-into-root
Jun 22, 2026
Merged

fix(codexcli): fold non-root rules into root AGENTS.md instead of inert .codex/memories#1979
dyoshikawa merged 1 commit into
mainfrom
resolve-issue-1765-codexcli-fold-nonroot-into-root

Conversation

@dyoshikawa-claw

Copy link
Copy Markdown
Collaborator

Summary

Codex CLI loads instructions only from the AGENTS.md family (root + hierarchical directory walk per the official docs). It does NOT scan .codex/memories/ for instruction files — that directory is Codex's separate SQLite-backed auto-memory system. Non-root rules written there were silently ignored.

Fix

Add foldsNonRootIntoRoot: true to the codexcli rule factory entry and remove the nonRoot path from CodexcliRule.getSettablePaths(), so non-root rule bodies are concatenated into the single root AGENTS.md by the RulesProcessor — same pattern as grokcli, warp, and deepagents.

Changes

  • Rewrite codexcli-rule.ts following the grokcli/warp pattern (root-only settable paths, both root and non-root rules target ./AGENTS.md)
  • Change ruleDiscoveryMode from 'toon' to 'auto' (no inert TOON references)
  • Update codexcli-rule.test.ts: 41 tests updated for folding behavior
  • Update gitignore tests: .codex/memories/ no longer generated
  • Regenerate .gitignore (drops **/.codex/memories/)

Precedent

This mirrors commit 3a57ea7a" which fixed the identical bug for warp (.warp/memories/` was inert).

Closes #1765

…rt .codex/memories

Codex CLI loads instructions only from the AGENTS.md family (root +
hierarchical directory walk). It does NOT scan .codex/memories/ for
instruction files — that directory is Codex's separate SQLite-backed
auto-memory system. Non-root rules written there were silently ignored.

Fix: add foldsNonRootIntoRoot: true to the codexcli rule factory entry
and remove the nonRoot path from CodexcliRule.getSettablePaths(), so
non-root rule bodies are concatenated into the single root AGENTS.md
by the RulesProcessor — same pattern as grokcli, warp, and deepagents.

- Rewrite codexcli-rule.ts following the grokcli/warp pattern (root-only
  settable paths, both root and non-root rules target ./AGENTS.md)
- Change ruleDiscoveryMode from 'toon' to 'auto' (no inert TOON refs)
- Update codexcli-rule.test.ts: 41 tests updated for folding behavior
- Update gitignore tests: .codex/memories/ no longer generated
- Regenerate .gitignore (drops **/.codex/memories/)

Closes #1765
@dyoshikawa
dyoshikawa merged commit 62cb41e into main Jun 22, 2026
9 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner

@dyoshikawa-claw Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-issue-1765-codexcli-fold-nonroot-into-root branch June 22, 2026 05:40
dyoshikawa added a commit that referenced this pull request Jun 23, 2026
…try (#2009)

Follow-up to #1979 (#1980 #1): after codexcli stopped emitting inert .codex/memories/ files (non-root rules now fold into root AGENTS.md), a **/.codex/memories/ line was left orphaned in the user-maintained zone of .gitignore, above the '# Generated by Rulesync' header. rulesync no longer references that directory, so the entry is dead cruft and pnpm dev gitignore neither emits nor strips it. Remove it.

Closes #1980

Co-authored-by: dyoshikawa <yoshikawa.daio@classmethod.jp>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rudironsoni pushed a commit to rudironsoni/rulesync that referenced this pull request Jun 23, 2026
PR dyoshikawa#1979 changed codexcli to fold non-root rules into the root AGENTS.md and
stopped writing the inert .codex/memories/ tree, but the e2e-rules case added
in dyoshikawa#1978 ('should pass check for a non-owning target when another target owns
AGENTS.md') still asserted .codex/memories/detail.md existed. The mismatch left
main's E2E suite red.

Update the assertions to the current behavior: the non-root 'Detail Rule' body
is emitted by the owning target (antigravity-ide) under .agents/rules/, and
codexcli no longer creates .codex/memories/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

codexcli non-root rules written to .codex/memories/ which Codex CLI does not read

2 participants