Skip to content

0001: Own C# architecture model, emitted to D2, in a new repo

Status: accepted for the FLT-379 first slice, 2026-11-04. Decided by Clahadore after the core seats attacked the plan. Approved by Andrew on 2026-11-05, together with two rulings: driver mode (block edits that change code directly) goes through the same gates as agent changes, and the first slice supports Windows only.

Decision

  1. The canonical model is a small set of immutable C# records owned by this repo. D2 is a derived output. Structurizr DSL and LikeC4 are possible later projections and are not in this slice.
  2. The owning repo is the new private andrewjonesdev-tools/forge-architecture.
  3. D2 is pinned to v0.9.0 and run as a subprocess, hash-checked on every launch.

This corrects forge-specs/forge-updated-design.md:68, which named Structurizr.Core as the canonical model.

Why not Structurizr.Core

Checked 2026-11-04:

  • NuGet's newest version is 1.1.1, and Jira FLT-379 research dates it 2023-02-23. It targets .NET Standard 2.0.
  • gh api repos/structurizr/dotnet returns 404, so no fixes are possible.
  • Active work is in structurizr/structurizr (Apache-2.0, not archived, pushed 2026-10-31). It has no .NET library.
Option Result
A. Structurizr.Core Rejected. Dead package with no source repo.
B. Own records, emit D2 Chosen. No dependency, full control of determinism and stable IDs. We own the schema.
C. Vendor a community fork Rejected. We would own the same dead code with more surface.
D. Emit DSL and run the Java tool Rejected. A JVM in every gate; the 2026-10-31 council also rejected it.
E. LikeC4 .c4 as canonical Rejected. A Node toolchain in the gate and the renderer becomes the source of truth.

The 2026-10-31 council (Jira FLT-379) already retired the NuGet and required C# as the single writer of a versioned model. B satisfies that. It differs in one way: that verdict assumed a Structurizr-shaped workspace JSON. This record has our own schema and no Structurizr compatibility claim. A later Structurizr export would be a projection, with its losses listed.

C4 is also narrowed on purpose. A .NET library is modeled as Library, not C4 Component, because a project file proves a build dependency, not a runtime component. The c3 views say "build dependencies".

