← Back to PRs

#11743: fix: remove redundant file reads from AGENTS.md template

by shogunsea open 2026-02-08 07:39 View on GitHub →
docs
## Summary - The AGENTS.md template's "Every Session" section instructed agents to manually read `SOUL.md`, `USER.md`, and other workspace files before every response - These files are already auto-injected by the system prompt assembler, making the reads redundant - Each redundant read costs a sequential LLM API round-trip (2-7s), adding ~20s of latency before the agent generates a reply ## Changes - Explicitly list auto-injected files so agents know not to re-read them - Keep only reads for files that are NOT auto-injected (`memory/YYYY-MM-DD.md`, `MEMORY.md`) - Instruct agents to batch remaining reads in a single parallel tool call - Add graceful handling for missing files (skip instead of retry) ## Verification Results | | Before | After | |---|---|---| | **Total duration** | 26,994ms (~27s) | **2,775ms (~3s)** | | **LLM round-trips** | 7 | **1** | | **Tool calls** | 5 file reads | **0** | The agent went from 7 sequential API calls down to a single call — no redundant file reads. It reads the auto-injected context and replies directly. ~10x improvement. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Updates `docs/reference/templates/AGENTS.md` to avoid redundant per-session file reads by explicitly listing files that are already auto-injected into agent context, and narrowing the "Every Session" checklist to only non-injected memory files (`memory/YYYY-MM-DD.md` and (main session only) `MEMORY.md`). The template also instructs batching remaining reads into a single parallel tool call and to gracefully skip missing files rather than retrying. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Change is confined to a documentation template; it removes redundant instructions without affecting runtime code paths. The updated guidance is internally consistent and reduces unnecessary tool calls/latency. - No files require special attention <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <details><summary><h4>Context used (3)</h4></summary> - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) - Context from `dashboard` - docs/reference/templates/AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=ef691cbd-a005-4c3e-998b-6fcd72f2d312)) </details> <!-- /greptile_comment -->

Most Similar PRs