Everything Claude Code Agent System Architecture: How Multi-Agent Workflows Work
Everything Claude Code uses a declarative, markdown-based agent architecture where autonomous agents are defined in the agents/ directory and orchestrated through CLI commands in commands/, with shared context managed via hooks.
The agent system architecture in Everything Claude Code enables complex AI-driven workflows by treating each specialized capability—planning, architecture, code review, security—as a modular, self-contained agent. This design, as implemented in WorldFlowAI/everything-claude-code, separates agent definition from orchestration, making the system transparent and extensible.
Agent Definition: Declarative Markdown Files
Every agent is declared in a markdown file inside the agents/ directory. The front-matter block specifies the agent's identity and capabilities:
name— unique identifier used by the orchestratordescription— concise purpose statementtools— available low-level operations (Read,Grep,Glob)model— which Claude model powers the agent (opus,sonnet,haiku)
The Architect agent at agents/architect.md demonstrates the full template. Beyond front-matter, each file details:
- Concrete responsibilities (design, review, planning)
- Step-by-step workflows (e.g., "Architecture Review Process")
- Checklists of Architectural Principles
- Common Patterns and anti-patterns
- Templates for Architecture Decision Records (ADRs)
The Orchestration Layer
CLI commands in commands/ instantiate and run agents. Key commands include:
| Command | Purpose | Agent Used |
|---|---|---|
plan |
Create task breakdowns | planner.md |
orchestrate |
Chain multiple agents | Multiple |
code-reviewer |
Validate implementation | code-reviewer.md |
The orchestrator reads agent definitions, constructs Claude API requests using the specified model, and manages the interaction flow.
Execution Flow
# User initiates a planning session
opencode plan --project my-app --output plan.json
Internally, as implemented in commands/plan.md:
// Pseudocode reflecting actual implementation
const agentDef = await readAgent('agents/planner.md');
const response = await claude.run({
model: agentDef.model,
prompt: `${agentDef.description}\n${taskSpecification}`
});
saveSession(response);
Shared Context and Memory Persistence
Agents operate on shared session context managed by the hooks system. The hooks/hooks.json registry maps hook events to scripts in hooks/.
Memory-persistence hooks handle session lifecycle:
# hooks/memory-persistence/session-start.sh
#!/usr/bin/env bash
SESSION_ID=$(uuidgen)
export CLAUDE_SESSION_ID=$SESSION_ID
mkdir -p .claude/sessions/$SESSION_ID
Additional hooks include:
session-end.sh— finalize and archive session statepre-compact.sh— compress context before token limits
This shared context enables multi-agent collaboration:
// orchestrate.js simplified flow
const plan = await runAgent('planner');
const architecture = await runAgent('architect', { plan });
const review = await runAgent('code-reviewer', { architecture });
Extending the System
Adding a new agent requires only:
- Create
agents/your-agent.mdwith front-matter and role description - The orchestrator auto-discovers it via directory scan
- Reference it in CLI commands or orchestration workflows
No code changes to the core system are needed.
Key Files in the Architecture
| File Path | Role |
|---|---|
agents/architect.md |
Reference agent with full workflow template |
agents/planner.md |
Task decomposition specialist |
agents/code-reviewer.md |
Implementation validator |
agents/security-reviewer.md |
Security-focused reviewer |
commands/orchestrate.md |
Multi-agent chaining command |
commands/plan.md |
Planning workflow entry point |
hooks/hooks.json |
Hook event registry |
hooks/memory-persistence/*.sh |
Session context management |
scripts/lib/utils.js |
Shared utilities |
Summary
- Agent definitions live as markdown in
agents/with declarative front-matter - Orchestration commands in
commands/load agents and drive Claude API calls - Hooks in
hooks/manage persistent shared context across sessions - Multi-agent workflows chain outputs: Planner → Architect → Reviewer
- Extensibility is file-based: add markdown, gain new capabilities
Frequently Asked Questions
What makes an agent "autonomous" in Everything Claude Code?
An agent is autonomous because it carries its own decision-making framework—defined in its markdown description and responsibilities—rather than following hardcoded logic. The orchestrator provides the prompt and context, but the agent's response strategy (how it plans, reviews, or designs) emerges from its documented role and the Claude model's reasoning.
How does context pass between multiple agents?
Context passes through the session persistence layer. When runAgent('architect', { plan }) executes, the plan object serializes to the session directory under .claude/sessions/$SESSION_ID/. Hook scripts ensure this state survives across process boundaries. Downstream agents read this shared context, building on previous outputs without direct coupling.
Can I use different Claude models for different agents?
Yes—the model front-matter field specifies which Claude model each agent uses. According to the agents/architect.md source, the Architect uses opus for complex reasoning, while lighter tasks might use haiku. The orchestrator respects this per-agent configuration when constructing API requests.
What happens if a session exceeds token limits?
The pre-compact.sh hook triggers before context overflow. This script, located at hooks/memory-persistence/pre-compact.sh, summarizes or truncates session history based on configurable heuristics, preserving critical decision points while freeing token budget for continued agent interaction.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →