Harness similarity

From ruvnet/ruflo · View interactive version

Harness similarity is an AI agent skill from the GitHub repository ruvnet/ruflo. Weighted similarity (ADR-152) between two harness fingerprints (genome + score JSON): an overall score in [0,1] plus per-component breakdown. Use when comparing two harnesses or detecting drift between them. Pure TypeScript; needs no @metaharness package.

How to use this skill

Skill file

Surfaces the production similarity function from CODE0 as a callable skill. Use when an agent needs to:

Algorithm (from ADR-152 §Decision)

overall = 0.60·cosine + 0.25·categorical + 0.15·jaccard

The 3-component design is load-bearing: numerical cosine alone is too coarse (the iter-35 spike showed LEGAL vs DEVOPS at cosine=0.97 despite being unrelated verticals). Categorical + jaccard pull the composite to the correct ordering.

Reference outputs (iter-35 spike fixtures)

| Pair | overall | cosine | categorical | jaccard |

|---|---:|---:|---:|---:|

| LEGAL × LEGAL (self) | 1.0000 | 1.0000 | 1.0000 | 1.0000 |

| LEGAL × SUPPORT | 0.8296 | 0.9987 | 0.7500 | 0.2857 |

| LEGAL × DEVOPS | 0.5840 | 0.9734 | 0.0000 | 0.0000 |

Both invariants from ADR-152 §"Smallest demonstrable spike" hold:

  1. similarity(X, X) === 1 exactly
  2. similarity(LEGAL, DEVOPS) < similarity(LEGAL, SUPPORT) (vertical affinity)

Architectural constraint inheritance (ADR-150)

Usage

# File inputs
npx ruflo metaharness similarity --a a.json --b b.json

# Memory inputs (records persisted by oia-audit.mjs)
npx ruflo metaharness similarity --a-key harness-X --b-key harness-Y

# Per-dimension breakdown (used by ADR-151 §3.2 Recommender)
npx ruflo metaharness similarity --a a.json --b b.json --per-dimension

# Alert when too-dissimilar (used by ADR-151 §3.3 Drift Detection)
npx ruflo metaharness similarity --a a.json --b b.json --alert-below 0.5

Implementation

Production module: CODE0

CLI skill: CODE0

MCP tool: mcp__plugin_ruflo-core_ruflo__metaharness_similarity (registered in v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts)

Spike anchor: CODE0 (regression suite — invariants locked here)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.