<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vibhu</title>
    <description>The latest articles on DEV Community by Vibhu (@evs-cmd).</description>
    <link>https://dev.to/evs-cmd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4209305%2Fb6fcf534-29bc-4d0a-abbb-e29a687aa244.jpg</url>
      <title>DEV Community: Vibhu</title>
      <link>https://dev.to/evs-cmd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evs-cmd"/>
    <language>en</language>
    <item>
      <title>One import, three chances: keeping coding agents inside your architecture</title>
      <dc:creator>Vibhu</dc:creator>
      <pubDate>Thu, 03 Dec 2026 15:02:46 +0000</pubDate>
      <link>https://dev.to/evs-cmd/one-import-three-chances-keeping-coding-agents-inside-your-architecture-54dh</link>
      <guid>https://dev.to/evs-cmd/one-import-three-chances-keeping-coding-agents-inside-your-architecture-54dh</guid>
      <description>&lt;p&gt;It's Tuesday afternoon. A coding agent is asked to add saved cards to checkout. It finds the card vault, sees a&lt;br&gt;
function that does exactly what it needs, and writes one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;billing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vault&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;store_card&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tests pass. The feature works. And the team decided two years ago that only &lt;code&gt;payments&lt;/code&gt; may touch&lt;br&gt;
&lt;code&gt;billing.internal&lt;/code&gt;, because that's where the card data lives. The decision is in ADR-0012, and the agent never saw it.&lt;/p&gt;

&lt;p&gt;Your team probably already wrote the rule down for agents, in a &lt;code&gt;CLAUDE.md&lt;/code&gt; or an &lt;code&gt;AGENTS.md&lt;/code&gt;. That helps, but a&lt;br&gt;
prompt file has two limits. It can't hold every rule for every component of a real system, and the longer it gets, the&lt;br&gt;
less of it the agent follows. And it's read once, at the start. An hour of edits later, when the agent writes that&lt;br&gt;
import, the rule is a hundred thousand tokens behind it.&lt;/p&gt;

&lt;p&gt;An agent doesn't need a longer description of the architecture. It needs to be able to ask the architecture at the&lt;br&gt;
moment it's about to change it. There are three such moments, and this is what each one looks like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcau2k0f4fxucg3k4oj7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcau2k0f4fxucg3k4oj7.gif" alt="An animation in three steps. The agent plans an import from billing.internal; ArchBeagle answers not allowed, ARCH-DEP-3, read ADR-0012. The agent replans through payments.api. Before the edit, the hook checks it: allowed. On the pull request, the architecture check reports 0 findings." width="760" height="428"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Chance 1: the agent asks while it plans
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://archbeagle.com" rel="noopener noreferrer"&gt;ArchBeagle&lt;/a&gt; keeps a model of your architecture: the components, which may depend on which,&lt;br&gt;
and the ADR behind each rule. It serves that model to agents over MCP, so an agent can ask before it writes anything.&lt;/p&gt;

&lt;p&gt;Each agent gets its own token, made in Settings and kept in your environment, never in the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ARCH_MCP_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'arch_…'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Claude Code, a &lt;code&gt;.mcp.json&lt;/code&gt; at the root of the repository connects it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"architecture"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://app.archbeagle.com/mcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bearer ${ARCH_MCP_TOKEN}"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex takes the same server in &lt;code&gt;~/.codex/config.toml&lt;/code&gt; and Cursor in &lt;code&gt;~/.cursor/mcp.json&lt;/code&gt;; the&lt;br&gt;
&lt;a href="https://archbeagle.com/docs/agents" rel="noopener noreferrer"&gt;agents guide&lt;/a&gt; has all three. Two tools do most of the work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;architecture_context(path)&lt;/code&gt;&lt;/strong&gt;: the component that owns a file, its layer, the dependencies the model declares,
its ADRs and its open findings. The agent calls it before editing a file it hasn't touched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;check_planned_change(repo, changes)&lt;/code&gt;&lt;/strong&gt;: for each import the agent plans to add, whether the model allows it. If
not, the rule it would break (&lt;code&gt;ARCH-DEP-3&lt;/code&gt;, an undeclared dependency between components) and the ADRs to read.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our example, the agent asks about &lt;code&gt;checkout → billing.internal&lt;/code&gt;, gets "not allowed, read ADR-0012", reads it, and&lt;br&gt;
goes through &lt;code&gt;payments.api&lt;/code&gt; instead. Nothing was written, so nothing needs undoing.&lt;/p&gt;

