<?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: talha-hmd</title>
    <description>The latest articles on DEV Community by talha-hmd (@talhahmd).</description>
    <link>https://dev.to/talhahmd</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%2F4231711%2F6797bc54-6efd-4343-b0f9-0c2e2e42e2c7.png</url>
      <title>DEV Community: talha-hmd</title>
      <link>https://dev.to/talhahmd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/talhahmd"/>
    <language>en</language>
    <item>
      <title>We Let Two AIs Negotiate a Deal and then Stopped Them From Leaking the Secret Number</title>
      <dc:creator>talha-hmd</dc:creator>
      <pubDate>Sat, 07 Nov 2026 08:37:16 +0000</pubDate>
      <link>https://dev.to/talhahmd/we-let-two-ais-negotiate-a-deal-and-then-stopped-them-from-leaking-the-secret-number-39ne</link>
      <guid>https://dev.to/talhahmd/we-let-two-ais-negotiate-a-deal-and-then-stopped-them-from-leaking-the-secret-number-39ne</guid>
      <description>&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%2Fl3rf48bgz6rxa3jsf4g0.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%2Fl3rf48bgz6rxa3jsf4g0.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;Clients hide their maximum budget. Agencies hide their lowest price. &lt;/p&gt;

&lt;p&gt;Because neither side wants to reveal their number first, business deals can take weeks of slow emails.&lt;/p&gt;

&lt;p&gt;Letting Artificial Intelligence (AI) do the bargaining sounds like an easy fix: let two AI bots chat and find a fair price in seconds. &lt;/p&gt;

