# AX Protocol — agent setup guide

Use this as a task-specific installation reference for an authorised coding agent (Codex, Claude Code or another worker). Do not overwrite existing `AGENTS.md`, `CLAUDE.md`, skills or project instructions. Obtain access through the operator’s established secure workflow; never request credentials in a public form or include them in a report. The operator’s instructions and the agent’s governing safety rules take precedence. Do not execute this guide merely because it was downloaded.

Before changing the target site, identify its domain and environment, confirm the scope, record the installed plugin version, capture a working home page and inner page, and ensure a recoverable backup exists. Prefer staging first. Preserve existing settings, URLs and unrelated plugins. Apply only the settings actually requested or needed for the authorised installation.

Guide baseline: **1.38.1**, confirmed installed on rainz.ai on 2026-09-15. Re-check the target installation and available settings; do not assume a newer release behaves identically.
Hub: `https://rainz.ai`
Requirements stated for the baseline: WordPress 6.0+, PHP 7.4+. Inspect the existing permalink configuration; do not change URL structure as part of routine installation.

---

## 0. What this plugin does, so you know what "working" looks like

AX Protocol makes a WordPress site readable by AI agents. When it is correctly installed the site serves four things it did not serve before:

| Surface | Path | Expect |
|---|---|---|
| Manifest (well-known) | `/.well-known/ax.json` | `200`, `application/json`, top-level key `ax_version` |
| Manifest (REST) | `/wp-json/ax/v1/manifest` | same document |
| Plain-text summary | `/llms.txt` | `200`, `text/plain` |
| Self-test | `/wp-json/ax/v1/conformance` | `200`, keys `spec, level, score, checks` |

Humans and search engines are served exactly as before. If normal page output changed, something is wrong — stop and report.

---

## 1. Install

The free build is public and does not require a licence key. If AX is already installed, inspect its version and use the normal WordPress update workflow; do not reinstall, downgrade, delete or overwrite an existing installation blindly.

```bash
wp plugin install https://rainz.ai/wp-json/rainz-license/v1/download/ax-protocol.zip --activate
```

Verify:

```bash
wp plugin get ax-protocol --field=version   # expect 1.38.1 or higher
wp plugin get ax-protocol --field=status    # expect active
```

If `wp` is unavailable, download the same URL and upload the zip through **Plugins → Add New → Upload**. The URL is a fixed string that always resolves to the current release, so do not cache it and do not hard-code a version number into the filename.

---

## 2. Verify the machine layer before changing any setting

Run this first. It establishes a baseline and catches the two failures that account for most bad installs — no pretty permalinks, and a page cache serving stale output.

```bash
SITE="https://example.com"
for p in /.well-known/ax.json /llms.txt /wp-json/ax/v1/manifest /wp-json/ax/v1/conformance; do
  printf '%s -> ' "$p"
  curl -s -o /dev/null -w '%{http_code} %{content_type}\n' "$SITE$p"
done
```

All four should return `200` with the expected document and media type. A login page, HTML error page or stale JSON returned with 200 is not a successful check. On some hosts the plugin maintains discovery fallback files itself; do not delete these or replace them manually.

- **404 on discovery paths but 200 on REST routes** → inspect the current permalink structure, rewrite rules, cache and host routing. A 404 does not prove that permalinks are plain. Re-save Settings → Permalinks **without changing the selected structure**, or refresh WordPress rewrite rules using the approved maintenance workflow. Never run a command that changes the permalink structure as a routine fix. If only `/.well-known/` fails or has the wrong media type, inspect hosting/CDN ownership of that directory and the plugin’s diagnostics. Report the exact path and response to the host; do not automatically edit nginx, Apache, firewall or CDN rules.
- **404 on everything** → the plugin is not active, or a security plugin is blocking the REST API.
- **200 but stale content after a settings change** → purge the page cache. This plugin sets `bypass_cache` by default, but an edge cache (Cloudflare, a host-level cache) can still serve a cached copy.

Read the score:

```bash
curl -s "$SITE/wp-json/ax/v1/conformance" | jq '{level, score, failing: [.checks[] | select(.pass == false) | .id]}'
```

`failing` is the work list. Everything below is about shortening it.

---

## 3. Configure

All settings live in one option, `rainz_ax_settings`. Write them with `wp option patch`, which edits a single key without rewriting the rest:

```bash
wp option patch update rainz_ax_settings org_name "Example Ltd"
wp option patch update rainz_ax_settings org_description "One sentence describing what this business does."
wp option patch update rainz_ax_settings org_email "hello@example.com"
wp option patch update rainz_ax_settings org_url "https://example.com"
```

