This summary is produced by the author, and not by AI.
The most important task for you during agentic development is to create, gather, and curate context. Context is anytext (or images) that the model ingests to produce a more relevant and useful response. Providing the right context at the right time helps agents produce better results; it’s about more than just writing markdown files:
In this article we give some guidance on how you can curate context for agentic development in business intelligence. This first article discusses more broadly the concept of “context” and why it’s so important when you use AI. You should treat context as a “first-class citizen” and a top priority.
Future articles focus on specific types of context highlighted in the previous diagramWhen working with AI agents, common everyday words take on specific technical meanings. Before we begin, it’s worth very quickly defining a few of them:
These are four common terms to understand when working with agents:
/skill or words like ultrathink (which maximizes effort for one turn) and ultracode (which allows use of a special feature called multi-agent workflows) in Claude CodeIn short, there’s different types of text that LLMs work with, which it might ingest and use in different ways.
As mentioned in an earlier blog post about LLM fundamentals, LLMs work by taking in and outputting text. They do this one token, or chunk, at a time. Even AI agents work this way when they are using tools such as reading a file or running a command in the terminal. An agent harness reads the output text, intercepts it, and runs the tool calls on behalf of the agent:
LLMs have no memory.Rather, they operate purely based on the input text and the numerical details of the language model, iterating in a loop. You can think of this like calling a function in a programming language. Because the model is dependent on the input text, this makes managing those inputs important for quality results. When we refer to “memory” for agents, we just mean mechanisms for the agent to save and re-ingest information in context.
The key part to understand is that LLMs have amnesia (metaphorically). They wake up with no memory or history and must work based on whatever little scraps of paper you slide over to them. You are charged for every word on those scraps of paper, so you want to keep them small.The sum total of all the text inputs given to an LLM is context. This includes the system prompt, the user prompt, any tool descriptions, the conversation history, and so on. Good agent harnesses like Claude Code or OpenCode hide a lot of this by default, but it’s still important to manage. Finally, the context window is the maximum amount of text, measured in tokens, that an LLM can process.
If you use a coding agent such as Claude Code or the GitHub Copilot CLI, you can run /context to get a visual representation of how full your context window is. A distinction that will become important later on in the article is context that is loaded each and every session and context that is specific to a session. The former is important to manage because it represents a tax on each and every session:
The problem with too much context is threefold:
The more input text you provide an agent, the worse it performs, even for simple tasks like recalling what was said. This is often called context rot. So, even though your model may support a million tokens of context, you will often get much better results with just 100-250k of context (as a hypothetical example). Think of the window size like the maximum safe weight on an elevator. Just because you can fill it to the brim doesn’t mean you should!
It’s not just about volume, but what the context is. Agents are prone to focusing on irrelevant context; they’re easily distracted.
LLM providers charge based on input and output tokens. So, the more context you provide, the more expensive the request; this is doubly bad if the context is irrelevant, because you’re paying for something you didn’t even care about. All of this is to say managing the context an agent receives, also called context engineering, dramatically affects cost and efficiency of AI agents.
/clear or /compact before you do this/compact when you come back or start an old session.For Power BI people, it can help to think about token caching like query folding with Power Query.
In a previous article about AI readiness, we describe the context window as more like a context budget. Your goal is to find that sweet spot in the middle where you give it enough information to guide it; nothing more.
With AI skills or MCP servers, it can be tempting to add as many as possible. Unfortunately, however, this adds a constant drag to your agents in the same way as having a heavy load on the back of a bicycle makes it hard to steer and stay upright. Every single MCP server and skill have a price tag that you can pay every session, so you want to know whether it’s worth paying, or not.
So, what type of context should you add and how should you manage it?
Again, you should think about context with a comparison to Power BI. If you want to optimize a data model, one of the easiest things you can do is reduce the amount of data. Likewise, if you want to optimize an agent, then you should reduce the amount of context.
Context can be scoped at different levels: organization, user, project, and local:
When you work with agents, this only applies to memory and skill files. They work hierarchically; if there’s conflicts between a memory file in your user configuration and your project configuration, then the bottom one wins. In general, you want to have a structure where the context that applies most broadly is as lean as possible; keep project-specific instructions and skills isolated to those projects.
For instance, if you have a pricing project where you create semantic models and reports, you shouldn’t include skills about other topics and areas.
First, you should keep always-loaded context to a bare minimum. Depending on your agent harness, such as GitHub Copilot or Claude Code, files like AGENTS.md or CLAUDE.md will be loaded into every session. These should be kept very short, with pointers to reference files for occasionally needed information. Pretend that you are being charged 5 cents for every word you write in here.
Don’t be afraid to back up and then just delete all your memory files and skills. Especially with newer models, doing this “fresh start” can help you realize exactly how much your stale context was weighing you down.
Splitting the context into core context and loadable references illustrates a concept known as progressive disclosure. Progressive disclosure is just a fancy term that refers to the agent only reading and using what it needs, when it needs it. Again, imagine you are being charged 1 cent for every single word that is read by the agent. You wouldn’t want it to read the full instructions every single time. You would want to progressively share, or disclose, more and more of the information the agent needs.
AI Skills are optimized for progressive disclosure. They contain a YAML frontmatter that describes what the skill does. This is often all an AI agent ever sees, so the frontmatter needs to be very clear about when the skill applies; if it’s vague or overly generic, the agent may read the full skill far too often (or never at all). If the user or the agent decides to invoke a skill, then the agent reads the rest of the skill file, which is written in Markdown. Then, the AI agent may decide to read bundled reference files, if any. Each stage is bigger than the last: the frontmatter costs around a hundred tokens in every session, the skill body a few thousand when invoked, and the reference files cost nothing at all until the agent actually reads them.
MCP servers are somewhere in between. Originally, many MCP servers were very token-inefficient because their tool descriptions were always loaded into context. Different agent harnesses have different workarounds for this. Anthropic built a tool search tool that Claude Code uses (a bit meta, right?) while GitHub Copilot groups different tools together as virtual tools.
While these optimizations help, we recommend installing skills and MCP servers conservatively and per-project where it makes sense. Try to keep as few skills and MCP servers as possible, and as few global context in general as possible.
So, what happens if you try to exceed the context window? In many agent harnesses, it will automatically compact, or summarize, the entirety of the agent session. Then it will start a fresh context window based on that summary. You can often manually run a /compact command to do this yourself.
Now, imagine if you had a two-hour meeting and unexpectedly you were asked to summarize it in a few sentences. Let’s say this would then be used as the agenda for next week. You would likely forget important details or even misremember certain details. Compacting is the same. It’s a lossy process and if done more than once, it starts to quickly degrade the quality of a session.
Instead, you should regularly start a fresh session or use a command like /clear to clear the session context. Alternatively, you can ask the agent to write a concise HANDOFF.md and then in a new session ask the agent to read it (some tools like herdr.dev even let agents brief each other). It’s a good idea to use a template of how this document should look, first, though.
This is also where subagents are very useful, if your harness supports them. Because a subagent will have its own context, it can do work like exploring a codebase or reviewing code commits and then return the result to the main agent without polluting the main agent’s context.
One of the reasons why we don’t recommend letting an AI document your data model for you is because large language models are verbose. Their whole job is to generate text, so it’s not surprising that they generate a lot of it.
The same advice applies to writing AI skills and documentation that go back into an agent’s context. It can be tempting to tell the agent to write a skill for a given task. Unfortunately, in addition to being verbose, agents will include all sorts of details that are mildly relevant but can be easily rediscovered if needed. It’s reasonable to use AI to help you with a first draft if you are feeling overwhelmed. But ideally, you should be writing the skills and documents that go into your context by hand.
In both cases, even if AI was good at writing concisely and clearly, there are likely specifics to your organization that you want to be putting into the guidance and documentation an AI agent will read.
Human-written context is better than AI-generated context largely because you’re documenting implicit information and making it explicit. In contrast, what an AI generates is just summarization of what’s already there, or an imperfect representation of your discussions and documents that you’ve given it. Relying on AI for context curation is like playing a game of telephone, where the meaning and intent of the information, often quite subtle and nuanced, gets quickly buried under idiosyncratic AI writing.
It’s fine to have AI make targeted changes and updates, but you need oversight on this process. That’s why it’s important to have context in source control, and ideally also tested.
One nuanced exception to the above; it can be a good idea to write your first, small skills with the help of an agent, especially if they’re just intended for you (and not distribution to others). If it works, it works. But this is definitely not something you should do for organizational context!
Managing context for agents isn’t a one-off, monolithic task. You can spend a lot of effort gathering and setting up the context, but you’ll need to keep updating it over time as your business, tools, preferences, and project evolves. If you only add, though, then the context quickly gets too much, and the outdated information becomes irrelevant.
To avoid this, you need to think about curating the context, like a diligent librarian would the books on the shelf. Things need to be organized, clean, and in the right place. Managing context is dull, hygienic work that keeps a workflow healthy.
This is just like keeping documentation up-to-date, or updating a semantic model and report as business objectives change over time. There’s nothing new, here; it’s just about good habits and consistency.
A simple way to get started:
Building automated tests (or evaluations; evals) for context is a full project on its own. It’s not something that you can “yolo slopcannon out” in a weekend. You need to set up the test conditions, prompts, and different types of testing like ablative or regression testing. We’ll talk more about this in a later article dedicated specifically to setting up evals.
LLMs are heavily dependent on text that they ingest to produce useful and relevant outputs. Much of this can be controlled by you in terms of the files, skills, and MCP servers you provide to an agent. The key thing is to find the Goldilocks zone of enough context to do the task but not distracting or irrelevant information.
Take your semantic models further with Tabular Editor.
Give Tabular Editor a spin