<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prakhar Gupta</title>
    <description>The latest articles on DEV Community by Prakhar Gupta (@prxmy).</description>
    <link>https://dev.to/prxmy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4171084%2Fcdc4e79a-a94d-4a2f-9b46-a0206cf04a55.jpg</url>
      <title>DEV Community: Prakhar Gupta</title>
      <link>https://dev.to/prxmy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prxmy"/>
    <language>en</language>
    <item>
      <title>We built an A/B testing agent you can text, and taught it not to overclaim</title>
      <dc:creator>Prakhar Gupta</dc:creator>
      <pubDate>Sun, 29 Nov 2026 13:41:39 +0000</pubDate>
      <link>https://dev.to/prxmy/we-built-an-ab-testing-agent-you-can-text-and-taught-it-not-to-overclaim-5fk2</link>
      <guid>https://dev.to/prxmy/we-built-an-ab-testing-agent-you-can-text-and-taught-it-not-to-overclaim-5fk2</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; You type "my signup form asks for too much, make it shorter." Twig edits your site on a separate branch, sends you before and after screenshots, asks what the test should count, and waits for your approval. Then it sets up a real Flagsmith experiment, reports the results in plain language, and when you say "ship it", removes the losing version from your code. It works from the web app, WhatsApp, Slack and Discord. Four of us built it in 72 hours for &lt;a href="https://www.wemakedevs.org/hackathons/flagsmith" rel="noopener noreferrer"&gt;Toggle Wars&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Live app: &lt;a href="https://twig.vertexfold.com" rel="noopener noreferrer"&gt;twig.vertexfold.com&lt;/a&gt; · Code: &lt;a href="https://github.com/prx-my/laughing-engine" rel="noopener noreferrer"&gt;github.com/prx-my/laughing-engine&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;Priya runs a small SaaS and suspects her signup form has too many fields. Testing that properly means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Getting a developer to build a second version of the form.&lt;/li&gt;
&lt;li&gt;Adding a feature flag SDK, giving every visitor a stable ID, and sending exposure events.&lt;/li&gt;
&lt;li&gt;Defining a conversion metric, then creating a multivariate flag and an experiment.&lt;/li&gt;
&lt;li&gt;Waiting, then reading a Bayesian credible interval and deciding whether "87% chance to win" is enough.&lt;/li&gt;
&lt;li&gt;Deleting the losing code afterwards.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For most small teams that is too much work for a hunch, so they ship the change and never find out whether it helped. We wanted the whole process to start with one message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd8sp850uopxru88ubx8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd8sp850uopxru88ubx8d.png" alt="Twig landing page" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What Twig does
&lt;/h2&gt;

&lt;p&gt;The name comes from the idea of two twigs growing off the same branch: the control and the variant.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;What you see&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ask&lt;/td&gt;
&lt;td&gt;"Make the signup form shorter"&lt;/td&gt;
&lt;td&gt;A coding agent works on your repo in its own folder and git branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Preview&lt;/td&gt;
&lt;td&gt;Before and after screenshots, phone and desktop&lt;/td&gt;
&lt;td&gt;Twig starts your dev server and screenshots both versions with Playwright&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pick what counts&lt;/td&gt;
&lt;td&gt;One multi-select question&lt;/td&gt;
&lt;td&gt;The agent lists things a visitor can actually do on that page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gate 1&lt;/td&gt;
&lt;td&gt;"Looks good, test it"&lt;/td&gt;
&lt;td&gt;Flagsmith flag, metric and experiment are created, tracking is added, the branch is published&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Watch&lt;/td&gt;
&lt;td&gt;Cards that update on their own&lt;/td&gt;
&lt;td&gt;A server-side watcher refreshes Flagsmith results and pushes them to the chat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ask about results&lt;/td&gt;
&lt;td&gt;"How much did signups go up?"&lt;/td&gt;
&lt;td&gt;Answers come from Flagsmith's numbers, and every number is checked in code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gate 2&lt;/td&gt;
&lt;td&gt;"Ship it"&lt;/td&gt;
&lt;td&gt;The winner is rolled out, the experiment is completed, and the losing code is deleted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The chat works in the web app, on WhatsApp, in a Slack DM and in Discord with &lt;code&gt;/twig&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcd59geh8d9hs083vx20a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcd59geh8d9hs083vx20a.png" alt="How it works page" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Where it started
&lt;/h2&gt;

&lt;p&gt;In our first session we drew the whole product as ASCII diagrams in the README, so every teammate (and every coding agent we used) worked from the same plan. This is one of them, showing Priya's week:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ┌────────────────────────────────────────────────────────────────┐
    │ DAY 0  ·  10:02  ·  WHATSAPP                                   │
    │ Priya: "the signup form has too many fields —                  │
    │         test a shorter one"                                    │
    └───────────────────────────────┬────────────────────────────────┘
                                    ▼
    ┌────────────────────────────────────────────────────────────────┐
    │ BACK ON WHATSAPP                                               │
    │ "preview ready — here is the diff and the preview link"        │
    │ counts: completed signups · one metric, nothing else           │
    │ Priya: "approve"                                               │
    └───────────────────────────────┬────────────────────────────────┘
                                    ▼
    ┌────────────────────────────────────────────────────────────────┐
    │ DAY 3  ·  09:00  ·  WHATSAPP                                   │
    │ Priya: "how is it going?"                                      │
    │ "B is ahead, 78% confident — about two more days"              │
    └───────────────────────────────┬────────────────────────────────┘
                                    ▼
    ┌────────────────────────────────────────────────────────────────┐
    │ DAY 5  ·  18:00  ·  WHATSAPP                                   │
    │ "B wins: 91% confidence, +18% signups"                         │
    │ Priya: "ship it"                                               │
    └───────────────────────────────┬────────────────────────────────┘
                                    ▼
    ┌────────────────────────────────────────────────────────────────┐
    │ THE BACKBONE                                                   │
    │ rolls out to 100% · deletes the losing code · closes the record│
    └────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One rule from that session stayed fixed through the whole build: there are two human approvals, one before a test goes live and one before a winner goes to 100% of traffic. Nothing skips either.&lt;/p&gt;




&lt;h2&gt;
  
  
  Walkthrough
&lt;/h2&gt;

&lt;p&gt;These screenshots are from the live app, using a demo project called &lt;code&gt;signup-demo&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Describe the change
&lt;/h3&gt;

&lt;p&gt;The home screen is a single text box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc6yazdks3u3br3w0c67w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc6yazdks3u3br3w0c67w.png" alt="What should we change?" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The agent edits the site and shows you
&lt;/h3&gt;

&lt;p&gt;The agent reads the repo, finds the form and removes two fields. Twig then takes before and after screenshots on phone and desktop sizes. The real site is untouched; the change lives on a branch named &lt;code&gt;le/&amp;lt;chat-id&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl5lnli2xu3b2ycerj5em.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl5lnli2xu3b2ycerj5em.png" alt="The request and the before and after preview" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Choosing what the test counts
&lt;/h3&gt;

