#!/usr/bin/env python3
"""Generate complete scoring for all 132 pairs."""

import json

# Read roster
with open("C:/Users/decid/AppData/Local/Temp/claude/C--Users-decid-Documents-projects/f6498a32-4d94-4746-9b85-956d8b1953da/scratchpad/dispatch-stage-C/slices/s1c/r078.json", encoding='utf-8') as f:
    roster = json.load(f)

req_lookup = {r['id']: r for r in roster}

# Read pairs
with open("C:/Users/decid/AppData/Local/Temp/claude/C--Users-decid-Documents-projects/f6498a32-4d94-4746-9b85-956d8b1953da/scratchpad/dispatch-stage-C/slices/s1c/q078.tsv", encoding='utf-8') as f:
    pairs = [line.strip().split('\t') for line in f if line.strip()]

# Create comprehensive scores - analyzing all 132 pairs
scores = []

# Manual scores based on careful analysis of requirement pairs
pair_scores = {
    0: (28, "Same family (psyche lifecycle), but distinct: legacy upgrade vs error stamp clearing"),
    1: (18, "Clearly distinct: message routing vs stream lifetime classes"),
    2: (35, "Same family (routing), distinct: rc attach vs rest verb"),
    3: (32, "Same family (UI), distinct: picker display vs rc marker"),
    4: (42, "Adjacent pairing concerns: rate limit vs transcript binding"),
    5: (25, "Same family (hazards), distinct: cascade protection vs single source"),
    6: (15, "Distinct: registry source vs stream lifetime"),
    7: (48, "Adjacent endpoint type concerns: open system vs agent/shell distinction"),
    8: (38, "Same family (endpoint display), distinct: list grouping vs picker"),
    9: (32, "Same family (adapter management), distinct: post-step vs add idempotency"),
    10: (26, "Same family (endpoint model), distinct: unbound attach vs gateway type"),
    11: (38, "Same family (lifecycle), distinct: notification vs stream retirement"),
    12: (42, "Adjacent observability: dispatcher metrics vs delivery visibility"),
    13: (16, "Clearly distinct: startup vs teardown are opposites"),
    14: (34, "Same family (CLI output), distinct: humanization vs VT enable"),
    15: (52, "Adjacent signoff concerns: grace vs echo behavior. Easy to swap."),
    16: (40, "Same family (daemon startup), distinct: net-bind vs stdio handling"),
    17: (22, "Same family (psyche), distinct: optional role skip vs stream evidence"),
    18: (18, "Distinct domains: startup defaults vs UI labeling"),
    19: (65, "Related deferred streams: drain vs survival. Genuinely overlapping."),
    20: (45, "Adjacent state management: effective state derivation vs driven-by self-heal"),
    21: (48, "Adjacent lifecycle concerns: brain rehydrate vs wake/resume handling"),
    22: (28, "Same family (installation), distinct: manifest signing vs manifest structure"),
    23: (29, "Same family (identity), distinct: local control display vs whoami endpoint"),
    24: (36, "Same family (picker), distinct: adapter description vs offline handling"),
    25: (48, "Adjacent listen concerns: seed consumption vs session-id fallback"),
    26: (28, "Same family (architecture), distinct: crate layering vs SDK surface"),
    27: (42, "Adjacent cleanup concerns: stale registry vs soft cleanup. Plausibly confused."),
    28: (32, "Same family (adapter), distinct: live update vs manifest shape"),
    29: (22, "Distinct: info.json updates vs log subscriber discipline"),
    30: (18, "Distinct: message origin vs update idempotency"),
    31: (48, "Adjacent stale concerns: index lock vs registry cleanup. Plausibly confused."),
    32: (25, "Distinct: shell staleness vs installation steps"),
    33: (22, "Same family (install), distinct: package config vs musl platform"),
    34: (26, "Same family (manifest), distinct: update message vs substitution"),
    35: (32, "Same family (shell model), distinct: activity frames vs shell basics"),
    36: (18, "Distinct: daemon restart vs translator liveness"),
    37: (24, "Same family (lifecycle), distinct: spawn collision vs wake/resume"),
    38: (28, "Same family (hosting), distinct: run basics vs resume reaping"),
    39: (42, "Same family (picker), both about display: shortcut numbering vs label"),
    40: (20, "Same family (endpoint types), distinct: infra vs shell"),
    41: (15, "Distinct: API surface vs message parsing safety"),
    42: (24, "Distinct: picker history vs context storage"),
    43: (58, "Related cleanup concerns: soft vs ephemeral. Genuinely overlapping promises."),
    44: (34, "Same family (state truth), distinct: liveness oracle vs custody identity"),
    45: (44, "Adjacent screen concerns: resize geometry vs grid width. Plausibly confused."),
    46: (46, "Adjacent peer concerns: routing chain vs address invariant"),
    47: (38, "Same family (render), distinct: lifecycle vs resize handling"),
    48: (28, "Same family (adapter), distinct: apply safety vs picker flow"),
    49: (40, "Same family (shells), distinct: shell basics vs list provenance"),
    50: (22, "Same family (adapter), distinct: hint form vs installation"),
    51: (18, "Distinct: digest env vs terminal feature"),
    52: (38, "Same family (picker UI), distinct: node grouping vs UX version"),
    53: (48, "Adjacent write concerns: file dropping vs direct write precedence"),
    54: (32, "Same family (hazards), distinct: endpoint lifecycle vs registry staleness"),
    55: (28, "Same family (installation), related steps"),
    56: (35, "Same family (identity display), distinct: list format vs rc identity"),
    57: (46, "Adjacent lifecycle hazards: dead PID vs ghosting. Plausibly confused."),
    58: (22, "Distinct: message payloads vs UI labeling"),
    59: (18, "Distinct: controller lease identity vs terminal"),
    60: (40, "Same family (control state), distinct: gossip vs stamp lifetime"),
    61: (28, "Same family (installation/update), distinct: install vs update"),
    62: (32, "Same family (daemon install), distinct: OS service vs bootstrap"),
    63: (32, "Same family (picker), distinct: offline display vs resume panel"),
    64: (22, "Distinct: psyche hosting vs context storage"),
    65: (40, "Same family (render), distinct: screen grid vs newline handling"),
    66: (48, "Adjacent driven-by concerns: own-node display vs remote eviction"),
    67: (26, "Same family (psyche), distinct: ephemeral driver vs session ID"),
    68: (28, "Same family (harness), distinct: connection lifecycle vs session ID"),
    69: (32, "Same family (endpoint lifecycle), distinct: identity honest vs unbound attach"),
    70: (26, "Same family (update), distinct: brain respawn vs drain drive"),
    71: (28, "Same family (adapter), distinct: update in-place vs install basics"),
    72: (24, "Distinct: online status vs run location"),
    73: (20, "Distinct: installation vs subnet"),
    74: (42, "Related identity concerns: controller lease vs rc identity"),
    75: (22, "Distinct: ConPTY vs file system hazards"),
    76: (28, "Same family (lifecycle), distinct: install vs update"),
    77: (35, "Same family (messaging), distinct: basics vs agent-id stamping"),
    78: (50, "Related purge UI: shortcut vs structured. Plausibly confused."),
    79: (18, "Distinct: adapter message vs delivery state"),
    80: (18, "Distinct: project gossip vs shell"),
    81: (40, "Same family (picker), distinct: features"),
    82: (32, "Same family (registry), distinct: liveness vs replay"),
    83: (24, "Distinct: info.json reads vs presence tracking"),
    84: (36, "Same family (lifecycle), distinct: stamp convergence vs spawn collision"),
    85: (32, "Same family (RC concerns), distinct: own-node vs attach truth"),
    86: (22, "Distinct: viewer cleanup vs session dedup"),
    87: (15, "Distinct: CI vs delivery"),
    88: (22, "Same family (installation), distinct: package vs shell service"),
    89: (15, "Distinct: digest vs pairing"),
    90: (44, "Adjacent state concerns: stamp convergence vs coherence"),
    91: (40, "Same family (lifecycle), distinct: liveness vs stop path"),
    92: (18, "Distinct: PTY vs UI"),
    93: (48, "Adjacent update concerns: clean close vs safe swap. Plausibly confused."),
    94: (28, "Same family (platform), distinct: file ops vs PID handling"),
    95: (22, "Distinct: manifest vs start"),
    96: (18, "Distinct: UI vs update"),
    97: (28, "Same family (hazards), distinct: injection vs PTY"),
    98: (42, "Related messaging: basics vs delivery axes. Plausibly confused."),
    99: (34, "Same family (idempotency), distinct: inbox vs restart"),
    100: (22, "Distinct: PTY wedge vs resize"),
    101: (24, "Distinct: stream lifecycle vs registry"),
    102: (36, "Same family (lifecycle), distinct: stamp lifetime vs spawn"),
    103: (32, "Same family (render), distinct: marker vs repaint"),
    104: (18, "Distinct: install vs shell frames"),
    105: (34, "Same family (UI), distinct: endpoint list vs picker"),
    106: (40, "Same family (init), distinct: registry dir vs store race"),
    107: (18, "Distinct: console vs resize"),
    108: (18, "Distinct: dispatch vs terminal"),
    109: (22, "Distinct: conflict vs charset"),
    110: (36, "Same family (logging/info), distinct: attribution vs filtering"),
    111: (32, "Same family (sessions), distinct: attribution vs auth"),
    112: (28, "Same family (install), related steps"),
    113: (22, "Distinct: display vs messaging"),
    114: (46, "Related resume concerns: brain conn vs wake/resume. Plausibly confused."),
    115: (18, "Distinct: psyche vs picker"),
    116: (28, "Same family (lifecycle), distinct: stop path vs liveness"),
    117: (22, "Distinct: display vs manifest"),
    118: (18, "Distinct: activity vs docs"),
    119: (18, "Distinct: unbound attach vs start"),
    120: (18, "Distinct: install vs translate"),
    121: (18, "Distinct: endpoint messages vs release"),
    122: (18, "Distinct: digest vs terminal"),
    123: (18, "Distinct: inject vs terminal"),
    124: (18, "Distinct: architecture vs handoff"),
    125: (28, "Same family (install), distinct: update vs install"),
    126: (38, "Same family (identity), distinct: endpoint info vs RC identity"),
    127: (42, "Related daemon lifecycle: brain restart vs hosted liveness"),
    128: (22, "Distinct: delivery state vs update finish"),
    129: (36, "Same family (picker), distinct: online action vs project choice"),
    130: (32, "Same family (RC/resume), distinct: reconnect vs unbound stamp"),
    131: (40, "Same family (control/ownership), distinct: steal vs generation"),
}

for idx, (id_a, id_b) in enumerate(pairs):
    if idx in pair_scores:
        score, why = pair_scores[idx]
    else:
        score = 25
        why = "Requires analysis"

    entry = {"a": id_a, "b": id_b, "score": score}
    if score >= 40:
        entry["why"] = why

    scores.append(entry)

# Output as JSON
output = {
    "evaluated": len(scores),
    "pairs": scores
}

import sys
json.dump(output, sys.stdout, indent=2)
