Skip to content

CLI

Terminal window
promptsize [options]

Run with no arguments, promptsize auto-detects your config, checks every budget, prints a report, and exits non-zero if any prompt is over.

FlagDescription
-c, --config <path>Path to the config file. Default: auto-detect.
--whyShow the per-file token breakdown under each entry.
--jsonOutput machine-readable JSON instead of the report.
--saveWrite current sizes to .promptsize.json (the baseline) and exit.
--silentSuppress output; rely on the exit code only.
-h, --helpShow help.
-v, --versionShow the version.
CodeMeaning
0All prompts within budget.
1One or more prompts over budget.
2Configuration or runtime error (e.g. no config found, no files matched).

These make promptsize a drop-in CI step — a non-zero exit fails the job.

Check everything and show what’s in each bucket:

Terminal window
promptsize --why

Machine-readable output for custom tooling:

Terminal window
promptsize --json
{
"ok": false,
"entries": [
{
"name": "few-shot examples",
"patterns": ["prompts/examples/*.md"],
"encoding": "o200k_base",
"tokens": 9200,
"limit": 8000,
"passed": false,
"overBy": 1200,
"delta": 320,
"files": [
{ "path": "prompts/examples/a.md", "tokens": 4600 },
{ "path": "prompts/examples/b.md", "tokens": 4600 }
]
}
]
}

Use a config in a non-standard location:

Terminal window
promptsize --config config/promptsize.json

Update the committed baseline after an intentional change:

Terminal window
promptsize --save
git add .promptsize.json