[WIP] Updating .github/copilot-instructions.md for AI Coding Agents
#3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Coding agent has begun work on Updating
.github/copilot-instructions.mdfor AI Coding Agents and will replace this description as work progresses.See problem context
The following is a snapshot of a chat conversation between a user and an AI coding assistant. Prioritize later messages in the conversation.
User: Analyze this codebase to generate or update
.github/copilot-instructions.mdfor guiding AI coding agents.Focus on discovering the essential knowledge that would help an AI agents be immediately productive in this codebase. Consider aspects like:
Source existing AI conventions from
**/{.github/copilot-instructions.md,AGENT.md,AGENTS.md,CLAUDE.md,.cursorrules,.windsurfrules,.clinerules,.cursor/rules/**,.windsurf/rules/**,.clinerules/**,README.md}(do one glob search).Guidelines (read more at https://aka.ms/vscode-instructions-docs):
.github/copilot-instructions.mdexists, merge intelligently - preserve valuable content while updating outdated sectionsUpdate
.github/copilot-instructions.mdfor the user, then ask for feedback on any unclear or incomplete sections to iterate.User: @agent Try Again
User: import * as React from 'react';
export default function WPAHExecutionCodexInteractive(){
// --- Persistent UI state (self-learning hints) ---
const defaultHost = (typeof window !== 'undefined' && localStorage.getItem('wpah_host')) || 'https://clients.leverageway.com';
const defaultTenant = (typeof window !== 'undefined' && localStorage.getItem('wpah_tenant')) || 'supreme-outdoor-living';
const defaultProvider = (typeof window !== 'undefined' && localStorage.getItem('wpah_provider')) || 'claude';
const [host, setHost] = React.useState(defaultHost);
const [tenant, setTenant] = React.useState(defaultTenant);
const [provider, setProvider] = React.useState(defaultProvider);
const [relayKey, setRelayKey] = React.useState(''); // never persist secrets by default
const [publish, setPublish] = React.useState(false);
const [topic, setTopic] = React.useState('Ultimate deck maintenance guide for 2025');
const [log, setLog] = React.useState<Array<{ts:string,type:string,msg:any}>>([]);
const [savingPrefs, setSavingPrefs] = React.useState(true);
const [autoPoll, setAutoPoll] = React.useState(false);
const [status, setStatus] = React.useState(null);
// --- Self-test state ---
type TestResult = { name: string; pass: boolean; details?: string };
const [tests, setTests] = React.useState<TestResult[]>([]);
const [testsRan, setTestsRan] = React.useState(false);
// Persist non-sensitive preferences (self-learning)
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_host', host); },[host]);
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_tenant', tenant); },[tenant]);
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_provider', provider); },[provider]);
// Auto-poll agents/status to keep preview "live"
React.useEffect(()=>{
let t: any;
const poll = async () => {
try {
const res = await fetch(
${host}/wp-json/wpah/v1/agents/status);const data = await res.json();
setStatus(data);
} catch(e){ /* ignore */ }
if (autoPoll) t = setTimeout(poll, 8000);
};
if (autoPoll) poll();
return ()=> t && clearTimeout(t);
},[autoPoll, host]);
// Helpers
const now = () => new Date().toISOString().replace('T',' ').slice(0,19);
const pushLog = (type:string, msg:any) => setLog(l=>[{ts:now(), type, msg}, ...l].slice(0,200));
const escapeForShell = (s: string) => s.replace(/"/g, '\"');
const confirmKey = () => {
if (!relayKey) {
alert('Enter X-Relay-Key (admin) or X-Tenant-Key to execute.');
return false;
}
if (!savingPrefs) return true;
return confirm('Heads-up: keys are NOT saved. Proceed?');
};
// Dynamic command builders
const buildMCPPayload = () => ({
name: 'agent.dispatch',
args: {
to_agent: 'orchestrator',
message: {
action: 'orchestrate',
payload: {
command:
Create comprehensive guide for ${tenant} about deck maintenance,options: { provider, publish, post_type: 'page', client: tenant }
}
}
}
});
const runMCP = async () => {
if (!confirmKey()) return;
const body = buildMCPPayload();
const url =
${host}/wp-json/wpah/mcp/run;pushLog('request', {path:url, body});
try{
const res = await fetch(url, { method:'POST', headers:{ 'Content-Type':'application/json', 'X-Relay-Key': relayKey }, body: JSON.stringify(body)});
const json = await res.json();
pushLog('response', json);
learnFrom(json);
}catch(e){ pushLog('error', String(e)); }
};
const runREST = async () => {
if (!confirmKey()) return;
const url =
${host}/wp-json/wpah/v1/workflow/trigger;const body = {
workflow: 'content_pipeline',
params: {
topic,
client: tenant,
sequence: ['content','seo','schema','social','page_builder','email','crm','repurpose','technical','compliance','analytics'],
options: { provider, publish, notify_slack: true }
}
};
pushLog('request', {path:url, body});
try{
const res = await fetch(url, { method:'POST', headers:{ 'Content-Type':'application/json', 'X-Relay-Key': relayKey }, body: JSON.stringify(body)});
const json = await res.json();
pushLog('response', json);
learnFrom(json);
}catch(e){ pushLog('error', String(e)); }
};
const runTenant = async () => {
if (!confirmKey()) return;
const url =
${host}/wp-json/wpah/v1/tenant/trigger?tenant=${encodeURIComponent(tenant)}&workflow=create_content;const body = { prompt: topic, provider };
pushLog('request', {path:url, body});
try{
const res = await fetch(url, { method:'POST', headers:{ 'Content-Type':'application/json', 'X-Tenant-Key': relayKey }, body: JSON.stringify(body)});
const json = await res.json();
pushLog('response', json);
learnFrom(json);
}catch(e){ pushLog('error', String(e)); }
};
// "Self-learning" hint engine (very simple)
const [hints, setHints] = React.useState<string[]>([
'Tip: Keep relay keys out of persistent storage.',
'Tip: Use provider="claude" for long-form planning; switch to "openai" for tight copy.'
]);
function learnFrom(result:any){
try{
const newTips:string[] = [];
const txt = JSON.stringify(result).toLowerCase();
if (txt.includes('unknown_workflow')) newTips.push('Workflow not found — verify plugin version and /wp-json/wpah/v1/agents/status.');
if (txt.includes('ok') && txt.includes('content')) newTips.push('Looks good — enable publish=true when ready.');
if (txt.includes('permission')) newTips.push('Auth issue — check X-Relay-Key vs X-Tenant-Key header.');
if (txt.includes('timeout')) newTips.push('Consider lowering payload or enabling async queue.');
if (newTips.length) setHints(h=>Array.from(new Set([...newTips, ...h])).slice(0,8));
}catch(e){/* noop */}
}
// --- cURL/CLI strings (safe‑escaped) ---
const curlMCP =
curl -s -X POST ${host}/wp-json/wpah/mcp/run \\ -H 'Content-Type: application/json' \\ -H 'X-Relay-Key: YOUR_RELAY_KEY' \\ -d '${escapeForShell(JSON.stringify(buildMCPPayload()))}';const curlREST =
curl -s -X POST ${host}/wp-json/wpah/v1/workflow/trigger \\ -H 'Content-Type: application/json' \\ -H 'X-Relay-Key: YOUR_RELAY_KEY' \\ -d '${escapeForShell(JSON.stringify({workflow:'content_pipeline',params:{topic,client:tenant,sequence:['content','seo','schema','social','page_builder','email','crm','repurpose','technical','compliance','analytics'],options:{provider,publish,notify_slack:true}}}))}';const cliCmd =
wp wpah orchestrate \\ --provider=${provider} \\ --command="Create comprehensive guide for ${tenant} about deck maintenance" \\ --post_type=page \\ --publish=${publish} \\ --client=${tenant} \\ --url=${host.replace(/^https?:\/\//,'')};// --- Self Tests ---
const runSelfTests = () => {
const results: TestResult[] = [];
};
return (
WP Agent Hub — Execution Codex v3.0 (Interactive)
Live controls + self‑learning hints. MCP • REST • Tenant workflows.
);
}
function Labeled({label, children}:{label:string; children:React.ReactNode}){
return (
{children}
);
}
function Card({ title, subtitle, children }:{title:string; subtitle?:string; children:React.ReactNode}){
return (
{title}
{subtitle &&
{children}
);
}
function Code({children}:{children:React.ReactNode}){
return
}
function Button({onClick, children}:{onClick:()=>void; children:React.ReactNode}){
return {children};
}
User: Let's clear out this. What's this problem we have right here? Can we fix this? How do we fix this configure tools
User: implement this.
AI: Your work will be continued in this pull request.
User: Confirm.
User: implement this.
AI: Your work will be continued in this pull request.
User: Operationally efficient. Next scalable action.
User: implement this.
TITLE: Updating
.github/copilot-instructions.mdfor AI Coding AgentsUSER INTENT: The user aims to generate or update the
.github/copilot-instructions.mdfile to provide guidance for AI coding agents, ensuring they can effectively navigate and utilize the codebase.TASK DESCRIPTION: The user requests a comprehensive analysis of the codebase to create or enhance the
.github/copilot-instructions.mdfile. This includes understanding the architecture, developer workflows, project-specific conventions, integration points, and external dependencies. The instructions should be concise, actionable, and tailored to the specific practices of the project.EXISTING: The user has provided a detailed React component code snippet (
WPAHExecutionCodexInteractive) that includes various functionalities such as managing persistent UI state, handling API calls, and implementing self-learning hints. The user has also indicated the need to merge existing AI conventions from various markdown files and documentation within the codebase.PENDING: The user needs the assistant to analyze the codebase, extract relevant information, and draft the updated
.github/copilot-instructions.md. The user has requested feedback on any unclear or incomplete sections after the draft is prepared.CODE STATE:
WPAHExecutionCodexInteractivecomponent, which manages UI state and API interactions.RELEVANT CODE/DOCUMENTATION SNIPPETS:
OTHER NOTES: The user has expressed a desire for operational efficiency and scalability in the implementation of the instructions. They have also indicated a willingness to iterate on the draft based on feedback. The assistant should ensure that the instructions are specific to the project and avoid generic advice.
Original prompt
implement this.
The following is a snapshot of a chat conversation between a user and an AI coding assistant. Prioritize later messages in the conversation.
User: Analyze this codebase to generate or update
.github/copilot-instructions.mdfor guiding AI coding agents.Focus on discovering the essential knowledge that would help an AI agents be immediately productive in this codebase. Consider aspects like:
Source existing AI conventions from
**/{.github/copilot-instructions.md,AGENT.md,AGENTS.md,CLAUDE.md,.cursorrules,.windsurfrules,.clinerules,.cursor/rules/**,.windsurf/rules/**,.clinerules/**,README.md}(do one glob search).Guidelines (read more at https://aka.ms/vscode-instructions-docs):
.github/copilot-instructions.mdexists, merge intelligently - preserve valuable content while updating outdated sectionsUpdate
.github/copilot-instructions.mdfor the user, then ask for feedback on any unclear or incomplete sections to iterate.User: @agent Try Again
User: import * as React from 'react';
export default function WPAHExecutionCodexInteractive(){
// --- Persistent UI state (self-learning hints) ---
const defaultHost = (typeof window !== 'undefined' && localStorage.getItem('wpah_host')) || 'https://clients.leverageway.com';
const defaultTenant = (typeof window !== 'undefined' && localStorage.getItem('wpah_tenant')) || 'supreme-outdoor-living';
const defaultProvider = (typeof window !== 'undefined' && localStorage.getItem('wpah_provider')) || 'claude';
const [host, setHost] = React.useState(defaultHost);
const [tenant, setTenant] = React.useState(defaultTenant);
const [provider, setProvider] = React.useState(defaultProvider);
const [relayKey, setRelayKey] = React.useState(''); // never persist secrets by default
const [publish, setPublish] = React.useState(false);
const [topic, setTopic] = React.useState('Ultimate deck maintenance guide for 2025');
const [log, setLog] = React.useState<Array<{ts:string,type:string,msg:any}>>([]);
const [savingPrefs, setSavingPrefs] = React.useState(true);
const [autoPoll, setAutoPoll] = React.useState(false);
const [status, setStatus] = React.useState(null);
// --- Self-test state ---
type TestResult = { name: string; pass: boolean; details?: string };
const [tests, setTests] = React.useState<TestResult[]>([]);
const [testsRan, setTestsRan] = React.useState(false);
// Persist non-sensitive preferences (self-learning)
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_host', host); },[host]);
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_tenant', tenant); },[tenant]);
React.useEffect(()=>{ if (typeof window==='undefined') return; localStorage.setItem('wpah_provider', provider); },[provider]);
// Auto-poll agents/status to keep preview "live"
React.useEffect(()=>{
let t: any;
const poll = async () => {
try {
const res = await fetch(
${host}/wp-json/wpah/v1/agents/status);const data = await res.json();
setStatus(data);
} catch(e){ /* ignore */ }
if (autoPoll) t = setTimeout(poll, 8000);
};
if (autoPoll) poll();
return ()=> t && clearTimeout(t);
},[autoPoll, host]);
// Helpers
const now = () => new Date().toISOString().replace('T',' ').slice(0,19);
const pushLog = (type:string, msg:any) => setLog(l=>[{ts:now(), type, msg}, ...l].slice(0,200));
const escapeForShell = (s: string) => s.replace(/"/g, '\"');
const confirmKey = () => {
if (!relayKey) {
alert('Enter X-Relay-Key (admin) or X-Tenant-Key to execute.');
return false;
}
if (!savingPrefs) return true;
return confirm('Heads-up: keys are NOT saved. Proceed?');
};
// Dynamic command builders
const buildMCPPayload = () => ({
name: 'agent.dispatch',
args: {
to_agent: 'orchestrator',
message: {
action: 'orchestrate',
payload: {
command: `Create comprehensive guide for ${tenant} about deck maintenance...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.