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

# AI rules: guide agent behavior in your project

> AI rules define persistent constraints for every Agent Mode session in a project — team conventions the agent always follows, no prompt needed.

AI rules are project-level instructions that Warp's agent follows in every session — without you having to include them in each prompt. Where a Skill packages up a reusable prompt you invoke by name, rules are always active: as long as you are working in a project that has rules configured, the agent applies them automatically. Rules are the right tool for team-wide conventions, non-negotiable constraints, and the kind of guidance that should never be forgotten.

## What rules are for

Rules work best for things that should always be true in a given project:

* **Style and convention** — "Always use `pnpm`, never `npm` or `yarn`."
* **Safety constraints** — "Never delete files in `src/migrations/` without an explicit user confirmation."
* **Testing requirements** — "Every new function must have at least one unit test."
* **Domain context** — "This is a payments service. Treat all amounts as integers in the smallest currency unit (cents)."
* **Tone and format** — "Write commit messages in the imperative mood, 72 characters or fewer."

<Note>
  Rules are enforced by including them in the agent's system prompt — they are not a hard technical constraint like a file permission. A sufficiently adversarial prompt could still override them. Use rules to guide, not to enforce security boundaries.
</Note>

## Enabling the AIRules feature

AI rules are gated behind the `AIRules` feature flag. If you do not see a **Rules** section in your agent settings, contact Warp support to request access, or check whether your account plan includes this feature.

## Configuring rules for a project

<Steps>
  <Step title="Open agent settings for the project">
    Navigate to **Settings → AI → Rules**, or open the Agent Mode input bar and click the **Rules** icon in the toolbar.
  </Step>

  <Step title="Add a rule">
    Click **Add rule** and type your instruction in the text field. Each rule is a single instruction written in plain English. Keep rules concise — one rule, one constraint.

    ```
    Always use pnpm, not npm or yarn, for package management.
    ```
  </Step>

  <Step title="Organize rules">
    Rules are applied in order. Put the most important constraints first. You can drag to reorder, and disable individual rules without deleting them.
  </Step>

  <Step title="Save and verify">
    Rules take effect immediately for new conversations. Start a new Agent Mode session and ask the agent to install a package — it should use `pnpm` without being told.
  </Step>
</Steps>

## Suggested rules

When the `SuggestedRules` feature is enabled, Warp analyzes your repository and suggests rules based on what it finds — for example, detecting your package manager, test framework, or linting configuration and proposing matching rules automatically.

Suggested rules appear in **Settings → AI → Rules → Suggestions**. Review each suggestion and click **Add** to include it, or dismiss it if it is not applicable. Suggestions are generated once when you first open a project and again when significant changes are detected.

<Tip>
  Suggested rules are a good starting point, but you should always review them before enabling. An inferred rule might be correct in most cases but wrong for your specific workflow.
</Tip>

## Rules and skills: how they interact

Rules and Skills are complementary:

|                  | Rules                       | Skills                       |
| ---------------- | --------------------------- | ---------------------------- |
| **When applied** | Always, in every session    | Only when explicitly invoked |
| **Scope**        | Project-wide                | Per run or per session       |
| **Stored in**    | Warp settings (per project) | `SKILL.md` files on disk     |
| **Best for**     | Non-negotiable constraints  | Reusable task templates      |

When you run an agent with a skill, both the rules and the skill instructions are included in the system prompt. Rules are included first, so they take precedence in any conflict. If a skill says "write informal comments" but a rule says "write formal docstrings", the rule wins.

## Example rules

Here are some concrete examples to illustrate what effective rules look like.

<AccordionGroup>
  <Accordion title="Package management">
    ```
    Always use pnpm for package management. Never run npm install or yarn add.
    ```
  </Accordion>

  <Accordion title="Testing">
    ```
    Every new exported function must have at least one test in the corresponding *.test.ts file. Do not mark a task complete if tests are missing.
    ```
  </Accordion>

  <Accordion title="Migration safety">
    ```
    Never modify or delete files under db/migrations/. If a migration change is needed, create a new migration file instead.
    ```
  </Accordion>

  <Accordion title="Branch naming">
    ```
    When creating a new branch, use the format: <type>/<short-description> where type is one of: feat, fix, chore, docs, refactor.
    ```
  </Accordion>

  <Accordion title="Domain context">
    ```
    This service processes financial transactions. All monetary amounts are stored as integers in cents (USD). Never use floating-point arithmetic for money calculations.
    ```
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Skills" icon="book-open" href="/agent/skills">
    Package reusable prompt instructions that complement your rules.
  </Card>

  <Card title="Agent Mode" icon="robot" href="/agent/agent-mode">
    Use rules and skills together in your local terminal session.
  </Card>

  <Card title="MCP servers" icon="plug" href="/agent/mcp-servers">
    Extend the agent with external tools from MCP servers.
  </Card>

  <Card title="Cloud agents" icon="cloud" href="/cloud/overview">
    Run rule-guided agents headlessly in the cloud.
  </Card>
</CardGroup>