&lt;p&gt;The answer is a guide, not a gate. And the text these tools return (ADRs, docs, notes) was written by people and&lt;br&gt;
other agents, so the agent treats it as data, never as instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chance 2: a hook checks each edit before it lands
&lt;/h2&gt;

&lt;p&gt;Agents told to ask usually do. "Usually" is why there's a second chance.&lt;/p&gt;

&lt;p&gt;A hook runs before the agent acts: a &lt;code&gt;PreToolUse&lt;/code&gt; hook in Claude Code and Codex, &lt;code&gt;preToolUse&lt;/code&gt; and its siblings in&lt;br&gt;
Cursor. It sends ArchBeagle the repository, the paths the edit writes and, for Python, the imports it adds. It never&lt;br&gt;
sends a file's contents or a prompt. It waits two seconds at most for the answer:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiws824asvg52z0hbf25x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiws824asvg52z0hbf25x.png" alt="The hook's three answers. An edit's paths and imports go to ArchBeagle, which answers allow (the edit goes ahead), warn (it goes ahead, and the agent sees the rule) or deny (it is stopped, with the rule, the reason and who may approve it once). Every answer is recorded against the agent's token." width="799" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;An allow is remembered for five minutes,&lt;/strong&gt; so a busy agent isn't slowed down. A deny never is, so an approval
works on the next try.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If ArchBeagle can't answer,&lt;/strong&gt; the edit goes ahead, marked "not checked" in the hook's log, unless you choose to
fail closed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every answer is recorded&lt;/strong&gt; against the agent's token, and a deny is kept as evidence. Afterwards you can see what
the agent tried, not only what it committed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chance 3: the pull request is checked against the model
&lt;/h2&gt;

&lt;p&gt;The last chance is the one that has to be there, because it catches everything, including an agent with no MCP and no&lt;br&gt;
hook. On every pull request, ArchBeagle compares the code with the model and reports each dependency the model doesn't&lt;br&gt;
allow, each component it doesn't know, and each breaking change to an OpenAPI, AsyncAPI, JSON Schema, Protobuf or MCP&lt;br&gt;
contract.&lt;/p&gt;

&lt;p&gt;A finding keeps its identity across runs, so you can see when a break appeared, when it was fixed and whether it came&lt;br&gt;
back. And when the agent reports its own work ("all tests pass, no architecture changes"), the report is labelled&lt;br&gt;
self-reported and shown next to what the check found:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyoxme48854tlyu0452f6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyoxme48854tlyu0452f6.png" alt="Pull request 412 side by side. The agent's report, labelled self-reported, says all tests pass and there were no architecture changes. ArchBeagle's check shows 214 tests passed from CI and a new dependency from checkout to billing.internal that the model doesn't allow." width="799" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning it on without slowing anyone down
&lt;/h2&gt;

