=== Reflexa Agent ===
Contributors: reflexatechnologies
Tags: ai, seo, llms.txt, robots.txt, structured data
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 0.15.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Three one-click fixes for AI answer engines, and the hands of the Reflexa agent: approve a change in your dashboard and the plugin applies it here.

== Description ==

Reflexa Agent connects this WordPress site to your Reflexa account. Reflexa checks the site from outside the way ChatGPT, Perplexity, Claude and Google do: can they reach it, read it without JavaScript, understand who the company is and quote the right page. The plugin is the agent's hands inside WordPress: it shows the result in wp-admin and applies the fixes that only something running inside WordPress can apply.

**What the plugin does**

* **Three switches, one click each**, applied from the Reflexa page in wp-admin or from your Reflexa dashboard:
  * Allow the AI answer engines' fetchers in robots.txt (training crawlers are left to your own policy).
  * Print an Organization block in the head of every page, so machines stop guessing which company this is.
  * Serve /llms.txt, a plain-text summary written from your own titles and descriptions.
* **Reports sitemap status** and respects the visibility settings of WordPress and SEO plugins.
* **Approved changes land as ordinary WordPress edits.** When you approve a change in the Reflexa dashboard (a title, a description, a passage on a page, a new page, a redirect, a stylesheet, a structured-data or tag snippet, a response header), the plugin applies it on its next check-in. Page edits are saved as revisions. Every change is marked and can be undone from the same place.
* **Counts AI visits.** PHP sees every request's user agent, so the plugin forwards the visits analytics never records: an AI engine fetching a page to answer someone, or crawling it to learn. Two kinds of request are forwarded as they happen — one whose user agent is a known AI crawler (its user agent, path and IP address), and one whose referrer is an AI answer engine (the referrer and the path only, no user agent and no IP address). No other request is forwarded on its own.
* **Counts what the site answers (the request log).** A page that fails or answers slowly is one a crawler leaves unread, so once the site is connected the plugin counts every request it answers: the path without its query string, the status, the response time and whether the caller was a robot. The counts are added up per page and sent with the 15-minute check-in; a failed request is listed with its minute, and a server error with the fatal error PHP reported. No IP address, user agent, query string, referrer or cookie is stored or sent. It has its own switch on the plugin's page. The full list is under *External service* below.
* **Reports to the dashboard every 15 minutes** which switches are on, which plugins and theme run here and which pages exist, so the dashboard can say which pages AI never touches.

**What the plugin never does**

* **It never inserts executable code.** A snippet it serves may carry only `<meta>` and `<link>` tags and structured data (`<script type="application/ld+json">` whose body must parse as JSON). The snippet is parsed before it is stored, and anything else — any other script, a style, an iframe, an image, an event handler, a `javascript:` address — is refused and reported back to the dashboard. Passages and new pages go through `wp_kses_post`, stylesheets through `wp_strip_all_tags`. Nothing fetched from Reflexa is ever executed.
* It never calls a language model. The diagnosis runs on Reflexa's side.
* It never changes the site without a click from an administrator, either on the plugin page or in the Reflexa dashboard.
* It never edits pages owned by a page builder it cannot read back safely, and never touches the pages you lock.
* It never writes to theme or plugin files, and has no editor, no file manager and no way to run code.
* It sets no cookies, builds no profile of anyone and never identifies a person. Of an ordinary visit only a count leaves the site: the page's path, its status and how long it took, added up with every other request for that page — never the visitor's IP address, browser, query string or cookies. The one request made by a person that is forwarded on its own is one that arrives from an AI answer, and of that only the referring engine and the path are sent.

**How this differs from an SEO plugin.** An SEO plugin gives you fields to fill in. This one is the site-side half of an agent: the checks are run from outside with the engines' own fetchers, the agent decides what to change and writes it, you approve the exact words in a dashboard, and the plugin applies and marks them so the dashboard can confirm the live site really has them — with one-click undo on each. It also counts the AI fetcher visits your analytics cannot see, because those fetchers run no JavaScript. No settings to tune, no score, no keyword fields.

