Search krep

Koder Krep — engines/search/krep

Modern search engine and CLI for the Koder Stack — a from-scratch grep replacement with text, structural, and record search modes.

Role in the stack

Area Sector Consumers
engines/search/ (new) krep /k-search, /k-housekeep, /k-audit-landings, /k-evolve (planned, in adoption order)

Primary couplings

Module Nature
engines/lang/lang/ runtime — Krep engine compiled in Koder Koda Native AOT; depends on KL SIMD codegen (AVX2/SSE on x86_64)
policies/reuse/search-tooling-first.kmd governance — capability gate G4 contract
policies/self-hosted-first.kmd governance — gates G1–G5 for ripgrep/grep replacement
Future: tree-sitter (FFI) dependency — for structural mode in F4

Status

*0.1.0experimental (202605-02)*— RFC ratified, module scaffolded, F1 pending.

Feature Status Phase
Text mode (regex / literal) ⏳ pending F1
Performance parity x86_64 (geomean ≤ 1.10× rg) ⏳ pending F1
Record mode (JSONL / NDJSON / chat transcripts) ⏳ pending F2
Server mode + MCP integration ⏳ pending F3
Structural mode (tree-sitter via FFI) ⏳ pending F4
Searchandreplace + LSP + bindings ⏳ pending F5
NEON support on aarch64 ⏸️ deferred separate RFC against engines/lang/lang/

Selfhostedfirst declaration

koder.toml [self_hosted] declares:

  • *eplaces:*ripgrep, grep, ack, ag, git-grep
  • *tatus:*experimental (no gates closed yet)
  • *ates_pending:*15 — permode feature parity, permode performance,

    stability, MCP contract, structural coverage, graceful shutdown, index versioning, NDJSON output, concurrency safety, result determinism, tail-latency p99, production_proven.

Promotion path:

  1. F1 closes Gate 1 (§6.1, geomean ≤ 1.10× rg) → status stable (text case).
  2. After ≥ 3 stable releases + ≥ 2 prod consumers, Gate 2 (§6.2,

    geomean ≤ 1.05× rg) closes → status official (text case) → default flips in CLAUDE.md, Claude Code config, /k-search, /k-housekeep, etc.

  3. Each subsequent mode (record, structural) follows the same dual-gate

    logic independently.

Comparative benchmarking

/k-bench engines/search/krep runs the comparative harness against ripgrep on the pinned 500-file Koder monorepo dataset (#008a) using the pinned rg binary (#008b) and reports the four Gate 1 verdicts (geomean / maxratio / parityor-win / p99). Wrapper at tests/benchmark/perf/krep-vs-rg.sh delegates to bench/run-bench.sh (single source of truth) and reformats output as the canonical /k-bench table. Per-criterion thresholds declared in engines/search/krep/koder.toml under [testing.bench.perf].

Pinned baselines under bench/reports/pinned/ (median, N5; tail, N100).

References

Source: ../home/koder/dev/koder/meta/docs/stack/modules/search-krep.md