&lt;p&gt;You don't need all three chances on day one, and nothing should block until it has earned the right to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgqd3pvuox4pd8yodi9up.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgqd3pvuox4pd8yodi9up.png" alt="Four steps in order: write the model down, turn on the pull request check, give agents a token, add the hook. Below, a rule's modes for agents: monitor, then warn, then block, moved one rule at a time once its warnings have been right." width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Write the model down.&lt;/strong&gt; If you have one in LikeC4, Structurizr, C4-PlantUML or Backstage, ArchBeagle reads it.
If not, it drafts one from the code, and a person approves it before it counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn on the pull request check.&lt;/strong&gt; On the free plan it reports and never blocks, so it's safe on every repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give each agent a token and the MCP config.&lt;/strong&gt; A few lines per agent, and it's where most breaks stop happening.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add the hook last.&lt;/strong&gt; Every rule starts in &lt;code&gt;monitor&lt;/code&gt; or &lt;code&gt;warn&lt;/code&gt; for agents. Move a rule to &lt;code&gt;block&lt;/code&gt; only once its
warnings have been right for a while. (Blocking beyond CI is a Pro feature.)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep your &lt;code&gt;AGENTS.md&lt;/code&gt;. It's still the best place for how your team works. Just stop asking it to be the architecture.&lt;/p&gt;

&lt;p&gt;ArchBeagle is in early access. &lt;a href="https://archbeagle.com/invite" rel="noopener noreferrer"&gt;Request an invite&lt;/a&gt;, or start with the &lt;a href="https://archbeagle.com/docs/agents" rel="noopener noreferrer"&gt;agents guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The components, ADR and pull request in the pictures are sample data.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>mcp</category>
      <category>codereview</category>
    </item>
    <item>
      <title>Agents write the code. Who checks the architecture?</title>
      <dc:creator>Vibhu</dc:creator>
      <pubDate>Wed, 25 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/evs-cmd/agents-write-the-code-who-checks-the-architecture-di7</link>
      <guid>https://dev.to/evs-cmd/agents-write-the-code-who-checks-the-architecture-di7</guid>
      <description>&lt;p&gt;Coding agents have made writing code cheap. Claude Code, Codex and Cursor open pull requests faster than a team can read them. The diffs got bigger and the reviewers got busier. The hard part is no longer writing the change. It’s knowing whether the change fits the system it lands in.&lt;/p&gt;

&lt;p&gt;Tests don’t answer that question. Here’s a pull request an agent might open on a Tuesday afternoon:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxlyfwk5o4zwapmg175js.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxlyfwk5o4zwapmg175js.png" alt="A pull request from claude-code: the tests pass, but the architecture check reports that checkout now depends on billing.internal, which the approved model doesn’t allow (ADR-0012)." width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every test passes. The feature works. And &lt;code&gt;checkout&lt;/code&gt; now imports straight from &lt;code&gt;billing.internal&lt;/code&gt;, which the team decided two years ago only &lt;code&gt;payments&lt;/code&gt; may do. Nothing in the test suite knows that. The decision lives in an ADR, an old diagram and the memory of whoever wrote them. If that person isn’t reviewing this pull request, it merges.&lt;/p&gt;

&lt;p&gt;Do that a few hundred times a month and the architecture drifts, one reasonable-looking change at a time, each one unchecked against the decisions already made.&lt;/p&gt;

&lt;p&gt;We built ArchBeagle to make those decisions checkable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture, as something a machine can check
&lt;/h2&gt;

&lt;p&gt;ArchBeagle starts from a model of your architecture, kept in Git next to the code: the components, which component may depend on which, and the ADRs behind each rule. If you already have one in LikeC4, Structurizr, C4-PlantUML or Backstage, it reads that. If you don’t, it drafts one from the code, and a person reviews and approves it before it counts.&lt;/p&gt;

&lt;p&gt;With a model in place, ArchBeagle checks every pull request against it and reports on the pull request where the code and the model disagree:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dependencies&lt;/strong&gt; the model doesn’t allow, with the rule and the ADR that explain why.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contract changes&lt;/strong&gt; in OpenAPI, AsyncAPI, JSON Schema, Protobuf and MCP tool lists, so a breaking change to another team’s API is visible before it ships.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;History:&lt;/strong&gt; a finding keeps its identity across runs, so you can see when it opened, when it was fixed and whether it came back.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also indexes each repository (modules, symbols, calls, complexity and which tests touch what) for Python, TypeScript, JavaScript, Go, Java, PHP and Ruby, so a reviewer can see what a change reaches before approving it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents can ask first
&lt;/h2&gt;

