c4-architecture

c4-architecture is a command for Claude Code from wshobson/agents. It costs 30 tokens per session (3,418 once invoked), scanned A, original, MIT.

A command that coordinates four C4 architecture agents to document an existing codebase from detailed code up to the overall system context. The C4 model is a structured way to describe software architecture at increasing levels of detail.

In plain words
What is it for?
Use it to analyse code directories, define components, map deployment containers and APIs, and produce context, container, component, and code documentation.
Why use it?
It gives a repository one connected set of architecture documents instead of isolated diagrams or unexplained implementation notes.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the c4-architecture plugin — 1 command, 4 agents shipped together

Good fit Use it to analyse code directories, define components, map deployment containers and APIs, and produce context, container, component, and code documentation.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/wshobson/agents/c4-architecture
About the project

Agentic Plugin Marketplace is a collection of reusable plugins, agents, skills, commands, and rules for coding-agent tools including Claude Code, Codex CLI, Cursor, OpenCode, Antigravity CLI, and GitHub Copilot. It is for developers assembling agentic workflows across multiple harnesses from shared Markdown sources, and the catalogue entries are examples or subsets of those workflow components.

wshobson/agents · 39,461 stars · on GitHub · sethhobson.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/wshobson/agents

Made for: Claude Code.

Or install c4-architecture, the plugin that ships this one along with the rest of its 1 command, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for c4-architecture

README.md
[![agentmods](https://agentmods.dev/badge/commands/wshobson/agents/c4-architecture.svg)](https://agentmods.dev/commands/wshobson/agents/c4-architecture)
Your own site
<a href="https://agentmods.dev/commands/wshobson/agents/c4-architecture"><img src="https://agentmods.dev/badge/commands/wshobson/agents/c4-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,418 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.03418
Opus 5 $0.00015 $0.01709
Sonnet 5 $0.00006 $0.00684
Haiku 4.5 $0.00003 $0.00342

Measured 4d ago against content hash ccd92748c35f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

c4-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/c4-architecture/commands/c4-architecture.md · 372 lines

How it starts

The opening of the file, as written. The whole thing — 372 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C4 Architecture Documentation Workflow

Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.

[Extended thinking: This workflow implements a complete C4 architecture documentation process following the C4 model (Context, Container, Component, Code). It uses a bottom-up approach, starting from the deepest code directories and working upward, ensuring every code element is documented before synthesizing into higher-level abstractions. The workflow coordinates four specialized C4 agents (Code, Component, Container, Context) to create a complete architectural documentation set that serves both technical and non-technical stakeholders.]

Overview

This workflow creates comprehensive C4 architecture documentation following the official C4 model by:

  1. Code Level: Analyzing every subdirectory bottom-up to create code-level documentation
  2. Component Level: Synthesizing code documentation into logical components within containers
  3. Container Level: Mapping components to deployment containers with API documentation (shows high-level technology choices)
  4. Context Level: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)

Note: According to the C4 model, you don't need to use all 4 levels of diagram - the system context and container diagrams are sufficient for most software development teams. This workflow generates all levels for completeness, but teams can choose which levels to use.

All documentation is written to a new C4-Documentation/ directory in the repository root.

Phase 1: Code-Level Documentation (Bottom-Up Analysis)

1.1 Discover All Subdirectories

  • Use codebase search to identify all subdirectories in the repository
  • Sort directories by depth (deepest first) for bottom-up processing
  • Filter out common non-code directories (node_modules, .git, build, dist, etc.)
  • Create list of directories to process

Read the full file on GitHub · 372 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 372 lines · 30 tokens per session scan A ccd92748c35f

Subscribe to this mod's changes

c4-architecture is a command published in the GitHub repository wshobson/agents (39,461 stars, last pushed 5d ago), licensed MIT. It adds 30 tokens to every session and 3,418 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.