Skip to content

Open source · MIT · runs on your machine

Context your AIcan trust.

ctxman turns any repository into model-ready context: exact token counts, method maps in 14 languages and budgets that never overflow — served to your tools over the CLI, MCP and REST, without your code leaving your machine.

npm install -g ctxman

Fit a real repository into a context window

1,719,753tokens1.7× the window

Context window: 1,000,000 tokens

$ ctxman --cli

ctxman on its own repository, commit fda35db, exact tiktoken counts

Works with
  • Claude Desktop
  • Claude Code
  • Cursor
  • VS Code
  • any MCP client
  • CI pipelines

Context windows are big. Repositories are bigger.

Dumping a repository into a prompt wastes the window on lockfiles, build output and boilerplate. ctxman measures what is there and keeps what matters.

81%smaller context from two plain-text rule files
64%fewer tokens for the same method map with TOON
1,444methods mapped with line and token counts
11 msto scan 505 files

Four ways in, one engine

Use it by hand, wire it into an assistant, call it from a service or embed it.

Analyse, map, review and explain from the terminal

$ ctxman --cli --changed-since main --target-model claude-sonnet-5-5
$ ctxman map --tokens 4096 --focus src/server.js
$ ctxman pr --base main --budget 30k
$ ctxman why src/cart.js:total --ask "Why round here?"

Everything a model needs, nothing it does not

Counts you can check

Per file and method, with your model's encoding where it is published, and Claude's exact count through Anthropic's API on request.

319,165 tokens

ctxman's own source, 140 files, tiktoken cl100k

Method maps

Every method with its line and its own token count, in 14 languages.

  "lib/core/Analyzer.js"[10]{name,line,tokens}:
    constructor,15,54
    initStats,27,64
    analyze,40,87
    analyzeSequential,57,61
    analyzeFile,71,253
    updateStats,110,218

Budgets that hold

Pack the highest-ranked files, whole or as signatures, into a hard token budget: ctxman pack --budget, REST or MCP.

29,989 / 30,000 · 12/140 files

Secrets stay out

Cloud keys, tokens and private keys become [REDACTED] before export.

- accessKeyId: 'AKIAABCDEFGHIJKLMNOP'
+ accessKeyId: '[REDACTED:aws-access-key-id]'

Changes and their history

ctxman pr packs a branch for review; ctxman why gathers the commits, issues and owners behind a function.

ctxman pr --budget 2500 → 2,413 tokens

Any format

TOON, JSON, YAML, Markdown, CSV, XML or a GitIngest digest — to a file, the clipboard or chunks.

  • TOON
  • JSON
  • YAML
  • Markdown
  • CSV
  • XML
  • Digest

Built for teams that cannot send their code away

Local-first

No hosted service and no telemetry: analysis runs where the code is, on a laptop or a CI runner.

Rules in the repository

.contextignore, .contextinclude and .methodinclude are plain files, reviewed and versioned like code.

Policy and audit log

A policy file denies paths, requires redaction and caps exports for the CLI, API and MCP server, and every export is logged.

Locked-down servers

REST and MCP bind to localhost, refuse foreign Host headers, keep CORS off and accept an auth token.

Deterministic output

Same commit, same context. Snapshots and diffs show how the context grows over time.

MIT licensed

Read it, fork it, run it air-gapped. No seats, no lock-in.

How ctxman compares

Hosted context engines index your code on their servers; packers flatten it into one file. ctxman measures and shapes it locally.

ctxman open source, localRepomix open sourceSourcegraph enterpriseGitHub Copilot enterpriseUnblocked enterprise
Runs without an account or serverYesYesNoNoNo
Token counts you can see, per fileYesYesNot documentedNot documentedNot documented
Fit context into a token budgetYesPartly or limitedPartly or limitedNot documentedPartly or limited
Commit history and decisions in contextYesYesYesNot documentedYes
Tickets, chat and wiki as sourcesNoNoPartly or limitedYesYes
Secrets masked before exportYesPartly or limitedNot documentedNot documentedNot documented
MCP server for agentsYesYesYesYesYes
Organisation-wide exclusion policyPartly or limitedNoYesYesPartly or limited
SSO, SCIM and rolesNoNoYesYesYes
Open sourceYesYesNoPartly or limitedNo

Yes · Partly or limited · No · Not documentedChecked 2026-10-09 · Full comparison with sources →

On the roadmap

Planned, not shipped yet. Several come from what teams expect of enterprise context engines.

  1. N1

    Discussions in ctxman why

    On request, read the pull-request and issue discussions behind the references ctxman why finds, from GitHub or GitLab.

  2. N2

    Semantic search over MCP

    The local embedding index of ctxman ask as an MCP tool, ranked together with BM25.

  3. N3

    Several repositories at once

    ctxman map, search and pack across the repositories of a workspace, with one budget.

Follow and discuss on GitHub ↗

We pointed it at its own repository

Every number on this page comes from a script that runs the CLI, the MCP server and the REST API on a clone of ctxman. Nothing is edited by hand.

Open the showcase →
project:
  root: ctxman
  totalFiles: 4
  totalTokens: 6501
methods:
  "lib/core/Analyzer.js"[10]{name,line,tokens}:
    constructor,15,54
    initStats,27,64
    analyze,40,87
    analyzeSequential,57,61
    analyzeFile,71,253
    updateStats,110,218
…

See where your tokens go

One command to install, one to measure your repository.

npm install -g ctxman && ctxman --cli

Released under the MIT License.