CODEOWNERS defines who is responsible for specific parts of your codebase. Kizuna uses this for automatic reviewer assignment and required approvals.
CODEOWNERS File
Create a file named CODEOWNERS (no extension) in:
- Repository root:
/CODEOWNERS .github/CODEOWNERS.kizuna/CODEOWNERS
Syntax
Basic Pattern
# Pattern Owners
/src/auth @security-team
/docs @docs-team @alice
*.js @frontend-teamDirectory Ownership
# All files in /src/auth
/src/auth @security-team
# All files in /docs and subdirectories
/docs/ @docs-teamFile Extensions
# All JavaScript files
*.js @frontend-team
# All Python files
*.py @backend-teamSpecific Files
# Exact file match
/package.json @devops-team
/.env.example @security-teamMultiple Owners
# Any of these can approve
/src/api @backend-team @alice @bobNegation (Order Matters)
# Everyone owns everything
* @org/everyone
# Except /secrets (only security)
/secrets @security-teamExamples
Monorepo Structure
# Global fallback
* @org/core-team
# Frontend
/apps/web/ @frontend-team
/apps/mobile/ @mobile-team
# Backend
/apps/api/ @backend-team
/libs/database/ @backend-team @dba-team
# Infrastructure
/infra/ @devops-team
/k8s/ @devops-team
# Documentation
/docs/ @docs-team
*.md @docs-team
# Security-sensitive
/src/auth/ @security-team
/src/crypto/ @security-teamMicroservices
# Each service owns itself
/services/auth/ @auth-team
/services/payments/ @payments-team
/services/notifications/ @notifications-team
# Shared libraries
/libs/common/ @platform-team
/libs/messaging/ @platform-teamAgent Ownership
Assign agents as owners:
# Security agent reviews all auth changes
/src/auth/ @security-agent
# Documentation agent reviews docs
/docs/ @docs-agent
# Performance agent reviews optimizations
/performance/ @perf-agentHow It Works
Automatic Assignment
When a PR modifies files:
- Kizuna checks which patterns match
- Collects all owners
- Assigns them as reviewers
Required Approvals
With branch protection:
- At least one CODEOWNER must approve
- Applies to protected branches only
Multiple Files Changed
If PR touches multiple owned areas:
- All relevant owners are assigned
- Each area needs approval
Special Syntax
Comments
# This is a comment
/src/auth @security-teamEmail Addresses
# Can use emails instead of usernames
/src/auth security@example.comTeams
# Organization teams
/src @org/frontend-teamWildcards
# All files in any tests directory
**/tests/ @qa-team
# All config files anywhere
**/*.config.js @devops-teamValidation
Web UI Preview
Kizuna shows CODEOWNERS preview:
- Go to Settings → CODEOWNERS
- See pattern matches
- Validate syntax
API Validation
bash
curl /api/v1/repos/org/repo/codeowners/validate \
-H "Authorization: Bearer $TOKEN"Best Practices
- Be specific — Narrow patterns over broad
- Use teams — Easier than individual users
- Include agents — AI can be owners too
- Review regularly — Update as team changes
- Document why — Comments explain ownership
Troubleshooting
Owners Not Assigned
Check:
- File path matches pattern
- Owners exist and have access
- CODEOWNERS file valid
Too Many Reviewers
Narrow patterns:
# Too broad
/src @everyone
# Better
/src/auth @security
/src/ui @frontendPattern Not Working
Remember:
- Order matters (last match wins)
- Patterns are relative to repo root
- Use leading
/for absolute paths
Summary
CODEOWNERS enables:
- Automatic assignment — Right reviewers every time
- Expert review — Domain owners see changes
- Distributed ownership — Clear responsibilities
- Agent integration — AI agents can own code too
It's the map of who knows what in your codebase.