Updated on 2026-07-29 GMT+08:00

Rules

Constraints are imposed on agent behavior through custom rules to enable a more accurate understanding of and strict compliance with relevant specifications.

Table 1 Comparison between rules and other functions

Dimension

Rule

Skill

MCP Server

Definition

Constrains the behavior of an agent.

Describes how to complete a specific task.

Invokes external tools.

Loading method

Is loaded into the context at the beginning of a chat for continuous inference.

Is loaded on demand to reduce context usage.

Is not involved in the inference process; calls external interfaces as required.

Application scenario

Defines code specifications, output formats, team collaboration agreements, etc.

Example: Code must comply with PEP 8 specifications.

Encapsulates testing processes, development tasks, complex business logic, etc.

Example: executing UI automated testing.

Connects to external systems to perform specific operations.

Example: controlling browser-related operations.

Key differences

Controls how an agent should behave, defining the behavior boundary.

Specifies how to complete a task, serving as a process guide.

Provides the capability to invoke tools, representing the execution dimension.

Rule Types

Rules are classified into local and cloud agents by creation method, and are divided into enterprise-level, team-level, project-level, and user-level agents by scope of application. You can select the most appropriate rules according to specific development scenarios and collaboration needs, achieving flexible and efficient code management.

Table 2 Rule types

Creation Method

Scope of Application

Description

Local

Project

Effective only for the current project, distributed along with the repository, and stored locally.

Rule file storage directory: ./.codeartsdoer/rule in the root directory of the project.

User

Effective for all projects of the current user, formulated based on personal habits or preferences, and stored locally.

Local storage directory: %USERPROFILE%/.codeartsdoer/rule

Cloud

Enterprise

Rules unified across the enterprise, available to all members, created by the enterprise administrator, and stored in the cloud.

Team

Rules unified across the team, available to specific teams, created by the enterprise administrator or team administrator, and stored in the cloud.

User

Rules formulated based on personal habits or preferences, available only to the members themselves, and stored in the cloud.

If rules with the same name exist, the rule invocation priority is as follows: cloud enterprise rules > cloud team rules > local project rules > local user rules > cloud user rules.

Constraints

Only the basic and professional packages support the creation of cloud rules.

Creating Local Rules

CodeArts Agent client allows the creation of both project and user rules. They are stored locally. You can select rules based on development scenarios and collaboration requirements to achieve efficient and accurate code management.

Custom rules for the project are shared alongside the code repository, helping teams work consistently and efficiently under common guidelines.

  1. Log in to CodeArts Agent IDE as instructed in Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
  4. On the Project tab, click next to a rule.
  5. Set parameters for creating a local project rule as instructed in Table 3.

    Figure 1 Creating a project rule
    Table 3 Parameters for creating a local project rule

    Parameter

    Description

    Rule Name

    Name of the rule to be created.

    Naming rules: Enter 1 to 64 characters. The following special characters are not allowed: \/:*?"<>|

    Applicable Scope

    Application scope of a rule, that is, where the rule takes effect.

    • Auto Apply: The rule applies to all chats by default and is automatically identified by the system.
    • Manual Call: The rule does not take effect automatically. You must enter # in the chat area and select a specific rule from the list to apply it.

    Description

    (Optional) Description of the rule. Enter up to 200 characters.

    Content

    Rule content, instructing the agent to respond consistently and predictably in certain situations. Enter up to 50,000 characters.

  6. Click OK to complete the rule creation.

    On the Project tab, view the created local project rule. It is stored in the ./.codeartsdoer/rule directory of the project root directory.

