Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

feat(metaharness): MCP tool exposes baselineKey + baselineFile fastpaths (iter 71)

ruv78a7ef54c5fc
diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh
index abf138eee0..f083f21b1a 100755
--- a/plugins/ruflo-metaharness/scripts/smoke.sh
+++ b/plugins/ruflo-metaharness/scripts/smoke.sh
@@ -191,6 +191,21 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \
grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"
[[ -z "$miss" ]] && ok || bad "$miss"
+step "17z34. drift_from_history MCP tool exposes baselineKey + baselineFile (iter 71)"
+miss=""
+WRAPPER="$ROOT/../../v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts"
+grep -q "baselineKey:" "$WRAPPER" 2>/dev/null || miss="$miss no-baseline-key-input"
+grep -q "baselineFile:" "$WRAPPER" 2>/dev/null || miss="$miss no-baseline-file-input"
+grep -q "args.push('--baseline-key'" "$WRAPPER" 2>/dev/null || miss="$miss no-baseline-key-arg-push"
+grep -q "args.push('--baseline-file'" "$WRAPPER" 2>/dev/null || miss="$miss no-baseline-file-arg-push"
+# Description mentions both fastpath multipliers
+grep -q "14x faster" "$WRAPPER" 2>/dev/null || miss="$miss no-14x-mention"
+grep -q "19x faster" "$WRAPPER" 2>/dev/null || miss="$miss no-19x-mention"
+# Phase 4 test exercises the new MCP-layer fastpath
+T="$ROOT/scripts/test-mcp-tools.mjs"
+grep -q "MCP-layer: baselineFile fastpath fires" "$T" 2>/dev/null || miss="$miss no-mcp-fastpath-test"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
step "17z33. weekly cron drift detection fires even on audit failure (iter 70)"
miss=""
F="$ROOT/../../.github/workflows/oia-audit-weekly.yml"
diff --git a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
index b9e3a927fa..6162c694f4 100755
--- a/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
+++ b/plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
@@ -316,6 +316,28 @@ async function main() {
// iter 54 β€” metaharness_drift_from_history positive case
const driftTool = tools.find((t) => t.name === 'metaharness_drift_from_history');
if (driftTool) {
+ // iter 71 β€” verify iter-66/67 fast-path flags are now MCP-callable
+ // Synthesize a baseline file on disk; pass via the new baselineFile input.
+ const baselinePath = pjoin(tmp, 'drift-baseline.json');
+ writeFileSync(baselinePath, JSON.stringify({
+ startedAt: '2026-06-16T00:00:00Z',
+ composite: { worst: 'clean' },
+ components: { oiaManifest: {}, threatModel: {}, mcpScan: { json: { findings: [] } } },
+ fingerprint: {
+ score: { harnessFit: 82, recommendedMode: 'CLI + MCP', archetype: 'typescript-sdk-harness', template: 'vertical:coding' },
+ genome: { repo_type: 'node_mcp_ci', agent_topology: ['m', 't'], risk_score: 0.3 },
+ },
+ }));
+ const rFastFast = await driftTool.handler({
+ path: '.', dryRun: true, threshold: 0.5, baselineFile: baselinePath,
+ });
+ if (!rFastFast.degraded) {
+ assert(rFastFast.data?.timing?.usedBaselineFile === true,
+ 'drift_from_history MCP-layer: baselineFile fastpath fires (iter 71)');
+ assert(rFastFast.data?.timing?.skippedAuditList === true,
+ 'drift_from_history MCP-layer: skippedAuditList=true via baselineFile (iter 71)');
+ }
+
const r54 = await driftTool.handler({ path: '.', dryRun: true, threshold: 0.5 });
if (!r54.degraded) {
assert(typeof r54.data === 'object' && r54.data !== null,
diff --git a/v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts
index 51b5d38349..424d01bc4a 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts
@@ -292,13 +292,15 @@ export const metaharnessTools: MCPTool[] = [
},
{
name: 'metaharness_drift_from_history',
- description: 'iter 53 β€” one-command drift detection. Composes audit-list + oia-audit + audit-trend: finds the most recent record in `metaharness-audit` namespace, runs a fresh audit against the current path, diffs via ADR-152 Β§3.1 similarity, alerts when structural similarity falls below `threshold`. Use BEFORE recommending the user act on drift β€” this returns a structured report rather than requiring 3 separate tool calls. ' + MCP_SUCCESS_SEMANTIC,
+ description: 'iter 53 β€” one-command drift detection. Composes audit-list + oia-audit + audit-trend: finds the most recent record in `metaharness-audit` namespace (or skips that with `baselineKey`/`baselineFile`), runs a fresh audit against the current path, diffs via ADR-152 Β§3.1 similarity, alerts when structural similarity falls below `threshold`. Use BEFORE recommending the user act on drift β€” this returns a structured report rather than requiring 3 separate tool calls. Iter 66+67 added fastpaths: `baselineKey` skips audit-list (~14x faster); `baselineFile` skips both audit-list AND memory roundtrip (~19x faster, ideal for CI artifact pipelines). ' + MCP_SUCCESS_SEMANTIC,
category: 'metaharness',
inputSchema: {
type: 'object',
properties: {
path: { type: 'string', description: 'Repo path to audit (default: cwd)', default: '.' },
baselineSince: { type: 'string', description: 'Use a baseline at least N(h|d|w) old, e.g. "7d" β€” skips drift against ultra-recent audits' },
+ baselineKey: { type: 'string', description: 'iter 66 β€” explicit memory key for the baseline audit. Skips audit-list (no ONNX warmup). Get from `metaharness_audit_list` first.' },
+ baselineFile: { type: 'string', description: 'iter 67 β€” file path to a saved oia-audit JSON. Skips audit-list AND memory roundtrip. Ideal for CI artifact pipelines (e.g., comparing this run vs a downloaded prior-run artifact).' },
threshold: { type: 'number', description: 'Alert when structural similarity < N. Default 0.95.', default: 0.95 },
dryRun: { type: 'boolean', description: 'Skip persisting the fresh audit to memory', default: false },
},
@@ -307,6 +309,8 @@ export const metaharnessTools: MCPTool[] = [
const args: string[] = [];
args.push('--path', String(input.path ?? '.'));
if (input.baselineSince) args.push('--baseline-since', String(input.baselineSince));
+ if (input.baselineKey) args.push('--baseline-key', String(input.baselineKey));
+ if (input.baselineFile) args.push('--baseline-file', String(input.baselineFile));
if (input.threshold !== undefined) args.push('--threshold', String(input.threshold));
if (input.dryRun === true) args.push('--dry-run');
const r = await runScript('drift-from-history.mjs', args);