Skip to content

Collapse duplication hand-synced across N sites

Enumerate every copy exhaustively before deleting any of them — N-1 of N collapsed copies is worse than none.

Also usessuperpowers

N byte-identical copies kept in step by hand is a defect with a countdown. The trap is that collapsing them looks trivial, and the risk lives entirely in the sites that were about to diverge.

Start here

One prompt to start
There are multiple hand-synced copies of this file -- find every single one and everything that references them before deleting anything, pin down the shared behavior they all carry with tests while every copy still exists, and prove afterward that every consumer of the old copies still behaves the same, not just that the imports still resolve.

Needscompass, superpowers, confab, andon

Beats

Run these in order. Each prompt is copy-pasteable straight into Claude Code.

  1. compass:compass-map-relationshipsalso in 4 other recipes

    Collapsing N-1 of N copies is worse than collapsing none; the enumeration must be exhaustive before the first deletion.

    Run this beat on its own
    prompt
    find every copy of this file and every place that references any of them — I want the complete list before we delete anything
  2. superpowers:test-driven-developmentalso in 3 other recipes

    The shared contract is only observable while all copies still exist.

    Run this beat on its own
    prompt
    before we collapse these copies, write tests that pin the behavior all of them share
  3. confab:confab-contract-driftalso in 3 other recipes

    Consolidation silently changes which signature is authoritative.

  4. andon:andon-verifyalso in 13 other recipes

    "All consumers still work" is a contract, and a green import is not evidence for it.

    Run this beat on its own
    prompt
    prove the wire: after consolidation, every consumer of the old copies still gets the same behavior

Worked example

Grounded in — why this beat order is trustworthy

five plugins each carry a `scripts/build_symbol_index.py` that is byte-identical to `tools/symbol-indexer/build_symbol_index.py` (all six share MD5 `1401d8e53d60aaffeab46c1d0cfc05b6`), and only the canonical copy has a test suite — `tools/symbol-indexer/test_build_symbol_index.py`, which is what `plugin-checks.yml` runs.

Do / Don't

  • Enumerate every copy and everything that references any of them, exhaustively, before deleting the first one.
  • Write tests that pin the shared behavior while all the copies still exist -- the shared contract stops being observable once they're gone.
  • Check for contract drift after consolidation -- which signature becomes authoritative can change silently.
  • Prove every consumer still gets the same behavior with andon-verify -- a green import is not evidence for that.
  • Don't collapse copies before the enumeration is exhaustive -- N-1 of N collapsed is worse than none, because the drift becomes invisible.
  • Don't wait until after consolidation to pin the shared behavior down -- it's only observable while every copy still exists.
  • Don't trust a green import as proof that every consumer still works -- that's the exact claim andon-verify has to prove instead of assume.