Proposal: A Standardized Data & State Layer for Agentic AI #99
antunjurkovic-collab
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Executive Summary
The WordPress AI ecosystem has successfully defined Transport (WP AI Client SDK) and Logic (Abilities API). However, a standardized Data & State Layer is currently missing.
Current AI experiments rely on parsing raw HTML (
post_content) and standard database writes. This results in:_links, and metadata.We propose Dual-Native API as the standardized I/O Layer to complete the stack. It provides a Machine Representation (MR) for efficient reading and a Safe Write API for atomic, conflict-free editing.
1. Strategic Alignment: The "Fourth Building Block"
In the AI Building Blocks roadmap, three blocks were identified. We believe the Data Layer is the necessary fourth block to make the system production-ready and scalable.
2. Solving the "Functional Core" Input Problem
The recent post Meet Abilities: WordPress' New Functional Core argues for composable, pure functions. However, functions require Structured Inputs.
Dual-Native acts as the "Type System" for Content Abilities.
Instead of
summarize( html_string ), we havesummarize( MR_Object ). This makes Abilities cleaner, faster, and purely focused on logic.3. Technical Architecture: The Dual-Native Pattern
The API synchronizes the Human View (HTML) with a Machine View (JSON).
A. The Read Path: Machine Representation (MR)
We expose a JSON envelope containing the logical Block Graph, stripped of theme markup and HTML comments.
Production Metrics (tested on galaxybilliard.club with 13 plugins including WooCommerce + Yoast SEO):
/wp/v2/posts)Key Features:
Content-Digest(RFC 9530) headers computed over final wire bytes.304 Not Modified).the_contentfilters, oEmbed processing, and hypermedia generation.See: BENCHMARK.md for AI cost analysis and PERFORMANCE.md for infrastructure metrics.
B. The Write Path: Atomic Mutations & Safety
We introduce a Safe Write API (
/blocks) that handles server-side block serialization.Atomic Operations:
Agents send intents like
append,prepend, orinsert(with index). The server handles the HTML generation, preventing layout corruption.Optimistic Locking:
The API enforces
If-Matchheaders using the content hash (CID).Example Scenario:
ETag: "sha256-abc123...")"sha256-xyz789...")If-Match: "sha256-abc123..."412 Precondition FailedResult: Zero data loss. The Agent's update is based on the latest content, not stale state.
4. Integration Plan: The "Agentic Bridge"
To demonstrate composability, we built a reference implementation (wp-dual-native-abilities) that bridges all four building blocks.
The Workflow: "Agentic Summarize"
dni/agentic-summarizeis triggeredWordPress\AI_Client\AI_Clientto send clean text to LLMFallback Behavior:
Live Validation (MCP)
We connected this stack to Anthropic's Model Context Protocol via Claude Desktop.
Demonstrated Capabilities:
Self-Healing: Claude detected a block order error via MR and autonomously fixed it using atomic moves.
Data Science: Claude used Code Execution (Python) to analyze the Catalog and plot content statistics instantly, treating WordPress as a structured dataset.
5. Production Validation
Test Site: https://galaxybilliard.club
Environment:
Validation Results:
Validation Tools Available:
6. Roadmap & Collaboration
We propose adding Dual-Native as an infrastructure experiment to the
WordPress/wordpress-developorWordPress/airepository.Phased Integration:
Phase 1: Bridge (Available Now)
wp-dual-native-abilitiesaddondni/get-post-mr- Read Machine Representationdni/get-post-md- Read Markdowndni/get-catalog- Content discoverydni/insert-blocks- Safe atomic writesdni/generate-title- AI title generationdni/ai-suggest- Summary & tag suggestionsdni/agentic-summarize- Full workflow referencePhase 2: Experiments (Immediate Benefits)
dni/get-post-mrfor context (saves 56% tokens)dni/generate-titlefor updates (prevents race conditions)Phase 3: Core Integration (Long-term)
7. Resources & Documentation
Repositories:
Benchmarks & Analysis:
Validation Tools:
8. Cost-Benefit Analysis
For AI Teams:
For Infrastructure Teams:
For Core Contributors:
9. Question for the AI Core Team
Does this "Data Layer" approach align with the architectural vision for the next phase of AI Experiments?
We believe the four-layer model (Interface + Logic + Transport + Data) creates a complete, production-ready foundation for agentic WordPress applications.
We are ready to contribute the code, documentation, and validation tools.
Next Steps:
Contact:
License: GPL v2 or later (WordPress-compatible)
Document Version: 1.0
Last Updated: November 2025
Beta Was this translation helpful? Give feedback.
All reactions