&lt;p&gt;Most A/B tools ask you to configure a metric. Twig asks one question instead and only offers things a visitor can do on that page, then adds the tracking code itself. The first choice is the main goal. Any others are watch-outs that shouldn't get worse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fziz1qta3ulp8z6ena2e5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fziz1qta3ulp8z6ena2e5.png" alt="The agent asks what the test should keep an eye on" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Gate 1: start the test
&lt;/h3&gt;

&lt;p&gt;Approving creates a Flagsmith environment, multivariate flag, metric and experiment, adds the Flagsmith JS SDK to the branch, and publishes it to its own Vercel link. Production is still unchanged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb4rlqiafs804cshkbn5z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb4rlqiafs804cshkbn5z.png" alt="Test ready, with Signups as the main goal and Form errors as a watch-out" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd5ti86m3t2tw2dd5egiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd5ti86m3t2tw2dd5egiz.png" alt="Live link and test running" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Simulated visitors
&lt;/h3&gt;

&lt;p&gt;A hackathon demo has no real traffic, and the rules allow simulation. Twig can send simulated visitors through Flagsmith's SDK in rounds, spaced out the way real traffic would arrive. The exposures and conversions are real Flagsmith events; the visitors are not, and the UI labels them as pretend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faylwzpkbcpm6nm8g2yds.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faylwzpkbcpm6nm8g2yds.png" alt="Pretend visitors, 1 of 4 rounds in" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Results that update on their own
&lt;/h3&gt;

&lt;p&gt;Flagsmith recalculates results at most once every five minutes and doesn't offer a webhook. Our server checks each running test, refreshes as soon as Flagsmith allows, and pushes new numbers to the chat over its event stream, so the browser never polls.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39zj09udd1agx1suzuzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39zj09udd1agx1suzuzn.png" alt="Results card: 87% chance the new version is better" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Asking about results
&lt;/h3&gt;

&lt;p&gt;You can ask questions in plain language, for example "How much did signups go up with the shorter form? And why did form errors change?"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg9v6ogyyntnj6eeu8boe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg9v6ogyyntnj6eeu8boe.png" alt="Answer about signups and form errors" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The answer reports +88%, then says it isn't a confirmed win because the likely range runs from −64% to +239%. On the "why" question, it explains that the test shows what visitors did but not their reasons, and marks its explanation as a guess.&lt;/p&gt;

&lt;p&gt;If you ask something the data can't answer, it says so:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwcyadmjnfa9e1vbl8c82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwcyadmjnfa9e1vbl8c82.png" alt="Is it doing better on phones? The test can't tell us that." width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Getting the agent to say "the test can't tell us that" reliably took more work than any other part of the project. The details are further down.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Gate 2: ship the winner
&lt;/h3&gt;

&lt;p&gt;After "I'm happy with the shorter form. Ship it to everyone", Twig completes the experiment in Flagsmith with the winning variant. The agent then removes the losing version and the flag check from the code, shows a preview, and publishes it, so no stale flag code is left behind.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo9t8wgkek8q8fou21xnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo9t8wgkek8q8fou21xnz.png" alt="Winner picked and the losing version removed" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Shopify and WordPress
&lt;/h3&gt;

&lt;p&gt;Shopify stores and WordPress sites work too. On Shopify, Twig never edits the theme. The store switches on Twig's &lt;a href="https://github.com/prx-my/laughing-engine/tree/main/apps/shopify-app" rel="noopener noreferrer"&gt;theme app embed&lt;/a&gt; with one Save in the theme editor, the agent writes each test as a few small CSS and JS files, and the embed loads Flagsmith on the storefront and shows each visitor their version. The app only asks for &lt;code&gt;read_themes&lt;/code&gt;, so once Shopify's App Store review passes, any store can install it. WordPress sites use the &lt;a href="https://github.com/prx-my/laughing-engine/tree/main/apps/wordpress-plugin" rel="noopener noreferrer"&gt;Twigs plugin&lt;/a&gt;. Here is a Shopify development store with a test running in Flagsmith:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foclfj924nl72t9anhsqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foclfj924nl72t9anhsqp.png" alt="Shopify store preview: the main button changed to &amp;quot;Shop the sale&amp;quot;" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Flagsmith card logs each recalculation and counts down to the next one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0dvttpv11husg12vphod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0dvttpv11husg12vphod.png" alt="Shopify test running in Flagsmith, with a countdown to the next update" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Slack and Discord
&lt;/h3&gt;

&lt;p&gt;Slack and Discord are two more windows onto the same chats. On Twig's Connect page, &lt;strong&gt;Add to Slack&lt;/strong&gt; installs the bot in your workspace and links it to your Twig account. From then on you talk to Twig in a DM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fimqn3enpl9se5joga6gx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fimqn3enpl9se5joga6gx.png" alt="Slack: Twig confirms the account is linked" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ask for a change in plain words. Twig says which project it's working on, links the same chat in the web app, and sends the before and after screenshots:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flm34uurr5ck5fg6avyku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flm34uurr5ck5fg6avyku.png" alt="Slack: asking for a change and getting the before screenshot" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The preview comes with three buttons: publish, change something, or start a new change. Each one sends the same message you could type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6d3rlbtgizxjblphq75e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6d3rlbtgizxjblphq75e.png" alt="Slack: the new version with Looks good, publish / Change something / New change" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add to Discord&lt;/strong&gt; adds the bot to a server you manage. Discord lists exactly what it asks for: create commands, view channels, send messages, attach files and read message history.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbgc7gczptipq176qtl21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbgc7gczptipq176qtl21.png" alt="Discord: adding Twig to a server and the permissions it asks for" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5brbrdn8w43ndvj0ar6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5brbrdn8w43ndvj0ar6l.png" alt="Discord: Twig joins the server" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Discord you start a change with &lt;code&gt;/twig&lt;/code&gt;. The follow-along link unfolds into a Twig card with the chat's title:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fowll4pitittswgpz3war.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fowll4pitittswgpz3war.png" alt="Discord: /twig make the main button say Browse the collection" width="800" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The preview arrives with the same three buttons as in Slack:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1mrpm9nmmbjzhgxsr89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1mrpm9nmmbjzhgxsr89.png" alt="Discord: the new version with the same three buttons" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;internet ─▶ Cloudflare ─▶ cloudflared ─▶ one container on a VPS
                                         ├─ Next.js 16      the web app (chat, cards, results)
                                         ├─ FastAPI         sign-in, connections, chats, webhooks,
                                         │                  our MCP tools, the results watcher
                                         └─ opencode        the coding agent (localhost only)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent is &lt;a href="https://opencode.ai" rel="noopener noreferrer"&gt;opencode&lt;/a&gt;. Twig is the harness around it. There is no hand-written state machine or prompt chain: we give the agent tools through our own MCP server, registered for each chat folder, and the UI draws cards from its tool calls.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;show_preview&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;starts dev servers and takes before/after screenshots (&lt;code&gt;?variant=&amp;lt;key&amp;gt;&lt;/code&gt; forces the new version)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;publish&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;pushes the chat's branch so Vercel builds it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;setup_experiment&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;creates the Flagsmith environment, flag, variation and metrics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;start_experiment&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;creates the experiment at 50/50 and starts it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;simulate_visitors&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;sends simulated visitors through the SDK in rounds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;show_results&lt;/code&gt;, &lt;code&gt;explain_results&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;returns numbers computed in code as a fact sheet&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ship_winner&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;completes the experiment with the winner&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Approve button in the web app doesn't call a special endpoint. It sends a chat message, the same one you would type on WhatsApp, which is why every channel shares one flow. WhatsApp, Slack (&lt;strong&gt;Add to Slack&lt;/strong&gt;, then a DM) and Discord (&lt;strong&gt;Add to Discord&lt;/strong&gt;, then &lt;code&gt;/twig&lt;/code&gt;) all go through one &lt;a href="https://github.com/prx-my/laughing-engine/blob/main/apps/api/conversation.py" rel="noopener noreferrer"&gt;&lt;code&gt;conversation.py&lt;/code&gt;&lt;/a&gt;, and each webhook checks its platform's own signature.&lt;/p&gt;