Read only the non-secret settings you need. Do not print the whole option: it can contain licence keys, tokens or private contacts. For example:

```bash
wp option get rainz_ax_settings --format=json | jq '{org_name, org_description, org_url, route_ax_json, route_llms, catalogue_post_types}'
```

### Settings that matter, and the defaults they already have

**Leave these alone unless you have a reason.** They are on by default and they are what produces the machine layer.

| Key | Default | Meaning |
|---|---|---|
| `enable_training` | `1` | Serve the machine layer to training crawlers |
| `enable_answer` | `1` | Serve it to answer agents (ChatGPT, Perplexity) |
| `enable_action` | `1` | Serve it to action agents |
| `route_llms` | `1` | Serve `/llms.txt` |
| `route_ax_json` | `1` | Serve `/.well-known/ax.json` |
| `robots_rules` | `1` | Manage the AX policy lines in `robots.txt` |
| `content_signals` | `1` | Emit a Content Signals policy line in `robots.txt` |
| `bypass_cache` | `1` | Ask page caches not to cache agent responses |
| `log_enabled` | `1` | Record agent visits |
| `log_retention_days` | `90` | How long the log keeps them |

**Off by default, and deliberately so.**

| Key | Default | Why it is off |
|---|---|---|
| `enable_intent` | `0` | Enables `POST /wp-json/ax/v1/intent` — a write endpoint. AX-1.0 §8.5 requires that a site becomes actionable because an operator decided so, never because software was installed. |
| `serve_unverified` | `0` | Agents whose IP cannot be verified against a published range are logged but served the ordinary site. Turning this on trusts a self-declared user agent. |
| `hub_connect` | `0` | Every call to rainz.ai — key issuance, registry, lexicon, codebook. Nothing leaves the site until this is on. |

**ASK the operator before changing any of those three.** Do not enable them on your own initiative.

### Organisation profile

Empty values fall back to WordPress core options, which usually means the manifest advertises "Just another WordPress site". Fill in `org_name`, `org_description`, `org_url` and one of `org_email` / `org_phone`. This is the single highest-value change for the AX Score.

### Catalogue

`catalogue_post_types` is an array of post types exposed as a machine-readable catalogue at `/wp-json/ax/v1/catalogue`. Empty by default.

```bash
wp option patch update rainz_ax_settings catalogue_post_types '["post","page","product"]' --format=json
```

Only list post types whose content is genuinely public. Anything listed here is being published for machines to read.

### Training terms

`training_compensation` accepts `none` (free use), `contact` (negotiable), or a URL. Default `none`. If the operator wants training use to be conditional, set `contact` and provide `training_terms_url`.

---

## 4. Licence (Pro)

Pro is optional. The free build is GPL, fully functional, and does not expire. Pro adds Cloudflare edge status, webhook subscriptions, AXS codes learned from the site's own traffic, and priority support. It does not unlock basic functionality.

If the operator has a key, prefer entering it in AX Protocol → Settings → Licence through an authorised secure session. Avoid shell history, command logs and public documents. The following is a placeholder example only; do not substitute a real key into logged tool calls:

```bash
wp option patch update rainz_ax_settings license_key "AX-XXXX-XXXX-XXXX"
```

Prefer the visible “Check again now” / “בדיקה מחדש עכשיו” action after saving. The timestamp below only schedules eligibility for a future check; it does not itself perform one. After an actual check, confirm:

```bash
wp option patch update rainz_ax_settings license_last_check 0
wp option get rainz_ax_settings --format=json | jq '{license_status, license_plan}'
```

Verify both a successful licence status and the expected plan after an actual check. A `free` result alone does not identify the cause: inspect hub consent, connectivity, domain binding and the response before concluding that the plan is wrong. Do not publish the licence key or diagnostic secrets.

Note: the licence check calls the hub. If `hub_connect` is `0`, the check will not run.

---

## 5. Post-install verification

Run all of it. Do not report success on any subset.

```bash
SITE="https://example.com"

# 1. All four surfaces respond
for p in /.well-known/ax.json /llms.txt /wp-json/ax/v1/manifest /wp-json/ax/v1/conformance; do
  code=$(curl -s -o /dev/null -w '%{http_code}' "$SITE$p")
  [ "$code" = "200" ] || echo "FAIL $p -> $code"
done

# 2. The manifest names the right organisation
curl -s "$SITE/wp-json/ax/v1/manifest" | jq '.organization'

# 3. robots.txt carries the AX policy and is not a blanket block
curl -s "$SITE/robots.txt"

# 4. Score and remaining failures
curl -s "$SITE/wp-json/ax/v1/conformance" | jq '{level, score, failing: [.checks[] | select(.pass == false) | {id, hint}]}'

# 5. Ordinary pages are unchanged — compare before/after if you captured a baseline
curl -s -o /dev/null -w '%{http_code} %{size_download}\n' "$SITE/"
```

