|
| 1 | +--- |
| 2 | +title: "Organization Rules" |
| 3 | +description: "Configure global rules that apply across all repositories in your organization" |
| 4 | +--- |
| 5 | + |
| 6 | +# Organization Rules |
| 7 | + |
| 8 | +Organization Rules allow you to specify global instructions that the Codegen agent will follow across all repositories in your organization. These rules act as organization-wide guidelines that ensure consistent behavior and standards across your entire codebase. |
| 9 | + |
| 10 | +## How Organization Rules Work |
| 11 | + |
| 12 | +When you define Organization Rules, they are automatically applied to every agent run within your organization, regardless of which repository the agent is working on. This provides a centralized way to enforce: |
| 13 | + |
| 14 | +- Coding standards and conventions |
| 15 | +- Security practices |
| 16 | +- Documentation requirements |
| 17 | +- Git workflow preferences |
| 18 | +- Communication styles |
| 19 | + |
| 20 | +## Rule Hierarchy |
| 21 | + |
| 22 | +Organization Rules work in conjunction with Repository Rules to provide flexible rule management: |
| 23 | + |
| 24 | +1. **Organization Rules** are applied first as the baseline for all repositories |
| 25 | +2. **Repository Rules** can override or extend Organization Rules for specific repositories |
| 26 | +3. If both are defined, Repository Rules take precedence for conflicting instructions |
| 27 | + |
| 28 | +This hierarchy allows you to set organization-wide defaults while still maintaining repository-specific customizations when needed. |
| 29 | + |
| 30 | +## Setting Up Organization Rules |
| 31 | + |
| 32 | +To configure Organization Rules: |
| 33 | + |
| 34 | +1. Navigate to your organization settings |
| 35 | +2. Select **Organization Rules** from the sidebar |
| 36 | +3. Enter your rules in the text area provided |
| 37 | +4. Click **Save** to apply the rules |
| 38 | + |
| 39 | +## Example Organization Rules |
| 40 | + |
| 41 | +Here are some common examples of Organization Rules: |
| 42 | + |
| 43 | +### Git Workflow Standards |
| 44 | +``` |
| 45 | +Always use git add . when staging changes for commit |
| 46 | +Never use git push --force under any circumstances |
| 47 | +Always create descriptive commit messages following conventional commit format |
| 48 | +``` |
| 49 | + |
| 50 | +### Code Quality Standards |
| 51 | +``` |
| 52 | +Always include comprehensive error handling in new functions |
| 53 | +Follow the existing code style and formatting conventions |
| 54 | +Add unit tests for any new functionality |
| 55 | +Include JSDoc comments for all public functions |
| 56 | +``` |
| 57 | + |
| 58 | +### Security Guidelines |
| 59 | +``` |
| 60 | +Never commit sensitive information like API keys or passwords |
| 61 | +Always validate user input before processing |
| 62 | +Use environment variables for configuration values |
| 63 | +``` |
| 64 | + |
| 65 | +### Documentation Requirements |
| 66 | +``` |
| 67 | +Update README files when adding new features |
| 68 | +Include inline comments for complex logic |
| 69 | +Document any breaking changes in commit messages |
| 70 | +``` |
| 71 | + |
| 72 | +## Best Practices |
| 73 | + |
| 74 | +### Keep Rules Clear and Specific |
| 75 | +- Write rules that are easy to understand and follow |
| 76 | +- Be specific about what you want the agent to do or avoid |
| 77 | +- Use clear, actionable language |
| 78 | + |
| 79 | +### Avoid Conflicting Rules |
| 80 | +- Ensure Organization Rules don't contradict each other |
| 81 | +- Consider how they might interact with Repository Rules |
| 82 | +- Test rules with different types of tasks |
| 83 | + |
| 84 | +### Regular Review and Updates |
| 85 | +- Periodically review your Organization Rules for relevance |
| 86 | +- Update rules as your organization's practices evolve |
| 87 | +- Remove outdated or unnecessary rules |
| 88 | + |
| 89 | +### Balance Global vs Repository-Specific Rules |
| 90 | +- Use Organization Rules for truly universal standards |
| 91 | +- Reserve Repository Rules for project-specific requirements |
| 92 | +- Avoid duplicating rules between levels |
| 93 | + |
| 94 | +## Troubleshooting |
| 95 | + |
| 96 | +### Rules Not Being Applied |
| 97 | +If your Organization Rules don't seem to be working: |
| 98 | + |
| 99 | +1. **Check Rule Syntax**: Ensure your rules are clearly written and unambiguous |
| 100 | +2. **Verify Save**: Make sure you clicked "Save" after entering your rules |
| 101 | +3. **Repository Override**: Check if Repository Rules are overriding your Organization Rules |
| 102 | +4. **Rule Conflicts**: Look for contradictory instructions that might confuse the agent |
| 103 | + |
| 104 | +### Agent Behavior Issues |
| 105 | +If the agent isn't following your rules as expected: |
| 106 | + |
| 107 | +1. **Simplify Rules**: Break complex rules into smaller, more specific instructions |
| 108 | +2. **Add Context**: Provide more context about when and how rules should be applied |
| 109 | +3. **Test Incrementally**: Add rules gradually to identify which ones work best |
| 110 | + |
| 111 | +## Related Settings |
| 112 | + |
| 113 | +- **[Repository Rules](/settings/repo-rules)**: Set repository-specific rules that can override Organization Rules |
| 114 | +- **[Agent Permissions](/settings/agent-permissions)**: Control what actions the agent can perform |
| 115 | +- **[Model Configuration](/settings/model-configuration)**: Configure which AI model the agent uses |
| 116 | + |
| 117 | +Organization Rules provide a powerful way to maintain consistency across your entire organization while still allowing flexibility for individual repositories. Use them to establish your organization's coding culture and ensure all agent interactions align with your standards. |
| 118 | + |
0 commit comments