WP Manifestindependent plugin directory
manifest / ai / slim-wordpress

SLIM Protocol

WordPress plugin for native SLIM Protocol support - AI-optimized content delivery

by SLIM Protocol Team · github.com/matteuccimarco/slim-wordpress · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/matteuccimarco/slim-wordpress/archive/refs/heads/master.zip

Make your WordPress content AI-ready. Expose posts and pages in SLIM format for efficient consumption by AI agents and LLMs.

Description

SLIM Protocol transforms your WordPress site into an AI-friendly platform by automatically exposing content in the SLIM-PYRAMID format - a structured, token-efficient representation designed for Large Language Models.

Why SLIM?

When AI agents browse the web, they face two major challenges:

  1. Token explosion: A typical blog post is 50-100KB of HTML, translating to 15-25K tokens
  2. Signal vs noise: Only 10-20% of page content is semantically relevant

SLIM Protocol solves both problems by providing a hierarchical, structured representation of your content:

Level Name Typical Tokens Use Case
L0 Identity 20-30 Quick identification
L1 Overview 50-100 Routing decisions
L2 Summary 150-300 Content understanding
L3 Full 500-2000 Deep analysis

Key Features

  • Zero Configuration: Works out of the box with sensible defaults
  • Discovery Endpoint: Standard /.well-known/slim (+ REST API fallback at /wp-json/slim/v1/discovery)
  • REST API: Clean API at /wp-json/slim/v1/content/{id}
  • Content Negotiation: Request SLIM via Accept: application/slim-pyramid+json
  • Link Tag: Automatic <link rel="alternate"> in HTML head
  • Caching: Intelligent caching with automatic invalidation on post update
  • Sitemap: AI-optimized sitemap at /slim-sitemap.xml (+ REST API at /wp-json/slim/v1/sitemap)
  • Post Type Control: Enable/disable SLIM for any post type
  • Developer Friendly: Hooks, filters, and template functions
  • No External APIs: Everything runs locally on your server

How It Works

  1. Install and activate the plugin
  2. AI agents discover your SLIM support via /.well-known/slim
  3. They request content in SLIM format instead of parsing HTML
  4. Your content is delivered in a clean, structured JSON format

Example Response

{ "swr_version": "0.1", "level": 1, "generated_at": "2026-01-27T10:30:00Z", "canonical_url": "https://example.com/my-post/", "identity": { "title": "Understanding Machine Learning", "type": "article", "language": "en" }, "topics": ["machine learning", "ai", "technology"], "summary": "A beginner's guide to machine learning concepts..." }

Who Benefits?

  • Site Owners: Your content becomes accessible to AI agents, improving visibility
  • AI Developers: Efficient content consumption without HTML parsing
  • SEO Professionals: Structured data improves AI understanding of your content
  • Performance: Reduced bandwidth for AI traffic (90%+ reduction)

Compatible With

  • Gutenberg (Block Editor)
  • Classic Editor
  • Elementor
  • WooCommerce
  • Custom Post Types
  • Multisite
  • WPML / Polylang
  • All major caching plugins

Links

Installation

Automatic Installation

  1. Go to Plugins > Add New in your WordPress admin
  2. Search for "SLIM Protocol"
  3. Click "Install Now" and then "Activate"

Manual Installation

  1. Download the plugin ZIP file
  2. Go to Plugins > Add New > Upload Plugin
  3. Upload the ZIP file and click "Install Now"
  4. Activate the plugin

Verification

After activation, verify the plugin is working:

`

Check discovery endpoint (standard)

curl https://yoursite.com/.well-known/slim

Or use REST API fallback (works on all servers)

curl https://yoursite.com/wp-json/slim/v1/discovery

Get SLIM for a post (replace 123 with your post ID)

curl https://yoursite.com/wp-json/slim/v1/content/123?level=1

Test content negotiation

curl -H "Accept: application/slim-pyramid+json" https://yoursite.com/your-post/

Get SLIM sitemap (JSON format)

curl https://yoursite.com/wp-json/slim/v1/sitemap?format=json `

Note: Some hosting providers (like SiteGround) may block /.well-known paths. In that case, use the REST API endpoints instead.

Frequently Asked Questions

What is SLIM?

SLIM (Structured Lightweight Information Markup) is a format designed to represent web content in a way that's optimized for AI consumption. It uses a pyramid structure (L0-L3) to provide increasing levels of detail, allowing AI agents to request exactly the depth of information they need.

