AI agents

Comparisons

Project Instructions: CLAUDE.md vs AGENTS.md

All three tools inject a project-level instructions file into the model’s context, but the filename, discovery, and merge rules differ. Claude Code uses CLAUDE.md; Codex and Kimi Code both use AGENTS.md — with different discovery rules between them.

Related per-tool pages: Claude Code — Project Instructions (CLAUDE.md) · Codex CLI project instructions (AGENTS.md) · Project Instructions (AGENTS.md)

File locations and precedence

Claude Code (CLAUDE.md)

TypeLocation
Enterprise policymacOS /Library/Application Support/ClaudeCode/CLAUDE.md; Linux/WSL /etc/claude-code/CLAUDE.md; Windows C:\ProgramData\ClaudeCode\CLAUDE.md
Project./CLAUDE.md or ./.claude/CLAUDE.md (commit to git)
User~/.claude/CLAUDE.md
Project local./CLAUDE.local.md — deprecated in favor of @ imports
  • All memory files load into context at launch; higher levels in the table are loaded first and take precedence.
  • Lookup recurses up from the cwd to (not including) /, reading CLAUDE.md/CLAUDE.local.md on the way; nested CLAUDE.md files in subtrees load on demand when Claude reads files there.
  • No size cap is documented.

Codex (AGENTS.md)

Discovery runs once per run (or per TUI session):

  1. Global scope (~/.codex): reads AGENTS.override.md if it exists, otherwise AGENTS.md — only the first non-empty file at this level.
  2. Project scope: from the project root (typically the Git root; configurable via project_root_markers) walk down to the cwd. In each directory Codex checks AGENTS.override.md, then AGENTS.md, then the names in project_doc_fallback_filenames. At most one file per directory.
  3. Merge: files are concatenated root-down, joined with blank lines; files closer to the cwd appear later and therefore override earlier guidance.
  • Empty files are skipped.
  • Combined size is capped at project_doc_max_bytes (default 32 KiB).

Kimi Code (AGENTS.md)

  • Project-level: AGENTS.md at the project root or .kimi-code/AGENTS.md. Content is injected into the system prompt as reference data (the ${agents_md} template variable).
  • Global Kimi-specific: $KIMI_CODE_HOME/AGENTS.md (default ~/.kimi-code/AGENTS.md); moves with KIMI_CODE_HOME.
  • Generic cross-tool: ~/.agents/AGENTS.md in the real OS home, shared across tools; does not move with KIMI_CODE_HOME.
  • Size limit: ? The docs do not specify an exact size cap or whether nested subdirectory AGENTS.md files merge; the changelog mentions a visible warning when AGENTS.md is truncated (previously silent), so a cap exists but is undocumented.

Import and override mechanisms

MechanismClaude CodeCodexKimi Code
Import other files@path/to/file imports (relative/absolute, @~/... supported, recursive up to 5 hops, not evaluated in code spans)No direct equivalent verified.No direct equivalent verified.
Per-directory overrideNested CLAUDE.md files load on demand in subtreesAGENTS.override.md replaces AGENTS.md in the same directoryNo direct equivalent verified.
Replace built-in instructions--system-prompt / --system-prompt-file CLI flagsmodel_instructions_file config key (replaces built-in instructions, not AGENTS.md)$KIMI_CODE_HOME/SYSTEM.md replaces the default main agent’s system prompt
Quick add from the composer# prefix prompts which memory file to append toNo direct equivalent verified.No direct equivalent verified.

/init behavior

  • Claude Code: /init bootstraps (generates) a project CLAUDE.md.
  • Codex: /init generates an AGENTS.md scaffold in the current directory.
  • Kimi Code: /init (idle only) analyzes the codebase and generates AGENTS.md.

Porting your instructions

  • Claude Code → Codex or Kimi Code: rename CLAUDE.md to AGENTS.md. Unroll any @import lines first — neither Codex nor Kimi documents import syntax, so inline the imported content yourself. In Codex, keep the total under 32 KiB (project_doc_max_bytes) or raise the limit.
  • Codex → Claude Code: rename AGENTS.md to CLAUDE.md. Remember Codex concatenates multiple AGENTS.md files root-down while Claude loads nested CLAUDE.md files on demand, so a multi-file Codex setup may become a single file or a set of nested files in Claude.
  • Kimi Code → Claude Code / Codex: check all three Kimi locations (AGENTS.md or .kimi-code/AGENTS.md in the project, ~/.kimi-code/AGENTS.md, ~/.agents/AGENTS.md) and consolidate.
  • Automated importers: Kimi Code ships a built-in /import-from-cc-codex skill command that imports Claude Code and Codex instructions, skills, and MCP settings. Codex ships /import, which migrates Claude Code (or Cursor) setup, projects, and chats. Neither Claude Code nor Codex documents an importer from Kimi Code.

Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.