&lt;p&gt;A check on the pull request catches the problem after the code is written. It’s cheaper to catch it before.&lt;/p&gt;

&lt;p&gt;ArchBeagle runs an MCP server, so a coding agent can ask the architecture questions while it plans. Each agent gets its own token. Before editing a file, it can ask which component owns it and which ADRs apply. Before adding an import, it can ask whether the model allows it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3yju5rhsemcwise9wp91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3yju5rhsemcwise9wp91.png" alt="A sequence: the agent calls architecture_context for checkout/cards.py, then check_planned_change for checkout to billing.internal, which comes back not allowed under ARCH-DEP-3. The agent changes its plan to use the payments API, opens the pull request, and the architecture check reports 0 findings." width="800" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The answer is a guide, not a gate. The pull request’s own check stays the authority, so an agent that skips the question still gets caught. But an agent that asks first usually doesn’t need to be caught at all. Claude Code, Codex and Cursor each take a few lines of configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  A self-report isn’t evidence
&lt;/h2&gt;

&lt;p&gt;Agents are good at describing their own work, and the description is usually right. “Usually” is the problem. When an agent reports what it did, ArchBeagle keeps the report and labels it self-reported. Next to it, for the same pull request, it shows what the check found:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyoxme48854tlyu0452f6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyoxme48854tlyu0452f6.png" alt="Pull request 412 side by side. The agent’s session report, labelled self-reported, says it added saved cards, that all tests pass and that there were no architecture changes. ArchBeagle’s check shows 214 tests passed from CI, a non-breaking contract addition, and a new dependency from checkout to billing.internal that the model doesn’t allow." width="799" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The two are never mixed. A reviewer sees the agent’s account and the independent result side by side, and the mismatch is the interesting part.&lt;/p&gt;

&lt;h2&gt;
  
  
  What ArchBeagle never does
&lt;/h2&gt;

&lt;p&gt;It never stores your source code. The database holds facts about the code: paths, names, line ranges, metrics, check results, and the text of your ADRs and docs. Code is read only inside a sandboxed job, with no network while it parses, and it isn’t kept.&lt;/p&gt;

&lt;p&gt;It doesn’t decide your architecture for you either. On the free plan the pull request check reports and never blocks a merge, and a model ArchBeagle drafts counts only after a person approves it.&lt;/p&gt;

&lt;p&gt;And it isn’t a code reviewer. A code reviewer reads the diff. ArchBeagle reads the diff against the system. Teams use both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;ArchBeagle is in early access, and during the launch every account gets every feature, free. It connects to your GitHub organisation through a GitHub App.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://archbeagle.com/invite" rel="noopener noreferrer"&gt;Request an invite&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://archbeagle.com/docs" rel="noopener noreferrer"&gt;Read the docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Follow along on &lt;a href="https://x.com/archbeagle" rel="noopener noreferrer"&gt;X&lt;/a&gt; and &lt;a href="https://www.linkedin.com/company/archbeagle" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’d like to hear how your team keeps its architecture in check now that agents write so much of the code. Reply here or write to &lt;a href="mailto:support@archbeagle.com"&gt;support@archbeagle.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The pull request, components and ADR in the pictures are sample data.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>codereview</category>
      <category>devops</category>
    </item>
    <item>
      <title>A governed fine-tune for $0.86: Qwen3-4B on IFC/BIM, with a person approving every step</title>
      <dc:creator>Vibhu</dc:creator>
      <pubDate>Mon, 26 Oct 2026 22:39:40 +0000</pubDate>
      <link>https://dev.to/cairndev/a-governed-fine-tune-for-086-qwen3-4b-on-ifcbim-with-a-person-approving-every-step-2709</link>
      <guid>https://dev.to/cairndev/a-governed-fine-tune-for-086-qwen3-4b-on-ifcbim-with-a-person-approving-every-step-2709</guid>
      <description>&lt;p&gt;Fine-tuning a model is easy to start. Running it responsibly in a team is the hard part. Usually it's a script on a GPU box: nobody approves the spend, nobody records which data went in, and "is it better than the base model?" is a guess.&lt;/p&gt;

