bc-grepai-configurator

Caution

grepai without a tuned config wastes cycles and returns noise. Default chunking is too small for Java/Kotlin, hybrid search is off, and test files compete with production code in results. Parallelism defaults may trigger the Ollama concurrency bug and stall indexing silently.

Tip

Trigger the agent with natural language. Say "configure grepai" or "setup grepai index" and it handles the rest — infrastructure check, language detection, config generation, MCP wiring, and verification. Assumes grepai and Ollama are already installed.

Quick reference

FieldValue
Modelopus
ToolsRead, Write, Edit, Bash, WebFetch, Glob, Grep
Permission modeacceptEdits
Triggers”configure grepai”, “grepai config”, “analyze for grepai”, “setup grepai index”
ScopeConfig generation only — does not install grepai or Ollama

When to use

  • New project — generate .grepai/config.yaml from scratch after cloning or creating a repo
  • Wrong search results — test files outranking production code, or queries returning unrelated modules
  • Language mismatch — chunking and trace settings need tuning after adding Java/Kotlin to a JS/TS repo
  • After embedder switch — switching from bge-m3 to mxbai-embed-large requires a full index reset
  • MCP not wiredgrepai_search tool missing from Claude Code after installation

Examples

configure grepai
setup grepai index for this Spring Boot monorepo
analyze for grepai — I have embedded SQL in JDBC repositories

Flow

  1. Infrastructure check

    Verifies grepai binary, Ollama daemon, and the bge-m3 embedder model. Stops with a clear error if any component is missing — no partial config written.

  2. Project analysis

    Runs Glob and Grep in parallel: detects build files (pom.xml, build.gradle, package.json), test directories, generated code paths, and embedded SQL patterns. Produces a structured analysis used in the next phase.

  3. Config generation

    Writes .grepai/config.yaml with language-tuned chunking, search boost rules (penalties for tests/generated code, bonuses for core/main), hybrid search for JVM stacks, and trace settings scoped to detected extensions only. Strips watch.last_index_time to avoid the index-skip bug.

  4. MCP wiring

    Checks for an existing grepai MCP entry in .mcp.json (project) or ~/.claude.json (global). If missing, shows the exact JSON block and the one-liner: claude mcp add grepai — grepai mcp-serve.

  5. Verification

    Confirms config exists, runs a test search, checks index size, and reports MCP status. Prints an indexed summary table — infrastructure, analysis, config settings, and next steps.

Internals — config.yaml template + phase details

Generated config.yaml skeleton:

version: 1

embedder:
  provider: ollama
  model: bge-m3
  endpoint: http://localhost:11434
  dimensions: 1024
  parallelism: 1          # Always 1 — Ollama concurrency bug #12591

store:
  backend: gob

chunking:
  size: 512               # 768-1024 for Java/Kotlin
  overlap: 50             # 75-100 for Java/Kotlin

watch:
  debounce_ms: 500
  # last_index_time: NEVER include — causes file-skip bug

search:
  boost:
    enabled: true
    penalties:
      # Tests: 0.5, Mocks: 0.4, Generated: 0.4
    bonuses:
      # Main source: 1.1, Core/domain: 1.2
  hybrid:
    enabled: false        # true for Java/Kotlin
    k: 60

trace:
  mode: fast
  enabled_languages:
    # Only extensions detected in Phase 2
  exclude_patterns:
    # Test file patterns from Phase 2

update:
  check_on_startup: false

ignore:
  - .git
  - .grepai
  # Project-specific from .gitignore analysis

Embedded SQL detection (Phase 2): Grep pattern JdbcTemplate|NamedParameterJdbcTemplate|@Query|String sql|"""\s*SELECT → sets HAS_EMBEDDED_SQL. When true, adds a warning header to config.yaml and the verify phase runs grepai trace callers instead of trace_graph to avoid the 2000+ false-edge explosion.

Chunking by stack:

Stacksizeoverlap
Java/Kotlin (Spring, JPA)768–102475–100
TypeScript (React, NestJS)512–76850–75
JavaScript (Node)51250
SQL migrations38440

Embedder options:

ModelDimsRAMBest for
bge-m3 (default)10241.5 GBMultilingual
mxbai-embed-large10241 GBEnglish, max accuracy
nomic-embed-text768500 MBFast, small repos
🔍

grepai skill

The /brewcode:grepai skill that orchestrates setup — calls this agent as part of its flow.

🔗

GitHub source

Agent definition, phase instructions, and config reference.

📄

Brewcode overview

Full brewcode plugin — skills, agents, and the infinite task execution loop.

Updating plugins

Use /brewtools:plugin-update to check and update the brewcode plugin suite in one command. See the FAQ for details.