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

# Draft rules with AI Assist

> Describe the rule you want in plain language and let AI Assist draft it for you to review in the Visual Editor.

AI Assist drafts rules for you based on a description of what you want to achieve.
From simple product pins to advanced configurations,
AI Assist turns your request into a draft that you review in the Visual Editor,
where you can revise it further or approve it for publishing.

## Rules you can create

AI Assist can draft rules with one or several conditions, date restrictions for promotions,
or more nuanced query parameters.
For example:

| If you say | AI Assist drafts |
| - | - |
| "Boost in-stock Nike products for queries containing 'nike'." | A rule for queries that contain `nike` that boosts records where the brand is Nike and the product is in stock. |
| "Hide this discontinued product from every search result, starting now." | An always-on conditionless rule that hides one item. |
| "From Black Friday through Cyber Monday, pin our TV deals bundle for 'tv deals'." | A rule for the query `tv deals` that pins one item to position 1, active during that period. |
| "On our shoe category page, boost items where New attribute is True." | A rule scoped to the shoes category filter that boosts records where `New` is `true`. |
| "Pin these 20 products for our clearance sale", followed by a list of object IDs. | A rule that pins the pasted IDs in sequence from a starting position, using a pin block to prevent gaps in curation when an item goes missing. |
| "If someone searches 'whisky' or 'whiskey' from Scotland, promote these 4 Scotch brands and hide these 2." | A rule for either query, restricted by a rule context for the region, with 4 promoted and 2 hidden items. |
| "On the Men's Shoes category page, on mobile, show one tile per shoe style, not per color." | A rule for the category filter and a mobile context that applies the [`distinct`](https://www.algolia.com/doc/api-reference/api-parameters/distinct) search parameter. |
| "Show a banner promoting our sale at the top of results for the two weeks before Christmas." | A conditionless, date-bound rule that uses the standard **Display Banner** consequence, with an image, alt text, and link. |
| "Don't match anything else when someone searches 'PHO'. That's our Phoenix line." | A rule for the exact query `PHO` that sets [`queryType`](https://www.algolia.com/doc/api-reference/api-parameters/queryType) to `prefixNone`. |
| "For brand searches like 'nike' or 'adidas', only match against the brand field." | A rule that applies search parameters to set [`restrictSearchableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes) to `["brand"]`. |

## Create a rule with AI Assist

> [!NOTE]
>
> To create rules, you need write permissions.

1. Start a new rule in one of these ways:
   * On the **Visual Merchandiser** page, select **New rule**.
   * On the **Rules** page, select **New rule**.
   * Ask AI Assist to "create a new rule".
2. When AI Assist asks you to describe the rule, describe the outcome you want, for example, "boost in-stock red shoes when someone searches for red shoes."
3. Answer any clarifying questions.
   AI Assist checks the attributes and values you mention against your data.
   If it isn't sure what you meant, it asks you to pick from actual options instead of guessing.
4. Review the draft in the Visual Editor.
   Change the conditions, values, or scope, and check the results in the live preview.
   AI Assist doesn't publish anything without your approval.
5. Publish the rule.
   Every rule created with AI Assist has a permanent "AI-assisted" tag.
   The [Activity Logs](https://dashboard.algolia.com/account/audit-logs) record it as made by AI Assist.

## How AI Assist checks rule hygiene

Before suggesting a draft, AI Assist checks for common rule problems and compares the draft with your existing rules and search configuration:

* **Before drafting.** AI Assist checks the attributes, categories, and collections you mention against your catalog.
* **While drafting.** A best-practice check flags rules that might apply to every search, might not return any results or match any products, or might clash with an existing rule. If a rule isn't the right tool, AI Assist suggests synonyms, custom ranking, or Personalization instead.

## See also

* [Rules overview](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview)
* [Merchandising and promoting](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting)
