c4-model-agentic-plugin is a github.com/caviri project A Claude Code plugin that reads any repository It writes an interactive C4 map, from system context down to code Plus a slide deck that explains it to the next developer And user stories your team can draw and talk over Every box points to a file Built on Simon Brown’s C4 model Open source · Apache-2.0

A Claude Code plugin · C4 model

Read any codebase
like a map.

One command explores your repository and writes an interactive architecture map you can open from the system down to the code, a slide deck that explains it, and user stories your team can mark up. Every box points to a file.

Install the Claude Code plugin c4-model-agentic-plugin for me. Read https://raw.githubusercontent.com/caviri/c4-model-agentic-plugin/main/INSTALL.md and follow its "Steps for the agent" section exactly.

Paste it into Claude Code. It runs the install, checks Python, Node.js and Chrome, and tells you how to start.

architecture-explorer/index.html
L1 · System contextWho uses the system, and what it is.

How it works

From repository to map in four moves

  1. 01

    Explore

    Claude reads from the outside in: README, deployment files, manifests, entrypoints, then the main flows.

    README.mddocker-compose.ymlpyproject.toml

  2. 02

    Ask

    A few questions, each with a default: who will read it, what is in scope, which flows matter. Then you correct its summary.

    audience?scope?flows?

  3. 03

    Brief

    It writes the brief: actors, containers, components, relationships, flows and state machines, each with the file it came from.

    project-brief.md

  4. 04

    Generate

    It builds the map and the deck, opens both in a headless browser, and reads the screenshots before it reports back.

    architecture-explorer/index.htmlproject-deck/index.html

Live example

Don’t read about it. Open it.

This is the output the plugin generated for a small example project: an image annotation tool with a web app, an API, a worker and three stores. Its model has since gained use cases, three wireframes (labelled illustrative, because the project was never run) and a data layer; the page carries those versions as its history.

Full page ↗

double-click a box to open it ⇅ in an open box draws a scenario inside it D scenarios A data / search

The map

Everything a map of your code should do

Four levels, one page

System context, containers, components, code. Boxes open in place, arrows reattach to whatever is visible, and a selection keeps only what it connects to bright.

Flows in colour

Each runtime flow in its own colour, with its use case: a sequence or collaboration diagram at any level, painted on the map's arrows, or drawn inside an open box with ⇅.

Pictures of what users see

Screenshots, diagrams or photos on a box, an arrow, a scenario or a step, in a gallery and a full-size viewer. Mock-ups carry an illustrative label.

State machines

Lifecycles drawn as states and transitions inside the box that owns them, with initial and final states marked.

Grounded in the code

Every box carries its file and line, linked to the repository. The build checks that each path exists before it calls the page done.

An RDF graph, too

Download the architecture as Turtle, JSON-LD or a single-file .rete graph in a published C4 ontology, and query it with SPARQL. The page can be rebuilt from the graph alone.

Edit it in the browser

Press ✎ edit: drag new boxes from the sidebar onto the map, reorder them in the outline, Alt+drag to connect, change any field, step or picture. Or let an AI agent edit it, each change waiting for your Apply. Undo, then download the model or the page.

Export any diagram

The whole map, the pinned board or a scenario diagram as an SVG, a PNG or a page of its own, in the colours on screen. Or the map as Mermaid text for a README.

Your colours, your sizes

Six colour themes (or follow the system), and a size menu for the interface, the spacing between boxes and the labels and arrows. Icons and technology logos on the boxes, in one colour or the brand’s.

The Data view of the example: the PostgreSQL tables as cards with a row per column, lines between the columns that hold each other's identifiers, and two flows painted on them in blue and teal, with chips giving the step numbers that read and write each column
The example’s PostgreSQL tables, with the upload and export flows painted on the columns they read and write.

And its data

Tables, files and ontologies, joined field to field

  • SQL tables, JSON Schemas and API payloads, ontologies, JSON-LD contexts, object-store keys and queue messages in one database diagram: a card per entity, a row per field
  • Lines between specific fields, across stores too: an object key kept in a column, an id passed to a job or copied into an export file, dashed where no store enforces it
  • Every schema sits in a box of the map, every table names the code that defines it, and every flow step lists the columns it reads and writes
  • An importer for SQL migrations, JSON Schema, OpenAPI, OWL / SHACL and JSON-LD contexts, with a drift check against the model
Schemas and data

And a deck

Slides that explain it to the next developer

  • C4 slides that zoom into each other, from context to components
  • Step-through and sequence diagrams, drawn as SVG and checked for overlaps
  • Code with line-by-line highlighting, and a where label pointing at the file
  • Speaker notes, a reading view, light and dark
Flip through the example deck
Title slide of the example deck

