Multi-Agent Collaboration
This skill should be used when designing agent coordination, implementing context handoffs, reducing context overhead, creating multi-agent workflows, optimizing agent communication, implementing progressive disclosure, selecting architectural patterns (hierarchical vs swarm), or debugging agent context issues. Provides SOTA patterns for multi-agent systems achieving 78%+ context reduction while maintaining analysis quality.
What this skill does
# Multi-Agent Collaboration
## Overview
State-of-the-art patterns for context-efficient multi-agent systems. These patterns enable complex agent workflows while minimizing token overhead through strategic context engineering.
## Research Foundation
- Google ADK: Context compilation pipelines and session management
- Anthropic: Multi-agent coordination and handoff protocols
- Progressive Disclosure: Agent-readable semantic interfaces
- LangGraph/CrewAI/AutoGen: Framework-specific orchestration patterns
## Pattern Selection Framework
| Pattern | Use When | Trade-offs |
|---------|----------|------------|
| **Hierarchical** | Clear decomposition, audit trails | Central bottleneck, sequential latency |
| **Swarm** | Parallel exploration, diverse perspectives | Coordination overhead, emergent behavior |
| **ReAct** | Dynamic adaptation, tool-heavy workflows | Myopic decisions, may meander |
| **Plan-Execute** | Clear sequence, predictability needed | Less adaptive, requires replanning |
| **Reflection** | Quality refinement, self-correction | Added latency, may reinforce errors |
| **Hybrid** | Multiple coordination needs | Implementation complexity |
For detailed YAML definitions and examples of each pattern, see `references/patterns.md`.
## The Four Laws of Context Management
### Law 1: Selective Projection
Pass only fields each agent needs, not full data structures.
```yaml
# BAD: Full snapshot everywhere
snapshot: {...20KB...}
# GOOD: Selective projection
context:
mode: deep
claims_analyzed: 15
high_risk_count: 4
```
### Law 2: Tiered Context Fidelity
Define explicit tiers based on agent role:
| Tier | Description | Example Agent |
|------|-------------|---------------|
| FULL | Complete data | Initial analyzer |
| SELECTIVE | Relevant subset | Domain workers |
| FILTERED | Criteria-matched | Validators |
| MINIMAL | Mode + counts | Strategy/routing |
| METADATA | Scope stats only | Report synthesis |
### Law 3: Reference vs Embedding
For large data, pass reference instead of full structure:
```yaml
# Embedding (expensive)
raw_findings: [{...}, {...}, ...] # 40+ items
# Reference (efficient)
findings_summary:
total: 45
by_severity: {CRITICAL: 3, HIGH: 12}
# Agent fetches specific findings on-demand
```
### Law 4: Lazy Loading
Load data on-demand, not upfront:
```yaml
initial_context:
scope: {item_count: 45}
available_data:
- name: findings
fetch: "request by severity or ID"
```
For implementation details and patterns, see `references/context-engineering.md`.
## Standard Handoff Protocol
```yaml
handoff:
from_agent: context-analyzer
to_agent: attack-strategist
context_level: MINIMAL
payload:
mode: deep
analysis_summary:
claim_count: 15
high_risk_count: 4
patterns: [pattern_1, pattern_2]
expected_output:
format: yaml
schema: strategy_v1
```
## Severity-Based Batching
Reduce validation operations by routing based on priority:
```yaml
batching:
CRITICAL: [all_validators] # 4 agents
HIGH: [checker, verifier] # 2 agents
MEDIUM: [checker] # 1 agent
LOW/INFO: [] # Skip
# Result: 60-70% fewer operations
```
## Anti-Patterns to Avoid
1. **Snapshot Broadcasting** - Passing full context to every agent
2. **Defensive Over-inclusion** - "Maybe they need this" mentality
3. **Grounding Everything** - Validating low-priority items
4. **Embedding Large Lists** - Full arrays when counts suffice
5. **Repeated Context** - Same data passed multiple times in chain
6. **Verbose Outputs** - Over-explaining when concise suffices
## Progressive Disclosure for Agents
### Three-Level Loading
```yaml
level_1_always_loaded:
- skill_name
- skill_description
tokens: ~100
level_2_on_trigger:
- main_skill_body
- core_patterns
- quick_reference_tables
tokens: ~2000
level_3_on_demand:
- detailed_references
- extended_examples
- implementation_guides
tokens: as_needed
```
## Guardrails and Validation
### Output Validation Pattern
```yaml
validation:
hook: post_tool_use
on_invalid:
action: block_and_retry
max_retries: 2
on_valid:
action: continue
```
### Context Tier Enforcement
Document what each agent does NOT receive:
```yaml
agent_context:
receives:
- analysis_summary
- assigned_vectors
not_provided: # CRITICAL: Explicit exclusions
- full_snapshot
- other_agents_data
- conversational_arc
```
## Metrics
Track these to validate optimization:
| Metric | Target |
|--------|--------|
| Total context passed | < 100KB |
| Redundancy ratio | < 0.1 |
| Validation efficiency | > 3:1 findings/operations |
| Tier compliance | 100% |
## Additional Resources
- `references/context-engineering.md` - Detailed context management patterns
- `references/patterns.md` - Architectural patterns with YAML definitions
- `references/examples.md` - Red-agent implementation examples
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.