Repository navigation
What Trazum Does
Generated from
README.mdbyscripts/build-wiki.mjs. Edit that file, not this page: an edit here is overwritten by the next build, and a wiki that has drifted from the repository is worse than no wiki.
The analyser reports sixteen findings, with assumptions attached to each estimate.
1. Tells you where the money actually is. This is the part worth reading first, because it is where the numbers are. Every advisory is priced per month against your own call volume, and none of them is about making the text shorter:
| Advisory | Why it matters |
|---|---|
| Prompt caching | Reading from cache costs 10% of input. The saving is computed over the real stable prefix: in a template with {{placeholders}}, only what precedes the first one is cached — not the whole prompt. |
| Reorder the template | Stable instructions sitting after the first variable placeholder never cache today. Trazum prices moving them in front — and with --reorder, does it. |
| Batch API | 50% off input and output when the work tolerates latency. |
| Cheaper model | Complexity heuristic: if the task looks simple, what dropping a tier would save. |
| Output-dominated cost | If you pay more for the answer than for the prompt, shortening the prompt has a ceiling. |
| Promotional pricing | Warns when you are budgeting with an introductory price that expires. |
| Context window | If the prompt does not fit, the call is going to fail. |
| Contradictory instructions | "Answer in English" three paragraphs above "reply in the customer's own language". The model has to pick one, and which one can change between calls — a correctness problem that also costs tokens twice. |
| Redundant examples | Few-shot examples that are near-copies of an earlier one, and what they cost per month. |
| Output format stated twice | A schema shown in a code block and then walked again in prose. The block is the version worth keeping. |
| Schema the request could carry | A schema block introduced by "Output format:" is paid for in input tokens on every call. Every major API now takes a response schema as a parameter — supported structured-output APIs can enforce the shape, but schema tokens may still be billed. See below. |
The last four are advisory only. A contradiction has a right answer that only the author knows, and an example that looks redundant may be demonstrating a boundary case on purpose. Trazum points; it does not cut.
Trazum can identify an output schema described inside a prompt and suggest using the provider's structured-output API instead. It never removes that schema automatically: the calling application must preserve the contract.
A constrained decoder can improve format reliability where supported. Moving a schema to a request parameter does not prove a billing saving: providers may still count schema tokens. Compare actual usage before claiming savings. The finding estimates the prompt text involved, not a guaranteed reduction in the provider's bill.
Only blocks preceded by an explicit output cue are considered. Example input is data the model may need and must not be removed as though it were a schema.
The example detector finds near-copies — the way few-shot blocks actually grow. It deliberately does not flag paraphrases: that case needs a model, and is on the roadmap for the LLM pass.
2. Then it trims the prompt itself. Twelve deterministic rules: courtesy,
filler, verbose phrasing, duplicated paragraphs, decorative separators, shouting
in capitals. Two levels — safe (no semantic risk) and aggressive (read the
diff). This is the smallest number on the page more often than not, and it is
reported that way rather than dressed up.
3. And never touches what would break the prompt. Code fences, indented code
blocks, inline code, URLs, email addresses, template placeholders ({{x}},
${x}, {x}, {% %}), XML/HTML tags and text inside quotation marks are isolated before any rule runs. If a rule ever did make one of those
disappear, that rule is discarded and the rest carry on.
Reviewing an aggressive run. Every rule reports what it actually changed,
so the level that saves the most is judged rule by rule rather than as one wall
of diff — and a single rule you disagree with comes off with --disable:
[aggressive] Intensifiers (3×, ~6 tokens)
VERY → —
extremely → —
quite → —
[aggressive] Self-verification instructions (1×, ~17 tokens)
You should double-check your answer before re… → —
4. Optionally, runs it past an LLM. The result is only accepted if it is
shorter and leaves protected content byte-identical. Otherwise the deterministic
version stands. It never returns something worse than where it started. With
--suggest it proposes phrases one at a time — You should always make sure to → Always — each checked against your prompt before you see it, so eight surviving
out of ten is a useful morning rather than a rewrite to read end to end.
5. Answers the questions that come before "shorten this". Trimming one file
is the smallest thing here. optimize is one of 60 commands — the table
above names what each answers — because knowing a prompt
is wasteful is not the same as knowing which prompt, whose change made it so,
or whether the shorter version still works.
check, diff, rank and blame all take --markdown-out, so the answer can
land in a pull request comment rather than a terminal nobody is looking at.
It gates in whatever CI you already run. One binary, two exit codes, and worked recipes for GitLab CI, Jenkins, CircleCI and a pre-commit hook — no vendor plugin, because each one would be a second code path that drifts from the exit codes it is supposed to relay.
Generated from
README.mdbyscripts/build-wiki.mjs. Edit that file, not this page: an edit here is overwritten by the next build, and a wiki that has drifted from the repository is worse than no wiki.