Skip to content

Redundant reads of injected AGENTS.md / session skill inflate startup context in large projects #57704

Open

Description

@JosephKisler

Summary

In two large, private production repositories, Codex CLI repeatedly reread instructions that had already been provided in the model context, then loaded broad historical documentation before beginning a narrowly scoped task. This inflated startup tool output and contributed to context growth and slower delivery. We cannot yet isolate whether the cause is model behavior, CLI context presentation, or interaction with project workflow instructions.

Environment

  • Codex CLI: 0.165.0
  • Model: gpt-6.1-sol, reasoning medium
  • OS: Debian/Linux
  • Native AGENTS.md project instructions, an explicitly invoked session-start skill, local handoff and sprint documents
  • Projects anonymized here as A (Astro/FastAPI website) and B (headless CMS)

Observations (from local JSONL session audits)

Project A, startup on 2026-10-28

  • 11 distinct tool responses contained 206,807 UTF-8 bytes of formatted response text during startup; these bytes are not a token measurement.
  • Project AGENTS.md and the fully injected session-start/SKILL.md were subsequently read again via cat: 37,415 bytes of identical redundant file text.
  • Repeat reads of handoff/workflow documents added 27,541 bytes. Broad sprint searches, full test-plan output and an unnecessarily large scanner raw output also occurred.
  • The skill and project instructions already requested reuse of loaded instructions and selective document reading.

Project B, startup on 2026-10-28

  • 36,830 bytes of redundant AGENTS.md / skill rereading.
  • A combined large output was truncated, after which the handoff was reread. Whole historical sprint/coordination documents were loaded when only active sections were needed.

Long-running Project A session

  • One later model request had 432,751 input tokens. Across 168 requests, cumulative input was ~46.7M tokens, mostly cached; these are separate metrics, and the entire volume is not claimed as waste.
  • 146 external tool calls, 41 returned images, and no recorded compaction in the audited window.
  • Several newly created browser-check routines required repair; some necessary product checks were mixed with additional user-requested work before delivery.

Expected behavior

  • If the complete AGENTS.md or explicitly invoked skill is already available in context, do not reread identical content through tools absent a concrete reason.
  • Read the current handoff once; load only relevant sprint, test, and historical sections.
  • Preserve mandatory security checks and release gates, but return concise summaries instead of lengthy raw logs when possible.
  • Continue toward the original delivery objective instead of expanding verification without a specific failure or requirement.

Actual behavior

The agent selected unnecessary full-file reads despite instructions to reuse context and load details only as needed. When asked afterward, it acknowledged that some reads were unjustified.

Related observation (not a claimed CLI bug)

The agent often noticed slow CI setup only after explicit user questions. One project's Python dependency installation took 17:22 while 93 tests ran in 0.47s; after separate CI optimization it took 3:42. A second project had >11-minute dependency installation. These are project CI issues, included as agent-level performance awareness feedback, not evidence of a Codex runner defect.

Request

Could the team investigate ways to:

  1. Avoid tool rereads of already provided instructions/skill bodies;
  2. Improve task-specific context selection and stopping criteria for information gathering;
  3. Expose startup context usage by source (injected instructions vs tool reads vs images), making regressions easier to diagnose;
  4. Keep verification proportionate while respecting project gates and user approvals.

We have already simplified our own agent/workflow configuration. No A/B comparison isolates CLI 0.165.0 or the model as the sole cause. Sanitized minimal traces can be prepared on request; full private session JSONL files are intentionally not attached.

Activity

  1. added
    bug
    CLI
    model-behavior
    context
    skills
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugcontextmodel-behaviorskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions