plugins/ruflo-metaharness/skills/harness-similarity/SKILL.md
Surfaces the production similarity function from scripts/_similarity.mjs as a callable skill. Use when an agent needs to:
overall = 0.60·cosine + 0.25·categorical + 0.15·jaccard
repo_type, archetype, template, recommendedMode)|A ∩ B| / |A ∪ B| over the agent_topology[] arrayThe 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.
| 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:
similarity(X, X) === 1 exactlysimilarity(LEGAL, DEVOPS) < similarity(LEGAL, SUPPORT) (vertical affinity)@metaharness/* imports.package.json.{ degraded: true, reason } with exit code 2; never throws.# 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
Production module: scripts/_similarity.mjs
CLI skill: scripts/similarity.mjs
MCP tool: mcp__claude-flow__metaharness_similarity (registered in v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts)
Spike anchor: scripts/_spike-similarity.mjs (regression suite — invariants locked here)