"""Cross-task sameness lint (R2, SPEC 7.6 item 3), run over a build after its tasks are built. Every piece of prose a task carries is filed under the text it came from: a card's ticket, thread, postmortem or runbook under the card (`H04`, `R06`, `survey:H08`, ...), README, ADRs, service runbooks and the handover under `house`, the split paragraph under `split`. Names, alerts, keys, numbers and times are masked (the way `review-v02/scratch-realism/rep.py` does it). Two checks: - no masked sentence appears in more than a third (rounded up) of the tasks that carry its text; - word 6-grams of instruction plus incident prose: the largest pairwise Jaccard over the tasks (SPEC: <= 0.10 over the public 12; reported here for the whole build). `render(family, seed)` builds a task's text without promtool, so tests and the CLI can lint a block quickly. """ from __future__ import annotations import itertools import math import random import re from collections import defaultdict STRUCT = re.compile(r"^\s*(#|\|[-: |]+\|\s*$|---\s*$|```|alerts: \[|