Skip to content

[Feature] Rex domain-aware code review — handbooks/domain/<area>/ glob with diff-match loading + lessons-learned capture #293

@atlas-apex

Description

@atlas-apex

User Story

As an adopter running ApexYard against a domain-specific codebase, I want Rex to load domain-specific review notes when a PR touches files in that domain, so that reviews catch domain-specific gotchas that pure code-and-ticket context misses (e.g. GitHub EMU migration scripts must handle private-fork access; Stripe webhook handlers must verify the Stripe-Signature header).

Acceptance Criteria

Stage 1 — Path-globbed domain handbooks (this ticket's MVP)

  • New handbook category handbooks/domain/<area>/*.md discovered by Rex on every review
  • Each handbook supports a paths: frontmatter field (list of globs). Rex loads the handbook only when the PR diff matches at least one glob (e.g. paths: ['scripts/github-emu-migration/**'])
  • When paths: is absent or empty, the handbook always loads (foundational domain rules)
  • ENFORCEMENT: blocking marker honoured (same shape as architecture/general/language handbooks)
  • Custom-handbooks layer: <private>/custom-handbooks/domain/<area>/ discovered alongside the public tree, both loaded when matched
  • handbooks/README.md documents the new category with the frontmatter convention
  • handbooks/domain/README.md explains path-mirroring + the paths: field + a worked example
  • AgDR records the design decision (why path-glob + frontmatter over a config table)
  • No regression on existing architecture / general / language discovery

Stage 2 — Codify-rule capture (follow-up ticket)

  • /codify-rule skill takes a human comment + diff context and proposes a handbook entry
  • Operator reviews + accepts/rejects via Y/N before the handbook is written
  • Captured rule includes the source PR for traceability

Stage 3 — Auto-propose from PR stream (follow-up ticket)

  • /enrich-domain <area> skill walks recent merged PRs that touched the area
  • Proposes additions Rex would have benefited from (new error messages, conditional branches, AgDR references)
  • Operator-approved per finding

Design Notes

No UI changes — this is a Rex agent-prompt change + handbooks/ tree extension + two follow-up skills.

The framework layer change is small: Rex's prompt (.claude/agents/code-reviewer.md § 8) gains a fourth discovery glob alongside architecture / general / language. Path-match logic lives in Rex's prompt (no new hook needed — the glob runs at review time, not at edit time).

Out of Scope

  • External-doc auto-fetch at review time. Tempting for ingesting GitHub's EMU docs, but introduces a freshness-versus-reproducibility tension we don't want in CI-class agents. Stays out unless an operator explicitly asks.
  • Per-team / per-project handbook overrides — handbooks remain framework-level (with the custom-handbooks layer for split-portfolio adopters). Already deferred per the existing handbooks design.
  • Stage 2 + Stage 3 implementations — included in ACs as follow-up scope but implemented as separate tickets so this MVP can land first.

Effort Estimate

Stage 1 only: ~2 days. Stages 2 + 3 are separate tickets.

Glossary

Term Definition
Rex The Code Reviewer sub-agent (.claude/agents/code-reviewer.md) — automated first-pass review on every PR
Domain handbook A markdown file under handbooks/domain/<area>/ that captures domain-specific review knowledge (e.g. GitHub EMU semantics, Stripe webhook validation rules)
Path-glob frontmatter A paths: field in the handbook's YAML frontmatter that tells Rex "only load me if the PR diff matches one of these globs"
Custom-handbooks layer The <private>/custom-handbooks/<dim>/... tree introduced in framework #243 for split-portfolio adopters to ship private handbooks alongside the public ones

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — material gap or user-impactingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions