# Workflow: route every issue to the right owner automatically
Manual triage does not scale. Ownership rules assign issues by stack-trace path, and alert rules decide who gets woken up. Set both up as one workflow.
## 1. Import CODEOWNERS
Connect the repo integration and import CODEOWNERS first. This gives you a baseline mapping from files to teams with zero maintenance, since it follows the repo.
## 2. Layer ownership rules
Ownership rules use glob syntax, not regex:
```
# team frontend owns the app code
path:src/app/** #frontend
# team payments owns checkout
path:src/payments/** #payments
```
Rules take precedence over CODEOWNERS, so use them for the exceptions and overrides the CODEOWNERS file cannot express. Add code mappings so stack-trace paths match repo paths.
## 3. Know the assignment semantics
Issues get assigned to the last rule that matches, and automatic reassignment stops once someone is assigned. This means rule order is your priority order: put the most specific rules last.
## 4. Alert rules on top
Ownership decides who owns it; alert rules decide who hears about it and how loudly:
- New issue in a critical path: page the owning team immediately.
- Issue regressing after a resolved release: notify the release owner.
- Spike in an already-owned issue: escalate, do not reassign.
## 5. Keep it current
Review ownership coverage quarterly: issues with no owner are triage debt. The activity log shows which rules fired, so dead rules (paths that moved) are easy to spot.
## Verify
Deploy a test error in each owned path and confirm the right team gets assigned and the right alert fires. An issue nobody owns after a week means a path gap, not a process gap.