Command reference
Everything the krypton client can do.
krypton scan
krypton scan REPO [options]
Builds the syntax tree of every source file under REPO on this machine and prints the server's review.
| Option | What it does |
|---|---|
--level relaxed|standard|strict | How strict the flag limit is. Default standard. |
--base REF | Score only files and lines changed since a git ref (new files count in full). |
--names | Put your real function names back into the review. They never left your machine. |
--full | Print the full review with every flagged file and hint. At a terminal the review is short: the crystal beside the purity score and the five most tangled functions under their real names. A pipe, an agent or CI always gets the full review. |
--json | Print the server's result as JSON instead of the review. |
--no-loader | Do not draw the lavender crystal while the scan runs. It only appears on a real terminal (never in a pipe, in CI or with --json output) and is also switched off by KRYPTON_NO_LOADER; NO_COLOR draws it without colour. |
--save FILE | Also write the server's whole answer to a file. |
krypton order
krypton order REPO [options]
Reads the repository's git history on this machine and builds a request that holds only file names, token counts and which files each recent commit touched. With --post it sends the request and prints the server's decision: keep (send your request unchanged) or reorder with the order to use. Without them it prints the request. See file ordering.
| Option | What it does |
|---|---|
--subdir DIR, --ext .py,.ts | Which folder and file suffixes go in the prompt. Default: the whole repository, .py. |
--files LIST | The request's files, one per line, in your order (- reads standard input). Without it, every matching file in alphabetical order stands in for your order. |
--model NAME | Which model the prompt is for, so file sizes are counted in that model's tokens. See Token counts. |
--tokenizer o200k_base|cl100k_base|estimate | Choose the tokenizer directly. |
--tokens-from FILE.json | Counts you computed yourself: {"path": tokens}. |
--post | Send the request and print the decision. |
--json | Print the decision as JSON. |
Token counts
The order decision compares how much of a prompt a cache would keep, so file sizes should be counted in the tokens of the model the prompt is for. Krypton is not in the path of your model calls, so it cannot read the model from them; you name it with --model (or set KRYPTON_MODEL once, or have your agent harness pass it).
| Model | How it is counted |
|---|---|
gpt-4o, gpt-4.1, gpt-5, o1, o3, o4 | Here, offline, with the real o200k_base vocabulary. |
gpt-4, gpt-3.5 | Here, offline, with cl100k_base. |
claude-... | With Anthropic's own token counter, using your ANTHROPIC_API_KEY. This sends each file's text to Anthropic (your model provider), never to Krypton, and only when you name a Claude model. Answers are cached by content in .krypton/tokens.json. |
| no model | An estimate of 3.5 characters per token. The command says so. |
krypton wire
krypton wire FILE... [--root DIR] [--level L] [--config FILE.json]
krypton wire --stdin-json < files.json
Prints the request body instead of sending it, so you can read exactly what would leave your machine. --stdin-json takes {"path": "source text"} on standard input, so a program that holds code in memory never writes it to disk. A .gitattributes entry adds its linguist-vendored and linguist-generated patterns. --names-out FILE writes the table that maps fingerprints back to your names.
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | The review failed, or a file could not be read, or the server could not be reached or refused the request (the message says which). |
2 | Usage error: a missing folder or a bad option. |
What gets scanned
.js .jsx .mjs .cjs .ts .tsx .mts .cts .py- Whatever your
.gitignorefiles ignore is never read (git's own rules: nested files,!exceptions and.git/info/exclude), and a.kryptonignorefile next to it adds more paths in the same syntax, for code you keep in git but do not want scored, such as generated files or test fixtures. - Dependency and build folders (
node_modules,dist,build,.git, virtual environments and the like) are never read, even when nothing ignores them. - The server also leaves out vendored and generated code by path and by name (minified and bundled files, copies of well-known libraries such as bootstrap or jQuery, anything
.gitattributesmarkslinguist-vendoredorlinguist-generated), and lists each with the reason. - A
krypton: ignore -- reasoncomment above a function waives it. The review lists every waiver with its reason.
Examples
# everything on this branch, for CI (exit code 1 on failure)
krypton scan . --base origin/main
# be gentle while cleaning up
krypton scan src --level relaxed
# exactly what would be sent
krypton wire src/app.py > request.json
# should I reorder this prompt? count in GPT-4o tokens
krypton order . --subdir src --ext .py,.ts --model gpt-4o --post