> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corepillar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How prompt tidying works

> The exact rules behind ModelHub's Optimise switch: what is protected, every phrase it removes or shortens, the order they run in, and how savings are counted.

[Optimise](/modelhub/chat/optimise) removes words that cost money and carry no instruction. This page lists every rule it applies, in the order it applies them.

## Principles

* **Delete or shorten fixed phrases only.** No AI is involved, and nothing is summarised or paraphrased. Asking a model to "compress" a prompt reliably drops the one constraint that mattered, and a cheaper answer to the wrong question is not a saving.
* **Never touch code.** Fenced code blocks are lifted out before any rule runs and put back unchanged afterwards. Indentation and blank lines inside them are content.
* **Never remove words that can carry an instruction.** `just`, `simply`, `briefly`, `only` and `exactly` look like filler and are deliberately not on any list. "Just the total" is a different request from "the total".
* **Always visible.** Every change is listed on the answer's report card.

## Order of operations

The order matters. Removing a bare "please" first would turn "could you please summarise this" into "could you summarise this", leaving the "could you" behind and saving almost nothing. So long phrases run before the single words inside them.

1. Protect fenced code blocks.
2. Formatting cleanups.
3. Wordy phrases shortened.
4. Stock politeness removed, in six groups.
5. Seams tidied where something was removed mid-sentence.
6. Restore code blocks and trim the start and end.

If the result would be empty, the original message is sent instead. A message counts as optimised only when at least one rule fired **and** the result is shorter.

## 1. Formatting cleanups

| Rule | Change label on the report card |
| - | - |
| Three or more consecutive line breaks (two or more blank lines) become a single blank line | "collapsed N blank-line run(s)" |
| Spaces and tabs at the end of a line are removed | "trimmed trailing space on N line(s)" |
| Runs of three or more spaces or tabs become one space | "collapsed N run(s) of spacing" |

## 2. Wordy phrases shortened

This is the only rule that changes wording rather than only deleting. It runs before the deletions. Matches ignore case; the replacement is written in lower case, so "In order to ship" at the start of a sentence becomes "to ship". Change label: "shortened N wordy phrase(s)". There are 50 entries.

| Group | Phrase → replacement |
| - | - |
| Purpose | in order to → to · for the purpose of → to · in an effort to → to · as a means of → to · in order for → for |
| Cause | due to the fact that → because · because of the fact that → because · in light of the fact that → because · owing to the fact that → because · in view of → since · inasmuch as → since |
| Condition | in the event that → if · in the event of → if · provided that → if |
| Time | at the present time → now · at this point in time → now · at this time → now · until such time as → until · for a period of → for · during the period → during · prior to → before · subsequent to → after · in this day and age → today · as of yet → yet |
| Reference | with reference to → about · with regard to → about · with respect to → about · in regard to → about · in terms of → for |
| General | with the exception of → except for · in the amount of → for · under the provisions of → under · is applicable to → applies to · comply with → follow · adjacent to → next to · in close proximity to → near · in lieu of → instead of · in between → between · already existing → existing · readily apparent → clear · first and foremost → first · a large number of → many · the majority of → most · in the near future → soon · on a regular basis → regularly · in spite of the fact that → although · despite the fact that → although · it is often the case that → often |
| Removed outright | it should be noted that · please be advised that |

### Where these come from

The list was built from two public, MIT-licensed plain-language databases: `retext-simplify` (324 entries, derived from US government plain-language guidance) and `too-wordy` (236 entries, from the `write-good` family of prose linters). Neither is installed; the lists were read once, filtered, and reviewed by hand.

1. **Mechanical filter.** Only multi-word phrases with exactly one replacement that is strictly shorter were kept, and anything containing a negation, quantifier or modal ("not", "all", "only", "must", "may") was dropped, because those change the claim rather than its length. 58 entries survived.
2. **Human review of the 58.** Entries that change register rather than length were removed ("adversely impact" → "hurt"), as were entries that change meaning ("benefit from" → "enjoy", "is responsible for" → "handles"), one ungrammatical entry, and military and legal boilerplate.
3. A few very common phrases missing from both sources were added by hand ("the majority of", "on a regular basis", "in the near future").

`retext-simplify` also marks 21 entries as safe to delete outright, including "there is", "it is", "very", "currently" and "appropriate". **None of those are applied.** Deleting "there is" from "there is a bug in the export" leaves "a bug in the export", which is not the same statement.

