Skip to content

Bug: Knowledge Base include/exclude patterns not applied during indexing (v1.27.3) #6506

@isune-coder

Description

@isune-coder

Bug Description

Both include_patterns and exclude_patterns from agent config and global settings are ignored during KB indexing. The resulting contexts.json always shows empty arrays, causing all files to be indexed.

Steps to Reproduce

  1. Set knowledge.defaultExcludePatterns in ~/.kiro/settings/cli.json:
"knowledge.defaultExcludePatterns": [".obsidian/**", "Attachments/**"]
  1. Set include in agent knowledgeBase resource config (~/.kiro/agents/sa-agent.json):
{
  "type": "knowledgeBase",
  "source": "file:///path/to/vault/",
  "include": ["**/*.md"],
  "autoUpdate": true
}
  1. Start chat session, KB auto-indexes
  2. Check ~/Library/Application Support/kiro-cli/knowledge_bases/*/contexts.json
  3. Observe include_patterns: [] and exclude_patterns: []

Expected Behavior

  • Agent config include: ["**/*.md"] should limit indexing to .md files only
  • Global knowledge.defaultExcludePatterns should exclude matching directories
  • contexts.json should reflect these patterns

Actual Behavior

  • contexts.json shows: "include_patterns": [], "exclude_patterns": []
  • 478 unique files indexed (expected ~285 .md files)
  • 187 files from .obsidian/ directory included (should be excluded)
  • Non-.md files indexed: .ts(72), .json(40), .js(14), .css(12), .pdf(6), .sh(3), .mjs(2)

Environment

  • Kiro CLI: v1.27.3
  • OS: macOS
  • Index type: best

Notes

This was working in a previous version. The regression likely occurred in a recent update where the pattern fields are no longer passed through to the indexing engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions