kiro-cli guide — CLI Guide ▶ Playground
Advanced Automation

Knowledge Bases

Index code, docs, and PDFs into a knowledge base for semantic search, and tune indexing behavior with settings.

A knowledge base lets you index a big pile of content (code, Markdown, CSV, PDF, and so on) all at once. After that, Kiro can run semantic search over this content, and it sticks around across sessions.

Turn the feature on first

kiro-cli settings chat.enableKnowledge true

It takes effect after you restart chat.

Using it in a conversation

A knowledge base is managed with the /knowledge slash command. Common actions look like this:

/knowledge            # See which knowledge bases you currently have

You can also just ask Kiro in natural language to do it for you, for example:

❯ Add the ./docs folder to the knowledge base
❯ Search my knowledge base for "database connection settings"
❯ Update the index of the docs knowledge base
TIP

Not sure which subcommands live under /knowledge? Type /help in the conversation to take a look, or just say what you want to do in natural language and let Kiro call it for you.

Tuning indexing behavior (settings)

Any preferences related to indexing can be configured with kiro-cli settings:

# File patterns to include / exclude when indexing (JSON arrays)
kiro-cli settings knowledge.defaultIncludePatterns '["**/*.md","**/*.ts"]'
kiro-cli settings knowledge.defaultExcludePatterns '["**/node_modules/**"]'

# Max number of files to index
kiro-cli settings knowledge.maxFiles 5000

# Text chunk size and overlap
kiro-cli settings knowledge.chunkSize 1024
kiro-cli settings knowledge.chunkOverlap 128

# Index type: fast (BM25 keyword) or best (semantic)
kiro-cli settings knowledge.indexType best
SettingDescription
knowledge.defaultIncludePatternsFile patterns to include in the index
knowledge.defaultExcludePatternsFile patterns to exclude
knowledge.maxFilesMax number of files to index
knowledge.chunkSizeSize of each text chunk
knowledge.chunkOverlapOverlap between text chunks
knowledge.indexTypefast (BM25) or best (semantic)

When to use it

  • The project is large and you want Kiro to quickly find the relevant passages
  • You have a batch of reference docs, specs, or PDFs you want Kiro to be able to look up anytime
  • You want to keep “background knowledge” around across many conversations
!

Indexing a huge pile of files takes time and resources. It’s better to first narrow the scope with includePatterns / excludePatterns, and conveniently exclude things like node_modules and dist.

In the next chapter, let’s look at how to bring external tools in using MCP.