I was knee-deep in a custom WooCommerce inventory sync for a client last month. Nearly 50k SKUs, plus several custom database tables for logging and delta tracking. I pointed a new AI coding agent at it to write a cleanup script for the sync logs, and the result was a mess. It kept inventing table names like wp_sync_records when the real table was wp_bbioon_inventory_delta. With no context, the agent was a blindfolded intern holding a chainsaw. That is the part of Effective AI Programming people skip: the prompt matters far less than the data you hand over.
My first instinct was to give the agent SSH access and let it “explore” the codebase. Rookie move. It burned thousands of tokens listing directories, hit rate limits, and still had no idea why our business logic worked the way it did, like why we only purge logs that are not flagged as ‘critical’. An agent without a map takes the most expensive route to the wrong destination. A WordPress MCP adapter closes that gap for a lot less.
A markdown schema file for effective AI programming
Context engineering fixes most of this. Rather than letting the AI guess at your infrastructure, you give it one compressed source of truth. I now keep an INFRA.md file in the project root holding the schema for custom tables, the S3 bucket prefixes, and the production log locations. The agent stops guessing and starts working from what is actually there. Most devs skip this, even though it is the whole point of effective context engineering.
/**
* A helper script to generate a context-rich Markdown file
* for your AI coding agent to read.
*/
function bbioon_generate_ai_context_file() {
$tables = [
'bbioon_inventory_delta',
'bbioon_sync_logs'
];
$output = "# Project Database Schema\n\n";
foreach ( $tables as $table ) {
global $wpdb;
$full_table = $wpdb->prefix . $table;
$columns = $wpdb->get_results( "DESCRIBE $full_table" );
$output .= "## Table: $full_table\n";
foreach ( $columns as $column ) {
$output .= "- {$column->Field} ({$column->Type})\n";
}
$output .= "\n";
}
file_put_contents( ABSPATH . 'AGENTS.md', $output );
}
When the agent starts listing tables over and over, or reasoning out loud about which file to open, that is a context problem. Do not let it loop. Stop the generation, update AGENTS.md or PROJECT.md, and tell it to re-index. You save tokens, and you save your own patience. If you are tired of “vibe coding” your way through errors, I wrote about why you should stop vibe coding your next WordPress project.
The context nobody writes down
Half of our technical decisions happen in meetings or casual Slack threads, and the AI is not in the room. If the team agreed that the summarization feature only runs for external attendees, the agent will never know until somebody types it out. I have started summarizing my own technical shaping meetings and dropping those notes straight into the project’s context window. Linking tools like Linear to the agent through the Model Context Protocol (MCP) helps here as well.
This gets complicated fast. Agents are powerful, but they only know what you have handed them. If you are tired of debugging someone else’s mess and you just want your site working with AI assistance that does not fight you, drop me a line. I have probably seen it before. Towards Data Science has a longer piece on agent facilitation if you want to keep reading.
What actually helped
- Write the technical details down. If it is not in a file, the agent does not know it.
- Keep one schema file. It stops the agent exploring and burning tokens.
- Summarize the meetings. Decisions made out loud belong in the codebase as markdown.
- Watch for repeats. When the agent asks the same question twice, something is missing from its context.
Treat the agent like a junior developer with perfect recall and no instincts. You would not drop a junior into a 50k SKU WooCommerce site without a map, so do not do it to the agent either.