Skip to content

Latest commit

Β 

History

History
404 lines (313 loc) Β· 14.2 KB

File metadata and controls

404 lines (313 loc) Β· 14.2 KB

🧭 Agent Index β€” Router + Composition Guide

Purpose: Route requests to the best agents, enforce predictable workflows, and produce consistent deliverables.

🎯 Mission

This index serves as the central router for the wp-dev-prompts agent library. It:

  • Classifies incoming requests by domain and risk level
  • Selects optimal agent teams (3–6 agents preferred)
  • Enforces phase-based execution: Plan β†’ Implement β†’ Verify β†’ Document
  • Produces artifacts that meet the Output Contract
  • Resolves conflicts between competing concerns

🧠 How to Use This Index

  1. Start with Orchestrators β€” Always consider qa-director for quality gates
  2. Add Primary Specialists β€” Based on task category (1–2 per domain)
  3. Add Supporting Agents β€” Only for missing outputs (reports, fixtures, CI)
  4. Keep Teams Lean β€” 3–6 agents unless work clearly spans more domains
  5. Run Phases β€” Plan β†’ Implement β†’ Verify β†’ Document

πŸ§‘β€πŸ’Ό Orchestrators (Always Considered)

Agent Owns When Required
qa-director Quality gates, test matrix, PR/nightly/release strategy Any change affecting tests or gates
repo-template-architect Structure, profiles, commands, template consistency Structural changes, new project setup
test-architecture Test boundaries, fixtures, mocks, determinism Test infrastructure changes
risk-manager Risk register, threat model, prioritization High-risk changes, security, data handling

πŸ—‚οΈ Task Categories β†’ Agent Sets

πŸ§ͺ Testing & QA

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Deterministic seeds and stable selectors
  • Artifacts uploaded on failure
  • Quarantine policy for flaky tests
  • Test isolation (no shared state)

β™Ώ Accessibility

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • axe-core scans on all routes
  • Explicit name/role/state assertions
  • Focus trap testing for modals
  • RTL run for critical routes
  • Keyboard-only navigation validation

πŸ›‘οΈ Security

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Nonce verification on all forms
  • Capability checks before actions
  • Input sanitization, output escaping
  • Semgrep rules for WP patterns
  • SARIF output for security findings
  • SBOM generation for dependencies

🌍 Multisite + Locales

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Network activation/uninstall hooks
  • get_option vs get_site_option usage
  • Super-admin capability boundaries
  • Locale matrix tests per site
  • RTL visual regression for critical screens

⚑ Performance

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Performance budgets defined
  • Cold and warm run measurements
  • Lighthouse CI artifacts
  • Core Web Vitals thresholds

πŸ“¦ Packaging & Release

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • No dev files in distribution
  • Version consistency across files
  • Changelog entry for each release
  • ZIP artifact creation and validation

🧰 CI / Toolchain

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Cache strategy for dependencies
  • Job isolation (no cross-job state)
  • Matrix design for versions
  • Fast lane (PR) vs slow lane (nightly)
  • Artifact retention policy

🧱 Data & Migrations

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • Upgrade-from-N-1 tests
  • Idempotent migrations
  • Deprecation policy documented
  • Contract tests for data structures

πŸ§‘β€πŸ« Developer Experience

Primary Agents:

Supporting Agents:

Mandatory Checks:

  • "One command" setup works
  • Docs are executable (examples compile)
  • README is current and accurate

🧾 Routing Algorithm

Step 0: Determine Complexity Tier

Before selecting agents, classify the task:

Signal T1 T2 T3
Files 1-2 3-5 6+
Existing tests Yes Partial No
Risk Low Medium High
Architecture change No Minor Yes

Tool Assignment:

  • T1 (Routine): Copilot β€” inline suggestions, constrained scope
  • T2 (Analytical): Cursor/ChatGPT β€” code review, refactoring analysis
  • T3 (Complex): Claude Code β€” full-context, architecture decisions

Then proceed to Step 1.

Step 1: Identify Request Type

  • Code: New features, bug fixes, refactoring
  • Tests: Test creation, test infrastructure
  • CI: Workflow changes, job configuration
  • Packaging: Build, release, distribution
  • Security: Auth, data handling, secrets
  • A11y: Accessibility improvements
  • Perf: Performance optimization
  • Multisite: Network-aware changes
  • i18n: Localization, RTL
  • Docs: Documentation updates
  • Mixed: Spans multiple domains

Step 2: Determine Risk Level

Level Scope Examples
Low Formatting, docs, comments README update, code style
Medium Config, lint rules, minor features ESLint config, new utility
High Auth, data, REST, files, multisite, release Login flow, database schema, API endpoints

Step 3: Choose Agents

  1. Always include qa-director for anything affecting gates
  2. Add 1–2 primary specialists per domain involved
  3. Add supporting agents only for missing outputs
  4. Cap at 6 agents unless truly necessary

Step 4: Run Phases

Phase Activities Outputs
A: Plan Analyze, checklist, acceptance criteria Plan document
B: Implement Write code, configs, tests Source files
C: Verify Run tests, validate gates Test results, artifacts
D: Document Update docs, handoff notes Documentation

🧯 Conflict Resolution Rules

