All answers

What goes in the context window for a coding agent, and who decides?

Dennis PilarinosDennis Pilarinos·Nov 17, 2026·Context Engine · Engineering Insights

Six layers: org rules, repo rules, the task, the code the agent reads, tool results and memory, and retrieved org context. The platform team owns org rules, repo owners own repo rules, the developer owns the task, and the agent picks the rest. Org context changes too fast to hand-edit, so Unblocked keeps it current from PRs, issues, docs and chat and serves it over MCP.

A coding agent's context window holds six layers: org-wide rules, repo rules, the task, the code it reads, tool results and memory, and context retrieved from the rest of the company. Each layer has a different owner. The platform team sets org rules. Repo owners write repo rules. The developer writes the task. The agent decides which files to open and which tools to call. The last layer has no natural owner, and that is where most teams get stuck. Retrieved org context is the slice of pull requests, tickets, design docs, chat threads and incidents that bears on the task in front of the agent. Unblocked is a context engine that maintains this layer: it ingests those sources as they change and hands the agent one cited answer through its context_research tool over MCP.

The six layers, in the order they load#

Anthropic describes the window plainly. Claude Code's context window "holds everything Claude knows about your session: your instructions, the files it reads, its own responses, and content that never appears in your terminal" (Claude Code docs). Before you type, "CLAUDE.md, auto memory, MCP tool names, and skill descriptions all load into context." Cursor says the same of its rules: "rule contents are included at the start of the model context" (Cursor docs).

LayerWhat it holdsWho owns itWhen it loads
Org rulesSecurity policy, compliance, company coding standardsPlatform or IT teamEvery session
Repo rulesBuild commands, layout, project conventionsRepo owners, in source controlEvery session, plus scoped rules on demand
The taskThe prompt, ticket or issueThe developerEach turn
CodeFiles the agent opensThe agentAs it works
Tool results and memoryCommand output, search hits, notes it savedThe agentAs it works; memory every session
Retrieved org contextPRs, tickets, docs, chat, incidentsA context engineWhen the agent asks

People write the first three. The agent chooses the next two. The last is fetched, so it is only as good as the system that keeps it current.

Platform teams own the floor#

Every major host gives the platform team a layer that loads for everyone. Claude Code has a managed policy CLAUDE.md, stored at a system path, for "organization-wide instructions managed by IT/DevOps" and shared with "all users in organization" (Claude Code memory docs). Cursor's Team and Enterprise plans "can create and enforce rules across their entire organization from the Cursor dashboard." An enforced rule cannot be turned off by a team member. On GitHub, "organization owners can add instructions to tailor Copilot to the needs and preferences of their organization" (GitHub docs).

Keep this layer small. It loads on every turn for every engineer, so each line costs tokens across the whole company. Length also costs accuracy: a March 2026 paper notes that LLMs show "significant performance degradation as context length increases" (Cao et al., 2026). Good candidates are rules that never change by repo. For example: never commit secrets, which license headers to use, which internal registry to pull from.

Precedence matters too. In Copilot Chat on GitHub.com, personal instructions rank highest, then repository instructions, then organization instructions. GitHub notes that other clients, such as VS Code, combine the files without a general ranking. Claude Code concatenates every file it finds rather than letting one override another. So a platform rule is a default, and a repo or personal rule placed later can contradict it.

Repo owners and developers own the middle#

A rules file is the markdown an agent loads at the start of every session to learn how a repo works. Repo rules live in source control: CLAUDE.md or AGENTS.md for Claude Code, .cursor/rules for Cursor, .github/copilot-instructions.md for Copilot. Unblocked reads these files too: its context_get_rules tool returns the coding rules it extracts from a repo's AGENTS.md and CLAUDE.md, so any agent connected to the MCP server can fetch them on request (Unblocked docs). Anthropic advises keeping each CLAUDE.md "under 200 lines" because "longer files consume more context and reduce adherence." It also warns that "if two instructions contradict each other, Claude may pick one arbitrarily" (Claude Code memory docs). The owner of a repo file has to prune it, and someone has to check it against the org layer above it.

The task belongs to the developer. A ticket link, a failing test and a clear finish line beat a long prompt. Skills, rules files and retrieved context covers what belongs where.

The agent owns what it reads and remembers#

Once the session starts, the agent decides. It opens files, runs commands and calls tools, and every result stays. Anthropic's guide puts it this way: "the results become part of the conversation history and count against the context budget on every subsequent turn" (Claude Cookbook, March 2026).

Memory is the agent's own layer too. Auto memory is the set of notes Claude Code writes for itself from your corrections and preferences. Claude, not you, writes it, and it loads the first 200 lines or 25KB every session. When a long session compacts, the root CLAUDE.md and auto memory are re-injected from disk. Older tool output is summarized with the rest of the conversation. So what the agent learned from a search an hour ago may survive only as a sentence.

That is fine for code, which the agent can re-read. It is a problem for knowledge that lives outside the repo, which the agent cannot re-read without a tool.

A context engine owns the org layer#

The reason behind a retry limit, the incident that changed a timeout, the Slack thread that retired a library: none of this is in the code, and none of it stays still. Teams that paste it into rules files end up with rules-file rot, where the file and the system drift apart because updating it is manual work that competes with shipping.

This layer needs a maintainer that is not a person. Unblocked's MCP server gives the agent context_research, "multi-source research across code, PRs, docs, issues, and messaging" that "returns a synthesized answer with citations" (Unblocked docs). Ingestion is event-driven, and each answer is computed against the current state of code, chat and docs when the agent asks (inside the Unblocked context engine). With Data Shield on for a source, answers respect that source's permissions. A short cited answer also leaves room in the window. We measured this once on one production repository, same prompt and model (claude-sonnet-4-6): with Unblocked attached the agent used 42 percent fewer tokens and 29 tool calls instead of 80 (same prompt, same model, different context). One run is not a population. The same server works in Claude Code, Cursor, Copilot in VS Code and JetBrains, Codex and Windsurf.

So the split is simple. People write the rules. The agent picks the code. A context engine keeps the company's knowledge current and decides which slice of it a given task needs.