**What needs an account.** The three switches work on their own, with no account and no connection. The check from outside, the findings, the AI visit counts and the changes the agent prepares are the Reflexa service, which needs an account on the Starter or Growth plan at [reflexaagent.com](https://reflexaagent.com/). The service is priced because every check and every prepared change is work done on Reflexa's servers.

== External service ==

This plugin is the client of the Reflexa service and sends data to **api.reflexatechnologies.com**, operated by Reflexa Technologies AB (Stockholm, Sweden). Nothing is sent until an administrator pastes the site token on the plugin's page.

What is sent, and when:

* **On every check-in** (every 15 minutes, once a day, and whenever an administrator opens the Reflexa page): the site URL, name and tagline, the site language, the WordPress and PHP versions, the active theme's name and version, the names and versions of installed plugins and whether they are active, whether permalinks, the sitemap and search-engine visibility are on, which Reflexa switches are on, and the paths of up to 100 published pages and posts. Site Studio receives the attachment ID, image URL, size and alt text of up to eight featured images selected on public, non-password-protected pages and posts. The service answers with the changes you approved in the dashboard and a short proof phrase the site serves so the token cannot be reused on another domain.
* **When a check is requested** from the plugin page: the site URL. Reflexa then fetches the site's public pages, as any crawler would.
* **When an AI crawler or fetcher visits** (a request whose user agent is a known AI crawler or fetcher): that request's user agent, referrer, IP address, path and the site's host name.
* **When a person arrives from an AI answer** (a request whose referrer is chatgpt.com, perplexity.ai, claude.ai, gemini.google.com, copilot.microsoft.com or you.com): the referrer, the path and the site's host name. No user agent, no IP address.
* **The request log** (with every 15-minute check-in, while the site is connected and the log is switched on): for each path and status, how many requests there were, how many of them came from robots, and the total and the longest response time; and for each request that ended in an error (status 400 and above), its path, status, response time and whether it came from a robot — for a server error also the first 200 characters of the fatal error PHP reported, with the file name and line. Paths are sent without their query strings. Between check-ins the lines wait in a protected folder under `wp-content/uploads/reflexa-agent/`; they are deleted once sent, when the log is switched off, and when the plugin is disconnected, deactivated or deleted.
* A request from a person with an ordinary browser and referrer is never sent on its own. It is only counted in the request log above, with nothing that identifies the visitor.
* **When reviewing pages**: check-ins include titles, URLs and revision fingerprints of supported public pages, plus the status and editor or authenticated preview links for drafts created through Reflexa. For published results, the public URL, title and a short excerpt let the dashboard verify what visitors can see.
* **When a change is applied**: whether it succeeded and a one-line detail, so the dashboard can show it.
* **When saving a Studio draft**: Reflexa sends this installation a short-lived signed command ID. The plugin fetches that approved draft and reports its WordPress status and editor link. Scheduled check-ins also deliver pending drafts if the site was offline.

Terms of service: https://www.reflexatechnologies.com/terms
Privacy policy: https://www.reflexatechnologies.com/privacy

== Installation ==

1. Install the plugin from the WordPress plugin directory, or upload the zip under Plugins → Add New → Upload Plugin, and activate it. The three switches are on the Reflexa page right away.
2. In your Reflexa dashboard (Starter or Growth plan) open Settings → Domain → WordPress and copy the site token.
3. In wp-admin open Reflexa and paste the token. The token belongs to that one site and grants nothing beyond it.
4. Run the first check from the same page. From then on the agent checks in every 15 minutes, picks up what you approved, applies it and reports back.

== Frequently Asked Questions ==

= Does the plugin change my site on its own? =

No. The three switches are turned on by an administrator on the plugin page or in the dashboard. Every other change is shown to you in the dashboard first and applied only after you approve it. Everything applied can be undone.

= Does it slow the site down? =

No. The check runs on Reflexa's servers. On the site the plugin adds a few lines to robots.txt, the head and llms.txt, and forwards AI visits in a non-blocking request with a two-second timeout. For any other visit the plugin appends one line to a file after the page has been sent; nothing is asked of Reflexa while a visitor waits.

= Does it use a language model inside WordPress? =

No. Nothing in the plugin calls a model. Model work happens in your Reflexa account, where it is priced per run.

= Will it conflict with my SEO plugin? =

WordPress and SEO plugins keep control of their sitemaps. The Organization block and the robots rules are additive and marked, so you can see exactly what came from Reflexa.

= What happens when I deactivate or delete the plugin? =

Deactivating stops the check-ins and removes the robots rules, the head block, llms.txt and the request-log lines not yet sent. Deleting the plugin also removes its options, the stored token and the edit history it kept on pages. Pages and passages you approved stay as they are: they are your content.

= Can I switch the request log off? =

Yes. On the Reflexa page in wp-admin, under the connection, the request log has its own switch. Off, nothing is counted and what had not been sent is deleted; everything else works as before.

= Is it free? =

The plugin is free and GPL, and its three switches work without an account. The check, the findings, the AI visit counts and the agent's changes are the Reflexa service and need a Starter or Growth plan. There is no trial that expires and nothing in the plugin unlocks on payment: the service is simply where that work is done.

== Changelog ==

= 0.15.0 =
* Find published, editable pages by title or slug across a large site. The paired dashboard can narrow results by page language and show matching addresses for review.

= 0.14.0 =
* Studio can check a specific public native page by its permalink, including pages beyond the first 100. The paired dashboard receives its current edit revision and supported fields.
* Page-specific Studio background changes verify the approved page and revision again before saving and load the stylesheet only on that page.

= 0.13.0 =
Review an individual paragraph override in a supported synced pattern on WordPress 6.6 or later.

= 0.12.0 =
* Studio pages can pair a headline and an action with wide photography or a split layout. The same page styling is used in your theme and private preview.
* New Studio layouts adapt to narrow screens. Optional entrance and button animations respect visitors' reduced-motion preference.

= 0.11.0 =
Edit existing native WordPress pages in Studio. Preview a text replacement, page color or rewrite in your active theme, save a private copy and approve applying it at the original address. WordPress checks both revisions before updating the page. Preview site-wide theme colors privately on a public page before applying the stylesheet.

= 0.10.1 =
Save a private WordPress draft directly from Studio as soon as the site's plugin receives the request.

= 0.10.0 =
Preview a proposed Studio page privately in the active WordPress theme before saving its draft.

= 0.9.9 =
Open Reflexa Studio from the top of a verified WordPress starter site to plan and preview its first pages.

= 0.9.8 =
Show indexing restrictions above site controls and distinguish crawler access, search eligibility and AI traffic.

= 0.9.7 =
Prepare private WordPress page drafts and review layouts on a copy before applying them to the original page.

= 0.9.6 =
The dashboard now shows when the WordPress plugin disconnects and when it reconnects.

= 0.9.5 =
* Redesigned WordPress admin with current control states, site checks, connection management and a responsive layout.

= 0.9.4 =
* Respect sitemap visibility and provider settings. Report active fixes without prompting for them again.

= 0.9.3 =
* Fix a fatal error while saving a site token, opening the Reflexa admin page or sending a heartbeat. The plugin now reads sitemap status through the WordPress core API.

= 0.9.2 =
* Recheck the current description before a rule publishes and preserve newer edits when restoring a page.

= 0.9.1 =
* The request log keeps its lines in a protected folder under uploads, under a name with a random part, instead of a fixed file in wp-content. The old file is removed on upgrade.
* The request log has its own switch on the plugin's page, and the page and this readme say exactly what it counts and sends.
* A fatal error is reported without the server's own folder paths.
* Disconnecting or deactivating deletes the lines not yet sent.

= 0.9.0 =
* The request log: every request the site answers — path, status, response time, robot or not — appended as one line and posted with the heartbeat, rolled up per day in the dashboard. Errors keep their minute for a fortnight, and a 500 carries the fatal PHP reported. No address, no user agent, no query string, no cookie.

= 0.8.3 =
* Approved stylesheets are enqueued through WordPress instead of printed into the head.
* A snippet is parsed again before it is printed, and only the elements the check approved are written out, so markup that closes the wrapper cannot escape it.
* The Organization block encodes every character that could end its own script element.
* The sitemap redirect and the /llms.txt link use the address this site actually serves, pretty permalinks or not.

= 0.8.2 =
* A snippet may carry only meta, link and JSON-LD tags; it is parsed first and anything that could execute is refused and reported.

= 0.8.1 =
* Undo finds its page from an index instead of scanning every post's meta.
* The sitemap state is read through WordPress's own sitemap server, not by firing its filter.

= 0.8.0 =
* Response headers can be set or removed per page or site-wide, when approved in the dashboard.
* The sitemap switch answers at /sitemap.xml unless an SEO plugin does.
* The robots block, the Organization script and llms.txt carry marks, so the dashboard can confirm they landed.
* Ready for the WordPress plugin directory: readme, uninstall, coding standard.

= 0.7.0 =
* Approved changes: a stylesheet, a snippet in the head or the body, one passage replaced on one page, a new page, each with its undo.

= 0.6.0 =
* Page edits approved in the dashboard: title, description, opening, FAQ, canonical, robots meta.
* Redirects approved in the dashboard.

= 0.5.0 =
* Heartbeat every 15 minutes: the agent picks up approved switches and reports back.

= 0.4.0 =
* AI Radar: AI crawler and fetcher visits are forwarded to the dashboard.

= 0.3.0 =
* First public build: pairing by site token, structural check, four switches.

== Upgrade Notice ==

= 0.15.0 =
Find an editable page by subject and language when its URL is unknown.

= 0.14.0 =
Look up an editable page by URL on large WordPress installations.

= 0.13.0 =
Review an individual paragraph override in a supported synced pattern on WordPress 6.6 or later.

= 0.12.0 =
See new Studio page layouts and optional animations in your active WordPress theme.

= 0.11.0 =
Preview edits to existing native WordPress pages and apply a saved review from Studio.

= 0.10.1 =
Save Studio drafts immediately on connected sites, with automatic retry at check-in.

= 0.10.0 =
Preview a proposed Studio page privately in the active WordPress theme before saving its draft.

= 0.9.9 =
Open Reflexa Studio from the top of a verified WordPress starter site to plan and preview its first pages.

= 0.9.8 =
Show indexing restrictions above site controls and distinguish crawler access, search eligibility and AI traffic.

= 0.9.7 =
Prepare private WordPress page drafts and review layouts on a copy before applying them to the original page.

= 0.9.6 =
The dashboard now shows when the WordPress plugin disconnects and when it reconnects.

= 0.9.5 =
The WordPress admin now shows local settings, the latest check and connection status together. Includes the sitemap privacy fix from 0.9.4.

= 0.9.4 =
Update to respect your site’s sitemap settings, including on sites that enabled the previous sitemap switch.

= 0.9.3 =
Update to fix a fatal error when the plugin reads sitemap status during setup and check-ins.

= 0.9.1 =
Moves the request log out of wp-content into a protected folder and gives it a switch. Recommended for every site that installed 0.9.0 from a zip.

= 0.8.0 =
Folder renamed to reflexa-agent to match the directory listing. If you installed an earlier zip by hand, delete the old "Reflexa" plugin and install this one; the token is pasted once more.
