Skip to the content
Miss any of the 6 linked parts and Archi won’t open the file

Deleting one element touched six things in the file

Arslan Rakhmatullin

Platform architect, as an outside expert or on your team. Let’s talk

Deleting one Business Actor (a person or team in the model) from a small test model removes six things: the actor, the Assignment relationship it was part of, its boxes on two views, and the two lines drawn from those boxes. One more attribute, targetConnections, has to be rebuilt on the boxes those lines pointed at., source: edit.rs line 146

That count comes from a test in amcli, a CLI I built for ArchiMate models, the .archimate files that Archi saves. It reads, edits, checks and draws them without Archi or a JVM. The README says it is built for AI agents.

Why the agent stays out of the XML

The amcli skill has a blunt rule: never read a .archimate file with Read or cat., source: SKILL.md line 35 Its description gives the reasons. These files run to megabytes, reading one wastes context, and an edit by hand corrupts the model so that Archi refuses to open it., source: SKILL.md line 14

The delete shows how. In the test file the actor is one line. Its id also sits on three other lines: as the source of the relationship, and in the archimateElement attribute of a box on each of two views. The relationship’s id sits in the archimateRelationship attribute of two lines on those views. Delete the element line alone and those ids name nothing. Archi then refuses to open the model.

This is not hypothetical. The commit that added amcli’s edits calls it the worst bug in the tool amcli replaced. That tool deleted concepts and left those references dangling.

Some of the damage is quieter. targetConnections lists the lines that point at a box, a copy of what the lines already say. A comment in the code says Archi tolerates a stale one in memory but fails on it at load. amcli does not patch it. It rebuilds it from the lines that survive., source: edit.rs line 737

An agent editing the XML would have to find all of that itself, on every delete. The CLI finds it once, in code that has a test.

What a checked edit gives the agent

A delete that would take other things with it is refused by default. The refusal is the impact report, and -y runs the delete once the agent has read it.

Every new relationship is checked against ArchiMate’s rules for which element types may connect, and how. A duplicate of the same type between the same pair is refused, and so are mixed types at a junction. The refusal names what is permitted between those two types, so the agent’s next call can be the right one.

Exit codes name the failure (not found, ambiguous, invalid, a conflict), and each comes with the next step: the nearest names, or the candidates with an id to paste.

amcli apply takes a JSONL batch and writes once. If any line fails, the file is byte-identical., source: README.md line 94 Bytes an edit did not touch stay as they were, so renaming one element changes one line in git.

At the end, amcli validate reports its findings, with the line in the file and a fix command where it has one. For a relationship whose end no longer exists, that is amcli relation delete and the id.

What to copy

  • Keep agents out of files where one fact sits in several places. Give the agent a command that changes all of them, and say in the skill not to open the file.
  • Make the refusal teach. An error that names the allowed option saves the agent a guess. Exit codes let it branch without parsing text.
  • Test what the target app will load. amcli’s tests reopen the model after edits. Its identity test asserts that parsing and writing every real Archi file in the test corpus changes no byte.

96 of the repo’s 102 commits carry a Claude co-author line. The tool is Apache-2.0, and releases are still 0.x.

If your agents edit a file that another program has to open, count how many places one delete has to touch.

Sources

  1. The test that counts the six. edit.rs:146
  2. The rule. SKILL.md:35
  3. The reasons, in the skill’s description. SKILL.md:14
  4. Rebuild, don’t patch. edit.rs:737
  5. Atomic batches. README.md:94