<?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 Rishi Bhatnagar on Medium]]></title>
        <description><![CDATA[Stories by Rishi Bhatnagar on Medium]]></description>
        <link>https://medium.com/@rishi.bhatnagar?source=rss-b306b80e7ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Y3PPSPmQSFDG3snzn5y3RA.jpeg</url>
            <title>Stories by Rishi Bhatnagar on Medium</title>
            <link>https://medium.com/@rishi.bhatnagar?source=rss-b306b80e7ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:16:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rishi.bhatnagar/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 Shadow at the Fryer]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-shadow-at-the-fryer-50bbd155039b?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/50bbd155039b</guid>
            <category><![CDATA[context-aware-ai]]></category>
            <category><![CDATA[co-pilot]]></category>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 23:55:11 GMT</pubDate>
            <atom:updated>2026-04-20T23:55:11.249Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4>The Co-Pilot Pattern</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="A young man (Gopal) stands next to the cashier, holding a wooden slate with ‘chips’ like ‘Summarize’ and ‘Visualize’ on it. He wears a small earpiece. In the background, a digital ‘Side Panel’ effect shows Sita in her office, seeing a live data-reflection of the stall. Samir, the architect, watches the interaction with a look of dawning realization." src="https://cdn-images-1.medium.com/max/1024/1*qKQQJIxkz1Jqudx2ko67jg.jpeg" /><figcaption>Multiple Co-Pilots helping out cashiers observe and talk to Sita</figcaption></figure><p>The evening rush at Samosa Hub was less of a business hour and more of a tactical exercise. The air was thick with the scent of cardamom and hot oil, and the line of customers stretched past the neighboring flower stall.</p><p>Samir squeezed through the crowd, finding his usual spot at the end of the counter. He noticed something different immediately. Standing next to the main cashier was a young man, who wasn’t handling money, nor was he bagging samosas. He held a small wooden slate and wore a single earpiece connected to a radio on his belt.</p><p>“New hire, Kumar?” Samir asked as the vendor handed him a steaming cup of chai.</p><p>“Not exactly,” Kumar said, leaning against the counter. “He’s Gopal, and I call him the ‘Shadow.’ But Sita calls him her ‘Co-Pilot.’ You see, Samir, we had a problem. Sita is in that fancy office downtown. She has all the spreadsheets and the five-year plans, but she’s blind to the street. She doesn’t know when the monsoon rain starts to leak through the awning, or when a customer makes a face because the chutney is too tart.”</p><p>“So Gopal is a reporter?”</p><p>“More like a bridge,” Kumar explained. “He stands right next to the cashier. He sees exactly what the cashier sees. If a customer walks up with a massive catering request written on a crumpled napkin, Gopal doesn’t wait for the cashier to struggle. He looks at the napkin, whispers the details into his radio, and Sita — miles away — immediately calculates the discount and the delivery time.”</p><p>Samir watched as a customer approached the counter with a complicated question about a bulk order for a wedding. Instead of the cashier panicking, Gopal tapped his slate. He had a few pre-carved wooden “chips” on the side of the slate. He tapped one labeled <strong>‘SUMMARIZE.’</strong></p><p>“Sita,” Gopal whispered. “Wedding order. 500 pieces. Needs a summary of our capacity for Saturday.”</p><p>A moment later, Gopal scribbled three bullet points on his slate and showed it to the cashier. The cashier nodded and gave the customer an immediate, confident answer.</p><p>“It’s like they share a brain,” Samir remarked.</p><p>“That’s exactly it!” Kumar said. “And it goes both ways. Last week, a customer brought in a competitor’s coupon. The cashier didn’t know what to do. He asked Gopal, ‘Can we match this?’ Gopal didn’t have to look it up. Sita was already ‘watching’ through Gopal’s narration. She told him, ‘Match it, but only if they buy a box of gulab jamun too.’ Gopal told the cashier, and the sale was saved.”</p><p>Kumar waved his hand toward the other end of the counter, where a second cashier was dealing with a delivery driver. Another “Shadow” was standing there, also with an earpiece.</p><p>“They both talk to Sita?” Samir asked.</p><p>“Yes,” Kumar said. “Sita is one person, but she can ‘pilot’ multiple stalls at once because the Shadows provide the context. She knows what’s happening at the fryer in Outlet 1 and the front counter in Outlet 4 simultaneously. She’s the expert sitting on everyone’s shoulder.”</p><p>Samir sat in silence for a long time, his chai getting cold. The architectural parallel was staggering.</p><p>“Kumar,” Samir finally said. “You’ve just implemented the <strong>Co-Pilot Pattern</strong>.”</p><p>“Here we go,” Kumar sighed with a smile. “Give me the technical version, my friend.”</p><p>“In my world,” Samir said, pulling out a napkin to draw, “we usually build AI as a separate ‘destination.’ If a user wants help, they have to leave the ‘page’ they are working on, go to a chat box, and explain everything from scratch. It’s like your cashier having to run downtown to talk to Sita every time a customer asks a question.”</p><p>“A total waste of oil,” Kumar agreed.</p><p>“Exactly. But your ‘Shadows’ are like a <strong>Browser Extension</strong> or a <strong>Side Panel</strong>,” Samir continued. “Because they exist <em>inside</em> the user’s workspace, they don’t need an explanation. They share the <strong>Context</strong>. When the cashier sees a ‘napkin’ (a webpage), the Co-Pilot sees it too. The AI doesn’t wait for a prompt; it observes the environment and provides specialized <strong>Tools</strong> — like your ‘Summarize’ or ‘Extract’ chips — to act on that specific moment.”</p><p>Samir circled the drawing of the earpiece. “And by allowing the cashier to ask questions back through the Shadow, you’ve created a <strong>Bi-directional Agentic Loop</strong>. The human provides the hands, the Co-Pilot provides the context, and the central Intelligence provides the reasoning. It turns every worker into an expert.”</p><p>Kumar handed Samir a fresh, hot samosa to replace the cold one. “I don’t know about ‘Bi-directional loops,’ Samir. I just know that my cashiers aren’t stressed anymore, and Sita feels like she’s standing right here in the heat with us.”</p><p><strong>Technical Takeaway:</strong></p><p><em>The </em><strong><em>Co-Pilot Pattern</em></strong><em> (commonly implemented as a Browser Extension) is the gold standard for </em><strong><em>Contextual Intelligence</em></strong><em>. Unlike traditional chatbots, a Co-Pilot shares the user’s “Sensory Space” — the Document Object Model (DOM) of the page they are currently viewing. This shared context allows for three critical capabilities:</em></p><ol><li><strong>Zero-Shot Context:</strong> <em>The AI knows the “Title,” “Tables,” and “Content” of the current page without the user having to explain it.</em></li><li><strong>Specialized Tooling:</strong> <em>The UI provides “Command Chips” (Summarize, Extract, Visualize) that trigger specific </em><strong><em>Agentic Tools</em></strong><em> to act on the current page’s data.</em></li><li><strong>The Sidebar Loop:</strong> <em>By persisting as a Side Panel, the AI remains available across navigations, allowing for a continuous, multi-turn conversation that “travels” with the user through their workflow.</em></li></ol><p>Reference GitHub: <a href="https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/chrome-ai-mode">https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/chrome-ai-mode</a></p><p>← <a href="https://medium.com/@rishi.bhatnagar/the-grease-stained-ledger-29807011c7b9">Prev: The Grease-Stained Ledger</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50bbd155039b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Grease-Stained Ledger]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-grease-stained-ledger-29807011c7b9?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/29807011c7b9</guid>
            <category><![CDATA[data-contract]]></category>
            <category><![CDATA[data-foundation]]></category>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <category><![CDATA[technical-parable]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 17:58:54 GMT</pubDate>
            <atom:updated>2026-04-20T23:56:18.411Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4>The Canonical Data Pattern</h4><blockquote><em>Note: This story is part of the </em><strong><em>Parables of Architecture Patterns</em></strong><em> series. Please refer to the origin story </em><a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4"><em>here</em></a><em>.</em></blockquote><figure><img alt="On one side, Kumar and Sita are frustrated, sorting through a chaotic, greasy pile of torn receipts and napkins stained with samosa oil — representing ‘Data Debt.’ On the other side, they are organizing a clean, professional station with standardized, waterproof binders and a ‘Data Contract’ checklist on the wall" src="https://cdn-images-1.medium.com/max/1024/1*6WGb1atmphKl-yNUfDyS0w.jpeg" /><figcaption>Kumar and Sita looking happy at clean accounting ledgers</figcaption></figure><p>Kumar stood in the middle of his flagship store, surrounded by a mountain of paper. There were crumpled receipts stained with ginger-garlic paste, napkins with scribbled order numbers, and, in some stores, nothing at all — just a manager’s “best guess” at how many samosas were sold.</p><p>“Sita,” Kumar sighed, throwing a greasy, illegible receipt into the bin. “How are we supposed to plan for New Delhi when we can’t even tell which outlet is making a profit? Outlet 2 counts by weight, Outlet 3 counts by the piece, and Outlet 4… well, I think they just count by how much cash is in the drawer at closing.”</p><p>Sita held up a hand. “We have to stop accepting ‘creative accounting,’ Kumar. It’s not just the mess; it’s that we are speaking five different languages. When I try to reconcile the books, I’m not analyzing data — I’m translating fiction.”</p><p>Kumar took a deep breath. “Enough. Tomorrow, the ‘Wild West’ ends.”</p><p>He and Sita spent the next week visiting every stall. They didn’t just tell the managers to “do better.” They implemented three iron-clad rules:</p><ol><li><strong>The Standard Template:</strong> They provided every stall with a standardized, waterproof ledger. No more napkins. If a receipt wasn’t on the template, it was as good as trash.</li><li><strong>The “Check-at-the-Door” Rule:</strong> Sita trained a clerk to audit the ledgers <em>before</em> they were filed. If a ledger had a missing field or an “estimation,” it was sent back to the stall manager to fix immediately.</li><li><strong>The Unified Language:</strong> They defined exactly what a “Sale” was (Time, SKU, Quantity, Price). They stopped accepting “Creative Bundling”, where managers made up their own prices.</li></ol><p>Two weeks later, Samir walked into the flagship store. He noticed the mountain of chaos was gone, replaced by neat, uniform binders.</p><p>“You look like you’ve actually slept,” Samir noted.</p><p>“I have,” Kumar said. “We stopped letting every store create its own reality. We forced them into a ‘Single Truth’ format. Now, Sita doesn’t spend her time decoding secrets; she spends it actually improving the business.”</p><p>Samir looked at the standardized ledger and smiled. “Kumar, you’ve just implemented a <strong>Canonical Data Model</strong> and <strong>Data Contracts</strong>.”</p><p>“Don’t start with the software words again,” Kumar groaned.</p><p>“I can’t help it!” Samir laughed. “In my world, we have different systems — some writing in messy code, some in databases, some in spreadsheets. We call it ‘Data Debt.’ You just solved it by enforcing a <strong>Data Contract</strong>. By requiring a standard format <em>before</em> the data enters your system, you’ve ensured that your ‘Brain’ (Sita) can actually trust the information it receives. You’ve moved from ‘Data Gathering’ to ‘Data Governance.’”</p><p>Kumar picked up a freshly printed, clean receipt. “Whatever you call it, Samir, it’s the difference between guessing and knowing.”</p><p><strong>Technical Takeaway:</strong></p><p><em>The </em><strong><em>Grease-Stained Ledger</em></strong><em> parable is an object lesson in canonical data models, demonstrating that a “Brain” (Sita/AI) is only as competent as the quality of the “Truth” (Data) it consumes. While Kumar and Sita resolved their chaos with waterproof ledgers and a deterministic clerk, at my firm, we have formalized this transition into a rigorous </em><strong><em>Canonical Data Standard</em></strong><em>. We stopped accepting data from disparate systems until it has passed through a robust </em><strong><em>Ingestion &amp; Validation Pipeline</em></strong><em>. To bridge our own “Grease-Stained Data Debt,” we have established the following five core data practices:</em></p><ol><li><strong>Canonical Data Model Enforcement:</strong> <em>We standardized what our core business entities look like. Just as Kumar’s stalls can’t create “Creative Bundling,” our service endpoints must emit a predefined sale, customer, and inventory schema. Data that does not conform is sent back to the silo to be corrected.</em></li><li><strong>Schema-Driven Data Contracts:</strong> <em>We moved past “best effort” data delivery to contract-driven delivery. A Data Contract defines the expected data structure, types, and quality rules. Our APIs validate every incoming request against this schema in real-time, enforcing the “Check-at-the-Door Rule” without human intervention.</em></li><li><strong>Data Observability &amp; Anomaly Detection:</strong> <em>Just as Kumar smells the oil on a receipt to know it’s a mess, we use monitoring to detect anomalies in data streams. If a warehouse system suddenly stops emitting price, or if an SKU count drops by 90%, our observability layer flags it, preventing the “FICTION” from entering the central data warehouse.</em></li><li><strong>Deterministic Master Data Management (MDM):</strong> <em>We established a Single Source of Truth for critical dimensions (like SKUs and Prices). We no longer allow regional offices (like Outlets 2 or 3) to modify this core reference data. A shared SKU means the exact same product and pricing structure globally.</em></li><li><strong>Strict Auditability:</strong> <em>Every data transformation from raw input (the oily napkin) to the clean ledger is tracked. This lineage ensures that if Sita (or our AI agent) makes a strategic error, we can trace it back to the precise data artifact that misled her, ensuring total accountability of our data foundation.</em></li></ol><p><a href="https://medium.com/@rishi.bhatnagar/the-nephew-behind-the-curtain-0e7a2bc1c3cd">← Prev: The Nephew Behind the Curtain</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-shadow-at-the-fryer-50bbd155039b">The Shadow at the Fryer: Next →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29807011c7b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Nephew Behind the Curtain]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-nephew-behind-the-curtain-0e7a2bc1c3cd?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e7a2bc1c3cd</guid>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[chain-of-thought-monitor]]></category>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <category><![CDATA[agentic-architecture]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 00:38:32 GMT</pubDate>
            <atom:updated>2026-04-19T17:59:56.628Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4>The Chain-of-Thought Monitor</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="Kumar proudly showing a pristine business folder to Samir, with a thought bubble: Dev sitting at a desk with a ‘REJECTED’ stamp and a laminated ‘Ground Truth Rules’ checklist, sternly reviewing a notepad full of handwritten ideas." src="https://cdn-images-1.medium.com/max/1024/1*n7FDs1xvk_BAdefckJySuw.jpeg" /><figcaption>Kumar proudly showing a his Delhi expansion strategy to Samir</figcaption></figure><p>“Samir! Come, I have something to show you,” Kumar beamed, wiping the counter as the architect approached the stall. Kumar proudly slapped a thick, beautifully bound folder onto the wood. “The complete strategy for our expansion into New Delhi. Courtesy of Sita, my brilliant General Manager.”</p><p>Samir picked it up, flipping through the pristine pages. “Congratulations, Kumar. New Delhi is a tough market. Did she get the local sourcing right?”</p><p>“She did,” Kumar smiled. “But it almost didn’t happen. You see, Sita is a visionary. Sometimes, her imagination runs a little too wild. Last week, she handed me her first draft for Delhi. It was a masterpiece — except she wanted to import frozen potatoes from Europe to save prep time. I had to throw a fifty-page plan in the trash because she missed one of my core business rules.”</p><p>“That’s the danger of a brilliant mind,” Samir nodded, sipping his chai. “They skip over the boring constraints. So, how did you fix it?”</p><p>“If I wait until the plan is finished to check her work, I waste days,” Kumar said, leaning in. “So, I changed the process. I bought her a special ledger. The left page is just for her rough notes — her <em>reasoning</em>. The right page is for the final plan. And then, I hired my nephew, Dev.”</p><p>“Dev? The one who failed his accounting exams?”</p><p>“Exactly,” Kumar laughed. “Dev has absolutely no imagination. He is rigid. He only follows instructions. I sat Dev in a chair right outside Sita’s office and gave him a laminated card with three absolute ‘Ground Truths’: 1. Potatoes must come from local Mandis. 2. The spice blend must come from our HQ. 3. The neighborhood votes on the monthly flavor.”</p><p>Samir looked intrigued. “And what does Dev do?”</p><p>“Every time Sita fills out the left page with her reasoning, she hands it to Dev,” Kumar explained. “Before she is allowed to write a single word of the final plan on the right page, Dev reads her thoughts. Yesterday, she wrote: <em>‘To ensure flavor consistency across Delhi, we will partner with a massive commercial spice vendor.’</em> Dev looked at his card, stamped a giant red <strong>REJECTED: RULE 2</strong> on her page, and handed it back.”</p><p>“And how did Sita react?”</p><p>“She was annoyed for about ten seconds,” Kumar chuckled. “Then she crossed it out, thought about it, and wrote: <em>‘We will set up a weekly transport from HQ to deliver our secret spice blend.’</em> Dev stamped it <strong>APPROVED</strong>, and she finally wrote it into the official plan. Dev doesn’t write the strategy. He just audits her logic.”</p><p>Samir set his chai glass down very slowly. He stared at the folder, then at Kumar.</p><p>“Kumar… you are a genius.”</p><p>“Because I employed my lazy nephew?”</p><p>“No,” Samir said, pulling out his notebook. “Because you didn’t audit just the final output. You audited her <em>reasoning process</em>. In the software world, we have powerful AI agents that do exactly what Sita does: they ‘hallucinate’ grand plans but forget the hard constraints. Most engineers try to write code to check the final answer. You just invented a <strong>Chain-of-Thought Monitor</strong>.”</p><p>Kumar crossed his arms, amused. “Explain.”</p><p>“When an AI agent thinks, we can force it to write its ‘scratchpad’ out loud — its Chain of Thought,” Samir said, sketching a diagram. “Your nephew Dev is a deterministic script — a strict, rigid monitor. The laminated card is our JSON ‘Ground Truth’ file. By forcing the agent to pass its reasoning through the monitor <em>before</em> it generates the final output, you catch the hallucination immediately. If a rule is broken, the monitor kicks it back, and the agent self-corrects.”</p><p>Kumar slid a fresh samosa across the counter to his friend. “I don’t know about JSONs or hallucinations, Samir. I just know Dev finally has a job, and my samosas in Delhi will taste exactly like the ones right here.”</p><p><strong>Technical Takeaway:</strong></p><p><em>The </em><strong><em>Chain-of-Thought (CoT) Monitor</em></strong><em> pattern is a vital guardrail against AI hallucinations. Instead of merely validating an agent’s final output (which is often too late or too complex to parse), you force the LLM to expose its intermediate reasoning steps. You then implement a rigid, deterministic “Auditor” (like a Python script using regex or keyword matching) to evaluate those thoughts against a “Ground Truth” dataset. If the agent’s logic violates a business constraint, the Auditor flags it, halting the generation and forcing the LLM to self-correct. You stop the error in the reasoning phase, ensuring the final output is always compliant.</em></p><p>Reference GitHub: <a href="https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/reasoning-chain-monitor">https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/reasoning-chain-monitor</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-ledger-that-survived-the-storm-01ad0bce7a1f">← Prev: The Ledger that Survived the Storm</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-grease-stained-ledger-29807011c7b9">The Grease-Stained Ledger: Next →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e7a2bc1c3cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ledger that Survived the Storm]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-ledger-that-survived-the-storm-01ad0bce7a1f?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/01ad0bce7a1f</guid>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[agentic-architecture]]></category>
            <category><![CDATA[checkpointer]]></category>
            <category><![CDATA[persistent-memory]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Fri, 10 Apr 2026 11:00:27 GMT</pubDate>
            <atom:updated>2026-04-19T18:18:16.924Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4>The Persistence Pattern</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="Kumar uses a flashlight to show a large, handwritten book filled with colorful bookmarks" src="https://cdn-images-1.medium.com/max/1024/1*X90f_W2F3YqMC2W9uSpMJw.jpeg" /><figcaption>Kumar uses a flashlight to show a large, handwritten book filled with colorful bookmarks</figcaption></figure><p>“Samir! Come in, stay dry,” Kumar called out, waving the architect into the stall. The monsoon rain was relentless, hammering against the tin roof like a drum.</p><p>Samir shook out his umbrella. “Quite a storm, Kumar. How is the new system holding up? Is Sita still managing the audits from downtown?”</p><p>“She is,” Kumar said, pouring a steaming cup of chai. “But we almost had a disaster yesterday. The power went out across the whole city. The intercoms went dark, the lights flickered out, and for two hours, the business just… stopped.”</p><p>“Ah, the reality of the physical layer,” Samir noted. “Did you lose your data?”</p><p>“That’s the thing,” Kumar leaned in. “Before the storm, I was using a fancy ‘Managed Concierge Service’ for our records. They kept all our history in their private vault downtown. It sounded great — no filing for me to do. But when the power flickered, I realized I couldn’t actually <em>see</em> the books. I had to call them, wait for ‘permission,’ and half the time they told me my key didn’t work in this weather.”</p><p>“So, what did you change?”</p><p>“I went back to basics, but with a twist,” Kumar pointed to a heavy, leather-bound ledger sitting on the counter, tucked into a small wooden alcove. “I realized that if Sita is the brain, she needs a memory that I can actually touch. Now, every single word she says over the intercom, and every action the Liaison takes, is written instantly into this book.”</p><p>“A local checkpoint,” Samir whispered.</p><p>“Exactly. And look here,” Kumar flipped to a page with a blue tab. “This tab is for you, Samir. Every time you come in, I flip to the ‘Samir Thread.’ Even if the power goes out for a week, the moment I open this book to your tab, I remember exactly how much sugar you like in your chai and that you prefer the spicy chutney over the sweet one.”</p><p>Just then, a massive crack of thunder echoed, and the lights in the stall surged and died. They were plunged into darkness.</p><p>Kumar didn’t panic. He reached under the counter, pulled out a flashlight, and shone it directly on the open ledger. “See? The ‘system’ just crashed. But the ‘state’ is right here. When the lights come back, I don’t have to ask you who you are or what we were talking about. I just read the last line.”</p><p>Samir laughed, deeply impressed. “Kumar, you’ve moved from <strong>Transient Memory</strong> to <strong>Transparent Persistence</strong>. In the software world, we call that a <strong>Checkpointer</strong>.”</p><p>“A checkpointer?”</p><p>“Yes. Instead of letting a cloud provider hide your conversation history in a black box, you’re using a pattern like <strong>LangGraph with a SQLite Saver</strong>. You’ve turned the conversation into a ‘state’ that is saved to a local database. If the script — or your stall — crashes, you don’t lose the context. You just reload the thread_id and pick up exactly where you left off.”</p><p>Kumar nodded, scribbling a note in the ledger by flashlight. “I like it. I don’t care if the concierge is closed for the night. I have my own books now.”</p><p><strong>Technical Takeaway:</strong></p><p><em>Cloud-managed AI agents (like Bedrock) offer “Stateful Runtimes,” but they often come with “Cloud Friction”: regional latency, opaque history, and complex permission hurdles. For builders who need </em><strong><em>explicit control</em></strong><em>, the </em><strong><em>LangGraph Persistence</em></strong><em> pattern is superior. By using a local SqliteSaver, the agent’s state becomes transparent and resilient. You can inspect the .db file to see exactly what the agent “remembers,” and by using thread_id as a configuration key, you can maintain long-term, multi-turn persistence that survives system restarts. Don’t let your agent’s memory be a black box — keep the ledger on your own counter.</em></p><p>Reference GitHub: <a href="https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/langgraph-stateful-agent">https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/mcp-interactive-tool</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-strategist-without-hands-09ccfffacaf9">← Prev: The Strategist without Hands</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-nephew-behind-the-curtain-0e7a2bc1c3cd">The Nephew behind the Curtain: Next →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01ad0bce7a1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Strategist without Hands]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-strategist-without-hands-09ccfffacaf9?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/09ccfffacaf9</guid>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[agent-loop]]></category>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <category><![CDATA[agentic-architecture]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 04:17:04 GMT</pubDate>
            <atom:updated>2026-04-19T18:17:52.536Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4>The Gap of Agency</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ez-hZ2_nbslJ4rRQOpHUIg.jpeg" /></figure><p>“Samir! More chai, more problems,” Kumar called out as the architect ducked under the corrugated tin awning of the samosa stall. The monsoon had started early, and the street outside was already ankle-deep in ambition and muddy water.</p><p>Samir sat down with a sigh. “What is it this time, Kumar?”</p><p>“You remember Sita, my General Manager?” Kumar began. “I gave her the intercom. She can read the daily supply logs, trigger new orders, and even update the ledger from her office downtown. Brilliant woman. Knows the business inside out.”</p><p>“So, what’s the problem?” Samir asked.</p><p>“I gave her a new task. I asked her to audit Outlet 3 completely on her own. Inventory, sales figures, production output — the whole picture.” Kumar paused. “She knew exactly what to do. She said, ‘First, get me the current inventory ledger. Then last week’s sales log. Then the daily production record.’ Perfect plan. Right sequence. Not a single wasted step.”</p><p>“That sounds like it went well,” Samir said, puzzled.</p><p>“It would have!” Kumar threw his hands up. “Except she cannot go and <em>get</em> any of those things herself. She is sitting in a corporate office downtown. She can think through the whole audit in her head. She can tell you exactly what she needs at every step. But she cannot open a single drawer, read a single page, or pick up a single phone at Outlet 3 without someone physically being there to do it for her.”</p><p>Samir set down his chai very slowly.</p><p>“She knows exactly what to do,” Kumar concluded, “and she cannot do any of it.”</p><p>“So what did you do?” Samir asked.</p><p>“I hired a local liaison at Outlet 3,” Kumar said simply, leaning back. “A runner. His only job is to wait for Sita’s requests and execute them. She calls over the intercom — ‘Get me the inventory ledger.’ He walks to the shelf, reads it, and reads it back to her. She says, ‘Now get me last week’s sales log.’ He fetches it. Back and forth, request and response, until Sita has everything she needs. Then she dictates the full audit report, and he writes it up.”</p><p>Samir blinked. “And it worked?”</p><p>“Perfectly,” Kumar said. “But I built one rule into the liaison’s contract that I think is the most important part.” He held up a finger. “I gave him a list of approved tasks. He will fetch the ledgers. He will read sales logs. He will write reports. But if Sita ever asks him to do anything outside that list — destroy a record, contact a competitor, move money — he refuses. Flat. No questions asked.”</p><p>Kumar picked up a piece of torn cardboard and drew two boxes, far apart: <strong>SITA</strong> and <strong>THE OUTLET</strong>. Between them, he sketched a small figure and labelled it: <strong>THE LIAISON</strong>.</p><p>“She is the brain. The outlet is the hands. The liaison is the only wire between them — and I decide exactly how thick that wire is.”</p><p>Samir stared at the diagram for a long moment. Then he laughed.</p><p>“Kumar, do you know what you’ve built?”</p><p>Kumar shrugged. “A samosa business that actually runs?”</p><p>“You’ve built the <strong>Agent Loop</strong>,” Samir said, sliding the cardboard toward himself. “This is one of the foundational patterns in agentic AI. Sita is your Large Language Model — brilliant, strategic, but sealed in a sandbox with no hands. Your outlet workers are local tools — capable of anything, but brainless without instruction. Your liaison is the execution loop — the strict mediator that translates Sita’s intent into real actions, one approved step at a time.”</p><p>Kumar looked at the diagram. “So every time someone builds an AI agent that can actually <em>do</em> things in the world…”</p><p>“They are building a Liaison,” Samir confirmed. “The intelligence never touches the world directly. It only sends requests. The world never understands the goal. It only executes what it’s handed. The loop holds the boundary — and that boundary is exactly as wide as you make it.”</p><p>Kumar was quiet for a moment. Then he looked up.</p><p>“I don’t need a smarter Sita. I need a better-designed liaison.”</p><p>Samir raised his chai. “Now <em>I’m</em> taking notes.”</p><p><strong>Technical Takeaway:</strong></p><p><em>The Gap of Agency is the fundamental challenge of agentic AI: an LLM has near-unlimited reasoning capability but zero access to the physical or digital world by default. The Agent Loop pattern bridges this gap by acting as a strict mediator — translating the model’s structured “tool requests” into real function calls, and feeding results back into the model’s context. Crucially, the LLM’s power is bounded by the tools you register. It can only act upon the world through the precise, pre-approved capabilities you give it. Want safety? Don’t register a </em><em>delete_file tool. Want observability? Log every exchange. The brain thinks. The hands act. The loop decides what the hands are allowed to do.</em></p><p><em>Reference GitHub: </em><a href="https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/agent_loop"><em>https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/agent_loop</em></a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-intercom-and-the-tablet-e0cea94c7e5b">← Prev: The Intercom and the Tablet</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-ledger-that-survived-the-storm-01ad0bce7a1f">The Ledger that Survived the Storm: Next →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09ccfffacaf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Intercom and the Tablet]]></title>
            <link>https://medium.com/@rishi.bhatnagar/the-intercom-and-the-tablet-e0cea94c7e5b?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0cea94c7e5b</guid>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[agentic-architecture]]></category>
            <category><![CDATA[out-of-band-ui-dashboard]]></category>
            <category><![CDATA[ai-architecture-pattern]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Sat, 04 Apr 2026 22:15:36 GMT</pubDate>
            <atom:updated>2026-04-19T18:17:05.446Z</atom:updated>
            <content:encoded><![CDATA[<h4>PARABLES OF ARCHITECTURE PATTERNS</h4><h4><strong>Model Context Protocol (MCP)</strong></h4><blockquote><em>Note: This story is part of the </em><strong><em>Parables of Architecture Patterns</em></strong><em> series. Please refer to the origin story </em><a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4"><em>here</em></a><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dm3lJT62UkEN6MrbHB67kw.jpeg" /><figcaption><strong>Out-of-Band UI rendering pattern using Model Context Protocol (MCP)</strong></figcaption></figure><p>“Samir, I have a new problem,” Kumar sighed, wiping his hands on his apron as the software architect sat down with his evening chai and samosa.</p><p>Kumar’s samosa business had exploded. What started as a single stall was now a thriving chain of six outlets scattered across the city. Naturally, the operations were getting chaotic.</p><p>“I hired a brilliant new General Manager, Sita, to oversee all six outlets,” Kumar explained. “She’s incredible. She analyzes sales trends, predicts perfectly when an outlet will run out of potatoes, and even formulates new chutney recipes on the fly. The problem? I put her in a fancy, centralized corporate office downtown.”</p><p>“Ah,” Samir said, taking a bite. “Centralized intelligence. Makes sense. What’s the issue?”</p><p>“She’s miles away from the fryers and the cash registers!” Kumar threw his hands up. “She can’t physically see the inventory ledgers, and she can’t shout into the kitchen to start a new batch. We have all this brainpower locked in a tower, completely isolated from the tools that actually make the business run.”</p><p>Samir smiled. He knew exactly what this was. “Kumar, your brilliant manager, Sita, is like a modern Cloud Large Language Model (LLM)— incredibly capable, but isolated in a sandbox, far away from your local systems. What you need is an <strong>Intercom System</strong>.”</p><p>“An intercom?”</p><p>“Yes. A standardized communication protocol,” Samir explained, using a napkin to draw a diagram. “Instead of the manager running out to the kitchens, you install a universal intercom at every outlet. She presses a button to ask Outlet 3 for their current stock, and presses another to tell Outlet 1 to fire up the fryers. In the software world, we call this the <strong>Model Context Protocol (MCP)</strong>. It’s a universal bridge that seamlessly connects an isolated, centralized intelligence to local data and tools.”</p><p>Kumar’s eyes lit up. He immediately began making calls to his electrician.</p><p>A few days later, Samir stopped by the flagship stall for his usual evening snack. Kumar was there, looking both triumphant and mildly annoyed.</p><p>“The intercoms work!” Kumar announced. “The manager can suddenly read the daily supply logs across all outlets and trigger new orders. It feels like magic. But… we hit a snag.”</p><p>“Oh?” Samir took a sip of his chai. “Don’t tell me she started ordering jalapeños instead of green chilies.”</p><p>“No, no, the orders are perfect,” Kumar said. “I wanted the manager to show me a live, interactive dashboard of the day’s metrics on the small LCD screen built into the intercom receiver on my desk. But the intercom manufacturer strictly restricted what could be shown on that little screen. It absolutely refuses to display my beautiful, interactive charts. It claims ‘security reasons’ and only shows plain text.”</p><p><em>(The equivalent of Claude Desktop’s sandboxed environment blocking inline </em><em>iframe UI rendering).</em></p><p>“Ah, the classic host restriction,” Samir nodded knowingly. “So, what did you do? Give up on the visual dashboard?”</p><p>“Have you met me?” Kumar grinned. “I realized the manager didn’t <em>need</em> to draw the dashboard on the restricted intercom screen. Instead, I used a <strong>Hybrid Approach</strong>.”</p><p>Kumar led Samir to his desk. Right next to the stubborn little intercom receiver, Kumar had mounted a pristine, sleek tablet.</p><p>“When the manager calculates the new stats, she uses the intercom to securely update a simple, central ledger,” Kumar explained, tapping the glass. “Simultaneously, this tablet is constantly watching that ledger. The moment the manager updates the numbers through the intercom, my tablet updates visually.”</p><p>Samir laughed out loud, genuinely impressed. “Kumar, you’ve just discovered the <strong>Out-of-Band UI rendering pattern</strong>! By separating the <em>control plane</em> (the MCP server handling the agent’s logic) from the <em>presentation plane</em> (a lightweight local web server, like aiohttp , running on a local port), you bypassed the host&#39;s UI restrictions completely. You preserved the Agentic Loop without compromising on visibility.”</p><p>Kumar handed Samir a fresh, piping hot samosa. “I don’t know about loops and planes, my friend. I just know my business is running smoother than ever, and I finally have my Dashboard.”</p><p><strong>Technical Takeaway:</strong> <em>When integrating MCP (Model Context Protocol) to give Agentic LLMs access to your stack, don’t let client-side UI rendering limitations block your progress. If a host restricts inline interactive components (</em><em>ui://), fall back to a Hybrid pattern: let the LLM manipulate local state via MCP tools, and serve an out-of-band frontend (e.g., via browser polling) to visualize the agent&#39;s work in real time.</em></p><p>Reference GitHub: <a href="https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/mcp-interactive-tool">https://github.com/bhatnagarrishi/ai-scout/tree/main/pocs/mcp-interactive-tool</a></p><p><a href="https://medium.com/@rishi.bhatnagar/keeping-it-fresh-9a028375851e">← Prev: Keeping it Fresh</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-strategist-without-hands-09ccfffacaf9">Next: The Strategist without Hands →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0cea94c7e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keeping it Fresh]]></title>
            <link>https://medium.com/@rishi.bhatnagar/keeping-it-fresh-9a028375851e?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a028375851e</guid>
            <category><![CDATA[dead-letter-queue]]></category>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[poison-pill]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Fri, 08 Aug 2025 02:23:17 GMT</pubDate>
            <atom:updated>2026-04-19T18:14:46.413Z</atom:updated>
            <content:encoded><![CDATA[<h4>Parables of Architecture Patterns</h4><h4>Dead Letter Queue and Poison Pill</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="Samosa store showing customers ordering samosa and a small fridge to keep the waste samosas for later investigation" src="https://cdn-images-1.medium.com/max/1024/1*MgQ9JW5eIQ-AXwChgpLCpw.png" /><figcaption>Samosa store with happy customers as well as a place to put in damaged/spoilt samosas (Dead Letter Queue)</figcaption></figure><p>“What happened last night? Everyone was looking so worried”, asked Samir. “Not worried, just focused. We just had a few samosas that were not up to quality, so we had stopped our process to investigate, while the customer orders kept piling up”, explained Kumar.</p><h4>Poison Pill</h4><p>“How did you figure that out? And how did you resolve that?” Samir asked.</p><p>“Well, we inspect all the samosas that we sell, and we noticed that there was a stale odor coming from some of the samosas we made in the morning. So, we stopped the process and traced it to a bad supply of potatoes that came from a distributor. We then proceeded to identify all the stores that received potatoes from that distributor, called them up to identify products created from those potatoes, and stopped whatever we were making from that”, explained Kumar.</p><blockquote><strong>Samir’s observation:<br></strong>This was very similar to how he was grappling with the problem with one of his vendors that occasionally sent him a stale file.<br>1. Identify stale file (or potatoes)<br>2. Identify the affected consumers (or stores)<br>3. Insert a message to stop the process<br>4. Consumers will stop affected processes using the stale file</blockquote><h4>Dead letter queue</h4><p>“But what do you do afterwards — do you just throw away the samosas?”, Samir was curious. “Yes, the samosas do get thrown away, but not before we fully understand the problem and learn from it”, laughed Kumar. “What do you mean? How do you learn from a samosa?” quipped Samir.</p><p>“Samosa says a lot, my friend. Take yesterday, for example. Our priority was to make sure we didn’t impact the creation of good samosas as customers were waiting. So, we just kept the bad samosas in a special bin to be investigated later. And this happened at all our stores. Later, we investigated how the samosas got bad — they arrived from the distributor a bit early when the store wasn’t yet open. So, they were kept outside and got wet in the rain and spoiled”, explained Kumar in detail.</p><blockquote><strong>Samir’s observations:<br></strong>There was a lot to unpack here, and these statements were very similar to his design where he sometimes received messages with special characters that caused processing issues:<br>1. First objective was to keep the system running. So, isolate the bad messages (or samosas) to avoid disruption to main pipeline.<br>2. Keep messages in a separate location that keeps them intact until they are ready to be analyzed</blockquote><p><a href="https://medium.com/@rishi.bhatnagar/separation-of-access-34f9acd856ff">← Prev: Separation of Access</a></p><p><a href="https://medium.com/@rishi.bhatnagar/the-intercom-and-the-tablet-e0cea94c7e5b">Next: The Intercom and the Tablet →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a028375851e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Separation of Access]]></title>
            <link>https://medium.com/@rishi.bhatnagar/separation-of-access-34f9acd856ff?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/34f9acd856ff</guid>
            <category><![CDATA[acl]]></category>
            <category><![CDATA[subnet]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <category><![CDATA[technical-parable]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Sat, 02 Aug 2025 00:31:14 GMT</pubDate>
            <atom:updated>2026-04-19T18:13:42.979Z</atom:updated>
            <content:encoded><![CDATA[<h4>Parables of Architecture Patterns</h4><h4>Subnet, ACL, and Public-Private networks</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="Showing a samosa counter with a few customers, along with the floor plan for the store" src="https://cdn-images-1.medium.com/max/700/1*Ud4qod2KSgqsLIi0Mu9vvA.png" /><figcaption>Samosa store with different areas — private, public, and credentialled</figcaption></figure><p>“You are one of the few stores that allow the public to use your restrooms. Isn’t that too generous of you?” quipped Samir.</p><p>“Ha ha! We actually only allow customers to access the restrooms. But there was an incident a few years ago where the customer accidentally entered our security room where we keep the cash!”, replied Kumar.</p><p>“Wow! How do you prevent that now?” asked Samir. “Well, we did several things — we ensured that the security room and resting area are under lock and key. Same for our inventory room. The bathroom key is with the front counter, and the customer has to ask for that key and return it to the counter after use.</p><blockquote><strong>Samir’s observation:<br></strong>Such simple and basic ideas, but powerful. He was reminded of their own network segmentation and access:<br>1. Network segmentation — public network: Similar to the store having a public area where anyone could come in even if they just want to chat with friends and avoid the glaring sun! <br>2. Network segmentation — private network: Similar to the store having a private area where only restricted access was allowed.<br>3. Subnets: Creating multiple areas within the store for different uses and different access — security room for keeping cash, resting area for taking breaks, bathroom for customers, etc. Customers will need to pick up the key (similar to entering password) before accessing the bathroom (in the private network).<br>4. Access Control Lists (ACL): Having multiple locks and keys for different areas allows controlling access to different people. The accountant will not have access to the inventory, and serving staff will not have access to the security room. Customers will have access to only the bathroom.</blockquote><p><a href="https://medium.com/@rishi.bhatnagar/price-of-popularity-7e92c7122f94">← Prev: Price of Popularity</a></p><p><a href="https://medium.com/@rishi.bhatnagar/9a028375851e">Next: Keeping it Fresh →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34f9acd856ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Price of popularity]]></title>
            <link>https://medium.com/@rishi.bhatnagar/price-of-popularity-7e92c7122f94?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e92c7122f94</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[ddos-protection]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[ddos-attack]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 19:36:21 GMT</pubDate>
            <atom:updated>2026-04-19T18:11:46.782Z</atom:updated>
            <content:encoded><![CDATA[<h4>Parables of Architecture Patterns</h4><h4>Handling DDOS attacks</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="A single samosa seller is overwhelmed by a large crowd" src="https://cdn-images-1.medium.com/max/1024/1*B1NP-9Rb-_62JAZYacr7ZQ.png" /><figcaption>A single samosa seller is overwhelmed by a large crowd and some regular customers are bewildered and unable to place their regular orders</figcaption></figure><p>“There is a price to be paid for popularity”, said Kumar. “A few years back, we faced a lot of problems with some rogues trying to get our snacks for free or just generally cause chaos”. “What happened?” asked Samir.</p><h4>Denial of Service Attacks</h4><p>“Well, we saw a sudden surge of orders randomly pop up. This was making it difficult for our regular customers to place their orders. But even worse, when we prepared those large orders, the people who placed them disappeared”, explained Kumar. “We blocked the phone numbers where we used to get these orders from, but they started calling from various numbers. And sometimes, they wouldn’t even place the orders, just put us on hold with a partial order, acting as if they were confirming the orders.”</p><p>“We also started seeing how innocent people were used to target us. We saw some fake promotion posters and advertisements claiming we were giving large discounts. So, we started getting a lot of calls and customers only to learn that those discounts were not real. It was a mess.”</p><blockquote><strong>Samir’s observations:<br></strong>These were all indications of a typical DOS (Denial of Service) and DDOS (Distributed DOS) attacks he was guarding against in his payment service:<br>1. Large number of requests from a single source: This is a typical DOS attack to overwhelm the system and slow it down so it cannot serve legitimate requests.<br>2. Distributing the large number of requests from multiple locations: Instead of one location, multiple locations start submitting requests, making it harder to block.<br>3. <a href="https://www.cloudflare.com/learning/ddos/ddos-attack-tools/slowloris/">Slow Loris attack</a> and <a href="https://www.cloudflare.com/learning/ddos/ddos-attack-tools/r-u-dead-yet-rudy/">RUDY attack</a>: Several requests that don’t actually complete but keep the resources engaged<br>4. Flash mob attack: While technically not a DDOS, it does reputational damage by sending in huge volume of customers with unreasonable expectation</blockquote><p>“Whoa… that’s terrifying. How did you resolve the attacks?” asked Samir, shocked. “Well, that’s the thing, the attacks are never resolved; we just mitigate them and render their effect powerless. We did discuss with a supply chain expert and came up with several strategies:</p><ul><li>Confirm large orders: Whenever we got a large order, we always confirmed it. If it were an existing customer, we would ask for their code. If it were a new customer, we would first onboard them properly.</li><li>Blocking and filtering calls: We started blocking some repeat offender numbers and also started using Google Voice to filter out known bad actors.</li><li>Reduced hold time: If a customer was taking a long time to place the order, we would ask them to call back when they were done and would wrap up the call quickly.</li><li>Redirect large orders to a different counter: This way, legitimate customers could continue placing their orders.</li><li>Localization: All orders from a particular area would be redirected to their local store. This way, if there was a problem, it was localized to within that store, and other stores could step in if needed. Also, for orders from regular corporate clients who place large orders, we set up kiosks in their offices to ensure the legitimacy of the orders.</li><li>Detecting and taking down promotions: When customers called with a promotion, we started detecting and taking down the fake ones proactively.”</li></ul><p>“That’s a lot of good work there. And it shows in the happy customers that you have. But it must be a lot of distraction and operational overhead”, commented Samir.</p><p>“Yes, but such is the price of popularity”, sighed Kumar.</p><blockquote><strong>Samir’s observation:<br></strong>These strategies were right out of the Software Security Architecture playbook he was following to design his service:<br>1. Rate limiting: Limiting the number of requests that can be sent from a specific IP address or network segment within a given time period.<br>2. Traffic filtering: Filter out malicious traffic based on IP addresses, protocols, or other characteristics.<br>3. Network segmentation: Dividing the network into smaller, isolated segments to limit the impact of an attack.<br>4. Content Delivery Networks (CDNs): Distributing content across multiple servers geographically to reduce the load on the origin server and absorb some of the attack traffic. Especially putting near locations with known high traffic.<br>5. Deny list<strong>:</strong> Blocking known malicious IP addresses or network segments.<br>6. Connection Timeouts: Setting short timeouts for inactive connections.<br>7. Using WAF: Web Application Firewall (WAF) uses signatures to identify known attack patterns and anomalous traffic patterns. It also blocks and malformed requests, applies geo-filtering, and apply rate limits, etc.<br>8. Traffic shaping: Prioritizing legitimate user traffic over bot traffic.</blockquote><p><a href="https://medium.com/@rishi.bhatnagar/managing-raw-materials-5b51dae4d9e7">← Prev: Managing Raw Materials</a></p><p><a href="https://medium.com/@rishi.bhatnagar/separation-of-access-34f9acd856ff">Next: Separation of Access →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e92c7122f94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing raw materials]]></title>
            <link>https://medium.com/@rishi.bhatnagar/managing-raw-materials-5b51dae4d9e7?source=rss-b306b80e7ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b51dae4d9e7</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[architecture-pattern]]></category>
            <category><![CDATA[middle-and-back-office]]></category>
            <category><![CDATA[technical-parable]]></category>
            <category><![CDATA[transaction-booking]]></category>
            <dc:creator><![CDATA[Rishi Bhatnagar]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 14:16:33 GMT</pubDate>
            <atom:updated>2026-04-19T18:09:49.800Z</atom:updated>
            <content:encoded><![CDATA[<h4>Parables of Architecture Patterns</h4><h4>Books of records</h4><blockquote>Note: This story is part of the <strong>Parables of Architecture Patterns</strong> series. Please refer to the origin story <a href="https://medium.com/@rishi.bhatnagar/crisp-architecture-lessons-from-a-samosa-seller-38e2eab1b2b4">here</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*lsVU00cpDG5jOYHuB2sN2g.png" /><figcaption>Showing the supply chain management between the warehouse and various outlets</figcaption></figure><p>“How do you keep track of raw materials across all the many branches and outlets you have? You even have pop-up kiosks in several office buildings; some offer pre-packaged food while others have kitchens in the back. And then you offer so many products requiring different raw materials”, Samir wanted to understand.</p><h4>End-of-day reconciliation</h4><p>“It’s a bit more involved than even that. We capture all materials used at any place in premade paper chits. These are color-coded — one for each product and represent the raw materials used. So, at the end of the day, we gather all the chits centrally in our warehouse from all our outlets. Then we know how much material was used and we replenish that material, adding any additional orders, etc. that we know for the next day”, explained Kumar.</p><blockquote>Samir’s observation:<br>This is interesting, he thought. This is very similar to the start of day loads and end of day reconciliations his team ran every day.<br>1. Start of day load: Load the spending power (or raw materials) at the start of day for each product (or outlet) such as debit cards, checks, ACH, wires, digital wallets, etc.<br>2. Intraday transactions: As the customer spends the money (or outlet uses the raw materials), the balance is calculated and updated. A ledger entry (or chit) keeps track of all spending<br>3. End of day reconciliation: At the end of the day, all customer balances are calculated from across all the products and new balances for the next day are prepared.</blockquote><h4>Intraday reconciliation</h4><p>“But what happens when you run out of products in the middle of a day?” asked Samir. “That was a problem we started running into as our pop-up kiosks started becoming more popular, and some custom dishes like pakoras took off. So, we started sending chits during the day and started replenishing throughout the day. This required a bit more work, but it increased our profits and customer satisfaction significantly”, explained Kumar.</p><blockquote>Samir’s observation:<br>This was exactly how they designed their real time payments (RTP)<br>1. For RTP, they had to maintain an account with the Fed. <br>2. When a customer made a payment to someone who was a customer of another bank, the other bank withdrew money from their Fed account. <br>3. When a customer of another bank sent money to their customer, the other bank deposited the money into their Fed account.<br>4. At all times, it was required for his bank to keep a minimum amount of money in the Fed account. <br>5. But sometimes, there was more outflow that inflow and that’s when they had to replenish the funds intraday. Other times, there was more inflow that outflow, and they wanted to withdraw the money so they could lend out more and make more profits. They called this liquidity management.<br>6. This had an additional benefit. The end of day reconciliation was a lot simpler since the volume of chits were spread through the day.<br>7. This also allowed identifying any mistakes earlier in the day rather than waiting for end of day.</blockquote><p><a href="https://medium.com/@rishi.bhatnagar/handling-popularity-298cf882ebe2">← Prev: </a><a href="https://medium.com/@rishi.bhatnagar/customers-and-loyalty-programs-8fc65e7f7203">Customer and Loyalty Programs</a></p><p><a href="https://medium.com/@rishi.bhatnagar/price-of-popularity-7e92c7122f94">Next: Price of Popularity →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b51dae4d9e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>