Phase 12c: Domain-aware /review-pr routing + domain label enforcement #101

Closed
opened 2026-03-14 22:37:12 +00:00 by forgejo_admin · 0 comments
Contributor

Lineage

plan-pal-e-agency → Phase 12 (Agent Specialization) → Phase 12c (Domain label routing)

Repo

forgejo_admin/claude-custom

User Story

As Betty Sue
I want /review-pr to automatically route to the correct domain-expert QA agent
So that I don't have to manually remember which QA agent to spawn for each domain

Context

Phase 12b deployed 3 domain-specialized QA agents: frontend-qa, dev-qa, devops-qa. Domain labels (domain:frontend, domain:backend, domain:devops) are deployed across all 36 Forgejo repos.

The current /review-pr skill has context: fork + agent: qa which statically routes to the now-deprecated generalist QA agent. This needs to become a smart router that:

  1. Reads the domain label from the parent issue
  2. Spawns the correct QA agent automatically

DORA Elite principle: if the system already has the data (domain label), the system makes the routing decision. No manual agent selection.

File Targets

Files to modify:

  • skills/review-pr/SKILL.md — Remove context: fork, agent: qa, and disable-model-invocation: true. Replace with model-invoked smart routing instructions that:
    1. Parse the PR argument (owner/repo#number)
    2. Get the PR via mcp__forgejo__review_pr to read the body
    3. Extract parent issue number from Closes #N in PR body
    4. Get the issue's labels via Forgejo API/MCP
    5. Route based on domain label:
      • domain:frontend → spawn frontend-qa agent
      • domain:backend → spawn dev-qa agent
      • domain:devops → spawn devops-qa agent
      • No domain label → STOP, tell user to apply domain label first
    6. Spawn the QA agent with ~100 token prompt (issue ref + PR ref + plan slug)

Files to create:

  • hooks/check-domain-label.sh — PreToolUse hook on mcp__forgejo__create_issue that warns (not blocks) when no domain: label is mentioned in the issue creation context. This is a soft reminder, not hard enforcement — some issues (docs-only) may not need a domain label.

Files NOT to touch:

  • agents/frontend-qa.md, agents/dev-qa.md, agents/devops-qa.md — already deployed in 12b
  • hooks/check-issue-template.sh — existing hook, don't modify

Acceptance Criteria

  • /review-pr owner/repo#N reads the PR, finds the parent issue, reads domain label, spawns the correct QA agent
  • /review-pr with no domain label on the issue stops and tells the user to apply a domain label
  • domain:frontend routes to frontend-qa
  • domain:backend routes to dev-qa
  • domain:devops routes to devops-qa
  • The spawned QA agent prompt includes the issue number, PR number, and plan slug
  • check-domain-label.sh hook exists and warns on issue creation without domain context

Test Expectations

  • Verify SKILL.md is valid (no frontmatter syntax errors)
  • Verify the routing logic handles edge cases: missing Closes #N, multiple Closes refs, no domain label
  • Verify the hook script is executable and produces a warning (not a block)

Constraints

  • The skill runs in Betty Sue's context (main session), NOT forked into a subagent
  • The skill must use Forgejo MCP tools to read labels — no curl/bash for API calls
  • The QA agent spawn must follow the minimal prompt pattern (~100 tokens)
  • Fall back gracefully — if label reading fails, tell the user instead of crashing
  • Keep the argument-hint: "[owner/repo#pr-number]" so the user knows the format

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes

Closes: n/a (Betty Sue will close after merge + deploy verification)

  • plan-pal-e-agency — parent plan
  • phase-pal-e-agency-12-agent-specialization — phase note
### Lineage `plan-pal-e-agency` → Phase 12 (Agent Specialization) → Phase 12c (Domain label routing) ### Repo `forgejo_admin/claude-custom` ### User Story As Betty Sue I want `/review-pr` to automatically route to the correct domain-expert QA agent So that I don't have to manually remember which QA agent to spawn for each domain ### Context Phase 12b deployed 3 domain-specialized QA agents: `frontend-qa`, `dev-qa`, `devops-qa`. Domain labels (`domain:frontend`, `domain:backend`, `domain:devops`) are deployed across all 36 Forgejo repos. The current `/review-pr` skill has `context: fork` + `agent: qa` which statically routes to the now-deprecated generalist QA agent. This needs to become a smart router that: 1. Reads the domain label from the parent issue 2. Spawns the correct QA agent automatically DORA Elite principle: if the system already has the data (domain label), the system makes the routing decision. No manual agent selection. ### File Targets Files to modify: - `skills/review-pr/SKILL.md` — Remove `context: fork`, `agent: qa`, and `disable-model-invocation: true`. Replace with model-invoked smart routing instructions that: 1. Parse the PR argument (owner/repo#number) 2. Get the PR via `mcp__forgejo__review_pr` to read the body 3. Extract parent issue number from `Closes #N` in PR body 4. Get the issue's labels via Forgejo API/MCP 5. Route based on domain label: - `domain:frontend` → spawn `frontend-qa` agent - `domain:backend` → spawn `dev-qa` agent - `domain:devops` → spawn `devops-qa` agent - No domain label → STOP, tell user to apply domain label first 6. Spawn the QA agent with ~100 token prompt (issue ref + PR ref + plan slug) Files to create: - `hooks/check-domain-label.sh` — PreToolUse hook on `mcp__forgejo__create_issue` that warns (not blocks) when no `domain:` label is mentioned in the issue creation context. This is a soft reminder, not hard enforcement — some issues (docs-only) may not need a domain label. Files NOT to touch: - `agents/frontend-qa.md`, `agents/dev-qa.md`, `agents/devops-qa.md` — already deployed in 12b - `hooks/check-issue-template.sh` — existing hook, don't modify ### Acceptance Criteria - [ ] `/review-pr owner/repo#N` reads the PR, finds the parent issue, reads domain label, spawns the correct QA agent - [ ] `/review-pr` with no domain label on the issue stops and tells the user to apply a domain label - [ ] `domain:frontend` routes to `frontend-qa` - [ ] `domain:backend` routes to `dev-qa` - [ ] `domain:devops` routes to `devops-qa` - [ ] The spawned QA agent prompt includes the issue number, PR number, and plan slug - [ ] `check-domain-label.sh` hook exists and warns on issue creation without domain context ### Test Expectations - [ ] Verify SKILL.md is valid (no frontmatter syntax errors) - [ ] Verify the routing logic handles edge cases: missing `Closes #N`, multiple `Closes` refs, no domain label - [ ] Verify the hook script is executable and produces a warning (not a block) ### Constraints - The skill runs in Betty Sue's context (main session), NOT forked into a subagent - The skill must use Forgejo MCP tools to read labels — no curl/bash for API calls - The QA agent spawn must follow the minimal prompt pattern (~100 tokens) - Fall back gracefully — if label reading fails, tell the user instead of crashing - Keep the `argument-hint: "[owner/repo#pr-number]"` so the user knows the format ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes Closes: n/a (Betty Sue will close after merge + deploy verification) ### Related - `plan-pal-e-agency` — parent plan - `phase-pal-e-agency-12-agent-specialization` — phase note
forgejo_admin 2026-03-14 23:21:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/claude-custom#101
No description provided.