=== IBS AI Agent Gateway ===
Contributors: ibsofts, laddoo
Donate link: https://donate.stripe.com/14keXEbyJ2xp43SdQR
Tags: Agents, Ai, LLM, markdown, rest-api
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your WordPress site with AI agents through structured content discovery, search, and REST APIs.

== Description ==

🌐 <a href="https://www.ibsofts.com/plugins">Official Website</a> | 📖 <a href="https://support.ibsofts.com/knowledgebase/articles/installing-and-activating-ibs-ai-agent-gateway">Documentation</a> | 💁 <a href="https://support.ibsofts.com/">Support</a>

🚀 **IBS AI Agent Gateway** makes your WordPress website AI-ready by enabling AI assistants, Large Language Models (LLMs), and other AI applications to discover, search, and retrieve WordPress content through structured APIs. It supports posts, pages, and WooCommerce products and can deliver content in clean, structured Markdown using the standard Accept: text/markdown HTTP header, allowing compatible AI clients to request Markdown instead of HTML.

Your website works exactly the same for human visitors. IBS AI Agent Gateway only serves Markdown when a compatible AI agent explicitly requests it, ensuring there is no impact on the normal browsing experience.

### 🚀 What is Markdown?
Web pages are designed for people, so they include HTML, CSS, JavaScript, navigation menus, sidebars, and other elements that AI doesn't need. This extra code makes it more difficult and expensive for AI models to process your content.
Markdown is a clean, lightweight format that is easy for AI assistants and Large Language Models (LLMs) to understand. By serving your content as Markdown, **IBS AI Agent Gateway** removes unnecessary markup, helping AI applications process your content more efficiently, use fewer tokens, and generate more accurate responses.


### 🚀How It Works
When an AI assistant or application requests a page using the standard Accept: text/markdown HTTP header, IBS AI Agent Gateway detects the request and converts the WordPress content into clean, structured Markdown.
Instead of returning the usual HTML page, the plugin responds with a Markdown version of the content and the appropriate Content-Type: _text/markdown header_. Human visitors continue to receive the normal HTML version of your website, so there is no change to the browsing experience.

`
curl https://yoursite.com/your-post/ \
  -H "Accept: text/markdown"
`

### 🚀Core Features
☑️ **Zero configuration** – works out of the box for publicly accessible singular content, including posts, pages, and custom post types.
☑️ **AI Agent Discovery** – provides structured site, API, language, and capability information to help AI agents discover available content and gateway features.
☑️ **REST API** – exposes WordPress content through dedicated AI-friendly REST endpoints for content discovery, search, and retrieval.
☑️ **OpenAPI support** – provides a machine-readable OpenAPI specification describing the available gateway API endpoints.
☑️ **Content Search** – allows AI agents and applications to search publicly accessible WordPress content through the gateway.
☑️ **Structured Markdown** – converts WordPress content into clean, structured Markdown for AI assistants, LLMs, and other AI applications.
☑️ **Page Builder Cleanup** – removes Elementor, Divi, WPBakery, and Beaver Builder layout markup, classes, attributes, and shortcodes to generate clean AI-friendly Markdown.
☑️ **WooCommerce Support** – product pages include price, SKU, stock status, rating, attributes, and gallery information; products are grouped by category in llms.txt.
☑️ **Multilingual Support** – detects languages using WPML, Polylang, and TranslatePress integrations, emits Content-Language headers, and provides alternate language URLs through hreflang Link headers.
☑️ **YAML Front Matter** – documents include structured metadata such as title, description, URL, publication date, categories, tags, and featured image.
☑️ **Content Signals** – emits Content-Signal headers (ai-train, search, and ai-input) to communicate content usage preferences to AI systems.
☑️ **Token Count Header** – X-Markdown-Tokens provides an estimated token count in Markdown responses for AI processing pipelines.
☑️ **HTTP Caching** – uses Vary: Accept headers so compatible caches and CDNs can distinguish between HTML and Markdown representations.
☑️ **LLMs.txt Support** – automatically generates an /llms.txt index following the llms.txt format.
☑️ **LLMs-full.txt Support** – provides full site content in a single Markdown file.
☑️ **Agents.txt Support** – provides an /agents.txt discovery file for AI agents.

### 🚀REST API
`
GET /wp-json/ibs-ai-agent-gateway/v1/site
GET /wp-json/ibs-ai-agent-gateway/v1/context
GET /wp-json/ibs-ai-agent-gateway/v1/content
GET /wp-json/ibs-ai-agent-gateway/v1/content/{id}
GET /wp-json/ibs-ai-agent-gateway/v1/search?q=<search_term>
GET /wp-json/ibs-ai-agent-gateway/v1/markdown?id=<post_id>
GET /wp-json/ibs-ai-agent-gateway/v1/markdown?slug=<slug>
GET /wp-json/ibs-ai-agent-gateway/v1/markdown?url=<permalink>
GET /wp-json/ibs-ai-agent-gateway/v1/openapi
`

### 🚀Privacy
☑️ **No external data sharing** – the plugin does not send website content or visitor information to external third-party services.
☑️ **Rate limiting** – API rate limiting uses the visitor's IP address temporarily to control request frequency. Rate-limit data is stored using WordPress transients and expires automatically.
☑️ **WordPress security practices** – uses WordPress APIs and security practices for sanitization, validation, escaping, and access control.
☑️ **Administrator-only settings** – plugin configuration is accessible only to authorized administrators.

== Installation ==

1. Upload the IBS AI Agent Gateway plugin.
2. Activate the plugin.
3. Navigate to Settings → IBS AI Agent Gateway.
4. Enable the required features.
5. Select supported post types.
6. Generate discovery files.
7. Verify the generated endpoints.


= Requirements =
* WordPress 6.0 or higher
* PHP 7.4 or higher


== Frequently Asked Questions ==

= Does it support custom post types? =
Yes. You can select which post types, including custom post types, are exposed through Settings → IBS AI Agent Gateway.

= Does it modify my existing content? =
No. IBS AI Agent Gateway only generates AI-friendly representations of your content alongside the original. Your posts, pages, and products remain untouched.

= Does it support WPML? =
Yes. When WPML is installed, IBS AI Agent Gateway automatically detects the default language, current language, available translations, and translation URLs, with no additional configuration required.

= Can I disable individual REST API endpoints? =
Yes. The Markdown API and Content API can be enabled or disabled independently from the plugin settings.

= Why are my discovery files (llms.txt, llms-full.txt, agents.txt) missing? =
Check that they're enabled in the plugin settings, then regenerate them from the settings page.


== Screenshots ==

1. General Settings – Configure AI Agent Gateway features and content options.
2. Advanced agents.txt Rules – Define custom AI agent access and usage rules.
3. Content Signals – Configure AI content usage signals.
4. Quick Links – Access discovery files and REST API endpoints.
5. API Playground – Test and explore the available AI agent APIs.

== Changelog ==

= 1.0 =
* Initial release.

== Upgrade Notice ==

= 1.0 =
* Initial release of IBS AI Agent Gateway.