## 3. Stock politeness removed

Each group is matched case-insensitively. Except for greetings, the phrases are removed **wherever they appear** in the message, not only at the start. Each group that fires adds one line to the report card.

### Request preambles, long forms (label: "removed request preamble")

Removed when followed by more text:

* I was wondering if you could / can / might
* I would be grateful if you could / would
* I'd appreciate it if you could / would; I'd really appreciate it if you could / would
* would it be possible to; would it be possible for you to
* is there any way you could / can; is there any chance (that) you could / can
* do you think you could / can
* if it's not too much trouble
* when you get a chance; when you have a chance; when you get a moment; when you have a moment
* sorry to bother you
* quick question; real quick

### Request preambles, short forms (label: "removed request preamble")

Removed when followed by more text:

* please could you; please can you
* could you; could you please; could you kindly
* can you; can you please; can you kindly
* would you; would you please; would you kindly; would you mind
* will you; will you please
* I would like you to; I'd like you to
* I need you to; I want you to
* I'm hoping you can
* may I ask you to

### Sign-offs (label: "removed sign-off")

* thanks so much; thanks a lot; thanks a million; thanks in advance; thanks again; thanks kindly (also "thank" without the s)
* thank you so much; thank you very much; thank you in advance; thank you kindly
* much appreciated; many thanks
* I appreciate your help; I appreciate it; I appreciate this
* appreciate your help; appreciate it
* cheers

A bare "thanks" or "thank you" on its own is **not** removed.

### Greetings (label: "removed greeting")

Only at the very start of the message:

* hi, hello or hey, optionally followed by "there", optionally followed by "hope you're well", "hope you are well", "hope you're doing well" or "hope you are doing well"

"Hope you're well" without a greeting in front of it is not removed.

### Redundant framing (label: "removed redundant framing")

* as an AI; as an AI language model
* you are an AI; you are an AI language model
* as a language model
* I know you're an AI, but

### Closing hedges (label: "removed closing hedge")

* if that makes sense; if this makes sense
* hope that makes sense; hope this makes sense
* if you don't mind; if you do not mind
* if you would be so kind

### Bare courtesy words (label: "removed politeness")

Last, once every phrase containing them has gone:

* please; kindly (when followed by more text)

A trailing "please." at the very end of a message is left in place.

## 4. Tidying the seams

Removing a phrase mid-sentence leaves its spacing behind. Afterwards:

* spaces before `? ! . , ; :` are removed,
* spaces after an opening `(` or `[` are removed,
* runs of two or more spaces become one,
* punctuation and spaces stranded at the very start are removed (so "You are an AI language model. Explain OAuth" does not become ". Explain OAuth").

## Worked examples

| Written | Sent | Report card |
| - | - | - |
| Could you please summarise the Q3 refund policy? Thanks in advance! | summarise the Q3 refund policy? | removed request preamble; removed sign-off; 9 tokens trimmed |
| Hi there! Hope you're well. I was wondering if you could review this contract. Much appreciated. | review this contract. | removed request preamble; removed sign-off; removed greeting; 18 tokens trimmed |
| As an AI language model, can you explain OAuth? Thank you so much. | explain OAuth? | removed request preamble; removed sign-off; removed redundant framing; 13 tokens trimmed |
| In order to ship prior to Friday, we need to comply with the policy. | to ship before Friday, we need to follow the policy. | shortened 3 wordy phrases; 4 tokens trimmed |
| Just the total, please. | *unchanged* | none |

## How savings are counted

`tokens trimmed = ceil(original characters ÷ 4) − ceil(sent characters ÷ 4)`, floored at zero.

This is the same four-characters-per-token approximation used elsewhere for estimates. It is shown as an estimate only; billing always uses the provider's reported token counts.

CorePillar's own measurement on a six-message sample of deliberately wordy business English removed 45 of about 121 tokens, a 37% reduction. Two of the six messages were left untouched. That is a best case on text chosen to contain these patterns. A terse, well-written prompt saves nothing.

## Interaction with routing and privacy

Tidying runs first, before scoring and before privacy screening. The trimmed text is what is scored for difficulty, masked, sent and saved. Because length is a routing signal, removing filler can lower a message's score slightly. Tidying applies to the typed message only, never to attached documents.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.