Krypton
Command reference

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.

OptionWhat it does
--level relaxed|standard|strictHow strict the flag limit is. Default standard.
--base REFScore only files and lines changed since a git ref (new files count in full).
--namesPut your real function names back into the review. They never left your machine.
--fullPrint 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.
--jsonPrint the server's result as JSON instead of the review.
--no-loaderDo 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 FILEAlso 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.

OptionWhat it does
--subdir DIR, --ext .py,.tsWhich folder and file suffixes go in the prompt. Default: the whole repository, .py.
--files LISTThe 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 NAMEWhich model the prompt is for, so file sizes are counted in that model's tokens. See Token counts.
--tokenizer o200k_base|cl100k_base|estimateChoose the tokenizer directly.
--tokens-from FILE.jsonCounts you computed yourself: {"path": tokens}.
--postSend the request and print the decision.
--jsonPrint 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).

ModelHow it is counted
gpt-4o, gpt-4.1, gpt-5, o1, o3, o4Here, offline, with the real o200k_base vocabulary.
gpt-4, gpt-3.5Here, 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 modelAn 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

CodeMeaning
0Success.
1The review failed, or a file could not be read, or the server could not be reached or refused the request (the message says which).
2Usage error: a missing folder or a bad option.

What gets scanned

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