Skip to main content

ken

Find the code. Keep the context.

Code search and project memory for coding agents. Ken finds relevant files, functions and classes, returns code your agent can inspect, and brings useful project knowledge into the next session. Works with Claude Code, Codex and other MCP clients.

Ken is maintained in Python. The separate Rust implementation and its migration tooling have been retired; they remain available in Git history. Searching and analyzing Rust projects is still supported.

97.6% Hit@10 · 1,251 queries · 63 repositories · CPU only

Measured on a pinned development snapshot; methodology and reproducible results.

We evaluated Ken using the same public code-search benchmark created by Semble. Ken returned a matching target in its first ten results for 1,221 of 1,251 queries. The measured engine runs locally, with no embedding API key or powerful GPU required. Results and methodology ↓

Start here

Requires Python 3.11+. Install the CLI, then connect a project:

uv tool install ken-rank
cd your-project
ken install .

Prefer pipx? Use pipx install ken-rank. The package is ken-rank; the command is ken.

Ken detects supported assistant setups and installs local MCP configuration, skills and hooks where available. Restart your assistant after installation. Choose a host explicitly with ken install --claude ., ken install --codex ., ken install --antigravity ., or ken install --opencode ..

Models download on first use; indexing and inference run on your machine. Prepare the search models and source index ahead of the first query with:

ken retrieval prepare --path .

Preparation reports progress on stderr and reuses vectors for unchanged source views. Full semantic search opens a prepared snapshot and reports when it needs updating. Exact symbol lookups are available after source indexing.

After switching branches or upgrading a retrieval runtime, refresh the active profile and remove index entries for missing or ignored files:

ken retrieval index --path . --prune
ken status .

Wait for any active indexing command to finish before running the refresh. Pruning updates the source index.

Ask about behavior, get code

ken search-files "Where are application settings loaded?"
ken search-symbols "Read a stored setting by key"
ken search-symbols "Reader.read_value"

Use English queries for the strongest current results. Choose the kind of piece when it matters:

ken search-symbols "Read stored settings" --piece-kind class
ken search-files "Load configuration" --piece-kind module

Compact text is the default in the CLI and MCP: a path, source range, symbol and numbered code. For example, this real response from the small demo project gives the agent something concrete to verify:

reader.py:6-8 :: Reader.read_value
6 |     def read_value(self, key):
7 |         """Return the stored value for a setting key."""
8 |         return get_value(key)

Need structured output? Add --json, or use MCP output_format="json". More actual CLI and MCP responses.

  • Give the agent a starting point. Claude Code and Codex hooks can inject ranked project context before each prompt. MCP tools support explicit searches in other clients.
  • Find by meaning or by structure. Search behavior, exact names and text; inspect symbols, imports, callers, related tests and change impact.
  • Keep the useful discoveries. Save findings with source references and anchors so the next session can recover them. Dependency checks expose when their declared inputs have changed.
  • Keep context focused. Results include source locations and selected code; full diagnostics and JSON are available when needed.
  • Run locally. The index, embeddings and project memory stay on your machine. Ken needs no hosted search service or embedding API. Your coding assistant's own connection and data policies still apply.

The default search combines lexical and static retrieval, structural information, CodeRankEmbed INT8 context and Ettin 68M reranking. You can use the complete pipeline on CPU. No model selection is needed to get the measured default.

Measured on real repositories

The benchmark was created by Semble and covers 1,251 queries across 63 repositories. Ken used the original queries, source revisions, annotations and NDCG evaluator, with every query retained. Results for the measured CodeRank configuration:

Metric Result
Matching target at Top1 73.78% — 923/1,251
Matching target within Top10 97.60% — 1,221/1,251
NDCG@10, averaged by repository 0.8480
Ready-index search, median / p95 1.97 s / 4.22 s
Highest worker peak RAM 1.76 GiB

CPU measurements: Apple M1 Pro, 10 cores, 32 GiB RAM. Search timing includes the API, compact rendering and serialization with the index and models prepared; initial setup is separate. The slowest query took 14.71 s. RAM is the whole-worker high-water mark, including preparation and model loading.

The annotations mainly identify files: 1,462 of 1,496 targets have no line span. These figures measure matching the published targets, not exact-function accuracy or a blind acceptance test. The same evaluator gives the saved Semble 0.7.0 reference 74.02% Top1, 98.64% Hit@10 and 0.8512 NDCG@10; its historical timings are not a matched comparison.

The full reproducible report includes all three tested contextual encoders, per-query scores, CPU/RAM costs, source/model hashes, limitations and a model-free recheck script. The private acceptance reserve was not used.

Let your agent use it

With MCP connected, the core workflow is:

ken_find(query="Where are stored settings read?", scope="symbols")
ken_read(path="reader.py", include=["source"], qualname="Reader.read_value")

Save a discovery for the next session:

ken remember "settings lookup" "Reader.read_value delegates to settings.get_value."
ken recall "settings lookup"

These paths and names belong to the demo project; use your repository's results. ken status . shows index health. ken tools lists the MCP tools from the shell.

Go deeper

Ken is open source under the MIT license.

Metadata

Release files for ken-rank 0.19.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ken-rank 0.19.0
File Size Uploaded Provenance Actions
ken_rank-0.19.0.tar.gz 25.1 MB With provenance Details for ken_rank-0.19.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ken-rank 0.19.0
File Interpreter ABI Platform Actions
ken_rank-0.19.0-py3-none-any.whl Python 3 none any Details for ken_rank-0.19.0-py3-none-any.whl

Total release size: 50.4 MB

Release files / ken_rank-0.19.0.tar.gz

Download URL ken_rank-0.19.0.tar.gz
Size 25.1 MB
Tags Source
SHA-256 checksum
How to use checksums
e953f062b387495d8ffffe1c49609683dab6106c1cb73a7ca04ed011e7b002b8
BLAKE2b-256 checksum
How to use checksums
ded5f74db2255c457995f08add5bdebe6aa3459f6e3bd05bef82e60702ebf301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ken_rank-0.19.0-py3-none-any.whl

Download URL ken_rank-0.19.0-py3-none-any.whl
Size 25.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2e64545eb40914d323e695c6a3ebdc6abb50f7a59c38d49dda969f334ba5de83
BLAKE2b-256 checksum
How to use checksums
f274dbbeea16baae6e9518ca7d904483d1e19abd0c6317d6d18a6cdec9525ee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for ken-rank 0.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ken_rank-0.19.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.19.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page