<?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: Harshil Srivastav</title>
    <description>The latest articles on DEV Community by Harshil Srivastav (@harshil-sri).</description>
    <link>https://dev.to/harshil-sri</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%2F4232487%2Fa80041f6-0850-4159-a254-7dc247783f43.jpg</url>
      <title>DEV Community: Harshil Srivastav</title>
      <link>https://dev.to/harshil-sri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harshil-sri"/>
    <language>en</language>
    <item>
      <title>Two Friends, Two AI Delegates, One Weekend Trip: Building Delegates on Switch</title>
      <dc:creator>Harshil Srivastav</dc:creator>
      <pubDate>Sat, 07 Nov 2026 17:09:42 +0000</pubDate>
      <link>https://dev.to/harshil-sri/building-a-switch-courtroom-where-ai-can-negotiate-but-cant-consent-1g6k</link>
      <guid>https://dev.to/harshil-sri/building-a-switch-courtroom-where-ai-can-negotiate-but-cant-consent-1g6k</guid>
      <description>&lt;p&gt;Planning a weekend trip with a friend should be easy. In practice it's a week of "are you free on the 14th?", "no, I have a deadline", "what about the 21st?", "how much are you spending?" in a group chat, until somebody gives up.&lt;/p&gt;

&lt;p&gt;I'm Harshil, a B.Tech AI/ML student in Delhi. With Daksh and Kartik, I built &lt;strong&gt;Delegates&lt;/strong&gt; for Flip the Switch, in Track 2: Best Personal or Creative Workflow. Each person gets their own AI delegate. The delegates work out a trip between them, a plain-code clerk checks every plan against both calendars, and nothing is final until both humans sign.&lt;/p&gt;

&lt;p&gt;Our rule: &lt;strong&gt;agents negotiate, humans sign.&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%2Fu31dlriqbap8m85lc3yb.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%2Fu31dlriqbap8m85lc3yb.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Switch does, without the jargon
&lt;/h2&gt;

&lt;p&gt;Switch gives people and AI agents a shared room to work in. Agents join with their own identities, read what's happening in the room, and post replies like teammates. Switch can also bridge a room to a chat app. We used &lt;strong&gt;Mattermost&lt;/strong&gt;, so the humans just type in a normal chat.&lt;/p&gt;

&lt;p&gt;The part that mattered most for us is identity. Every message in a Switch room has a real sender. That's the whole project, really: Harshil's delegate must never be able to speak for Daksh, and the only way to enforce that is to know exactly who sent each message.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trip
&lt;/h2&gt;

