<?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: 小哥不太逍遥</title>
    <description>The latest articles on DEV Community by 小哥不太逍遥 (@xgbtxy).</description>
    <link>https://dev.to/xgbtxy</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%2F4281548%2Fc134bd33-7ba7-40d9-a292-c92960cc1fe8.png</url>
      <title>DEV Community: 小哥不太逍遥</title>
      <link>https://dev.to/xgbtxy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xgbtxy"/>
    <language>en</language>
    <item>
      <title>Stop Scripting How Your Coding Agent Thinks — Make the Tool Substrate Deterministic Instead</title>
      <dc:creator>小哥不太逍遥</dc:creator>
      <pubDate>Fri, 04 Dec 2026 00:51:18 +0000</pubDate>
      <link>https://dev.to/xgbtxy/stop-scripting-how-your-coding-agent-thinks-make-the-tool-substrate-deterministic-instead-4adh</link>
      <guid>https://dev.to/xgbtxy/stop-scripting-how-your-coding-agent-thinks-make-the-tool-substrate-deterministic-instead-4adh</guid>
      <description>&lt;p&gt;&lt;em&gt;Lessons from auditing 101,108 coding-agent tool calls, shipping 74 merged upstream PRs across Go/Rust/Python, and building a zero-dependency Rust harness (&lt;code&gt;xgbtxy/ap&lt;/code&gt; + &lt;code&gt;ap-harness-lite&lt;/code&gt; v1.1.0).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is a funny pattern you notice once you run coding agents every day for months across real repositories: every time a smarter model drops, teams rush to write even &lt;em&gt;more&lt;/em&gt; orchestration glue around it. State machines telling the model when to think, rigid planner prompts, custom retry supervisors, and 3,000-token system instructions warning it not to break files.&lt;/p&gt;

&lt;p&gt;And yet, across model upgrades, the agent still burns half its context budget on the exact same mundane failures:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reading an entire 1,800-line source file to locate one 25-line function.&lt;/li&gt;
&lt;li&gt;Dumping 35 KB of noisy &lt;code&gt;cargo test&lt;/code&gt; or &lt;code&gt;pytest&lt;/code&gt; logs straight into the conversation window, evicting the actual design context.&lt;/li&gt;
&lt;li&gt;Patching code by bare line number after an earlier edit shifted the file—corrupting an adjacent block and burning four more turns fixing a syntax error it created itself.&lt;/li&gt;
&lt;li&gt;Running two parallel agents in the same repo and watching them silently overwrite each other's changes, or timing out a test suite on Windows while orphaned child processes keep file locks open.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When I audited &lt;strong&gt;101,108 real coding-agent tool-call traces&lt;/strong&gt;, the takeaway was blunt: &lt;strong&gt;over-controlling &lt;em&gt;how&lt;/em&gt; frontier models reason usually hurts, while leaving the &lt;em&gt;tool substrate&lt;/em&gt; fuzzy guarantees wasted tokens and flaky edits.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I like to keep my own building philosophy simple: technology has fewer real walls than ever right now—when useful tools and open specifications are this accessible, the main craft is picking clean local building blocks and shipping the right fix at the right time.&lt;/p&gt;

