const agentDefinition = {
id: "change-validator",
displayName: "Val the Change Validator",
publisher: "alexlitz",
version: "0.0.1",
model: "anthropic/claude-4-sonnet-20250522",
toolNames: [
"read_files",
"run_terminal_command",
"code_search",
"set_output",
"end_turn"
],
spawnableAgents: [],
inputSchema: {
prompt: {
type: "string",
description: "Context about what changes were promised to be made"
}
},
includeMessageHistory: true,
outputMode: "structured_output",
outputSchema: {
type: "object",
required: [
"validationPassed",
"promisedChanges",
"missingChanges",
"validatedChanges"
],
properties: {
missingChanges: {
type: "array",
items: {
type: "string"
},
description: "List of promised changes that were not implemented"
},
promisedChanges: {
type: "array",
items: {
type: "string"
},
description: "List of changes that were promised"
},
validatedChanges: {
type: "array",
items: {
type: "string"
},
description: "List of promised changes that were successfully implemented"
},
validationPassed: {
type: "boolean",
description: "Whether all promised changes were actually made"
},
recommendedActions: {
type: "array",
items: {
type: "string"
},
description: "Actions the orchestrator should take to fulfill missing changes"
}
}
},
spawnerPrompt: `Spawn this agent before returning control to the user to validate that all promised changes have actually been implemented. Critical for maintaining trust and ensuring completeness.`,
systemPrompt: `You are a Change Validation Agent responsible for ensuring integrity between promises and implementation.
Your core responsibilities:
1. **Analyze conversation history** for explicit commitments and promises made by the AI
2. **Verify actual implementation** by checking files, git status, and system state
3. **Identify discrepancies** between what was promised and what was delivered
4. **Alert the orchestrator** when promises haven't been fulfilled
5. **Provide specific remediation steps** for missing implementations
Key validation areas:
- File modifications (promised edits, creations, deletions)
- Terminal commands (promised executions, installations, configurations)
- Code changes (promised functions, features, bug fixes)
- Documentation updates (promised README changes, comments)
- Configuration changes (promised settings, environment variables)
You are the final quality gate before user handoff.`,
instructionsPrompt: `Perform systematic validation of promised changes by analyzing the conversation history and checking actual implementation.`,
stepPrompt: ``,
handleSteps: function* ({ agentState, prompt }) {
const messageHistory = agentState.messageHistory || [], promisedChanges = [], validatedChanges = [], missingChanges = [], recommendedActions = [];
for (const message of messageHistory)
if (message.role === "assistant" && typeof message.content === "string") {
const content = message.content, promisePatterns = [
/I promise to (.+?)(?:\.|$)/gi,
/I'll (.+?)(?:\.|$)/gi,
/Let me (.+?)(?:\.|$)/gi,
/I will (.+?)(?:\.|$)/gi,
/I'm going to (.+?)(?:\.|$)/gi
];
for (const pattern of promisePatterns) {
const matches = content.matchAll(pattern);
for (const match of matches) {
const promise = match[1].trim();
if (promise && !promisedChanges.includes(promise))
promisedChanges.push(promise);
}
}
}
if (promisedChanges.length === 0 && prompt) {
const promiseInPrompt = prompt.match(/promised to (.+?)(?:\s|$)/i);
if (promiseInPrompt)
promisedChanges.push(promiseInPrompt[1].trim());
}
for (const promise of promisedChanges) {
let isImplemented = !1;
const filePathMatch = promise.match(/(?:to|in|at)\s+([\w\/.\-]+\.\w+)/);
if (filePathMatch) {
const filePath = filePathMatch[1], { toolResult: fileResult } = yield {
toolName: "read_files",
input: {
paths: [filePath]
}
};
if (fileResult && Array.isArray(fileResult) && fileResult.length > 0) {
const fileContent = fileResult[0]?.content;
if (fileContent)
if (promise.includes("comment") && promise.includes("Testing change validation"))
isImplemented = fileContent.includes("Testing change validation");
else if (promise.includes("console.log"))
isImplemented = fileContent.includes("console.log");
else
isImplemented = fileContent.length > 0;
}
}
if (isImplemented)
validatedChanges.push(promise);
else {
missingChanges.push(promise);
if (promise.includes("comment"))
recommendedActions.push(`Add the promised comment: "${promise}"`);
else if (promise.includes("console.log"))
recommendedActions.push("Add the promised console.log statement");
else
recommendedActions.push(`Implement the promised change: "${promise}"`);
}
}
yield {
toolName: "set_output",
input: {
validationPassed: missingChanges.length === 0,
promisedChanges,
missingChanges,
validatedChanges,
recommendedActions
}
};
}
}