User rules are created according to personal habits and preferences. CodeArts Agent applies these rules consistently across all projects to deliver results tailored to user style.

  1. Log in to CodeArts Agent IDE as instructed in Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
  4. On the User tab, click next to a rule.
  5. Set parameters for creating a local user rule as instructed in Table 4.

    Figure 2 Creating a local user rule
    Table 4 Parameters for creating a local user rule

    Parameter

    Description

    Rule Name

    Name of the rule to be created.

    Naming rules: Enter 1 to 64 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed.

    Applicable Scope

    Application scope of a rule, that is, where the rule takes effect.

    • Auto Apply: The rule applies to all chats by default and is automatically identified by the system.
    • Manual Call: The rule does not take effect automatically. You must enter # in the chat area and select a specific rule from the list to apply it.

    Type

    Location where the rule is stored. If you select Local, the user rule is stored locally.

    Description

    (Optional) Description of the rule. Enter up to 200 characters.

    Content

    Rule content, instructing the agent to respond consistently and predictably in certain situations. Enter up to 50,000 characters.

  6. Click OK to complete the rule creation.

    On the User tab, view the created local user rule. It is stored in the %USERPROFILE %/.codeartsdoer/rule directory on the local.

CodeArts Agent rules are now compatible with the AGENTS.md file. You only need to place the AGENTS.md file into the corresponding directory, and CodeArts Agent will automatically recognize and apply the rules defined in the file.

Table 5 Levels of the AGENTS.md file

Level

Scope

Priority Rule

Description

User

All projects under the current account

  • Existing rules take priority: When the content in AGENTS.md conflicts with existing rules, the existing rules shall prevail.
  • Project configuration takes priority: When user and project AGENTS.md files coexist and their content conflicts, the project AGENTS.md shall prevail.

User-exclusive AGENTS.md, custom configurations based on personal habits and preferences.

Local storage directory: %USERPROFILE%/.codeartsdoer/

Project

Current project

Project-specific AGENTS.md applies only to the current project.

Storage directory: the root directory of the project

The following describes how to create a project AGENTS.md to customize rules and their invocation effects.

  1. Create a project AGENTS.md.

    Create an AGENTS.md file in the root directory of the project for instructing project agent behaviors. Use either of the following methods:
    • Local creation: Locate the target project folder on the local machine. Create a file named AGENTS.md in the root directory of the project.
    • Creation on CodeArts Agent: Log in to CodeArts Agent IDE as instructed in Quick Start. In the explorer area, locate the target project. Create a file named AGENTS.md under this project.

    Example configuration of AGENTS.md:

    # Project Agent Code of Conduct
    ## 1. Scope Declaration
    This rule takes effect only for chats within the current project context.
    ## 2. Core Response Constraints
    - Structured expression: Responses must adopt a clear hierarchical structure (such as lists, headings, and bold text) to avoid large blocks of unformatted text. The logic needs to progress step by step, with key points highlighted.
    - Factual rigor: Fabricating uncertain information is strictly prohibited. For professional domain content, accuracy must be ensured. If information is missing, explicitly state "unable to confirm" instead of making guesses.
    - Tone and style: Keep the tone professional yet friendly, and appropriately use relaxed and natural expressions.
    ## 3. Mandatory Requirements
    After each response ends, the following fixed closing statement must and can only be added, and no other content shall be modified, omitted, or added:
    The answer is complete. If you have any other questions, feel free to let me know at any time.

  2. Initiate a chat in the agent to verify the output effect.

    The output of the agent strictly complies with the style requirements defined in Core Response Constraints. In addition, the standard closing statement "The answer is complete. If you have any other questions, feel free to let me know at any time." is automatically appended to the end of the session. This indicates that the custom rules in AGENTS.md have been successfully loaded and taken effect.

Creating Cloud Rules

The cloud (CodeArts Agent console) supports the creation of three categories of rules: enterprise rules, team rules, and user rules, among which cloud user rules can be created either on the cloud or locally.

Before creating a cloud rule, ensure that you have purchased basic or professional edition.

