The semantic index — RepoGraph
KHAELOR understands your repository without stuffing it into context: an incremental symbol index answers “where is it defined?” and “who uses it?” in milliseconds.
Two tools replace most exploratory greps#
├─ symbols "class:*Controller" · 2 hits · 9ms
src/http/auth.ts:24 [class] export class AuthController {
Login/logout endpoints.
src/http/admin.ts:11 [class] export class AdminController { ├─ refs handleAuth · callers · 14 sites
src/http/auth.ts:31 await handleAuth(token)
src/http/middleware.ts:88 if (!(await handleAuth(t))) return deny()
src/cli/login.ts:52 const ok = await handleAuth(input)| Tool | Input | Returns |
|---|---|---|
symbols | query (wildcards: *Controller, shorthand class:*), kind (function · class · type · export · variable · method), scope (glob). | file:line, kind, signature, doc comment. |
refs | symbol, direction = callers · callees · importers. | Usage sites with a line of context each. |
Indexing#
- Incremental by mtime: only changed files re-extract; queries lazily refresh (debounced ~5 s), so results are never stale for long and startup stays instant.
- Warm-up in the background at engine assembly — the first tool call does not pay for it.
- Languages today: TypeScript/JavaScript and Python, via a dependency-free heuristic extractor. tree-sitter grammars are the documented upgrade path — the service interface will not change.
node_modules,.git,dist,referencesare always excluded.
Skeletons — the token economics#
The index can render any file as a skeleton: its signatures and doc comments with line anchors — typically 5–15% of the tokens of the full file:
src/kernel/dispatch.ts — skeleton (9 symbols; re-read the file if you need bodies)
18 | export interface DispatchOptions { // Kernel dispatch configuration.
42 | export function dispatch(call: ToolCall): Result<Obs> // The single entrypoint.
97 | function verifyGrant(cap: Capability): boolean
Exploration that used to cost a 3,000-token file read costs a 200-token skeleton. The agent is
prompted to reach for symbols/refs before grep.
What it will not pretend#
callees is a heuristic (identifiers called within the defining region, resolved
against known symbols) — good for orientation, not a type-checked call graph. When precision
matters, KHAELOR confirms with read. Dynamic dispatch and reflection are invisible to
any static index; the tools say so instead of guessing.