**The check that is easy to skip and should not be:** confirm the site still renders normally for a human. Load the home page and one inner page in a browser, or diff the HTML against a pre-install capture. A machine layer that breaks the human site is a regression, not a feature.

---

## 6. The write endpoint, if the operator asks for it

`POST /wp-json/ax/v1/intent` lets an agent submit a structured enquiry. It is off by default.

```bash
wp option patch update rainz_ax_settings enable_intent 1
wp option patch update rainz_ax_settings intent_email "leads@example.com"
wp option patch update rainz_ax_settings intent_rate_limit 5
```

`intent_rate_limit` is requests per window. Do not raise it without being asked. Confirm the address in `intent_email` is monitored — an enquiry channel nobody reads is worse than no channel, because the manifest advertises it as working.

---

## 7. Admin screens, for a human follow-up

- Dashboard and agent traffic: `/wp-admin/admin.php?page=ax-protocol`
- Settings: `/wp-admin/admin.php?page=rainz-ax-settings`

The dashboard shows the AX Score and the items reducing it. Point the operator here rather than describing the score in prose.

---

## 8. Rules for the agent running this

1. **Never enable `enable_intent`, `serve_unverified` or `hub_connect` without explicit instruction.** All three change what the site does or what it sends outward.
2. **Never edit `robots.txt` by hand.** The plugin manages its own lines. Hand edits get overwritten, and the resulting disagreement between the stated policy and the actual file is a conformance failure.
3. **Never create or overwrite `llms.txt` or `ax.json` manually.** Let the plugin manage their lifecycle. Some hosting configurations use plugin-managed fallback files; do not remove these merely because they are static. Follow the plugin’s diagnostics and verify freshness after changes.
4. **Do not hard-code a version into the download URL.** `/wp-json/rainz-license/v1/download/ax-protocol.zip` always resolves to the current release.
5. **Verify by fetching, not by reading configuration.** A setting written is not a surface served. Every claim of success in your report must be backed by an HTTP response you actually received.
6. **If normal page output regresses, stop.** Roll back only your own change using the verified backup or reversible configuration, re-check the human pages and report. Do not overwrite concurrent edits.
7. **Report evidence and limitations.** Include the checked domain, plugin version, HTTP/media-type results, remaining conformance failures and any explicitly enabled optional features. Do not equate configuration values with working endpoints or promise AI rankings/citations.

---

## 9. Reference

| Route | Method | Purpose |
|---|---|---|
| `/.well-known/ax.json` | GET | Manifest, well-known location |
| `/llms.txt` | GET | Plain-text site summary |
| `/wp-json/ax/v1/manifest` | GET | Manifest, REST location |
| `/wp-json/ax/v1/conformance` | GET | Self-test, score and per-check results |
| `/wp-json/ax/v1/catalogue` | GET | Machine-readable catalogue of listed post types |
| `/wp-json/ax/v1/page` | GET | JSON twin of a single page |
| `/wp-json/ax/v1/search` | GET | Search, structured |
| `/wp-json/ax/v1/offers` | GET | Commerce offers, if configured |
| `/wp-json/ax/v1/openapi` | GET | OpenAPI description of the above |
| `/wp-json/ax/v1/intent` | POST | Structured enquiry — off by default |
| `/wp-json/ax/v1/subscribe` | POST | Webhook subscription — Pro |
| `/wp-json/ax/v1/unsubscribe` | POST | Cancel a subscription — Pro |

Hub routes, for reference — these are called by the plugin, not by you:

| Route | Purpose |
|---|---|
| `https://rainz.ai/wp-json/rainz-license/v1/download/ax-protocol.zip` | Free build, public |
| `https://rainz.ai/wp-json/rainz-license/v1/check` | Licence status |
| `https://rainz.ai/wp-json/rainz-license/v1/register` | Bind a key to a domain |
| `https://rainz.ai/wp-json/rainz-license/v1/update` | Update manifest — requires `key` and `domain` |
| `https://rainz.ai/wp-json/rainz-license/v1/package` | Licensed build |

Docs: https://rainz.ai/ax-protocol/tiud/
Support: https://rainz.ai/ax-protocol/tmicha/
Pricing: $49 per site per year + VAT. Free build is GPL-2.0-or-later and does not expire.