To create an enterprise rule, a team rule, or user rule on the cloud, perform the following steps:

  1. Log in to the CodeArts Agent console.
  2. In the navigation pane on the left, choose Agent Settings > Skills and Rules. The skill and rule lists are displayed.
  3. On the Rules tab, click Add Rule in the upper right corner. The Add Rule dialog box is displayed.
  4. Set the parameters based on Table 6.

    Figure 3 Creating a cloud rule
    Table 6 Cloud rule parameters

    Parameter

    Description

    Name

    Name of the rule to be created.

    Naming rules: Enter 1 to 64 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed.

    Content

    Customize one or more rules. The value can contain a maximum of 50,000 characters.

    Example: requiring the system to always respond using Python.

    Application Scope

    Application scope of a rule, that is, where the rule takes effect.

    • Auto Apply: The rule applies to all chats by default and is automatically identified by the system.
    • Manual Call: The rule does not take effect automatically. You must enter # in the chat area and select a specific rule from the list to apply it.

    Applied To

    • Private: available only to the members themselves and will not be shared with other users.
    • Enterprise: available to all members of the entire enterprise, and can only be created by enterprise administrators.
    • Team: available to specified teams and can be created by enterprise administrators or team administrators.

    Teams

    This parameter is displayed only when Applied To is set to Team.

    Select a team from the drop-down list. If no team has been created, create one first.

    Enterprise administrators can view and select all teams, while team administrators can only view and select the team they belong to.

    Tag

    (Optional) Several types of tags have been preset in CodeArts Agent. Select tags from the drop-down list as required.

    Brief Description

    (Optional) Description of the rule. Enter up to 1,024 characters.

  5. Click Confirm and Enable to complete the rule creation.

    On the Rules tab, view the created rule. To immediately view the created cloud rule on the client, go to the corresponding rule tab (Enterprise/Team/User) under Skills and Rules on the client, and click in the rules area. Then the cloud rule is synchronized to the client.

    • The CodeArts Agent client automatically synchronizes cloud rules every 24 hours.
    • The CodeArts Agent client synchronizes only enabled rules.

The account has been assigned a seat. If not, cloud user rules cannot be created.

  1. Log in to CodeArts Agent IDE as instructed in Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
  4. On the User tab, click next to a rule.
  5. Set parameters for creating a user rule as instructed in Figure 4.

    Figure 4 User rule
    Table 7 Parameters for creating a user rule

    Parameter

    Description

    Rule Name

    Name of the rule to be created.

    Naming rules: Enter 1 to 64 characters. Only letters, digits, underscores (_), hyphens (-), and periods (.) are allowed.

    Applicable Scope

    Application scope of a rule, that is, where the rule takes effect.

    • Auto Apply: The rule applies to all chats by default and is automatically identified by the system.
    • Manual Call: The rule does not take effect automatically. You must enter # in the chat area and select a specific rule from the list to apply it.

    Type

    Location where the rule is stored. If you select Cloud, the user rule is stored on the cloud.

    Description

    (Optional) Description of the rule. Enter up to 200 characters.

    Content

    Rule content, instructing the agent to respond consistently and predictably in certain situations. Enter up to 50,000 characters.

  6. Click OK to complete the rule creation.

    On the User tab, view the created cloud user rule.

Referencing a Rule in Chat

  • Automatically-applied rules: They take effect for all chats by default and are automatically identified by the system.
  • Manually-applied rules: To use them, you need to enter # in the chat area, or click and choose Add Context. Then click Rules and select the target rule.
    Figure 5 Adding context to select rules

Managing Rules

CodeArts Agent IDE supports full lifecycle management of rules, helping users efficiently control and continuously optimize them based on business needs.

Table 8 Managing Local Rules

Operation

Procedure

Editing a local rule

On the settings page of CodeArts Agent IDE, choose Skills and Rules > Project > Rules or Skills and Rules > User > Rules. Hover the cursor on the target rule and click to edit the rule.

Deleting a local rule

On the settings page of CodeArts Agent IDE, choose Skills and Rules > Project > Rules or Skills and Rules > User > Rules. Hover the cursor on the target rule and click to delete the rule.

The target rule disappears from the list once successfully deleted.

CAUTION:

Deleting a rule will affect the agents using it. Deleted rules cannot be recovered. Exercise caution when performing this operation.

Table 9 shows the operation permissions of different roles on managing cloud rules.

Table 9 Operation permissions of different roles on cloud rules

Role

Enterprise Rule

Team Rule

User Rule (Operations Except Editing)

User Rule (Editing)

