Organization Rules

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.

How Organization Rules Work

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:

  • Coding standards and conventions
  • Security practices
  • Documentation requirements
  • Git workflow preferences
  • Communication styles

Rule Hierarchy

Organization Rules work in conjunction with Repository Rules to provide flexible rule management:

  1. Organization Rules are applied first as the baseline for all repositories
  2. Repository Rules can override or extend Organization Rules for specific repositories
  3. If both are defined, Repository Rules take precedence for conflicting instructions

This hierarchy allows you to set organization-wide defaults while still maintaining repository-specific customizations when needed.

Setting Up Organization Rules

To configure Organization Rules:

  1. Navigate to your organization settings
  2. Select Organization Rules from the sidebar
  3. Enter your rules in the text area provided
  4. Click Save to apply the rules

Example Organization Rules

Here are some common examples of Organization Rules:

Git Workflow Standards

Always use git add . when staging changes for commit
Never use git push --force under any circumstances
Always create descriptive commit messages following conventional commit format

Code Quality Standards

Always include comprehensive error handling in new functions
Follow the existing code style and formatting conventions
Add unit tests for any new functionality
Include JSDoc comments for all public functions

Security Guidelines

Never commit sensitive information like API keys or passwords
Always validate user input before processing
Use environment variables for configuration values

Documentation Requirements

Update README files when adding new features
Include inline comments for complex logic
Document any breaking changes in commit messages

Best Practices

Keep Rules Clear and Specific

  • Write rules that are easy to understand and follow
  • Be specific about what you want the agent to do or avoid
  • Use clear, actionable language

Avoid Conflicting Rules

  • Ensure Organization Rules don’t contradict each other
  • Consider how they might interact with Repository Rules
  • Test rules with different types of tasks

Regular Review and Updates

  • Periodically review your Organization Rules for relevance
  • Update rules as your organization’s practices evolve
  • Remove outdated or unnecessary rules

Balance Global vs Repository-Specific Rules

  • Use Organization Rules for truly universal standards
  • Reserve Repository Rules for project-specific requirements
  • Avoid duplicating rules between levels

Troubleshooting

Rules Not Being Applied

If your Organization Rules don’t seem to be working:

  1. Check Rule Syntax: Ensure your rules are clearly written and unambiguous
  2. Verify Save: Make sure you clicked “Save” after entering your rules
  3. Repository Override: Check if Repository Rules are overriding your Organization Rules
  4. Rule Conflicts: Look for contradictory instructions that might confuse the agent

Agent Behavior Issues

If the agent isn’t following your rules as expected:

  1. Simplify Rules: Break complex rules into smaller, more specific instructions
  2. Add Context: Provide more context about when and how rules should be applied
  3. Test Incrementally: Add rules gradually to identify which ones work best

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.