The brief
AI agents often struggle with context and understanding of the broader codebase. Through testing, we discovered that AI agents use less tokens over the course of a conversation if at the start of a conversation, they are given a high level overview of the codebase and the task at hand. Ambiance CLI/MCP tools provide a roadmap of relevantcontext that helps agents understand the query context to avoid hallucinations and duplication of efforts. Initially conceuptualized as a user driven tool, expanding the tool to agent usage via MCP, CLI and Agent Skills was a natural evolution.
The approach
- Provide RAG based semantic understanding of the codebase to AI agents.
- Compact context to reduce token usage while pointing agent to relevant code chunks.
- Maintain local embeddings for fast semantic search.
- Use AST (Abstract Syntax Tree) and grep chunking to return semantically relevant code chunks.
- Build an MCP server for universal compatibility.
- Extend to CLI to reduce context usage and allow users to query the codebase directly.
- Extend to Agent Skill to allow AI agents to implement tool use as needed.
- Analyze file relationships and project structure.
Discoveries
- Agents perform better with big picture context and the right tools like AST/Grep and Embeddings
- MCP while initially simple, places use instructions in the most important location in the context window.
- Agents are great at using the terminal and CLI tools. Giving them Agent Skills allows them to expand their capabilities on demand.
The result
A seamless way for AI to navigate and understand complex repositories, improving code generation and debugging.