Skip to content

ContextKing

Semantic code navigation toolkit for large C# and TS codebases

Install

$git clone https://github.com/Fredrik-C/ContextKing

Install command taken from the project's README or registry entry. Always review code before running it.

Context King

Code navigation toolkit for Claude Code, Codex CLI, and OpenCode on large C#, TypeScript/TSX, Kotlin, and Python codebases.

Most approaches to reducing token usage focus on compacting what the agent reads: tighter prompts, summarised context, leaner encoding. Context King addresses a different problem: the token cost of getting there. On a large codebase, navigating to the right method without guidance means scanning many wrong files before finding the right one, and that over-reading during navigation dominates the total cost.

The goal is to reach the right method body in as few steps as possible, spending tokens only on what is relevant. Context King indexes source files with lightweight lexical metadata and replaces broad file searches with a four-step navigation system:

file-first lexical retrieval -> optional metadata reranking -> scoped exploration -> live AST signature extraction -> targeted method extraction

The problem

A large solution or monorepo can have tens of thousands of C#, TypeScript/TSX, Kotlin, and Python files spread across thousands of folders. When Claude Code needs to find a specific piece of logic, the typical unguided path is:

  1. Grep or Glob across the whole repo, returning dozens of hits across unrelated modules.
  2. Scan candidate files for keywords. Many files touched, and grep misses cross-module naming/context clues.
  3. Eventually find the right method, but only after pulling a lot of surrounding noise into the context window.

On a 20,000-file codebase this is expensive. Unscoped searches return false positives from test projects, generated code, node_modules, and unrelated modules. Every wrong file wastes tokens and pushes relevant context out of the window.


The solution

Context King installs these commands into your AI CLI tool:

Command What it does
ck find-files Lexical file search over path/file/type/method names
ck get-keyword-map Returns bounded lexical and semantic hints to refine weak or broad file searches
ck expand-folder Scoped folder browser: enumerates source files and extracts signatures, with an optional regex filter
ck signatures Live AST extraction. Lists every method/property signature in a set of files
ck get-method-source Reads one named member using AST and returns exact line and char spans
ck get-type-source Reads one supported type declaration by name with exact line and char spans
ck get-enum-members Lists enum members for a named enum without reading the full file
ck read-full-file Reads one supported source file with a large-file guardrail and explicit override
ck build-check Runs dotnet build -v q and prints compact diagnostics
ck index Builds or refreshes the source-map index (runs automatically on first use)
ck init Initializes Context King in a repository (see Installation)
ck find-symbol Finds type or member declarations in C#, TypeScript/TSX, Kotlin, and Python files across a scoped path
ck refs Finds textual references (call-sites) for a symbol across a scoped path
ck recall Retrieves knowledge snippets for a folder or a cross-folder ranked query (step 2.5)
ck learn Records a knowledge snippet to a session-specific .ck-knowledge/**/*.jsonl file
ck forget Removes a stale snippet by ID

The file-first flow in practice:

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro,…

Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…