&lt;p&gt;We ran a real fine-tune end to end with &lt;a href="https://github.com/cairndev-sh/cairn" rel="noopener noreferrer"&gt;cairn&lt;/a&gt;, the open-source control plane we're building for exactly this, using only public packages from PyPI. Here is what happened, with the real numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The run in numbers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Model&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://huggingface.co/Qwen/Qwen3-4B-Base" rel="noopener noreferrer"&gt;Qwen3-4B-Base&lt;/a&gt;, 4-bit QLoRA (r 16)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data&lt;/td&gt;
&lt;td&gt;5,646 training rows of IFC/BIM instructions (from 42,680)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware&lt;/td&gt;
&lt;td&gt;one NVIDIA T4 (AWS g4dn.xlarge)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Training&lt;/td&gt;
&lt;td&gt;353 steps, 73 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$0.86 settled&lt;/strong&gt;, against a &lt;strong&gt;$16.50&lt;/strong&gt; worst-case estimate approved up front&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Test loss&lt;/strong&gt; (348 held-out rows)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;1.955 → 0.218&lt;/strong&gt; (89% lower)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;General ability&lt;/td&gt;
&lt;td&gt;no measurable change on ARC, HellaSwag, WinoGrande, PIQA or MMLU&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The adapter, the dataset, the training curve and the raw eval results are public: &lt;a href="https://huggingface.co/cairndev/qwen3-4b-ifc-bim-qlora" rel="noopener noreferrer"&gt;&lt;code&gt;cairndev/qwen3-4b-ifc-bim-qlora&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://huggingface.co/datasets/cairndev/ifc-bim-alpaca-dedup" rel="noopener noreferrer"&gt;&lt;code&gt;cairndev/ifc-bim-alpaca-dedup&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two machines, one rule
&lt;/h2&gt;

&lt;p&gt;A small control box runs the cairn engine. It holds the run record, the approval gates and the budget, and it starts and stops the GPU box. The GPU box runs only the trainer. Nothing listens on it: the engine reaches it over SSH. Datasets, checkpoints and the adapter move between the two through S3.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A person approves the data, and the data gets checked
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;dataset-prep/prepare&lt;/code&gt; paused before reading anything, and showed the source, its pinned Hub commit and the split plan. Only after approval did it download, check and split the data.&lt;/p&gt;

&lt;p&gt;The checks found something worth knowing. &lt;strong&gt;85% of the source rows were near-duplicates&lt;/strong&gt; of each other: the dataset is template-generated, so the same IFC statement appears with only the numbers changed. Near-duplicate removal (MinHash, 0.8) kept 6,295 rows. The split is by template family, so variants of one template never sit on both sides of train and test, and the split's leakage check passed.&lt;/p&gt;

&lt;p&gt;That number changed how we read every result after it. Without the check, we'd have trained on 42,680 rows and believed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The launch refuses before it spends
&lt;/h2&gt;

&lt;p&gt;At launch, before any record existed, cairn checked:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data roles:&lt;/strong&gt; each dataset version's role, so a test set can't be passed as training data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Holdout:&lt;/strong&gt; the training rows don't overlap the validation or test rows, exactly or near.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The GPU estimate:&lt;/strong&gt; priced from the box's hourly rate × each leg's timeout × its retries, $16.50 worst case, which fit the $25 budget.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then it stopped at &lt;strong&gt;&lt;code&gt;approve-run&lt;/code&gt;&lt;/strong&gt;, with that estimate and the training settings on the card. The GPU box was only started after the approval.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The box starts, trains, and stops itself
&lt;/h2&gt;

