Build a repeatable cleanup chain for LLM output
Raw model output rarely goes straight into your app. You usually want to strip boilerplate, pull out the JSON, normalize whitespace, or redact PII before display or storage. This builder lets you toggle those transforms and arrange them in order, then applies them in sequence so you can see exactly what your production post-processing chain would produce.
How it works
Each enabled step is a pure text transform applied in the order shown. Strip boilerplate removes common LLM lead-ins and sign-offs like “Sure, here is” and “Let me know if you need anything else”. Extract JSON scans for the first balanced object or array, including inside code fences, and keeps only that. Strip markdown removes headings, emphasis, links, and code markers. Trim whitespace collapses repeated spaces and blank lines. Anonymize PII swaps emails and phone-like sequences for placeholder tokens. The output of one step becomes the input to the next, so reordering changes the result and the preview updates live.
The order problem in practice
Pipeline step ordering is where most teams make their first mistake. Consider what happens if you extract JSON before stripping markdown:
- Input:
```json\n{"name": "Alice"}\n``` - Extract JSON (first): sees the fenced block and correctly extracts
{"name": "Alice"} - Strip markdown (second): nothing to do, result is clean
Now reverse the order:
- Strip markdown (first): removes the code fence markers but may also mangle the brace content depending on the implementation
- Extract JSON (second): encounters raw text that may or may not parse
The live preview in this builder makes these interactions visible immediately, so you can experiment before committing to a production sequence.
What each step does in detail
Strip boilerplate matches common LLM preamble patterns — phrases like “Certainly!”, “Sure, here is”, “As an AI language model”, and tail phrases like “I hope this helps!” or “Let me know if you need anything else.” These are present in almost every conversational model output when asked to produce content, and removing them leaves only the substantive response.
Extract JSON finds the first balanced JSON object {...} or array [...] in
the text, including inside a code fence, and discards everything around it. This
handles the most common case: a model that was told to output JSON but still
wrapped it in a short explanation.
Strip markdown removes heading markers (#), emphasis (*, _), links
([text](url)), and code block fences. Useful when you want plain displayable
text but the model defaulted to formatting.
Trim whitespace collapses multiple spaces into one and removes blank line runs. Useful as a final cleanup step after any other transform that may introduce trailing whitespace or double newlines.
Anonymize PII replaces email patterns and phone-number-like digit sequences
with tokens such as [EMAIL] and [PHONE]. It is pattern-based, not semantic,
so it catches common formats reliably but is not a substitute for certified
redaction tooling in regulated environments.
Replicating the chain in production code
Once you have found an order that produces the output you want, implementing the same pipeline in Node.js or Python takes only a few lines per step. The value of testing in this builder is discovering edge cases — truncated JSON that looks balanced, boilerplate phrases that appear inside useful content, email addresses you actually want to keep — before they surface in production traffic.
Everything in this tool runs locally; your text never leaves the browser.