of your AI coding agent is important to its efficiency. It’s doubtless one of the vital vital elements figuring out what number of duties you possibly can carry out with a coding agent and your success charge in doing so.
On this article, I’ll talk about particular methods I exploit to enhance the context of my AI brokers. I’ll clarify particularly how I do it, and why. It’s necessary to know why I’m utilizing these methods, so you can begin creating your personal methods sooner or later, and actually optimize your agentic coding.

Desk of Contents
Why optimize agentic context
The context you present your coding agent is all the data it has to finish a process. Thus, correctly managing your context is extremely necessary in order for you your coding agent to work effectively.
Enhancing your context by a couple of p.c can have a large affect in your effectivity as an engineer should you spend many hours every day programming. I thus spend numerous time, continuously making an attempt to optimize my programming with my coding agent.
The 4 methods I’ll current within the subsequent part are a results of my testing all kinds of various methods and approaches. On this article, I’ll solely cowl 4 of crucial methods and why they work so effectively. Sooner or later, I may also cowl some failed methods and replicate on why they didn’t work
4 particular methods
On this part, I’ll cowl 4 particular methods I make the most of to optimize the context for my coding brokers. I’ve written the methods in no explicit order, and I think about all of them necessary to me in my quest to be as environment friendly an engineer as potential.
At all times replace AGENTS.md
Most likely crucial method I exploit is to continuously replace the AGENTS.md file. Continuous studying continues to be an unsolved downside for LLMs, thus we have to provide you with our personal options to make coding brokers bear in mind our preferences.
I’ve written a guidelines file for my coding agent, which specifies some preferences I’ve:
- At all times write Python 3.13 syntax if utilizing Python
- By no means use the Any sort
- At all times use varieties and docstrings for features
These are preferences I’ve throughout all of the repositories I contact, and which I thus all the time need my agent to observe. I like to recommend spending time reflecting by yourself coding guidelines and specifying them to your agent.
Moreover, every time my coding agent makes an error, I assist it appropriate the error and inform the agent to recollect the repair in AGENTS.md. This makes positive the agent avoids this error sooner or later, and easily makes the agent quicker and extra environment friendly.
When you proceed doing this over time, you’ll discover the agent changing into considerably higher and more adept at performing the duties you ask it to carry out. This might be:
- Implementing new options
- Fixing bugs
- Checking manufacturing logs
This works so effectively since you’re offering your coding agent with the required context that you simply possess, however you by no means wrote down. By informing the coding agent in AGENTS.md, you present the mannequin important context for downside fixing.
Observe that you should use any Markdown recordsdata that you simply desire. Claude Code makes use of CLAUDE.md, Warp makes use of WARP.md, and Cursor makes use of .cursorrules. Nevertheless, I discover that almost all coding brokers all the time learn AGENTS.md, which makes it an excellent file identify to retailer agentic reminiscence in.
Present documentation hyperlinks
One other tip is to supply related documentation hyperlinks to the mannequin, or to explicitly inform the mannequin to search out documentation on-line by means of an online search.
I generally discover that my coding agent is utilizing outdated syntax, for instance, when interacting with the OpenAI API. In these situations, I present the mannequin a hyperlink to the most recent OpenAI documentation and inform it to base its code on this.
The issue of coding brokers utilizing outdated code usually happens as a result of LLMs have a deadline, which essentially have to be earlier than the mannequin was carried out coaching. The cutoff date for any given mannequin might be over a 12 months in the past, by which numerous API documentation has modified. Thus, it’s essential to ensure the mannequin makes use of the most recent out there documentation by offering it with hyperlinks to those docs.
Coding brokers usually makes use of outdated code due to the mannequin information cutoff. The repair to this downside is to supply the brokers with the most recent API documentation
Present IaC stack as context
One other method I make the most of is to supply details about my infrastructure as code (IaC) stack as context to my coding agent. That is extremely helpful when utilizing an agent to take a look at manufacturing logs (which you must do).
I began utilizing this method after I seen my agent was spending numerous time discovering data, such because the names of my database tables. For instance, if the agent wished to search out data from a desk, it first needed to record all tables, guess which desk is related, and check out it. If it failed, it must attempt a distinct desk.
This takes numerous time and tokens, costing you each effectivity and cash, and is thus one thing you want to keep away from.
To supply my agent with all of the IaC context, I had an agent undergo the entire related IaC repositories and create a single Markdown file containing all related context, for instance, the names of all my database tables. I then present this file as context to my coding agent every time it’s related.
New threads on a brand new context
One other easy method I make the most of is to begin new threads every time I’m coping with new contexts. For instance ,if I simply completed implementing a brand new function, and now wish to repair a bug, I nearly all the time begin a brand new thread in Cursor.
The reason being that when implementing the brand new function, the mannequin shops numerous context that’s fully irrelevant to fixing the bug. This not solely fills up the mannequin context, however may act as noise, distracting the mannequin from extra related data.
Thus, every time you possibly can, you must make certain to begin new threads every time altering contexts. This might be after you applied a brand new function, and wish to repair a bug. Or after you fastened a bug, and wish to take a look at manufacturing logs together with your agent.
This works effectively as a result of the necessary context that ought to be saved throughout threads is saved in AGENTS.md, as I mentioned in an earlier part.
Conclusion
On this article, I’ve lined 4 particular methods I make the most of to optimize the context of my coding brokers. Using these methods makes me a considerably extra environment friendly engineer, as a result of my coding brokers can work rather more effectively. I like to recommend making an attempt out these methods for your self to search out out in the event that they work effectively for you. Moreover, I like to recommend experimenting with new methods and approaches your self, which may make you simpler. Everytime you discover your coding brokers are unable to do one thing, you must instantly begin ideating and enthusiastic about easy methods to make them capable of carry out such duties.
👉 My Free Assets
🚀 10x Your Engineering with LLMs (Free 3-Day Electronic mail Course)
📚 Get my free Imaginative and prescient Language Fashions e-book
💻 My webinar on Imaginative and prescient Language Fashions
👉 Discover me on socials:
📩 Subscribe to my e-newsletter
🧑💻 Get in contact
✍️ Medium
















