Fluent C# architecture spec that enforces the rules (CLI, CI, xUnit) and generates AI-agent context (AGENTS.md, MCP) from one model.
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
git clone https://github.com/andypgray/loadbearingResumen de MCP Servers
# LoadBearing
<!-- mcp-name: io.github.andypgray/loadbearing -->
[](https://github.com/andypgray/loadbearing/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/andypgray/loadbearing) [](https://www.nuget.org/packages/Zphil.LoadBearing.Cli) [](https://www.nuget.org/packages/Zphil.LoadBearing.Cli)
LoadBearing is a .NET tool that renders one C# architecture spec to two targets: enforcement and agent context.
The architecture of a long-lived codebase is real: layers, boundaries, rules. It is also unenforced: it lives in a few heads, no build step checks it, and diagrams drift. Nothing fails when a change crosses a boundary, least of all when a coding agent wrote the change: fast, plausible, and blind to which walls are load-bearing. Architecture-as-code is LoadBearing's answer: the rules become one C# spec, and the spec becomes every surface on this page.
1. **Enforcement**: one checker passes or fails the rules at the command line, in CI, as named xUnit tests, and in an agent hook when the agent's turn ends.
2. **Agent context**: the same rules render to a managed `AGENTS.md` block, per-directory rule cards, and MCP query tools for coding agents.
Write your architecture once. Use it everywhere.
A rule is one statement:
```csharp
arch.Rule("layering/domain-independent")
.Enforce(domain.MustNotReference(application, infrastructure, api))
.Because("The Domain holds the quote and rate model the rest of the subsystem is built on; it stays free of the layers that depend on it so it can be reasoned about and tested on its own.")
.Fix("Move the dependency out of Domain: define an interface here and implement it in the outer layer that needs it.");
```
That is the whole rule: an ID, a posture (`Enforce`), a constraint, a reason, a fix. It is committed in the [clean-architecture example](https://github.com/andypgray/loadbearing/tree/main/examples/Meridian.Quoting), and CI holds `check` green against the codebase it governs.
LoadBearing is pre-alpha and under construction; [Status](#status) holds the current inventory.
## One spec produces
Each target below consumes the same reified model, and every violation report carries the rule ID, the generated rule sentence, the reason, the fix, and the exact `file:line`.
| Target | What it is |
|---|---|
| `loadbearing check` | one pass-or-fail verdict for the command line and CI |
| `check --sarif` | that verdict as SARIF 2.1.0, for code scanning |
| xUnit adapter | every rule an individually named test |
| `loadbearing render` | the managed `AGENTS.md` block and per-directory rule cards |
| `loadbearing mcp` | `arch_check`, `arch_status`, `arch_explain`, `arch_context`, and `arch_graph`, plus a `derive_spec` prompt |
| agent hook | `check` when a turn ends; a red rule refuses the stop, report on stderr |
The adapter's failure text is byte-identical to the CLI's: the two share one renderer, and a product test pins them equal. The managed block plus `loadbearing explain` are also the generated architecture documentation, written for agents first and readable by people; the gate under [The prose it generates](#the-prose-it-generates) keeps it current.
The compiler is the source of truth for your code. LoadBearing is the source of truth for your architecture.
## This repo's own spec
LoadBearing governs itself. Thirty-five rules over this repository's real code, across eight declared layers, live in [`LoadBearingArchSpec.cs`](https://github.com/andypgray/loadbearing/blob/main/arch/Zphil.LoadBearing.ArchSpec/LoadBearingArchSpec.cs), and every fence from here down to [This page is tested](#this-page-is-tested) is that spec, or this solution under it, on one surface after another — bar the two under [As SARIF](#as-sarif), which come from the Meridian example, because showing a ratchet needs live debt and this repository has paid its own off. Take the rule that keeps the CLI off stdout — `host` is the layer the CLI project defines:
```csharp
arch.Rule("cli/no-stdout")
.Enforce(host
.MustNotUse(
arch.Member(() => Console.Out),
arch.Member(typeof(Console), nameof(Console.Write)),
arch.Member(() => Console.WriteLine())))
.Because("Stdout is a protocol channel here — the MCP server speaks JSON-RPC over it and CLI " +
"output flows through System.CommandLine's console — so a direct Console write corrupts " +
"the wire and is invisible to the in-process tests.")
.Citation("https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio")
.Fix("Write CLI output through the command's InvocationConfiguration console; route server " +
"diagnostics to the logger or Console.Error.");
```
Nothing in the build system stops the CLI writing to `Console`, and the MCP server on the other side of that stdout speaks JSON-RPC over it. This rule is the only thing standing between those two facts.
## The prose it generates
`loadbearing render` derives the rule sentence from the constraint, carries the `Because` across verbatim, and writes the result into the managed block of this repository's committed [`AGENTS.md`](https://github.com/andypgray/loadbearing/blob/main/AGENTS.md), the convention file Claude Code, Codex, Cursor, and Copilot read:
```markdown
- `cli/no-stdout` — The Host layer must not use `Console.Out`, `Console.Write()` or `Console.WriteLine()`. Stdout is a protocol channel here — the MCP server speaks JSON-RPC over it and CLI output flows through System.CommandLine's console — so a direct Console write corrupts the wire and is invisible to the in-process tests. See <https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio>.
```
Nobody wrote that sentence, and nobody can let it go stale: [`SelfSpecTests.AgentsMd_IsCurrent`](https://github.com/andypgray/loadbearing/blob/main/tests/Zphil.LoadBearing.Tests/Dogfood/SelfSpecTests.cs) composes the block in process and asserts the committed file already equals it. Its sibling `ScopedCards_AreCurrent` holds the whole class the same way, every per-directory card this repository commits, and also fails on a card that no rule placement produced, so one orphaned by a spec change cannot stay behind being read. The prose an agent reads is provably the spec the build enforces. Agents that query rather than read get the same model over MCP (`loadbearing mcp`).
The block is as current as the CLI that renders it. Nothing inside it records a version, so an older `loadbearing` re-renders it to that older tool's content without warning. Keep the tool and the spec's package reference in lockstep (see [Installing](#installing)), and re-render in CI to fail on a diff, the way this repository does for its [examples](#examples).
## When an agent breaks it
Suppose an agent adds a progress printer to the CLI so a slow solution load stops looking hung, and reaches for `Console.WriteLine`. The agent finishes and tries to hand the work back. The `Stop` hook in [`hooks/`](https://github.com/andypgray/loadbearing/tree/main/hooks) runs `check` over the working tree, the rule goes red, and the wrapper exits 2, which is how a Claude Code hook refuses a stop, with the report on the agent's stderr:
```text
FAIL cli/no-stdout — The Host layer must not use `Console.Out`, `Console.Write()` or `Console.WriteLine()`.
because: Stdout is a protocol channel here — the MCP server speaks JSON-RPC over it and CLI output flows through System.CommandLine's console — so a direct Console write corrupts the wire and is invisible to the in-process tests.
citation: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio
fix: Write CLI output through the command's InvocationConfiguration console; route server diagnostics to the logger or Console.Error.
subject: 154 types, 1 generated
src/Zphil.LoadBearing.Cli/Rendering/ProgressPrinter.cs:10 — Zphil.LoadBearing.Cli.Rendering.ProgressPrinter uses System.Console.WriteLine()
src/Zphil.LoadBearing.Cli/Rendering/ProgressPrinter.cs:15 — Zphil.LoadBearing.Cli.Rendering.ProgressPrinter uses System.Console.WriteLine()
```
That stanza is one rule's worth of the board the wrapper hands back whole. It carries the five things an agent needs to act without asking a human: the rule ID, the reason, the page that reason rests on, the fix, and the exact `file:line` of every offending write. The `subject:` line is scope rather than a finding, and appears only when a generator wrote some of what the rule swept. The agent routes the output through the command's console instead, and the next stop is clean. The correction lands in the turn that made the mistake, which is the last moment it costs nobody else anything.
## In xUnit
The same spec runs inside a test project, where a team already looks. `ArchRuleTests<TSpec>` from the xUnit adapter turns each rule into an individually named test, and this repository's whole adapter dogfood is [one class declaration](https://github.com/andypgray/loadbearing/blob/main/tests/Zphil.LoadBearing.Tests/Dogfood/AdapterSelfSpecTests.cs):
```csharp
[Collection("Serial")]
public sealed class AdapterSelfSpecTests : ArchRuleTests<LoadBearingArchSpec>
{
protected override string SolutionPath => FindSolutionUp("Zphil.LoadBearing.slnx");
}
```
Each test's display name is its rule ID, so a broken rule is named in the run summary rather than buried in an assertion message, and a `Migrate` rule's grandfathered sites keep their test green while the ratchet Lo que la gente pregunta sobre loadbearing
¿Qué es andypgray/loadbearing?
+
andypgray/loadbearing es mcp servers para el ecosistema de Claude AI. Fluent C# architecture spec that enforces the rules (CLI, CI, xUnit) and generates AI-agent context (AGENTS.md, MCP) from one model. Tiene 0 estrellas en GitHub y su última actualización registrada es del 2026-09-12.
¿Cómo se instala loadbearing?
+
Puedes instalar loadbearing clonando el repositorio (https://github.com/andypgray/loadbearing) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar andypgray/loadbearing?
+
Nuestro agente de seguridad ha analizado andypgray/loadbearing y le ha asignado un Trust Score de 95/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.
¿Quién mantiene andypgray/loadbearing?
+
andypgray/loadbearing es mantenido por andypgray. La última actividad registrada en GitHub es del 2026-09-12, con 4 issues abiertos.
¿Hay alternativas a loadbearing?
+
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.
Despliega loadbearing en tu cloud
Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.
¿Mantienes este repo? Añade un badge a tu README
Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.
[](https://claudewave.com/repo/andypgray-loadbearing)<a href="https://claudewave.com/repo/andypgray-loadbearing"><img src="https://claudewave.com/api/badge/andypgray-loadbearing" alt="Featured on ClaudeWave: andypgray/loadbearing" width="320" height="64" /></a>Más MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
The fastest path to AI-powered full stack observability, even for lean teams.