Stop Pasting Your Whole Repo Into the Agent
说明与用途
使用简短的文件清单限制初始上下文,让代理专注于关键文件,并在需要时请求更多,从而降低错误风险。
问题
Agents often receive too much undifferentiated context when developers paste entire repositories, causing the model to dilute relevant signals and make incorrect edits.
结果
Limiting initial context to a curated set of files reduces noise, enables the agent to ask clarifying questions, and prevents incorrect edits across large codebases.
工作流
- Create a short AGENT_CONTEXT.md manifest mapping task types to key files.
- Include a read_first list of the most relevant files and a don_not_inject list of non‑essential files.
- Use the manifest to supply only the specified files to the agent on the first turn.
- Allow the agent to ask for additional files if needed.
- Mark the authoritative source (e.g., contract, schema, migration, invariant test) explicitly.
- Avoid auto‑attaching large reference files like README.
- Iterate the manifest weekly based on high‑frequency tasks.
证据
Instead of pasting files reactively, maintain a short file-level manifest that maps a task type to the files the agent should read first.
The failure mode isn't "not enough context." It's "too much undifferentiated context."
For API work specifically, the highest-leverage artifact isn't any code file — it's the contract.
- 记录日期: 2026-10-10T01:41:00.237Z