&lt;p&gt;Each chat gets its own git worktree outside the app's repo. Early on, chat folders lived inside the repo and the agent could read the app's own code and &lt;code&gt;.env&lt;/code&gt;; moving them out fixed that.&lt;/p&gt;

&lt;p&gt;Everything a person sees goes through one allowlist in &lt;code&gt;present.py&lt;/code&gt;. Only named fields from our tools' cards reach the browser or WhatsApp, so file paths, shell commands, API keys, stack traces and model reasoning stay on the server. A test in CI pushes all of those through every mapper and fails if any of them come out the other side.&lt;/p&gt;

&lt;p&gt;Deploys: each push to &lt;code&gt;main&lt;/code&gt; runs the API tests and the web build in CI, then deploys to the VPS over SSH and waits for &lt;code&gt;/health&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  How we use Flagsmith
&lt;/h2&gt;

&lt;p&gt;Twig drives Flagsmith's experimentation API from start to finish. These are the calls we use, all under &lt;code&gt;https://api.flagsmith.com/api/v1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;                                    &lt;span class="c1"&gt;# one per Twig project&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;P&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;                             &lt;span class="c1"&gt;# MULTIVARIATE flag, "control" default&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;P&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mv&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;                &lt;span class="c1"&gt;# the new version&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiment&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;             &lt;span class="c1"&gt;# what we count&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;                    &lt;span class="c1"&gt;# 50/50 rollout + metrics&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;refresh&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;  &lt;span class="c1"&gt;# at most once per 5 min&lt;/span&gt;
&lt;span class="no"&gt;GET&lt;/span&gt;  &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;environments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;experiments&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;complete&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;         &lt;span class="c1"&gt;# ship the winner (or control)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the site, the agent adds &lt;code&gt;@flagsmith/flagsmith&lt;/code&gt;, identifies the visitor with a stable ID before reading the flag, uses &lt;code&gt;getExperimentFlag(flag).variant&lt;/code&gt; to choose the version, and calls &lt;code&gt;trackEvent(event)&lt;/code&gt; on success.&lt;/p&gt;

&lt;h3&gt;
  
  
  Notes for anyone building on Flagsmith experiments
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;@flagsmith/flagsmith&lt;/code&gt; package. The older &lt;code&gt;flagsmith&lt;/code&gt; package has no &lt;code&gt;getExperimentFlag&lt;/code&gt; or &lt;code&gt;trackEvent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Variations need a &lt;code&gt;key&lt;/code&gt; and a &lt;code&gt;"feature"&lt;/code&gt; field, otherwise exposures aren't recorded and nothing tells you.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;feature_state_value&lt;/code&gt; has to be &lt;code&gt;{"type": "string", "value": ...}&lt;/code&gt;. The &lt;code&gt;"unicode"&lt;/code&gt; / &lt;code&gt;string_value&lt;/code&gt; shape returns a 400.&lt;/li&gt;
&lt;li&gt;Results can be refreshed once every five minutes (you get a 429 otherwise). Base your timing on Flagsmith's &lt;code&gt;refresh_requested_at&lt;/code&gt;, and wait about 45 seconds after sending events, or the refresh may come back empty.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;chance_to_win&lt;/code&gt; already accounts for the metric's direction. For a metric where lower is better, it is the chance the new version is lower, so don't invert it. We did at first.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Exposures and conversions are matched by identity. If each event gets a new random ID, both arms look healthy and the result means nothing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Keeping the agent honest about results
&lt;/h2&gt;

&lt;p&gt;An agent that announces "B won, +88%" after 200 visitors does more harm than good. We used six layers, and the ones we rely on most are code rather than prompt instructions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;explain_results&lt;/code&gt; builds a fact sheet in code: per-version numbers, the change and its likely range, chance to win, watch-out status and a split check. It also lists what the test can't tell you, such as device breakdowns or reasons.&lt;/li&gt;
&lt;li&gt;Cards are drawn from data, never from the model's text. The model's sentence sits beside the card as a caption.&lt;/li&gt;
&lt;li&gt;Verdicts come from Flagsmith. "Too early" uses Flagsmith's threshold (50+ visitors and 5+ conversions per version), and "clear" means a chance to win above 95% or below 5%. We added no thresholds of our own.&lt;/li&gt;
&lt;li&gt;After each reply, the server checks every number against the fact sheet, allowing for rounding, and flags any that don't match.&lt;/li&gt;
&lt;li&gt;The instructions separate "what" from "why": state what the data shows, say the test can't show the reason, and label any explanation as a guess.&lt;/li&gt;
&lt;li&gt;The prompt itself comes last, since the model can still ignore it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Layer 4 can't catch an invented reason that contains no numbers, such as "people liked the colour". Layer 5 is there for that case, and the real card is always shown next to the answer.&lt;/p&gt;




&lt;h2&gt;
  
  
  Things we learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;opencode loads your personal MCP servers unless you give it its own config folder via &lt;code&gt;XDG_CONFIG_HOME&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;MCP registration is per folder, and you need &lt;code&gt;codemode: false&lt;/code&gt; or every tool gets wrapped in an &lt;code&gt;execute&lt;/code&gt; call.&lt;/li&gt;
