Stratagem.php Project Overview
Stratagem.php is a pure-PHP implementation of an AI Agent skill library, an MCP server, and the A2A protocol. It wraps practical skills into independent units called "Stratagems" (锦囊, jinnang). Each stratagem serves as both an executable tool and agent-readable documentation, aiming to improve AI accuracy and efficiency when performing specific tasks.
Core Value Proposition
- Skills are packaged as self-contained, reusable "Stratagems"
- Each stratagem doubles as executable code and documentation that agents can read
- Goal: improve AI task execution accuracy and efficiency
- Stratagem Core Layer: All foundational functional modules; each stratagem is a self-contained PHP file
- Protocol Support Layer: Complete MCP and A2A protocol stacks
- Application Collaboration Layer: Represented by the Yongle Academy system, providing project management and content generation workflows
- Pure PHP implementation: Based on PHP 8.0+, zero external dependencies
- Full MCP support: Stdio, SSE, and HTTP transport modes for the smart stratagem system
- Dual-mode operation, metadata search, and self-documenting comments
- Enterprise-grade security: Path traversal protection, operation whitelisting, and rate limiting
Technical Architecture
The design philosophy is "simple yet powerful," visualized as a three-layer cake:
Protocol Support
| Protocol | Description | Purpose | |------|------|------| | MCP | Model Context Protocol | Connecting agents with tool resources | | A2A | Agent-to-Agent Protocol | Dynamic collaboration and communication between agents |