kdb

The fastest way for agents to navigate code + knowledge bases

Built with Rust. Your agents explore code faster and burn fewer tokens. Fast, precise, no overhead.

See the difference

Demo video — coming soon

Agent codebase exploration — with vs without kdb

What your agent gets

The install prompt adds these instructions to your agent's system prompt.

## Navigation

Prefer `kdb` over Glob/Grep for navigating projects.
All commands work on both markdown and code files.
Run `kdb init` at the project root if no `.kdb` directory exists.

| Task                          | Use                                  |
|-------------------------------|--------------------------------------|
| List symbols in a file        | `kdb symbols <file>`                 |
| Get specific symbol(s)        | `kdb symbols <file> -s <name>...`    |
| Find who imports a symbol     | `kdb refs <file> -s <symbol>`        |
| Find inbound links to a file  | `kdb refs <target>`                  |
| List outbound deps            | `kdb deps <file>`                    |
| Explore directory structure   | `kdb tree [path] [-L <depth>]`       |
| Find broken links / orphans   | `kdb check`                          |

Fall back to Grep/Glob when: searching for arbitrary strings/patterns,
or kdb doesn't cover the query (e.g. regex search across file contents).
kdb
  init                Initialize a kdb project in a directory
  check [PATH]        Report broken links and orphan files
  tree [PATH]         Print a filtered directory tree
                      [-L <depth>] [-a] [-d] [-f] [-I <glob>] [-P <glob>] [-J]
  symbols <PATH>      Print symbols for a markdown or code file
                      [-s <name>...] [--json] [--public]
  refs <TARGET>       Find inbound references to a markdown target or code symbol
                      [-s <symbol>] [-c <N>] [--json] [--count]
  deps <TARGET>       Print direct dependencies for a file/symbol target
                      [--json]
  graph [PATH]        Render a dependency graph
  fmt [PATH]          Generate or update code index headers
  lsp                 Run the language server over stdio

Usage

$ kdb symbols src/resolve/mod.rs
src/resolve/mod.rs
  fn resolve_file          pub  L12
  fn resolve_imports       pub  L45
  fn resolve_symbol        pub  L78
  struct ResolveContext     pub  L5
  enum ResolveError        pub  L98
$ kdb refs src/resolve/mod.rs -s resolve_file
src/index/mod.rs:23         use crate::resolve::resolve_file;
src/cmd.rs:67               let result = resolve_file(&ctx, path)?;
tests/resolve_test.rs:12    use kdb::resolve::resolve_file;
$ kdb tree -L 2
.
├── docs
│   ├── architecture.md
│   └── getting-started.md
├── src
│   ├── cmd.rs
│   ├── index
│   ├── resolve
│   └── symbols
├── tests
├── Cargo.toml
└── README.md

Features

kdb symbols

Extract functions, types, structs, headings from any file. Code and markdown.

$ kdb symbols README.md
README.md
  # Getting Started        L1
  ## Installation           L5
  ## Quick Start            L20
  ## Configuration          L45

kdb refs

Find every file that imports a symbol or links to a document. Instant reverse lookup.

$ kdb refs docs/architecture.md
docs/getting-started.md:12    [architecture](architecture.md)
docs/index.md:3               [arch overview](architecture.md)
README.md:48                  [docs](docs/architecture.md)

kdb deps

List outbound imports and links. See what a file depends on at a glance.

$ kdb deps src/cmd.rs
src/resolve/mod.rs          use crate::resolve::resolve_file
src/index/mod.rs            use crate::index::build_index
src/symbols/query.rs        use crate::symbols::extract

kdb tree

Filtered directory tree. Respects ignore patterns. Shows what matters.

$ kdb tree -L 2
.
├── docs
│   ├── architecture.md
│   └── getting-started.md
├── src
│   ├── cmd.rs
│   ├── index
│   ├── resolve
│   └── symbols
├── tests
├── Cargo.toml
└── README.md

kdb check

Find broken links and orphan files across your entire project.

$ kdb check
broken links:
  docs/old-guide.md:15 → setup.md (not found)
  src/lib.rs:3 → crate::legacy (no such module)

orphan files:
  docs/draft-notes.md (no inbound links)