Code Is Cheap, Bad Architecture Is Not: Introducing Wiremap
In this agentic era, code has become quite cheap, to the point that the bottleneck has moved to code review. People are trying various ways to deal with this, for example with better verification methods. Some (many?) don’t even read the code anymore! That’s fine for pet projects, but you still have some responsibility when you merge a change that can impact a large number of users.
I’ve been enjoying tools like Plannotator Guided Reviews, which let an agent break a review down into logical chunks, making it much easier to focus on what’s going on. But working on large backend systems, usually with a lot of components, I felt this was not enough. What I really want to see when I receive a PR to review is its impact on the system as a whole. I am less interested in the individual lines of code (except for performance-sensitive work) and more in the bigger picture. I don’t care so much if a variable is badly named, but a service calling another one it shouldn’t know about, or bypassing one to peek at its database, is something I really want to see.
I’ve been drawing architecture diagrams for years. I used Enterprise Architect in the old days, then tried more modern solutions like the C4 model and Structurizr, but there was always the same problem: they got outdated quickly. Now we have the perfect solution for that, since it’s quite trivial for agents to keep them up to date as part of their workflow.
Introducing Wiremap
I built Wiremap, and the first release is out today. It keeps a model of your system’s architecture in your repository: services, jobs, stores, channels and outside systems, and the edges between them.
It consists of three parts:
- a small description language that reads easily in a diff
- a skill that lets your agent write it from the code and update it with each change
- a CLI to check it, format it and draw it
Agents are already very good at generating architecture diagrams. What Wiremap brings to the table is a simple way to include them in your workflows, so that these diagrams always stay up to date and changes surface when they happen. And it comes with a pretty cool way to visualize them.
You might be wondering why I didn’t reuse an existing format like C4. I did look at a few of them, but none was a good fit. In tools like Structurizr or LikeC4, a relationship is basically an arrow with a label. Anything more than that, like whether it’s a call or a write, or where it comes from in the code, would have to be stored as metadata that nothing checks. I wanted both to be part of the format and verified by the CLI, so I ended up creating a small format of my own.
What it looks like
Here is the map of the Spring PetClinic Microservices, extracted by an agent with the Wiremap skill and no human intervention. Hover a node to see what it talks to:
The model behind it is a plain text file called wiremap/model.txt. It is designed to be easy to read, especially in a diff (more on that later):
service api-gateway on java {
call customers-service
call genai-service
call vets-service
call visits-service
}
service customers-service on java {
write customers-service-db
}
service genai-service on java {
call api.openai.com
call customers-service
call vets-service
}
...
store customers-service-db on hsqldb
external api.openai.com outside
It doesn’t cover what is inside a service, such as classes or endpoints. The focus is on which deployable components there are and how they interact with each other.
Every edge points to a line of code
The agent also generates a second file, wiremap/evidence.txt, in which every node and every edge points to the line of code or configuration it comes from:
service genai-service {
at docker-compose.yml | genai-service:
on java at spring-petclinic-genai-service/pom.xml | <artifactId>spring-petclinic-genai-service</artifactId>
...
call customers-service at spring-petclinic-genai-service/src/main/java/org/springframework/samples/petclinic/genai/AIDataProvider.java | return discoveryClient.getInstances("customers-service").get(0).getUri();
...
}
This is important for two reasons. First, the agent can’t invent an edge: if it adds one, it has to say where it found it. Second, the model can be verified against the code with wiremap check. Let’s see what happens if someone renames the GenAI service in docker-compose.yml:
$ wiremap check
wiremap/evidence.txt:17: the snippet does not appear in `docker-compose.yml`
at docker-compose.yml | genai-service:
1 problem
Of course, it only checks that the line is still there, not that the code around it still does the same thing. But in practice, it’s enough to catch a model that became stale, and if you run it in your CI, you will know as soon as the model and the code diverge.
Enforcing rules
Evidence makes sure that the model is accurate. But what about making sure that the architecture is the one you want? This is where rules come in, and it’s the part I personally find the most powerful.
Every team has rules like “only the orders service writes to the orders database” or “nothing in fulfilment calls checkout”. Usually they live in someone’s head or in a wiki page, and they’re really easy to miss. With Wiremap, they live inside model.txt and the CLI enforces them. You don’t even have to learn the syntax: ask your agent “only the customers service writes to the customers database”, and it writes this:
rule no write to customers-service-db except from customers-service
A rule forbids a kind of edge (call, read, write, publish, consume, or edge for all of them) between a source and a target. Each of these can be a node, a group of nodes, or something more general like any external or any store on postgres, and you can add exceptions. Here are a few examples:
rule no edge from api-gateway to any store
rule no call to any external except from genai-service
rule no write to vets-service-db
Once you have rules, wiremap check fails for every edge that breaks one of them. For example, let’s say that in PetClinic, only the API gateway is allowed to call the vets service:
rule no call to vets-service except from api-gateway
$ wiremap check
wiremap/model.txt:13: genai-service call vets-service breaks `rule no call to vets-service except from api-gateway` (line 32)
at spring-petclinic-genai-service/src/main/java/org/springframework/samples/petclinic/genai/VectorStoreController.java | this.webClient = webClientBuilder.build(); (wiremap/evidence.txt:23)
at spring-petclinic-genai-service/src/main/java/org/springframework/samples/petclinic/genai/VectorStoreController.java | String vetsHostname = "http://vets-service/"; (wiremap/evidence.txt:24)
1 problem
The output shows the edge, the rule it breaks, and the lines of code responsible for it. Since the agent updates the model with each change and check runs in your CI, a pull request that adds a forbidden call will fail before it gets merged, even if nobody looked at the code. This is exactly the kind of problem I was worried about! Note that the agent never changes rules on its own: it only adds, changes or removes them when you ask it to. Otherwise, it simply reports the edges that break them.
Reviewing the architecture of a pull request
Now let’s get back to my initial problem: when I review a pull request, I want to see its impact on the system before looking at the code. Since the model is committed together with the code, a pull request that changes the architecture also changes wiremap/model.txt, and that diff alone already tells you a lot. Here is how the model changes with a real pull request of the OpenTelemetry Demo (#457) that added a Kafka queue:
--- a/wiremap/model.txt
+++ b/wiremap/model.txt
@@ -1 +1,4 @@
+service accountingservice as AccountingService on go {
+ consume orders
+}
service adservice as AdService on java
@@ -11,2 +14,3 @@ service checkoutservice as CheckoutService on go {
call shippingservice
+ publish orders
}
@@ -17,2 +21,5 @@ service featureflagservice as FeatureFlagService on elixir {
}
+service frauddetectionservice as FraudDetectionService on kotlin {
+ consume orders
+}
service frontend on typescript {
@@ -40,2 +47,3 @@ store ffs on postgres
store redis-cart on redis
+channel orders on kafka
actor operator {
For a more complete picture, you can simply ask your agent “What does this change do to the architecture?”, and it will compare the model before and after the change. It even works if the repository doesn’t have a model yet: in that case, the agent only models the parts touched by the change. It then writes a Markdown report listing the nodes and edges that were added, changed or removed, with the evidence for each one, so you can easily post it as a pull request comment. On top of that, wiremap report --link adds a link that opens the change in the viewer (the whole change is encoded in the link itself). Here is what it looks like for the same pull request:
Open the change in full screen
Tested on real repositories
Since the agent does the extraction, the quality of the result depends a lot on the skill, which tells it what to look for, what to ignore and how to name things. To get it right, I extracted models from a large number of public repositories and looked at each map, and every time I saw some noise, I added an instruction to the skill to avoid it. I also ran the skill with different agents and refined it until they all converged to the same output.
However, real projects can be tricky, and it’s impossible to come up with a skill that makes the right call in every case. Maybe your topology is split across two Compose files, or maybe your admin service is not worth showing. For that reason, I made it easy to add your own guidance on top of the skill: you can write it in plain Markdown in wiremap/conventions.md, next to the model. For example:
- The topology is deploy/compose.yaml with deploy/compose.prod.yaml.
- Leave out the admin service and every call to or from it.
- Each folder under services/ is a group.
The agent reads this file before every extraction, update or report, and your conventions always take precedence over the skill. You don’t even need to write them yourself: at the end of an extraction, the agent lists the judgment calls it made and offers to save them as conventions, so that the next run makes the same choices.
If you are curious to see what it looks like on other projects, the examples page has the maps of four of those repositories.
Try it
Wiremap is made of a skill that works with Claude Code, Codex and other harnesses, and a CLI available for Linux, macOS and Windows. With Claude Code, you can install both with a plugin:
/plugin marketplace add ghostdogpr/wiremap
/plugin install wiremap@wiremap
Then, in the repository you want to map, ask your agent:
Extract a Wiremap model of this repository.
The agent will write the model, run wiremap check until it’s valid, and propose the choices it made as conventions. You can then run wiremap view to look at the map, and commit the wiremap/ folder together with your code. Check the documentation to learn how to install it in other harnesses, how to keep the model up to date, and how to write rules.
I hope that with Wiremap, the next pull request that quietly adds a call between two services, or a second writer to a database, gets noticed during the review, even if nobody reads every line of the code.
Wiremap works with any stack, since the agent does all the reading. It’s still very new and far from perfect, so if you try it on your own system and something looks off, or if you have ideas to make it better, please open an issue or let me know. Feedback and contributions are welcome!