Does this affect my site's SEO?

SLIM Protocol complements traditional SEO. It adds structured data that helps AI systems understand your content better. The plugin doesn't modify your existing HTML output - it only adds an alternative representation accessible via API.

Will this slow down my site?

No. SLIM responses are only generated when specifically requested via the API or content negotiation. The plugin uses intelligent caching and doesn't add any overhead to regular page loads for human visitors.

Which post types are supported?

By default, posts and pages are enabled. You can enable/disable any public post type in Settings > SLIM Protocol, including custom post types, WooCommerce products, and more.

Can I customize the SLIM output?

Yes! The plugin provides extensive hooks and filters:

` // Add custom data to SLIM response add_filter( 'slim_response_data', function( $data, $post, $level ) { $data['custom_field'] = get_post_meta( $post->ID, 'my_field', true ); return $data; }, 10, 3 );

// Modify enabled post types add_filter( 'slim_enabled_post_types', function( $types ) { $types[] = 'product'; return $types; }); `

Does it require an external API?

No! All SLIM generation happens locally on your WordPress server. No API keys, external services, or third-party dependencies required.

How do AI agents discover SLIM support?

AI agents can discover your SLIM support in multiple ways:

  1. Discovery endpoint: Check /.well-known/slim for capability information
  2. REST API discovery: Check /wp-json/slim/v1/discovery (fallback for servers that block .well-known)
  3. Link tag: Look for <link rel="alternate" type="application/slim-pyramid+json"> in HTML
  4. Content negotiation: Send requests with Accept: application/slim-pyramid+json header

Is this compatible with Gutenberg?

Yes, SLIM Protocol is fully compatible with the block editor. It analyzes both classic and Gutenberg content, extracting text, headings, and structure regardless of how the content was created.

What about custom fields and ACF?

The plugin focuses on core post content by default. For custom fields (including Advanced Custom Fields), use the slim_response_data filter to include them in the output.

Is caching supported?

Yes, the plugin includes built-in caching with configurable TTL. It also integrates with WordPress object cache and popular caching plugins like WP Super Cache, W3 Total Cache, and LiteSpeed Cache.

Does it work with WooCommerce?

Yes! Enable the "product" post type in settings, and your WooCommerce products will be available via SLIM. Product-specific data (price, SKU, etc.) can be added via filters.

Is multisite supported?

Yes, SLIM Protocol works on WordPress multisite installations. Each site in the network can have its own configuration.

Screenshots

  1. Settings Page - Configure post types, cache duration, default level, and view endpoint URLs
  2. Post Meta Box - Preview SLIM output directly in the post editor and copy API endpoint
  3. Discovery Endpoint - JSON response at /.well-known/slim showing site capabilities
  4. REST API Response - Clean, structured SLIM-PYRAMID representation of content
  5. SLIM Sitemap - XML sitemap listing all SLIM-enabled content for AI crawlers

Changelog

1.0.2 - 2026-01-28

  • Fixed WordPress.org Plugin Checker compliance issues
  • Removed deprecated load_plugin_textdomain() call (auto-loaded since WP 4.6)
  • Removed Update URI header (not allowed for WordPress.org hosted plugins)
  • Renamed helper function to slim_get_slim() for proper prefix
  • Added proper escaping for all outputs in admin settings
  • Added translators comments for placeholder strings
  • Added phpcs:ignore comments for legitimate direct database queries
  • Updated Tested up to: 6.9
  • Reduced tags to 5 as per WordPress.org guidelines

1.0.1 - 2026-01-28

  • Added REST API fallback endpoints for discovery and sitemap
  • New endpoint: /wp-json/slim/v1/discovery (fallback for servers blocking .well-known)
  • New endpoint: /wp-json/slim/v1/sitemap with JSON format support
  • Fixed PHP reserved keyword issue in content endpoint
  • Improved rewrite rule flushing on activation
  • Updated documentation with all REST API endpoints

1.0.0 - 2026-01-27

  • Initial public release
  • Discovery endpoint at /.well-known/slim
  • REST API at /wp-json/slim/v1/content/{id}
  • Content negotiation via Accept header
  • SLIM-PYRAMID levels L0-L3 support
  • Settings page with post type configuration
  • Intelligent caching with automatic invalidation
  • SLIM sitemap at /slim-sitemap.xml
  • Post editor meta box with preview
  • Automatic link tag injection in HTML head
  • Internationalization ready (i18n)
  • Developer hooks and filters
  • Shortcode support [slim_badge]