Forking the .NET library (Andrew's question, 2026-11-04)

Andrew asked whether Structurizr could be forked and maintained as open source. Legally yes: every copy checked is Apache-2.0. Four seats weighed upkeep and drift (Cedric Focus, Jenny, Susie Franny, Gronktayvius General; FLT-379-fork-question.md in the session notes).

Observed: evs-broadcast/structurizr-dotnet is the fullest fork, with a Dsl project and 224 .cs files, but it was last pushed 2024-04-05, has 0 stars, targets net7.0 and references Newtonsoft.Json 10.0.3. d4span was last pushed 2024-06-17 and has no Dsl project. Meanwhile structurizr/structurizr keeps releasing in Java (v2026.10.26, library v6.2.4). Seats reported, but nobody here verified, that this Newtonsoft version carries CVE-2024-21907. Fork grammar coverage was not checked.

  • This slice: keep B. All four agree. This slice needs none of the fork's client, DSL parser or views API.
  • Open-source fork: not recommended now, and this is Andrew's call. The cost is a standing commitment: modernizing, security fixes, tracking Java schema changes, releases and strangers' issues. Seats' estimates differ and rest on unchecked coverage, so treat them as rough. Cedric noted that Java release activity does not prove monthly breaking changes to the schema or DSL.
  • Triggers to reopen: a real consumer needs in-process, native C# round-trip of current Structurizr workspaces or DSL, which exporting cannot do, and a named owner has capacity for it.
  • Cheaper route if interoperability is wanted: emit Structurizr DSL or JSON from this model and validate it with the Java tool as an optional CI check. Nothing public was created.

Long-term direction (asked by Andrew, 2026-11-04; open)

Andrew asked what is best for Forge long term, and recalled that Structurizr was chosen so users could understand architecture through C# and Blockly. The design backs the two-way part: forge-updated-design.md:116 makes C# the source of truth, :2135 and :2141 promise round trips including Structurizr DSL with C#, and :1559-1567 set the zoom path. It does not say Structurizr compiles to Blockly. An earlier spec edit called the DSL an optional later export, which was wrong and has been corrected.

Seats (FLT-379-longterm-question.md in the session notes):

Seat Pick Must Forge read DSL long term? C# builder API for architecture as blocks
Cedric Focus L2, scoped: own model plus bounded DSL interop, reader on evidence Yes, if the two-way promise stays Compatible, not mandated; add when block-editing tasks need it
Jenny L2, staged on L1 Yes Required, when authoring is built
Susie Franny L1: own model, DSL as export No first-class read; one-way import on demand Not mandated by the design
Gronktayvius General L1: own model, DSL as export No Rejected as a second writer unless a usability session shows projection fails

Agreed by all four: - Own model under SpecIrRoot, with C# authoritative. A Structurizr fork as the canonical model is rejected. - Start with DSL export. No seat wants the reader or builder before something triggers them. - "Round trip to every format" overpromises at C4. Code to diagram is a lossy projection. Diagram to code is an explicit, bounded command, or a refusal.

Andrew's direction, given after the seats answered, in his words: "as the user learns more about the work they are doing they should be able to edit the blocks which should then trigger the builder api to consider changing the di cdktn etc the 2 way translation allows the user to make changes that the agents can then act on to make the real hardcore changes".

Clahadore's reading, not reviewed by the seats, with Andrew's answer on direct edits below:

  1. C# stays the only source of truth. Code is projected up to the model, then to diagrams and blocks.
  2. A block edit does not compile to code. It becomes a typed proposed change on the model, such as "add a container" or "A talks to B". The builder API is the typed way to state that change.
  3. Agents act on the proposal and write the real DI, project and cdktn changes on a branch, with the usual gates and hard stops. A diagram edit may mean many code edits, and the agent makes those choices.
  4. The generator re-reads the changed code. The model diff against the proposal shows whether the agent delivered it.

This answers the seats' two objections. Blocks are not a second writer, because agents write the C#. And the lossy inverse stops being a compiler problem, because a person or agent resolves the ambiguity. It also gives this slice's model diff a second use, as the check in step 4.

Direct edits: forge-updated-design.md:116 said every edit mutates the AST through Roslyn. Andrew on that path: "it should still in theory have the capability but it likely wont be used it can be an experimental feature i guess". And on what a proposal holds: "it will translate into code for the agents to get an idea of what the user wants in the proposal kind of but their could be a driver mode for people who want that". So a block edit translates to draft C# inside the proposal, as intent for the agents, not as the final change. Agents carrying out proposals is the normal path. Direct Roslyn edits are an experimental, opt-in driver mode. Whether driver mode keeps the same gates is not yet decided; Clahadore's recommendation is yes.

Andrew then added that direct translation is needed for teaching: "it also will be useful to have it directly change into code for the reverse pair programming mode" and "so forthat eteaching functionality yes it is necessary". So direct block-to-C# translation is a required capability (forge-updated-design.md, section 24.5), not merely experimental. Only its use on real work as driver mode is experimental. This raises the bar: that translation must be deterministic and exact for whatever block subset teaching uses, so it has its own tests and cannot lean on an agent resolving ambiguity. It does not need to cover every architecture edit; a block with no exact translation can say so.

The spec is updated. None of this is built in this slice.

Triggers: block-based architecture editing starts the typed proposal and builder API. A real workspace that must be imported starts a DSL reader, for the subset that file uses; block edits do not need one. Source-level callers of Structurizr.Core would justify a compatibility layer. Demand from outside users is unmeasured.

Low-cost seams from the seats: treat IDs as opaque; allow one element several origins; keep declared and observed facts distinct; keep any future layout in separate keyed records; keep writers as pure functions over the model. Tying primary keys to Roslyn symbols is declined because an imported element has no symbol. Schema v1 has no consumers outside this repo, so SchemaVersion covers later changes.

Why a new repo

  • fleet-infra: this tool scans every repo, and two sibling sessions are active there. It would also bring jsii and Node concerns near a parser of hostile input.
  • usage-governor, fleet-harness: unrelated and busy.
  • No Forge monorepo exists; the roadmap's src/Forge.* waves have no home yet. Forge.Cli (roadmap wave 7) can consume the Core later.

Costs: a new remote, docs set, board entry and fleet-repo-sync manifest line.

Why D2 v0.9.0

Observed on a sample diagram with --layout=dagre: 3 runs on Windows and 2 on Linux (alpine container) gave byte-identical SVG, sha256 prefix 407dc4bc156f3bc5, 16651 bytes. Local v0.7.1 gave 5db98255412b365e. So a pin is required, and one sample does not prove every diagram is stable. Windows amd64 on home-ci is the authoritative render environment.

Also observed on real v0.9.0: $ in a double-quoted label breaks compile with "substitutions must begin on {"; \$, \\, \" render payloads such as ${vars.x}, @evil.d2 and icon: https://... as inert text; D2_* environment variables change output; compile errors contain absolute paths.

Who attacked it

Seats via council-seat on the plan, 2026-11-04. Clahadore (Claude family) wrote the plan and did not vote.

Seat v1 Final
Cedric Focus (Codex) REJECT APPROVE, on the third re-check of v2
Jenny (Gemini) APPROVE WITH CONDITIONS not re-seated; conditions adopted
Susie Franny (Muse) APPROVE WITH CONDITIONS not re-seated; conditions adopted
Gronktayvius General (Grok) APPROVE WITH CONDITIONS not re-seated; conditions adopted
Gronktayvius Red Team (Grok) APPROVE WITH CONDITIONS not re-seated; conditions adopted

All five picked B and the new repo. Conditions are in docs/technical/plan-v2.md.

Conditions declined: - A synth hash in model.json (Red Team): any attribute change would stale the diagram. - Treating an Exe with a test package as exit 2 (Red Team): xunit.v3 test projects are Exe, so this would fail real repos. A Web or Worker SDK with a test package is still exit 2. - Name-based test exclusion (Jenny): a production project named *.Tests would vanish. Name alone never excludes. - IModelRenderer seam from v1: dropped, as Cedric advised, until a second renderer exists.

Consequences

  • A green gate means committed artifacts equal this generator's output for declared sources. It does not mean the picture is the whole system, a runtime call graph, or an exposure map. Each diagram says so.
  • Expected models were written by Clahadore, not a human. Andrew or Shereeba remain the human oracle.
  • Reversal is cheap while only this repo consumes the schema.