Skip to content

Commit 570b4fa

Browse files
Add user rules to agent rules documentation
- Added user rules as the first level in the three-tier hierarchy - Updated rule precedence: Repository > Organization > User - Added user rules configuration section with 'Coming Soon' note - Included user-level rule examples for personal preferences - Updated rule resolution process to include all three levels - Enhanced hierarchy examples to show user, org, and repo rules working together Co-authored-by: Jay Hack <[email protected]>
1 parent 5d78f48 commit 570b4fa

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

docs/settings/repo-rules.mdx

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ Agent Rules in Codegen act as persistent instructions or "system prompts" for th
88

99
## Rule Hierarchy
1010

11-
Codegen supports a hierarchical rule system with two levels:
11+
Codegen supports a hierarchical rule system with three levels:
1212

13-
1. **Organization Rules** - Apply to all repositories within your organization
14-
2. **Repository Rules** - Apply to a specific repository and override organization rules when conflicts exist
13+
1. **User Rules** - Personal preferences that apply to all your work across organizations
14+
2. **Organization Rules** - Apply to all repositories within your organization
15+
3. **Repository Rules** - Apply to a specific repository and override higher-level rules when conflicts exist
1516

1617
<Note>
17-
**Rule Precedence**: Repository rules take precedence over organization rules when conflicts exist. This allows you to set organization-wide defaults while customizing specific repositories as needed.
18+
**Rule Precedence**: Repository rules take precedence over organization rules, which take precedence over user rules when conflicts exist. This allows you to set personal defaults, organization-wide standards, and repository-specific customizations.
1819
</Note>
1920

2021
## Types of Rules
@@ -36,16 +37,35 @@ Rules automatically discovered from files in your repository (repository level o
3637
When an agent is assigned a task, all applicable rules are automatically included in the agent's context as "Mandatory User Rules." The agent sees these rules alongside the actual task or prompt it receives, ensuring consistent behavior.
3738

3839
**Rule Resolution Process:**
39-
1. **Organization Rules** are loaded first (if configured for your organization)
40-
2. **Repository Rules** are loaded next (if configured for the specific repository)
41-
3. **Repository rules override organization rules** when conflicts exist
42-
4. **Automatic rule files** are discovered and included (repository level only)
43-
5. All rules are combined and presented to the agent as mandatory constraints
40+
1. **User Rules** are loaded first (if configured in your personal settings)
41+
2. **Organization Rules** are loaded next (if configured for your organization)
42+
3. **Repository Rules** are loaded next (if configured for the specific repository)
43+
4. **Higher-level rules override lower-level rules** when conflicts exist (Repository > Organization > User)
44+
5. **Automatic rule files** are discovered and included (repository level only)
45+
6. All rules are combined and presented to the agent as mandatory constraints
4446

45-
For example, if your organization has a rule "Use TypeScript for all new code" and a specific repository has a rule "Use JavaScript for this legacy project," the repository rule takes precedence for that specific repository.
47+
For example, if you have a user rule "Always use semicolons in JavaScript," your organization has a rule "Use TypeScript for all new code," and a specific repository has a rule "Use JavaScript for this legacy project," the repository rule takes precedence, followed by the organization rule, then your personal user rule.
4648

4749
## Configuring Agent Rules
4850

51+
### User Rules
52+
53+
User rules are personal preferences that apply to all your work across organizations. These are perfect for setting your individual coding style, preferred tools, or workflow preferences.
54+
55+
**To configure user rules:**
56+
1. Navigate to your personal settings in the Codegen web interface
57+
2. Look for the "User Rules" or "Personal Agent Rules" section
58+
3. Enter your personal preferences and coding standards
59+
4. Click "Save" to apply them across all organizations and repositories you work with
60+
61+
<Tip>
62+
User rules are ideal for personal preferences like "Always include detailed commit messages," "Prefer functional programming patterns," or "Use specific linting configurations."
63+
</Tip>
64+
65+
<Note>
66+
**Coming Soon**: User-level rules are currently being implemented and will be available in an upcoming release. The infrastructure is in place, and this feature will allow you to set personal coding preferences that follow you across all organizations.
67+
</Note>
68+
4969
### Organization Rules
5070

5171
Organization rules apply to all repositories within your organization and serve as default behavior guidelines.
@@ -148,6 +168,20 @@ When rules are discovered, they are displayed in the AgentTrace under the `SetAc
148168

149169
Agent rules are flexible and can be used for various purposes across different levels:
150170

171+
### User-Level Rules Examples
172+
173+
Perfect for personal preferences that should apply across all your work:
174+
175+
- **Personal Coding Style:**
176+
- "I prefer functional programming patterns over object-oriented when possible."
177+
- "Always include detailed JSDoc comments for functions with more than 2 parameters."
178+
- **Workflow Preferences:**
179+
- "Include performance considerations in code reviews for any loops or database queries."
180+
- "Prefer explicit error handling over try-catch blocks when the error is expected."
181+
- **Tool Preferences:**
182+
- "Use my preferred linting configuration and code formatting style."
183+
- "Always suggest using TypeScript strict mode for new projects."
184+
151185
### Organization-Level Rules Examples
152186

153187
Perfect for organization-wide standards that should apply to all repositories:
@@ -178,16 +212,17 @@ Perfect for repository-specific requirements that may override organization defa
178212

179213
### Rule Hierarchy in Action
180214

181-
Here's how organization and repository rules work together:
215+
Here's how user, organization, and repository rules work together:
182216

217+
**User Rule:** "I prefer detailed error messages with context"
183218
**Organization Rule:** "Use TypeScript for all new code"
184219
**Repository Rule:** "This legacy project uses JavaScript - do not convert existing files"
185-
**Result:** The agent will use JavaScript for this specific repository while using TypeScript for all other repositories in the organization.
220+
**Result:** The agent will use JavaScript for this specific repository (repository rule wins), but will still include detailed error messages (user rule applies) since there's no conflict.
186221

187222
<Tip>
188223
Keep your rules concise and clear. Overly complex or numerous rules might confuse the agent or lead to suboptimal performance. Focus on the most critical guidelines for your organization and repositories.
189224
</Tip>
190225

191226
<Note>
192-
All agent rules (organization, repository, and automatic rule files) are applied *in addition* to any global prompting strategies or agent capabilities. They provide a hierarchical layer of instruction that helps ensure consistent behavior across your organization and codebases.
227+
All agent rules (user, organization, repository, and automatic rule files) are applied *in addition* to any global prompting strategies or agent capabilities. They provide a hierarchical layer of instruction that helps ensure consistent behavior across your personal work, organization, and codebases.
193228
</Note>{" "}

0 commit comments

Comments
 (0)