Skip to content

Google Analytics, Vercel Web Analytics, Leadsy, the Ship or Die traffic check, the TikTok Pixel, the OpenAI Ads Measurement Pixel, Behavly, the Convincd demo agent and HubSpot stay off until you accept. The help chat starts once you have chosen. The Book a demo button appears once you have chosen. Read our Privacy Policy.

StellarFirmStellarFirm

Guides

Context engineering for AI agents: give them less, better

A plain guide to context engineering for AI agents: why long chats get worse, and how to write briefs, trim tools and keep notes so work stays sharp.

StellarFirm team6 min read

View as Markdown
On this page

If your AI agent assistant was brilliant at the start of a long chat and sloppy an hour later, the cause is usually not the model. It is the context: everything the assistant has to read before it takes its next step. Managing that on purpose is called context engineering, and you can do a useful version of it without writing any code.

This guide explains the idea in plain terms, based on Anthropic's engineering write-up on the subject, and turns it into habits for founders and small teams.

What is context engineering?#

Context engineering is deciding what an AI model sees each time it works. Prompt writing focuses on the instructions. Context engineering covers the whole window: the instructions, the tools the agent can call, any documents or data it has loaded, and the running history of the conversation.

The useful shift is that it is not a one-time job. Each step of an agent's work, something decides what goes into the window. If you are the one briefing the assistant, you are part of that decision.

Why does more context make results worse?#

Models have a limited attention budget. Anthropic describes context rot: as the amount of text grows, the model's ability to recall specific details tends to decline. It is a slope, not a cliff, and it shows up to some degree in every model.

In practice you will notice it as:

  • The assistant forgets a rule you gave it near the start.
  • It repeats work or contradicts an earlier decision.
  • It fixates on an old, irrelevant part of the conversation.

So the goal is not to give an agent everything. The goal is the smallest set of information that makes the right action likely. Long does not have to mean bad, but every line should earn its place.

How do I write instructions at the right level?#

Anthropic describes two ways to get this wrong. One is brittle, over-specific rules, a long if-this-then-that script that breaks the first time something unexpected happens. The other is vague advice that assumes the agent already knows what you mean. Aim between them: specific enough to steer, flexible enough to let the assistant use judgment.

Compare these two briefs for a support assistant.

Too vagueToo rigidAbout right
"Be helpful with customers."A 40-line decision tree for every possible refund question."Answer from our help articles. If a customer asks for a refund outside the stated window, draft a polite reply and flag it for me instead of deciding."

Two more habits help:

  1. Organise the brief into labelled parts. Background, the task, what good looks like, and what to avoid. Clear headings make it easier for the model to find what applies.
  2. Start small and add on failure. Write the shortest brief that states the job, run it, and add an instruction only when you see a specific mistake. This keeps the brief from filling with rules nobody remembers adding.

In StellarFirm the stable parts of a brief belong in your company brief, your house rules and your playbooks, so you write them once instead of pasting them into every chat. See house rules and write a playbook for your AI Agent Assistant.

Why should an agent have few tools?#

Tools are part of the context too, because the agent reads their descriptions every time. Anthropic points out a common failure: a bloated set of tools whose jobs overlap. Their test is useful for anyone choosing what to connect: if a person cannot say for sure which tool fits a situation, the agent will not do better.

For a small team that means connecting what a job needs, not everything available. A marketing assistant that drafts posts does not need access to your accounting data. Fewer, clearer tools also make approvals easier to reason about; see approval workflows for AI agents.

Should I paste everything up front?#

Usually not. Anthropic describes just-in-time retrieval: instead of loading every possibly relevant document at the start, the agent keeps lightweight references, such as file paths, links or saved queries, and pulls the content in only when a step needs it. Their coding agent works this way, exploring files as it goes rather than reading a whole project first.

You can copy the idea when briefing any assistant:

  • Point to the document ("the pricing policy is in the Library") instead of pasting forty pages.
  • Name the folder, the board or the thread where the detail lives.
  • Ask the assistant to read only what a step needs and to say what it used.

The trade-off, which Anthropic also notes, is that exploring takes time and needs a little guidance so the agent does not wander. A mix often works best: put the few stable facts up front, and let the assistant look up the rest.

What do I do when a chat gets long?#

Anthropic describes three techniques for long jobs, and each has a plain version you can use.

TechniqueWhat it meansWhat you can do
CompactionSummarise a conversation that is nearing its limit and continue from the summary.Ask for a summary of decisions, open questions and next steps, then start a fresh chat with it.
Structured notesThe agent writes notes outside the chat and reads them back later.Keep a running notes file or page for the job, and have the assistant update it.
Sub-agentsSpecialists work in their own clean windows and return a short summary.Split big jobs: one assistant researches, another writes, each starting clean.

Their guidance on choosing: compaction suits long back-and-forth, notes suit work with clear milestones, and several agents suit research where parallel exploration pays off.

PromptHand off to a fresh chat

Summarise this chat for a fresh start. List the decisions we made, the facts I gave you that still matter, what is unfinished, and the next three steps. Keep it under 200 words and leave out anything we dropped.

PromptKeep a running note

For this job, keep a short note with: the goal, decisions so far, open questions and where the source files are. Update it when something changes and show me the new version.

PromptTrim what the assistant reads

Before you start, tell me which of the documents and connections I gave you this job actually needs, and which you would leave out. Read only what a step requires and name what you used.

A small routine you can start this week#

  1. Write the brief once. Put your company facts, tone and rules in one place the assistants can read.
  2. One chat per job. When the job changes, start again with a short summary.
  3. Point, don't paste. Name where details live and let the assistant fetch them.
  4. Trim connections. Remove tools and sources a job does not use.
  5. Watch for drift. If the assistant starts missing earlier instructions, summarise and restart rather than repeating yourself louder.

Where does StellarFirm fit?#

StellarFirm AI Agent Assistants work through the tools you already use, and the habits above apply directly: keep the company brief short and current, give each job its own chat, and keep sends, deploys and deletes behind Approve. Less noise in the context means more of the assistant's attention goes to your actual task. To see how the assistants are organised, read what is an AI Agent Assistant.

Frequently asked questions

What is context engineering?

It is the practice of deciding everything an AI model sees while it works: instructions, tools, documents, and the history of the conversation. Prompt writing is one part of it.

What is context rot?

It describes how a model's ability to recall details can decline as the amount of text in its context grows. The decline is gradual, which is why a very long chat slowly gets less reliable.

Should I paste everything the assistant might need?

No. Give the goal, the few facts that matter, and pointers to where more detail lives. Assistants can fetch the rest when a step needs it.

When should I start a new chat?

When the job changes, or when the chat has become long and the assistant starts missing things you told it earlier. Carry over a short summary instead of the whole history.

Sources