CODE INTELLIGENCE FOR AI AGENTS · 2026
Krolik gives
AI agents eyes
that grep never had.
Tree-sitter ASTs across 13 languages, an Apache AGE knowledge graph,
and a live observability bridge from Prometheus alert to
file:function in 5 seconds. 28 MCP tools, plus two
optional Rust companions — ox-embed-server (ONNX embeddings +
cross-encoder rerank + SPLADE) and ox-codes
(deeper dead-code / health). Open source, top to bottom.
- Languages
- 13
- MCP tools
- 28
- Install
- 5 min
KNOWLEDGE GRAPH
What Krolik sees.
Your code as a property graph, indexed for agents. Every symbol, every call edge, every import, every test relationship. Queried in natural language via Cypher.
debug_investigate
From Prometheus alert
to file:function in 5 seconds.
Six-phase async pipeline: failure spikes, Jaeger failed traces, symbol resolution, callgraph walks upstream and downstream, log excerpts, LLM fusion. Returns ranked hypotheses with body excerpts. No one else does this.
semantic_search
Find by concept.
Not by keyword.
Hybrid retrieval: BM25F lexical scoring, pgvector 768-dim embeddings, one-hop AGE graph expansion, ColBERT cross-encoder reranker. Finds what grep can't describe.
- auth.ValidateToken auth/token.go:142 ctx.Deadline() exceeded before JWKS fetch completed — timeout not propagated
- middleware.AuthChain auth/middleware.go:88 calls ValidateToken without context timeout guard
- jwks.FetchPublicKey auth/jwks.go:61 HTTP client uses default transport, no deadline
- server.handleAuth server/routes.go:207 auth handler called with request context
- TestValidateToken_Timeout auth/token_test.go:89 test exists but uses 30s timeout — too lenient
- config.AuthTimeout config/auth.go:34 timeout constant: 0 — not set
- cache.TokenStore cache/tokens.go:19 in-memory LRU, TTL-bound
- errors.ErrAuthFailed errors/auth.go:8 sentinel error used in 4 callers
- retry.WithBackoff retry/retry.go:44 exponential backoff, used by JWKS fetcher
- otel.RecordError telemetry/spans.go:91 helper for span error annotation
Cypher via
natural language.
Apache AGE property graph on PostgreSQL. Every symbol, call edge, import, route handler, test relationship. Query the graph from plain English: Krolik translates to Cypher and returns structured results.
MATCH (caller:Symbol)-[:CALLS]->(fn:Symbol)
WHERE fn.name = 'ValidateToken'
AND fn.package = 'auth'
OPTIONAL MATCH (fn)-[:TESTED_BY]->(test:Symbol)
RETURN caller.name,
caller.file,
caller.line,
test.name AS test_coverage
ORDER BY caller.file; dataflow_analyze + rewrite
Taint tracking.
Structural codemods.
IL/CFG analysis traces values from source to sink. Detects dead stores, unescaped user input reaching SQL or command execution. Rewrite applies AST search-replace patterns across all 13 languages with wildcard matching, survives multi-line code that regex can't touch.
return errors.New(msg)
return fmt.Errorf("%s: %w", msg, err)
return nil, errors.New(queryErr)
return nil, fmt.Errorf("query: %w", queryErr)
return errors.New(cacheErr)
return fmt.Errorf("cache: %w", cacheErr)
... +244 more errors.New($MSG) → fmt.Errorf("%s: %w", $MSG, err) positioning
Where the tools live.
grep sees text. LSP sees one file's types. Sourcegraph indexes repos for humans. Datadog sees runtime metrics. Krolik sees all four layers simultaneously, for agents. No one else is in that quadrant.
quickstart
Five minutes from clone
to first MCP call.
Just an LLM endpoint and you have repo analysis, call tracing, structural rewrite, dataflow, and PR review.
Add Postgres + AGE for code_graph;
ox-embed-server + pgvector for semantic_search and code_research reranking;
ox-codes for stricter dead_code + full code_health grades.
Redis is just an L2 cache. All companions are open source.
$ docker compose -f krolik.yml up -d
Starting go-code ... done
$ curl -X POST http://localhost:8897/mcp \
-H 'Content-Type: application/json' \
-d '{"tool":"semantic_search","query":"auth context deadline bug"}'
→ 12 results in 380ms Frequently asked
questions.
What languages does Krolik support?
Go, Python, TypeScript, TSX, Rust, Java, C, C++, Ruby, C#, PHP, Svelte, and Astro — 13 total. Type-aware analysis is live today on Go via go/types. SCIP backend is in flight for the other 11.
How does it integrate with Claude Code or Cursor?
Krolik exposes 28 MCP tools over Streamable HTTP. Add the URL to your MCP config — Claude Code, Cursor, Windsurf, Aider, Cline, or any client implementing the Model Context Protocol.
Do I need ox-embed-server and ox-codes?
Both are optional Rust companions (open source, same author). ox-embed-server is a unified ONNX sidecar — multilingual-e5-large (1024d, default), jina-code-v2 (768d, code), a gte-multi-rerank cross-encoder, and SPLADE — speaking OpenAI `/v1/embeddings`, Cohere `/v1/rerank`, and TEI `/embed_sparse`. It unlocks `semantic_search` and the reranker used by `code_research`. ox-codes deepens `dead_code` and `code_health` with structural + symbol-graph analysis. Without them those tools degrade to AST-only heuristics; the other ~23 tools work unchanged.
How is this different from Sourcegraph?
Sourcegraph indexes code for humans. Krolik indexes code for AI agents. We add a knowledge graph (Apache AGE), a runtime observability bridge (Prometheus + Jaeger → file:function), and an MCP-native protocol. Sourcegraph has none of these.
What infrastructure do I actually need?
Just an OpenAI-compatible LLM endpoint (LiteLLM, CLIProxyAPI, or any wrapper). That's the only hard requirement. Add PostgreSQL with Apache AGE to enable `code_graph`. Add pgvector + ox-embed-server to enable `semantic_search` and reranking. Add ox-codes for stricter dead-code verdicts and full A–F repo grades. Redis is optional for L2 cache. Everything else is in-process Go — no JVM, no Node, no cloud service.
Self-hosted only?
Yes. Apache 2.0, every component. Bring your own LLM endpoint (mandatory) and optionally PostgreSQL + our Rust companions for the tools that need them. No SaaS lock-in, no telemetry, no phone-home.
What's the licence?
Apache 2.0 across the stack. Engine: github.com/anatolykoptev/go-code. Companions: github.com/anatolykoptev/ox-codes, github.com/anatolykoptev/ox-embed-server.