You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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]>
Copy file name to clipboardExpand all lines: docs/settings/repo-rules.mdx
+48-13Lines changed: 48 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,14 @@ Agent Rules in Codegen act as persistent instructions or "system prompts" for th
8
8
9
9
## Rule Hierarchy
10
10
11
-
Codegen supports a hierarchical rule system with two levels:
11
+
Codegen supports a hierarchical rule system with three levels:
12
12
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
15
16
16
17
<Note>
17
-
**Rule Precedence**: Repository rules take precedence over organization ruleswhen 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.
18
19
</Note>
19
20
20
21
## Types of Rules
@@ -36,16 +37,35 @@ Rules automatically discovered from files in your repository (repository level o
36
37
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.
37
38
38
39
**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)
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
44
46
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.
46
48
47
49
## Configuring Agent Rules
48
50
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
+
49
69
### Organization Rules
50
70
51
71
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
148
168
149
169
Agent rules are flexible and can be used for various purposes across different levels:
150
170
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
+
151
185
### Organization-Level Rules Examples
152
186
153
187
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
178
212
179
213
### Rule Hierarchy in Action
180
214
181
-
Here's how organization and repository rules work together:
215
+
Here's how user, organization, and repository rules work together:
182
216
217
+
**User Rule:** "I prefer detailed error messages with context"
183
218
**Organization Rule:** "Use TypeScript for all new code"
184
219
**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.
186
221
187
222
<Tip>
188
223
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.
189
224
</Tip>
190
225
191
226
<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.
0 commit comments