&lt;li&gt;Vercel reports through commit statuses rather than GitHub deployments, and its branch hostname label has a 63-character limit. That is why our branches are named &lt;code&gt;le/&amp;lt;id&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A field called &lt;code&gt;status&lt;/code&gt; in a tool result overwrote the card's own status. We renamed it.&lt;/li&gt;
&lt;li&gt;Next.js gzip compression held back our event streams until we set &lt;code&gt;compress: false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Screenshots have to wait until the page stops changing, or they catch the new version half-rendered while Flagsmith loads.&lt;/li&gt;
&lt;li&gt;Flagsmith's browser SDK holds events and sends them every 10 seconds, so a click that opens another page was lost. Our Shopify embed sends them straight away with a &lt;code&gt;keepalive&lt;/code&gt; fetch.&lt;/li&gt;
&lt;li&gt;A public Shopify app that writes theme files needs an exemption Shopify rarely grants. A theme app embed needs only &lt;code&gt;read_themes&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Stats
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;About 72 hours from the first commit to submission&lt;/li&gt;
&lt;li&gt;130+ commits across the web app, API, Shopify app, WordPress plugin, and the WhatsApp, Slack and Discord channels&lt;/li&gt;
&lt;li&gt;One full run verified on the live app: request, preview, metrics, test, rounds of visitors, questions about results, ship, cleanup, publish and a PDF report&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Revenue estimates per month currently appear only with real traffic. We want them from the first day of a test.&lt;/li&gt;
&lt;li&gt;WhatsApp, Slack and Discord work today. Telegram would use the same adapter.&lt;/li&gt;
&lt;li&gt;Shopify's App Store review, so any store can install Twig, not just development stores.&lt;/li&gt;
&lt;li&gt;Tests currently run in our team's Flagsmith account. Connecting your own organisation is next.&lt;/li&gt;
&lt;li&gt;Nothing in Twig is specific to &lt;code&gt;signup-demo&lt;/code&gt;, and we'd like to see it running on other people's sites.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The team
&lt;/h2&gt;

&lt;p&gt;Twig was built for Toggle Wars, the Flagsmith experimentation hackathon run by &lt;a href="https://www.wemakedevs.org/hackathons/flagsmith" rel="noopener noreferrer"&gt;WeMakeDevs&lt;/a&gt;, by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prakhar&lt;/strong&gt; (&lt;a href="https://github.com/prx-my" rel="noopener noreferrer"&gt;@prx-my&lt;/a&gt;): connectors (WhatsApp, Slack, Discord, Shopify, WordPress), the deploy pipeline and the VPS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Medhansh&lt;/strong&gt; (&lt;a href="https://github.com/Medhansh-741" rel="noopener noreferrer"&gt;@Medhansh-741&lt;/a&gt;): sign-in, the opencode agent loop, Flagsmith experiments, results and the web app&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shreyas&lt;/strong&gt; (&lt;a href="https://github.com/shryssssss-maker" rel="noopener noreferrer"&gt;@shryssssss-maker&lt;/a&gt;): Twig's design, including the GPU fog background, typography, landing page and workspace&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shrey&lt;/strong&gt; (&lt;a href="https://github.com/MrPanda009" rel="noopener noreferrer"&gt;@MrPanda009&lt;/a&gt;): the login page and the fog transitions between screens&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Try Twig at &lt;a href="https://twig.vertexfold.com" rel="noopener noreferrer"&gt;twig.vertexfold.com&lt;/a&gt;: sign in and describe a change&lt;/li&gt;
&lt;li&gt;Star the repo: &lt;a href="https://github.com/prx-my/laughing-engine" rel="noopener noreferrer"&gt;github.com/prx-my/laughing-engine&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Star &lt;a href="https://github.com/Flagsmith/flagsmith" rel="noopener noreferrer"&gt;Flagsmith&lt;/a&gt;, the open-source flag and experimentation platform Twig runs on&lt;/li&gt;
&lt;li&gt;Follow the team on GitHub: &lt;a href="https://github.com/prx-my" rel="noopener noreferrer"&gt;Prakhar&lt;/a&gt;, &lt;a href="https://github.com/Medhansh-741" rel="noopener noreferrer"&gt;Medhansh&lt;/a&gt;, &lt;a href="https://github.com/shryssssss-maker" rel="noopener noreferrer"&gt;Shreyas&lt;/a&gt;, &lt;a href="https://github.com/MrPanda009" rel="noopener noreferrer"&gt;Shrey&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'd like to hear what you would test on your own site first. Leave it in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>hackathon</category>
      <category>featureflags</category>
    </item>
    <item>
      <title>I built a family scam alarm with AI agents on Switch. Here's how, and everywhere I got stuck</title>
      <dc:creator>Prakhar Gupta</dc:creator>
      <pubDate>Sat, 07 Nov 2026 19:48:51 +0000</pubDate>
      <link>https://dev.to/prxmy/i-built-a-family-scam-alarm-with-ai-agents-on-switch-heres-how-and-everywhere-i-got-stuck-3gma</link>
      <guid>https://dev.to/prxmy/i-built-a-family-scam-alarm-with-ai-agents-on-switch-heres-how-and-everywhere-i-got-stuck-3gma</guid>
      <description>&lt;p&gt;Most "AI agent" demos have one agent answering one person. The problem I wanted to solve needed the opposite: &lt;strong&gt;several people and several agents, in one chat, getting one urgent job done together.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This post walks through how I built it, for the &lt;a href="https://www.wemakedevs.org/hackathons/switch" rel="noopener noreferrer"&gt;WeMakeDevs × Switch "Flip the Switch" hackathon&lt;/a&gt;. For each part I explain &lt;em&gt;why&lt;/em&gt; it's built that way, &lt;em&gt;what I tried first&lt;/em&gt;, and &lt;em&gt;where it broke&lt;/em&gt;. If you're building anything where agents and humans share a chat, most of these lessons carry over.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you'll learn&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to split work between AI agents and plain code, and why I kept the most important decision away from the AI&lt;/li&gt;
&lt;li&gt;How a service with no AI at all can be a full participant in an agent chat room&lt;/li&gt;
&lt;li&gt;Why AI agents can't keep a clock, and what to do instead&lt;/li&gt;
&lt;li&gt;How to hand work from one agent to another in front of the humans&lt;/li&gt;
&lt;li&gt;Why "the agent asks for approval" wasn't safe enough, and what I replaced it with&lt;/li&gt;
&lt;li&gt;Real bugs from live testing, and how I got out of each&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/VWSH7CKUek0" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
🎥 &lt;a href="https://youtu.be/VWSH7CKUek0" rel="noopener noreferrer"&gt;Demo video&lt;/a&gt; · 💻 &lt;a href="https://github.com/prx-my/parent-line" rel="noopener noreferrer"&gt;Code&lt;/a&gt; · 𝕏 &lt;a href="https://x.com/_prxmy/status/2119134696768770535" rel="noopener noreferrer"&gt;The thread on X&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  The problem in one minute
&lt;/h2&gt;

