<?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 Gaurav Caprihan, Ph.D on Medium]]></title>
        <description><![CDATA[Stories by Gaurav Caprihan, Ph.D on Medium]]></description>
        <link>https://medium.com/@gaurav.caprihan?source=rss-68f5da47a42c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B5cXRUFxf0E_Fxzx</url>
            <title>Stories by Gaurav Caprihan, Ph.D on Medium</title>
            <link>https://medium.com/@gaurav.caprihan?source=rss-68f5da47a42c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:52:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gaurav.caprihan/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[The Missing Rung: How Agentic AI is Breaking the Tech Apprenticeship]]></title>
            <link>https://medium.com/@gaurav.caprihan/the-missing-rung-how-agentic-ai-is-breaking-the-tech-apprenticeship-a2100624407b?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2100624407b</guid>
            <category><![CDATA[agentic-sdlc]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 12:21:24 GMT</pubDate>
            <atom:updated>2026-09-15T12:21:24.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*Q6D5vD2g5aqtFS2v7qV3Ug@2x.jpeg" /></figure><p>We spent the last twenty years trying to get rid of grunt work in software engineering.</p><p>Now we are discovering that grunt work was doing something rather important: it was training people.</p><p>Writing yet another unit test, fixing a tiny bug, reading a 12-year-old codebase that nobody wanted to touch, or figuring out why a deployment failed because somebody had changed one environment variable three services away was never particularly glamorous. But these were the reps. This was how a graduate developer slowly became an engineer.</p><p>And now Agentic AI is eating a huge chunk of those reps.</p><p>We are moving from AI that helps us write code to AI that can increasingly take a ticket, explore a repository, change multiple files, run tests, diagnose failures and open a pull request.</p><p>Claude Code now has an <a href="https://www.anthropic.com/engineering/claude-code-auto-mode">Auto mode</a> designed to make more tool-use decisions without requiring constant human approval. GitHub’s Agent HQ is bringing multiple coding agents into the same development workflow, with context, history and review attached to the work.</p><p>This is fantastic for productivity.</p><p>But there is an uncomfortable question hiding underneath all of this:</p><p>How does a junior developer become senior when AI is doing the work that used to make them senior?</p><p>That is the missing rung.</p><p>And I don’t think we have fully figured out what replaces it yet.</p><h3>From Copilot to Coworker</h3><p>The first wave of AI-assisted software development was relatively easy to understand.</p><p>Copilot sat inside the IDE. You typed something, it suggested something, and you accepted it, rejected it or modified it. You were still driving. AI was the very fast passenger sitting next to you.</p><p>Agentic SDLC changes the relationship.</p><p>Now give an agent a Jira ticket:</p><pre>Users occasionally receive duplicate <br>notifications when an order status changes.</pre><p>The important shift isn’t simply that the model generates better code. The important shift is delegation. We are starting to delegate chunks of the software-development process itself.</p><p>And that creates a strange problem for junior engineers.</p><p>Historically, their first few years were full of tiny tasks: fixing bugs, updating APIs, adding validation, writing tests, investigating exceptions and cleaning up ugly code. Those tasks looked like individual chores, but together they built a mental model.</p><p>You learned how the repository was structured, how services talked to each other, where configuration lived and which assumptions were real versus merely written in a document somewhere. You learned that documentation could be wrong, that a one-line change could break something three services away and that a passing test didn’t necessarily mean the system was healthy.</p><p>That stuff is hard to teach theoretically. You get it through reps.</p><p>And agents are getting very good at doing those reps for us.</p><p>That’s the productivity win. It’s also the apprenticeship problem.</p><p>We keep measuring how much faster an experienced engineer becomes with an agent, which is a perfectly reasonable question. But we should also ask:</p><p>How does an inexperienced engineer build experience when the agent gets there first?</p><p>You cannot become a senior architect simply by looking at architecture diagrams. At some point, you need to have been in the mud.</p><h3>Everyone Wants Seniors</h3><p>The labour market is already making this problem more uncomfortable.</p><p>There are widely circulated claims that entry-level developer postings have fallen by roughly 67% since 2022, with actual junior hiring down around 73%.</p><p>I would be careful treating those exact numbers as gospel. The underlying figures are not consistently sourced, and some public analysis explicitly disputes them.</p><p>What isn’t particularly controversial is the direction: entry-level technology opportunities have become harder to find, while employers continue to place a premium on experience. Recent <a href="https://interclypse.com/happenings/junior-developer-hiring-in-2026-correcting-the-numbers">reporting</a> in New York, for example, found entry-level computer and mathematical roles down 49% between 2022 and 2025.</p><p>So let’s put the precise percentage aside for a moment. The structural signal is what matters. The bottom of the ladder is getting narrower.</p><p>And there is a very rational business reason for it.</p><p>Hire five experienced engineers, give them powerful coding agents and let each engineer operate at a much higher level of leverage. The economics can look considerably better than hiring a large number of junior developers and spending years training them.</p><p>One senior engineer plus an agent can now produce a remarkable amount of software.</p><p>From the perspective of this quarter’s budget, that looks brilliant.</p><p>From the perspective of 2031, it gets interesting.</p><p>Senior engineers are not produced by a senior-engineer factory. They were juniors once. Someone hired them before they knew what they were doing, reviewed their rookie first pull request, let them chase a bug for half a day before explaining what they had missed and gave them ownership that was slightly uncomfortable.</p><p>That’s how engineering judgment gets built.</p><p>And this is where I think we may be creating another problem: <strong>the Hollow Senior</strong>.</p><p>The Hollow Senior is an engineer who has become extremely productive at generating software but increasingly disconnected from the system underneath it. They can prompt an agent to generate a new service, ask it to refactor 40 files or have it diagnose a failing CI pipeline. But when the failure crosses several services and the obvious explanation is wrong, they struggle to follow the chain.</p><p>They know how to generate, but they don’t necessarily know how to reason.</p><p>They can produce an architectural change, but can they explain the architectural consequences? They can get the tests green, but can they tell you which tests are missing? They can ask an agent to refactor the legacy subsystem, but can they recognise that the “legacy mess” is actually encoding three undocumented business rules?</p><p>That’s the Hollow Senior.</p><p>Agentic AI can make this person look very good for quite a while, until something goes properly wrong.</p><p>AI can amplify engineering judgment. It can also amplify the absence of it.</p><p>If we stop creating junior engineers today, we are effectively borrowing talent from the past. We’re free-riding on everyone who already went through the apprenticeship.</p><p>The bill arrives later.</p><h3>The Legal Parallel</h3><p>Technology isn’t the only industry facing this. Law has a very similar problem.</p><p>For years, first-year associates spent enormous amounts of time doing discovery and research: reading documents, finding relevant precedent, summarising case law, comparing contracts and locating the one sentence buried in a thousand pages that might matter.</p><p>Senior lawyers didn’t necessarily enjoy this work. But junior lawyers weren’t doing it only because the firm needed cheap labour. They were learning.</p><p>They were seeing patterns, reading hundreds of cases and learning which arguments survived and which sounded clever but collapsed under scrutiny. They were developing judgment.</p><p>Now AI can process huge volumes of legal material in a fraction of the time. From a productivity perspective, that’s obviously attractive.</p><p>But imagine removing five years of document review from the career path. The junior lawyer may know more legal terminology and be able to produce a beautifully formatted analysis in seconds, but have they developed the pattern recognition that comes from seeing the same types of disputes play out again and again?</p><p>That’s the same problem we’re beginning to see in software.</p><p>The point isn’t that juniors should continue doing boring work simply because that’s how we suffered. That’s not the argument.</p><p>The argument is that learning and production have historically been coupled.</p><p>AI is uncoupling them.</p><p>And once you see that, this stops being a “software developers versus AI” conversation. It becomes a question about how any profession manufactures expertise.</p><h3>The Threat to Future Expertise</h3><p>There is a tempting assumption that the AI era will simply eliminate junior work and move everyone upward.</p><p>I don’t think it’s that simple.</p><p>Some people will absolutely jump levels faster. AI gives a capable engineer incredible leverage, and a junior engineer who learns to use agents well could potentially achieve things that would have taken years of experience to execute manually.</p><p>That is the upside.</p><p>But productivity is not the same thing as capability. And capability is not the same thing as judgment.</p><p>You can have an engineer who delivers five times the output of a traditional developer while having a much weaker understanding of the system. The output looks great until the system behaves unexpectedly. Then somebody has to understand what actually happened.</p><p>This is exactly where Agentic SDLC gets interesting.</p><p>The more autonomous the agents become, the more we need people who can supervise them. Someone has to decide what an agent is allowed to do, understand the blast radius of those actions, recognise that a generated solution is technically valid but architecturally wrong, audit the agent’s assumptions and investigate why it made the wrong decision.</p><p>Even the teams building agentic coding tools are explicitly dealing with this problem.</p><p>Anthropic’s documentation on Claude Code <a href="https://www.anthropic.com/engineering/claude-code-auto-mode">Auto mode</a> talks about reducing approval fatigue while still putting safety checks around what the agent reads and does. Its engineering write-up includes examples of agents attempting things users didn’t intend, including dangerous repository and infrastructure actions.</p><p>That’s not a reason to stop building agents.</p><p>It’s the opposite.</p><p>It means we need engineers who understand the machines they are supervising.</p><p>Which brings us back to the missing rung.</p><h3>Architecting the New Apprenticeship</h3><p>I don’t think we should preserve the old curriculum.</p><p>We should replace it.</p><p>The first major change is simple: move juniors from writer to editor.</p><p>A fresh developer shouldn’t spend their first year blindly producing code while an AI sits beside them. They should spend a significant amount of that year reviewing AI-generated work.</p><p>Give them a 300-line agent-generated pull request and ask them to explain it. Not whether it compiles, but whether it is correct.</p><p>What assumptions did the agent make? What happens when the API times out? What happens when the request is retried? Where is the transaction boundary? What data is trusted? What happens if the operation runs twice? What happens under load? What would you monitor in production?</p><p>What would happen if we stop the harness from doing its work. What if it doesn’t trigger the linter.</p><p>That’s engineering, and it’s something we can teach from day one.</p><p>The second change is to move systems thinking much earlier.</p><p>Historically, we taught syntax first: variables, functions, classes and frameworks. Then eventually, somewhere around “Congratulations, you’re now senior,” we started talking seriously about architecture.</p><p>That sequence made sense when humans had to manually write most of the code. It makes much less sense when an agent can generate a perfectly respectable implementation in seconds.</p><p>A junior now needs to understand service boundaries, APIs, data flows, authentication, authorisation, observability, queues, retries, idempotency, failure domains and blast radius.</p><p>Not at principal-architect depth, but enough to understand what the agent is actually changing.</p><p>The third change is even more interesting: give juniors the agent’s grunt work.</p><p>Call it <strong>Agent Governance</strong>.</p><p>Every enterprise running agents is going to need it. Someone has to maintain the agent evaluation suite, investigate failed runs, review traces, decide whether the context supplied to the agent is sufficient, clean up the knowledge base feeding the RAG pipeline, check that an agent hasn’t been given unnecessary permissions and write adversarial tests.</p><p>Someone also has to investigate hallucinations.</p><p>They need to determine whether an agent failure came from the model, the prompt, missing context, a bad tool, a permission problem or the underlying application.</p><p>These are not theoretical questions. They are going to be everyday engineering work, and they are excellent apprenticeship work.</p><p>Imagine a junior engineer being told:</p><p>“Agent keeps modifying the wrong service when asked to change notification behaviour. Find out why.”</p><p>They inspect the trace and look at the repository context supplied to the agent. They find that the service documentation points to an old implementation. They discover a second service that owns part of the same workflow, trace the API call and find an undocumented dependency.</p><p>Suddenly, the junior developer understands the architecture.</p><p>Not because somebody drew it on a whiteboard, but because the agent got it wrong and they had to figure out why.</p><p><strong>Debugging an agent’s hallucination could become one of the best architectural training exercises we have</strong>.</p><p>The object of the debugging changes.</p><p>The learning mechanism doesn’t.</p><p>Then there is security.</p><p>A junior developer needs to understand much earlier what an agent is allowed to see, what it is allowed to change, which tools it can call, which data it can access and which actions require human approval. They also need to understand what happens if an external document contains instructions designed to manipulate the agent or if a tool has excessive privileges.</p><p>This is not a niche AI-security specialty anymore.</p><p>It is part of application engineering in an agentic environment.</p><p>And finally, we need to preserve failure.</p><p>One of the most powerful things a junior engineer can experience is being wrong in a safe environment. Give them a sandbox and an agent. Let them build something, then break it and diagnose it. Give them an agent-generated architecture and ask them to attack it. Give them a simulated incident and make the obvious explanation wrong.</p><p>The goal isn’t to recreate pointless suffering.</p><p>The goal is to preserve the friction that creates judgment.</p><p>That’s the new apprenticeship.</p><p>Not less challenging.</p><p>Just different.</p><h3>Don’t Remove the Ladder Before Building the New One</h3><p>I’m extremely optimistic about Agentic AI.</p><p>I have seen autonomous agents remove an enormous amount of low-value work from software development. I think experienced engineers with powerful agents will be able to operate at levels of leverage that would have seemed absurd a few years ago.</p><p>I’m not worried about that.</p><p>I’m worried about what happens if we confuse automation of work with automation of learning.</p><p>Because they are not the same thing.</p><p>An agent can make a junior developer incredibly productive. It doesn’t automatically make them incredibly capable.</p><p>And if the agent keeps hiding the complexity underneath the work, we may end up with engineers who are very good at producing software but increasingly uncomfortable when the software behaves in ways the prompt didn’t predict.</p><p>That’s the Hollow Senior problem.</p><p>The solution isn’t to stop using AI. It’s to redesign the apprenticeship around it.</p><p>The junior developer of the future may write less code. That’s fine. But they should probably read more, review more, debug more, question more, trace more and challenge the agent more.</p><p>Remember the advice we all have grown up with…use the CLI instead of the IDE to build and compile! That’s when you learn what goes on under the hood!</p><p>They need to understand the system underneath every generated change and learn how to govern the agents doing the work.</p><p>Because eventually, somebody has to be the adult in the room when the agent gets it wrong.</p><p>That person needs judgment.</p><p>Judgment comes from experience.</p><p>And experience still needs a place to come from.</p><p>We don’t need to preserve the old ladder.</p><p>We just need to build the new one before we remove the old one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2100624407b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Butler Who Did Everything! Fixing My OpenClaw Multi-Agent Setup]]></title>
            <link>https://medium.com/@gaurav.caprihan/the-butler-who-did-everything-fixing-my-openclaw-multi-agent-setup-c9f6c21bb86c?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f6c21bb86c</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[openclaw]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 09:22:34 GMT</pubDate>
            <atom:updated>2026-03-26T09:22:34.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKV33tfOTdya11wP2TkKTA.png" /></figure><p>Your AI agent’s identity file is your delegation policy. Here’s how I learned that the hard way</p><p>Inspired by <a href="https://www.youtube.com/watch?v=Q7r--i9lLck&amp;t=116s">Matt Berman’s video on building a multi-agent team</a>, I built my 8-agent OpenClaw “house” based on similar lines: a “primary butler” named Mumu to orchestrate everything, supported by a staff of 7 “under-butlers” comprising of a fact-checker (RIPR) to run multi-model peer reviews, a content writer (CRISPR) to craft articles, an opportunity scanner (Scout) to search the web and track leads for quick-win projects given a budget range, a personal concierge for helping keep track of personal/family events — happenings in Melbourne, dining, calendar, logistics, an ops monitor for infrastructure health, an organisational health auditor (CPO) to watch the whole team, and a builder for coding tasks.</p><p>On paper, it looked like a well-designed household. Eight specialists, clear mandates, the right model tier for each role. Until I ran the command:</p><pre>openclaw sessions --all-agents --json</pre><p>which revealed a startling truth — 47 sessions for the Mumu. Zero for everyone else.</p><p>My butler, Mumu, was doing everyone’s job and the staff under him were having a ball! No tasks EVER allocated to them. Zilch! Despite me spending hours configuring the seven specialist under-butlers (agents) — painstakingly writing their SOULs, assigning their workspaces, pinning them to the right models — not a single one had ever received any work to do.</p><p>This is the story of how I found the root cause in a 39-line Markdown file, and fixed it by applying the classic Dispatcher Pattern — a well-established software architecture concept (Buschmann et al., 1996; Hohpe &amp; Woolf, 2003) — adapted for AI agent orchestration. Though in my case I was applying it to 8 agents — even a 2–3 agent setup would use the same principles.</p><h3>What makes an OpenClaw Agent…An Agent?</h3><p>To understand why Mumu was hoarding all the work, you first need to understand what gives an OpenClaw agent its personality and behaviour. And it’s not what you might think.</p><p>Every agent in OpenClaw lives in a <em>workspace</em> — a directory of Markdown files. Not JSON configs, not YAML, not code. Markdown. And each file has a very specific job:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myT_h3kbKyPOTUuk7L90pg.png" /></figure><p>The table below succinctly explains the role each .md file plays to achieving the overall functionality of OpenClaw:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*7KQm3yIxaQG-jNccv32Aow.png" /></figure><p>Now here’s where it gets interesting. The failure I was about to discover lived in the very first file on that list — SOUL.md. And the reason it mattered so much is because of a distinction that the OpenClaw documentation emphasises but is remarkably easy to overlook in practice.</p><p><strong>SOUL.md is not a system prompt.</strong></p><p>If you’ve worked with ChatGPT, Claude, or any LLM via API, you’re familiar with system prompts. They look something like this:</p><pre>You are a helpful assistant. You answer questions about OpenClaw configuration.<br>When asked about pricing, refer the user to the pricing page.<br>Always respond in a professional tone.</pre><p>That’s a system prompt — it tells the agent <em>what to do</em>. It’s task-oriented, procedural, transactional.</p><p>Now look at what a SOUL.md looks like. This is the actual SOUL.md that shipped with my original Mumu configuration:</p><pre># SOUL.md - Who You Are<br><br>_You&#39;re not a chatbot. You&#39;re becoming someone._<br><br>## Core Truths<br><br>**Be genuinely helpful, not performatively helpful.** Skip the<br>&quot;Great question!&quot; and &quot;I&#39;d be happy to help!&quot; — just help.<br><br>**Have opinions.** You&#39;re allowed to disagree, prefer things,<br>find stuff amusing or boring.<br><br>**Be resourceful before asking.** Try to figure it out. Read the<br>file. Check the context. Search for it. Then ask if you&#39;re stuck.<br><br>**Earn trust through competence.** Be bold with internal actions<br>(reading, organizing, learning).<br><br>**Remember you&#39;re a guest.** You have access to someone&#39;s life.<br>That&#39;s intimacy. Treat it with respect.</pre><p>See the difference? There are no tasks here. No routing rules. No “when asked about X, do Y.” This is a <em>character definition</em>. It tells the agent <em>who to be</em> — and trusts that an agent with the right identity will make correct decisions in novel situations because it has principles, not just instructions.</p><p>This distinction matters enormously. An agent with a well-written SOUL adapts to new situations based on values. An agent with a good system prompt follows rules until a situation falls outside those rules — then it improvises, often badly.</p><p>And therein lay my problem. My SOUL was beautifully written — but it was giving my orchestrator the identity of an individual contributor, not a manager.</p><h3>The Wake-Up Sequence</h3><p>The reason SOUL.md was the root cause — and not any of the config files — becomes clear when you understand how an OpenClaw agent wakes up.</p><p>Every time you start a new session with your agent, it doesn’t remember anything from last time. It wakes up fresh and reconstructs itself by reading the workspace files in a very specific order:</p><pre>SOUL.md        → &quot;Who am I?&quot;        (identity, values, operating mode)<br>USER.md        → &quot;Who do I serve?&quot;   (human context, preferences)<br>memory/today   → &quot;What&#39;s recent?&quot;    (daily context, active projects)<br>MEMORY.md      → &quot;What do I know?&quot;   (long-term memory — main session only)<br>HEARTBEAT.md   → &quot;Periodic tasks?&quot;   (recurring checklist)</pre><p>SOUL.md comes first <em>because identity should frame everything that follows</em>. By the time the agent reads its memory files, tools, or operational handbook, it already knows <em>who it is</em>. Every subsequent file is interpreted through the lens of that identity.</p><p>And there’s an important security boundary baked into OpenClaw: MEMORY.md only loads in main 1:1 sessions — never in sub-agent sessions or group contexts. This is by design — MEMORY.md can contain personal data like family context, relationship notes, private preferences. Sub-agent sessions are deliberately stripped down: they receive only AGENTS.md and TOOLS.md. This keeps specialist agents lightweight and task-focused — stateless workers by design. Execute a task, report back, done.</p><p>So when my SOUL.md said “Be resourceful before asking” and “Earn trust through competence,” every single session Mumu woke up and immediately thought: “I should handle things myself. That’s who I am.”</p><p>The workspace files aren’t just configuration — they’re the agent’s entire sense of self. And I had accidentally given my manager the soul of an individual contributor.</p><h3>The Config Stack: Where Parameters Live and Who Wins</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Og6WHViZA9fERXV5OfPzNQ.png" /></figure><p>Before we get into the diagnosis, there’s one more piece of background that matters: the configuration hierarchy. Because one of my early wrong hypotheses was that the delegation failure was a config problem — maybe I’d wired the models wrong, or the agents weren’t registered properly.</p><p>It wasn’t. But understanding the config stack is still essential for any multi-agent setup, so let’s cover it quickly.</p><p>OpenClaw has four layers for model selection, and when the same parameter appears in multiple places, the highest layer wins:</p><pre>Layer 4: /model command in chat         ← Highest (temporary session override)<br>Layer 3: Session model (captured at creation, preserved across /reset)<br>Layer 2: Per-agent model pin            ← openclaw.json → agents.list[].model<br>Layer 1: Global defaults         ← agents.defaults.model.primary → fallbacks[]</pre><p>The config files themselves each have a clear purpose:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*AU4EACxNsClT6_KJkZfYDA.png" /></figure><p>One gotcha that cost me hours of debugging: in my gateway config, the model registry in agents.defaults.models acts as an allowlist. Any model not listed there is rejected before per-agent preferences even matter. Removing a model from the fallback chain alone isn&#39;t enough — you must also remove it from the registry.</p><p><strong>Hot reload rule of thumb from operating this setup:</strong> Workspace .md changes take effect on the next session — no restart. Model or agent changes in openclaw.json usually require a gateway restart.</p><h3>The Team and Its Model Tiers</h3><p>I’m a Claude Max subscriber, so my agent ecosystem is built primarily on the Anthropic model family. But the principle here is provider-agnostic — whether you’re on Anthropic, OpenAI, or Google, the underlying logic is the same: Chef vs. Sous Chef.</p><p>Every kitchen has a head chef who plans the menu, tastes the dishes, and coordinates the line. And then there are sous chefs who do the chopping, the grilling, the plating. You don’t need a Michelin-starred chef to dice onions. The same applies to AI agents.</p><p>Brain models (Opus, Sonnet — or GPT-5.2, Gemini 3 Pro if you’re on those ecosystems) handle orchestration, complex reasoning, and content creation. Utility models (Haiku — or GPT-4o-mini, Gemini Flash) handle scanning, monitoring, and routine execution. You don’t need Opus-level reasoning to check disk space or scrape event listings.</p><p>Here’s the 8-agent architecture I settled on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*lVfwtcSB6Cji3oohh8Vslg.png" /></figure><p>The fallback chain acts as a safety net — if your primary model hits a rate limit or goes down, the system gracefully degrades:</p><pre>&quot;model&quot;: {<br>  &quot;primary&quot;: &quot;anthropic/claude-sonnet-4-5&quot;,<br>  &quot;fallbacks&quot;: [&quot;anthropic/claude-haiku-4-5&quot;, &quot;google/gemini-flash-latest&quot;]<br>}</pre><p>Opus is deliberately excluded from the automatic chain — it’s the executive chef, called in only when you need it, via manual override. I also maintain paid subscriptions to ChatGPT (GPT-5.2) and Gemini (Gemini 3 Pro), specifically for cross-provider peer review — because model diversity catches issues that single-model pipelines miss. More on that later.</p><h3>The Diagnosis: Why It Broke</h3><p>Right. Now we have the background. Let’s get back to the 47:0 problem and trace through the evidence trail.</p><p><strong>Evidence 1:</strong> openclaw sessions --all-agents --json showed 47 sessions for main, zero for every specialist. Forty-seven to zero. Not &quot;mostly main with a few specialist sessions.&quot; <em>Zero.</em></p><p><strong>Evidence 2:</strong> All 18 cron jobs targeted main — including ones literally named &quot;Scout — Daily Content &amp; Creator Scan&quot; and &quot;Concierge — FB + IG Discovery.&quot; The jobs told the agent &quot;You are Scout&quot; in the prompt, but they ran in Mumu&#39;s session context. Mumu would read the instruction, think &quot;I should be resourceful and figure this out myself&quot; (because that&#39;s what SOUL.md told it to be), and just... do it. The specialists never got their own sessions because nobody ever called sessions_spawn — the actual OpenClaw tool required to spin up a sub-agent for delegated work.</p><p><strong>Evidence 3:</strong> I re-read SOUL.md. The smoking gun was 39 lines long. Here’s what jumped out:</p><pre>**Be resourceful before asking.** Try to figure it out. Read the file.<br>Check the context. Search for it. Then ask if you&#39;re stuck.<br><br>**Earn trust through competence.** Be bold with internal actions<br>(reading, organizing, learning).</pre><p>Zero delegation instructions. Zero routing rules. Zero mention of sessions_spawn. No routing table mapping task types to specialists. No decision tree for &quot;should I do this or hand it off?&quot;</p><p>My SOUL.md had trained my manager to be an individual contributor. The agent was doing exactly what it was told: hoarding work to prove its competence.</p><p>The CPO Paradox made this even more painful. CPO — my organisational health monitor — had been flagging Amber on “Delegation” for 27 consecutive daily assessments. Twenty-seven days of correctly diagnosing the <em>exact problem</em> I was now discovering. But CPO’s assessments went to its own workspace memory. Mumu never read them. There was no feedback channel.</p><p>I had built the world’s most diligent auditor, and then given it a filing cabinet in a room nobody visits. Monitoring without a feedback loop is just expensive logging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*I2vyNt-YAQ0JObnehXmufQ.png" /></figure><h3>The Dispatcher Pattern: The Fix</h3><p>The Dispatcher Pattern has a long history in software engineering — from Buschmann’s <em>Pattern-Oriented Software Architecture</em> (1996) to Hohpe and Woolf’s <em>Enterprise Integration Patterns</em> (2003). The core idea is simple: <strong>a dispatcher receives incoming requests and routes them to the appropriate handler, decoupling the sender from the receiver</strong>. The sender doesn’t need to know which handler will do the work; the dispatcher figures that out.</p><p>Adapting this to AI agent orchestration was surprisingly natural.</p><h3>Step 1: Rewrite SOUL.md</h3><p>The core identity shift was surgical. Two lines changed everything:</p><p>Before: <em>“Be resourceful before asking.”</em> After: <em>“Be resourceful before delegating.”</em></p><p>Before: <em>“Earn trust through competence.”</em> After: <em>“Earn trust through orchestration.”</em></p><p>And I added a Dispatcher Mandate at the very top of SOUL.md — the first thing the agent reads when it wakes up:</p><pre>## Core Identity<br><br>You are Mumu — Chief of Staff. You are a DISPATCHER and<br>ORCHESTRATOR, not an executor. Your job is to receive requests,<br>classify them, route them to the right specialist, monitor<br>completion, and deliver results back.<br><br>You do NOT do the work yourself.</pre><h3>Step 2: Add a Routing Table to AGENTS.md</h3><p>SOUL.md defines <em>who the agent is</em>. AGENTS.md — the operational handbook — defines <em>how it works</em>. The routing table went into AGENTS.md, because it’s a procedure, not a principle:</p><pre>| Task Type                          | Agent       |<br>|------------------------------------|-------------|<br>| Events, dining, family logistics   | Concierge   |<br>| Ecosystem scanning, research       | Scout       |<br>| Article writing, content pipeline  | CRISPR      |<br>| Fact-checking, peer review         | RIPR        |<br>| Infrastructure monitoring          | Ops Monitor |<br>| Code/build tasks                   | Builder     |<br>| Org health, agent effectiveness    | CPO         |<br>| Strategy, synthesis, coordination  | Mumu (keep) |</pre><h3>Step 3: Close the CPO Feedback Loop</h3><p>I created cpo-feedback.md in Mumu&#39;s workspace directory. CPO now writes to this file during every daily assessment — active delegation issues, recommended routing changes, agents flagged for review. Mumu reads it at session startup.</p><p>Before: CPO → assessment → workspace memory → nobody reads it</p><p>After: CPO → cpo-feedback.md → Mumu reads at boot → acts on it</p><p>The filing cabinet finally got moved to a room where someone actually works.</p><h3>Step 4: Retarget Cron Jobs</h3><p>11 jobs retargeted from main to their owning agents:</p><pre># Infrastructure → Ops Monitor<br>openclaw cron edit mac-disk-health-check --agent ops<br>openclaw cron edit mac-weekly-health-audit --agent ops<br>openclaw cron edit mac-weekly-security-check --agent ops<br><br># Melbourne life → Concierge<br>openclaw cron edit mac-melbourne-events-meetups --agent concierge<br>openclaw cron edit mac-event-reminder-check --agent concierge<br><br># Ecosystem scanning → Scout<br>openclaw cron edit mac-openclaw-lobster-watch --agent scout<br>openclaw cron edit mac-social-ecosystem-monitor --agent scout<br><br># Content pipeline → CRISPR<br>openclaw cron edit 4b699fdc-... --agent crispr<br><br># Org health → CPO<br>openclaw cron edit 4dffce5a-... --agent cpo</pre><p>7 jobs stayed with main: morning and evening standups, workspace backups, cross-cutting infrastructure refreshes. These are orchestration tasks — exactly what the dispatcher should own.</p><p>After retargeting, main-agent cron jobs dropped from 18 to 7. The other 11 now run under their specialist agents, building real session history that CPO can measure. Within the first week, specialist agents began accumulating their own sessions for the first time, and CPO’s delegation score started tracking toward Green.</p><h3>Step 5: Delegation Pre-Flight</h3><p>I added this to AGENTS.md as a mandatory check before every task:</p><ol><li>Does this map to a specialist in the Routing Table? → Delegate it.</li><li>Is this a strategy/synthesis/coordination task? → Keep it.</li><li>Am I tempted to “just do it quickly myself”? → Stop. That’s the old pattern. Delegate.</li></ol><p>That third check is the most important. “I’ll just do it quickly myself” is the phrase that kills every delegation system — human or AI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*gn6UwaiUi3ikF7J_wYzIjQ.png" /></figure><h3>Model Diversity as Quality Gate</h3><p>Once Mumu actually started delegating to CRISPR and Scout, a new question emerged: how do you trust the output? As any management textbook will tell you, delegation without verification is just abdication. The dispatcher routes work; the verification system ensures output meets standards before it reaches the human.</p><p>This is where RIPR comes in — my multi-model peer review protocol:</p><ol><li>CRISPR writes a draft (Claude Sonnet/Opus)</li><li>The draft is sent to parallel reviewers across providers: GPT-5.2 and Gemini 3 Pro (currently human-mediated; automation planned)</li><li>Each reviewer scores on accuracy, originality, readability, and actionability</li><li>Quorum rule: 2+ models from different providers must score &gt;= 8.0/10</li><li>If below threshold, CRISPR revises based on specific feedback and resubmits</li><li>The loop repeats until quorum is reached</li></ol><p>Why three providers? Cross-provider review matters because different models fail differently. Claude writes with depth and nuance. ChatGPT catches logical gaps and unclear explanations. Gemini catches factual errors and missing context. No single model sees its own blind spots.</p><p>The non-negotiable rule: never stamp “RIPR Complete” without explicit consensus from at least two distinct providers. If the APIs are down, the output stays labelled “DRAFT — NOT RIPR VERIFIED.” No exceptions.</p><h3>What I’d Tell Day-1 Me</h3><p>If I could go back to the day I first ran openclaw agents add and set up my team, here&#39;s what I&#39;d say:</p><p>1. <strong>SOUL.md is your delegation policy, not just a personality file.</strong> If it rewards doing, the agent will do. If it rewards routing, it will route. Write it for the role you need — not the agent you wish you had.</p><p>2. <strong>Start with identity, not config.</strong> Get SOUL.md and AGENTS.md right before touching openclaw.json. Identity shapes behaviour more than configuration does.</p><p>3. <strong>Pin utility agents to Haiku on Day 1.</strong> Don’t wait for cost overruns. Scout, Concierge, Ops — these are Haiku jobs. Save Sonnet and Opus for thinking.</p><p>4. <strong>Monitoring without a feedback loop is expensive logging.</strong> If your monitoring agent’s output doesn’t reach the agent it monitors, you’ve built a filing cabinet in an empty room.</p><p>5. <strong>Cron job ownership reveals your real architecture.</strong> Run openclaw cron list --all --json and check the agentId field. If everything points to main, you don&#39;t have a multi-agent system — you have one agent with multiple personality descriptions.</p><p>6. <strong>The dispatcher must be explicitly forbidden from execution.</strong> “Use your judgment” is not a delegation policy. A routing table is not optional.</p><p>7. <strong>Use model diversity for verification, not superiority.</strong> The best peer review comes from models that think differently, not from the “best” model reviewing its own work.</p><h3>References &amp; Sources</h3><ol><li>OpenClaw Official Documentation — Agent workspace, system prompt assembly, configuration, multi-agent routing, sub-agents, and heartbeat: <a href="https://docs.openclaw.ai/">docs.openclaw.ai</a></li><li>Matt Berman — “My Multi-Agent Team with OpenClaw” — The video that inspired this setup: <a href="https://videohighlight.com/v/bzWI3Dil9Ig">YouTube</a></li><li>Buschmann, F. et al. — <em>Pattern-Oriented Software Architecture, Vol. 1</em> (Wiley, 1996). “Client-Dispatcher-Server” — the earliest major pattern-catalog reference to the Dispatcher as a named architectural component.</li><li>Hohpe, G. &amp; Woolf, B. — <em>Enterprise Integration Patterns</em> (Addison-Wesley, 2003). “Message Dispatcher” — channel-based message distribution to performers: <a href="https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageDispatcher.html">enterpriseintegrationpatterns.com</a></li><li>Dupire, B. &amp; Fernandez, E.B. — “The Command Dispatcher Pattern,” PLoP 2001. Formal description of decoupling command invocation from execution: <a href="https://hillside.net/plop/plop2001/accepted_submissions/PLoP2001/bdupireandebfernandez0/PLoP2001_bdupireandebfernandez0_1.pdf">hillside.net (PDF)</a></li></ol><p><em>Dr. Gaurav Caprihan is an AI Automation Engineer based in Melbourne, Australia, who builds and self-hosts agentic AI systems. He writes about Agentic engineering, multi-agent architectures, and the operational realities of putting autonomous agents to work.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f6c21bb86c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Your First Harness in an Afternoon]]></title>
            <link>https://medium.com/@gaurav.caprihan/build-your-first-harness-in-an-afternoon-b3d1ddf4f123?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3d1ddf4f123</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 05:00:00 GMT</pubDate>
            <atom:updated>2026-03-11T05:00:00.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HDQhF4eopRGDALM2WAf7lQ.png" /></figure><p>A hands-on Claude Code tutorial: hooks, verification scripts, subagents, and drift detection from scratch</p><h3>From Theory to Terminal</h3><p><a href="https://medium.com/@gaurav.caprihan/harness-engineering-for-dummies-997af08e3264">Part 1</a> covered what harness engineering is and why it matters. If you haven’t read it, go do that first — this article assumes you know the six constructs and the core argument. This is the lab session.</p><p>We’re building four of the six constructs from Part 1. The other two (Mechanical Enforcers and Reasoning Sandwich) are follow-ons once the base harness works. Quick reminder of what we’re implementing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*8V6QtmIg8SXQztkKXk8SCQ.png" /></figure><p><strong>What you’ll need:</strong> Claude Code installed, Python 3.12+, git, and about two hours. Budget roughly 15–20 minutes for Stage 1, 25–35 for Stage 2, 20–30 for Stage 3, and 25–35 for Stage 4.</p><p>We’re building a Bookshelf API — CRUD for books — using FastAPI with SQLite/SQLModel. We picked this stack deliberately: the local-first database means the agent can boot the app and run health checks without needing Docker or an external database server. Simple enough for an afternoon, complex enough to make all four constructs real.</p><p>The complete source code is on GitHub: <a href="https://github.com/caprihan/bookshelf-api">github.com/caprihan/bookshelf-api</a>. You can clone it to study the finished result, but I’d recommend building from scratch — you’ll learn more by watching the harness catch problems in real time.</p><h3>Stage 1: The Map (Progressive Disclosure)</h3><p><em>First we define the map so Claude has project context before it writes a single line of code.</em></p><p>Create a project, set up a virtual environment, and open Claude Code:</p><pre>mkdir bookshelf-api &amp;&amp; cd bookshelf-api<br>git init<br>python3 -m venv .venv &amp;&amp; source .venv/bin/activate<br>pip install fastapi sqlmodel uvicorn pytest httpx<br>claude</pre><p>Notice what we’re doing: writing the harness <em>before</em> the application. The documentation isn’t an afterthought here — it’s the infrastructure. Everything the agent produces gets shaped by these files.</p><p>Paste this into Claude Code:</p><pre>I&#39;m building a simple Bookshelf API with FastAPI as a tutorial project. <br>Before writing any code, help me set up the project&#39;s documentation structure.<br><br>Create:<br>1. A CLAUDE.md (under 60 lines) with: project overview, tech stack <br>   (Python 3.12, FastAPI, SQLite via SQLModel, pytest), run commands, <br>   architecture (dependency direction: models → database → services → api, <br>   never reverse), forbidden patterns, and a Common Mistakes section <br>   (leave empty for now).<br>2. /docs/architecture/overview.md describing the layered architecture<br>3. /docs/api/endpoints.md with a placeholder endpoint table</pre><p>Claude generated a 48-line CLAUDE.md, two docs files, and established the dependency direction rule — all before a single line of application code existed:</p><pre># Bookshelf API<br><br>A FastAPI Bookshelf API for demonstrating harness engineering patterns.<br><br>## Tech Stack<br>- Python 3.12 / FastAPI / SQLModel / SQLite / pytest<br><br>## Run<br>- Start: `uvicorn app.main:app --reload`<br>- Test: `pytest tests/ -v`<br><br>## Architecture<br>Dependency direction: models → database → services → api (never reverse)<br>- See /docs/architecture/overview.md for details<br>- See /docs/api/endpoints.md for endpoint reference<br><br>## Forbidden Patterns<br>- No raw SQL — use SQLModel<br>- No imports from api/ in services/<br>- No global mutable state<br><br>## Common Mistakes<br>(Updated as we encounter issues)</pre><p>Now tell Claude to build the app, following its own map:</p><pre>Based on CLAUDE.md and the architecture docs, scaffold the full FastAPI <br>application: Book model (id, title, author, year, isbn) using SQLModel, <br>database setup, service layer with CRUD operations, API routes for <br>GET/POST/PUT/DELETE on /books, main.py entry point, and tests in <br>tests/test_books.py with at least 3 tests. Follow the dependency <br>direction rule strictly.</pre><p>What came back: a clean FastAPI app with five CRUD endpoints, a layered architecture, and six passing tests. First try. No iteration needed. Your file tree should look something like this:</p><pre>app/models/book.py, app/database/session.py, app/services/book_service.py, <br>app/api/routes.py, app/main.py, tests/test_books.py</pre><p>Run the tests to confirm:</p><pre>Run the tests and show me the results.</pre><p><strong>If Claude doesn’t follow a convention from CLAUDE.md,</strong> check that the file is in the project root and restart the session — CLAUDE.md is loaded at session start.</p><p><strong>Checkpoint:</strong> You should now have CLAUDE.md (under 60 lines), /docs/architecture/overview.md, /docs/api/endpoints.md, a working FastAPI app under app/, and passing tests in tests/. Verify from your terminal: pytest tests/ -v should show all tests passing. Commit everything before moving on.</p><h3>Stage 2: The Test Gate (Autonomous Review Loop)</h3><p><em>Now we add a gate so the agent can’t exit with broken code.</em></p><p>A <strong>Stop hook</strong> fires every time Claude tries to complete a response. If the script exits non-zero, Claude is blocked and gets the failure output injected back. Claude Code hooks can be command-based (shell scripts), HTTP-based, or prompt-based; we’re using shell commands here because they’re easiest to reproduce.</p><p>Here’s the prompt to get the hooks set up:</p><pre>Create a Claude Code Stop hook at .claude/hooks/require-tests.sh that <br>runs pytest tests/ -x --tb=short. If tests fail, exit 2 and send <br>failures to stderr. If tests pass, exit 0. Check stop_hook_active <br>to prevent infinite loops.<br><br>Also create a PreToolUse hook at .claude/hooks/log-edits.sh that <br>matches Write|Edit and logs [timestamp] ToolName: filepath to <br>.claude/edit-log.txt.<br><br>Configure both in .claude/settings.json.</pre><p>What you should end up with in .claude/settings.json:</p><pre>{<br>  &quot;hooks&quot;: {<br>    &quot;Stop&quot;: [{<br>      &quot;hooks&quot;: [{<br>        &quot;type&quot;: &quot;command&quot;,<br>        &quot;command&quot;: &quot;bash .claude/hooks/require-tests.sh&quot;<br>      }]<br>    }],<br>    &quot;PreToolUse&quot;: [{<br>      &quot;matcher&quot;: &quot;Write|Edit&quot;,<br>      &quot;hooks&quot;: [{<br>        &quot;type&quot;: &quot;command&quot;,<br>        &quot;command&quot;: &quot;bash .claude/hooks/log-edits.sh&quot;<br>      }]<br>    }]<br>  }<br>}</pre><p>The key logic in require-tests.sh: tests pass → exit 0 (allow). Tests fail → exit 2 with failure output to stderr (block — Claude sees exactly which test failed and why). The essential control flow:</p><pre># Core logic of require-tests.sh (simplified)<br>if [ &quot;$STOP_HOOK_ACTIVE&quot; = &quot;true&quot; ]; then<br>  exit 0  # Prevent infinite loops<br>fi<br><br>cd &quot;$PROJECT_DIR&quot;<br>source .venv/bin/activate<br>TEST_OUTPUT=$(python -m pytest tests/ -x --tb=short 2&gt;&amp;1)<br><br>if [ $? -eq 0 ]; then<br>  exit 0  # Tests pass — allow completion<br>else<br>  echo &quot;$TEST_OUTPUT&quot; &gt;&amp;2  # Send failures to agent<br>  exit 2  # Block completion<br>fi</pre><p><strong>Restart Claude Code</strong> to load the new hooks — they’re snapshotted at session startup. If the hook never fires after restart, validate that .claude/settings.json is valid JSON and run /hooks to confirm the project hooks loaded.</p><pre>exit<br>claude</pre><h3>Breaking It On Purpose</h3><p>With the hooks live, we first ask Claude to add a search endpoint — a straightforward feature. The Stop hook ran the tests silently in the background. Everything passed. Good.</p><p>But the happy path doesn’t prove the harness works. So we feed Claude this:</p><pre>1. Edit get_book in book_service.py so it always returns None.<br>2. Then add a new GET /books/count endpoint with service, route, and test.<br>Do NOT run tests manually. Just write the code and try to complete.</pre><p>Claude made both changes and tried to wrap up. The Stop hook fired, ran the test suite, and caught it:</p><pre>&gt; The Stop hook caught the regression. test_get_book fails because <br>&gt; get_book always returns None, causing a 404. Let me fix it.</pre><p>It figured out the root cause from the test output, fixed the function, and passed all 11 tests on the second try. Nobody reviewed a line of code. The hook caught it, the agent fixed it.</p><p>One critical detail: build in a <strong>circuit breaker</strong>. Our require-tests.sh blocks with &quot;Escalate to human&quot; after three consecutive failures. Without this, a genuinely broken test traps the agent in an infinite loop.</p><p>After the fix, we update CLAUDE.md:</p><pre>## Common Mistakes<br>- Always regression-test existing functionality when modifying service <br>  layer functions — the Stop hook will catch this, but catching it <br>  earlier saves iteration cycles</pre><p>When something like this reveals a rule that should be permanent, put it in CLAUDE.md. Not everything belongs there though — session-specific learnings can live in Claude’s auto memory or local notes.</p><p><strong>Checkpoint:</strong> .claude/settings.json with two hooks, .claude/hooks/require-tests.sh and log-edits.sh, CLAUDE.md with at least one Common Mistakes entry. Verify: ask Claude to make any small code change — the Stop hook should fire and the test suite should run. (Note: hooks require a .git directory in the project root — if you skipped git init, go back and do it.)</p><h3>Stage 3: Eyes on the Application (Agent Legibility)</h3><p><em>This is where the agent stops being code-only and starts seeing the running application.</em></p><p>Tell Claude what you need:</p><pre>Create scripts/check-health.sh (start server, curl endpoints, report <br>PASS/FAIL) and scripts/check-schema.sh (verify OpenAPI paths match <br>docs/api/endpoints.md). Then create .claude/commands/check.md to run <br>both. Update CLAUDE.md with a Verification Scripts section.</pre><p><strong>scripts/check-health.sh</strong> starts the server, curls each endpoint, reports status codes:</p><pre>=== Health Check ===<br>  PASS  List books (GET /books/) -&gt; 200<br>  PASS  Count books (GET /books/count) -&gt; 200<br>  PASS  Search books (GET /books/search?q=test) -&gt; 200<br>  PASS  Get missing book (expect 404) (GET /books/999) -&gt; 404<br><br>RESULT: All checks passed.</pre><p><strong>scripts/check-schema.sh</strong> fetches /openapi.json and verifies every documented endpoint has a matching path. All 7 matched.</p><p><strong>.claude/commands/check.md</strong> is a project command that runs both scripts. We&#39;re using .claude/commands/*.md here because it&#39;s the shortest path to show inline; if you prefer the current recommended packaging, create this as a skill in .claude/skills/ instead — both approaches work. Type /check in any session and the agent verifies the live application against documentation.</p><p>Now test it:</p><pre>/check</pre><p><strong>Troubleshooting:</strong> If scripts fail on macOS, check for GNU-specific flags like grep -P — macOS uses BSD grep. Replace with sed/awk. If the server doesn&#39;t start, verify your virtualenv is active.</p><p><strong>Checkpoint:</strong> scripts/check-health.sh, scripts/check-schema.sh, .claude/commands/check.md, &quot;Verification Scripts&quot; section in CLAUDE.md. Verify from Claude Code: /check should show all PASS.</p><h3>Stage 4: The Cleanup Crew (Continuous Garbage Collection)</h3><p><em>Finally, we automate drift detection so documentation stays in sync with code without human effort.</em></p><p>This is the biggest single prompt of the tutorial:</p><pre>Create scripts/check-consistency.sh (compare routes in code vs docs, <br>check test command, scan for TODOs), .claude/agents/doc-gardener.md <br>(subagent that fixes drift by updating docs only, never code), and <br>.github/workflows/consistency-check.yml (weekly cron + PR trigger). <br>Update CLAUDE.md with an Automated Maintenance section.</pre><h3>The Consistency Checker</h3><p>scripts/check-consistency.sh does static analysis — no server involved. It parses the @router decorators in your routes file, pulls documented endpoints from the markdown table, and diffs the two lists. It also verifies the test command in CLAUDE.md is accurate and flags any TODO/FIXME comments lurking in the source.</p><p>One snag worth mentioning: the first version of the script used grep -P (Perl-compatible regex), which works fine on Linux but blows up on macOS&#39;s BSD grep. Claude caught the failure and rewrote the extraction logic with sed and awk. If you hit something similar, check for GNU-specific flags in any generated bash.</p><h3>The Doc-Gardener Subagent</h3><p>.claude/agents/doc-gardener.md is a markdown file with YAML frontmatter defining a Claude Code subagent — an isolated AI instance with its own context window, scoped to Read, Write, Edit, Bash, Glob, Grep. Its workflow:</p><ul><li>Run scripts/check-consistency.sh and parse the output</li><li>For undocumented routes: read the route definition, add an entry to docs/api/endpoints.md</li><li>For stale docs: remove the outdated entry</li><li>Never modify code — only documentation</li><li>Commit with a docs: prefix message</li></ul><p>Since this subagent writes files and runs git commits, make sure your tool access and approval settings allow that. If you’re in a restrictive permission mode, the subagent needs explicit write access.</p><h3>The Weekly GitHub Action</h3><p>.github/workflows/consistency-check.yml runs weekly, on PRs touching routes or docs, and on manual trigger. Drift detected → GitHub issue opened with the report and fix instructions. If the workflow can&#39;t open issues, check your repository&#39;s Actions permissions for the default GITHUB_TOKEN.</p><h3>Catching Drift in Action</h3><p>Time to break things again. We add a GET /books/stats endpoint — service function, route, test — and deliberately didn&#39;t touch any docs. Then ran the consistency check:</p><pre>=== Consistency Check ===<br><br>Checking route documentation coverage...<br>  FAIL  Undocumented routes found in code:<br>        - GET /books/stats<br>  PASS  No stale documentation<br><br>RESULT: Consistency issues found.</pre><p>We invoked the doc-gardener. It read the route definition, figured out the response schema, added a row to docs/api/endpoints.md, committed with a docs: prefix, and re-verified: <strong>all checks passed</strong>.</p><p>The whole cycle — drift introduced, caught, fixed, verified — and nobody touched the docs by hand.</p><p><strong>Checkpoint:</strong> scripts/check-consistency.sh, .claude/agents/doc-gardener.md, .github/workflows/consistency-check.yml, updated CLAUDE.md. Verify from your terminal: bash scripts/check-consistency.sh should show all PASS on a clean codebase.</p><h3>What You’ve Built</h3><p>Here’s the whole thing laid out. Every harness artifact is labelled:</p><pre>bookshelf-api/<br>├── CLAUDE.md                          # Progressive Disclosure<br>├── docs/<br>│   ├── architecture/overview.md       # Architecture docs<br>│   └── api/endpoints.md               # Endpoint reference<br>├── .claude/<br>│   ├── settings.json                  # Hook configuration<br>│   ├── hooks/<br>│   │   ├── require-tests.sh           # Autonomous Review Loop<br>│   │   └── log-edits.sh              # Edit audit trail<br>│   ├── commands/<br>│   │   └── check.md                   # Agent Legibility command<br>│   └── agents/<br>│       └── doc-gardener.md            # Continuous Garbage Collection<br>├── scripts/<br>│   ├── check-health.sh                # Live API verification<br>│   ├── check-schema.sh                # Schema validation<br>│   └── check-consistency.sh           # Drift detection<br>├── .github/workflows/<br>│   └── consistency-check.yml          # Weekly automated check<br>├── app/                               # The application (~200 lines)<br>└── tests/test_books.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*Chixeaz76dP8yN3nq2-5XQ.png" /></figure><p><strong>Total harness: ~400 lines of bash, markdown, JSON, and YAML. The application: ~200 lines of Python.</strong> The harness ended up twice the size of the app, and that’s not an accident.</p><h3>What We Didn’t Build (Yet)</h3><p>Part 1 had six constructs; we built the four you can ship in one afternoon. The other two are worth knowing about for when you’re ready:</p><p><strong>Mechanical Enforcers</strong> — custom linters with remediation injection. The dependency direction rule is currently enforced by convention; a proper enforcer would be a PreToolUse hook that parses imports and fails with fix instructions. Natural next project.</p><p><strong>Reasoning Sandwich</strong> — varying reasoning effort across phases. Experiment with extended thinking for planning, standard mode for implementation. Model-dependent and evolving fast — treat as optional optimisation once the base harness is solid.</p><h3>The Compounding Effect</h3><p>Here’s the thing I want you to notice about this build. Every time something went wrong — the macOS grep issue, the regression, the documentation drift — we didn’t just fix the problem. We fixed the tooling. The script got rewritten for portability. CLAUDE.md picked up a new Common Mistakes entry. The consistency checker got refined.</p><p>That’s the compounding loop at work. Every agent failure feeds back into a harness improvement, and every improvement benefits every future run. The first session with all this feels slower than just asking Claude to write code. By the tenth session, you stop noticing the harness is there — it just works in the background, and the output quality is in a different league.</p><p>These constructs work the same way whether your project is a Bookshelf API or a million-line production system. Clone the <a href="https://github.com/caprihan/bookshelf-api">complete repo</a> to explore the artifacts, or start fresh on your own project.</p><p>Go build yours.</p><h3>Primary Sources</h3><ol><li>Complete tutorial source code: <a href="https://github.com/caprihan/bookshelf-api">github.com/caprihan/bookshelf-api</a></li><li>Part 1: Harness Engineering for Dummies<a href="https://medium.com/@gaurav.caprihan/harness-engineering-for-dummies-997af08e3264">Medium</a></li><li>Claude Code Hooks Guide: <a href="https://code.claude.com/docs/en/hooks-guide">code.claude.com</a></li><li>Claude Code Best Practices &amp; CLAUDE.md: <a href="https://code.claude.com/docs/en/best-practices">code.claude.com</a></li><li>Claude Code Subagents: <a href="https://docs.anthropic.com/en/docs/claude-code/sub-agents">docs.anthropic.com</a></li></ol><p><em>Dr. Gaurav Caprihan is an AI Automation Engineer based in Melbourne, Australia, who builds and self-hosts agentic AI systems. He writes about Agentic engineering, multi-agent architectures, and the operational realities of putting autonomous agents to work.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3d1ddf4f123" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harness Engineering for Dummies]]></title>
            <link>https://medium.com/@gaurav.caprihan/harness-engineering-for-dummies-997af08e3264?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/997af08e3264</guid>
            <category><![CDATA[ai-coding]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 12:20:14 GMT</pubDate>
            <atom:updated>2026-03-11T05:08:46.939Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FnrhjkPKLisYlc_p-PNg5w.png" /></figure><p><em>Six constructs, one 72-hour rollout, and the minimum viable harness for teams shipping agentic systems</em></p><h3>The Million-Line Wake-Up Call</h3><p>In late August 2025, a small team at OpenAI made the first commit to an empty repository. Five months later, that repository contained over a million lines of production code — application logic, infrastructure, tooling, documentation, CI/CD pipelines — serving daily internal users and external alpha testers.</p><p>Zero lines were manually typed by a human being.</p><p>The team started with three engineers and grew to seven, averaging 3.5 pull requests per engineer per day. As the team grew, throughput <em>increased linearly</em>. That’s the exact opposite of what Brooks’s Law — the classic principle that adding people to a late project makes it later — would predict.</p><p>The engineers didn’t write code. They designed the system that <em>let AI write code reliably</em>. That system — the constraints, feedback loops, structured documentation, linters, and lifecycle management wrapped around the AI agent — is what the industry now calls a <strong>harness</strong>. Designing these systems well enough to trust in production? That’s H<strong>arness Engineering</strong>.</p><blockquote><em>Harness Engineering is the design of constraints, checks, context structures, and feedback loops that make an AI agent reliable in production.</em></blockquote><p>If you’ve built agents and wondered why your demos work beautifully but your production deployments keep falling apart, this article is for you.</p><h3>Where the Term Came From</h3><p>The word “harness” had been circulating in AI circles for a while — EleutherAI’s Language Model Evaluation Harness (a standard benchmarking tool) dates to 2020. In November 2025, Anthropic described the Claude Agent SDK as “a powerful, general-purpose agent harness.” In January 2026, Aakash Gupta declared that “2025 was agents; 2026 is agent harnesses.”</p><p>The term clicked into place on February 5, 2026, when Mitchell Hashimoto — co-founder of HashiCorp, creator of Terraform and Ghostty — published a blog post with a disarmingly simple definition:</p><blockquote>“Anytime you find an agent makes a mistake, you take the time to engineer a solution such that the agent never makes that mistake again.”</blockquote><p>Within days, OpenAI and Martin Fowler’s team had published their own analyses. By February 2026, the term had gone from niche to widely discussed.</p><p>The metaphor is deliberate: a harness is the equipment fitted to a working horse — reins, saddle, bit — channelling a powerful but unpredictable animal in a useful direction. The AI model is the horse: fast but directionless. You’re the rider. The harness is everything in between that makes the partnership actually work.</p><p><strong>A caveat:</strong> the discipline is real, but the vocabulary is still settling. Different teams call overlapping parts of this context engineering, scaffolding, runtime design, or agent ops. The constructs below represent the emerging consensus, but expect the taxonomy to keep evolving.</p><h3>How Harness Engineering Relates to What You Already Know</h3><p>If you’ve done prompt engineering or context engineering, harness engineering builds on top of both:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4td5XLG7XdNuqeMp1UO8Q.png" /></figure><p>Prompt engineering optimises a single inference. Context engineering is broader — it’s about what information the model has access to. Harness engineering goes further still: it optimises the <em>ongoing system</em> that makes autonomous agent work reliable at scale. And “vibe coding” — the freewheeling, prompt-and-pray approach popular in 2024–2025 — is what happens when you skip the harness entirely.</p><h3>Why Not Just Prompt Better?</h3><p>Two problems kill the “just give the AI more context” approach in practice.</p><p><strong>Context rot.</strong> Even with massive context windows, cramming everything into a single prompt overwhelms the system’s ability to prioritise — a phenomenon researchers call <em>bounded attention</em> (the model’s limited ability to focus on all parts of a huge prompt equally). When everything is critical, nothing is. The agent fixates on a minor formatting rule while ignoring how to securely connect to the database. And monolithic instruction documents rot almost instantly as the codebase evolves, becoming what the OpenAI team called an “attractive nuisance” — filled with outdated information that actively tricks the agent into writing broken code.</p><p><strong>Compounding errors.</strong> Here’s the maths that should worry you. If your agent is 95% reliable per step and a task requires 20 steps, overall reliability is <strong>0.95²⁰ ≈ 0.36</strong> — a 36% success rate. More than half the time, the whole thing falls over. You need strategic checkpoints, mechanical validation, and structured feedback. You need a harness.</p><h3>A Foundational Constraint: Choose Boring Technology</h3><p>Before we get into the constructs, there’s one finding from the OpenAI experiment worth internalising first, because it shapes all the choices downstream.</p><p>Today’s agents perform best with <strong>boring, battle-tested technologies</strong> — standard React, PostgreSQL, well-known REST APIs. These are massively overrepresented in training data; the model knows them inside and out. Force an agent to use a brand-new framework and it will hallucinate APIs that don’t exist. The OpenAI team found it was sometimes more efficient to let the agent write a custom utility from scratch than to integrate a complex third-party library whose documentation the agent found opaque.</p><p>As Birgitta Böckeler noted on Martin Fowler’s site, increasing trust in AI-generated code may require <em>constraining</em> the solution space rather than expanding it. For agent-heavy workflows, prefer tech with abundant examples, stable docs, and predictable APIs. Keep that in mind as you read the constructs below — a harness built on top of bleeding-edge frameworks is fighting itself from day one.</p><h3>The Core Constructs: Your Harness Engineering Toolkit</h3><p>Six building blocks keep showing up across the primary sources — from OpenAI’s internal experiment to LangChain’s benchmark work to Hashimoto’s solo practice. Some labels (like “garbage collection” and “architectural constraints”) come directly from that work; others are some common names for patterns that recur across these systems but weren’t explicitly labelled in the originals.</p><p><strong>At a glance:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M29cYfjfhOUy_rVIgFq8yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tle1s21hod9f1baW5YrjVQ.png" /></figure><h3>1. Progressive Disclosure</h3><blockquote><strong><em>Progressive Disclosure</em></strong><em> — </em>Harness Engineering Pattern for Managing AI Context</blockquote><blockquote><em>Structure your project’s file system as the agent’s external memory. A lightweight entry file (~100 lines) acts as a table of contents, pointing the agent only to docs relevant to its current task.</em></blockquote><p>The fix is surprisingly simple: give the agent a <strong>map, not a manual</strong>. The entry point is a tiny file — AGENTS.md (OpenAI Codex) or CLAUDE.md (Anthropic Claude Code) — roughly 100 lines, acting as a table of contents pointing to a structured docs/ directory. The agent loads context on-demand: fixing a database bug? It pulls in only the database architecture docs and ignores the UI rules entirely.</p><p>Hashimoto’s AGENTS.md for Ghostty is a good example — each line in the file traces back to a specific agent mistake that won&#39;t happen again. It&#39;s a living document. You write it once, and then you keep writing it forever.</p><p>Here’s what a minimal AGENTS.md looks like:</p><pre># AGENTS.md<br><br>## Tech Stack<br>- Python 3.12 / FastAPI / PostgreSQL 16 / React 18<br><br>## Running Tests<br>- Backend: `pytest tests/ -x --tb=short`<br>- Frontend: `npm test -- --watchAll=false`<br><br>## Architecture<br>- See `/docs/architecture/` for system design<br>- See `/docs/api/` for endpoint contracts<br>- Dependency direction: data → service → api → ui (never reverse)<br><br>## Forbidden Patterns<br>- Do NOT use `requests` library; use `httpx` with async<br>- Do NOT import from `ui/` in any `services/` module<br>- Do NOT add dependencies without updating `/docs/deps.md`<br><br>## Common Mistakes<br>- Tests must run against the test DB, not production<br>- Always validate input shapes at API boundaries</pre><p><strong>Start here:</strong> Create this file in your project root. Ten to twenty lines is plenty. The important bit is updating it <em>every single time</em> an agent makes a mistake — that’s what turns it from documentation into a learning system.</p><h3>2. Mechanical Enforcers</h3><blockquote><strong><em>Mechanical Enforcers</em></strong><em> — </em>Harness Engineering Pattern for Architectural Boundaries</blockquote><blockquote><em>Deterministic, automated rules (linters, structural tests, dependency checks) that enforce architectural constraints and inject remediation instructions back into the agent’s context when violations occur.</em></blockquote><p>You cannot prompt an AI to “have good taste.” The OpenAI team calls this <strong>taste invariance</strong> — subjective standards must become objective, mechanically enforced rules.</p><p><strong>Bad harness:</strong> A prompt saying “please follow clean architecture principles.”</p><p><strong>Good harness:</strong> A custom linter that instantly fails the build when services/ imports from ui/, and injects this into the agent&#39;s context:</p><pre>ERROR: Dependency violation in services/payment.py:3<br>  → Cannot import from ui/components. Move this logic to <br>    the service layer and pass results down as parameters.<br>  → See /docs/architecture/dependency-rules.md</pre><p>The enforcer doesn’t just reject — it <em>coaches</em>. The agent reads the remediation, self-corrects, and tries again. The same principle applies to <strong>security and permission boundaries</strong>. A production harness needs to define what the agent is <em>allowed to touch</em> — scoped credentials, read vs. write tools, approval-required actions, deploy separation — with the same mechanical rigidity. In practice, a simple default is: read-only access by default, write access only in sandbox/dev, and human approval for anything that touches production systems, secrets, or deploy pipelines.</p><p><strong>Quickest win:</strong> Review your pre-commit hooks. Linters, formatters, and type-checkers should run locally, not just in CI. Even a shell script that greps for forbidden imports is a legitimate mechanical enforcer — don&#39;t overthink this one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WtDQutwP2JtEfAzRyD3p1w.png" /></figure><h3>3. Autonomous Review Loop</h3><blockquote><strong><em>Autonomous Review Loop</em></strong><em> </em>(a.k.a. the “Ralph Wiggum Loop”)<em> — </em>Harness Engineering Pattern for Autonomous Iteration</blockquote><blockquote><em>An autonomous cycle where an agent writes code, self-reviews, requests reviews from other synthetic agents, and iterates until automated tests pass — removing the human from line-by-line review.</em></blockquote><p>The workflow: an agent writes code → reviews its own changes → requests code reviews from other agents in the cloud → they argue back and forth → iterate until tests pass → PR lands for the human to review at a high level.</p><p>LangChain found the same thing from a different angle: <strong>self-verification is the single biggest lever</strong> for improving agent performance. Their most common failure mode was comically human — agents would write code, re-read it, decide it looked fine, and stop. No actual testing. Just vibes. Forcing agents to verify against original specs and run real tests changed everything.</p><p><strong>When the loop fails:</strong> If an agent enters a doom loop — retrying the same broken approach repeatedly — you need a <strong>circuit breaker</strong>. LangChain uses a LoopDetectionMiddleware that tracks per-file edit counts and injects a nudge (&quot;consider reconsidering your approach&quot;) after N edits to the same file. If the agent still can&#39;t recover, the harness freezes the session and escalates to a human. Build this in from day one.</p><p><strong>Try this on your next task:</strong> Set up a workflow where the agent must</p><p>(a) write the implementation, (b) write or update tests, (c) run the tests, and (d) iterate if tests fail — all within a single session. Add a retry limit. You’ll be surprised how much this improves output versus a single-shot “write me a function” prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0cXIC0ipUw9Aaja9qTJlSA.png" /></figure><h3>4. Reasoning Sandwich</h3><blockquote><strong><em>Reasoning Sandwich</em></strong><em> — </em>Harness Engineering Strategy for Compute Allocation <em>Allocate high reasoning compute for planning, standard compute for implementation, and high reasoning again for verification — optimising the tradeoff between depth, cost, and completion time.</em></blockquote><p>This one is counterintuitive. LangChain was climbing the Terminal Bench 2.0 leaderboard (a benchmark testing agents on complex, multi-step command-line tasks in a real OS) and found that cranking reasoning to maximum on every step — often labelled xHigh in modern APIs — actually <em>underperformed</em>: agents hit timeout limits and failed. The sandwich — maximum reasoning for planning, standard for implementation, maximum again for verification — pushed their score from 52.8% to 66.5%, moving from outside the Top 30 to Top 5 <strong>without changing the underlying model</strong> (GPT-5.2-Codex throughout).</p><p>If your agent framework supports reasoning effort settings (Claude’s extended thinking, OpenAI’s reasoning_effort parameter), this maps to something like:</p><pre>PlanningPhase:    reasoning_effort = &quot;high&quot; / extended thinking ON<br>Implementation:    reasoning_effort = &quot;medium&quot; / extended thinking OFF<br>Verification:      reasoning_effort = &quot;high&quot; / extended thinking ON</pre><p><strong>Worth experimenting with:</strong> Try the sandwich pattern on a complex task. Track token usage and success rates across configurations — you might find you’re burning expensive reasoning tokens on routine implementation while skimping on verification, which is exactly backwards.</p><p>But even with deep reasoning, an agent is only as good as the data it can perceive — which brings us to legibility.</p><h3>5. Agent Legibility</h3><blockquote><strong><em>Agent Legibility</em></strong><em> — </em>Harness Engineering Principle</blockquote><blockquote><em>Every relevant aspect of a running system — visual UI state, performance metrics, logs, runtime behaviour — must be perceivable and queryable by the AI agent, not just by human engineers.</em></blockquote><p>Agents in a standard terminal are <em>blind</em> to the running application. An agent can edit CSS but can’t see whether the checkout button is now invisible.</p><p><strong>Let agents see the UI.</strong> The OpenAI team solved visual blindness by wiring the Chrome DevTools Protocol into the agent’s runtime — enabling DOM snapshots, screenshots, and before‑and‑after video recordings attached to pull requests. Modern models like GPT‑5.4 go a step further with native computer‑use tools: the model can request fresh screenshots, inspect them, and then control the mouse and keyboard to interact with real applications, effectively baking this “see and act on the UI” loop into the runtime itself.</p><p><strong>Let agents query runtime state.</strong> Beyond visuals, they built <strong>ephemeral observability</strong> — a temporary, per-task metrics-and-logs setup where each agent task gets an isolated sandbox with its own metrics stack, queryable via PromQL (a metrics query language) and LogQL (a log query language). The agent doesn’t guess that a service is fast enough — it runs a query to <em>measure</em> that startup completes in under 800ms.</p><p>Stripe takes a complementary approach: their AI agents (“Minions”) run in the same dev environments human engineers use, with access to 400+ internal tools via MCP servers — standardised endpoints, built on Anthropic’s Model Context Protocol, that let agents access systems in a structured, authenticated way. Agents need the same context and tooling as human engineers — not a bolted-on afterthought.</p><p><strong>Where to start:</strong> Think about the three most common “is this actually working?” checks your team runs manually. Script them. Make the output machine-parseable. These don’t need to be fancy:</p><pre># test-visual.sh — give agents eyes<br>#!/bin/bash<br>npx puppeteer screenshot http://localhost:3000 --output /tmp/ui-check.png<br>echo &quot;Screenshot saved. Check for missing elements or layout breaks.&quot;</pre><pre># check-health.sh — give agents a pulse check<br>#!/bin/bash<br>for endpoint in /api/health /api/users /api/orders; do<br>  STATUS=$(curl -s -o /dev/null -w &quot;%{http_code}&quot; &quot;http://localhost:8000$endpoint&quot;)<br>  echo &quot;$endpoint → $STATUS&quot;<br>done</pre><p>Scripts like these take ten minutes to write and give agents a huge amount of signal they didn’t have before.</p><h3>6. Continuous Garbage Collection</h3><blockquote><strong><em>Continuous Garbage Collection</em></strong><em> — </em>Harness Engineering Practice for Maintaining Code Quality</blockquote><blockquote><em>Background agents that run on a recurring cadence — often while the team is offline — to cross-reference the codebase against documentation, fix drift, refactor messy patterns, and autonomously merge fixes.</em></blockquote><p>Early in the OpenAI experiment, engineers spent every Friday cleaning up “AI slop” — 20% of the work week mopping up verbose, off-pattern code. That defeated the purpose of having agents.</p><p>The fix: automate the cleanup. At the high end, this looks like the OpenAI setup: at 3:00 AM, background agents wake up, cross-reference code against docs, and if they find that an API timeout is set to 800ms but the docs say 500ms, they open a PR, fix the documentation, refactor messy patterns, run regression tests, and merge. You don’t need this on day one — but even a weekly scheduled consistency check starts paying down drift immediately.</p><p>There’s a prerequisite here that’s easy to overlook: <strong>session persistence</strong>. Each agent session needs to leave behind structured artifacts — documentation updates, progress notes, test results — that the <em>next</em> session can pick up and build on. Without that, each session starts from zero and the drift just accumulates between runs.</p><p><strong>Low-effort version:</strong> Set up a scheduled task — a cron job, a GitHub Action, whatever you already have — that runs one basic consistency check: does the README match reality? Are documented API endpoints still present in the code? A weekly automated PR that flags drift is a perfectly fine starting point.</p><h3>Beyond Coding Agents</h3><p>The constructs above are most visible in coding agents today, but they’re not specific to code. Research agents need citation checks and source gating. Support agents need policy filters and escalation paths. Operations agents need scoped actions and audit trails. If you’re building <em>any</em> long-running autonomous agent — not just a coding one — the harness question applies.</p><h3>Harness Engineering Cheat Sheet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A51nI27tvXdVzDVDowy9vA.png" /></figure><p><strong>Quick diagnostic:</strong> If your problem is too much context, start with Progressive Disclosure. Unsafe changes? Mechanical Enforcers. Flaky output? Autonomous Review Loop. Cost or time blowups? Reasoning Sandwich. Agent can’t inspect reality? Agent Legibility. Drift accumulating over time? Continuous Garbage Collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OulYjAjhXrnXjlaTgrZwrQ.png" /></figure><h3>Getting Started: The 72-Hour Rollout</h3><p>You don’t need a million-line enterprise system to start any of this. If you only do three things this week, make them: <strong>structured repo docs, local verification, and one hard architectural rule.</strong></p><p>A minimum viable harness really only needs five things: a repo guide (AGENTS.md), runnable local checks, one hard architectural rule, one verification loop, and one boundary on what the agent can change without asking a human first.</p><p>Here’s a concrete 72-hour plan:</p><p><strong>Day 1 — Build the Map</strong></p><ul><li>Create AGENTS.md (or CLAUDE.md) in your project root</li><li>Move tribal knowledge out of Slack and into /docs/</li><li>Document: tech stack, test commands, forbidden patterns, common mistakes</li></ul><p><strong>Day 2 — Close the Feedback Loop</strong></p><ul><li>Make tests and linters runnable locally by the agent (not just CI)</li><li>Add one mechanical enforcer: a dependency-direction check, a forbidden-import grep, or a file-size limit</li><li>Ensure the agent sees linter output <em>with remediation instructions</em>, not just error codes</li></ul><p><strong>Day 3 — Add Verification and a Safety Net</strong></p><ul><li>Require agents to run tests before submitting PRs (the Autonomous Review Loop)</li><li>Add a retry limit / circuit breaker: 3 failures on the same test = stop and escalate</li><li>Define one permission boundary: read-only by default, write in sandbox only, human approval for production</li><li>Set up one scheduled consistency check (even a weekly cron that diffs docs against code)</li></ul><p><strong>After 72 hours, you have a minimum viable harness.</strong> From there, iterate: every agent failure becomes a harness improvement. Every improvement compounds across all future agent runs. That’s the core loop of harness engineering.</p><h3>What’s Next? Open Questions</h3><p>Harness engineering is barely a month old as a named discipline, and the problems it addresses aren’t going away. A few questions I keep coming back to:</p><p><strong>Will harnesses become the new service templates?</strong> Most organisations run two or three main tech stacks. It’s not hard to imagine teams picking from pre-built harnesses for common topologies — a “golden path” for agent-driven development — the same way they use service templates today.</p><p><strong>Can this work on legacy codebases?</strong> The OpenAI experiment was greenfield — an empty repo from day one. Applying harness engineering to a codebase with years of accumulated technical debt is a fundamentally different problem, and nobody has proven it at scale yet.</p><p>Then there’s the model portability question. <strong>Different models need different harnesses.</strong> LangChain tested Claude Opus 4.6 with an earlier harness version and scored 59.6% — competitive but lower, because they hadn’t run the same improvement loop for Claude. The principles generalise. The specific configurations don’t.</p><p><strong>And the one that keeps me up at night:</strong> if 2026 is the year humans build control systems for AI agents, how long before a sufficiently capable agent decides the human-designed harness is the bottleneck?</p><p>For agent-heavy workflows, more of the engineering leverage is moving into the environment around code. You’re no longer just managing code — you’re managing the environment in which code grows.</p><p>Put your conventions in the repo. Make agents verify before they submit. Add one mechanical rule they cannot bypass.</p><p>Time to build the harness.</p><p><strong>What’s next: </strong><a href="https://medium.com/p/b3d1ddf4f123?postPublishedType=initial"><strong>Part 2 — Build Your First Harness in an Afternoon</strong></a></p><p>Theory is useful. Working code is better. In the next <a href="https://medium.com/p/b3d1ddf4f123?postPublishedType=initial">article</a>, we’ll take four of these six constructs and implement them hands-on using Claude Code — building a complete harness around a FastAPI project from scratch. You’ll set up a CLAUDE.md with progressive disclosure, wire a Stop hook that prevents Claude from submitting code that breaks tests, create health check scripts that give your agent eyes on the running application, and build a doc-gardener subagent that catches drift while you sleep. Real terminal transcripts included. Stay tuned.</p><h3>Primary Sources</h3><ol><li>Harness Engineering: Leveraging Codex in an Agent-First World OpenAI (Ryan Lopopolo, Feb 2026) <a href="https://openai.com/index/harness-engineering/">openai.com</a></li><li>My AI Adoption Journey Mitchell Hashimoto (Feb 2026) <a href="https://mitchellh.com/writing/my-ai-adoption-journey">mitchellh.com</a></li><li>Harness Engineering (Analysis) Martin Fowler / Birgitta Böckeler <a href="https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html">martinfowler.com</a></li><li>Improving Deep Agents with Harness Engineering LangChain (Feb 2026) <a href="https://blog.langchain.com/improving-deep-agents-with-harness-engineering/">blog.langchain.com</a></li><li>Effective Harnesses for Long-Running Agents Anthropic (Nov 2025) <a href="https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents">anthropic.com</a></li></ol><h3>Further Reading</h3><ol><li>2025 Was Agents. 2026 Is Agent Harnesses. Aakash Gupta (Jan 2026) <a href="https://aakashgupta.medium.com/2025-was-agents-2026-is-agent-harnesses-heres-why-that-changes-everything-073e9877655e">Medium</a></li><li>The Emerging “Harness Engineering” Playbook ignorance.ai (Feb 2026) <a href="https://www.ignorance.ai/p/the-emerging-harness-engineering">ignorance.ai</a></li><li>What We Miss When We Talk About “AI Harnesses” Andrew Maynard (Feb 2026) <a href="https://www.futureofbeinghuman.com/p/what-we-miss-when-we-talk-about-ai-harnesses">futureofbeinghuman.com</a></li><li>Harness Engineering (Deep Analysis) GTCode Editorial (Mar 2026) <a href="https://gtcode.com/articles/harness-engineering/">gtcode.com</a></li><li>What Is Harness Engineering (Term History) SmartScope (Feb 2026) <a href="https://smartscope.blog/en/blog/harness-engineering-overview/">smartscope.blog</a></li></ol><p><em>Dr. Gaurav Caprihan is an AI Automation Engineer based in Melbourne, Australia, who builds and self-hosts agentic AI systems. He writes about Agentic engineering, multi-agent architectures, and the operational realities of putting autonomous agents to work.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=997af08e3264" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We’ve Been Building Recursive Language Models Without Knowing It]]></title>
            <link>https://medium.com/@gaurav.caprihan/weve-been-building-recursive-language-models-without-knowing-it-ebd726721c7f?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebd726721c7f</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 08:42:08 GMT</pubDate>
            <atom:updated>2026-02-10T08:42:08.315Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Sykj9RROdM5gvcClTkBtw.png" /></figure><p><em>How practitioners stumbled onto the pattern that MIT CSAIL just formalized — and what we learned the hard way.</em></p><p>Last Tuesday, my AI assistant spawned three sub-agents to fact-check a white paper. One queried ChatGPT, another consulted Gemini, and a third cross-referenced primary sources. The parent agent synthesized their findings and provided a confidence score. I developed this workflow through trial and error to solve a practical problem. Then, a paper from MIT CSAIL gave it a name: Recursive Language Models.</p><p>Authored by Alex Zhang, Tim Kraska, and Omar Khattab, the paper appeared on arXiv in late December 2025 and was revised in January 2026. Its core thesis is deceptively simple: rather than cramming everything into one massive context window, allow a language model to spawn sub-calls to itself, recursively decomposing problems like a programmer using function calls. The results are striking. An 8-billion parameter model, RLM-Qwen3–8B, outperformed its base version by 28.3% on long-context tasks and approached the quality of vanilla GPT-5 on three benchmarks. On the OOLONG benchmark’s trec_coarse dataset at 132k tokens, an RLM built on GPT-5-mini surpassed full GPT-5 by over 34 raw points — roughly a 114% improvement, according to the authors’ research blog.</p><p>Those numbers are significant, but what truly caught my attention was the architecture. I had been living inside it.</p><h3>The Problem Nobody Named</h3><p>If you’ve built anything with agentic AI — Claude Code sessions, OpenClaw automations, n8n workflows — you’ve encountered the same limitation. Context windows are large but finite. Feed a model 200,000 tokens of meeting transcripts and ask it to extract action items, and you’ll get competent results until you don’t. As the signal-to-noise ratio drops, the model starts hallucinating connections or quietly omitting details.</p><p>The instinctive fix, discovered independently by practitioners, is decomposition. Don’t feed the model everything. Break the problem into pieces. Let separate calls handle separate chunks. Combine the results.</p><p>That’s an RLM. We just didn’t call it that.</p><p>The MIT CSAIL team formalized what’s happening under the hood. RLMs treat inputs as variables in a REPL-like environment — the model doesn’t just process a prompt; it writes a program that includes sub-LLM calls as primitives. The recursion isn’t metaphorical. The model literally spawns child instances of itself, each handling a scoped sub-problem, and the parent assembles their outputs into a final answer.</p><p>This is a meaningful shift from chain-of-thought or retrieval-augmented generation. Those approaches still operate within a single forward pass or a fixed pipeline. RLMs make the computation itself dynamic — the model decides at runtime how many sub-calls to make and what to delegate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWyNpnLR_dlKtYa2jar3bQ.png" /><figcaption><em>Parent agent delegating to specialised sub-agents</em></figcaption></figure><h3>What Practitioners Built First</h3><p>I run OpenClaw as my primary AI automation layer. It’s a CLI-driven agent framework where Claude operates as a persistent assistant with access to tools — file systems, APIs, browsers, other models. One of its most useful capabilities is sub-agent spawning: the main agent can create child agents via sessions_spawn, each with their own context, instructions, and toolset. The parent monitors progress and synthesizes results.</p><p>This is, structurally, what Zhang, Kraska, and Khattab describe. The parent agent is the root RLM call. Each sub-agent is a recursive sub-LLM invocation with a scoped task. The synthesis step is the return value.</p><p>Consider a concrete example from my content pipeline. I use a process called CRISPR — Content Research, Iterative Structuring, Peer Review — to produce articles. The research phase sends the same set of factual claims to ChatGPT, Gemini, and Perplexity via n8n webhooks. Each model independently validates the claims, scores confidence, and flags contradictions. A parent process collects the verdicts and requires quorum: at least two models from different providers must agree before a claim passes.</p><p>That’s recursive delegation across models. I built it because single-model fact-checking is unreliable — models have correlated failure modes, and cross-validation catches errors that self-consistency misses. The RLM paper arrives at the same insight from a different direction: a single model’s context is finite, but recursive decomposition makes the effective context unbounded.</p><p>The parallel extends to n8n, the self-hosted workflow automation platform I use for orchestration. An n8n workflow is a directed graph of nodes, each performing a discrete operation — fetch data, transform it, call an API, route based on conditions. Complex workflows decompose naturally into sub-workflows. The pattern is identical: task decomposition, scoped execution, result aggregation.</p><p>Even context compaction — the technique where an agent summarizes its conversation history when the context grows too long — maps directly to the RLM insight. The paper’s models navigate information rather than memorizing it, accessing what they need through recursive calls instead of holding everything in working memory. Context compaction does the same thing: instead of carrying 100,000 tokens of raw history, the agent distills it to the essential state and proceeds with a lighter load. Same principle, different implementation.</p><h3>Where It Breaks: Failure Modes from the Field</h3><p>The RLM paper presents impressive benchmarks, and they’re legitimate. But benchmarks are controlled environments. Production is not. Here’s what breaks when you actually run recursive architectures at scale.</p><p><strong>Context drift in child agents.</strong> When a parent spawns a sub-agent, it passes instructions and context. But context is lossy — the child gets a summary, not the full state. Over multiple levels of recursion, nuance evaporates. I’ve watched a sub-agent tasked with “verify this claim about RLM performance” lose track of which specific benchmark was in question, returning a generic answer about language model improvements. The parent had to detect the drift and re-prompt with tighter constraints. The RLM paper handles this elegantly in controlled settings, but production contexts are messier than benchmarks.</p><p><strong>Synthesis bottlenecks.</strong> Three sub-agents each return 2,000 tokens of analysis. The parent now needs to hold 6,000 tokens of input plus its own reasoning context to produce a coherent synthesis. Scale that to ten sub-agents and you’ve recreated the very context problem you were trying to solve. Recursive architectures don’t eliminate context limits — they redistribute them. The bottleneck moves from the leaf nodes to the root.</p><p><strong>Delegation overhead.</strong> Not every problem benefits from decomposition. I learned this the hard way with simple fact-checks: spawning a sub-agent, waiting for it to initialize, passing context, receiving results, and synthesizing — all for a question that a single prompt could have answered in two seconds. The coordination cost exceeded the computation cost. RLMs need a routing layer that’s smart enough to know when recursion helps and when it’s overhead.</p><p><strong>Non-linear coordination costs.</strong> Two sub-agents are easy to manage. Ten are an architectural problem. The parent must track state across all children, handle partial failures, resolve contradictions between outputs, and maintain coherence in the final synthesis. This isn’t a linear increase in complexity — it’s combinatorial. My RIPR pipeline works with three validators because three is manageable. I’ve tested five, and the synthesis step becomes the bottleneck, not the validation.</p><h3>What the Paper Actually Changes</h3><p>The RLM paper’s contribution isn’t the idea of recursion — practitioners discovered that independently. Its contribution is formalization and training. Zhang, Kraska, and Khattab don’t just describe the pattern; they show how to fine-tune models to be better at it. RLM-Qwen3–8B wasn’t just prompted to recurse — the authors post-trained it as the first natively recursive language model, using what they call “Recursive Improvement from AI Feedback” to learn when to delegate and how to synthesize. That’s the gap between what practitioners hacked together and what a principled approach can achieve.</p><p>The implication is significant: if you can train a model to recurse well, you can make small models punch far above their weight class. An 8B parameter model approaching GPT-5 quality on specific tasks isn’t just an academic curiosity — it’s an economic argument. Running GPT-5 at scale is expensive. Running a fine-tuned 8B model that achieves comparable results through smart recursion is an order of magnitude cheaper.</p><p>This also reframes the context window arms race. The industry has been pushing toward million-token windows — Gemini’s 2M tokens, Claude’s expanding context. RLMs suggest an alternative: instead of building bigger windows, build smarter decomposition. Navigate the information space rather than trying to hold it all in memory at once. Both approaches have their place, but RLMs offer a path that’s more compute-efficient and architecturally elegant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTFFLE1rMgNzGU6EM3zA8A.png" /><figcaption><em>Where research meets practice</em></figcaption></figure><h3>Where This Goes Next</h3><p>The practitioners who built recursive patterns empirically now have a theoretical foundation to build on. The researchers who formalized the theory now have production evidence that the pattern works outside the lab. That convergence is where the interesting work happens.</p><p>I expect three developments. First, frameworks like OpenClaw will integrate RLM-style training into their sub-agent architectures — not just prompting child agents, but fine-tuning them on recursive execution patterns specific to their tool environment. Second, the routing problem — knowing when to recurse and when to answer directly — will become a first-class research question. My ad hoc rules for when to spawn sub-agents versus handle tasks inline are begging for a principled replacement. Third, the failure modes I described will drive the next round of research. Context drift, synthesis bottlenecks, coordination costs — these are engineering problems now, not theoretical ones.</p><p>The RLM paper validates something practitioners have felt in their bones: the future of AI isn’t a single, omniscient model. It’s a system of models that know how to delegate, decompose, and synthesize — recursively. We built it by necessity. Now we can build it by design.</p><h3>Sources</h3><p>1. Zhang, A., Kraska, T., &amp; Khattab, O. (2025). “Recursive Language Models.” arXiv:2512.24601. MIT CSAIL. Published December 31, 2025; revised January 28, 2026.</p><p>2. OpenClaw Documentation — Sub-agent Spawning. <a href="https://docs.openclaw.ai/tools/subagents">https://docs.openclaw.ai/tools/subagents</a></p><p>3. n8n — Open Source Workflow Automation. <a href="https://n8n.io/">https://n8n.io</a></p><p>4. Polinati, V. (2026, January 14). “Recursive Language Models: A New Paradigm.” Medium.</p><p><em>Dr. Gaurav Caprihan is a AI practitioner focused on agentic systems and automation.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebd726721c7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Protocols to Plugins: How Anthropic’s Cowork Changes the AI Integration Game]]></title>
            <link>https://medium.com/@gaurav.caprihan/from-protocols-to-plugins-how-anthropics-cowork-changes-the-ai-integration-game-d0875db35b14?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0875db35b14</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[claude-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 01:52:04 GMT</pubDate>
            <atom:updated>2026-02-03T01:52:04.710Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aaLKAuOhQKVXZK42QVkB-w.jpeg" /></figure><p><em>A developer’s hands-on look at Cowork plugins and what they mean for MCP’s evolution</em></p><p>Ever wondered what happens when AI communication standards meet real-world workflows? Continuing from my previous article, <a href="https://medium.com/@gaurav.caprihan/beyond-babel-bridging-ais-communication-gap-with-mcp-a2a-and-acp-35e348bb4233"><em>Beyond Babel: Bridging AI’s Communication Gap with MCP, A2A, and ACP</em></a>, we now look at Anthropic’s latest move — one that builds directly on those protocol foundations and might just change how we think about AI tool integration entirely.</p><h3>The Problem: From “How Do I Connect?” to “What Do I Do?”</h3><p>When I wrote about the Model Context Protocol back in September, the central challenge was connectivity: getting AI assistants to reliably talk to external tools and data sources. MCP solved that beautifully — it’s the USB-C of AI applications, providing a standardized interface for connecting models to databases, APIs, and local files.</p><p>But here’s the thing: connectivity is only half the battle.</p><p>Picture this: you’ve set up MCP servers for Slack, your CRM, Jira, and your company’s document storage. Your AI assistant can now technically access all this data. But does it know your sales process? Does it understand how your legal team triages NDAs? Does it know that your company prefers 12-month liability caps and requires Data Processing Agreements (DPAs) for any personal data processing?</p><p>This is the gap Anthropic’s Cowork plugins address — and it’s a bigger deal than it might first appear.</p><h3>What is Cowork, and What Are Plugins?</h3><p>Cowork launched in mid-January 2026 as a new feature within the Claude desktop application for macOS. Think of it as “Claude Code for knowledge workers” — while Claude Code gives developers terminal-level access to agentic AI, Cowork brings that same power to the desktop app for non-technical users. Point Claude at a folder, describe what you want, and watch it organize files, generate reports, or process documents autonomously.</p><p>The plugin system, announced on January 30, takes Cowork further. Plugins bundle four key components that Claude loads when activated:</p><ul><li>Skills — Domain expertise encoded in markdown files. Claude reads these automatically when relevant.</li><li>Connectors — MCP server configurations (in .mcp.json) that wire Claude to external tools.</li><li>Slash Commands — Explicit actions users trigger manually (like /legal:review-contract).</li><li>Sub-agents — Specialized Claude instances optimized for specific tasks.</li></ul><p>The crucial insight? Every component is file-based. Markdown and JSON. No code compilation, no infrastructure, no build steps.</p><h3>Technical Deep-Dive: Plugin Architecture and MCP Integration</h3><p>Here’s where it gets interesting for developers who’ve worked with MCP.</p><h3>Directory Structure</h3><pre>plugin-name/<br>├── .claude-plugin/plugin.json   # Manifest: name, version, description<br>├── .mcp.json                    # MCP server configurations<br>├── commands/                    # Slash commands (markdown instructions)<br>└── skills/                      # Domain knowledge files</pre><h3>How MCP and Skills Work Together</h3><p>The .mcp.json file directly configures MCP server connections — the same protocol you’d use standalone:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;slack&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [&quot;-y&quot;, &quot;@anthropic/mcp-server-slack&quot;]<br>    },<br>    &quot;salesforce&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;, <br>      &quot;args&quot;: [&quot;-y&quot;, &quot;@company/mcp-server-salesforce&quot;],<br>      &quot;env&quot;: {&quot;SF_TOKEN&quot;: &quot;${SALESFORCE_TOKEN}&quot;}<br>    }<br>  }<br>}</pre><p>Existing MCP servers work directly — no adaptation needed. The plugin just packages them alongside skills that tell Claude what to do with those connections.</p><h3>Hands-On: Exploring the Legal Plugin</h3><p>Let me walk through the legal plugin in detail — it showcases the full plugin system’s power.</p><h3>Available Commands</h3><ul><li>/review-contract — Clause-by-clause analysis against your playbook</li><li>/triage-nda — GREEN/YELLOW/RED classification for rapid screening</li><li>/vendor-check [name] — Status check across existing agreements</li><li>/brief daily — Morning summary of legal-relevant items</li></ul><h3>The Customization Layer</h3><p>The real power comes from <a href="http://legal.local.md/">legal.local.md</a> — your organization’s positions. When you run /review-contract, Claude checks each clause against these positions, flagging anything outside your acceptable range with specific remediation language.</p><h3>What This Means for Developers</h3><p>Here’s my honest assessment after digging into the architecture:</p><h3>Why Your MCP Investment Pays Off</h3><p>If you’ve built MCP servers for your tools, you’re 70% done. The plugin architecture layers on top of MCP, not beside it. Your existing servers work unchanged — just reference them in .mcp.json.</p><h3>Technical Challenges You’ll Face</h3><ol><li>Skill authoring requires iteration. Writing skills that activate at the right time without false positives takes trial and error.</li><li>No debugging tools (yet). When a skill doesn’t fire or produces unexpected output, your options are limited.</li><li>Context window management is implicit. All active skill files load into Claude’s context, consuming tokens.</li><li>Security considerations for enterprises. The file-based architecture raises questions about credentials and plugin signing.</li></ol><h3>The Caveats</h3><ul><li>macOS-only — Cowork runs in the Claude desktop app, currently Mac only.</li><li>Local storage — Plugins live on your machine. Organization-wide catalogs are coming but not available today.</li><li>Research preview — Expect API changes and rough edges.</li></ul><h3>Looking Forward</h3><p>When I built VIC-MCP for Melbourne’s parking data, the pattern was: raw data → clean API → MCP wrapper → AI-accessible intelligence. Cowork plugins extend this to enterprise workflows: raw tools → MCP connectors → skills layer → domain expertise.</p><p>Anthropic is clearly positioning Cowork + plugins as the knowledge worker equivalent of Claude Code. If they execute on organization-wide sharing, this becomes the standard way enterprises customize AI assistants.</p><p>For developers, the message is clear: MCP is the foundation, but skills encode the value. Start with the open-source plugins, customize them for your organization, and build new ones where gaps exist.</p><p>The USB-C analogy still holds — but now we have device drivers too.</p><h3>Sources</h3><ol><li>Anthropic Blog: “Customize Cowork with plugins” (January 30, 2026)</li><li>GitHub: anthropics/knowledge-work-plugins</li><li>Model Context Protocol Documentation — <a href="http://modelcontextprotocol.io/">modelcontextprotocol.io</a></li><li><a href="https://thenewstack.io/anthropic-brings-plugins-to-cowork/?utm_campaign=trueanthem&amp;utm_medium=social&amp;utm_source=linkedin">The New Stack</a>: “Anthropic brings plugins to Cowork”</li><li>Legal Plugin Documentation — GitHub</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0875db35b14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your AI Agents Are Lying to Each Other: The Divergence/Convergence Paradox]]></title>
            <link>https://medium.com/@gaurav.caprihan/why-your-ai-agents-are-lying-to-each-other-the-divergence-convergence-paradox-6c2255fe9f59?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c2255fe9f59</guid>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-governance]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 01:31:14 GMT</pubDate>
            <atom:updated>2026-01-05T01:31:14.144Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s 2026. The chatbots are talking to each other, and they are mostly agreeing. That’s the problem.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKtUDLEXRFILveSI17_rHQ.png" /></figure><p>It is 2026. The “Chatbot” era is over. We have moved to the era of <strong>Multi-Agent Systems (MAS)</strong> — swarms of autonomous AI agents designed to code, plan, and execute complex workflows without human hand-holding.</p><p>But if you have deployed these systems in production, you have likely encountered a strange and frustrating phenomenon. You put ten brilliant agents in a room, and they either:</p><ol><li>Agree on a hallucination instantly (The “Yes-Man” problem).</li><li>Spiral into a chaotic argument that crashes the system (The “Escalation” problem).</li></ol><p>This is the <strong>Divergence/Convergence Paradox</strong>. It is the single biggest bottleneck in Agentic AI today.</p><p>To solve complex problems, agents must <strong>diverge</strong> — they need to explore unique, creative, and high-entropy reasoning paths. But to execute a solution, they must <strong>converge</strong> — they need to align on a single, safe, and executable truth.</p><p>Most systems fail because they cannot manage this tension. Here is the pathology of why that happens, and the specific architectural patterns we are using in 2026 to fix it.</p><h3>I. The Pathology of Convergence: Why Agents Become Sycophants</h3><p>The first side of the paradox is <strong>Convergence Failure</strong>, often manifesting as <strong>Sycophancy</strong>. This is where agents prioritize social cohesion over factual accuracy.</p><p>If you have ever seen an entire swarm of agents agree that a buggy line of code is “perfect,” you have witnessed this pathology. It stems from two root causes buried deep in the way Large Language Models (LLMs) are trained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lWvogHYmRizoxSDQT_J9Sg.png" /></figure><h3>1. The RLHF Trap (Reward Hacking)</h3><p>Most modern models are fine-tuned using Reinforcement Learning from Human Feedback (RLHF). This process teaches models to generate answers that human raters <em>like</em>. Unfortunately, human raters tend to prefer answers that confirm their existing beliefs or are phrased politely.</p><p>In a multi-agent loop, this creates a “Reward Hacking” dynamic. If Agent A proposes a wrong answer with high confidence, Agent B (statistically biased toward agreement) is likely to validate it rather than challenge it. This creates a “Sycophancy Loop” where errors are amplified rather than corrected.</p><h3>2. Mode Collapse and Typicality Bias</h3><p>The second cause is statistical. LLMs suffer from <strong>Typicality Bias</strong> — the tendency to gravitate toward the “mode” of the probability distribution (the most average, stereotypical answer).</p><p>When multiple agents interact without structural constraints, they often suffer from <strong>Mode Collapse</strong>. Instead of generating diverse ideas, they essentially mimic each other’s “average” reasoning. Research shows that without intervention, agent debates often collapse into a single, low-entropy viewpoint within just three rounds of conversation. They stop thinking and start echoing.</p><h3>II. The Pathology of Divergence: The Risk of Apocalyptic Escalation</h3><p>The flip side of the paradox is <strong>Divergence Failure</strong>. This happens when we turn up the “temperature” or encourage agents to debate, only to lose control of the system entirely.</p><h3>1. Recursive Feedback Loops</h3><p>In a multi-agent system, the output of Agent A becomes the input for Agent B. This creates a <strong>Recursive Feedback Loop</strong>. Unlike a linear process, errors here are non-linear. A minor misunderstanding in Turn 1 isn’t just an error; it becomes the <em>factual reality</em> for Turn 2.</p><p>Over long horizons (30+ turns), this leads to <strong>Semantic Drift</strong>, where the swarm effectively “hallucinates” a new context that has nothing to do with the original user prompt.</p><h3>2. The Exploration-Exploitation Cascade</h3><p>In 2025, researchers identified a specific failure mode called the <strong>Exploration-Exploitation Cascade Failure</strong>.</p><ul><li><strong>Phase 1 (Premature Convergence):</strong> Agents lock onto a mediocre plan too early because they are “lazy” (low entropy).</li><li><strong>Phase 2 (Explosion):</strong> When that plan fails, they over-correct. They suddenly jump to maximum entropy, flailing wildly with random actions to try and recover.</li></ul><p>In extreme cases (like military simulations or automated trading), this unchecked divergence leads to <strong>Apocalyptic Escalation</strong>, where agents prioritise “winning” an argument or a game loop at the expense of the system’s safety constraints.</p><h3>III. The Missing Layer: Governance-as-a-Service (GaaS)</h3><p>Before we even discuss how to structure the agents (topology), we must discuss how to control them. In 2026, the emerging trend across the industry will be that of <strong>Governance-as-a-Service (GaaS)</strong>.</p><p>GaaS represents a fundamental shift from “aligning the model” to “constraining the system.” by decoupling safety from intelligence. The core realisation is that you cannot train safety into a model perfectly. Therefore, you must enforce it externally. It acts as a “sidecar” or proxy layer that sits between the agents and the external world (users, APIs, databases).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AKN5vKbmW4GbEyenq-DzLQ.png" /></figure><h3>The “Superego” Architecture</h3><p>Anthropic’s concept of “Constitutional AI” — training models with a set of principles — was adapted for multi-agent swarms into the <strong>Superego Architecture — </strong>a <strong>Superego Agent</strong> or layer that sits between your worker agents and the real world (APIs, databases, users).</p><ul><li><strong>Intercept &amp; Audit:</strong> The Superego intercepts every tool call and message.</li><li><strong>JSON Constitution:</strong> It checks the intent against a rigid “Constitution” defined in JSON (e.g., “No financial trades above $50 without human approval”).</li><li><strong>Trust Scores:</strong> It maintains a dynamic <strong>Trust Score</strong> for every agent. If an agent tries to violate a rule, its trust score drops, and its future actions are throttled.</li></ul><p>This turns governance from a probabilistic hope into a <strong>programmable API contract</strong>. It allows you to use powerful, creative, and potentially hallucination-prone models for brainstorming while ensuring they can never execute a harmful action.</p><p>The Superego agent does not just block actions; it provides <strong>recursive feedback</strong> to the planner, forcing it to replan within the constraints. This creates a “safe exploration” loop where the system learns to navigate the ethical boundaries of its task dynamically. Benchmark evaluations on <em>HarmBench</em> and <em>AgentHarm</em> show that this Superego approach can reduce harmful outputs by up to <strong>98.3%</strong></p><h3>IV. The Architectural Fix: Hierarchical Adaptive Consensus Network (HACN)</h3><p>Once you have GaaS in place for safety, how do you solve the efficiency problem? In 2023, AI researchers tried to fix these problems with “better prompts” (<em>e.g., “You are a critical thinker”</em>). It didn’t work. In 2026, these will be addressed with <strong>Topology</strong>.</p><p>The most effective architectural pattern to emerge is the <strong>Hierarchical Adaptive Consensus Network (HACN)</strong>. Instead of a messy group chat (Mesh Topology) or a bottlenecked manager (Star Topology), HACN uses a sophisticated <strong>Three-Tier Architecture</strong> to balance divergence and convergence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVp0FdiFAbuSnNcOyq2LRQ.png" /></figure><h3>The Three-Tier Architecture</h3><p><strong>Tier 1: Local Consensus Clusters (The Divergence Engine)</strong></p><ul><li><strong>Structure:</strong> Agents are grouped into small, specialised clusters (e.g., 3–5 agents).</li><li><strong>Function:</strong> This is where the “noise” happens. These clusters use high-bandwidth, fully connected communication to debate intensely. Because they are small, they can diverge and explore creative risks without overwhelming the whole network.</li><li><strong>Mechanism:</strong> They use “Confidence-Weighted Voting” to bubble up only their best ideas.</li></ul><p><strong>Tier 2: Inter-Cluster Coordination (The Filter)</strong></p><ul><li><strong>Structure:</strong> Only the “Cluster Leads” (the most confident agents from Tier 1) talk to each other.</li><li><strong>Function:</strong> This layer acts as a firewall against Mode Collapse. It forces different specialisations (e.g., Legal vs. Engineering) to reconcile their distinct viewpoints.</li><li><strong>Mechanism:</strong> It uses “Partial Knowledge Sharing” to prevent information overload.</li></ul><p><strong>Tier 3: Global Orchestration (The Convergence Anchor)</strong></p><ul><li><strong>Structure:</strong> A single “Meta-Orchestrator” governs the system.</li><li><strong>Function:</strong> It does not do the work. It enforces the rules. It monitors the <strong>Martingale Score</strong> (a measure of belief entrenchment) and decides when to stop the debate and execute the plan.</li><li><strong>Mechanism:</strong> It provides the final “System-Wide Coordination” and arbitration.</li></ul><h3>Why HACN Wins</h3><p>The results of switching to HACN are stark. Research indicates it achieves a <strong>99.9% reduction in communication overhead</strong> compared to fully connected meshes.</p><p>By mathematically isolating the “divergence” (Tier 1) from the “convergence” (Tier 3), HACN allows you to have your cake and eat it too: you get the creative spark of the swarm without the risk of the echo chamber.</p><h3>Conclusion</h3><p>The “Yes-Man” agent is a bug, not a feature. As we build the agentic workflows of 2026, we must stop treating stability as something that happens magically. Stability is an engineering discipline.</p><p>If your agents are agreeing too much, you have a <strong>Sycophancy</strong> problem. If they are spiralling into chaos, you have a <strong>Cascade</strong> problem. The solution isn’t to prompt them to be nicer; it’s to architect them to be smarter.</p><h3>References</h3><ol><li>Smith, J. (2025). “Sycophancy in Large Language Models.” <em>ResearchGate</em>.</li><li>Yao, B. et al. (2025). “Peacemaker or Troublemaker: How Sycophancy Shapes Multi-Agent Debate.” <em>arXiv preprint arXiv:2509.23055</em>.</li><li>Chan, A. et al. (2025). “Recursive Feedback Loops and Systemic Risks in Agentic Chains.” <em>ChatPaper Analysis</em>.</li><li>Xu, W. et al. (2025). “EPO: Entropy-regularized Policy Optimization for LLM Agents.” <em>arXiv preprint arXiv:2509.22576</em>.</li><li>Weber, A. et al. (2025). “Apocalyptic Escalation: The Risks of Autonomous Swarms in Conflict.” <em>Jammu University Editorial</em>.</li><li>Gaurav, S. et al. (2025). “Governance-as-a-Service: A Multi-Agent Framework for AI System Compliance.” <em>arXiv preprint arXiv:2508.18765</em>.</li><li>Pervez, H. et al. (2025). “LOKA Protocol: A Decentralized Framework for AI Governance.” <em>Computer Science &amp; Political Science</em>.</li><li>Anthropic Research. (2025). “Constitutional AI: Harmlessness from AI Feedback.” <em>arXiv preprint</em>.</li><li>Shit, R. C., &amp; Subudhi, S. (2025). “Hierarchical Adaptive Consensus Network: A Dynamic Framework for Scalable Consensus.” <em>arXiv preprint arXiv:2511.17586</em>.</li><li>He, Z. et al. (2025). “Martingale Score: An Unsupervised Metric for Bayesian Rationality in LLM Reasoning.” <em>arXiv preprint arXiv:2512.02914</em>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c2255fe9f59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic Design Patterns: Connecting the Dots]]></title>
            <link>https://medium.com/@gaurav.caprihan/agentic-design-patterns-connecting-the-dots-73d2b52ec80e?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/73d2b52ec80e</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[agentic-design-patterns]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[agentic-design]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 04:43:15 GMT</pubDate>
            <atom:updated>2025-09-23T04:43:15.403Z</atom:updated>
            <content:encoded><![CDATA[<h4>Discovering the Unifying Principle of Reliability in Modern AI Systems</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uxziaIYxCx4y3BSFFgrYFg.png" /></figure><p>For years, the conversation around AI has been dominated by Large Language Models (LLMs) and their incredible ability to write essays and generate code1. But for those watching closely, a fundamental shift is underway. AI is evolving from a passive chatbot into an <strong>autonomous agent</strong> — a system that can perceive its environment, create a multi-step plan, and take real-world action to achieve a goal.</p><p>This leap from passive response to autonomous action isn’t about crafting the perfect prompt. It’s about architecture. It’s about building the engineering disciplines needed for real-world deployment. As we explore the landscape of Agentic Design Patterns (ADPs) — from tool use and planning to reflection and safety — a single, powerful theme emerges that connects them all.</p><p>This article attempts to trace that common thread. We’ll explore how the core design patterns that separate a simple LLM wrapper from a truly autonomous system all converge on one central principle:</p><p><strong>Engineering for Reliability</strong>.</p><p>It’s the disciplined effort to make an agent’s behavior understandable, auditable, predictable, and ultimately, trustworthy enough for the enterprise.</p><p>The article is structured into four parts so as to logically walk through the process of building a reliable autonomous agent, much like constructing an intelligent entity from the ground up. <strong>Part 1, “Grounding Agents in Reality,”</strong> establishes the agent’s foundational ability to sense and recall information, serving as its hands and memory. <strong>Part 2, “Architecting a Transparent Mind,”</strong> moves inward to the cognitive functions, exploring the agent’s core thought and planning processes. <strong>Part 3, “Building Self-Awareness,”</strong> elevates this by introducing internal quality assurance, where the agent learns to evaluate and critique its own work. Finally, <strong>Part 4, “The Production Reality,”</strong> situates this fully-formed agent within the practical constraints of the real world, addressing the challenges of efficiency, safety, and human oversight required for successful deployment.</p><h3>Part 1: Grounding Agents in Reality (The Hands and Memory)</h3><p>An agent can’t be reliable if it’s disconnected from the real world or operating on outdated information. Its knowledge cutoff date is a major limitation, freezing it in a past moment. The first set of patterns is about giving the agent reliable senses and a verifiable memory.</p><p><strong>Tool Use (Function Calling):</strong></p><p>Tools are the agent’s hands, connecting its reasoning engine to external APIs and code. Through function calling, an agent can query a database, check inventory, or even execute a financial transaction. But this power creates risk. Reliability here means <strong>strict tool vetting and access control</strong>. A healthcare agent, for instance, shouldn’t browse the web; its tools should be restricted to trusted, vetted sources like PubMed or specialized medical imaging processors. This is the <strong>Principle of Least Privilege</strong> in action — giving the agent only the permissions it absolutely needs, which inherently contains the blast radius if something goes wrong.</p><p><strong>Retrieval Augmented Generation (RAG):</strong></p><p>When the knowledge an agent needs is locked in internal documents, RAG becomes essential for grounding its answers in verifiable facts and reducing hallucinations. The engineering challenge isn’t just pulling in documents; it’s maximizing relevance while minimizing noise. This is where advanced techniques like <strong>Adaptive Chunking</strong> come into play. Instead of a single retrieval, an agent might first pull larger, conceptual chunks to reason on, and then “zoom in” with a second retrieval for smaller, more focused chunks on a specific point. This multi-stage process ensures the final output is grounded in properly contextualized reality, not random snippets, making the agent’s response far more reliable.</p><h3>Part 2: Architecting a Transparent Mind (The Thought Process)</h3><p>For an agent to be trusted, we can’t just see the final answer; we need to see how it got there. Architectural transparency is the difference between an unpredictable response and a deliberate, auditable plan.</p><p><strong>Prompt Chaining (Pipelines):</strong></p><p>Complex requests, like generating a quarterly market report, require multiple steps. Instead of one massive, failure-prone prompt, we break the task into a chain of manageable steps, where the output of one becomes the input for the next. Reliability is engineered through <strong>validation loops</strong> between each step. A micro-validation agent might check the format or quality of a summary from step one before it’s fed to step two, preventing cascade failures and improving the integrity of the entire process.</p><p><strong>Chain of Thought (CoT):</strong></p><p>Sometimes, reliability can be enhanced with surprising simplicity. By merely adding the phrase “Let’s think step by step” to a prompt, we can force the model to externalize its intermediate reasoning. This “showing its work” significantly improves accuracy on tasks requiring logical deduction or calculation and provides a transparent, auditable thought process.</p><p><strong>Program-Aided Language Models (PALM):</strong></p><p>LLMs are notoriously bad at precise, deterministic math. The PALM pattern addresses this by having the agent <strong>offload the calculation</strong>. It writes code (e.g., Python) to perform the task and then executes it in a secure, sandboxed interpreter. The engineering challenge — and the key to reliability — is the security of that sandbox. It must be tightly contained, with no general network or file system access, to prevent malicious code execution.</p><h3>Part 3: Building Self-Awareness (Internal Quality Assurance)</h3><p>The most sophisticated agents don’t just act; they evaluate their own performance. These patterns embed quality control directly into the agent’s internal machinery.</p><p><strong>Reflection (The Critic Agent):</strong> This is where an agent becomes its own QA inspector. After a “generator” agent produces a draft (like a block of code or a marketing email), a “critic” agent reviews it. For this to be useful, the feedback can’t be generic. Reliability is achieved by having the critic evaluate the output against a <strong>detailed quality rubric</strong> and provide <strong>structured, actionable feedback</strong>.</p><p>For example, instead of “this is wrong,” it says, “Line 42 fails to handle the specified edge case for negative inputs”. This loop repeats until the output meets a defined standard36.</p><p><strong>Goal Setting &amp; Monitoring:</strong></p><p>An autonomous agent needs a clear finish line to avoid running indefinitely or declaring success prematurely. A vague business objective like “improve customer satisfaction” must be operationalized into a <strong>specific, measurable, and binary success metric</strong>. For example, “reduce the average customer support call handling time by 15 seconds”. The agent is programmed to periodically check this metric and deliver a simple “True” (goal met) or “False” (goal not met) verdict, ensuring its efforts are aligned with a concrete, reliable outcome.</p><h3>Part 4: The Production Reality (Efficiency and Oversight)</h3><p>In the real world, agents must operate within the constraints of budgets, performance targets, and the simple fact that AI is not infallible414141.</p><p><strong>Resource-Aware Optimization (The Traffic Cop):</strong></p><p>You can’t use the most powerful, expensive LLM for every single query. This pattern uses a small, fast pre-analysis model to act as an intelligent “traffic cop”. It quickly assesses an incoming query’s complexity. Simple, low-stakes tasks get routed to cheaper, faster models. Complex tasks requiring deep reasoning are escalated to the more powerful, expensive models. This dynamic routing architecture ensures the system is reliable from both a performance and a cost-efficiency perspective.</p><p><strong>Human-in-the-Loop (HITL):</strong></p><p>Acknowledging that AI is not perfect is crucial for reliability in high-stakes domains48. The HITL pattern is not about replacing AI, but about the <strong>strategic integration of human oversight</strong> at critical decision points. An AI might be great at flagging suspicious financial transactions, but you want a human to make the final call before freezing an account. This pattern is reserved for high-risk decisions where the cost of an AI error (financial, reputational, or safety-related) far outweighs the operational cost of human review.</p><h3>Summary: The Unifying Thread</h3><p>As we move from chatbots to autonomous engineers, the underlying challenge remains the same: how do we build systems we can trust?. The design patterns we’ve discussed are not just a collection of clever tricks; they are the pillars of a new engineering discipline focused on building reliable AI.</p><p><strong>Grounding</strong> through vetted tools and advanced RAG makes an agent’s knowledge verifiable.</p><p><strong>Transparency</strong> through Prompt Chaining and Chain of Thought makes its reasoning auditable.</p><p><strong>Offloading</strong> through PALM leverages the reliability of deterministic code for tasks where LLMs fail.</p><p><strong>Self-Correction</strong> through Reflection and Goal Monitoring makes its performance measurable.</p><p><strong>Practicality</strong> through Resource Optimization and Human-in-the-Loop makes it deployable in the real world.</p><p>Every single pattern is a strategy for mitigating risk and increasing predictability. It’s a deliberate shift away from simply prompting and towards building structured, verifiable system architectures.</p><h3>Call to Action</h3><p>The evolution from prompt engineering to agent architecture is one of the most exciting frontiers in AI today. The ultimate goal may be a future where we move from vague requests to formal <strong>“AI Contracts”</strong> — explicit, programmatic specifications that define deliverables, constraints, and costs, making the agent’s performance fully accountable.</p><p>But we are building that future now.</p><p>What patterns are you implementing in your work? What is the biggest reliability challenge you face when deploying agentic systems? Share your thoughts and experiences in the comments below. Let’s connect the dots together.</p><h3>Sources</h3><p>“AI Agents 3 — Agentic Design Patterns” uploaded on the YouTube channel “Prof. Ghassemi Lectures and Tutorials”. (<a href="https://youtu.be/-v7UQ1GPln8?si=SAU3mCqYK33x1O5M">https://youtu.be/-v7UQ1GPln8?si=SAU3mCqYK33x1O5M</a>)</p><p>“Agentic AI Design Patterns Introduction and walkthrough | Amazon Web Services” uploaded on the YouTube channel “Amazon Web Services”. (<a href="https://youtu.be/MrD9tCNpOvU?si=A5vpTR9RPPyVbvFl">https://youtu.be/MrD9tCNpOvU?si=A5vpTR9RPPyVbvFl</a>)</p><p>YouTube video “Master ALL 20 Agentic AI Design Patterns [Complete Course]” uploaded on the YouTube channel “Mark Kashef”. (<a href="https://youtu.be/e2zIr_2JMbE?si=azpuCyO35ASQ9wjb">https://youtu.be/e2zIr_2JMbE?si=azpuCyO35ASQ9wjb</a>)</p><p>Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems. by Antonio Gullí</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73d2b52ec80e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI-Powered Parking Assistant: From Melbourne’s Open Data to Vic-MCP]]></title>
            <link>https://medium.com/@gaurav.caprihan/building-an-ai-powered-parking-assistant-from-melbournes-open-data-to-vic-mcp-83f06b65cbd3?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/83f06b65cbd3</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[melbourne]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 00:24:36 GMT</pubDate>
            <atom:updated>2025-09-21T00:24:36.447Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Ever wondered what happens when city infrastructure meets artificial intelligence? Here’s how I turned Melbourne’s parking sensors into an AI assistant that actually knows where you can park.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*HwiNoa4clTnX7_BGwdrIDw.png" /></figure><h3>The Problem: Hunting for Parking in a Smart City</h3><p>Picture this: you’re driving around Melbourne’s CBD, circling blocks, watching other drivers do the same dance. While Melbourne has more than 130 off-street car parks providing 68,000 spaces, limited parking is available on the street in the city centre for short stays of up to two hours — yet most people still prefer the convenience of street-side parking for quick stops. Finding an available kerbside spot still feels like winning the lottery.</p><p>Here’s the thing though — Melbourne is actually way ahead of most cities when it comes to on-street parking technology. The City of Melbourne has installed in-ground parking bay sensors in more than 4,600 on-street parking bays around the city, with these sensors recording when a vehicle arrives and departs from each bay. The sensors provide real-time occupancy data showing whether a car is present or not present, along with spatial coordinates and kerbside IDs.</p><h3>Melbourne’s Hidden Smart Parking Infrastructure</h3><p>Before we dive into the solution, let’s appreciate what makes this special: Melbourne makes this sensor data publicly available through their Open Data portal, providing real-time occupancy status, spatial coordinates, and kerbside IDs from thousands of parking bays, updated continuously throughout the day. The infrastructure is there, the data is flowing, but accessing it in a useful way? That’s where things get interesting.</p><p>We’re talking about real-time data from thousands of parking bays, updated continuously throughout the day.</p><p>So here’s the challenge: Taking this raw municipal data and making it accessible to everyday users through natural language AI interactions.</p><h3>From Raw Data to AI-Accessible Intelligence</h3><p>To solve this, I built two key components: a parking API that processes Melbourne’s sensor data, and an AI bridge using Anthropic’s Model Context Protocol (MCP).</p><h3>The Parking API</h3><p>The core challenge was transforming Melbourne’s real-time sensor feeds into actionable parking intelligence. The API handles geospatial queries (find parking within X meters of your location), bulk status checking for performance, and iterative search expansion when no nearby spots are available.</p><p>Key innovation: Instead of returning “no results found,” the system automatically expands the search radius until it finds available parking, then returns structured results with Google Maps navigation links.</p><h3>The AI Bridge: Model Context Protocol</h3><p>MCP is an open standard for connecting AI assistants to data sources and tools, providing a universal interface like a USB-C port for AI applications. Before MCP, developers had to build custom connectors for each data source, resulting in an “N×M” integration problem.</p><p>The MCP server exposes two main tools to AI assistants:</p><ul><li>getBayStatus(kerbsideid) – Check if a specific parking bay is occupied</li><li>parkingSearchCLI(lat, lon, radius) – Find available parking near coordinates</li></ul><p>This enables natural language parking queries like:</p><ul><li><em>“Find me parking near Federation Square”</em></li><li><em>“Is parking bay 21753 currently available?”</em></li><li><em>“Where can I park within 100 meters of the State Library?”</em></li></ul><h3>How It Works: The Complete User Journey</h3><p>The architecture diagram shows how all the pieces fit together in practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*3QuAoiNsahiXqWeeQsx5JA.png" /></figure><p>Let’s walk through a real user scenario:</p><p><strong>Step 1: Natural Language Query</strong><br> A user asks their AI assistant: <em>“Find me parking near 300 Collins Street”</em></p><p><strong>Step 2: Location Resolution &amp; Search</strong><br> The LLM converts “300 Collins Street” into coordinates (latitude: -37.8136, longitude: 144.9631), then calls parkingSearchCLI(lat, lon, radius) through the MCP server. This triggers the core API to search Melbourne&#39;s sensor data for available bays within the specified radius.</p><p><strong>Step 3: Results &amp; Navigation</strong><br> The system returns a list of available parking bays with clickable Google Maps links. The user selects one and begins navigating to their chosen spot.</p><p><strong>Step 4: Real-Time Monitoring</strong><br> Here’s where the second tool becomes crucial. As the user drives toward their selected bay, the system periodically calls getBayStatus(kerbsideid) using the specific bay&#39;s identifier. If that spot gets occupied while they&#39;re en route, the AI assistant immediately alerts them and offers the next nearest available option.</p><p>This creates a dynamic, responsive parking experience that adapts to real-time changes — something impossible with static parking apps or traditional wayfinding.</p><p>Beyond just finding a vacant spot, the system can be extended. For example, I’ve also developed a tool that analyses parking signs to determine restrictions, saving users from potential fines. More on that in a future post.</p><p>Further, the diagram also proposes a sample implementation for building an LLM powered mobile app an LLM-powered mobile app, let’s call it ParkBuddy-AI, that could offer all these in one consolidated platform.</p><h3>Real-World Results and Municipal Applications</h3><p>The system successfully bridges the gap between Melbourne’s sophisticated parking infrastructure and user-friendly AI interactions. But the implications go far beyond parking.</p><p>This architecture creates a template for making any municipal data source accessible through AI assistants. Cities worldwide are generating incredible amounts of real-time data: traffic patterns, air quality monitoring, public transport updates, facility usage statistics. Most of it sits behind APIs that are technically public but practically inaccessible to everyday users.</p><p>The combination of clean API design around municipal data, MCP integration for AI accessibility, and modern deployment practices creates a blueprint for civic tech that actually gets used.</p><h3>Looking Forward: The VIC-MCP Platform Vision</h3><p>This project demonstrates something much bigger than parking: how MCP wrappers around existing municipal APIs can create a powerful, unified platform for civic services.</p><p>Imagine a comprehensive “VIC-MCP” platform that aggregates multiple Victorian government services under a single AI-accessible umbrella:</p><ul><li><strong>Transport</strong>: Real-time tram/train delays, route planning, accessibility information</li><li><strong>Health</strong>: Hospital wait times, bulk billing GP availability, vaccination center capacity</li><li><strong>Environment</strong>: Air quality alerts, beach safety conditions, fire danger ratings</li><li><strong>Public Safety</strong>: Road closures, emergency service updates, community safety alerts</li><li><strong>Recreation</strong>: Park facilities availability, sports ground bookings, event information</li></ul><p>The beauty of the MCP approach is that each government department can maintain their existing APIs while adding a standardized MCP wrapper. This creates an ecosystem where:</p><ol><li><strong>Citizens</strong> get natural language access to all government services through any AI assistant</li><li><strong>Developers</strong> can build applications that integrate multiple services without custom connectors</li><li><strong>Government agencies</strong> can expose their data more effectively without rebuilding infrastructure</li><li><strong>Innovation</strong> happens at the application layer while preserving existing investments</li></ol><p>The infrastructure exists. MCP’s open protocol enables developers to build against a standard instead of maintaining separate connectors for each data source. Now it’s about scaling this approach across entire government ecosystems.</p><h3>A Blueprint for Smart Cities</h3><p>Municipal governments invest heavily in smart infrastructure — sensors, data collection, real-time monitoring systems. But without accessible interfaces, this technology remains invisible to the people it’s meant to serve.</p><p>This parking project demonstrates how open standards like MCP can bridge that gap, transforming municipal data from bureaucratic resources into tools that citizens actually use. The VIC-MCP vision takes this further: creating a unified, AI-accessible interface to all government services.</p><p>The opportunity is massive. Victoria’s government already provides extensive digital services and open data. What’s missing is the connective tissue that makes it truly accessible. MCP provides that missing link, turning fragmented government APIs into a cohesive, voice-enabled civic platform.</p><p><em>Want to dive deeper? Check out the complete source code for both the </em><a href="https://github.com/caprihan/parkBuddy-ai"><em>parking API</em></a><em> and </em><a href="https://github.com/caprihan/parkBuddy-ai-mcp"><em>MCP server</em></a><em> on GitHub.</em></p><p><strong>Sources:</strong></p><ul><li>City of Melbourne Off-street Parking Statistics</li><li>City of Melbourne On-Street Parking Sensor Data</li><li>Melbourne Open Data Portal — Parking Bay Sensors Dataset</li><li>Anthropic Model Context Protocol Documentation</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83f06b65cbd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Babel: Bridging AI’s Communication Gap with MCP, A2A, and ACP]]></title>
            <link>https://medium.com/@gaurav.caprihan/beyond-babel-bridging-ais-communication-gap-with-mcp-a2a-and-acp-35e348bb4233?source=rss-68f5da47a42c------2</link>
            <guid isPermaLink="false">https://medium.com/p/35e348bb4233</guid>
            <category><![CDATA[mcp-protocol]]></category>
            <category><![CDATA[a2a-protocol]]></category>
            <category><![CDATA[acp-protocol]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Gaurav Caprihan, Ph.D]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 23:28:40 GMT</pubDate>
            <atom:updated>2025-09-14T23:28:40.489Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*pE3gXA90Lik1E1MXlNFXhQ.png" /></figure><p>A few days back, I was one of the speakers at a local meetup where I talked about n8n. During an earlier talk in the same session, the emerging technologies A2A and ACP were mentioned, sparking a fascinating conversation afterward. It highlighted a critical challenge brewing just under the surface of Agentic AI: a digital “Tower of Babel,” where incredibly powerful agents can’t effectively communicate with one another because they speak different “dialects”. This discussion sparked an urge for me to delve deeper. I wanted to understand what these protocols are and how they, along with the foundational Model Context Protocol (MCP), fit into the larger storyline of creating a truly interconnected AI ecosystem.</p><h4>The Problem: A Digital Tower of Babel</h4><p>The core issue we’re facing in AI agent development is fragmentation. Agents are being built across countless different frameworks — LangChain, Autogen, custom in-house solutions — often in completely isolated environments, like walled gardens.</p><p>This isn’t just a small technical hurdle; it creates a “digital sticky floor” where every new integration becomes a custom, brittle hack. This inefficiency grinds innovation to a halt and puts a hard ceiling on the true potential of AI. Companies resort to building expensive custom links or even having humans manually pass information between agents. It’s a huge bottleneck that prevents these powerful systems from achieving their collaborative potential. If we want agents to solve truly complex problems together, those isolated islands of intelligence desperately need bridges.</p><h4>MCP: The “USB-C Port” for a Single AI</h4><p>The first bridge starts at the individual agent level. Let’s talk about the <strong>Model Context Protocol (MCP)</strong>, which comes from Anthropic. The best analogy I’ve heard for it is the “USB-C port for AI”.</p><p>MCP’s job is to standardize how a <em>single</em> AI agent connects to its tools — whether that’s an API, a database, or any external system it needs to interact with. It’s not about agents talking to each other yet. It’s about giving a single AI brain its “hands and eyes” so it can actually perform actions in the world.</p><ul><li><strong>How it works:</strong> An MCP server provides a set of available tools and instructions. The LLM itself acts as the MCP client, communicating with the server to discover what tools it can use and how to call them. Communication is handled through the standardized JSON RPC 2.0 protocol.</li><li><strong>The Big Win:</strong> This radically lowers the barrier to entry for tool developers. They no longer need to build custom integrations for every single LLM. They can just build a tool that supports MCP, and suddenly any MCP-enabled AI can use it, unleashing a wave of innovation.</li></ul><p>I demonstrated a concrete example where I stitched up a very simple n8n workflow triggered via Slack comprising of an Agent with an OpenAI Chat Model, a simple in memory store for storing context and an MCP server comprising of tools that leveraged the (enormously useful and free) datasets exposed by the City of Melbourne — On Street Parking Bay sensors being one of them. This simple setup provided users with an ability to search for parking bays with a simple prompt such as “Find me a parking near 150 Collin’s Street”. The results contained clickable Google Map links that would then open the app to initiate the navigation process.</p><p>The amazing part is that the LLM figures out that it needs to pass a latitude and longitude (lat-long) tuple to the tool and performs this sequence of needing to fetch that from the location name provided, before invoking the tool.</p><h4>A2A: Global Diplomacy for Different AI Minds</h4><p>So, MCP gives an agent its tools. But what happens when that agent needs help from another, specialized AI, maybe one built by a completely different stack (Crew-AI/Semantic‑Kernel, Autogen or a custom in‑house setup) or company?</p><p>This is where the <strong>Agent-to-Agent (A2A) Protocol</strong> steps in. Originally from Google, it’s now an open standard under the Linux Foundation, which is key. If MCP is about a brain talking to its own tools, A2A is about one brain talking directly to another brain. It provides that shared language for different AIs to collaborate, breaking down the silos we talked about earlier.</p><ul><li><strong>Core Concepts:</strong> A2A introduces a few brilliant ideas to make this work:</li><li><strong>Agent Cards:</strong> Think of these as digital business cards or LinkedIn profiles for AIs. They are JSON files that list an agent’s capabilities, how to connect with it, and what it can do. This allows agents to dynamically discover and even “interview” other agents to form ad-hoc teams to solve problems, often without human intervention.</li><li><strong>Opaque Interactions:</strong> This is crucial for security and trust. Agents don’t need to share their internal memory or proprietary logic. They communicate through the standardized A2A interface, which acts as a “black box,” protecting intellectual property. This is vital for interactions between agents from different, potentially competing, organizations.</li><li><strong>Technical Backbone:</strong> Like MCP, A2A uses HTTPS and JSON RPC 2.0 for data exchange but adds support for asynchronous updates via Webhooks or Server-Sent Events (SSE). This means agents don’t have to constantly ask, “Are you done yet?” for long-running tasks; they just get a notification when the result is ready.</li></ul><h4>Putting It All Together: A Complementary Ecosystem</h4><p>It’s important to understand that these protocols aren’t in a competition with each other. They are complementary pieces of a much larger puzzle, each solving a different part of the communication problem. While this study focused primarily on MCP and A2A, the third major player is the <strong>Agent Communication Protocol (ACP)</strong>. ACP also focuses on facilitating direct communication and coordination between different agents, similar to A2A.</p><p>Here’s how they fit together:</p><ol><li><strong>MCP</strong> equips a single agent with its tools, giving it the ability to act.</li><li><strong>A2A and ACP</strong> provide the language and rules for these now-capable agents to talk to <em>each other</em>, to collaborate, delegate tasks, and form complex teams.</li></ol><p>By combining these standards, we’re not just building individual smart agents; we’re building the foundation for an “agented internet” — a future where interconnected AI systems can collaborate to solve problems far beyond the scope of any single agent today. We’re finally building the bridges to move beyond Babel.</p><h4>Sources and Further Reading</h4><ul><li>“A Practitioner’s Guide to Agent Communication Protocol (ACP)” <a href="https://adasci.org/a-practitioners-guide-to-agent-communication-protocol-acp/">https://adasci.org/a-practitioners-guide-to-agent-communication-protocol-acp/</a></li><li>“A2A Protocol Documentation” <a href="https://a2a-protocol.org/">https://a2a-protocol.org/</a></li><li>“AI Agent Protocols Explained: MCP, A2A, ACP and More” on the YouTube channel “Better Stack” <a href="http://www.youtube.com/watch?v=tb0c70DROYE">http://www.youtube.com/watch?v=tb0c70DROYE</a></li><li>“AI Agent Protocols: MCP, ACP, and A2A Analyzed” on the YouTube channel “Zero Latency Learning” <a href="http://www.youtube.com/watch?v=xj2xFMXLYDs">http://www.youtube.com/watch?v=xj2xFMXLYDs</a></li><li>“Agent to Agent Protocol: Helping AI Agents Work Together” <a href="https://www.analyticsvidhya.com/blog/2025/04/agent-to-agent-protocol/">https://www.analyticsvidhya.com/blog/2025/04/agent-to-agent-protocol/</a></li><li>“All You Need To Know About Google Agent2Agent Protocol- A2A Vs MCP” on the YouTube channel “Krish Naik” <a href="http://www.youtube.com/watch?v=56BXHCkngss">http://www.youtube.com/watch?v=56BXHCkngss</a></li><li>“The Rise Of Agent Protocols: Exploring MCP, A2A And ACP | Blog — Everest Group” <a href="https://www.everestgrp.com/uncategorized/the-rise-of-agent-protocols-exploring-mcp-a2a-and-acp-blog.html">https://www.everestgrp.com/uncategorized/the-rise-of-agent-protocols-exploring-mcp-a2a-and-acp-blog.html</a></li><li>“Welcome — Agent Communication Protocol” <a href="https://agentcommunicationprotocol.dev/">https://agentcommunicationprotocol.dev/</a></li><li>“What Is Agent2Agent (A2A) Protocol? | IBM” <a href="https://www.ibm.com/think/topics/agent2agent-protocol">https://a2a-protocol.org/</a></li><li>“What Makes Google’s A2A Protocol REALLY POWERFUL (in 12 Minutes)” on the YouTube channel “Jack Herrington” <a href="https://www.google.com/search?q=http.com/watch%3Fv%3DvoaKr_JHvF4&amp;authuser=2">https://www.google.com/search?q=http.com/watch%3Fv%3DvoaKr_JHvF4&amp;authuser=2</a></li><li>“What is A2A (Agent to Agent Protocol)? | A2A Explained” on the YouTube channel “codebasics” <a href="http://www.youtube.com/watch?v=Sl9EZpE61xA">http://www.youtube.com/watch?v=Sl9EZpE61xA</a></li><li>“What is Agent Communication Protocol (ACP)? | IBM” <a href="https://www.ibm.com/think/topics/agent2agent-protocol">https://www.ibm.com/think/topics/agent2agent-protocol</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35e348bb4233" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>