&lt;p&gt;So instead of building another heavy Python prompt-orchestration framework, I inverted the stack: give the model maximum room to reason, and move five mechanical invariants into a &lt;strong&gt;single statically linked pure-Rust binary&lt;/strong&gt; (&lt;a href="https://github.com/xgbtxy/ap" rel="noopener noreferrer"&gt;&lt;code&gt;xgbtxy/ap&lt;/code&gt;&lt;/a&gt;, MIT, &lt;code&gt;v2.93.0&lt;/code&gt;) with zero runtime dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Read Enclosing AST Symbols, Edit by Content Hash (&lt;code&gt;ap splice --hashline&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Line numbers are terrible edit coordinates for LLMs; search-and-replace breaks on repeated indentation. Compiling six Tree-sitter grammars (Rust, Go, Python, TypeScript, JavaScript, C) directly into &lt;code&gt;ap&lt;/code&gt; lets any agent read only the enclosing symbol, tagged with short content hashes (&lt;code&gt;42:a3|...&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;When the agent submits a patch via &lt;code&gt;ap splice apply --hashline --stdin --test --rollback-on-test-fail&lt;/code&gt;, &lt;code&gt;ap&lt;/code&gt; verifies every anchor hash before touching disk, checks Tree-sitter syntax, runs the test gate, and rolls back cleanly if tests fail. In our empirical runs, pairing AST-bounded edits with automated checks lifted mutation-kill coverage from &lt;strong&gt;&lt;code&gt;62.5%&lt;/code&gt; to &lt;code&gt;100.0%&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Lossless SQLite FTS5 Log Compression (&lt;code&gt;ap sieve&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Piping noisy test logs through &lt;code&gt;head&lt;/code&gt; or &lt;code&gt;tail&lt;/code&gt; throws away the middle error frame permanently. &lt;code&gt;ap sieve run&lt;/code&gt; emits a compact digest for the model while indexing 100% of the verbatim output into an embedded SQLite FTS5 store (&lt;code&gt;ap sieve search&lt;/code&gt; / &lt;code&gt;ap sieve peek --lines&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;On the synthetic 597-line &lt;code&gt;cargo test&lt;/code&gt; failure log bundled in our companion MIT Lite Kit (&lt;a href="https://github.com/xgbtxy/ap-harness-lite/releases/tag/v1.1.0" rel="noopener noreferrer"&gt;&lt;code&gt;xgbtxy/ap-harness-lite&lt;/code&gt; v1.1.0&lt;/a&gt;), &lt;code&gt;ap sieve&lt;/code&gt; shrinks &lt;strong&gt;&lt;code&gt;32,258 B&lt;/code&gt; (~8,065 tokens) down to &lt;code&gt;1,307 B&lt;/code&gt; (~327 tokens) — a &lt;code&gt;95.9%&lt;/code&gt; cut&lt;/strong&gt; while keeping both buried assertion failures directly readable.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Budgeted Micro-Rule Retrieval (&lt;code&gt;ap recall&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Instead of paying for a monolithic instruction file on every turn, &lt;code&gt;ap recall&lt;/code&gt; queries an embedded FTS5/BM25 store and injects only the 1–3 matching rules under a strict token budget. In &lt;code&gt;v2.93.0&lt;/code&gt;, 10,000-rule lookup latency dropped from &lt;strong&gt;&lt;code&gt;20.57ms&lt;/code&gt; to &lt;code&gt;0.33ms&lt;/code&gt; (&lt;code&gt;62.3x&lt;/code&gt;)&lt;/strong&gt;, and warm-cache &lt;code&gt;ap audit&lt;/code&gt; dropped from &lt;strong&gt;&lt;code&gt;10.03s&lt;/code&gt; to &lt;code&gt;416ms&lt;/code&gt; (&lt;code&gt;24.1x&lt;/code&gt;)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Cooperative File Leases &amp;amp; OS Process Containment (&lt;code&gt;ap baton&lt;/code&gt; + &lt;code&gt;ap-winjob&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Parallel agents shouldn't rely on polite prompt instructions to avoid stepping on each other. &lt;code&gt;ap baton claim --owner &amp;lt;id&amp;gt; --ttl &amp;lt;sec&amp;gt;&lt;/code&gt; provides atomic TTL-backed cooperative file leases across linked Git worktrees (&lt;code&gt;exit 2&lt;/code&gt; on contention) plus &lt;code&gt;&amp;lt;500&lt;/code&gt;-token &lt;code&gt;ap baton resume&lt;/code&gt; handoff capsules. On Windows, &lt;code&gt;ap exec&lt;/code&gt; binds child process trees inside a Win32 Job Object (&lt;code&gt;ap-winjob&lt;/code&gt;) so timeouts terminate the entire process tree cleanly with zero orphaned runners.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The Same Discipline Scales Beyond Agents: 74 Upstream PRs &amp;amp; 3 Verified IETF Errata
&lt;/h2&gt;

&lt;p&gt;The unexpected side effect of building zero-false-positive local checks is how cleanly the habit transfers to open-source maintenance and formal standards work. Across &lt;strong&gt;&lt;code&gt;74&lt;/code&gt; officially merged upstream PRs&lt;/strong&gt;—spanning Apache (&lt;code&gt;arrow-go&lt;/code&gt;, &lt;code&gt;datafusion-sqlparser-rs&lt;/code&gt;, &lt;code&gt;opendal&lt;/code&gt;, &lt;code&gt;spark&lt;/code&gt;), CNCF &amp;amp; OCI (&lt;code&gt;etcd-io/bbolt&lt;/code&gt;, &lt;code&gt;opencontainers/runtime-spec&lt;/code&gt;, &lt;code&gt;opentelemetry-python&lt;/code&gt;, &lt;code&gt;prometheus/client_golang&lt;/code&gt;, &lt;code&gt;coredns&lt;/code&gt;, &lt;code&gt;go-tuf&lt;/code&gt;, &lt;code&gt;nats.go&lt;/code&gt;), HTTP engines (&lt;code&gt;valyala/fasthttp&lt;/code&gt;, &lt;code&gt;gofiber/fiber&lt;/code&gt;), AI SDKs (&lt;code&gt;onnxruntime&lt;/code&gt;, &lt;code&gt;transformers&lt;/code&gt;, &lt;code&gt;modelcontextprotocol/rust-sdk&lt;/code&gt;, &lt;code&gt;a2aproject/a2a-python&lt;/code&gt;, &lt;code&gt;a2a-go&lt;/code&gt;), and W3C/standards repos (&lt;code&gt;RDFLib/rdflib&lt;/code&gt;, &lt;code&gt;CycloneDX&lt;/code&gt;)—plus &lt;strong&gt;&lt;code&gt;3&lt;/code&gt; officially Verified IETF RFC errata&lt;/strong&gt; (&lt;code&gt;EID 9311&lt;/code&gt;, &lt;code&gt;EID 9330&lt;/code&gt;, &lt;code&gt;EID 9352&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt; Held, &lt;code&gt;0&lt;/code&gt; Rejected), busy maintainers merge small, test-backed fixes quickly when the noise floor is zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest Negative Controls (When NOT to Use &lt;code&gt;ap&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Every tool has break-even thresholds, and hiding them wastes everyone's time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tiny commands (&lt;code&gt;&amp;lt;1.2 KB&lt;/code&gt; stdout)&lt;/strong&gt;: &lt;code&gt;ap bench&lt;/code&gt; ships with a built-in negative control showing that wrapping a &lt;code&gt;70 B&lt;/code&gt; output adds &lt;code&gt;+48 B&lt;/code&gt; of wrapper metadata (&lt;code&gt;118 B&lt;/code&gt;). Run &lt;code&gt;git status -s&lt;/code&gt; directly or pass &lt;code&gt;ap exec --raw&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small files (&lt;code&gt;&amp;lt;80&lt;/code&gt; lines)&lt;/strong&gt;: Just read the file straight through.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Direct CLI beats eager MCP when you have a shell&lt;/strong&gt;: &lt;code&gt;ap mcp&lt;/code&gt; exposes 37 stdio tools for MCP-only hosts, but loading 37 JSON schemas eagerly into every turn defeats token savings. If your agent has shell access, call &lt;code&gt;ap&lt;/code&gt; directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Yourself (100% MIT, Zero Trackers)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Canonical Engineering Essay: &lt;a href="https://xgbtxy.github.io/essays/deterministic-harness.html" rel="noopener noreferrer"&gt;https://xgbtxy.github.io/essays/deterministic-harness.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Essay #2 (Zero-FP OSS &amp;amp; IETF Errata): &lt;a href="https://xgbtxy.github.io/essays/zero-fp-oss-and-ietf-errata.html" rel="noopener noreferrer"&gt;https://xgbtxy.github.io/essays/zero-fp-oss-and-ietf-errata.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Interactive Token-Savings Estimator &amp;amp; &lt;code&gt;ap sieve&lt;/code&gt; Playground: &lt;a href="https://xgbtxy.github.io/" rel="noopener noreferrer"&gt;https://xgbtxy.github.io/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Pure-Rust Single Binary (&lt;code&gt;v2.93.0&lt;/code&gt;, 5 platforms): &lt;a href="https://github.com/xgbtxy/ap" rel="noopener noreferrer"&gt;https://github.com/xgbtxy/ap&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Free MIT Companion Lite Kit (&lt;code&gt;v1.1.0&lt;/code&gt;, FTS5 recipes + 24/24 CI-tested Task-DAG validator): &lt;a href="https://github.com/xgbtxy/ap-harness-lite/releases/tag/v1.1.0" rel="noopener noreferrer"&gt;https://github.com/xgbtxy/ap-harness-lite/releases/tag/v1.1.0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Short &lt;code&gt;1080p&lt;/code&gt; Terminal Walkthroughs (~100s each): &lt;a href="https://www.youtube.com/playlist?list=PLBVbhUxEeai4" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLBVbhUxEeai4&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What deterministic local guardrails have saved you the most agent turns lately?&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
  </channel>
</rss>
