Skip to content

Commit c14765e

Browse files
committed
fix(codex): add persistent_instructions to baseline and relax sanity check
The global sanity check (check-codex-global-state.sh) hard-fails when persistent_instructions is missing from ~/.codex/config.toml, but neither the baseline .codex/config.toml nor the sync script ever define this field. This causes a clean install to report a failing sanity check even though the sync otherwise succeeds (anomalyco#967). - Add persistent_instructions to the baseline .codex/config.toml so that users who cp the config get a working default. - Downgrade the sanity check from fail to warn, since persistent_instructions is additive and optional — users who rely solely on AGENTS.md should not be blocked. Fixes anomalyco#967 (persistent_instructions part; context7 naming addressed by anomalyco#970) Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Lidang-Jiang <[email protected]>
1 parent 8b6140d commit c14765e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎.codex/config.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ notify = [
2727
"-sound", "default",
2828
]
2929

30-
# Prefer AGENTS.md and project-local .codex/AGENTS.md for instructions.
30+
# Persistent instructions are appended to every prompt (additive, unlike
31+
# model_instructions_file which replaces AGENTS.md).
32+
persistent_instructions = "Follow project AGENTS.md guidelines. Use available MCP servers when they can help."
33+
3134
# model_instructions_file replaces built-in instructions instead of AGENTS.md,
3235
# so leave it unset unless you intentionally want a single override file.
3336
# model_instructions_file = "/absolute/path/to/instructions.md"

‎scripts/codex/check-codex-global-state.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ fi
8989
if [[ -f "$CONFIG_FILE" ]]; then
9090
check_config_pattern '^multi_agent\s*=\s*true' "multi_agent is enabled"
9191
check_config_absent '^\s*collab\s*=' "deprecated collab flag is absent"
92-
check_config_pattern '^persistent_instructions\s*=' "persistent_instructions is configured"
92+
# persistent_instructions is recommended but optional; warn instead of fail
93+
# so users who rely on AGENTS.md alone are not blocked (#967).
94+
if rg -n '^persistent_instructions\s*=' "$CONFIG_FILE" >/dev/null 2>&1; then
95+
ok "persistent_instructions is configured"
96+
else
97+
warn "persistent_instructions is not set (recommended but optional)"
98+
fi
9399
check_config_pattern '^\[profiles\.strict\]' "profiles.strict exists"
94100
check_config_pattern '^\[profiles\.yolo\]' "profiles.yolo exists"
95101

0 commit comments

Comments
 (0)