<?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: Sam Nodehi</title>
    <description>The latest articles on DEV Community by Sam Nodehi (@samnodehi).</description>
    <link>https://dev.to/samnodehi</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%2F3993092%2F7a8d9fbb-c3cf-436b-b3f8-69e0e82a707e.png</url>
      <title>DEV Community: Sam Nodehi</title>
      <link>https://dev.to/samnodehi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samnodehi"/>
    <language>en</language>
    <item>
      <title>ZAM: deterministic context governance for AI agents</title>
      <dc:creator>Sam Nodehi</dc:creator>
      <pubDate>Fri, 19 Jun 2026 19:05:53 +0000</pubDate>
      <link>https://dev.to/samnodehi/zam-deterministic-context-governance-for-ai-agents-g2h</link>
      <guid>https://dev.to/samnodehi/zam-deterministic-context-governance-for-ai-agents-g2h</guid>
      <description>&lt;p&gt;============================================================&lt;/p&gt;

&lt;h1&gt;
  
  
   dev.to post — copy each part into the matching field
&lt;/h1&gt;

&lt;p&gt;--- TITLE (paste into the "Title" field) ---&lt;/p&gt;

&lt;p&gt;ZAM: deterministic context governance for AI agents&lt;/p&gt;

&lt;p&gt;--- TAGS (paste into the "Tags" field) ---&lt;/p&gt;

&lt;p&gt;ai, llm, opensource, typescript&lt;/p&gt;

&lt;p&gt;============================================================&lt;/p&gt;

&lt;h1&gt;
  
  
   BODY — copy EVERYTHING below this line into the post body
&lt;/h1&gt;

&lt;p&gt;Most AI agents shove &lt;strong&gt;everything&lt;/strong&gt; into the prompt every turn — every skill, every tool definition, every memory lane — no matter what the user actually asked. That bloats the prompt (cost + latency), buries the relevant context, and quietly degrades answers. Trimming by hand is risky: drop the wrong thing and you silently break safety or correctness.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;ZAM&lt;/strong&gt; — an open-source &lt;em&gt;context governance layer&lt;/em&gt; — to make that decision deterministically.&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%2Fr9tiybcvavyq2dcbwr3a.gif" 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%2Fr9tiybcvavyq2dcbwr3a.gif" alt="ZAM deciding what context each request needs" width="800" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;ZAM runs &lt;strong&gt;before&lt;/strong&gt; the prompt is assembled. Given the request and an inventory of available components (scaffolds, skills, tools, memory, history), a deterministic pipeline — request router -&amp;gt; 12-step selector ladder -&amp;gt; conflict resolver -&amp;gt; budgeter — decides which to &lt;strong&gt;include / omit / defer&lt;/strong&gt;, and emits a structured &lt;em&gt;plan&lt;/em&gt; plus a full decision &lt;strong&gt;trace&lt;/strong&gt;. It never assembles prompt text itself: &lt;strong&gt;the model proposes, deterministic guardrails enforce.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The spine is &lt;strong&gt;fail-open on uncertainty&lt;/strong&gt;: it only makes the context smaller when that's &lt;em&gt;safe&lt;/em&gt;; when in doubt, it includes more. It's reproducible (no model call needed to plan), schema-validated, and fully auditable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evidence, not assertion
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run benchmark   &lt;span class="c"&gt;# offline, deterministic, no API key&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;63.9% mean token savings, 0 unsafe omissions&lt;/strong&gt; vs. the inject-everything baseline.&lt;/li&gt;
&lt;li&gt;A live tier shows the cheap deterministic router agrees with a &lt;em&gt;model's&lt;/em&gt; classification &lt;strong&gt;85.7%&lt;/strong&gt; of the time — and both disagreements were on the safe side.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Portable: one core, three surfaces
&lt;/h2&gt;

&lt;p&gt;The same core governs three very different surfaces with &lt;strong&gt;zero core changes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an &lt;strong&gt;agent workspace&lt;/strong&gt; (Markdown files),&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP&lt;/strong&gt; tools / resources / prompts — directly the "too many MCP servers blow my context window" problem,&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;Telegram&lt;/strong&gt; bot's per-message context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(They're &lt;em&gt;reference&lt;/em&gt; adapters over documented/synthetic inputs — the logic is real and reusable; the bundled examples are synthetic, stated in each.)&lt;/p&gt;

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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;context-plane
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;plan&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;context-plane&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;promptPlan&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;plan&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Help me debug the failing build.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;registry&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promptPlan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;selectedComponents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// include / omit / defer, each with a reason&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open-core, &lt;strong&gt;Apache-2.0&lt;/strong&gt;. It's early (v0.1.x) — repo, the demo, and feedback:&lt;br&gt;
&lt;strong&gt;&lt;a href="https://github.com/samnodehi/zam-context-plane" rel="noopener noreferrer"&gt;https://github.com/samnodehi/zam-context-plane&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>mcp</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