Enterprise administrators

All operations on all rules.

All operations on all rules.

All operations except editing on all rules.

Editing on rules created by themselves.

Team administrators

The following operations can be performed:

  • Favorite or unfavorite rules.
  • Modify the application scope of cloud rules.

All operations on rules created by members of their own team (including the team administrator).

All operations except editing on rules created by members of their own team (including the team administrator).

Editing on rules created by themselves.

Team members

The following operations can be performed:

  • Favorite or unfavorite rules.
  • Modify the application scope of cloud rules.

The following operations can be performed on rules created by members of their own team (including the team administrator):

  • Favorite or unfavorite rules.
  • Modify the application scope of cloud rules.

All operations except editing on rules created by themselves.

Editing on rules created by themselves.

Enterprise members

The following operations can be performed:

  • Favorite or unfavorite rules.
  • Modify the application scope of cloud rules.

No operation permissions.

All operations except editing on rules created by themselves.

Editing on rules created by themselves.

Table 10 Managing cloud rules

Operation

Procedure

Editing a cloud rule

  1. On the CodeArts Agent console, choose Skills & Rules, click the Rules tab, and view the status of the target rule.
    • If it is enabled, disable it first.
    • If it is disabled, go to the next step to edit the rule.
  2. Click Edit next to the target rule.

Deleting a cloud rule

  1. On the CodeArts Agent console, choose Skills & Rules, click the Rules tab, and view the status of the target rule.
    • If it is enabled, disable it first.
    • If it is disabled, go to the next step to delete the rule.
  2. Click Delete next to the target rule.

    The target rule disappears from the list once successfully deleted.

CAUTION:

Deleting a rule will affect the agents using it. Deleted rules cannot be recovered. Exercise caution when performing this operation.

Enabling or disabling a cloud rule

On the CodeArts Agent console, choose Skills & Rules, click the Rules tab, and click / next to the target rule.

Only enabled rules can be synchronized to the CodeArts Agent client.

Adding a cloud rule to favorites or removing it

On the CodeArts Agent console, choose Skills & Rules, click the Rules tab, and click Favorite or Unfavorite next to the target rule.

View the favorites on the Favorites tab.

Batch deleting cloud rules

  1. On the CodeArts Agent console, choose Skills & Rules, click the Rules tab, and view the status of the target rule.
    • If it is enabled, disable it first.
    • If it is disabled, go to the next step to delete the rule.
  2. Select the target rules and choose More > Batch Delete in the upper right corner. A confirmation dialog box is displayed.
  3. Enter DELETE or click Autofill, and then click OK.

    The target rule disappears from the list once successfully deleted.

Batch enabling or disabling cloud rules

On the CodeArts Agent console, choose Skills & Rules, and click the Rules tab. Select the target rules and click Batch Enable or choose More > Batch Disable in the upper right corner.

Only enabled rules can be synchronized to the CodeArts Agent client.

Batch adding cloud rules to favorites or removing them

On the CodeArts Agent console, choose Skills & Rules, and click the Rules tab. Select the target rules and choose More > Batch Favorite or More > Batch Unfavorite in the upper right corner.

View the favorites on the Favorites tab.

Modifying the application scope of cloud enterprise rules or team rules

On the settings page of CodeArts Agent IDE, choose Skills and Rules > Enterprise > Rules or Skills and Rules > Team > Rules. Locate the target rule and click the switch next to it.

  • : You need to manually apply the rule.
  • : The system automatically identifies the rule and applies it.

Batch modifying the application scope of cloud enterprise rules or team rules

  1. On the settings page of CodeArts Agent IDE, choose Skills and Rules > Enterprise > Rules or Skills and Rules > Team > Rules. Click in the upper right corner.
  2. Select the target rules and click Enable or Disable in the upper right corner.

Related Documents

For an end-to-end usage example of the rules, refer to AI Drawing Logic Construction Practice Based on Custom Rules. This practice configures rule constraints over the AI process of graphing sin(x) to achieve standardized generation with precise coordinates, consistent formatting, and controllable results.