<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samet Samyeli on Medium]]></title>
        <description><![CDATA[Stories by Samet Samyeli on Medium]]></description>
        <link>https://medium.com/@sametsamyeli?source=rss-8844eb0da2d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1XEi049NkrKASCl240ok9A.jpeg</url>
            <title>Stories by Samet Samyeli on Medium</title>
            <link>https://medium.com/@sametsamyeli?source=rss-8844eb0da2d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:39:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sametsamyeli/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Defending Your Moat with Policy - ( 3/5 )]]></title>
            <link>https://medium.com/@sametsamyeli/stop-defending-your-moat-with-policy-3-5-dc288b4b61d4?source=rss-8844eb0da2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc288b4b61d4</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artifical-intellegence]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[andrej-karpathy]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <dc:creator><![CDATA[Samet Samyeli]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 12:08:44 GMT</pubDate>
            <atom:updated>2026-08-12T12:08:44.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7zEExvzYrmniPqrywVBlQ.jpeg" /></figure><blockquote><em>Most AI products defend their moat with policy documents that quietly rot the moment a junior engineer or a late-night refactor arrives. I defend mine with two hard assertions that run on every commit: one that fails the build if I ever ship the things I swore I would never build, and one that fails the wiki if I ever let a hard-won lesson become unqueryable or contradictory. Both are sealed in an HMAC chain. The result is the only kind of moat that actually ratchets every refusal and every lesson makes the system strictly harder to regress and strictly more useful over time.</em></blockquote><p>I run two scripts on every commit.</p><p>The first greps the entire codebase for things I have sworn never to ship: dynamic evaluators, value-returning secret tools, raw provider modules, the lethal trifecta of agentic exfiltration. If any of them appear, the build fails hard.</p><p>The second walks the wiki and asks the opposite question. What should exist here that does not? A claim with no source. A concept page with zero inbound links. A contradiction between two pages written months apart. The first script stops the system from turning into a CVE. The second stops it from forgetting what it already learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oz5mhw8g9BwkjxN-iveltQ.png" /></figure><p>I built lodos around one rule. Every refusal that matters is a grep in the build. Every piece of knowledge that matters is a versioned, queryable page. Both live inside an HMAC chain that breaks loudly the moment anything is tampered with. Write what you refuse to add. Write what you refuse to forget. Make the build refuse to ship without both.</p><p>Most AI products write down what they want to be and defend it with policy. A smaller group writes down what they refuse to become and defends it with code. The rarest group also writes down what they refuse to forget and defends it with a wiki that fails its own integrity check the moment a page drifts. That last group is building the only kind of moat that compounds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m4VgMg6NkcVPh_QHBbmAdQ.png" /></figure><h3>What decays and what does not</h3><p>Policy moats die quietly. “We never log secrets.” “We sandbox every tool output.” “We validate before the LLM sees it.” These sentences live in SOC 2 documents. They are true the day they are written. Then a junior engineer adds a debug logger. A refactor moves the sanitizer behind a feature flag. The sentence stays in the document. The system no longer behaves like the sentence. Nothing fails. Nobody notices.</p><p>Knowledge moats die even faster. A founder learns at 2 a.m. why a customer churned, drops the insight in Slack, and forgets it within a week. The lesson exists nowhere that can be queried. Three months later the same pattern returns and the founder pays the same tuition again. This is the most expensive decay because the founder does not even know it is happening.</p><p>Both failures share the same cure. Bind the thing to a structure that breaks when the thing breaks. Make the build fail on a refusal regression. Make the wiki fail its own lint when a page goes orphan, drifts off-topic, or contradicts itself. The fix is not process. The fix is an assertion the system runs against itself every single time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rpVAyDLGL7jf-AH92YKMTw.png" /></figure><h3>The Karpathy pattern, commercialized</h3><p>The knowledge half is not original. Andrej Karpathy described an LLM wiki with three operations and one claim: the wiki is the executable, the raw sources are the code, the LLM is the compiler, the lint is the tests, the queries are the runtime.</p><p>I copied the pattern and then changed three things on purpose.</p><ul><li>Storage. Karpathy uses a folder of markdown files and git. I use SQLite plus a per-section encrypted vault. The trade is interop for confidentiality. A clean markdown export still gives me Obsidian when I want it.</li><li>Autonomy. Karpathy lets the LLM write directly. I force every change through a propose-and-approve diff modal. The agent never touches the canonical page itself. I spend five to ten seconds on each approval. In exchange the agent cannot quietly rewrite my behavior.</li><li>Audit. Karpathy keeps a plain markdown log. I keep an HMAC chain signed against a sub-key of the master password. A tampered log surfaces as a chain break on the next startup.</li></ul><p>These are not philosophical differences. They are commercial adaptations of a personal-knowledge pattern. They keep the spirit and charge compliance-buyer prices.</p><h3>Both sides ratchet the same way</h3><p>The refusal side and the knowledge side have identical shape. One greps for things that must never exist. The other greps for things that must never be missing. Both are absence checks. Both fail loud. Both are sealed in the same HMAC chain.</p><p>When I ask the wiki a question and the answer is good, the interface offers a one-click “save this as a page.” If I take it, the answer becomes durable. The next session finds it. The same question never needs to be asked again. The metric is save-rate. It rises over time. The wiki is the only part of the system that gets strictly stronger the more I use it.</p><p>The refusal side works the same way. Every new feature that threatens an invariant gets a new invariant written into the verify script. The script grew from seven checks to thirty-two in eight months. Each capability ships with the grep that closes its abuse class. The codebase becomes monotonically more refused with every feature that ships.</p><p>Most teams treat these as separate concerns. They are the same discipline applied to two different absences: what must never exist, and what must never be forgotten.</p><h3>What it costs and why the cost is the point</h3><p>I lose velocity on exactly the features that fight the refusals and on the rewrites that would ignore the wiki. A power user wants an inline expression evaluator. Declined. A customer wants a value-returning secret tool. Declined. Future me will be tempted to rip the approval loop out because it feels slow. The build will not allow it.</p><p>The release notes look different from every competitor’s. Mine name the refusals as often as they name the features. There is no clean growth story that omits the things I deliberately refused to build.</p><p>What I gain does not fit on a landing page. It fits in a sales conversation with a regulated buyer. That buyer hears “we cannot” differently from “we promise not to.” A compliance officer treats a tamper-evident HMAC chain differently from a markdown log. The founder reading the wiki today is being read by the founder who will need it in six months. None of those people are reachable through marketing claims.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOhbwWTlEku4yZWScMu24w.png" /></figure><h3>Five pieces you can steal</h3><p>None of them requires the others. Together they form the pattern.</p><ol><li>A declarative workflow engine that contains no expression evaluator of any kind.</li><li>A two-store vault in which the AI literally cannot return a plaintext secret.</li><li>A build-time invariant script written with negative-proof discipline.</li><li>A wiki that implements the three Karpathy operations and wraps the log in an HMAC chain.</li><li>A propose-only learning loop in which the agent never writes its own behavior.</li></ol><p>Run them in any order. The only thing they share is the discipline: write the things you refuse to ship and the things you refuse to forget, assert both in the build, and prove the asserts by trying to violate them on purpose. Everything else is engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jme_4TQbq7F8Lcym_R_zbA.png" /></figure><h3>What comes next</h3><p>The final loop is the one that took the longest to get right. The agent watches the conversation, notices when its own skill catalog could be improved, and proposes an edit. I approve or reject. The edit travels through the same diff modal as every wiki proposal. The agent never writes its own behavior. The chokepoint between proposal and approval is the actual moat.</p><p><em>The next post is about that loop and about one short passage in the disposition prompt that justified the entire engineering effort.</em></p><p><em>Other languages &amp; Turkish: </em><a href="https://lodos.md/tr/blog/savunma-hattinizi-yazili-kurallara-emanet-etmeyin"><em>https://lodos.md/tr/blog/savunma-hattinizi-yazili-kurallara-emanet-etmeyin</em></a></p><p><em>Join waitlist: </em><a href="https://lodos.md/">https://lodos.md/</a> 🫶🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc288b4b61d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero-Knowledge as Architectural Blindness — 2/5]]></title>
            <link>https://medium.com/@sametsamyeli/zero-knowledge-as-architectural-blindness-2-5-23581de51e25?source=rss-8844eb0da2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/23581de51e25</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Samet Samyeli]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 16:03:48 GMT</pubDate>
            <atom:updated>2026-07-02T16:03:48.178Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZxBDfQDnoXjiPB-mCgPQsQ.jpeg" /></figure><blockquote><em>Your AI assistant just asked to see your Stripe live key. Most secret managers would let it the API exposes getSecret(name), the agent calls it, the plaintext lands in the transcript, and from there into whatever pipeline the agent talks to. The interesting question is what kind of schema makes that exchange </em><strong><em>structurally unanswerable</em></strong><em>.</em></blockquote><p>For lodos I picked a position that’s easy to advertise and hard to engineer: the AI cannot see the value of any secret in the vault. Not “won’t” <strong>cannot</strong>. There is no code path that returns a plaintext secret to the calling AI. The Prisma schema has no column the AI could read; the IPC layer has no method that returns a decrypted field; the MCP tool registry has no tool whose contract is <strong>give me the value</strong>. If a future me tries to add one, the build script catches it before merge.</p><p>This post is the schema walkthrough what it actually looks like to design <strong>architectural blindness</strong> instead of policy blindness, and what you give up in exchange. The vault is the layer I’m most proud of, partly because the engineering is honest about what it doesn’t do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyBbppfeFP9iLcFIM3ODnA.jpeg" /></figure><h3>The two-store model</h3><p>The naive design is one column: <em>encryptedJson</em> holds the section payload, you decrypt on read, you serve fields from the decrypted blob. That works, and it has one bug class any read path eventually decrypts. The lookup that wanted <em>account_id</em> (public) also decrypted <em>api_key</em> (sensitive). The audit log might catch the wasted decrypt; the leak to the LLM transcript probably doesn’t.</p><p>So vault sections have two stores, side by side:</p><pre>model SecretSection {<br>id String @id @default(cuid())<br>name String // &quot;stripe&quot;, &quot;aws&quot;, &quot;github&quot;<br>encryptedJson Bytes // libsodium secretbox(sensitive-fields, sectionKey)<br>nonSensitive Json // { account_id, region, username, ... } plain<br>fieldSchema Json // [{key, type, sensitive, required}, ...]<br>keyWrapped Bytes // sectionKey, wrapped by masterDEK<br>// ...<br>}</pre><p>Every field knows whether it’s <em>sensitive: true</em> or <em>sensitive: false</em>. The routing happens once, at write time. Sensitive fields go through libsodium; non-sensitive fields land in a plaintext JSON column. Reading a non-sensitive field is a SQLite read no decrypt, no DEK access, no audit write. Reading a sensitive field requires the master password.</p><p>You lose: the ability to lie to yourself about which fields are which. You can’t decide at read time. The schema forces the call upfront.</p><p>You get: a bug class deleted. The chat MCP tool <em>secrets_field_metadata</em> returns the real length for non-sensitive fields and <em>0</em> for sensitive ones not because we hid the length, but because the metadata path never touches <em>encryptedJson</em>. The discipline holds at the type level, not at the comment level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hP_2d3byQLF2k7QmOwUCxA.jpeg" /></figure><h3>The encryption pipeline</h3><p>The sensitive side runs on Argon2id and libsodium. Nothing exotic:</p><pre>// On unlock<br>const masterDEK = await argon2id(masterPassword, {<br>memLimit: 64 * 1024 * 1024,  // 64MB<br>opsLimit: 3,<br>salt: vault.argon2Salt,<br>});<br>// HMAC check against vault.masterKeyCheck fail-fast on wrong password<br>// On read of a sensitive field<br>const sectionKey = unwrap(section.keyWrapped, masterDEK);<br>const plaintext = sodium.crypto_secretbox_open(<br>section.encryptedJson, section.nonce, sectionKey,<br>);<br>const value = JSON.parse(plaintext)[field];<br>sectionKey.fill(0);  // zero-fill before GC</pre><p>Three properties matter for the blindness claim. First, the master DEK lives in main-process memory only never in the renderer, never in the chat-engine subprocess, never in an IPC payload. Second, a compromised single section is not a compromised vault: each section has its own random <em>sectionKey</em>, wrapped by master DEK. Third, the unlock state has an idle timeout of five minutes and an absolute cap of thirty; after that, every section is one re-prompt away from being unreadable.</p><p>This is the part where I expect security-minded readers to say “<strong>yes but</strong>” and start asking about memory dumps, swap files, GPU residency. Fair questions, mostly out of scope here. The relevant point is that <strong>the AI cannot reach into this pipeline</strong>. The Agent SDK runs in a subprocess that has no access to vault state; it talks to the main process over IPC, and the IPC surface has no method that returns plaintext.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9BBOe3MXpqIhNL3dg8P9Yw.jpeg" /></figure><h3>Pattern A, B, D never C</h3><p>There are exactly four ways a secret can be used in this system:</p><ul><li><strong>A Never leaves the vault. : </strong>A secret is referenced by name in a workflow, decrypted main-process side, injected into a subprocess env, never returned to the AI. The AI sees <em>{{</em><a href="https://secrets.stripe.live/"><em>secrets.stripe.live</em></a><em>_key }}</em> in YAML and an HTTP 200 in the response.</li><li><strong>B Narrow egress filter</strong>. : A value like <em>postgres://user:pass@host/db</em> is decrypted main-process side, a filter extracts `host` only, and that becomes the <em>allowedEgress</em> value. The secret as a value never crosses the IPC boundary; a derived projection does.</li><li><strong>C Decrypt and return to the AI. :</strong> ❌ Does not exist. No MCP tool registered. No IPC method. No code path. If you grep the codebase for any tool name matching <em>_value_get$</em>, the result is empty by construction. The build script enforces that.</li><li><strong>D Inject and run. :</strong> A subprocess is spawned with the secret in its env. Six layers between the secret and any AI surface: env-only (not argv), encoding-redactor on stdout/stderr, no-shell-string-build, content-firewall on output, HMAC audit log entry with opaque path, hard-coded egress allowlist per call.</li></ul><p>The point of writing these as patterns is that <strong>C is the one most products ship</strong>. Their secret manager tool returns the plaintext to the agent loop, and they call that <strong>integration</strong>. Pattern A through D are integration too they just don’t put the secret in the transcript.</p><p>The trade is honest. Some workflows are easier with Pattern C. None are <strong>necessary</strong> with Pattern C. So we ship A, B, D, and we use a build-time grep to keep C out.</p><h3>The opaque audit chain</h3><p>The audit log is the part that surprised me most when I designed it.</p><p>A vault audit row says “section X, field Y was injected by actor Z at time T, signature S, prev-signature P.” The natural schema stores <em>fieldPath</em> as plaintext. That’s a leak: anyone with read access to the audit table sees that the AI agent injected <a href="https://stripe.live/"><em>stripe.live</em></a><em>_key</em>, not just <strong>that it injected something</strong>. For a regulated buyer doing compliance review, that audit table itself becomes secret material.</p><p>So the schema doesn’t store the path. It stores the hash:</p><pre>fieldPathHash: sha256(sectionName + &#39;.&#39; + fieldKey).slice(0, 16)</pre><p>A sixteen-character opaque token. Even the error responses use it: when injection fails, the error is <em>{ pathHash: “a3f2…”, sectionExists: true }</em>, never <em>{ field: “</em><a href="https://stripe.live/"><em>stripe.live</em></a><em>_key”, error: “not found” }</em>. The audit reader, running in the main process in the user’s own context, does the reverse lookup. The AI never sees the plaintext path, and a leaked audit table reveals nothing about which secrets are stored.</p><p>The chain is HMAC-linked every row signs <em>(payload + prev-signature)</em> with a sub-key derived from master DEK. `verifyAuditChain()` runs on startup; a tampered or deleted row breaks the chain and surfaces in the UI as a forensic alert. Hard-delete is forbidden; archive is a soft-delete with the row left in place.</p><p>You can screenshot the audit table and show it to a SOC2 auditor. The auditor sees an actor identifier, a section, an opaque field hash, a timestamp, and an HMAC chain. The actual secret names don’t leak. <strong>That</strong> is what compliance buyers are paying for.</p><h3>When the user couldn’t tell the architecture from a bug</h3><p>During the first real dogfood, a user ran <em>echo </em><a href="https://x.com/search?q=%24API_KEY&amp;src=cashtag_click"><em>$API_KEY</em></a><em> </em>through <em>secret_inject_and_run</em>. The call failed with <em>MCP_LETHAL_TRIFECTA_GATE</em>. The user took it to the AI assistant for diagnosis; the AI spent about 3k tokens explaining that the command was rejected because it was “static text” and recommended switching to a curl call. Wrong. The gate condition was <em>allowedEgress.length === 0 &amp;&amp; riskTier === ‘novel’</em> the call had no egress allowlist, so it was rejected as potentially exfiltrating without a declared destination.</p><p>The bug ticket got reclassified as moat-win. The architecture worked correctly, and the AI’s confusion was itself evidence: the system refused based on egress shape, not command content, and the AI’s wrong diagnosis was downstream of an unhelpful tool description, not a broken refusal. We edited the description; the gate stayed put.</p><p>The lesson I keep returning to is that a refusal the AI doesn’t understand is still a refusal. <strong>Architectural blindness doesn’t require the LLM to be on board with it.</strong></p><h3>What this is worth commercially</h3><p>The pitch I make to founders thinking about this kind of work is straightforward. SOC2 and ISO buyers will not accept “we promise” as a policy. They will accept “we cannot.” A vendor that <strong>can</strong> see your live keys and <strong>promises</strong> not to is a vendor that occasionally has CVEs in their logging stack. A vendor whose schema <strong>cannot</strong> see the value is a different category of risk, and that category prices differently.</p><p>The Phase-3 path I left open from day one is per-recipient wrap. The section key is already an indirection; today it’s wrapped once by master DEK. In a team setting, it gets wrapped N times once per recipient public key and the server still cannot decrypt because it doesn’t hold any private key. The wrap is additive, not a rewrite, because the per-section indirection was kept generic from the first commit. That door stays open without any feature shipped for it now.</p><h3>The next layer</h3><p><em>Schema design protects the secret at rest and in inject. But schemas are code, and code can be edited. The next post </em><strong><em>32 Build-Time Invariants That Fail My Build If I Regress</em></strong><em> walks through the script that keeps the Prisma schema from regressing, the workflow engine from growing an eval, and the MCP tool registry from sprouting a secret_value_get. Refusal becomes a grep, and the grep ships with its own fake violation to prove the grep still has teeth.</em></p><p><em>Join waitlist: </em><a href="https://lodos.md/">https://lodos.md/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23581de51e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Built a Workflow Engine That Can’t Have n8n’s CVE]]></title>
            <link>https://medium.com/@sametsamyeli/we-built-a-workflow-engine-that-cant-have-n8n-s-cve-4fc3c33dde6b?source=rss-8844eb0da2d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fc3c33dde6b</guid>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[n8n]]></category>
            <dc:creator><![CDATA[Samet Samyeli]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 17:46:01 GMT</pubDate>
            <atom:updated>2026-07-02T23:00:14.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XL6lZ9kCgor0PCjPd3Mrrg.jpeg" /></figure><p>n8n had <strong>CVE-2025–68613</strong> last month CVSS 9.9, RCE via expression eval. That’s not the interesting part.</p><p>Interesting part is that the entire class of vulnerability is structurally absent from the workflow engine I designed for lodos.md not because we sandbox better, not because we patched faster, but because there is no expression evaluator anywhere in the pipeline to inject into. The build script greps for it. If a future me adds `eval` or `new Function` or `vm.runInContext` to the workflow surface, the build turns red before the commit lands.</p><p>This post is the architecture walkthrough: what “declarative-bounded” actually means at the level of the YAML schema, why I chose to lose Turing-completeness on purpose, and the specific grep that holds the line.</p><p>If you build workflow tooling (or any system) that takes user-provided expressions and runs them the trade is worth examining honestly. n8n made a different one, and they had a CVSS 9.9 RCE for it. I made this one, and I have a workflow engine that’s strictly less expressive than theirs. Pick your tradeoff knowingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6-DfGRzBZpl6yxryKoGqQ.png" /></figure><h3>What “declarative” actually means her</h3><p>The lodos.md workflow engine exposes five primitives. That’s it:</p><ul><li><strong>http_request</strong> : method, URL template, headers, body, `allowedEgress` host list, `timeoutMs`</li><li><strong>db_query </strong>: SELECT-only against the local SQLite, with a static denylist for vault/billing tables</li><li><strong>ai_call</strong> : hardcoded `<a href="https://api.anthropic.com/">api.anthropic.com</a>` egress, `noSecrets: true` (transcript stripped before send)</li><li><strong>tool_call</strong> : read-only-auto MCP tools, guard-gated, supports optional-degrade</li><li><strong>Control flow</strong> : `wait`, `if_else`, `loop` with **closed-enum comparators** (`eq`, `neq`, `gt`, `lt`, `changed-since-last-run`)</li></ul><p>That last line is the one I want to defend. Most workflow engines I’ve seen ( n8n, Zapier, Temporal even ) let you write a JS expression in the condition slot. <strong>If this number is greater than 5, branch left. </strong>The expression evaluator is convenient for users and a cliff for security teams. So we don’t have one. The comparator is an enum; the comparison is data; there is no path from a user-edited YAML field to a function call.</p><p>You lose things. You can’t write `if step.result.users.filter(u=&gt;<a href="https://u.active/">u.active</a>).length &gt; 5`. You can write `if step.result.activeUserCount gt 5` and produce `activeUserCount` upstream in a `db_query` or `ai_call`. Computation moves to the primitives that already exist; the workflow definition stays declarative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzml26W4yXEWPpo60jHWgg.png" /></figure><h3>The schema discipline</h3><p>The workflow YAML parses through a Zod schema with `z.lazy` for recursion (loops and `if_else` can nest). Unbounded `z.lazy` is a different name for eval — a malicious YAML can blow the stack or the heap before any handler runs. So the schema is double-bounded:</p><pre>const StepSchema: z.ZodType&lt;Step&gt; = z.lazy(() =&gt;<br>  z.discriminatedUnion(&#39;type&#39;, [<br>    HttpRequestStepSchema,<br>    DbQueryStepSchema,<br>    AiCallStepSchema,<br>    ToolCallStepSchema,<br>    WaitStepSchema,<br>    IfElseStepSchema, // contains: steps[] (z.lazy, max 16)<br>    LoopStepSchema,   // contains: body[]  (z.lazy, max 16)<br>  ])<br>);<br><br>// Walk-time enforced in addition to per-array caps:<br>const MAX_TOTAL_NODES = 100;<br>const MAX_DEPTH = 5;</pre><p>Three bounds, every one of them necessary. `per-array .max(16)` keeps any single block from being a megabyte of nested branches. `total-nodes 100` bounds the whole graph (you can’t smuggle complexity past the per-array cap by spreading thin). `depth 5` keeps the recursive walk constant-time relative to the input. None of the three is paranoia; each closes a class of resource attack that a real workflow user would never write but a hostile YAML would.</p><h3>Why `secret_value_get` doesn’t exist</h3><p>There is no MCP tool in the system whose contract is <strong>give me the plaintext of a secret</strong>. There’s a six-layer `secret_inject_and_run` that takes a secret reference and an argv, sets the value in a subprocess env, runs the command, and never returns the value to the calling AI. That’s it.</p><p>This isn’t a policy (“don’t add such a tool”). The build script asserts the absence:</p><pre>// scripts/verify-moat-invariants.mjs — INV-M1 (simplified)<br>const FORBIDDEN_TOOL_NAMES = [<br>  /\bbash\b/,<br>  /\bexec\b/,<br>  /\bshell\b/,<br>  /_value_get$/,    // catches secret_value_get, dek_value_get, anything _value_get<br>  /^secret_value_/,<br>];<br><br>const mcpIndexSrc = readFileSync(&#39;apps/mcp/src/index.ts&#39;, &#39;utf8&#39;);<br>for (const pattern of FORBIDDEN_TOOL_NAMES) {<br>  if (pattern.test(mcpIndexSrc)) {<br>    console.error(`INV-M1 VIOLATION: forbidden tool pattern ${pattern}`);<br>    process.exit(1);<br>  }<br>}</pre><p>If some future me or a future AI editor working on this codebase convinces themselves they need a value-returning secret tool, the build refuses before the merge.</p><h3>INV-M5 the eval tripwire</h3><p>The corresponding check for the workflow engine is even simpler:</p><pre>// INV-M5: no eval-class primitive in workflow / skill / deck surfaces<br>const FORBIDDEN_EXEC_PATTERNS = [<br>  /\beval\s*\(/,<br>  /\bnew\s+Function\s*\(/,<br>  /\bvm\.(runIn|compileFunction)/,<br>  /\brequire\([&#39;&quot;]child_process[&#39;&quot;]\)/,<br>  /\bimport\s+.*\bfrom\s+[&#39;&quot;]child_process[&#39;&quot;]/,<br>];<br><br>for (const dir of [&#39;electron/workflow/&#39;, &#39;electron/skills/&#39;, &#39;electron/deck/&#39;]) {<br>  for (const file of walkTs(dir)) {<br>    const src = readFileSync(file, &#39;utf8&#39;);<br>    for (const pattern of FORBIDDEN_EXEC_PATTERNS) {<br>      if (pattern.test(src)) {<br>        console.error(`INV-M5 VIOLATION in ${file}: ${pattern}`);<br>        process.exit(1);<br>      }<br>    }<br>  }<br>}</pre><p>Fifty lines of Node, zero dependencies, runs in the standard `pnpm verify` step. The whole class of CVE that n8n’s CVSS-9.9 expression-RCE lives in is closed by a grep.</p><p>The discipline that makes this real is the <strong>negative proof</strong>: the script ships with its own fake violation. A throwaway `__probe.ts` file with a literal `eval(` in it. CI runs the script twice first with the probe injected (must exit 1), then with it removed (must exit 0). A refusal-detector that never fails is indistinguishable from no detector at all; the negative proof is what gives this script teeth.</p><h3>Feature growth through narrowing, not relaxation</h3><p>The skeptical reader’s question:<em> doesn’t this break when you need more features?</em></p><p>When I shipped `web_fetch` for L2 web egress, I didn’t add an evaluator. I added: narrow-host allowlist + per-source byte budget + redirect-reauth + SSRF-against-self + render-firewall + tainted-content propagation. Twenty-six new test cases, zero new eval surface. The engine got more powerful by adding *bounds*, not by adding <strong>expression power</strong>.</p><p>You can do this. Most growth in workflow tools is interpreted as “give the user more eval surface.” It can be interpreted instead as “give the user more bounded primitives.” The latter is harder to design and impossible to grow into a CVSS 9.9.</p><h3>What this costs and why I paid it</h3><p>You give up, arbitrary in-step computation, JS expression conditions, dynamic field projection, whatever the user can do in n8n’s `{{<a href="https://x.com/search?q=%24json.foo.map&amp;src=cashtag_click">$json.foo.map</a> (x =&gt; x * 2) }}`. Real workflow users do reach for these, and when they do in lodos they reach for them by writing one more `ai_call` or `db_query` step. The workflow definition stays declarative; the eval surface stays empty.</p><p><em>You get:</em> a workflow engine where CVE-2025–68613 is structurally impossible, where the schema enforces bounded resource consumption, and where every refusal is enforced by a grep, not a docstring.</p><p>—</p><p><em>The next post in the series goes one layer down into the vault. “</em><strong><em>AI never see sk_live” </em></strong><em>the AI cannot see your Stripe live key is the architectural claim, and the schema fragment that backs it up is the one I’m most proud of. </em><strong><em>Zero-Knowledge as Architectural Blindness</em></strong><em> explains why our Prisma schema literally cannot hold a plaintext field path, and how that buys us the SOC2-grade audit story for free.</em></p><p><em>Join waitlist: </em><a href="https://lodos.md/">https://lodos.md/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fc3c33dde6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>