Moving beyond prompting
Working efficiently with agents means being able to understand how to steer it's output beyond just back and fourth prompting.
Intro
For the longest time, I always assumed that prompting was the only way to direct my agent’s output.
This is far from the case, as it turns out -- there's actually a lot of systems that exist outside of prompting -- each filing a different blind spot your agent stumbles over. Together, they fall under the incredibly important concept of context.
What is context?
Context can be thought of as a combination of situational awareness and background knowledge.
The surrounding words, text, or environmental circumstances that help explain the true meaning or significance of a specific event, phrase, or piece of information.
Setting up a fresh agent (session) is like hiring a new intern. While it has a general sense of logic and can complete easy tasks, harder more ambiguous tasks usually result in your agent falling short.
This is usually due to a knowledge gap. Your agent simply doesn't have the full picture of the project, and all the underlying "ball knowledge" that you have. Tools like system instructions, MCP servers and skills help fill in these knowledge gaps, and give the agent extra tools and resources to produce better outcomes.
System instructions
Like a rulebook, your agent reads these each time you start a new session.
Context window
Each agent stores its own context in something called the context window. Think of it like short term memory. These context windows are isolated per session, so if you start a new chat, your agent starts with a fresh context window.
Every prompt is added to the context window. That way the agent can remember what you talked to it about in the session, and reference previous prompts to help inform it each time it needs to do a task.
Each context window has a limit. As this window fills (usually via prompts), the session begins to degrade. Think of it like a desk: the more paper you pile on, the harder it is to find the one page you need.
This deterioration in performance is known as context rot. Symptoms include: missing details, forgets instructions, grabbing the wrong things, hallucinating more frequently ect..
When you hit your limit, your agent usually begins a process called auto-compaction, summarizing and preserving the previous context window to make room for new information.
You can also manually compact the context window by typing in /compact.
The more often a session is compacted, the more context the agent has to sift through, making it slower and more expensive. SOOOO instead of just using one session for everything, you should break your work into sprints.
How you prompt is still important
Prompting is always the agent's first touch point for context, since it's literally the instructions for your agent to carry out. Each time you ask it "rephrase this, summarize this, fix this code", you hand it a set of actionable instructions.
Great prompts are usually pretty specific. They can define scope, specific areas to change, and intended behavior. I'd advise not overthinking prompts too much, and to lean into tools that help improve your prompts precision.
A personal favourite of mine is Benji Taylor’s Agentation. It’s a point and click editor that grabs the code you’re pointing at, includes it in your prompt.
This is awesome, because it points out exactly where you want the change reflected in code!! (This saves the agent from needing to spend tokens to figure it out on its own)
Memory
If context window is an agents short term memory, then memory, as the name implies, is your agents long term memory (shocker).
As you work with your agents, they take note of things you like, dont like ect. They write these down in files (ie: claude.md), so that they can learn how to work with you better.
Apps like Claude and ChatGPT have memory built in, and coding agents usually keep theirs as a file in your project that they read and update.
Dreaming
We humans have a part in our brain called the hippocampus. It's in charge of processing our memories, and deciding what to remember. Anthropic published an article recently (the components of agent memory) theorizing on a similar concept for agents; called dreaming.
Currently, memory gets stale and outdated. The idea with dreaming, is that during downtime when you don't use your agent, it reads over your transcripts to understand you better and recursively update its own memory.
Kinda cool and scary right?
System instructions
System files are the literal instructions your agent reads each time it gets started within a session.
System instructions are just file(s) that your agents read before they starts working. They exist outside of any context window, which means that any information you put in it is shared across every single agent session you run. Think of it like a rulebook.
Normally, it takes the form of a .md file (ie: Design.md, Agents.md etc...)
An example of a system prompt
# Agent Guide An illustrated guide to working with AI agents. Next.js 16 (App Router) + Tailwind v4 + TypeScript. ## Commands - `pnpm dev` — dev server - `pnpm lint` — eslint, must pass before a commit - `npx tsc --noEmit` — typecheck, must pass before a commit ## Conventions - Every page is explicit JSX. No content JSON, no CMS. - Colors are hex pulled from the Figma file, never Tailwind's palette. - SVGs are inlined by hand — no icon packages, no next/image. - Animation lives in globals.css, parameterized with CSS vars (--dur, --delay, --o), and every class is listed in the prefers-reduced-motion opt-out block. ## Style - Comments explain WHY, never what the line already says. - Match the surrounding file. Don't invent a new pattern for something the repo already solves. ## Don't - Don't add dependencies without asking. - Don't reformat files you weren't asked to touch. - Don't commit or push unless I ask.
If you want your agent to always remember something, write it in a AGENTS.md file! Examples could be styling guides, rules of engagement, or even your name.
It lives either in your project's folder (if you are working within a coding project), or in your agent's own settings folder if you want it to apply everywhere. If you want to find it, just ask your agent to open it for you and show you.
Here's an example:If your system prompt says, “Please address me as Caleb whenever you speak to me,” the agent will call you Caleb in every new session (unless you explicitly tell it otherwise).
If you want to create a .md file, just ask your agent to make one for you. To edit it, get your agent to show you where it created the file, and then just edit it.
Write an AGENTS.md
Can you create an AGENTS.md file for this project? Include the commands you should run before committing, my styling conventions, and a rule that you never push without asking me first.
Skills
Skills are like system instructions but for very specific tasks. While system prompts are loaded in each time an agent starts working, skills are situationally invokedSituationally invoked means that both you or the agent can decide when a skill should actually be acted on!.
An easy way to understand skills is this analogy of swimming. When you wake up each day, you don't try and start swimming, because it's not relevant. However, if you were thrown in water, or put into a pool, your body instinctively begins treading water to stay afloat. It invokes the /swim skill!
The cool thing about skills is that both you and the agent can invoke them. You can tell the agent to use a skill by typing in a command (/find-inspiration). The agent can also understand when a skill should be invoked, and automatically invoke it by itself.
Some of my own skills include:
- /get-inspo
- searches Mobbin for design inspiration, then pastes it into Figma with the Figma MCP
- /preview-pr
- runs test flights and lint checks before I PR anything
A good rule of thumb for making something a skill is if you catch yourself having to repeat the same prompt or workflow 3+ times. It's very easy to make a skill. You can get your agent to help you:
Make a skill
Can you make a skill called /convert-temperature which takes in a {number}, and converts it from Celcius to Farrenheit, unless I specify another measurement
All the major models ship their own skills too. For example:
/code-review ultra- Claude Code releases a swarm of subagents to hunt for bugs
/deep-research- Claude Code runs a pile of searches at once and writes you a report with its sources
/review- Codex reads what you haven’t committed and flags what looks broken
/init- Codex writes an AGENTS.md for the project you’re sitting in
Model Context Protocol (MCP)
So there's this scene in The Matrix, that's like super famous. Basically, Neo, the protagonist needs to learn how to fight really well, despite being a regular dude.
Instead of training how to fight, they download like 20 bajillion martial art sets into his head, and suddenly he's a master at Kung Fu.
Connecting your agent to MCP servers is basically the equivalent to Neo downloading all those martial arts skills. Each MCP server connection comes with instructions on how to use the app, aswell as giving your agent abilities native to said app. This increases the versatility of your agents abilities.
For example, if I connect the doordash MCP, I can ask my agent to order food on my behalf. If I connect the Figma MCP, my agent can both pull files from Figma, and write to Figma.
There are a lot of MCP servers out there. Usually to connect them, you can type in /mcp, or you can just ask your agent to help you.
Only connect MCP servers you actually intend to use. Each one connected still introduces additional definitions and context into an agents context window -- and having too many can confuse your agent on when to invoke/not invoke them.
Find MCP servers to connect
Based on what you know about me and my previous sessions, suggest some MCP servers that I could connect to. If you Don’t know anything, give me a table of the top 5 most popular MCP servers and a short 10-20 word use case to help me calibrate my decision.
Exercising Restraint
Just like it's not great to attach too little context, attaching too much can be just as detriment, and result in overwhelm your agent.
Fundamentally, understanding how to partition out context on a systematic level, and leveraging each of these different forms (system instructions, prompts, MCPs) etc, can save you a lot of token spend when your agent runs in circles.
You shouldn't be attaching every single MCP, you shouldn't be filling your system prompts, and you shouldn't just be creating a crap ton of skills. Be intentional and prescriptive with all the context you fill your agent with, and it'll brew great results.
(Exercise restraint.)