&lt;p&gt;The scenario is a real one for us. Two friends in Delhi want a weekend away in the next couple of weeks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Harshil&lt;/strong&gt; works Monday to Friday, 9 to 6, and can't take leave. His budget is around ₹8,000 and he wants the mountains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Daksh&lt;/strong&gt; interns weekdays 10 to 7. His DBMS assignment is due Monday the 16th at 10am, so Sunday evening is off limits. He can spend up to ₹10,000 and refuses overnight buses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Three Switch identities do the work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cvc-lead-advocate&lt;/code&gt;&lt;/strong&gt; is Harshil's delegate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cvc-creator-advocate&lt;/code&gt;&lt;/strong&gt; is Daksh's delegate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cvc-clerk&lt;/code&gt;&lt;/strong&gt; is plain Node.js. No model. It does the calendar maths and enforces the rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The courtroom on our site is the presentation layer. The three illustrated judges (budget, calendar, consent) are characters that react to what happens in the room. They don't decide anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  How a run goes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Each person briefs their own delegate.&lt;/strong&gt; Harshil types in Mattermost, in plain English:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@cvc-lead-advocate I have my job Monday to Friday, 9 to 6, and I can't take any leave.
Budget is around 8k per person. I'd love somewhere in the mountains.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;His delegate turns that into a schedule and replies with exactly what it will protect. Anything marked 🔒 is a hard limit the clerk will enforce. Daksh does the same with his own delegate.&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%2F8u5sw9bpkdz3bqerpmhb.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%2F8u5sw9bpkdz3bqerpmhb.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Nobody briefs someone else's delegate.&lt;/strong&gt; During our run, Daksh told Harshil's delegate "Harshil is free this Friday". The clerk refused it: Harshil's delegate only takes instructions from Harshil.&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%2F01ftwzrtbizx6xuxd69p.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%2F01ftwzrtbizx6xuxd69p.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The clerk finds the free time.&lt;/strong&gt; Harshil asks the clerk to plan a weekend trip from Delhi. The clerk lines up both calendars for the next six weeks and looks for windows of 20 hours or more when both of us are free. In our run, Fri 13 Nov was cut short by Daksh's Sunday block, and every weekend from Fri 20 Nov was clear.&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%2Fa7pvftqrh4ko2jtsbuc1.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%2Fa7pvftqrh4ko2jtsbuc1.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. One delegate proposes, the clerk checks, the other reviews.&lt;/strong&gt; Harshil's delegate proposed Nainital: the mountains Harshil wanted, with overnight trains instead of buses for Daksh. Leave Fri 20 Nov at 10:05 pm, back in Delhi Sun 22 Nov by 9 pm, about ₹6,500 each. The clerk checked it against both work weeks, both budgets and Daksh's DBMS block. If a plan breaks a hard limit, the clerk sends it back and the delegate tries again. Then Daksh's delegate reviewed it and agreed.&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%2Fuc8j6x4ccrfua2r31cib.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%2Fuc8j6x4ccrfua2r31cib.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. The humans decide.&lt;/strong&gt; A delegate agreeing is a recommendation, not a signature. Each of us had to send &lt;code&gt;@cvc-clerk approve&lt;/code&gt; from our own account. After Harshil it said "1 of 2". After Daksh, the clerk posted 🔒 &lt;strong&gt;Trip locked.&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%2F0iwylmhrlz005qcr5imf.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%2F0iwylmhrlz005qcr5imf.png" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The website replays that run. Scroll down and you get the whole case file: each person's limits, the plan with every check, both signatures, and the full Switch room log, where every entry keeps its Switch message ID.&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%2Faifxw2xxk4ugdsfxwh81.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%2Faifxw2xxk4ugdsfxwh81.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I set it up
&lt;/h2&gt;

&lt;p&gt;I ran Switch Console through &lt;strong&gt;WSL using the Linux &lt;code&gt;.deb&lt;/code&gt;&lt;/strong&gt;. For the project runtime we committed the upstream Compose file, which pins Switch core, gateway and setup to &lt;strong&gt;0.31.0&lt;/strong&gt; and Mattermost to &lt;strong&gt;11.9.0&lt;/strong&gt;. The app needs Node.js &lt;strong&gt;22.13 or newer&lt;/strong&gt; and has no npm dependencies.&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 &lt;span class="nt"&gt;--depth&lt;/span&gt; 1 &lt;span class="nt"&gt;--branch&lt;/span&gt; main https://github.com/harshil-sri/delegates.git
&lt;span class="nb"&gt;cd &lt;/span&gt;delegates
npm run init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That creates &lt;code&gt;.runtime/stack.env&lt;/code&gt; with generated local credentials. Keep that folder private. Then, on the machine that runs the stack (the helper scripts are Windows PowerShell):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\scripts\start-stack.ps1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nx"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;setup&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;npm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;setup:engine&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\scripts\start-trip.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Reset&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setup registers the three identities in Switch and creates the private room. If you'd rather watch it in a terminal, &lt;code&gt;npm run trip:reset&lt;/code&gt; does the same as the last line. Other things you can say to the clerk: &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;can we make it cheaper?&lt;/code&gt; (it re-plans with that note) and &lt;code&gt;reset&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To just see the replay, no Switch needed: open &lt;a href="https://public-wheat-one-26.vercel.app/court" rel="noopener noreferrer"&gt;https://public-wheat-one-26.vercel.app/court&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell the next beginner
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Give every participant a real identity
&lt;/h3&gt;