&lt;p&gt;In a "digital arrest" scam, a caller posing as police puts an older person on a video call, says they're under investigation, and walks them through sending their savings to "clear their name". India's Home Ministry told the Supreme Court of &lt;strong&gt;21,900+ complaints and ₹647 crore+ in eight months of 2026&lt;/strong&gt; (&lt;a href="https://www.hindustantimes.com/india-news/21900-digital-arrest-complaints-registered-till-sept-mha-to-sc-101792697131006.html" rel="noopener noreferrer"&gt;Hindustan Times&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The scam runs on &lt;strong&gt;isolation&lt;/strong&gt;. Victims are told they "must not communicate with anyone else" (&lt;a href="https://indianexpress.com/article/explained/digital-arrest-scams-supreme-court-rbi-bank-liability-explained-10943089/" rel="noopener noreferrer"&gt;Indian Express&lt;/a&gt;). Even the bank's safety check fails: it calls the account holder to confirm, and that's the one person the scammer is coaching.&lt;/p&gt;

&lt;p&gt;So the design rule was simple: &lt;strong&gt;don't ask the victim, tell the family.&lt;/strong&gt; When Mom's bank SMS looks wrong, the family's group chat gets an alarm, and AI agents help the family split the work: one person calls Mom, one reports on the 1930 helpline, one calls the bank, and the paperwork gets done before the bank's reporting deadline.&lt;/p&gt;

&lt;p&gt;(The longer story, with sources, is in &lt;a href="https://web-jet-three-69.vercel.app/blog/nobody-else-on-the-call/" rel="noopener noreferrer"&gt;this post on the project site&lt;/a&gt;.)&lt;/p&gt;


&lt;h2&gt;
  
  
  Why Switch, and not "a Telegram bot plus an LLM API"?
&lt;/h2&gt;

&lt;p&gt;My first instinct was a Telegram bot that calls an LLM. Then I listed what I'd have to build myself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a shared history that every agent and person reads from&lt;/li&gt;
&lt;li&gt;routing: which message goes to which agent&lt;/li&gt;
&lt;li&gt;agent-to-agent handoff without a hidden back channel&lt;/li&gt;
&lt;li&gt;a way for an agent to ask a human before doing something risky&lt;/li&gt;
&lt;li&gt;the Telegram side, and later WhatsApp and SMS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/sandbox-quantum/switch" rel="noopener noreferrer"&gt;Switch&lt;/a&gt; already does all of that. It's an open-source platform where &lt;strong&gt;people and agents are participants in the same room&lt;/strong&gt;. Its Telegram bridge turns a Telegram group into a Switch room, so the family keeps using the app they already have, and every agent sees the same conversation they do.&lt;/p&gt;

&lt;p&gt;That changed how I designed everything. Instead of wiring components together, &lt;strong&gt;every part of Parent Line just posts to the room and gets addressed in it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff5bomcu8jssgcctexr0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff5bomcu8jssgcctexr0p.png" alt="Architecture: Bank watch, Ride watch and Call watch post into the family room on Switch; inside it the Guardian agent hands out jobs to the family and passes the case to the Clerk agent" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Part&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Switch feature it uses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Family group&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;People in Telegram&lt;/td&gt;
&lt;td&gt;Telegram bridge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Guardian&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;AI agent (Claude Code)&lt;/td&gt;
&lt;td&gt;The room's instructions are its prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Clerk&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;AI agent (Claude Code)&lt;/td&gt;
&lt;td&gt;Agent-to-agent handoff, room documents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Bank watch&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python, no AI&lt;/td&gt;
&lt;td&gt;Agent identity + HTTP API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ride watch&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python, no AI&lt;/td&gt;
&lt;td&gt;Agent event stream (long poll)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Call watch&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python + Twilio, no AI&lt;/td&gt;
&lt;td&gt;Agent identity + HTTP API&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice the bottom half: &lt;strong&gt;three of the five participants have no AI at all.&lt;/strong&gt; That was deliberate, and it's the first lesson.&lt;/p&gt;


&lt;h2&gt;
  
  
  Lesson 1: Decide what must &lt;em&gt;not&lt;/em&gt; be AI
&lt;/h2&gt;

&lt;p&gt;The most important decision in the whole system is "should we wake the family at midnight about this payment?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I could have done:&lt;/strong&gt; send every bank SMS to the LLM and ask "is this a scam?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I didn't:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Predictability.&lt;/strong&gt; A family must be able to trust that ₹4.8 lakh at 23:40 to a new payee &lt;em&gt;always&lt;/em&gt; fires, not "usually".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Testability.&lt;/strong&gt; Rules can be unit tested. A prompt can only be sampled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy.&lt;/strong&gt; If a model reads every SMS, it reads every grocery payment. With rules, &lt;strong&gt;no AI ever sees an SMS that doesn't raise an alarm.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost and uptime.&lt;/strong&gt; Rules run in microseconds with no API key and no network.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So Bank watch is plain Python, standard library only. It parses the SMS and checks a few rules: over the family's limit, a payee never paid before, an FD broken early, a loan, several debits close together, a debit late at night.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1icqdu7z12hv2k4lr6i2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1icqdu7z12hv2k4lr6i2.png" alt="Terminal: the sample scam SMS raises an alarm listing three reasons; an ordinary ₹450 grocery payment raises nothing" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second command is the important one. A ₹450 payment to the local kirana store produces &lt;strong&gt;nothing&lt;/strong&gt;. The family never sees Mom's everyday spending.&lt;/p&gt;

&lt;p&gt;The alarm also carries a deadline. RBI's 2017 customer-liability circular says an unauthorised debit reported within &lt;strong&gt;three working days&lt;/strong&gt; costs the customer nothing. Counting working days is exactly the kind of thing I didn't want a model doing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;report_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# shortcut: counts every day but Sunday as a working day; bank holidays
&lt;/span&gt;    &lt;span class="c1"&gt;# only push the real deadline later, so this date is never too late.
&lt;/span&gt;    &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;counted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;counted&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;counted&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;When you take a shortcut, make it fail in the safe direction.&lt;/strong&gt; I skipped the bank-holiday calendar. Ignoring holidays can only make my date &lt;em&gt;earlier&lt;/em&gt; than the real deadline, never later. Early is safe; late costs a family money.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What the AI &lt;em&gt;does&lt;/em&gt; get:&lt;/strong&gt; coordinating people. Turning an alarm into jobs, tracking who took what, chasing the ones nobody took, and writing complaints. Those are language tasks, and an LLM is very good at them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The trade-off:&lt;/strong&gt; rules miss SMS formats they don't know. Today Bank watch reads SBI's format and a generic one. A model would generalise better, and I chose to pay that price for predictability. Adding a bank means adding a parser and a test.&lt;/p&gt;


&lt;h2&gt;
  
  
  Lesson 2: A service with no AI is just another participant
&lt;/h2&gt;

&lt;p&gt;Here's the part that surprised me most about Switch. To Switch, Bank watch is an &lt;strong&gt;agent&lt;/strong&gt;, exactly like the Guardian. It has a name, an identity and room membership. It just never runs an AI session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In Switch Console, create an agent called &lt;code&gt;bank-watch&lt;/code&gt; and give it a working directory. Console writes its credentials there (git-ignored).&lt;/li&gt;
&lt;li&gt;Invite it to the room from Telegram: &lt;code&gt;!invite-agent @bank-watch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Post with one HTTP call:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;room_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Send one message to the room; return Switch&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s event id.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;room_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;room_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;the alarm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;event_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's &lt;code&gt;POST /agents/{id}/message&lt;/code&gt;. The alarm ends with &lt;code&gt;@guardian over to you.&lt;/code&gt;, and &lt;strong&gt;delivering that mention to the Guardian is Switch's job.&lt;/strong&gt; No queue, no webhook between my services and my agents, no glue code.&lt;/p&gt;

&lt;p&gt;Here's the family room in Switch Console, with all five participants:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs4uza7glfos6tba17wjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs4uza7glfos6tba17wjl.png" alt="Switch Console showing the family room bridged from Telegram, with five agents: guardian, bank-watch and clerk here now, ride-watch disconnected, call-watch status unknown" width="799" height="527"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; you don't need an SDK or an MCP client to join an agent conversation. Anything that can make an HTTP request can be a participant. That's what let me keep the critical logic in tested Python while still being "in the room".&lt;/p&gt;
&lt;h3&gt;
  
  
  Bonus: your prompt can live in git
&lt;/h3&gt;

&lt;p&gt;The same HTTP client can run any Switch operation, the ones AI agents get as MCP tools. So &lt;code&gt;bankwatch setup&lt;/code&gt; sets the Guardian's behaviour directly:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;op&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;update_room&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;room_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;room_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;instructions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The Guardian's prompt is the &lt;strong&gt;room's instructions&lt;/strong&gt;: a Markdown file in the repo, with the family's names, the backup neighbour and the bank filled in from &lt;code&gt;family.toml&lt;/code&gt;. Nobody pastes a prompt into a UI. It's versioned, reviewable, and reproducible on a fresh machine.&lt;/p&gt;

&lt;p&gt;A few rules in those instructions came straight from watching Telegram render the output:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No tables, no headings.&lt;/strong&gt; Switch converts the agents' Markdown for each chat app. On Telegram, bold and bullets survive and tables don't. So every layout uses bold, numbered lines and bullets only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"One idea per line, at most 8 lines."&lt;/strong&gt; People read these on a phone, at night, scared.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A fixed set of emoji&lt;/strong&gt;: 🚨 alarm, ✅ done, ⏳ in progress, ❌ nobody yet. The same symbol always means the same thing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Tell people to start their reply with &lt;a class="mentioned-user" href="https://dev.to/guardian"&gt;@guardian&lt;/a&gt;."&lt;/strong&gt; By default a Switch agent only gets messages addressed to it. (A server feature flag, &lt;code&gt;follow_the_conversation&lt;/code&gt;, lifts that, but it's off by default.)&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Lesson 3: AI agents can't keep a clock
&lt;/h2&gt;

&lt;p&gt;Ride watch is a check-in for a ride alone at night. You write &lt;code&gt;@ride-watch 25 min&lt;/code&gt; and paste the ride app's share-trip message. If you haven't said &lt;code&gt;reached&lt;/code&gt; 10 minutes after that, it asks. No answer 5 minutes later, and the family gets an alarm with the vehicle number and driver details.&lt;/p&gt;

&lt;p&gt;My first thought was to give this to the Guardian. It doesn't work: &lt;strong&gt;an agent only acts when someone writes to it.&lt;/strong&gt; It can't wake itself up at 23:55 to notice that nothing happened. "Nothing happened" never arrives as a message.&lt;/p&gt;

&lt;p&gt;So the timer is plain Python again. It reads messages from Switch's &lt;strong&gt;agent event stream&lt;/strong&gt; (&lt;code&gt;GET /agents/{id}/events&lt;/code&gt;, a long poll) and runs a 30-second tick beside it:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;events&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;events&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# long poll: returns as soon as something arrives
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;is_for_me&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;room_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;payload&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="c1"&gt;# Ride watch never reads an image; the Guardian does, if the alarm fires.
&lt;/span&gt;        &lt;span class="n"&gt;shots&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mxc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;attachments&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
                 &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mimetype&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;image/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
        &lt;span class="nf"&gt;step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;rides&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shots&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;shots&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
             &lt;span class="nf"&gt;on_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rides&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sender_name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;shots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Look at the screenshots line. People send a screenshot of the driver's details. Ride watch &lt;strong&gt;doesn't read it&lt;/strong&gt;. It keeps Switch's media id. If the alarm fires, the Guardian (Claude) downloads it with its &lt;code&gt;download_attachment&lt;/code&gt; tool and reads out the vehicle and driver for the family. &lt;strong&gt;On a ride that ends safely, no AI looks at anything.&lt;/strong&gt; Reading an image is a judgement call, so it goes to the AI, and only when it matters.&lt;/p&gt;
&lt;h3&gt;
  
  
  🧱 Where I got stuck: an AI pretending to be my timer
&lt;/h3&gt;

&lt;p&gt;In a live test, a ride alarm appeared in the family group &lt;strong&gt;before the check-in time&lt;/strong&gt;. Ride watch hadn't posted it.&lt;/p&gt;

&lt;p&gt;What happened: Switch Console has a &lt;strong&gt;room watcher&lt;/strong&gt;. When an agent it manages is @-mentioned and isn't connected, Console starts a Claude Code session &lt;em&gt;as that agent&lt;/em&gt; to answer. My Ride watch only polls, so to Switch it looked absent. Someone wrote &lt;code&gt;@ride-watch&lt;/code&gt;, Console started a Claude session called &lt;code&gt;ride-watch&lt;/code&gt;, and that session did what it thought a ride watcher should do: it posted a ride alarm. A fake one.&lt;/p&gt;

&lt;p&gt;That's the worst kind of bug for this project. A false alarm sends a whole family running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I got out, in three layers&lt;/strong&gt;, because any one of them could fail:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Stay visibly present.&lt;/strong&gt; Ride watch now sends a heartbeat (&lt;code&gt;POST /agents/{id}/connection/renew&lt;/code&gt;) every 2 seconds. Switch forgets a connection after about 6, so now it counts the service as there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn the watcher off.&lt;/strong&gt; On the agent's page in Console, under &lt;strong&gt;Room watcher&lt;/strong&gt;, press &lt;strong&gt;Stop&lt;/strong&gt;. It's now a step in the README.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tell any stray session to stay silent.&lt;/strong&gt; The room instructions now say that &lt;code&gt;bank-watch&lt;/code&gt; and &lt;code&gt;ride-watch&lt;/code&gt; are small programs, and an AI session running under either name must post nothing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Layer 3 is the one I could watch working. Here's a session Console started as &lt;code&gt;bank-watch&lt;/code&gt; &lt;em&gt;after&lt;/em&gt; the fix. It read the instructions and refused to post:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzsrh9q22hm3g0rcfb0h8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzsrh9q22hm3g0rcfb0h8.jpg" alt="Switch Console: an AI session started as bank-watch replies that it didn't post anything because the room's instructions say bank-watch is a small program, not an AI agent, and that it must stay silent" width="800" height="890"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(&lt;a href="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/gmbqw44bvxw5zs790gyg.png" rel="noopener noreferrer"&gt;https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/gmbqw44bvxw5zs790gyg.png&lt;/a&gt;)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;If a program and an AI can share a name, assume the AI will one day answer for the program.&lt;/strong&gt; Make it impossible (stop the watcher), make it unlikely (stay connected), and make it harmless (instructions).&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Lesson 4: Hand work between agents where the humans can see it
&lt;/h2&gt;

&lt;p&gt;The Guardian splits the alarm into three jobs and tracks them as the family replies. Once money has moved, it hands the paperwork to a second agent in one plain line:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@clerk please open a case
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That's an ordinary message in the room. &lt;strong&gt;The family sees the handoff&lt;/strong&gt;, can correct it, and can step in. No hidden agent-to-agent channel.&lt;/p&gt;

&lt;p&gt;The Clerk keeps one case file per incident as a &lt;strong&gt;Switch room document&lt;/strong&gt; (&lt;code&gt;create_room_document&lt;/code&gt;). It writes the 1930 complaint and the letter to the bank, and owns the RBI deadline: on the last day, Bank watch posts a reminder addressed to &lt;code&gt;@clerk&lt;/code&gt; asking for the bank's complaint number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why two agents and not one?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Different time scales.&lt;/strong&gt; The Guardian is about people &lt;em&gt;right now&lt;/em&gt;: who's calling Mom? The Clerk is about paper over &lt;em&gt;days&lt;/em&gt;: was it reported, what's the complaint number, when do we escalate?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smaller prompts work better.&lt;/strong&gt; Each agent's instructions stay focused, and each is easier to test by itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separate permissions.&lt;/strong&gt; Only the Clerk can draft public posts, so only the Clerk needs the safety rules for them (lesson 5).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a stretch of the real test group. A ride alarm, the rider says &lt;code&gt;reached&lt;/code&gt;, the Guardian closes it, and then goes straight back to the bank alarm that's still open: who's called Papa, and who's taking job 2? (My test family's config calls the parent Papa.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41v9yfbsv39528b439yk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41v9yfbsv39528b439yk.jpg" alt="The family Telegram group: a ride alarm with three jobs, the rider replies reached, the Guardian closes the ride alarm, posts the bank alarm's job list with one job done, one in progress and one untaken, and later re-raises the open bank alarm to everyone" width="800" height="890"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The numbers from that live test on Telegram:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the Guardian answered &lt;strong&gt;5 seconds&lt;/strong&gt; after the alarm&lt;/li&gt;
&lt;li&gt;the Clerk had updated the case file &lt;strong&gt;28 seconds&lt;/strong&gt; after it&lt;/li&gt;
&lt;li&gt;with no job taken, the Guardian chased the family at &lt;strong&gt;3 minutes&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@guardian I'll take 1&lt;/code&gt; got an updated job list &lt;strong&gt;2 seconds&lt;/strong&gt; later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What's still not solved:&lt;/strong&gt; because of lesson 3, the Guardian can't keep chasing by itself if nobody writes anything. The fix is the same pattern as Ride watch, a small timer service that re-raises an unanswered alarm. It's next on the roadmap.&lt;/p&gt;


&lt;h2&gt;
  
  
  Lesson 5: Put a human's thumb on the last button
&lt;/h2&gt;

&lt;p&gt;When a bank or ride app ignores a complaint, public pressure works. So the Clerk drafts a short post for X tagging their support account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 1:&lt;/strong&gt; the Clerk posted through the X API, behind Switch's &lt;strong&gt;approval card&lt;/strong&gt;. Claude Code's permission settings made the post command wait, and a family member had to press &lt;strong&gt;Allow&lt;/strong&gt; in the chat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What went wrong:&lt;/strong&gt; in a live test the Clerk was running with Claude Code's &lt;strong&gt;Auto mode&lt;/strong&gt; on. Its own safety review decided the command was fine and ran it. &lt;strong&gt;No approval card appeared.&lt;/strong&gt; The guard I was relying on wasn't the one in charge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 2:&lt;/strong&gt; no agent can publish at all. The Clerk runs a checker, then sends a link that opens X with the draft filled in. A person reads it and presses &lt;strong&gt;Post&lt;/strong&gt; on their own account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F26957bbr2hmrh6axemkr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F26957bbr2hmrh6axemkr.png" alt="Terminal: xpost.py refuses a draft containing a phone number and an account number, then turns a safe draft into an x.com compose link" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The checker refuses phone numbers, email addresses, long account-style numbers and anything over 280 characters, because someone panicking at midnight will paste the wrong thing. The safe draft becomes an &lt;code&gt;x.com/intent/post&lt;/code&gt; link.&lt;/p&gt;

&lt;p&gt;Side benefits I didn't plan for: no X developer account, no API keys to leak, and the post comes from the family's own account, which carries more weight than a bot.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;For anything public and irreversible, don't rely on a setting to stop the agent. Remove the agent's ability to do it.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Other walls, and how to get past them
&lt;/h2&gt;

&lt;p&gt;Some of these I hit in testing; the rest the README now warns about, so you don't have to.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The Telegram group never showed up in Switch&lt;/td&gt;
&lt;td&gt;Telegram's &lt;strong&gt;Group Privacy&lt;/strong&gt; was on when the bot joined, so the bot never saw messages&lt;/td&gt;
&lt;td&gt;Turn it off in BotFather &lt;em&gt;before&lt;/em&gt; adding the bot. Already added? Remove the bot and add it again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Every agent message ended with a list like &lt;code&gt;mcp__switch__read_context&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Telegram connections show each turn's tool calls, which helps developers and confuses families&lt;/td&gt;
&lt;td&gt;I wrote &lt;a href="https://github.com/sandbox-quantum/switch/pull/1585" rel="noopener noreferrer"&gt;a Switch PR&lt;/a&gt; adding a &lt;strong&gt;Show tool calls&lt;/strong&gt; setting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;My demo SMS was a ₹4,80,000 &lt;strong&gt;UPI&lt;/strong&gt; transfer&lt;/td&gt;
&lt;td&gt;UPI to a person is capped at ₹1 lakh a day, so that SMS can't exist&lt;/td&gt;
&lt;td&gt;Switched the sample to &lt;strong&gt;IMPS&lt;/strong&gt;. Domain details matter in a demo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replaying an SMS with a changed reference number made the Clerk ask "one debit or two?"&lt;/td&gt;
&lt;td&gt;Bank watch drops duplicates by reference. A new reference really is a second debit, and the agents were right&lt;/td&gt;
&lt;td&gt;Delete &lt;code&gt;bankwatch-state.json&lt;/code&gt; to replay, and don't fake the reference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ride watch said a ride was "already alarmed"&lt;/td&gt;
&lt;td&gt;An old test ride was still saved as alarmed&lt;/td&gt;
&lt;td&gt;Delete &lt;code&gt;ridewatch-state.json&lt;/code&gt; between tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The missed-call webhook returned &lt;strong&gt;403&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Twilio signs the exact URL it calls. A quick cloudflared tunnel gets a new address on every restart, so the signed URL stopped matching my config&lt;/td&gt;
&lt;td&gt;Update &lt;code&gt;public_url&lt;/code&gt; and Twilio's webhook together, every time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A family member's reply got no answer&lt;/td&gt;
&lt;td&gt;It didn't start with &lt;code&gt;@guardian&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Tell people in every message, or turn on &lt;code&gt;follow_the_conversation&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  Giving back to Switch
&lt;/h2&gt;

&lt;p&gt;Most Indian parents live in WhatsApp, not Telegram. The parent-facing half of this idea, &lt;strong&gt;Line&lt;/strong&gt;, is a help line in Mom's own chat. It answers phone questions one step at a time in Hindi, English or Hinglish, and refuses scam-shaped requests ("install AnyDesk", "tell me the OTP") by alerting the family. That needed new Switch platforms, so I wrote them:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pull request&lt;/th&gt;
&lt;th&gt;What it adds&lt;/th&gt;
&lt;th&gt;One thing I learned&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/sandbox-quantum/switch/pull/1166" rel="noopener noreferrer"&gt;#1166&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;WhatsApp&lt;/td&gt;
&lt;td&gt;Check every webhook's &lt;code&gt;X-Hub-Signature-256&lt;/code&gt; and de-duplicate by message id, because Meta retries deliveries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/sandbox-quantum/switch/pull/1244" rel="noopener noreferrer"&gt;#1244&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;SMS through Twilio&lt;/td&gt;
&lt;td&gt;Every text costs money, so cap segments per reply and per number per hour. Approval cards become a text reply like &lt;code&gt;A1 1&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/sandbox-quantum/switch/pull/1585" rel="noopener noreferrer"&gt;#1585&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Show tool calls setting&lt;/td&gt;
&lt;td&gt;You can't just switch off activity for a platform: the same code draws the approval cards people need&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/sandbox-quantum/switch/pull/1576" rel="noopener noreferrer"&gt;#1576&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Microsoft 365 connector research&lt;/td&gt;
&lt;td&gt;Not used by Parent Line&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;They're still open, so Line is optional. &lt;strong&gt;Everything else runs on Switch as released.&lt;/strong&gt; One design note: an agent is connected to one room at a time, so Line lives in Mom's chat and hops to the family room with &lt;code&gt;connect_to_room&lt;/code&gt; to raise an alarm, then hops back.&lt;/p&gt;


&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;You don't need Switch, a phone or a bank to see the core logic. Python 3.11+ and one minute:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/prx-my/parent-line &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;parent-line
python3 check.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmr3x9vfzs05tydebgd39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmr3x9vfzs05tydebgd39.png" alt="Terminal: check.py reports OK for Python, repo files, family.toml, 58 unit tests and the sample alarm, then lists the optional tools for later steps" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every line is &lt;code&gt;OK&lt;/code&gt;, &lt;code&gt;NOTE&lt;/code&gt; or &lt;code&gt;FAIL&lt;/code&gt;, and every &lt;code&gt;FAIL&lt;/code&gt; comes with its fix. I wrote &lt;code&gt;check.py&lt;/code&gt; for anyone cloning the repo, judges included: the first minute decides whether someone keeps going.&lt;/p&gt;

&lt;p&gt;The full flow on Telegram with Switch Console takes about 20 minutes. The &lt;a href="https://github.com/prx-my/parent-line#run-it" rel="noopener noreferrer"&gt;README&lt;/a&gt; walks through it, including the problems above.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/prx-my" rel="noopener noreferrer"&gt;
        prx-my
      &lt;/a&gt; / &lt;a href="https://github.com/prx-my/parent-line" rel="noopener noreferrer"&gt;
        parent-line
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Family alarms for digital-arrest scams, built on Switch: bank SMS triggers a family Telegram group where an AI agent and the family respond together.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Parent Line&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;When an older parent's bank SMS looks like a scam, the family's group chat gets an alarm, and two AI agents help the family act on it together. Built on &lt;a href="https://github.com/sandbox-quantum/switch" rel="noopener noreferrer"&gt;Switch&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://youtu.be/VWSH7CKUek0" rel="nofollow noopener noreferrer"&gt;Demo video&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://web-jet-three-69.vercel.app/" rel="nofollow noopener noreferrer"&gt;Website&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/prx-my/parent-line#run-it" rel="noopener noreferrer"&gt;Try it in one minute&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/prx-my/parent-line#how-switch-is-used" rel="noopener noreferrer"&gt;How Switch is used&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/prx-my/parent-line#my-pull-requests-to-switch" rel="noopener noreferrer"&gt;My pull requests to Switch&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Digital-arrest scammers win by isolation. They keep an older parent on a video call for hours, forbid them to tell anyone, and walk them through sending their savings to "clear their name". The bank's confirmation call doesn't help: it reaches the one person the scammer controls, who has been told what to say.&lt;/p&gt;

&lt;p&gt;Parent Line tells the family instead. Someone calls the parent, someone reports it, someone calls the bank, and the paperwork is done before the bank's reporting deadline.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;For judges&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;&lt;div class="table-wrapper-paragraph"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;table&gt;

&lt;thead&gt;

&lt;tr&gt;

&lt;th&gt;You're judging&lt;/th&gt;

&lt;th&gt;Where to look&lt;/th&gt;

&lt;/tr&gt;

&lt;/thead&gt;

&lt;tbody&gt;

&lt;tr&gt;

&lt;td&gt;&lt;strong&gt;Use of Switch&lt;/strong&gt;&lt;/td&gt;

&lt;td&gt;
&lt;br&gt;
&lt;a href="https://github.com/prx-my/parent-line#how-switch-is-used" rel="noopener noreferrer"&gt;How Switch is used&lt;/a&gt;:&lt;/td&gt;

&lt;/tr&gt;

&lt;/tbody&gt;

&lt;/table&gt;&lt;/div&gt;…&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/prx-my/parent-line" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;





&lt;h2&gt;
  
  
  What it can't do (yet)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It can't stop a transfer.&lt;/strong&gt; Only the bank can. That's why "call the bank" is one of the three jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No SMS, no alarm.&lt;/strong&gt; If Mom's phone is off, or the bank's format isn't parsed, nothing reaches Bank watch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It isn't proven.&lt;/strong&gt; The rules are tested and the flow works live. Whether real families respond fast enough is still an open question. Family members have stopped these scams in the news, but those are single stories. I found no study that measures how often it works.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Someone has to run it.&lt;/strong&gt; Ideally each family runs its own Switch, so no company holds many families' bank SMS. For families who can't, someone they trust would host it. That part is a plan, not built.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The three things I'd tell you before you build with agents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Draw the line between judgement and rules first.&lt;/strong&gt; Give the AI language and coordination. Keep money, time and anything you must test in plain code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make agents and services peers in one room.&lt;/strong&gt; Then handoffs are visible, history is shared, and humans can step in at any point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test live, early, with the real chat app.&lt;/strong&gt; The worst bugs in this post, the fake ride alarm and the post that skipped its approval, only showed up in live Telegram tests, never in unit tests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you've been the child who got that phone call, or you're building something on Switch and hit different walls, I'd like to hear about it in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built for Flip the Switch. #HowISwitch #FlipTheSwitch&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>tutorial</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