Upgrade Notice

1.0.2

WordPress.org Plugin Checker compliance fixes. Helper function renamed to slim_get_slim().

1.0.0

Initial release. Install to make your WordPress content AI-ready!

Developer Documentation

Template Functions

` // Get SLIM data for current or specific post $slim_data = slim_get_slim( $post_id, $level );

// Example: Get L2 summary for post 123 $summary = slim_get_slim( 123, 2 ); echo $summary['summary']; `

Actions

  • slim_before_generate - Fires before SLIM generation starts
  • slim_after_generate - Fires after SLIM generation completes
  • slim_cache_cleared - Fires when cache is invalidated for a post
  • slim_before_response - Fires before sending API response
  • slim_plugin_activated - Fires on plugin activation
  • slim_plugin_deactivated - Fires on plugin deactivation

Filters

  • slim_enabled_post_types - Modify which post types support SLIM
  • slim_response_data - Modify SLIM data before output
  • slim_cache_ttl - Modify cache duration (default: 3600 seconds)
  • slim_discovery_data - Modify discovery endpoint response
  • slim_sitemap_posts - Modify posts included in sitemap
  • slim_generator_class - Use custom generator classes
  • slim_max_summary_length - Modify summary truncation length
  • slim_extract_topics - Customize topic extraction

REST API Endpoints

GET /wp-json/slim/v1/discovery

Returns discovery document with site capabilities and available endpoints.

Response includes: supported levels, enabled post types, endpoint URLs, limits, and statistics.

GET /wp-json/slim/v1/content/{id}

Retrieve SLIM representation of a post.

Parameters:

  • id (required) - Post ID
  • level (optional) - Pyramid level 0-3, default from settings
  • refresh (optional) - Force cache refresh if true

Headers:

  • X-SWR-Version - Protocol version in response
  • X-SWR-Level - Actual level returned
  • X-SWR-Cache - Cache status (hit/miss)

GET /wp-json/slim/v1/content?url={url}

Retrieve SLIM representation by URL instead of post ID.

Parameters:

  • url (required) - Full URL of the post
  • level (optional) - Pyramid level 0-3

GET /wp-json/slim/v1/sitemap

Returns list of all SLIM-enabled posts with their API endpoints.

Parameters:

  • format (optional) - xml (default) or json

POST /wp-json/slim/v1/batch

Retrieve SLIM for multiple posts in a single request.

Body (JSON):

  • ids (required) - Array of post IDs (max 50)
  • level (optional) - Pyramid level 0-3

DELETE /wp-json/slim/v1/cache/{id} (requires authentication)

Clear cache for a specific post.

DELETE /wp-json/slim/v1/cache (requires authentication)

Clear all SLIM cache.

WP-CLI Commands

`

Clear all SLIM cache

wp slim cache clear

Clear cache for specific post

wp slim cache clear --post_id=123

Generate SLIM for a specific post

wp slim generate 123 --level=2

Warm cache for all posts

wp slim warm --post-type=post

Export all SLIM data

wp slim export --format=json > slim-export.json

Show plugin status

wp slim status `

Custom Generator Example

` // Create custom L1 generator class My_Custom_L1_Generator extends Slim_L1_Generator { public function generate( $post ) { $data = parent::generate( $post );

    // Add custom logic
    $data['reading_time'] = $this->calculate_reading_time( $post );
    $data['sentiment'] = $this->analyze_sentiment( $post );

    return $data;
}

}

// Register custom generator add_filter( 'slim_generator_class', function( $class, $level ) { if ( $level === 1 ) { return 'My_Custom_L1_Generator'; } return $class; }, 10, 2 ); `

Privacy Policy

SLIM Protocol respects user privacy:

  • No Data Collection: The plugin does not collect any personal data
  • No External Requests: All processing happens locally on your server
  • No Tracking: No analytics, telemetry, or usage tracking
  • Public Content Only: Only exposes content that is already publicly accessible
  • GDPR Compliant: No personal data processing or storage

The plugin simply provides an alternative format for accessing your public content. It does not create, store, or transmit any additional data beyond what WordPress already contains.

Support