Concrete Practices for 'Context Engineering' in AI-Driven Development - Cited from Manus
Hello, I'm Nagi.
On this account, I mainly post articles about insights gained from developing products and information regarding the latest AI.
This article is intended for individual developers, engineers, and those who love AI (LLMs), and I believe it contains information useful for AI-driven development (Vibe Coding).
Specifically, based on the blog “Context Engineering for AI Agents: Lessons from Building Manus” published by Manus on July 18, 2025, I will explain context engineering and its concrete application methods that we, as AI users, should know, with the goal of enabling you to understand and utilize them even without specialized knowledge.
Cited Article: Context Engineering for AI Agents: Lessons from Building Manus
What is Context Engineering?
In recent years, the term “prompt engineering” has become common in conversations about AI. This is a technique for refining individual instructions to determine what kind of “prompt” should be given to an AI to elicit a more accurate answer.
In contrast, “context engineering” is a broader approach with a long-term perspective.
Rather than thinking only about individual instructions (points), it refers to the technique of strategically designing and managing the entire dialogue (lines and planes), such as the flow of conversation, background information, and the prerequisites that should be given to the AI.
“Prompt engineering” focuses on refining the text conveyed to the AI, but it might be easier to understand “context engineering” as focusing on the environment in which the AI is used, in addition to prompt engineering.
Concrete Problems That Can Be Solved
Have you ever experienced the following while doing AI-driven development?
Error loops: “Error 1” appears, and by asking the AI to fix it, it becomes “Error 2,” but when you ask for a fix in the same way, “Error 1” reappears, and the errors continue to loop.
Not using tools: Even though you tell the AI the name of the tool you want it to use, it generates irrelevant answers without using the tool.
Ignoring instructions: When you ask for several tasks at once, it ignores part of the instructions or performs unrelated implementations.
These frustrations regarding AI implementation and behavior are not so much because the AI's capabilities are low, but rather because of a mismatch between the unique “mechanisms” the AI possesses and our “way of conveying information.”
Context engineering is a way of thinking to resolve this mismatch and make the AI smarter and operate as intended.
By knowing this, we can understand the strengths and weaknesses of AI and proactively assist it. As a result, we can reduce the frustrations mentioned earlier, help the AI deeply understand the intent of our instructions, and decrease the causes of stress in AI-driven development.
The Main Reason AI Forgets Conversations
The fundamental cause of the problems mentioned earlier lies in the unique “memory mechanism” that AI possesses.
We humans organize vast amounts of past experience and knowledge into mental drawers, retrieving them when needed to think through things. However, the way AI remembers is a bit different.
AI performs all its thinking within a limited working memory (similar to capacity in short-term memory) called a "context window".
The image is that this short-term memory stores the entire conversation history, provided prompts, and all materials, and uses them to generate the next words or code.
Because of this mechanism, when the "short-term memory" becomes full due to long dialogues or providing too much information, content that cannot be remembered or memories that are forgotten occur, just as with humans.
Performance degradation:
This is the biggest problem. Just as humans forget the first words they learned when they finish reading a vocabulary book, AI also has a tendency to easily forget instructions written at the beginning or middle of a conversation, which directly leads to "ignoring instructions" or "misreading context".Slower response speed:
Because it goes through everything in its short-term memory before starting a task, the more content it has memorized, the slower the AI's response speed becomes.Increased costs:
When using AI via an API, charges are incurred based on the amount of AI usage. In other words, blindly continuing to provide information also leads to increased development costs. Additionally, services like the Claude Code Max plan are more likely to hit rate limits.
In this way, simply continuing to provide information blindly can actually confuse the AI and lower its performance.
Techniques to "Remind" the AI
There are broadly two types of approaches.
The first approach is to actively help the AI "remind" itself so that it does not forget important information. Because the context is limited, we re-input important information to ensure consistency in the AI's output.
Concrete Techniques
1. ToDo list (- [ ] → - [x]):
When asked to perform complex implementations or multiple tasks at once, AI often gets confused about where to start, leading to "ignoring instructions."
To prevent this, it is extremely effective for us to act like a manager and provide instructions as a bulleted "ToDo list". AI recognizes this as a clear roadmap and completes tasks one by one, which dramatically reduces omissions.
Sometimes, it checks off the "ToDo list" only after finishing all the work, so I include instructions like "check off after completing one action."2. Feedback on "failure records":
The biggest cause of error loops is that the AI does not understand "why that error occurred" and repeats ad-hoc fixes.
By having the AI read records summarizing error content and the solutions used at that time to provide it with pseudo-learning experience, you can reduce the frequency of repeating the same mistakes.
In the case of AI-driven development, it is easier to manage if you compile such records into a single file and have it reference that.3. "Re-input" important information:
In the middle of long development tasks, there are many cases where AI, like humans, forgets the initial purpose and constraints.
If you feel the conversation has become long, try re-inputting important information, such as "The purpose is XX, the means is YY".
This allows you to remind the AI of important content and maintain consistent output.
Also, some recent services offer "context compression" as a standard feature, so using that function is one option. Using this resolves the prerequisite of a long conversation history, making it less likely for performance to degrade.
At first glance, these techniques appear to increase the amount of information given to the AI and pressure the context. However, by preventing detours and rework, they ultimately reduce the total amount of dialogue and suppress performance degradation.
Approaches to "Reduce" unnecessary information
The other approach is the opposite of the previous one. To help the AI perform at its best, we help it by strategically "reducing" unnecessary information that becomes noise in its thinking, allowing it to focus on the task.
The referenced article points out the problem where if you show an AI agent too many tools (functions) at once, the context gets filled with their descriptions, causing the AI to get confused and its performance to drop.
This is very similar to the phenomenon where humans get lost on what to do when there are too many choices.
To solve this problem, the development team of the original article uses a technique called 'tool masking'.
This is a very clever approach where, instead of showing all tools to the AI at all times,only the necessary tools are presented according to the situation, and unnecessary ones are hidden.
While we can rarely manipulate the inside of an AI directly,the concept of 'narrowing down choices so as not to confuse the AI' can be applied to daily prompts.
Concrete Techniques
1. Break down tasks:
There are many cases where an AI gets confused about which tool to use when trying to perform different types of tasks simultaneously, such as 'writing code,' 'searching the web,' and 'manipulating files.'
Therefore, by requesting one by one bysearching the web for the cause of the error first and thenmodifying this file based on that cause,dividing instructions by tool (function) category and requesting them one by one, the user performs 'tool masking' on behalf of the AI, allowing the AI to focus on the task at hand.
In principle, this method is
almost the same approach as the 'To-Do list' introduced earlier. It might be more realistic to stick to one or the other.2. Clearly specify the functions you want it to use:
Instead of vaguely asking 'fix this bug,' use a method ofusing XX (actual tool name) to find a solution to this error message and tell me the three most likely ones, therebyclearly specifying which tool you want it to use.
This allows the AI to completely avoid the cost of wondering 'which tool should I use,' making it easier to avoid problems like 'not using the tool.'3. Assign a role (persona):
When you give it a specific role, such as 'You are a Python programmer who is good at file manipulation,' the AI reduces its attention to tools unrelated to that role (e.g., web search) and focuses its thinking on writing code or handling files.
This is also an effective technique for effectively narrowing down the AI's thinking options and increasing the accuracy of specific tasks.
In environments where you can set system prompts or custom prompts, it is often optimal to describe it there.
More Advanced Techniques
-
4. Present only the necessary tools according to the situation and hide unnecessary ones:
This is the most direct and powerful approach.
Here, as an example of a tool, we assumeModel Context Protocol (MCP).
There may be other methods, but the following methods can be considered as concrete means.Recommended: Change the disabled status of the MCP server registered in the service from false to true
Not recommended: Delete the tool (The cited article states that it is better to keep it as masking because if you delete the tool completely, you will not be able to respond if you need that information later.)
Example (JSON file)
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
],
"disabled": false
}
}
}Summary
In AI-driven development, the cause of frequent complaints was the limit of the 'context window' that AI has, which is the short-term memory for humans.
And we have looked at two approaches to dealing well with that constraint.
Deliberately 'providing' information
By breaking down tasks or specifying the tools to be used, you can remove noise that confuses the AI and prevent context compression caused by tools.'Reducing' unnecessary information
By breaking down tasks or specifying the tools to be used, you can remove noise that confuses the AI and prevent context compression caused by tools.
If the AI falls into an error loop or ignores your instructions in the future, please try referring to the specific techniques based on the two perspectives introduced in this article.
Also, if you would like to know more details, please read the source of this article, 'Context Engineering for AI Agents: Lessons from Building Manus'.
Cited article: Context Engineering for AI Agents: Lessons from Building Manus
Definitions of terms and knowledge
Manus: A service providing a general-purpose AI agent developed by the Chinese startup 'Monica'.
Context Engineering for AI Agents: Lessons from Building: A blog post written for those building their own AI agents, detailing the Manus project's focus on context engineering, providing expert commentary, and explaining how to apply context engineering to LLMs, along with important considerations.