&lt;p&gt;A delegate that only produces text locally can't move the trip forward. It has to post through Switch under its own identity, and the clerk only reacts to messages from the right sender. Binding the human Mattermost accounts took extra work: the HTTP directory in our pinned Switch version didn't expose which native account belonged to which person, so setup reads that mapping with a scoped, read-only SQL query instead of guessing from usernames.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Keep the maths out of the model
&lt;/h3&gt;

&lt;p&gt;The AI is good at turning "I need Sunday evening free for my DBMS assignment" into a schedule. It's not where I want the final check on dates and rupees. The clerk does that in plain code: it expands weekly rules, finds shared windows, and rejects anything that touches a hard block or goes over a budget. Soft preferences only show up as warnings.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Treat a change of mind as a reset
&lt;/h3&gt;

&lt;p&gt;If someone tells their delegate a new constraint after a plan exists, both approvals are cleared and the clerk asks for a fresh plan. An old "yes" shouldn't carry over to a different trip.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Filter the noise
&lt;/h3&gt;

&lt;p&gt;Switch posts passive-agent notices and admin messages into the room. We filter them so they don't trigger a delegate turn or clutter the log on the website. Our workers also poll the room for new messages, which is simple but adds a second or two.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Tests and consent prove different things
&lt;/h3&gt;

&lt;p&gt;The repo passes &lt;strong&gt;117 tests&lt;/strong&gt;, including a full trip from plain-English briefs through a clerk rejection, a counter-offer and two approvals. That shows the rules work. The approvals in the replay are the part that came from people.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building by voice with Wispr Flow
&lt;/h2&gt;

&lt;p&gt;I dictated prompts, delegate instructions, the README and this post with &lt;strong&gt;Wispr Flow&lt;/strong&gt;, including the rules about who can brief which delegate. That was our Code with Wispr side-track workflow, not a speech feature in Delegates.&lt;/p&gt;

&lt;p&gt;My &lt;strong&gt;lifetime Wispr Flow stats&lt;/strong&gt; (not hackathon-only) are a &lt;strong&gt;57-day streak&lt;/strong&gt;, &lt;strong&gt;131,956 words dictated&lt;/strong&gt;, &lt;strong&gt;126 wpm&lt;/strong&gt;, and &lt;strong&gt;23 apps&lt;/strong&gt;. I'm not claiming a measured time saving for this build.&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%2Ff802qa2acozaokvl1wdl.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%2Ff802qa2acozaokvl1wdl.png" alt=" " width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Private context for each delegate is first. Right now both delegates sit in the same room, so each can read the other person's limits. In a real negotiation you'd want each side to keep some cards hidden. After that: the same flow in Slack or Discord, where our friends actually plan trips, and actual bookings once both people sign.&lt;/p&gt;

&lt;p&gt;The part I like most is that the most important thing a delegate does is sometimes stop and wait. It can find a weekend that works. Saying yes is still our job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live replay:&lt;/strong&gt; &lt;a href="https://public-wheat-one-26.vercel.app/court" rel="noopener noreferrer"&gt;https://public-wheat-one-26.vercel.app/court&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/harshil-sri/delegates" rel="noopener noreferrer"&gt;https://github.com/harshil-sri/delegates&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo video:&lt;/strong&gt; &lt;a href="https://youtu.be/956i9IuQE_Y" rel="noopener noreferrer"&gt;https://youtu.be/956i9IuQE_Y&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switch docs:&lt;/strong&gt; &lt;a href="https://docs.switchagents.ai/" rel="noopener noreferrer"&gt;https://docs.switchagents.ai/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>opensource</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
