=== AI With Me ===
Contributors: sethshoultes
Tags: ai, blogging, drafts, mcp, assistant
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.3.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Tell your AI app your idea for a post. It leaves a draft on your site, and you review it and publish it yourself.

== Description ==

You have an idea for a post. Maybe you're on your phone, maybe you're walking the dog. You tell your AI app, and a few seconds later there's a draft waiting on your site.

AI With Me connects the AI app you already use to your WordPress site. You sign in with your normal WordPress login and press Allow once. After that, you can say things like "turn this idea into a post" or "blog what I did today", and the app writes a draft, adds a picture and tags it.

Then you open the link it gives you, read the draft, change what you like, and publish it in WordPress when you're happy.

**What your AI app can do**

* Read your site's name, address, categories and tags.
* Read your recent posts, and read one post in full.
* Write a new post as a draft.
* Change a draft or a pending post that you could edit yourself.
* Add an image to your Media Library, from a web address or sent straight from the app.
* Set the categories and tags on a draft. It can create a new one only when you are allowed to manage categories.

**Drafts by default, publishing when you turn it on**

Your AI app writes drafts. It can publish, schedule or unpublish your own posts only after you switch publishing on for that app in Settings > AI connections, where every publish is listed with an undo. An administrator can switch publishing off for the whole site. It never deletes anything, and it cannot change a post that is already live. Pages, comments, users, plugins and settings are out of reach.

**Who it works for**

Anyone who can edit posts on the site can connect their own AI app. The app acts as that person, never as someone else, and can only do what that person is allowed to do. Administrators can see and disconnect every connection. Everyone else sees only their own.

**Made for**

AI apps that let you add your own connector. Your site needs a public https address, because these apps reach your site from the internet.

== Installation ==

1. Install and activate the MCP Adapter plugin, which AI With Me needs. Then install and activate AI With Me. WordPress won't activate AI With Me until the adapter is active.
2. Go to **Settings > AI connections** and copy the address on the "How to connect" line.
3. In your AI app, add a custom connector and paste that address.
4. The app sends you to your own site. Sign in if you aren't already, check the app's name and where it sends you back, and press **Allow**. Only allow it if you just started connecting an AI app yourself.
5. Ask your app for a draft. It gives you a link. Open it, review, and publish in WordPress.

== Frequently Asked Questions ==

= Will it ever publish something without me? =

Not unless you turn it on. By default everything it writes is a draft that only you and your team can see until a person publishes it. If you switch publishing on for an app in Settings > AI connections, that app can publish and schedule your own posts, and each one is listed there with an undo. The undo cannot recall what publishing already sent out, such as feeds and emails.

= Can another plugin add more? =

Yes, but only if you let it. A plugin that adds tools starts switched off, and an administrator turns it on under **Settings > AI connections**. The sign-in page names the plugin that supplies each extra tool, and says in plain words what it can do, including when a tool can delete. If a plugin later swaps its provider, or a tool becomes able to delete, an app you already connected stops getting that tool. Nothing asks you about it. To use the tool again, connect the app again and read the sign-in page.

= Can it change a post that is already live? =

No. It can only change drafts and pending posts. Ask it to change a live post and it tells you to edit that one in WordPress.

= Is an image it adds private until I publish? =

No. An image goes into your Media Library and has a public address straight away, even before any post that uses it goes live. Anyone who knows that address can open it. Don't ask it to add an image you aren't ready to share. To take one back, delete it from the Media Library.

= How do I disconnect an app? =

Go to **Settings > AI connections** and press **Disconnect** next to it. Its access stops at once. If an app was connected more than once, disconnect each entry.

= What if I delete a user or take away their editing rights? =

Their connections stop working straight away.

= Does it work on a multisite network? =

Not in this version. AI With Me will not activate on a multisite install and tells you so.

= Does it work on a site that is only on my own computer? =

No. Your AI app reaches your site from the internet, so the site needs a public https address.

= The connection fails and my host strips a header. What now? =

Go to **Tools > Site Health**. AI With Me adds two checks there. They tell you if your host drops the sign-in header, and if the sign-in documents can't be found, and what to change.

= What does it store, and what happens when I delete it? =

It keeps a list of the apps you connected, the sign-ins you allowed, and short-lived sign-in records, and, by default, the records of add-ons that store something, such as Memory's notes, all in tables of its own on your site. Deleting the plugin removes those tables and its settings. Your posts and images stay. If you choose a storage add-on for a feature, that add-on keeps its records where it says, and deleting AI With Me does not remove them.

== External services ==

AI With Me contacts other web addresses only in the cases below. It never sends your posts, your visitors' details or anything from your database. Each request names the plugin and its version, and never your site's address.

