← Back to Agents

Patterns Library

Reusable patterns for multi-agent orchestration

These patterns emerge from daily practice orchestrating AI agents for real work. They're not theoretical—they're battle-tested solutions to common problems.

Orchestration Patterns

How to coordinate multiple agents for complex tasks.

Orchestrator + Specialists

One coordinator agent delegates to specialized agents. The orchestrator handles routing and synthesis.

Example: Claude Code (orchestrator) → Frontend Agent, Backend Agent, Doc Writer (specialists)
Best for: Complex projects with distinct skill requirements

Pipeline Chain

Agents process work sequentially. Output of one becomes input of the next.

Example: Research → Write → Review → Format → Publish
Best for: Content creation, data processing workflows

Parallel Workers

Multiple agents work on independent subtasks simultaneously, results merged at end.

Example: Scrape 10 pages in parallel → Combine results
Best for: Data collection, batch processing

Critic Loop

Worker agent produces output, critic agent reviews and requests improvements iteratively.

Example: Writer → Critic → Writer (revised) → Critic (approved)
Best for: Quality-critical outputs, code review

Safety Patterns

How to prevent agents from causing unintended harm.

Human-in-the-Loop Gates

Critical

Require human approval before irreversible actions

How: Pre-commit hooks, approval workflows, staged deployments
Example: Agent prepares database migration → Human reviews → Agent executes

Scope Locks

High

Agents can only access/modify explicitly allowed files or resources

How: File allowlists in CLAUDE.md, read-only defaults
Example: Frontend agent can only modify /components/, not /lib/db/

Explicit File Staging

Critical

Never use git add . with agents. Stage only files the agent actually modified.

How: git add file1.tsx file2.tsx instead of git add .
Example: Prevents accidental commits of unreviewed changes

Reversibility Checks

Medium

Before any action, verify it can be undone or rolled back

How: Backup creation, transaction wrappers, soft deletes
Example: Agent backs up config before modifying

Productivity Patterns

How to get more done with less friction.

Memory Triggers

Short phrases in CLAUDE.md that activate specific behaviors

"READ FIRST, EDIT SECOND, ALWAYS" → Agent reads file before any suggestions

File Dependencies

Specify exact files required, not vague agent completion states

"Requires: /lib/types.ts, /lib/utils.ts" instead of "after setup is done"

Context Preservation

Summarize state before breaks or handoffs to prevent context loss

ADHD summary format: Where we are, What's done, To resume, Quick win

Progressive Disclosure

Start with simple, add complexity only when needed

Basic agent → Add tools → Add memory → Add multi-agent

Knowledge Patterns

How agents access and leverage external knowledge sources.

RAG (Retrieval Augmented Generation)

Agents retrieve relevant information from external knowledge bases before generating responses. Reduces hallucinations and enables real-time data access.

Architecture: Index documents → Embed query → Similarity search → Context injection → Generate
Supabase pgvectorPineconeContext7 MCP
Best for: Documentation Q&A, research assistants, enterprise knowledge bases

MCP Knowledge Sources

Use Model Context Protocol servers to give agents real-time access to external data sources and APIs.

Architecture: Agent → MCP server → External API/Database → Structured response → Agent action
Firecrawl (web)Supabase (database)Airtable (structured data)
Best for: Web research, database queries, real-time data integration

Context Windowing

Strategically manage what context agents see. Too much context causes confusion; too little causes errors.

Architecture: Full context → Relevance filter → Priority ranking → Token budget → Compressed context
Prompt cachingDocument summarizationSliding context windows
Best for: Long-running agents, multi-file operations, large codebases

These patterns are the foundation. Trust engineering is how you decide when to apply them.