> For the complete documentation index, see [llms.txt](https://cyr1en.gitbook.io/commandprompter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cyr1en.gitbook.io/commandprompter/prompts/presets.md).

# Presets

Presets are reusable prompt, post-command, approval-gate, and conditional post-command definitions stored in `plugins/CommandPrompterPaper/presets.json`.

## Prompt preset

```
/command <@my_prompt>
```

The ID is case-sensitive and stops at the first space. Typing `<@` in chat suggests configured preset IDs via tab completion. Inline flags appended inside a preset reference are ignored; configure behavior in JSON. Preset `sanitize` settings are honored (`"sanitize": false` preserves formatting and special characters in input).

Multi-input dialog presets produce N separate answers (one for each input row), while zero-input dialog presets produce 0 answers without consuming answer slots.

## Create and manage prompt presets

Since **3.3.0**, use `/cmdp preset` to turn an inline prompt into its corresponding structured JSON definition:

```
/cmdp preset add reason <Please enter a reason:>
/cmdp preset add rename <a:Enter a new name -ds>
/cmdp preset update reason <Why are you reporting this player?>
/cmdp preset remove rename
```

Use the saved prompt in another command, for example `/report <p:Choose a player> <@reason>` if your server provides `/report`.

| Command                                       | Behavior                                                                                       |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `/cmdp preset add <id> <inline prompt...>`    | Creates a prompt preset. The ID must be unused across all preset categories.                   |
| `/cmdp preset update <id> <inline prompt...>` | Replaces the complete definition of an existing prompt preset, including its type and options. |
| `/cmdp preset remove <id>`                    | Deletes an existing prompt preset. No inline prompt follows the ID.                            |

Players and console can use these commands with `promptpaper.preset`, granted to operators by default and included in `promptpaper.admin`. TAB suggests the actions and existing prompt IDs for `update` and `remove`. `/commandprompter preset` is equivalent to `/cmdp preset`.

### What gets saved

The trailing argument accepts exactly one complete inline prompt, including its delimiters. Spaces are part of that argument; do not wrap the whole prompt in quotes. Configured delimiters and screen mappings apply. A compound dialog is one prompt:

```
/cmdp preset add adjustment <d:choice[set,add]:Mode && d:num[0,24,2,6]:Amount>
```

This creates a `dialog` preset with two entries in `base.inputs`: a choice row with `constraints: ["set", "add"]` and a number row with `constraints: [0, 24, 2, 6]`. Use it as `<@adjustment>`.

Conversion supports Chat, Anvil, Sign, Player UI, Dialog, Confirmation, and Item prompts, including configured aliases for those types. It preserves sanitization, title displays, supported execution options, and placeholders. Placeholders remain text until the preset is used. Dialog title/body rows become structured layout fields, and tab-completion dialogs retain their button threshold as `dialog_type.max_buttons`.

The resulting definition is saved in the `prompts` array of `presets.json`. You can edit its JSON fields for further customization; see [Presets Configuration](/commandprompter/configuration/presets.md#common-prompt-fields), including the shared `behavior` object for validators, answer types, timeouts, and early termination.

### When changes take effect

Successful command edits are saved and become available immediately, without `/cmdp reload`. Active sessions retain the preset definitions they started with. After removing a preset, new commands referencing its ID fail until those references are changed or the preset is recreated.

Manual file edits still require `/cmdp reload`, which cancels active sessions. Preset commands reject edits while a configuration reload is in progress; retry when it finishes.

### Rejected edits

The command reports an error for:

* an existing ID passed to `add`, or a missing ID passed to `update`/`remove`;
* an ID belonging to a post-command, approval gate, or conditional post-command;
* plain text without prompt delimiters, multiple prompts, or surrounding command text;
* a preset reference such as `<@reason>`, a post-command, or an approval gate as the input;
* an unknown prompt type or validator alias, or a custom screen provider without a built-in JSON equivalent;
* a compound prompt using a non-dialog type;
* malformed `presets.json`, a preset count/file-size limit violation, or an unsuccessful save.

The command validates the complete candidate file before replacing it. Failed validation or saving keeps the active preset snapshot intact; unrelated entries and JSON fields are preserved by successful edits.

## Post-command preset

```
/command <@my_prompt> <!@my_post_command>
```

The post-command's JSON `execution_policy` decides whether it runs on completion or cancellation. `execute_as` and `delay_ticks` also come from the preset; inline marker/delay hints do not override them.

Conditional post-commands use the same `<!@id>` reference. Their JSON condition selects `if_true` or `if_false` after the configured lifecycle event.

## Approval-gate preset

```
/trade <p:Choose a player> <i:Choose an item> <!gate:@trade_confirm>
```

An approval gate pauses after input collection and asks the target resolved by its trusted JSON definition. Decline or timeout prevents the primary command from running. See [Command Flows](/commandprompter/features/command-flows.md#approval-gates).

Unknown prompt, post-command, conditional, or gate IDs abort interception and show a configuration error. Literal unknown tags are not passed through to the underlying command.

Run `/cmdp reload` after manually editing `presets.json`. Command edits through `/cmdp preset` apply immediately. See [Presets Configuration](/commandprompter/configuration/presets.md) for every field and full examples.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cyr1en.gitbook.io/commandprompter/prompts/presets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
