{"slug":"living-architecture","title":"living-architecture","summary":"Reference for the living-architecture layer (LikeC4 structure model + arc42 principles + model-truth import enforcement + cross-check): its syntax, the checks, the rules a coding agent follows when it changes code under it, and how to maintain it. Building the first model is la:a","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:43:59.613684Z","repo":{"url":"https://github.com/MotleyAI/living-architecture","stars":16,"forks":2,"license":"MIT","updatedAt":"2026-11-27T11:19:06Z"},"bodyHtml":"<hr>\n<h2>name: living-architecture\ndescription: 'Reference for the living-architecture layer (LikeC4 structure model + arc42 principles + model-truth import enforcement + cross-check): its syntax, the checks, the rules a coding agent follows when it changes code under it, and how to maintain it. Building the first model is la:arch-init; carving a boundary is la:arch-cleanup.'</h2>\n<p><strong>Preflight:</strong> run <code>la-doctor --plugin &lt;this skill's base directory&gt;</code> once per session before using any <code>la-*</code> or <code>trmv-*</code> command; if it fails, stop and show the user its output. If <code>la-doctor</code> is not found, or reports the la tools older than the plugin, stop and give the user the install command at this plugin's <code>version</code> (in its <code>.claude-plugin/plugin.json</code>): <code>uv tool install living-architecture==&lt;version&gt; --with-executables-from type-rename-move</code> in a Python repo, <code>npm install -g living-architecture@&lt;version&gt; type-rename-move@&lt;version&gt;</code> in a TS/JS repo.</p>\n<h1>Living architecture</h1>\n<p>Four layers, one element id everywhere. Behaviour lives in OpenSpec (in repos that use it); everything\ncross-cutting lives here:</p>\n<table>\n<thead>\n<tr>\n<th>Layer</th>\n<th>Question</th>\n<th>Artifact</th>\n<th>Property</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Behaviour</td>\n<td>what does it do, now?</td>\n<td><code>openspec/specs/&lt;id&gt;/spec.md</code></td>\n<td>living, merged by OpenSpec</td>\n</tr>\n<tr>\n<td>Structure</td>\n<td>how is it arranged, now?</td>\n<td>LikeC4 model + views</td>\n<td>living; ONE model, diagrams are projected views</td>\n</tr>\n<tr>\n<td>Rationale</td>\n<td>why is it this way, and what must all code here obey?</td>\n<td>arc42 file per element that earns prose</td>\n<td>living, edited in place</td>\n</tr>\n<tr>\n<td>Enforcement</td>\n<td>is the code actually like this?</td>\n<td><code>arch_check</code> model-truth (the one import law) + LikeC4 model validation, run before a change is done and in CI</td>\n<td>executable, blocking</td>\n</tr>\n</tbody>\n</table>\n<p><strong>History is NOT a layer here.</strong> Git history, plus the OpenSpec archive (per-change\ndesign + deltas, dated, immutable) in repos that use it, IS the decision trail. Never create\nADR files or append-only decision logs (they are merge hell). \"Why it is like\nthis now\" belongs in the element's arc42, present tense; \"how we got here\" is\nhistory.</p>\n<h2>Alignment rules</h2>\n<ul>\n<li><strong>arc42 = LikeC4 = module structure align perfectly.</strong> An element's fully qualified id is its LikeC4 id\nand names its arc42 file, <code>architecture/&lt;id&gt;.arc42.md</code>; a precise element's package is its node's <code>package</code> plus\nits path below the node.</li>\n<li><strong>OpenSpec is looser.</strong> A spec either belongs to one element at any depth (listed in that element's\nmetadata <code>specs</code> — the element is then a behaviour <em>leaf</em>) or is <strong>cross-cutting</strong> (listed once in <code>index.yaml</code>\nwith the fully qualified elements it touches, at any depth). Never duplicate a spec across elements; <code>arch_check</code>\nenforces exactly-once.</li>\n<li><strong>Model depth is a dial, not an obligation.</strong> Model precisely where you are\nactively enforcing boundaries; sweep the rest into a few <em>virtual bucket\nnodes</em> (tagged <code>#virtual</code>, claiming several packages, no alignment claim,\ngoverned only at bucket granularity — no nested elements, no child-level arrows).\nDeepen a bucket into precise nodes the first time real\nwork touches it. Never model deeper than you're willing to keep true.</li>\n</ul>\n<h2>File layout — the tree is virtual</h2>\n<p>Each tool keeps its native layout; shared node ids join them. The LikeC4 model\nmaps nodes to code; <code>index.yaml</code> holds only repo-wide settings.</p>\n<pre><code>repo/\n  openspec/specs/&lt;spec-id&gt;/spec.md\n  architecture/\n    model.c4                         # the ONE LikeC4 model: one specification and one model block\n    views.c4                         # one views block; each view scoped to one language root\n    index.yaml                       # repo-wide settings (below)\n    system.arc42.md                  # root narrative + global principles\n    &lt;element id&gt;.arc42.md            # e.g. python.sql.arc42.md; only where an element earns prose\n  living-architecture.yaml           # repo config: format, and architecture: true once the model exists\n</code></pre>\n<p>Every arc42 file sits directly in <code>architecture/</code>, never in a subfolder.</p>\n<p>These are the only LikeC4 files allowed anywhere under <code>architecture/</code> (<code>.c4</code> or\n<code>.likec4</code>). Nothing else may sit at their top level. Any other layout makes\n<code>la-arch-check</code> exit 2 and <code>la-arch-diagrams</code> exit 1, with one message naming\nevery violation. The repo's format is <code>format</code> in <code>living-architecture.yaml</code>:\nthe <code>la</code> version that introduced it. Every command refuses any other format,\nnaming the <code>la</code> to upgrade to for a newer one and <code>la-arch-migrate</code> for an older\nor missing one; <code>la-arch-migrate</code> converts the repo (verified, all-or-nothing)\nand stamps the current format.</p>\n<p>The checker is <code>la-arch-check</code> (the one import law + cross-check, run by the\ngates); it needs no per-repo code. <code>la-arch-diagrams</code> regenerates the embedded\nview diagrams.</p>\n<p>The model has one top-level <strong>root element per language</strong> <code>index.yaml</code> declares,\nwhose id is the language (<code>python</code>, <code>typescript</code>); it carries no mapping metadata. A node\nis a direct child of a root; it is virtual iff its element kind is declared\n<code>#virtual</code>. Relations are written inside a root with names relative to it\n(<code>sql -&gt; core</code> inside <code>python { }</code> is <code>python.sql -&gt; python.core</code>), so a relation\nacross roots cannot be written. Element ids are fully qualified in findings and\nin <code>touches:</code>. Any element — root, node or nested — MAY list the <code>specs</code> it owns in one <code>metadata { }</code>\nblock; a node also declares its mapping there:</p>\n<pre><code>specification {\n  element node\n  element bucket {\n    #virtual\n  }\n  tag legacy\n  tag virtual\n}\nmodel {\n  python = system 'My package' {             // the python root (any element kind)\n    sql = node 'SQL' {                       // precise node python.sql\n      metadata {\n        package 'mypkg.sql'                  // required\n        claims ['mypkg.sqlutil']             // optional: further units it owns\n        specs ['sql-dialects']               // specs owned by THIS node alone\n      }\n      // arc42 doc, if any: architecture/python.sql.arc42.md\n      render = node 'Render' { metadata { specs ['sql-render'] } }  // maps to mypkg.sql.render; nested elements may own specs\n      dialects = node 'Dialects'             // maps to mypkg.sql.dialects\n    }\n    surfaces = bucket 'Surfaces' {           // virtual bucket\n      metadata {\n        packages ['mypkg.api', 'mypkg.mcp', 'mypkg.cli']\n      }\n    }\n    surfaces -&gt; sql\n  }\n}\n</code></pre>\n<p>TypeScript units are extensionless paths relative to the section's\n<code>source_root</code> (<code>package 'src/daemon'</code>, nested <code>pty</code> maps to <code>src/daemon/pty</code>); a\nunit is a directory with a visible source file or exactly one module file, and a\nunit naming both is ambiguous. Test files, declaration files\n(<code>la-config get lang.typescript.declaration_globs</code>) and installed dependencies are\ninvisible; type-only imports never count.</p>\n<p>Keys and types come from the shared node schema; values are <code>key 'value'</code> or\n<code>key ['a', 'b']</code> — single quotes, no escapes, arrays may span lines, no trailing\ncomma. Nested elements, at any depth, carry no mapping keys: <code>&lt;node&gt;.a.b</code> maps to <code>&lt;package&gt;.a.b</code>, and the\nimport law applies wherever the model nests. Malformed metadata is a setup error (exit 2) naming the element; a\nmodel still using the retired <code>arc42</code> key converts with <code>la-arch-migrate</code>.</p>\n<p><code>index.yaml</code>:</p>\n<pre><code>python:                               # one section per language; at least one\n  root_package: mypkg                 # required, or root_packages: the unit of the python root\n  source_root: src                    # optional: directory containing the roots\ntypescript:\n  root_package: src\n  source_root: web                    # optional\n  tsconfig: web/tsconfig.app.json     # optional: default each root's nearest tsconfig\n\nlegacy_arrows: {baseline: 8}          # exact count of #legacy arrows in the model (ratchet)\n\ncross_cutting_specs:\n  queries: {touches: [python.core, python.engine, python.sql]}\n\nx-anything: {}                        # repo-owned keys start with x-; the tools ignore them\n</code></pre>\n<p><code>root_packages: [app, packages/ui]</code> replaces <code>root_package</code> when a language's code sits in several sibling\ndirectories under one <code>source_root</code>; the roots are disjoint and unit ids stay relative to <code>source_root</code>.</p>\n<p><code>views.c4</code> scopes each view to a root, <code>view &lt;id&gt; of &lt;root&gt; { ... }</code>, with include names and predicate\nanchors relative to the root at any depth (<code>include api.handlers</code>, <code>api.handlers -&gt; *</code>); the root itself is never\ndrawn.</p>\n<h2>arc42 element file — required shape</h2>\n<p>arc42-lite, per element, always present tense, updated in place:</p>\n<ol>\n<li><strong>Purpose &amp; context</strong> — 3–10 lines.</li>\n<li><strong>Building blocks</strong> — pointer to the node's LikeC4 view. Never a duplicate\ndrawing, never a prose restatement of the model.</li>\n<li><strong>Principles</strong> — numbered rules that ALL code in this element and its descendants, old and new,\nMUST obey. Each tagged <code>[enforced: &lt;check|test id&gt;]</code> or\n<code>[review]</code>. Prefer enforced; every <code>[review]</code> principle is a standing\ncandidate for a new fitness function. Keep them normative and minimal: when\nwork strains a principle, first make the code comply; edit one only when it\ngenuinely forbids something needed, in the smallest general wording — never\ndescriptive text or implementation detail (function names, mechanisms).</li>\n<li><strong>Rationale</strong> — why the current shape is right. Where it derives from a\nspecific change, link the archived openspec change id — do not restate\nhistory.</li>\n</ol>\n<h2>Enforcement wiring — the one import law</h2>\n<p>There is no separate import-linter config: the entire import law lives in the\nLikeC4 model and is checked by <code>la-arch-check</code> (<strong>model-truth</strong>). The\nmodel's relations must exactly match the AST-measured runtime import edges, at\nevery granularity the model declares:</p>\n<ul>\n<li>a module attributes to its finest mapped element, else its node;</li>\n<li>every edge is licensed by its most-specific covering arrow — a declared\narrow is the only thing that permits an import, and silence is a ban;</li>\n<li>a measured edge with no covering arrow, a declared arrow with no measured\nedge, and an undeclared edge between two nested elements are all findings.</li>\n</ul>\n<p>Type-only imports are excluded. Grandfathered crossings are dashed\n<code>#legacy</code> arrows in the model itself (one arrow per real edge, no wildcards);\n\"layer direction\" is just <em>no upward arrow declared</em>, and a child boundary is\njust <em>no arrow declared between those nested elements</em> — so one law subsumes what used\nto be separate <code>layers</code> / <code>forbidden</code> / boundary contracts.</p>\n<p>Python edges come from <code>ast</code>, TypeScript edges from the TypeScript compiler\nunder the repo's tsconfig. Either twin checks a mixed repo: each language's facts\ncome from its own twin (PyPI or npm, found on PATH or run through <code>uvx</code>/<code>npx</code>), and\nmodel-truth runs once over all of them.</p>\n<p><strong>The enforcement bundle</strong> = <code>la-arch-check</code> + LikeC4 model validation\n(<code>npx likec4 validate</code>; if the installed CLI version lacks it, use the lightest\ncommand that parses the model, e.g. <code>npx likec4 build</code>) + <code>trmv-typecheck</code> against\nits committed baseline. It is blocking: run it before declaring any change done,\nand in CI. <code>arch_check</code> is cheap and deterministic, so wire it there once the setup\nhas settled (not at init), pinned to a release, in the form of the repo's\necosystem: <code>uvx --no-build --from living-architecture==&lt;version&gt; la-arch-check</code>\n(after <code>astral-sh/setup-uv</code>, pinned by commit SHA) or\n<code>npx -y -p living-architecture@&lt;version&gt; la-arch-check</code> (after\n<code>actions/setup-node</code>, pinned by commit SHA).</p>\n<p><strong>Ratchet rules (hard):</strong></p>\n<ul>\n<li><code>#legacy</code> arrows may only ever be REMOVED, never added. Wanting to add one\nmeans the architecture is changing — change the model and arc42 deliberately\ninstead, with the user's explicit OK.</li>\n<li><code>legacy_arrows.baseline</code> in <code>index.yaml</code> is the exact <code>#legacy</code> count;\n<code>arch_check</code> fails if the model's count differs, and the baseline is lowered\nas arrows are retired. Progress is monotonic and machine-checked.</li>\n</ul>\n<p><strong><code>la-arch-check</code> verifies, from the model and <code>index.yaml</code>:</strong></p>\n<ul>\n<li><code>architecture/</code> holds exactly <code>model.c4</code> and <code>views.c4</code>, each with only its blocks (else exit 2);</li>\n<li>every element's metadata matches the shared schema (else exit 2);</li>\n<li>every precise node's <code>package</code> and <code>claims</code> (and every bucket's <code>packages</code>)\nexist on disk; every nested element's unit exists under its node's package\nand does not collide with another declared unit; a bucket contains no\nelements; every arc42 file sits directly in <code>architecture/</code> and is <code>system.arc42.md</code>,\n<code>&lt;element id&gt;.arc42.md</code> of a model element, or listed in <code>cross_cutting_arc42</code>;</li>\n<li>every top-level unit of each language's roots is claimed by exactly\none node — no orphan packages;</li>\n<li>every spec group (a directory under <code>openspec/specs/</code> or under a non-archived\nchange's <code>specs/</code>) is mapped exactly once: in exactly one element's <code>specs</code>\nor in <code>cross_cutting_specs:</code>; every element named in a <code>touches:</code> list exists;</li>\n<li>model-truth holds at every declared granularity, the <code>#legacy</code> count equals\n<code>legacy_arrows.baseline</code>, and each mapped doc's embedded view diagram is\nbyte-fresh;</li>\n<li>every principle item in an arc42 file carries a status tag —\n<code>[enforced: arch_check:&lt;check-id&gt;]</code>, <code>[enforced: test:&lt;path&gt;]</code>, <code>[review]</code>,\nor <code>[target: &lt;issue key&gt;]</code> (a future-state clause; keys must match the\nrepo's <code>issue_key_pattern</code>); an item may add one <code>[lang: &lt;language&gt;]</code> naming\na declared language it alone binds.</li>\n</ul>\n<h2>Maintenance</h2>\n<ul>\n<li>No model yet (<code>architecture/index.yaml</code> absent) → run the <strong>la:arch-init</strong>\nskill; it builds the first model from a measured scaffold.</li>\n<li>Otherwise keep the model, <code>index.yaml</code>, and arc42 in sync IN THE SAME PR as\nany structural change; deepen buckets / add views for new subsystems; tighten\nboundaries via the <strong>la:arch-cleanup</strong> skill.</li>\n</ul>\n<h2>Working under the architecture</h2>\n<p>These rules bind a coding agent at every step of any change in a repo whose\n<code>living-architecture.yaml</code> sets <code>architecture: true</code>: planning, writing tests, implementing,\nand fixing review findings. <code>architecture/*.arc42.md</code>, <code>architecture/model.c4</code>\nand <code>architecture/views.c4</code> are normative harnesses, exactly like tests.</p>\n<ul>\n<li><strong>Read them first.</strong> Before the work, read <code>architecture/index.yaml</code>, the\narc42 file of each element the change touches and of each of its ancestors\n(<code>architecture/&lt;element id&gt;.arc42.md</code>, where present), <code>system.arc42.md</code>\n(cross-cutting principles), and the LikeC4 view of every touched element.</li>\n<li><strong>Obey them.</strong> Every plan, test, implementation and fix obeys the element\nprinciples and the model's import law, or explicitly includes the model +\narc42 update as part of the change. A plan states which principles apply.</li>\n<li><strong>Flag, never deviate.</strong> If anything in an arc42 file seems wrong,\ncontradictory, or makes the task impossible or substantially harder, flag it\nto the user explicitly and wait for their call. Never silently deviate from,\nreinterpret, or ignore a principle, and never produce work that quietly\nconflicts with one.</li>\n<li><strong>Keep them normative and minimal.</strong> When work strains a principle, first make\nthe code comply; propose an edit only when the principle genuinely forbids\nsomething needed, in the smallest general wording. Never use descriptive text\nor implementation detail (function names, mechanisms).</li>\n<li><strong>Never edit without per-change approval.</strong> Never create, modify, or delete a\nharness without the user's explicit approval of that specific edit: present\nthe exact edit and wait for the OK. An approved plan that mentions the edit\ndoes not count.</li>\n<li><strong>Finish green.</strong> Before declaring the change done, run the enforcement bundle\nand fix until it passes.</li>\n<li><strong>New capability</strong> (OpenSpec repos): decide with the user where its spec\nattaches (one element's metadata <code>specs</code>, at any depth, or\n<code>cross_cutting_specs</code> in <code>index.yaml</code> with a <code>touches:</code> list) and record it in\nthe same change.</li>\n<li><strong>Pure structural refactors</strong> (moving code across boundaries) are their own\nchanges via <strong>la:arch-cleanup</strong>, never smuggled into feature changes.</li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":15937,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:45:55.252497Z","sha256":"EC48831FEC3176C1802C0619532A164600F8D20741DCF7638DBBE5E46B7AD59B","sizeBytes":6640},"review":null,"source":{"repositoryUrl":"https://github.com/MotleyAI/living-architecture","path":"plugin/la/skills/living-architecture","license":"MIT","commit":"c1ecf0af05da41d754e0a83233334edf6cbca797","subtreeSha":"41104E58EC5E17ADF32CCB41CD61FF0E64DD105346E38041116807AD0D4D88C1","lastSyncedAt":"2026-11-29T00:43:57.908191Z"},"reviewedAt":"2026-11-29T00:52:36.110947Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/MotleyAI/living-architecture/tree/main/plugin/la/skills/living-architecture"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install motleyai-living-architecture@llmmart"},{"target":"git","command":"git clone https://github.com/MotleyAI/living-architecture.git"}]}