auth-yes/.forum/poc-g1/orchestration_matrix_poc.ts

99 lines
2.9 KiB
TypeScript

/**
* Agent Forum v4 - Orchestration Matrix PoC
*
* Verifies the programmatic definition and interaction of the 6 core
* agent roles (Gatekeeper, Historian, Adversary, Translator, Analyst, Evaluator)
* with their specific inputs and outputs.
*/
// Define the Orchestration Matrix
const OrchestrationMatrix = {
"Gatekeeper": {
inputs: ["Ontologies", "YAML DAGs"],
outputs: ["Verification checklists"],
directive: "Bridge human requirements with technical reality.",
},
"Historian": {
inputs: ["sqlite-vec", "Git Notes"],
outputs: ["Contextual injection"],
directive: "Prevent regression and historical repetition.",
},
"Adversary": {
inputs: ["SCIP graphs", "CFGs", "Mutation", "OTel Traces"],
outputs: ["Edge-case tests", "mutations", "bottlenecks"],
directive:
"Expose security flaws, enforce test coverage, and identify execution bottlenecks.",
},
"Translator": {
inputs: ["SCIP diffs", "existing docs"],
outputs: ["API references", "guides"],
directive: "Maintain code-to-documentation parity.",
},
"Analyst": {
inputs: ["Telemetry", "PR threads"],
outputs: ["Workflow optimizations", "Protocol updates"],
directive: "Optimize human-to-agent collaboration.",
},
"Evaluator": {
inputs: ["transitions.json", "DAGs"],
outputs: ["Pipeline progression"],
directive: "Govern pipeline integrity (R/W access to meta-state).",
},
};
function runPoC() {
console.log("Running Orchestration Matrix PoC tests...\n");
// Simulate an agent pipeline request
const requestedTask = "Generate tests for a new database query method.";
// The system determines the appropriate agent based on inputs/outputs
console.log(`Task: "${requestedTask}"`);
console.log("Routing task based on Orchestration Matrix...\n");
let selectedAgent = null;
for (const [role, definition] of Object.entries(OrchestrationMatrix)) {
if (
definition.outputs.some((out) =>
out.includes("tests") || out.includes("bottlenecks") ||
out.includes("mutations")
)
) {
selectedAgent = role;
break;
}
}
if (selectedAgent === "Adversary") {
console.log(`✅ Correctly routed to: ${selectedAgent}`);
console.log(
` Inputs allowed: ${
OrchestrationMatrix[selectedAgent].inputs.join(", ")
}`,
);
console.log(
` Expected Outputs: ${
OrchestrationMatrix[selectedAgent].outputs.join(", ")
}`,
);
console.log(
` Primary Directive Enforced: ${
OrchestrationMatrix[selectedAgent].directive
}\n`,
);
console.log(
"✅ Orchestration Matrix PoC successful: Agents logically constrained to defined roles and I/O boundaries.",
);
} else {
console.error(
`❌ Routing failed. Expected 'Adversary', got '${selectedAgent}'`,
);
Deno.exit(1);
}
}
if (import.meta.main) {
runPoC();
}