The author shares that replacing pre-injected context with a search tool the agent calls on-demand, backed by structured documents in OpenSearch, greatly reduced agent errors and improved traceability.
tl;dr Don't inject custom context basis user query/RAG/etc. into prompt, make agent search it with a tool with params (query, filter, search_type, temporal, limit). It was the single biggest lever to bring control on using the agent.. I build AI agents at my company, and initially, our context layer was obsidian stlye skills markdown files folders, cross-links. We would initially do vector search / RAG and inject the context alongside prompts. We used to see repetitive challenges there and we went down rabbit hole trying to fix it.. What kept breaking: Context poisoning / digression. Once we were past ~50 markdown files, the agent would wander between docs and pick up instructions that had nothing to do with the task. We tried building explicit navigation paths and interlinking everything, but it didn't help much. No source proof. As the knowledge base grew, we couldn't reliably say which piece of context drove a given action. Users won't trust an agent that can't show its work. What actually worked for us: Structured docs instead of markdown. We moved context into JSON / structured documents. Agents navigate way better when things look like code. We had about 10-12 document types and then each type had 5-8 fields within them Make the agent search, don't spoon-feed it. Instead of pre-injecting context, we gave it meta-info about what context exists and made it responsible for searching and discovering the right pieces (tool-based search capability for the agent rather than us running RAG/prompt expansion upstream). For search, we created a tool search_resources that would run queries on the opensearch index in which the structured docs were stored - the tool we created had 5 parameters: * query - Select the query it wants to run * filter - Filter by specific type of documents * search_type - Define search type (semantic / syntactic) * temporal - Add temporal True/False if your data has time based staleness * limit - number of responses it receives in return If you're doing something similar, what's your experience been? What else is working great for you?
The article argues that better semantic search or larger context windows won't fix unreliable AI agents; instead agents must verify retrieved context by reopening the original source before answering or acting.
A developer shares that reducing an agent's context window by half unexpectedly improved its performance in lead qualification and CRM automation, suggesting that too much context can hide bad architecture and lead to indecision.
This article discusses a technique for reducing context bloat in AI agents by decoupling the planning phase from execution, improving agent efficiency and accuracy.
This paper evaluates context engineering configurations for LLM agents in enterprise tool-use workflows, showing that summarization with selective pruning achieves 91.6% accuracy while reducing token usage by over 60% compared to full-context baselines.
The author introduces AICTX, an open-source tool that preserves structured operational state across coding agent sessions, reducing the need for agents to rediscover repository context each time.