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. |
CodeArts Agent allows you to create local and cloud rules. Local rules are created on the client, while cloud rules are created on the console. Note that cloud user rules can be created either on the console or on the local client.
This section describes how to manage rules on the client. For details about how to manage cloud rules on the console, see Skill and Rule Management Center.
Local Rule Categories
| Application Scope | Applicable To | Storage Directory | Description |
|---|---|---|---|
| Project | Current project | ./.codeartsdoer/rule in the project root directory | Effective only for the current project, distributed along with the repository, and stored locally. |
| User | All projects of the current user | %USERPROFILE%/.codeartsdoer/rule | Effective for all projects of the current user, formulated based on personal habits or preferences, and stored locally. |
Constraints
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.
Creating Local Rules
The 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 project members work consistently and efficiently under common guidelines.
- Log in to CodeArts Agent IDE as instructed in Quick Start.
- Click
in the upper right corner to open the global setting 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. To use the rule, on the chat panel, enter # in the input box or click
and choose Add Context. Then click Rules and select a rule from the list.
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 to open the global setting 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. To use the rule, on the chat panel, enter # in the input box or click
and choose Add Context. Then click Rules and select a rule from the list.
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.
CodeArts Agent rules are 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 | Storage Directory | Priority Rule | Description |
|---|---|---|---|---|
| User | All projects of the current user | %USERPROFILE%/.codeartsdoer/ |
| User-exclusive AGENTS.md, custom configurations based on personal habits and preferences. |
| Project | Current project | Project root directory | Project-specific AGENTS.md applies only to the current project. |
The following describes how to create a project AGENTS.md to customize rules and their invocation effects.
- Create AGENTS.md in the project root directory in either of the following ways:
- 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, locate the target project. Create a file named AGENTS.md in the project directory.
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.
Figure 3 Custom rules loaded and taken effect
If you are using the free/basic/professional edition, ensure that your 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 to open the global setting 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 6 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. To use the rule, on the chat panel, enter # in the input box or click
and choose Add Context. Then click Rules and select a rule from the list.
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 Local 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. |
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.
What is your overall rating for this page?
Thank 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