&lt;p&gt;After approval:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;compute/acquire&lt;/code&gt; tagged the instance with a lease, then started it.&lt;/li&gt;
&lt;li&gt;A 5-step smoke run proved the whole path on the box: data from S3, the tokenizer, 4-bit loading, a checkpoint back to S3.&lt;/li&gt;
&lt;li&gt;The real training ran 353 steps. Every 50 steps a checkpoint was mirrored to S3, so a killed process resumes instead of restarting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;compute/release&lt;/code&gt; stopped the box right after training&lt;/strong&gt;, before anyone looked at the results, so it didn't bill while we decided.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each step settled its actual box time: smoke $0.05, train $0.81. The estimate is the ceiling you approve; the record keeps what you paid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxjtois3b6rkghgb00yzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxjtois3b6rkghgb00yzn.png" alt="Train and eval loss over 353 steps on a Tesla T4: eval loss falls from 0.83 to 0.55 and flattens" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Better than the base model, on data it never saw?
&lt;/h2&gt;

&lt;p&gt;The pipeline's &lt;code&gt;improved&lt;/code&gt; gate compares the candidate with the base model on held-out data, and it passed. We then measured both models on the &lt;strong&gt;348-row test split&lt;/strong&gt;, which never reached the trainer: loss fell from &lt;strong&gt;1.955 to 0.218&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A lower loss on your own domain doesn't tell you whether the model got worse at everything else. So we ran a forgetting check with lm-evaluation-harness, with identical settings for both models:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Base&lt;/th&gt;
&lt;th&gt;Fine-tuned&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Easy&lt;/td&gt;
&lt;td&gt;0.767&lt;/td&gt;
&lt;td&gt;0.760&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Challenge&lt;/td&gt;
&lt;td&gt;0.527&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HellaSwag&lt;/td&gt;
&lt;td&gt;0.647&lt;/td&gt;
&lt;td&gt;0.653&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WinoGrande&lt;/td&gt;
&lt;td&gt;0.740&lt;/td&gt;
&lt;td&gt;0.707&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PIQA&lt;/td&gt;
&lt;td&gt;0.800&lt;/td&gt;
&lt;td&gt;0.787&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MMLU&lt;/td&gt;
&lt;td&gt;0.768&lt;/td&gt;
&lt;td&gt;0.797&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No change is larger than the noise at these sample sizes (about ±3–4 points). So: &lt;strong&gt;no measurable loss of general ability&lt;/strong&gt;, which is not the same as none. The samples were small, and we say so on the model card.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A person promotes
&lt;/h2&gt;

&lt;p&gt;The run then paused at &lt;code&gt;promote-model&lt;/code&gt;, with the losses on the card. Promotion is a decision, not a side effect. Moving the tag needed its own approval too.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it took
&lt;/h2&gt;

&lt;p&gt;Every step was a &lt;code&gt;cairn&lt;/code&gt; CLI command against the engine: install, connect the GPU box, prepare the data, launch, approve, read the findings, promote. The full list, in order, is in the new guide: &lt;strong&gt;&lt;a href="https://docs.cairndev.sh/guides/fine-tune-a-model/" rel="noopener noreferrer"&gt;Fine-tune a model on a GPU box&lt;/a&gt;&lt;/strong&gt;. Swap in your own dataset (Alpaca, prompt/completion or chat) and base model; the pipeline is the same.&lt;/p&gt;

&lt;p&gt;cairn is Apache-2.0 and self-hosted. If you fine-tune models in a team, try the guide on your own data, and tell us where it breaks: &lt;a href="https://github.com/cairndev-sh/cairn" rel="noopener noreferrer"&gt;github.com/cairndev-sh/cairn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://cairndev.sh/blog/governed-fine-tune-for-86-cents.html" rel="noopener noreferrer"&gt;cairn blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
