Skip to main content

Component indexing

Kombai indexes your codebase to understand your team’s specific tech stack, coding patterns, and component structure. It uses Agent Swarm methodology where multiple agents work together to perform specific tasks that are required to index your components. This helps Kombai to generate code that matches your conventions and fits perfectly into the existing codebase. Component indexing indexes your local codebase components and external packages to improve the accuracy of the Agent using the indexed components while generating code.

How It Works

When you start the component indexing process, the following steps are performed:
1
Subagents traverse component folders to locate relevant files and generate a formatted directory tree.
2
Reusable components are identified from the directory tree.
3
Subagents run a deep research of each component to understand its function, props, use case, visual layout, and file references.
4
Component descriptions are created based on the research results.
Upon receiving a user query, the Agent will:
1
Pass the query to a subagent to fetch all component descriptions from the index and find the most relevant ones.
2
The main Agent performs detailed analysis by reading the source files of the matched components.
Now, the Agent will have a higher likelihood of using the correct indexed components while generating code. For faster response times, the results are cached to accelerate responses for subsequent queries.

Benefits over Vector DB

Higher component reusability

Component indexing improves the accuracy of the Agent to reuse the indexed components rather than creating duplicate ones.

Lower token usage

Subagents match relevant components during indexing, allowing the main Agent to avoid processing extra files and significantly reduce 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 query processing, improving the initial context quality.

Reduced iterations

Users need fewer follow-up messages or corrections to complete tasks compared to Vector DB.

Visual attributes

Component indexing captures layout, styling, and behavior of each component, which is difficult to extract through Vector DB alone.

Deep research

Deep research on each component allows the Agent to distinguish between components with similar use cases and select the correct one for each task.

Lower computational burden

Subagents share the computational baggage of indexing components and matching the relevant indexed components after receiving the user query, so the main Agent only handles the user task workload.

Tech stack identification

First-time indexing

When you use Kombai in a repository for the first time, the indexing process runs automatically to detect the tech stack in use. Kombai then shows a Proposed tech stack box that groups detected technologies by category. For example, React under Project Type, shadcn under Component Library, and Redux Toolkit under State Management.

Manual indexing

If your project has changed significantly since the last time you used Kombai in this repo (for example, major architectural changes or a tech stack migration), the initial indexing may no longer be accurate. In those cases, ask Kombai to scan the codebase again to find the updated tech stack. Kombai will rescan the repository and show the Proposed tech stack again based on what it detects.