#11743: fix: remove redundant file reads from AGENTS.md template
docs
Cluster:
Memory Compaction Improvements
## 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
#7896: docs: enforce immediate memory persistence in AGENTS.md
by FelixFoster · 2026-02-03
82.1%
#15852: fix: pass agentId when resolving IRC session paths
by MisterGuy420 · 2026-02-14
81.9%
#9829: Fix MCP transport reconnect and SSE header handling
by mabengda · 2026-02-05
81.6%
#20267: feat: workspace-aware post-compaction context
by nickjlamb · 2026-02-18
80.1%
#19560: docs: refactor agent workspace default location & bootstrap configu...
by ashinkuniyil · 2026-02-17
77.4%
#22977: fix(ui): resolve agent names from config in session dropdown
by NikhilGaddam · 2026-02-21
76.9%
#16362: Update session-pruning.md - updated agents.defaults config std
by elliottb · 2026-02-14
76.8%
#20112: Update AGENTS.md - use adequate token for staying silent in group c...
by albertocsm · 2026-02-18
76.8%
#15982: fix: pass agentId to resolveSessionFilePath in reply flow (NX-003)
by automagik-genie · 2026-02-14
76.4%
#7196: docs: Agent continuity - the 'stranger problem' and lighter approach
by sincere-arjun · 2026-02-02
76.3%