# How do I configure prompt injection rules?

> Cube Agent 2.4.1 Release (Build 2004105) User Guide.
> Category: Models & AI. Content baseline: 2026-12-05.
> Web page: https://cubeagent.app/en/docs/assistant_prompt_rules/

## When to use it

Save recurring response formats or supplemental instructions as rules. Keep general identity and tone settings in **Prompt**; rules are inserted into subsequent model requests as configured without modifying your chat history or making extra model calls.

## Setup steps

1. Open **Assistants → Edit assistant → Prompt → Rules**, and tap **Add**.
2. Enter a rule name and body, then choose its position: before the system prompt, after the system prompt, at the start of the conversation, before the latest question, or at a specified depth.
3. Rules placed inside the conversation can use the system, user, or assistant role; rules before or after the system prompt are treated as system instructions. Specified depth counts back from the end—`0` means the end, depths larger than the available history fall back to the start, and tool calls and results remain intact together.
4. Insert date or environment variables as needed, reorder rules, return to the list to turn the rule on, and tap **Save** in the assistant's top-right corner.

For example, if you want every answer to lead with the takeaway, place "Start with a one-sentence conclusion, then explain your reasoning" at **Before latest question**. When multiple rules share the same position, they apply in list order; turn off any rule you temporarily do not need.

## Editing and context usage

Unsaved changes are preserved as you switch between Prompt, Rules, and Opening; inserted variables are appended to the end of the text. Rule content consumes model input context and appears under "Prompt rules & opening" in the context usage breakdown. Referencing an environment variable inside a rule sends its real value to the current model provider—do not use rules to pass secrets.

## Protocol compatibility

Anthropic, Gemini, and OpenAI Responses request formats currently do not support inserting standalone `system` rules inside the conversation body and will prompt you to adjust if you combine them—switch to another role, move the rule before or after the system prompt, or disable it. Whether compatible endpoints accept a given ordering still depends on the provider; trailing `assistant` content may also be treated by the model as text to continue.
