Skip to main content

How to Use Rules in the Divi AI Agent

Learn how to save rules that tell the Divi AI Agent how you work, so you stop repeating yourself in every chat.

A rule is an instruction you save once, and the Divi AI Agent follows it in every conversation afterward - no retyping your brand colors, your spacing preferences, or your accessibility standards into every request.

This article covers creating a rule in the AI Rule Editor, the difference between a rule that's always applied and one the Agent applies at its own judgment, and a set of rules worth writing for your own projects.

Creating a Rule

Divi 5 - Open the Rules List
  1. Open the Divi AI Agent by clicking on the Divi AI Agent icon in the left sidebar.

  2. Click the Rules icon to open the rules list.

  3. Click Add New Rule. The AI Rule Editor opens.

  4. Fill in the four fields:

    • Title - "Give this rule a short name to identify it in the rules list."

    • Rule - "Write the exact instruction the AI agent should follow."

    • When To Use - "Describe when the AI agent should apply this rule."

    • Always Use - "Enable to include this rule with every AI request automatically."

  5. Save the rule. It's now available to the Agent in this and every future conversation.

Note: Adding a rule this way, through the rules list, doesn't ask for confirmation. If you instead ask the Agent itself to create a rule for you in chat, it will ask you to confirm before publishing it.

Always Use vs When To Use

Divi 5 - Rules options

This is the distinction that decides how useful a rule actually is.

Turn Always Use on and the rule rides along with every single request you send the Agent, no exceptions. That's the right setting for something that should never vary - a brand voice, a color rule, a standard you want enforced everywhere, all the time.

Rule Example:

Title: Brand Voice

Rule: Write all copy in a friendly, plain-language tone. No jargon, no exclamation points.

Always Use: On

Every request you send, from writing a headline to filling in a form's confirmation message, gets checked against that instruction.

Leave Always Use off, and the rule depends entirely on what you write in When To Use.

The Agent reads that description and decides for itself, request by request, whether the rule applies - so it doesn't crowd out every conversation with instructions that only matter sometimes.

Rule Example:

Title: Form Field Spacing

Rule: Use 24px gaps between form fields and 40px above the submit button

When to Use: When building or editing a form.

Always Use: Off

With such a rule, ask the AI Agent to build a pricing table, and this rule never comes into play, but if it is asked to build a contact form, it applies automatically, without you mentioning spacing at all.

Rules of thumb:

  • If an instruction should hold everywhere, turn Always Use on.

  • If it only applies to a specific kind of task, describe that task in When To Use and leave Always Use off.

Rules Worth Writing

A few starting points, written the way you'd actually type them into the Rule field:

  • Brand voice. "Write all copy in a friendly, plain-language tone. Avoid technical jargon and exclamation points." (Always Use)

  • Spacing scale. "Use only these spacing values for padding and margin: 8px, 16px, 24px, 40px, 64px. Never use an arbitrary number in between." (Always Use)

  • Global Variables over hex codes. "Always apply an existing Global Variable for color, font, and spacing values instead of typing a hex code or a raw number." (Always Use)

  • Preferred presets. "When adding a button, apply the 'Primary CTA' preset instead of styling one from scratch." See Presets for how to build and save one. (When To Use: "When adding or restyling a button")

  • Accessibility defaults. "Every image needs descriptive alt text, and body text must keep at least a 4.5:1 contrast ratio against its background." (Always Use)

  • Heading levels. "Use only one H1 per page. Section titles are H2, and anything nested inside a section is H3 or lower - never skip a level." (When To Use: "When adding or editing headings")

  • Button copy. "Button labels should be two to four words and start with a verb, like 'Get Started' or 'View Pricing,' never plain text like 'Click Here.'" (Always Use)

  • Mobile spacing. "On mobile, reduce section top and bottom padding to 40px regardless of what it is on desktop." (When To Use: "When styling a section for mobile")

Adapt the wording to how you actually work. The Agent reads the Rule field as plain instructions, not code, so write it the way you'd explain it to a new team member.

Add Context to a Rule

Divi 5 AI Agent - Add Context to a Rule

A rule can reference something specific rather than describing it in words.

  1. Open the AI Rule Editor.

  2. Click the Context icon Ai Agent - Add Context icon to attach a preset, variable, or other piece of context directly to the rule - so instead of writing "use the blue we usually use," the rule points straight at the Global Variable or preset you selected in the Context selection.

Nesting Rules

Divi 5 AI Agent - Add nested Rules
  1. Open the AI Rule Editor.

  2. Click on the Rule icon inside the AI Rule Editor.

This is worth doing when several rules share a common instruction - nest the shared rule into each of the others instead of retyping it, so updating it in one place updates everywhere it's used.

Editing, Duplicating and Deleting Rules

  1. In the AI Agent chat window, click on the Rules icon .

  2. Hover over a custom rule:

    1. Edit Rule Divi 5 settings icon: Edit the selected rule.

    2. Duplicate Rule Divi 5 - Duplicate Icon: Duplicate the current rule and use it as a starting point for a new rule.

    3. Delete Rule Divi 5 - Trash icon: Delete the selected rule.

If you ask the Agent to update or delete a rule for you in chat, rather than doing it from the list, it always asks for confirmation first - this is one of the Agent's higher-risk actions. For more details, check the Approvals and Risk Levels in the Divi AI Agent article.

Rules vs Commands

A rule is how you want work done; a command is a job you want done. A rule about spacing or tone applies quietly in the background across every request that matches it. A command is a saved prompt you actively trigger, like a shortcut for a request you send often. For more details, check out the How to Use Commands in the Divi AI Agent article.

Did this answer your question?