Git-Driven Knowledge Base
Every commit updates the AI's understanding. Your code patterns, conventions, and implementations become searchable knowledge.
A comprehensive guide to understanding and utilizing the AI-powered WordPress development system
The WDG AI Development Environment is a local development platform that combines containerized WordPress environments with AI-powered code understanding. It indexes committed code for semantic search and provides AI assistants with deep knowledge of your codebase.
The platform addresses common development challenges by:
projects/
├── my-site/
│ ├── backups/ # Database backups
│ ├── config/ # Configuration files
│ ├── logs/ # Application logs
│ ├── repositories/ # Project-specific repository clones
│ │ └── my-site/ # Repository for this project
│ │ └── wp-content/
│ │ ├── themes/
│ │ ├── plugins/
│ │ ├── mu-plugins/
│ │ └── uploads/
│ ├── docker-compose.yml # Project Docker config
│ └── project.json # Project metadata
├── client-project/
│ └── ... # Another isolated projectEach project is completely isolated with its own:
Note: WordPress files and database data are stored in Docker volumes for performance and portability, not in the project directory structure shown above.
When you commit code, git hooks trigger the indexing pipeline:
git commit -m "Add custom payment gateway"
# ↓ Triggers post-commit hook
# ↓ Extracts code components (functions, classes, hooks)
# ↓ Generates embeddings using local AI models
# ↓ Stores in Qdrant vector databaseYour code becomes searchable by meaning:
The MCP server provides structured access to your codebase. AI assistants automatically use these tools when you ask questions:
# When you ask your AI: "Find refund processing code"
# It automatically calls:
search_codebase("refund processing") # Semantic search
# When you ask: "Where is the process_order function?"
# It automatically calls:
search_functions("process_order") # Find function definitions
# You don't call these directly - your AI assistant doesOnly committed code enters the knowledge base. By design:
The system includes pre-indexed knowledge of:
WDG\Core\PostType and WDG\Core\TaxonomyNo external API calls for code understanding:
wdg create client-site --init-wikitSearch for existing patterns (through your AI assistant):
Ask your AI tool (Claude Code, Cursor, Gemini CLI):
"Search for user registration form implementations"
"Show me existing user registration patterns"
"Find examples of form validation in the codebase"Your AI assistant will use MCP tools to search the indexed codebase.
Develop with AI assistance:
git add .
git commit -m "feat: Add user registration with email verification"
# Knowledge base now includes your new implementationInstead of grep or manual searching:
# Traditional approach
grep -r "add_action.*init" .
# AI-powered semantic search approach (ask your AI assistant)
"Search for initialization hooks for custom post types"
"Show me examples of init action usage"The semantic search understands intent and returns relevant results even if the exact words don't match.
Note: These tools are called automatically by your AI assistant (Claude Code, Cursor, etc.) when you ask questions. You don't invoke them directly - this is a reference for understanding what your AI can do.
search_codebase(query, project=None, file_types=None) Search across all indexed code using natural language.
When to use: Finding implementations of concepts
search_codebase("validate user input")
search_codebase("ajax form submission", project="client-site")
search_codebase("responsive grid", file_types=["scss", "css"])search_functions(function_name, project=None) Find specific function definitions.
When to use: Locating exact function implementations
search_functions("process_payment")
search_functions("wdg_render_", project="my-site") # Partial matchessearch_wordpress_hooks(hook_name, hook_type=None) Find WordPress hooks and their implementations.
When to use: Understanding hook usage across projects
search_wordpress_hooks("init")
search_wordpress_hooks("save_post", hook_type="action")
search_wordpress_hooks("the_content", hook_type="filter")search_wikit_blocks(block_name=None) Search through Wikit Gutenberg blocks.
When to use: Finding and understanding Wikit components
search_wikit_blocks() # List all blocks
search_wikit_blocks("card") # Find card-related blocksget_project_info(project_name) Get project configuration and status.
When to use: Understanding project setup
info = get_project_info("client-site")
# Returns: PHP version, WordPress version, active plugins, indexed statuswordpress_docs(query, type="all", get_details=False) Search WordPress documentation.
When to use: Quick reference for WordPress functions
wordpress_docs("WP_Query")
wordpress_docs("wp_enqueue", type="function", get_details=True)The system provides context files for different AI tools in the root directory:
CLAUDE.md - Comprehensive context for Claude Code and Claude CLIGEMINI.md - Context for Google Gemini CLI.cursor/ - Directory for Cursor IDE configuration cursorrules - Cursor IDE rules and patterns (auto-loaded)mcp.json - MCP server configuration (auto-loaded).codex/ - Directory for OpenAI Codex configuration.claude/ - Directory for Claude Code settings and MCP configuration.gemini/ - Directory for Gemini CLI settingsEach provides:
Cursor automatically detects and loads the .cursor/ directory configuration. To use:
.cursor/cursorrules file is automatically loaded.cursor/mcp.json configures MCP server connectionThe configuration includes:
The platform provides specialized context for AI tools through configuration files:
.claude/settings.json with MCP server connection.cursor/cursorrules and MCP configuration.gemini/settings.json for contextThese configurations give AI assistants:
No special setup required beyond the initial MCP connection.
wdg-ai-dev-env/
├── projects/ # Your WordPress projects
│ └── {project-name}/
│ ├── backups/ # Database backups
│ ├── config/ # Project configuration files
│ ├── logs/ # Application logs
│ ├── repositories/ # Project-specific repository clones
│ │ └── {repo-name}/ # Repository clone for this project
│ │ └── wp-content/ # The actual WordPress content
│ │ ├── themes/
│ │ ├── plugins/
│ │ ├── mu-plugins/
│ │ └── uploads/
│ ├── docker-compose.yml # Project-specific Docker configuration
│ └── project.json # Project metadata
│
├── repositories/ # Central repository storage (Wikit framework)
│ ├── wikit-core/ # Base classes and traits
│ ├── wikit-theme/ # 50+ Gutenberg blocks
│ ├── wikit-facets/ # Faceted search
│ └── wikit-app/ # Application layer
│
├── services/ # Service configurations
│ ├── nginx/ # Nginx proxy config
│ ├── mysql/ # MySQL configuration
│ └── wordpress/ # WordPress base image config
│
├── mcp-server/ # AI tool server
│ └── server.py # FastMCP implementation
│
├── indexer/ # Code indexing pipeline
│ ├── embedder.py # Generates embeddings
│ └── updater.py # Updates vector DB
│
├── cli/ # Command-line tools
│ └── wdg # Main CLI executable
│
├── data/ # Persistent data volumes
│ ├── mysql/ # MySQL database files
│ └── qdrant/ # Vector database files
│
└── docker-compose.yml # Main service orchestrationProjects use repositories as their wp-content directory:
# Create project with Wikit framework
wdg create my-site --init-wikit
# Structure created:
# projects/my-site/repositories/my-site/wp-content/
# ├── themes/
# ├── plugins/
# ├── mu-plugins/
# └── uploads/
# Docker mounts this to container:
# Container path: /var/www/html/wp-content
# Host path: ./projects/my-site/repositories/my-site/wp-contentThis enables:
Important: WordPress core files and database data are stored in Docker volumes, not in the local file system. This provides improved I/O performance and simplified container management.
# 1. Ask AI to search for existing patterns
"Search for custom post type implementations in our codebase"
# 2. AI uses MCP tools
search_codebase("custom post type registration")
search_functions("register_post_type")
search_wikit_blocks("query") # For display blocks
# 3. AI provides implementation following found patterns
"Based on your codebase, here's a custom post type following WDG patterns..."# Ask your AI assistant to search for potential issues
"Search for direct database queries without prepare statements"
"Find instances of echo without escaping"
"Show me POST access without nonce verification"# Find all similar implementations
"Find all form handling code in the codebase"
# AI identifies patterns
search_codebase("form submission handling")
search_wordpress_hooks("admin_post_")
# AI suggests refactoring
"I found 5 different form handling patterns. Here's a unified approach..."Problem: Code changes not appearing in search
# Check indexing status
wdg status
# Manual reindex
wdg my-project index
# Check git hooks
ls -la .git/hooks/post-commitProblem: AI can't access tools
# Verify MCP server
curl http://localhost:8765/health
# Check Docker services
docker-compose ps mcp-server
# Restart MCP
docker-compose restart mcp-serverProblem: Search returning no results
# Check collections
wdg collections list
# Reindex a project
wdg my-project index[ ] System Requirements
[ ] Initial Setup
git clone https://github.com/wdgdc/wdg-ai-dev
cd wdg-ai-dev
./install.sh[ ] Create First Project
wdg create test-site
wdg test-site start[ ] Connect AI Assistant
.cursorrules).claude/settings.json with MCP connection.gemini/settings.json with MCP connection[ ] Verify Knowledge Base
docker-compose logs -f [service]wdg doctor