**An app's connection details.** When an app identifies itself with a web address instead of registering, the plugin fetches that one address, after you have signed in on your site, to read the app's name and where it may send you back. Like any web request, this shows your server's IP address. Nothing else about your site is sent. The answer is limited to 5 KB. The plugin makes at most 10 of these requests per signed-in person every 10 minutes, and 100 an hour for the whole site, and keeps a good answer for an hour.

**An image's address.** When your AI app asks it to add an image from a web address, the plugin downloads that one address from your server. It accepts only JPEG, PNG, GIF and WebP images, up to 10 MB, and gives up after 10 seconds. Like any web request, this shows your server's IP address. Nothing else about your site is sent.

Those addresses are chosen by your AI app and not by us. The plugin needs no account.

**Update checks.** About twice a day, the plugin asks ai-with-me.com for its newest version, and it downloads the new version from there when you update. An add-on we publish asks for its own updates the same way. Like any web request, this shows your server's IP address. Nothing else is sent.

== For developers ==

= Add a feature =

A plugin adds tools to AI With Me as a feature. It registers the feature on the `aiwm_register_features` action, which runs once, before the Abilities API sets up its categories. A feature has an id, the contract version it was written for, a label, one sentence that the sign-in page shows, the path to its tools file, and a handler and a permission check for each tool.

The full guide, with a complete example plugin, is [Build a feature](https://github.com/sethshoultes/ai-with-me/blob/main/docs/build-a-feature.md).

* AI With Me reads the tools file and registers the abilities itself, under the category `ai-with-me-<feature id>`, so a tool's definition cannot drift from its file. An ability registered any other way is never offered to an AI app.
* A feature from another plugin starts switched off. Only features that ship with AI With Me start on.
* A tool may be destructive if its tools file says so. AI With Me writes the sign-in wording for it from that mark, never from the add-on's own sentence.
* The sign-in page names the plugin that supplies each add-on feature. A new feature or tool needs people to connect again, and so does a change of provider or a tool becoming destructive.
* Tool names use your own namespace, such as `acme/notes`. The `ai-with-me/` prefix and the ids `read`, `drafts`, `images` and `terms` are reserved. If two plugins claim the same id or tool name, the first one wins and the site shows a notice naming both.
* Registering after the action has run is refused, and so is a feature written for a newer contract than the installed AI With Me knows.

= Behind a proxy or CDN =

Sign-in limits count requests per visitor address. Behind a reverse proxy or CDN, WordPress sees the proxy's address for everyone, so one caller can use up a limit for all visitors. Add a small filter that returns the real visitor address from the header your proxy sets. Use that header only when the request really came from your own proxy, because anyone can send a header of their own:

`add_filter( 'aiwm_client_ip', function ( $ip ) { $proxies = array( '203.0.113.10' ); return in_array( $ip, $proxies, true ) && isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $ip; } );`

Replace the example address with the addresses your proxy connects from. Tools > Site Health > Info > AI With Me shows which address is in use.

== Changelog ==

= 0.3.1 =
* Switching publishing off for the whole site now turns it off for every app, however the setting is changed, including from the command line. Switching it back on starts every app off again.
* Publish records are tidied daily: undone ones go, and the rest after 30 days. An app can unpublish only what it published in the last 30 days.

= 0.3.0 =
* Your AI app can now publish, schedule and unpublish your own posts, if you turn that on for it. Publishing is off for every app until you switch it on in Settings > AI connections.
* WordPress still decides: an app can publish only if the person it signs in as may publish posts, so a contributor's app never can.
* Every publish is listed on Settings > AI connections with an undo. An administrator can switch publishing off for the whole site.

= 0.2.2 =
* A stored note's id must be exactly a UUID. An id with a line break after it is now refused, as any other bad id is.

= 0.2.1 =
* Claude Code, Codex and other apps that run on your own computer can now connect. Before, your site refused them when they signed in.

= 0.2.0 =
* Changing or resetting your password now disconnects your AI apps; each one asks you to connect again.
* When your AI app is refused a change to a published post, it now gets the post's edit link to pass on to you.
* A category or tag list the plugin could not read is now left out, instead of answered as empty.
* Adds the storage that add-ons such as Memory use, and lets an administrator choose where each add-on keeps it.
* Add-ons we publish can now update through the same signed update check as AI With Me.

= 0.1.1 =
* Requests to other web addresses name the plugin and its version, and never your site's address.
* Safer disconnects: if a database problem stops your site from fully disconnecting an app, you now get an error instead of a success message.
* Safer sign-in: a database problem during sign-in now shows as an error, and is never mistaken for an expired or unknown code.
* Clean-ups for the WordPress.org plugin directory.

= 0.1.0 =
* First release. Connect an AI app to your site, and let it write drafts for you to review. It reads posts and site details, writes and edits drafts, adds images, and sets categories and tags. It cannot publish, schedule or delete.