&lt;p&gt;The problem? Large Language Models (LLMs) love to help. If someone asks nicely—or gives a clever prompt—the AI will accidentally leak the secret budget. A prompt is not a security lock.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Built: Backchannel
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Backchannel&lt;/strong&gt; is a deal system built on &lt;strong&gt;Switch&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Instead of putting both sides in one chat room where the AIs can trick each other, Backchannel gives each side its own private Discord room.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Agency Room (Party 1):&lt;/strong&gt; The agency person and their AI &lt;strong&gt;envoy&lt;/strong&gt; (a Claude Code agent).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Room (Party 2):&lt;/strong&gt; The client person and their AI &lt;strong&gt;envoy&lt;/strong&gt; (a Claude Code agent).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Deal Table (Public Room):&lt;/strong&gt; Where deal updates and final contracts appear.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The two AI envoys never share a room and cannot talk directly to each other.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Agency Room - Private]       [The Clerk - No AI]       [Client Room - Private]
Party 1 + agency-envoy   &amp;lt;-&amp;gt;     Python Rules     &amp;lt;-&amp;gt;    Party 2 + client-envoy
(Floor: $6,000)                                          (Ceiling: $9,000)
                                      |
                           [#deal-table - Public]
                          Status &amp;amp; Final Term Sheet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Between the rooms sits &lt;strong&gt;the Clerk&lt;/strong&gt;: a simple Python script with &lt;strong&gt;no AI&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The Clerk is the only member in both private rooms. It reads every offer, checks that it doesn't break any rules, and passes clean numbers across. &lt;/p&gt;

&lt;p&gt;A neutral &lt;strong&gt;mediator&lt;/strong&gt; runs the Switch server and the Clerk. Just like an escrow agent holding money safely during a house sale, the mediator makes sure neither side can cheat or spy on the other.&lt;/p&gt;




&lt;h2&gt;
  
  
  How We Set Up Switch
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Switch&lt;/strong&gt; connects AI coding agents directly to everyday chat apps like Discord. &lt;/p&gt;

&lt;p&gt;Here is how we set it up step-by-step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Switch Console &amp;amp; Local Server:&lt;/strong&gt; Run the local server to manage agents and incoming messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect Discord:&lt;/strong&gt; Add your Discord bot token and server ID in the Switch Console. Switch creates a live bridge between Discord and the agents.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the Channels:&lt;/strong&gt; Make private rooms (&lt;code&gt;#agency-war-room&lt;/code&gt;, &lt;code&gt;#client-war-room&lt;/code&gt;) and one public room (&lt;code&gt;#deal-table&lt;/code&gt;). Add the Switch bot and human teammates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the Two Claude Code Envoys:&lt;/strong&gt; In Switch Console, set up &lt;code&gt;agency-envoy&lt;/code&gt; and &lt;code&gt;client-envoy&lt;/code&gt;. Point them to their folders (&lt;code&gt;envoys/agency&lt;/code&gt; and &lt;code&gt;envoys/client&lt;/code&gt;), paste their setup instructions, and set &lt;strong&gt;"Who can talk to it"&lt;/strong&gt; to &lt;strong&gt;Anyone&lt;/strong&gt;. Then run &lt;code&gt;!invite-agent @agency-envoy&lt;/code&gt; and &lt;code&gt;!invite-agent @client-envoy&lt;/code&gt; in Discord.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect the Clerk (Hand-written Python Agent):&lt;/strong&gt; The Clerk registers using &lt;code&gt;POST /agents&lt;/code&gt;, listens to incoming messages over an event stream, and checks room lists with &lt;code&gt;list_rooms&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Two Quick Gotchas:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Permission Trap:&lt;/strong&gt; If you leave an agent set to "Owner Only" in Console, it will ignore other team members. Make sure it is set to &lt;strong&gt;Anyone&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Room List Bug:&lt;/strong&gt; Calling &lt;code&gt;list_rooms&lt;/code&gt; in the Switch API needs an active connection first. The Clerk must connect to the event stream before asking for the room list.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What the Clerk Does
&lt;/h2&gt;

&lt;p&gt;The Clerk keeps humans in full control using five simple commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SEAL&lt;/code&gt;: Each person secretly locks in their private limit (&lt;code&gt;SEAL 6000&lt;/code&gt; for the agency; &lt;code&gt;SEAL 9000&lt;/code&gt; for the client). The Clerk keeps these numbers in temporary memory only. They are never saved to a file, logged, or shown to anyone.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;OFFER&lt;/code&gt;: An AI envoy suggests a price (e.g., &lt;code&gt;OFFER 8500&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;APPROVE&lt;/code&gt; / &lt;code&gt;REJECT&lt;/code&gt;: If an envoy makes an offer that crosses its human's limit, the Clerk stops it: &lt;code&gt;NEEDS A PERSON. Held.&lt;/code&gt; The deal pauses until the person types &lt;code&gt;APPROVE&lt;/code&gt; or &lt;code&gt;REJECT&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SIGN&lt;/code&gt;: When both AI envoys agree on the exact same price, the Clerk asks both humans to confirm. When each person types &lt;code&gt;SIGN&lt;/code&gt;, the Clerk posts the official &lt;strong&gt;term sheet&lt;/strong&gt; to &lt;code&gt;#deal-table&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Golden Rule
&lt;/h3&gt;

&lt;p&gt;The only number allowed in an offer is the offer itself.&lt;/p&gt;

&lt;p&gt;By default, Backchannel runs in &lt;strong&gt;amounts-only mode&lt;/strong&gt;. Only the bare dollar number crosses between rooms. All sentences stay inside their own room. &lt;/p&gt;

&lt;p&gt;If sentences are turned on (&lt;code&gt;CLERK_NOTES=on&lt;/code&gt;), the Clerk scans every single word to stop leaks.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Leak Experiment: Guard On vs. Guard Off
&lt;/h2&gt;

&lt;p&gt;In our real tests, the agency set its lowest price to $6,000, and the client set its budget ceiling to $9,000. &lt;/p&gt;

&lt;p&gt;We then told the agency envoy to hint at its secret price:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test Mode&lt;/th&gt;
&lt;th&gt;What the AI Sent&lt;/th&gt;
&lt;th&gt;What Actually Crossed the Room&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amounts Only (Default)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;OFFER 8800 Honestly, we can't go under 6k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Only &lt;code&gt;8800&lt;/code&gt; crossed. The sentence stayed blocked.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sentences ON, Guard OFF&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;OFFER 8800 Honestly, we can't go under 6k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;LEAKED:&lt;/strong&gt; The whole sentence crossed. The client saw the secret floor.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sentences ON, Guard ON&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;OFFER 8800 Honestly, we can't go under 6k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;BLOCKED:&lt;/strong&gt; The Clerk caught extra numbers, number words (&lt;code&gt;k&lt;/code&gt;), and limit words (&lt;code&gt;under&lt;/code&gt;). Zero text crossed.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When the guard was turned on, the Clerk blocked the leak instantly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;BLOCKED (a second number; spells out a number: k; talks about a limit: under). Nothing crossed.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The envoy had to rewrite its offer cleanly without any secret numbers:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;OFFER 8800 Full scope with launch support included.&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Clerk checked that no limit words were present and let the message cross cleanly.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. A prompt is not a lock
&lt;/h3&gt;

&lt;p&gt;You cannot just tell an AI &lt;em&gt;"never tell anyone your budget"&lt;/em&gt;. If a user asks the right questions, the AI will eventually give it away.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Separate intelligence from authority
&lt;/h3&gt;

&lt;p&gt;Let AI handle what it does best: talking, proposing ideas, and negotiating. Let simple, non-AI code enforce hard rules, limits, and contracts. We did not try to police two AIs with a third AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Mediators must be neutral
&lt;/h3&gt;

&lt;p&gt;Whoever runs the server can read the chat history. For two companies to trust this setup, a neutral middleman (like an escrow service) has to host the system.&lt;/p&gt;




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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Knowledge Envoys:&lt;/strong&gt; Updating the envoy instructions so the AI is never even told the secret limit. Since the Clerk already stops bad offers, the AI does not even need to know the number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Running Locally:&lt;/strong&gt; Letting each side run its own AI envoy on its own computer, connecting to the neutral Clerk over the internet.&lt;/li&gt;
&lt;/ul&gt;




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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repo:&lt;/strong&gt; &lt;a href="https://github.com/Saad-2006/backchannel" rel="noopener noreferrer"&gt;github.com/Saad-2006/backchannel&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo Video:&lt;/strong&gt; &lt;a href="https://youtu.be/8SV46XGqTIU" rel="noopener noreferrer"&gt;Watch the submission video&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;What do you think?&lt;/strong&gt; Would you let an AI bot negotiate a price for you if simple code made sure it never went over your budget? Let us know in the comments!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>discord</category>
      <category>fliptheswitchhackathon</category>
    </item>
  </channel>
</rss>
