Rules
Constraints are imposed on agent behavior through custom rules to enable a more accurate understanding of and strict compliance with relevant specifications.
| 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.
| 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.
- Log in to CodeArts Agent IDE as instructed in Quick Start.
- Click
in the upper right corner of CodeArts Agent IDE to open the settings page. - In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
- On the Project tab, click
next to a rule. - 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.
- 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.
- Log in to CodeArts Agent IDE as instructed in Quick Start.
- Click
in the upper right corner of CodeArts Agent IDE to open the settings page. - In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
- On the User tab, click
next to a rule. - 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.
- 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.
| Level | Scope | Priority Rule | Description |
|---|---|---|---|
| User | All projects under the current account |
| 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.
- 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.
- 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:
- Log in to the CodeArts Agent console.
- In the navigation pane on the left, choose Agent Settings > Skills and Rules. The skill and rule lists are displayed.
- On the Rules tab, click Add Rule in the upper right corner. The Add Rule dialog box is displayed.
- 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.
- 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.
- Log in to CodeArts Agent IDE as instructed in Quick Start.
- Click
in the upper right corner of CodeArts Agent IDE to open the settings page. - In the navigation pane on the left, choose Skills and Rules. The Installed tab is displayed.
- On the User tab, click
next to a rule. - Set parameters for creating a user rule as instructed in Figure 4.
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.
- 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.
| 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 |
| 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 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.
| 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:
| 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:
| The following operations can be performed on rules created by members of their own team (including the team administrator):
| All operations except editing on rules created by themselves. | Editing on rules created by themselves. |
| Enterprise members | The following operations can be performed:
| No operation permissions. | All operations except editing on rules created by themselves. | Editing on rules created by themselves. |
| Operation | Procedure |
|---|---|
| Editing a cloud rule |
|
| Deleting a cloud rule |
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 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 |
|
| 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.
|
| Batch modifying the application scope of cloud enterprise rules or team rules |
|
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot







