﻿=== AOS Governance for WP ===
Contributors: aosfoundation
Tags: ai governance, mcp, security, policy, audit
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.1
Stable tag: 1.2.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Constitutional AI governance for WordPress MCP. Deterministic policy gates between AI agent intent and site execution.

== Description ==

**AOS Governance for WP** is the first constitutional AI governance layer for WordPress. It places a deterministic policy gate between AI agent intent and site execution — every action is evaluated, every decision is logged, and every policy is enforced without exception.

= The Problem =

WordPress 6.9 introduces the Abilities API and MCP Adapter, enabling AI agents to create posts, delete users, modify settings, and execute arbitrary actions on your site. Existing monitoring tools can log MCP requests, but they cannot **stop** an unauthorized action before it executes.

= The Solution =

AOS Governance for WP is not a monitoring tool. It's an **enforcement layer**. Think of it as the constitutional policy gate between AI intent and site execution:

* **Deterministic Policy Engine** — Pure pattern-matching rules, no LLM in the governance loop
* **Sub-millisecond Evaluation** — Less than 1ms gate evaluation time
* **Pre-built Policy Templates** — No bulk deletion, no admin creation, no plugin installation, and more
* **Immutable Audit Trail** — Tamper-evident, SHA-256 checksummed log entries
* **MCP-Native Abilities** — AI agents can query policies, check permissions, and view their governance profile
* **Per-Agent Detection** — Identifies Claude, Cursor, ChatGPT, Windsurf, and more
* **Zero External Dependencies** — No API calls, no cloud services, no data leaving your server

= How It Works =

1. AI agent calls a WordPress ability through the MCP Adapter
2. AOS intercepts the call before execution
3. The Policy Engine evaluates the action against your active policies
4. If allowed → the ability executes normally
5. If denied → the agent receives a structured deny reason and the action is blocked

= Built-in Policies =

* **No Bulk Deletion** — Blocks deletion of more than 10 items at once
* **No Admin User Creation** — Blocks AI from creating administrator accounts
* **No Plugin/Theme Installation** — Blocks infrastructure changes
* **No Critical Settings Changes** — Protects site URL, admin email, and more
* **Content Rate Limiting** — Prevents content flooding
* **No Direct File Editing** — Blocks PHP file modifications

= MCP-Native Abilities =

AOS registers its own abilities so AI agents can natively interact with the governance layer:

* `wpg/check-policy` — Pre-flight policy check (will this action be allowed?)
* `wpg/audit-log` — Query the governance audit trail
* `wpg/active-policies` — List active policies
* `wpg/agent-profile` — View detected identity and permissions
* `wpg/report-generate` — Generate compliance reports

== Installation ==

1. Upload the `aos-governance` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Navigate to **WP Governance → Dashboard** to view the gate status
4. Review and customize policies under **WP Governance → Policies**
5. Configure alerts under **WP Governance → Settings**

= Requirements =

* WordPress 6.0 or higher
* PHP 8.1 or higher
* WordPress MCP Adapter plugin (recommended but not required)

== Frequently Asked Questions ==

= Does this replace the MCP Adapter? =

No. AOS Governance for WP works alongside the MCP Adapter. The adapter enables AI agents to interact with WordPress; AOS governs what they're allowed to do.

= Does this use AI to make governance decisions? =

No. The Policy Engine is 100% deterministic. It uses pattern matching and rule evaluation — no LLM, no AI, no ambiguity. Given the same policies and the same action, the result is always identical.

= What happens when an action is denied? =

The AI agent receives a structured `WP_Error` response containing the policy name, the deny reason, and the evaluation time. The denial is logged to the immutable audit trail. If configured, email and/or webhook alerts are sent.

= Can I create custom policies? =

Yes. In addition to the 6 built-in policies, you can create custom policies with conditional rules, ability filters, agent filters, and template-based deny messages.

= How is this different from MCP Tracker or activity log plugins? =

MCP Tracker and activity logs are **monitoring tools** — they record what happened after the fact. AOS Governance for WP is a **governance layer** — it evaluates policy *before* execution and blocks actions that violate your rules. MCP Tracker is your security camera. AOS is your security guard.

== Screenshots ==

1. Dashboard with governance stats and recent activity
2. Policy management with toggle switches and priority ordering
3. Immutable audit log with filtering
4. Settings with email and webhook alerts

== Changelog ==

= 1.2.5 =
* Fix: Build script dev-code stripping broke class-wpg-license.php structure
* Replaced fragile regex stripping with robust @dev-strip-start/@dev-strip-end markers
* Ensures clean production zips with no orphaned methods outside class scope

= 1.2.4 =
* Fix: Fatal parse error in WPG_Alerts_Email class (missing space in type hint)
* Rebuild of 1.2.3 with critical hotfix

= 1.2.3 =
* Pro: Advanced email alerts — Instant, Digest, and Threshold delivery modes
* Pro: Email health check detects SMTP plugins and validates delivery
* Pro: Send Test Email from settings for quick verification
* Pro: Rate limiting and digest scheduling via WordPress cron
* Fix: Plugin Check errors resolved (escaping, translators comments, ordered placeholders)
* Fix: Stable tag and Tested up to version synced
* Fix: Hidden .gitkeep replaced with index.php in languages directory
* Improvement: Webhook alerts now support HMAC signing with configurable secret
* Improvement: Uninstall cleanup for all email alert options and cron jobs

= 1.2.2 =
* Pro: LemonSqueezy license activation and deactivation
* Pro: License status display and Pro feature gating
* Policy import/export via JSON
* Agent profile system for per-agent governance
* AI Engine (Meow Apps) MCP interception

= 1.2.0 =
* Visual condition builder for custom policies
* Ability picker with checkbox interface
* Batch simulation runner for dashboard testing
* Per-integration test buttons for Abilities API, MCP Adapter, AI Engine

= 1.0.0 =
* Initial release
* Deterministic Policy Engine with conditional evaluation
* 6 built-in policy templates
* Immutable audit trail with SHA-256 checksums
* Agent detection for Claude, Cursor, ChatGPT, Windsurf, and more
* MCP-native abilities (wpg/check-policy, wpg/audit-log, etc.)
* WordPress admin dashboard with stats and management
* Email and webhook alerts for denied actions
* REST API for programmatic access
