openai / openai/codex

Allow configurable AGENTS.md reload policies, including freeze

Open
#43,309 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI config enhancement session
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Request

Add a user-configurable policy for automatically reloading AGENTS.md instructions, with an explicit freeze option. This is a token-efficiency and session-consistency preference, useful even when the entire conversation fits comfortably within the context window.

Related bug: #43295 tracks automatic instruction reload overflowing the context window and locking a previously usable session. That failure needs to be handled independently of this feature request. This enhancement is about allowing users to choose whether and how updates enter a conversation.

Why freeze is useful

I append technical learnings from the current session to a persistent history/instruction file. The session already contains that information. Automatically loading it again is redundant; I prefer the next new session to read the updated file.

Even a one-character timestamp change can append an entire updated instruction bundle on cold resume. Users with small instruction files may still want to avoid the extra tokens, while users with large bundles see a larger cost and context jump.

Initial scope: reload or freeze

Proposed configuration:

agents_md_reload_policy = "freeze"
  • reload: retain the existing update behavior as the compatibility default, subject to fixing the context-budget failure tracked in #43295.
  • freeze: retain the conversation's last accepted instruction snapshot across turns, cold resumes, forks and compaction, including an initially empty snapshot. A genuinely new conversation loads current files.

Enabling freeze on an existing conversation should preserve its last accepted snapshot, not rewind it to an older one. It should not rewrite or deduplicate historical messages. Explicit file reads by the agent remain possible; the setting controls automatic instruction reloading.

Expose the choice through normal configuration/profile overrides. The proposed implementation requires the setting on each launch or in config/profile; it does not add a persisted per-thread setting. For legacy histories without a usable instruction snapshot, load current instructions once as a documented fallback.

Possible later extensions

These are separable follow-ups, not prerequisites for freeze:

  • Append diff only: append additions/removals relative to the last accepted bundle, while preserving earlier turns and retaining a complete snapshot for replay/compaction. No LLM-generated change summary is required.
  • Conditional full reload: allow a configurable bundle-size or projected-context threshold; defer the update and show a local notification when it would exceed the chosen limit. An 80% projected-context threshold is one possible user preference, not a required universal value.

Mutating previously supplied instructions in place is outside this request. A frozen session plus explicit, time-local updates avoids silently changing the instructions under which earlier turns occurred.

Available freeze implementation

Commit 8f4db86 (download patch) implements reload/freeze only, based on 8d7cc24a87f4aa66aa434eb4f25f4f4bafc0e0a9. It contains no experimental diff or threshold behavior.

The manager keeps the frozen state independently of the comparison baseline that compaction can clear. Replay restores the snapshot from surviving world-state records, respecting rollback. Restored snapshots do not claim current filesystem provenance, since the existing persisted format does not retain it.

Validation on Linux x86-64:

  • 26 targeted AGENTS integration tests and 295 configuration tests passed.
  • CLI build succeeded; the standalone mock-API script in #43295 passed against the actual binary in both default and freeze modes, with no inference or production credentials.
  • Schema regeneration, scoped Clippy fix, formatting and whitespace checks completed. An unrelated automatic unused-import cleanup was excluded from the patch.
  • The broader core suite was not green: 3,930 passed, 217 failed, 9 skipped. Failures included missing helper binaries, resource limits, parse failures and timeouts; not all were triaged against a clean baseline. The optional code-mode-host build was blocked by a missing pinned V8 archive (HTTP 404). The full workspace suite was not run.

An upstream PR was attempted, but GitHub rejected creation and the repository reports pull_request_creation_policy: collaborators_only. The patch is linked for maintainer review or application.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review commit 8f4db8617ba6c269c53517d5f1cf2b4eeb127caf and the configuration/profile entry points first. Run the targeted AGENTS integration tests and configuration tests, then verify reload and freeze behavior across turns, resumes, forks, compaction, and new conversations. Done means the reload/freeze policy works without including the separate context-budget fix or later extensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.