When agents disagree, apply this priority order:

  1. Security > Performance > Accessibility > Correctness > DX > Style
  2. Multisite correctness > Single-site convenience
  3. Determinism > "Fast but flaky"
  4. Ship safe > "Ship fast"

Common Conflicts

Conflict Resolution
Performance vs Security Security wins; optimize safely
Fast tests vs Thorough tests Fast on PR, thorough on nightly
DX vs Correctness Correctness wins; improve DX separately
New feature vs BC Maintain BC; deprecate gracefully

πŸ§ͺ Output Contract

Every routed task must produce:

1. Agent Team

Primary Agents:
- agent-name: one-line justification

Supporting Agents:
- agent-name: one-line justification

2. Deliverables

  • Files to create/modify (paths)
  • Commands to add
  • CI jobs to add
  • Documentation to write

3. Gates

  • What blocks PR merge
  • What runs on nightly
  • What runs on release-candidate

4. Artifacts

  • Report locations (JUnit, SARIF, screenshots, traces, LHCI)
  • Retention policy
  • Upload conditions

5. Verification

  • Local commands to validate
  • CI validation steps
  • Manual verification if needed

6. Risks & Gaps

  • What remains manual
  • What may be noisy/flaky
  • Known limitations

πŸ“ Agent Directory Structure

agents/
β”œβ”€β”€ AGENT_INDEX.md              # This file
β”œβ”€β”€ orchestrators/
β”‚   β”œβ”€β”€ qa-director.md
β”‚   β”œβ”€β”€ repo-template-architect.md
β”‚   β”œβ”€β”€ test-architecture.md
β”‚   └── risk-manager.md
β”œβ”€β”€ specialists/
β”‚   β”œβ”€β”€ testing/
β”‚   β”‚   β”œβ”€β”€ unit-testing.md
β”‚   β”‚   β”œβ”€β”€ integration-testing.md
β”‚   β”‚   β”œβ”€β”€ e2e-playwright.md
β”‚   β”‚   β”œβ”€β”€ visual-regression.md
β”‚   β”‚   β”œβ”€β”€ regression-suite-curator.md
β”‚   β”‚   └── test-data-and-fixtures.md
β”‚   β”œβ”€β”€ accessibility/
β”‚   β”‚   β”œβ”€β”€ a11y-tree-and-aria-auditor.md
β”‚   β”‚   β”œβ”€β”€ keyboard-and-focus-specialist.md
β”‚   β”‚   β”œβ”€β”€ storybook-a11y-specialist.md
β”‚   β”‚   └── manual-a11y-protocol.md
β”‚   β”œβ”€β”€ security/
β”‚   β”‚   β”œβ”€β”€ threat-modeling.md
β”‚   β”‚   β”œβ”€β”€ wp-security-patterns.md
β”‚   β”‚   β”œβ”€β”€ pentest-playbook.md
β”‚   β”‚   └── secrets-and-supply-chain.md
β”‚   β”œβ”€β”€ wordpress/
β”‚   β”‚   β”œβ”€β”€ multisite-specialist.md
β”‚   β”‚   β”œβ”€β”€ data-model-and-migrations.md
β”‚   β”‚   β”œβ”€β”€ backward-compatibility.md
β”‚   β”‚   β”œβ”€β”€ wp-hooks-architecture.md
β”‚   β”‚   └── i18n-l10n-rtl-specialist.md
β”‚   β”œβ”€β”€ release/
β”‚   β”‚   β”œβ”€β”€ packaging-and-dist-builder.md
β”‚   β”‚   β”œβ”€β”€ wporg-readme-and-assets.md
β”‚   β”‚   β”œβ”€β”€ plugin-header-and-metadata.md
β”‚   β”‚   └── release-manager.md
β”‚   β”œβ”€β”€ ci/
β”‚   β”‚   β”œβ”€β”€ github-actions-architect.md
β”‚   β”‚   β”œβ”€β”€ reporting-and-artifacts.md
β”‚   β”‚   β”œβ”€β”€ linting-and-static-analysis.md
β”‚   β”‚   └── compatibility-matrix.md
β”‚   β”œβ”€β”€ dx/
β”‚   β”‚   β”œβ”€β”€ onboarding-and-quickstart.md
β”‚   β”‚   β”œβ”€β”€ makefile-justfile-designer.md
β”‚   β”‚   └── contributing-and-pr-gates.md
β”‚   └── extras/
β”‚       β”œβ”€β”€ flaky-test-tamer.md
β”‚       β”œβ”€β”€ failure-injection-chaos-lite.md
β”‚       β”œβ”€β”€ legal-and-licensing-checker.md
β”‚       └── documentation-quality-auditor.md

πŸ”— Quick Reference: Agent by Concern

Concern Go-To Agent
"Tests are flaky" flaky-test-tamer
"Need multisite support" multisite-specialist
"RTL is broken" i18n-l10n-rtl-specialist
"Preparing a release" release-manager + packaging-and-dist-builder
"Security review needed" wp-security-patterns + threat-modeling
"CI is slow" github-actions-architect
"Accessibility audit" a11y-tree-and-aria-auditor
"Database schema change" data-model-and-migrations
"New contributor setup" onboarding-and-quickstart
"Quality gates unclear" qa-director