Skip to content

feat(codex): add user-global Codex CLI instructions #131

@kurone-kito

Description

@kurone-kito

Parent roadmap: #130 (<!-- dotfiles-roadmap-id: user-global-ai-symmetrization -->)

Background

home/dot_codex/ currently contains only config.toml. Codex CLI
reads user-global instructions from ~/.codex/AGENTS.md when it
starts a session in a repository that lacks a local AGENTS.md.
Today, when this dotfiles repository is applied, Codex sessions in
non-IDD repositories fall back to model defaults for conversation
language, commit-message style, and commit-signing recovery.

For comparison, Copilot CLI is already covered by
home/dot_copilot/copilot-instructions.md (deployed to
~/.copilot/copilot-instructions.md since commit 9ee65fa).

Proposed change

Before drafting, verify that Codex CLI's user-global instructions
loader filename is AGENTS.md (Codex CLI's documented convention
for project-level files; verify upstream docs / changelog for the
user-global equivalent). If a different filename is canonical, name
the new file accordingly and record the source in the PR.

Add home/dot_codex/AGENTS.md. Use
home/dot_copilot/copilot-instructions.md as the reference shape
and adapt it for Codex CLI's interaction model:

  • Opening paragraph stating that repository-specific instructions
    (project-level AGENTS.md, .github/instructions/*.md, etc.)
    always take precedence over this file.
  • Conversation language policy (match user's language; comments and
    docs in English).
  • Conventional Commits guidance (lowercase, user-perspective,
    72-character subject, atomic commits, breaking-change marker).
  • The full bounded signing fallback ladder (configured GPG attempt
    → classify failure → optional gpg-agent restart → SSH fallback
    with key discovery → unsigned), matching the same structure used
    in the canonical home/dot_copilot/copilot-instructions.md.
  • Coding standards defaults (LF endings, no trailing whitespace,
    trailing newline, lowercase-hyphen filenames).
  • Guardrails (do not modify community docs without approval; do
    not claim tests succeeded without running them).

Replace Copilot-specific wording like "Agent mode" / "Plan mode"
with Codex CLI's own pause/continue terminology so the same
behavioral intent translates without product confusion. Where the
Copilot file uses "GitHub Copilot CLI" as the surface name, prefer
"Codex CLI" or surface-agnostic "the agent". Aim for structural
parity rather than a byte-identical copy.

Acceptance criteria

  • home/dot_codex/AGENTS.md exists as a plain .md source file
    (not a .tmpl).
  • The file opens with a paragraph that explicitly defers to
    repository-specific instructions.
  • It contains sections covering Conversation, Commit rules
    (including the signing fallback ladder), Coding standards, and
    Guardrails, in any order that reads naturally.
  • The signing fallback ladder spells out: configured GPG attempt,
    failure classification by category (P / C / A / U), conditional
    gpg-agent restart with all three skip clauses (gpgconf not on
    PATH; $SSH_AUTH_SOCK resolves to gpg-agent's SSH socket;
    non-interactive CI), SSH fallback with the same three-step key
    discovery (gpg.format == sshgpg.ssh.defaultKeyCommand
    first non-certificate ssh-add -L line passed as one quoted
    argument), and unsigned as the accepted final fallback. No fixed
    ~/.ssh/id_ed25519 path is named.
  • The existing home/dot_codex/config.toml is untouched.
  • npx markdownlint-cli2 "home/dot_codex/AGENTS.md" passes (the
    rules from .markdownlint.yml).
  • A cspell run over the new file passes (the custom dictionary in
    .cspell.config.yml is sufficient).
  • tests/bash/helpers/bats-core/bin/bats tests/bash/ still passes
    unchanged.

Candidate files

  • home/dot_codex/AGENTS.md (created)

Notes

  • Reference shape: home/dot_copilot/copilot-instructions.md.
  • Specificity target: a mid-tier model implementing this issue
    should choose the exact wording per section; the issue requires
    structural parity rather than literal copy.
  • If verification finds the canonical user-global filename for
    Codex CLI differs from AGENTS.md, prefer the canonical name
    and explain in the PR description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions