=== Bridle ===
Contributors: plugpress
Tags: support, ai, email, inbox, customer support
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The AI support agent inside WordPress. Mail arrives sorted and every reply is drafted from your own docs, pages and past answers.

== Description ==

Bridle puts your support mailbox inside wp-admin. Forward `support@` to the address Bridle gives you and each customer email becomes a conversation, already sorted and usually with a reply drafted. You send the draft, or let the agent send the ones it is sure of. Your conversations stay in your own database.

**What it does**

* **Sorts the mail.** People land in the Inbox. Receipts, newsletters and pitches go to Updates, a feed you read in place. Scams go to Spam.
* **Drafts from what you already know.** Each reply is written from your Agent instructions, snippets, Bridle Docs docs, your pages and posts, WooCommerce products and your past replies, with names, emails and order numbers removed. Each source can be switched off. Every fact and link in a draft is checked against those sources, and the agent does not write from outside knowledge.
* **Draft or Auto, per inbox.** In Draft a person sends every reply. In Auto the agent sends only the replies it is sure of, after a 15-minute hold you can stop. It answers a conversation at most twice and sends at most 30 an hour per inbox. Refunds, billing, legal, security, cancellations and upset customers always wait for a person.
* **Bring your own agent.** ChatGPT, Claude, Codex or any agent that speaks MCP can read the inbox, search your knowledge, write drafts and add notes through [Saddle](https://saddle.to) or the WordPress MCP Adapter. Sending stays off until you allow it for that agent.
* **A chat bubble that answers.** Switch on Bridle Chat and visitors get answers from the same knowledge, checked the same way. Anything it isn't sure of comes to your Inbox, and you reply by email.
* **Your AI key, or none.** Connect Anthropic, OpenAI or Google in WordPress and use them as much as you like. Without a key, Bridle AI answers instead: 100 answers a month free, then packs.
* **Starts with a chat.** Bridle asks for your business name and support address, finds out where that mail is hosted and shows the forwarding steps for that provider.
* **Works for a team.** Invite teammates, assign conversations and leave private notes. Several addresses get an inbox each.
* **Keeps your data.** Conversations, contacts and settings live in `wp_bridle_*` tables on your site.

**Bridle Pro**

Bridle is complete without it. [Bridle Pro](https://bridle.to/pro/) adds chat on your other sites, taking over a chat live, order lookups and a list of what the agent couldn't answer.

Bridle is built by the team behind [Saddle](https://saddle.to).

== External services ==

Bridle connects to the services below. Nothing is sent until you create an inbox or an email arrives.

**1. The Bridle email relay (PlugPress)**

Inbound mail reaches your site through a Cloudflare Email Worker run by PlugPress at `mail.bridle.to`. Forwarding addresses are on `bridle.to`.

* When Bridle contacts it: when you create an inbox or switch one back on, when your site URL changes, once a day to re-sync, when you press "Fix forwarding", when Settings or Home show your inbox count or waiting mail, and when you switch off or remove an inbox, erase all data or delete the plugin (to deregister its inboxes; deleting the plugin keeps all your data).
* What is sent: your site URL, your webhook URL, the address of your site's verify route, the inbox code and a secret your site generated for that inbox. The secret lets your site check that each delivery came from the relay. To show waiting mail, your site sends one inbox's code and secret. With Bridle Pro active, also its licence key, to raise the inbox limit.
* What the relay sends your site: before it adds a new inbox (or moves one to a new site address), the relay calls your site's verify route with a random challenge, and your site answers with a code made from that inbox's secret. This proves the site asking is the one the mail will go to; no secret is shown. The route answers only while your site is adding that inbox. A site on your own computer (localhost, .local, .test) can't be reached, so it can't add inboxes.
* Limits: each site can have 3 inboxes on the relay for free. A Bridle Pro licence raises it (10, 25 or unlimited, by plan). Inboxes you already have keep working. Settings → Inboxes shows how many you use. The relay also limits how often one server can call it; if it is busy, Bridle tries again later.
* What the relay does with mail: it parses each message sent to a forwarding address and posts it to your webhook. It stores the inbox registration. If your site cannot be reached, the relay keeps that message and tries again for 48 hours, then deletes it (a kept message is removed after 3 days at most, and a count of deleted ones is kept for 30 days). It keeps at most 200 messages or 200 MB per site; past that, new mail your site can't take is refused and its sender gets a bounce. If every delivery to your site has failed for 14 days, the relay tries each new message once and refuses it if that fails, keeping nothing. Home shows how many emails are waiting. Mail is never sent to anyone else. Mail to a forwarding address no site uses (for example a removed inbox) is refused, and its sender gets a bounce. The relay keeps short technical logs for up to 7 days: what happened, for which inbox code or site, and when. They hold no sender addresses, no subjects and no mail content.
* [Terms of Service](https://bridle.to/terms/) and [Privacy Policy](https://bridle.to/privacy/).

**2. The AI provider you connect**

Drafts are written by the provider you connect in WordPress's AI settings (the WordPress AI Client), with your own key. Without one, Bridle AI (below) can write them instead, if you switch it on.

* When: each time a draft is written for a new customer message, when you ask for a redraft, each time a visitor asks something in Bridle Chat (if you switch it on), when you rewrite or translate a reply, and when **Settings → Replies** checks that a provider is connected (WordPress may ask the provider for its list of models).
* What is sent: the conversation text (the last 12 messages, or the chat so far), the customer's contact details Bridle holds, your Agent instructions and snippets, and the passages from your docs, pages, products and redacted past replies that match the question. A rewrite sends only the reply you are writing, plus the customer's newest message when you translate into their language.
* The provider's own terms and privacy policy apply. They depend on which provider you choose, for example Anthropic, OpenAI or Google.

**3. Bridle AI (optional)**

If you don't connect your own AI key, you can switch on Bridle AI under **Settings → Replies**: a service run by PlugPress that writes the same drafts and chat answers with no key. 100 answers a month are free; more are sold in packs. Your own key, when connected, is always used first. Off unless you switch it on.

* Where: `ai.bridle.to`.
* When: once when you switch it on (to sign up your site: the service sends your site a challenge and your site answers it, so no secret is shown), each time a draft, a chat answer or a rewrite is written while it is on, when Settings shows how many answers are left, and when you buy a pack.
* What is sent: at sign-up, your site URL and the email you enter for receipts. For each answer, the same text an AI provider would get (the conversation or chat so far, the contact details Bridle holds, your Agent instructions and snippets, and the matching passages from your knowledge).
* Where it goes: the service sends that text to Anthropic's Claude (Haiku) through Cloudflare AI Gateway, with logging off, and does not store it. Cloudflare and Anthropic process it under their own terms: [Cloudflare Privacy Policy](https://www.cloudflare.com/privacypolicy/), [Anthropic Privacy Policy](https://www.anthropic.com/legal/privacy).
* What the service keeps: your site URL, your email, a one-way hash of your server's IP address (to limit sign-ups) and a count of answers used.
* Bridle Chat with Bridle AI: the chat bubble sends each visitor message to `ai.bridle.to`, which passes it to your site with the visitor's IP address and the page's web address. Your site checks it and hands back the prompt, and the service asks the AI and passes the answer back to your site, so your site never waits on the AI. The service keeps none of it. It also keeps the address of your site's chat endpoint and a secret it signs those requests with.
* Packs are paid through Polar on a checkout page that opens in your browser.
* With Bridle Pro, its licence key, once, so the answers that come with the licence are added to your site. The service checks the key with Polar and keeps only a hash of it.
* [Terms of Service](https://bridle.to/terms/) and [Privacy Policy](https://bridle.to/privacy/).

**4. The decision model you connect (optional)**

If you add a key under **Settings → Sorting**, Bridle asks a decision model to read each inbound email, with your own account. Without a key nothing is sent and mail is sorted by its headers.

* When: once for every email that arrives, and when you press "Save and test" (a made-up sample email).
* What is sent: the sender's name and address, the Reply-To and mailing-list headers, the subject and the newest message (quoted history removed, at most 6,000 characters).
* TypeSafe (Jev) at `api.typesafe.ai`: [Master Customer Agreement](https://typesafe.ai/legal/mca), [Privacy Policy](https://typesafe.ai/legal/privacy-policy), [Data Processing Agreement](https://typesafe.ai/legal/data-processing).
* Cloudflare Workers AI (Jev, Clef or Clef-flash) at `api.cloudflare.com`: [Terms](https://www.cloudflare.com/website-terms/), [Privacy Policy](https://www.cloudflare.com/privacypolicy/).

**5. Cloudflare Turnstile (optional)**

Only if you add Turnstile keys under **Settings → Chat**. Without keys nothing is loaded or sent.

* When: a visitor's browser loads Turnstile from `challenges.cloudflare.com` when they open the chat; your site asks Cloudflare to check the result when that visitor starts a chat.
* What is sent: Turnstile collects signals from the visitor's browser to tell people from bots. Your site sends Cloudflare the token from the browser and your secret key.
* [Turnstile Privacy Addendum](https://www.cloudflare.com/turnstile-privacy-policy/), [Terms](https://www.cloudflare.com/website-terms/).

**6. Gravatar**

The conversation list and letters show customer pictures through WordPress's own avatar function. Your browser asks Gravatar (run by Automattic) for the picture, which sends a hash of the customer's email address. Customers without a Gravatar get an illustrated face drawn by Bridle. [Terms of Service](https://wordpress.com/tos/) and [Privacy Policy](https://automattic.com/privacy/).

**Not an external service: mail host lookup**

When you enter your support address, Bridle works out who hosts it so it can show the right forwarding steps. For common free-mail domains it recognises the name. For a company domain it runs a DNS MX lookup from your own server, using PHP's `getmxrr()` and your server's resolver. No HTTP request is made and no data is sent to PlugPress.

Replies you send go through `wp_mail()` and whichever SMTP plugin or mail service your site already uses.

== Installation ==

1. In wp-admin go to **Plugins → Add New**, search for "Bridle", then install and activate it.
2. Open **Bridle** and answer the setup chat: your business name and the support address you use today.
3. Forward that address to the Bridle address shown in the chat. Bridle gives the steps for your mail host, and setup finishes itself when the first email arrives.
4. Connect an AI provider in WordPress's AI settings.
5. Under **Settings → Replies**, choose Draft for the inbox.

An SMTP plugin is optional but helps your replies reach inboxes reliably.

== Frequently Asked Questions ==

= Do I need a mail server? =

No. Inbound mail comes through a forwarding rule from your existing mailbox to the Bridle address. Outbound replies go through `wp_mail()`, or your SMTP plugin if you have one.

= Does it work with Gmail, Outlook or Zoho? =

Anything that can forward mail works. Bridle never logs in to your provider; it receives what you forward. The setup chat shows the forwarding steps for your host and surfaces Gmail's confirmation code and link for you.

= Do I need WordPress 7.0? =

Yes. Bridle uses the AI Client and the Abilities API that arrived in 7.0. The inbox works without an AI provider connected; the agent stays off until you connect one.

= Which AI provider does it use? =

Whichever one you connect in WordPress's AI settings, with your own key, free and without limits. If you'd rather not get a key, switch on Bridle AI under Settings → Replies: 100 answers a month free, then packs. See External services above for exactly what is sent.

= What does the agent read? =

Your Agent instructions and snippets, plus, each switchable under **Settings → Knowledge**: published Bridle Docs docs, your pages and posts, WooCommerce products and past replies. Past replies come only from your team's own answers in resolved conversations in the same inbox, with names, emails, phone numbers, order numbers, keys and links to other sites removed.

= Can the agent send replies by itself? =

Yes, in an inbox set to Auto (off by default). It sends only replies whose every quote and link checked out against your knowledge, and never about refunds, billing, legal, security, cancellations or upset customers. Each reply waits 15 minutes so you can read it, send it now or stop it. It answers a conversation at most twice and sends at most 30 an hour per inbox. A reply it sends carries a short line saying an AI wrote it. If you sometimes answer from your mail app, stay on Draft, because Bridle cannot see those replies.

= Can I use ChatGPT, Claude or Codex instead? =

Yes. Install Saddle or the WordPress MCP Adapter, create an application password named after the agent, and connect your AI app to your site. With the MCP Adapter, the address is `https://your-site/wp-json/mcp/mcp-adapter-default-server`, and Bridle's tools appear through its discover and execute tools. In Saddle, give the app **Edit content** under **AI apps** (with Saddle 1.5.1 or older, also switch Bridle on under **Services**). The agent brings its own model; Bridle gives it the inbox and your knowledge through WordPress Abilities. Its drafts appear in Bridle with its name on them and are checked the same way. It can send only once you allow it for that teammate under **Settings → AI apps**, and each send waits two minutes so you can stop it.

= Can I run support@, info@ and sales@ separately? =

Yes. Under **Settings → Inbox → Connect an inbox**, create one inbox per address, each with its own forwarding address, sender name and agent mode. The inbox switcher in the top bar shows one or all.

= Where is customer data stored? =

In your own database, in tables prefixed `wp_bridle_`. Deleting the plugin keeps them. **Settings → Data → Erase all data** erases everything.

= What happens to my mail if I stop using Bridle? =

Remove the forwarding rule at your mail host first. Deactivating or deleting Bridle doesn't change your mailbox, so `support@` keeps forwarding to the Bridle address. While Bridle is switched off, the relay keeps that mail for up to 48 hours and then deletes it. After you delete the plugin, the relay refuses it and the sender gets a bounce.

= Are there keyboard shortcuts? =

Yes. They are not printed on the buttons, so the screen stays clean.

* `1` to `5`: Inbox, Updates, Resolved, Spam, Trash
* `j` / `k`: move down and up a list. `↵` opens, `x` selects; shift-click a checkbox to select a range
* `r`: reply. `n`: note. `e`: resolve. `a`: accept the agent's draft
* `⌘↵` (`Ctrl`+`Enter` on Windows): send. `⌘⇧↵`: send and resolve
* `/`: search. `Esc`: back
* `⌘K` (`Ctrl`+`K` on Windows), anywhere in WordPress: its command palette, with every Bridle box and Settings page and a search of your conversations

= How do I export or erase a person's data? =

The standard WordPress privacy tools (Tools → Export Personal Data and Erase Personal Data) include Bridle's conversations, messages and attachments tied to an email address.

= Where is the source code? =

The admin app is built from the `src/` folder shipped in this plugin, with `@wordpress/scripts`. To rebuild it, run `npm install && npm run build` in the plugin folder. The compiled files are in `build/`. The PHP is unminified.

= What third-party code does it include? =

All GPL-compatible: the Mona Sans and Geist Mono fonts (SIL Open Font License 1.1, licence texts in `src/app/styles/fonts/`), Lucide icons (ISC), Radix UI, shadcn/ui, TipTap, Tailwind CSS and class-variance-authority (MIT).

== Screenshots ==

1. The Inbox, with every box in the dock below.
2. The agent's draft, with the help doc and past reply it was checked against.
3. The setup chat: forwarding connected, then how the agent should sound.
4. Settings → Replies: Off, Draft or Auto for each inbox.
5. Updates: receipts and newsletters as a feed you read in place, with Move to inbox on each card.

== Changelog ==

= 1.0.0 =
First release.

* Sorts mail into Inbox, Updates and Spam.
* Drafts replies from your instructions, docs, pages, products and past answers.
* Draft or Auto per inbox, with guardrails and a 15-minute hold.
* Works with ChatGPT, Claude, Codex or any MCP agent through WordPress Abilities.
* Setup is a chat that walks through forwarding for your mail host.
* Newsletters, receipts and reports look the way their sender designed them.
* Resolve or trash a conversation straight from the list.
* Unread conversations are marked for each teammate.
* Up to 3 inboxes per site on the Bridle mail service, free. Settings → Inboxes shows how many you use.
* Optional sorting with a decision model on your own key: Jev through TypeSafe, or Clef (the default, on Cloudflare's free daily allowance) and Jev through Cloudflare.
* With Bridle Docs installed, its Docs sit in Bridle's menu, between Inbox and Settings, in the same look.
* Home, the first screen: one next step, this week's numbers, what needs you and whether each part of the agent is working.
* Bridle Chat: switch on a chat bubble for your site. It answers from the same knowledge as your email drafts, checks every fact, says it is an AI, and hands refunds, billing, upset visitors and anything it isn't sure of to a person, who replies by email. Every chat is kept in Bridle.
* The chat has an assistant with a name and a face: Blake by default, with six friendly faces to pick from or your own picture, always marked as an AI assistant. After 30 seconds on a page it can say hello next to the chat button with a soft chime, once a day at most. Change the timing or turn the sound off under Settings → Chat.
* The chat only shows an answer that cites a doc, page or product (a hello or thanks needs none). It never reads your private notes, contact details or other customers' past answers.
* An email left in the chat stays "not confirmed" until the visitor taps the link in their confirmation email. Until then the AI doesn't see that contact's details.
* Chat limits: one hourly AI budget for everything a chat can cost you, a cap on drafts per chat and on chat emails, Turnstile when someone asks for a person, and visitors counted correctly behind Cloudflare and on IPv6.
* A chat answer that takes too long hands the visitor to a person instead of hanging, and a retry never answers (or charges) twice.
* Chat answers don't count toward Auto's hourly limits.
* After a visitor leaves their email, the chat keeps answering their other questions until a person replies.
* Bots can't run up your AI bill: a new chat needs an invisible check in the visitor's browser (no puzzle to solve, nothing sent to anyone else), each visitor and the whole site have hourly and daily AI limits, and a message with nothing in it gets a quick reply instead of an AI answer.
* Chat answers at once, with no AI cost, when it already knows the answer: a quick reply to hello or thanks, the same checked answer to a question asked before (fresh again whenever your docs or pages change), and straight to a person for refunds, billing or questions nothing on your site covers.
* Chats that never reached a person are deleted after 30 days. Privacy export and erase also find chats where someone typed their email.
* No AI key? Switch on Bridle AI under Settings → Replies: 100 answers a month free, then packs from $10. Only answers that pass Bridle's checks count, and your own key is always used first.
* Bridle AI trims a long conversation to fit, gives back an answer that takes too long, and signs your site up again if it was signed out.
* Settings → Bridle Pro shows what Pro adds, one short line each. Nothing else in Bridle asks you to buy it.
* When the chat hands a visitor to a person, it says when you usually reply (from your real first-reply time), and sends them a copy of the chat. Your reply shows in their chat bubble, and by email if they haven't read it there within a few minutes. You get an email when a chat needs you.
* Settings is one panel with a page for each part: Inboxes, Replies, Knowledge, Sorting, AI apps, Team, Emails and Data. Help sits behind a ? beside each label.
* While the agent drafts, the Inbox groups mail by what you do next: Ready to send, Sending soon and Needs you, each row showing the draft's first line or why a person should look.
* A calmer top bar: the mark, search, Settings and one Help menu with the keyboard shortcuts. Which inbox a list shows sits beside its title, and every box has the same width and title.
* Select many conversations the way you do in Gmail: hover an avatar for its checkbox, shift-click for a range, select all, read or unread, or every conversation in the view. Mark them read or unread, resolve, spam or trash them at once.
* Trash empties itself: conversations there are deleted for good after 30 days. Delete forever is one click away in Trash.
* One Bridle icon everywhere: the white mark on an orange circle, in the app and the plugin directory.
* A calmer look that matches bridle.to: black text, links and buttons, grey faces, and orange only on the icon.
* The chat knows where the visitor is: the page they're on and a short overview of your site go with every question, so "how much is this?" and "what do you sell?" get real answers.
* When the chat needs one more detail, it asks a short question instead of handing off. When it still isn't sure, it offers a person with a button and the chat goes on. No email form unless the visitor asks for a person.
* The chat answers how to cancel, billing and privacy questions when your docs cover them, and leaves you a note. Refunds, disputes, legal and security still go to a person.
* Each site the chat runs on gets its own hourly and daily AI limits.
* With Bridle AI on, chat answers are made at ai.bridle.to while your site only checks and stores them, so many visitors can chat at once on any hosting. If the service can't be reached, the chat answers from your site as before.
* Works with the WordPress MCP Adapter plugin. When an AI agent's reply can't be sent, Bridle says why in words, the same ones the app shows.
* A chat shows the page the visitor started it on. The chat answers only on your own site.
* "Powered by Bridle" under the chat is off unless you turn it on (Settings → Chat), like the line under emails.
* A staging copy of your site can no longer take your live site's mail: Bridle only points a forwarding address at a new site address when the site's own address changes or you press Fix forwarding, and a copy leaves the live site's addresses alone when you switch an inbox off or erase its data. Home tells you when an address points elsewhere.
* An inbox you switch off and on again gets its mail again.
* Backslashes in emails, notes and settings are kept as written.
* Bridle in WordPress's command palette (⌘K) on every admin screen: go to any box or Settings page, connect an inbox, or type to find a conversation. The Help menu opens it too, and shows Bridle's version.
* Pick the model for each task: one for email drafts and one for chat answers, from the models your AI connection offers (Settings → Replies).
* A cleaner chat: pick the button's icon, corner, size and a light or dark theme. The window shows your site icon, keeps its actions in one menu and lists the sources it used.
* Settings pages link to short guides on bridle.to for the job at hand, such as putting the chat on your other sites. No admin notices, ever.
* Rewrite a reply or the agent's draft: shorter, friendlier, more formal, spelling fixed, or translated into the customer's language or any other. It keeps every link and number, refuses a rewrite that changes one, and Undo puts your words back.
* Drafts keep coming when several emails arrive at once on sites with an older Action Scheduler (WooCommerce), and a draft that failed because the AI connection was briefly unavailable is tried again.
* Pages with the chat bubble no longer ask your AI provider on every visit: Bridle remembers the connection for a few minutes and asks again when you change it.
* Drafts read answers that a model wraps in a code block. Long Agent instructions and long saved-reply lists are trimmed to what fits, best matches first, so every draft stays fast and cheap.
* A reply to a chat is no longer shown as failed while it waits to be read in the bubble, and a private note is never emailed. Two replies sent at once can no longer share an email ID.
* A message that arrives while the agent is writing marks the draft as out of date.
* Pictures in an email that load from the sender's server stay hidden until you click Show images, so the sender can't tell you opened it. Pictures sent inside the email always show.