And user stories

Stories your team can draw and talk over

  • One page per project: who wants what and why, the screens they see, the acceptance criteria checked against the code, and each journey through the architecture
  • Readers mark up any screen: pen, highlighter, arrows, boxes and numbered pins with notes, plus a comment
  • Record a voice note while you draw: the strokes are timed to your voice and replay with it
  • Download a story as one HTML file with its screens, drawings, comments and audio, send it, and import the files that come back. A script turns all of it into Markdown for the next round of work
A user story page of the example: a wireframe of the annotate page with a red ring around the label field, a box around the Submit button, an arrow, a highlighted line and a numbered pin; beside it a feedback card with a comment, the pin's note and a voice note playing at 0:04, its timeline ticked where each stroke was drawn, and the transcript line being spoken shown over the screen
A voice note replaying on the example: the arrow is drawn back as the voice reaches it. Demonstration feedback (DEMO DATA).
Compare mode in the explorer at the system context: an added mail server in green, a changed person in amber, the software system marked with a +2 −2 badge for the changes inside it, and a panel listing each change with its author and commit
Compare mode at the system context, on demonstration data with fictional authors.

And its history

See how the architecture changed, and who changed it

  • Every merge, release or pull request that touched the model becomes a version on a timeline along the bottom of the explorer
  • Compare any two: added boxes and arrows in green, removed ones as red ghosts, changes in amber, each with its author and commit, and counted on the boxes around them up to the system context
  • Diff reports for two branches or a pull request, and blame for every box
  • An RDF 1.2 dataset with PROV-O provenance: a named graph per version, a reifier per changed triple
History and diffs

No Claude Code needed

Use it in ChatGPT and Claude

  • ChatGPT
  • Claude web & desktop
  • any MCP client
  • A remote MCP server: the assistant reads a public GitHub repository, writes the model and checks it with the explorer’s own validator, SHACL and the real file paths
  • The explorer appears right in the chat as an interactive view (MCP Apps): open boxes, step through scenarios, export the graph
  • Turtle, JSON-LD and .rete exports, or the standalone page, from the same model
  • Stateless: the server keeps nothing of your model
ChatGPT and Claude (MCP)
The example's architecture explorer drawn inline in a chat: toolbar, the map at the container level, and the expand button
The view as show_explorer draws it, in a test host that speaks the MCP Apps protocol.

Measured, not claimed

What the plugin produced for the example

Every figure here is counted from the example on this page: a 39-file project with a web app, an API, a background worker, PostgreSQL, Redis and MinIO, where people annotate images and every annotation is reviewed.

  • 64boxes on 4 levels3 people, 1 system, 4 containers, 3 data stores, 21 components, 27 functions and classes, 5 states
  • 63source paths checkedeach box’s file and line, verified by script before the page was written
  • 69relationships, all labelledevery arrow says what it carries, from PUT originals to FOR UPDATE SKIP LOCKED
  • 93scenario stepsfour runtime flows, from batch upload to the COCO export, each step pointing at code
  • 20slides, 11 diagramsthe deck that explains it, written from the same brief as the map
  • 30entities, 140 fieldstables, buckets, job messages, JSON objects and ontology classes in 7 schemas, each placed where it lives
  • 18ids across storesreferences no store enforces, such as an object key in images.storage_key or an id in the COCO file
  • 45steps that touch dataeach lists the tables and columns it reads and writes, from INSERT images to the export file
  • 4,958RDF triplesthe same model as Turtle or JSON-LD, data layer and icons included, ready for SPARQL or a .rete file

Background

Built on Simon Brown’s C4 model

The four levels this plugin draws (system context, containers, components and code) are the C4 model, created by Simon Brown. It grew out of the software architecture workshops he ran from the mid-2000s, when attendees could not make sense of the diagrams they were drawing; the name “C4” first appeared in his QCon London workshop in March 2011.

This plugin is an independent project, not affiliated with or endorsed by Simon Brown. It uses the C4 levels as its map. For the model itself, go to the source.

Install

Map your codebase this afternoon

Needs Claude Code. Python 3 builds the deck; Node.js 18+ and Chrome or Edge are optional, for building and checking the map.

Ask your agent: paste into Claude Code
Install the Claude Code plugin c4-model-agentic-plugin for me. Read https://raw.githubusercontent.com/caviri/c4-model-agentic-plugin/main/INSTALL.md and follow its "Steps for the agent" section exactly.
Or yourself, in Claude Code
› /plugin marketplace add caviri/c4-model-agentic-plugin
› /plugin install c4-model-agentic-plugin@c4-model-agentic-plugin
Then, in the project to explain
› /c4-model-agentic-plugin:explain-project [deck | explorer | stories] [audience or focus]