Multi-File Agent Architecture

Definition (confidence: high)

A prompt architecture pattern where instructions are split across multiple files: a shared base prompt plus mode/role-specific prompts loaded on demand. ~17% of tools (~9/52) use this pattern.

Structure (confidence: high)

shared/
  base.md          ← Role, Guardrails, Communication style
  tools.md         ← Shared tool definitions
modes/
  code.md          ← Code-specific instructions
  architect.md     ← Planning-specific instructions
  ask.md           ← Q&A-specific instructions

Tools Using This Pattern (confidence: high)

Cline (base + modes), RooCode (5 distinct modes), Manus (Agent Loop + 15+ Modules), Anthropic (chat prompt + tool-use prompt), Augment Code (Sonnet 4 prompt + GPT-5 prompt), Codex CLI (old prompt + 2025 prompt).

Key Innovation: RooCode’s 5-Mode Architecture (confidence: high)

Each mode has a specialized persona, its own tool access, its own workflow rules, and a handoff protocol between modes. Architect produces a spec → Code implements it → Debug fixes it.

Advantages vs. Disadvantages (confidence: high)

  • Advantages: Specialized behavior per mode, smaller per-mode prompts, easier to extend, mode switching enables complex workflows
  • Disadvantages: Coordination complexity, mode-switching latency, inconsistency risk (modes may drift), more complex testing

monolithic-prompt-limits — The counter-pattern. ~75% of tools use monolithic prompts. Multi-file is the solution to monolithic scaling limits.

monolithic-vs-multi-file — Detailed comparison of architecture trade-offs across complexity, flexibility, token efficiency, and maintainability.

skills-directory-gate — Multi-file architectures often pair with a skills directory gate, enabling extension without prompt modification.

roocode-5-mode-architecture — The most sophisticated multi-file implementation with mode handoff protocol.

Implications (confidence: high)

Multi-file architecture is the next frontier after monolithic prompts hit scaling limits around 15K tokens. For sophisticated tools with distinct modes (planning vs. coding vs. debugging), the modular approach enables specialization without bloat. The architecture choice reflects tool maturity: early-stage uses monolithic, growing adopts multi-file, platforms use SDK.

Sources

  • [raw/prompts/articles/taxonomy-synthesis-2026-07-16.md]