Skip to main content

Architecture

What: The agent system is organized into two tiers. Global specialist agents (an OPTIONAL pattern — projects may forbid them, and the zol-rag flagship does, preferring direct work to preserve context) live in ~/.claude/agents/ and provide broad domain expertise — security engineering, database design, AI/ML implementation, frontend development, testing. Project-specific reviewer agents (4 types) live in PROJECT/.claude/agents/ and provide targeted review checklists calibrated to the project's specific patterns, conventions, and regulatory requirements.

Why: The two-tier structure exists for the same reason as the instruction hierarchy (Section 4): different scopes require different levels of specificity.

A global security engineer agent knows about OWASP Top 10, JWT validation, SQL injection prevention, and PII protection. This knowledge applies to any project. But it does not know that Trust Relay uses Depends(get_current_user) for authentication, get_tenant_session(tenant_id) for database access, or that 33 tables have FORCE ROW LEVEL SECURITY. A project-specific security reviewer knows these conventions and checks for them explicitly.

Global agents are generalists that apply broad expertise. Project reviewers are specialists that enforce specific contracts. Project reviewers are the load-bearing tier; global specialists are optional reinforcement where a project wants them: the global agent catches categories of issues (missing authentication), and the project reviewer catches convention violations (using get_session() instead of get_tenant_session()).

Global Specialist Agents (optional; Trust Relay runs 14):

AgentDomainWhen to Dispatch
Code ArchitectSystem architecture, DDD, module boundariesNew feature design, refactoring strategy
AI EngineerLLM integration, ML pipelines, RAG, vector databasesAI feature implementation
Security EngineerAuth, authorization, injection prevention, PIISecurity-sensitive changes
Database EngineerSchema design, query optimization, migrationsDatabase changes
Frontend DeveloperReact, Next.js, component architectureFrontend implementation
UI DesignerVisual design, layout, design system applicationUI component creation
UX ResearcherUser flows, interaction patterns, accessibilityUX design decisions
Python ExpertPython idioms, async patterns, performanceComplex Python implementation
Test Writer & FixerTest coverage, failure analysis, test repairTest creation and debugging
Code ReviewerGeneral code quality, patterns, maintainabilityCode review
DebuggerRoot cause analysis, systematic investigationComplex bugs
Deployment EngineerCI/CD, containerization, infrastructureDeployment and ops
MCP ExpertMCP server integration, tool configurationMCP setup and troubleshooting
Research AgentInformation gathering, technology evaluationResearch tasks

Project-Specific Reviewer Agents (4):

These are detailed in Section 5.3.

Evidence: Trust Relay uses 18 agent definitions: 14 global specialists and 4 project reviewers. Each agent definition includes a frontmatter header (name, description, model, tools), a role description, a domain-specific checklist, and an output format specification. The project reviewers are calibrated to Trust Relay's specific patterns — the API reviewer checks for Depends(get_current_tenant), the migration reviewer checks for FORCE ROW LEVEL SECURITY, the compliance reviewer checks for EU AI Act Article 11-15 requirements. See appendix-f-evidence.md for the agent count metrics.

How: Agent definitions are markdown files with YAML frontmatter placed in ~/.claude/agents/ (global) or PROJECT/.claude/agents/ (project). Claude Code discovers them automatically. For the full agent architecture specification, see appendix-c-agents.md.