Skip to main content
The component indexing module in Kombai is designed to enhance the Agent’s ability to reuse existing components from your codebase and external packages, significantly improving the accuracy of the generated code while reducing token usage and context window consumption. By indexing your components, the Agent can quickly identify and utilize relevant components during code generation, leading to more efficient and accurate results. It handles large number of variations and cases out of the box and saves users significant time and effort in setting up and maintaining skills for using their component libraries efficiently.

How to index reusable components in your codebase

index local components
  1. Click the icon in the chat input box.
  2. Click icon located at the top-right of Current tech stack.
  3. Switch to the Component Indexing tab.
  4. Click Add Index button on the top-right.
  5. Click Local Components button in the newly opened modal.
  6. Browse and select the components folder from your workspace.
  7. Continue and start indexing.
Once all the components are indexed, they will appear in the UI as accordions. Click on an accordion to view the component’s description.

How to index external npm packages

index external packages
  1. Follow steps 1-5 of Index local components.
  2. Click External Package button in the newly opened modal.
  3. Select a folder on your machine that contains the private package source and continue. If your private package is a git repository, switch to Git Repository tab, add repo URL, branch, and continue.
You need to be on a Team plan to index external packages.
Once all the components are indexed, they will appear in the UI as accordions. Click on an accordion to view the component’s description.

How It Works

1
During the indexing phase, an agent traverses the component folders to locate relevant files and reusable components are identified directly from the directory tree.
2
Further, a swarm of subagents briefly read each component to identify the context in which the component must be used.
3
The subagents identify import paths and subpackages for uniquely identifying each component.
4
Once the indexing is complete, the Agent invokes a specialized subagent which can identify potentially relevant components based on the use cases identified during the indexing process.
5
When a user sends a query, the main Agent passes the requirement to this subagent which then discovers potentially relevant components. In most medium to large requirements, the number of these components can be quite large.
6
The Agent then offloads the discovery and detailing process to the another specialized subagent which only read and analyze the files relevant to the user’s current task.
Each subagent utilizes models and tools tuned to save time and tokens for their specific task. The results are cached to accelerate subsequent queries. This process allows the main Agent to avoid processing extra files and significantly reduces token consumption and fatigue. We have observed agents on an average need to read almost 3 files per component to identify its props and visual tree, which can quickly add up to tens of files for medium to large requirements. In our testing with several large codebases, we have observed up to 80% reduction in token usage and context window consumption compared to approaches relying on grep, vector indexes or raw agent search.

Higher component reusability

Component indexing improves the Agent’s accuracy in reusing existing indexed components.

Lower token usage

Subagents match relevant components during indexing, allowing the main Agent to avoid processing extra files and significantly reducing token consumption.

Speed

Caching enables repeated or related queries to be handled nearly instantaneously by retrieving data directly from memory.

Contextual accuracy

Indexing provides the Agent with a comprehensive component map before processing a query, improving the quality of the initial context.

Reduced iterations

Users typically require fewer follow-up messages or corrections to complete tasks compared to using standard grep and raw agent search.

Visual attributes

Component indexing captures the layout, styling, and behavior of each component, which is difficult to extract through grep and raw agent search alone.

Deeper research

Subagents are categorized according to each phase of the component indexing process to ensure deeper, more granular research of each component’s attributes.

Lower computational burden

Subagents handle the computational load of indexing and matching components, leaving the main Agent free to focus entirely on the user’s primary task.