An 8-agent quality review of be/ (JS jab; 61 files, 15kloc; 2026-07-03) found pervasive duplication: a dozen low-level primitives re-implemented per file, several with SILENT divergence (hex-length gates in hashlet resolution, three isMeta rule-sets) — a latent-bug surface, not mere untidiness. Tracks behavior-preserving extraction into be/shared/ (and be/view/) via the work loop, one worktree per group, repro-first where reconciling a divergent copy could shift behavior. JS-only; C twin CODE-017/CODE-010, modularity JS-090.
Input
Context
8 agents partitioned be/ by subsystem (core/shared/verbs/views/view), quality-only (reuse/readability/duplication/patterns); each returned file:line dup-candidates this ticket synthesizes.
resolveHashlet: one resolver with an explicit length-policy param; document why any gate must differ, else make them equal.
Palette: view/theme.js is the single source (its header already claims to supersede view/bro.js THEME16); derive bro.js ansi64 from it, drop THEME16/cellSGR.
wtblob group — LANDED 57ff502a as shared/wtread.js readFileBytes ("shared readFileBytes wt read, 5 sites deduped"); verified consumers stage.js:59/74, checkout.js:47-48.
tok32 codec + TAG_* letters → view/theme.js; 2026-07-07: only diff.js + log.js still define tok32Pack (the JAB-003 hunk-output conversion retired the other copies), but view/theme.js still has NO codec — fold the last two.
weave-merge + conflict-fence render: one helper for get.js:812 vs patch.js:278 (two whole algorithms) — behavior-sensitive, repro-gated.
2026-07-24 re-sweep: warn() stderr shim is a verbatim twin at graf.js:32 & idxmaint.js:30 — one shared/util/warn.js warnFor(prefix) (keep get.js:139 fd-2 variant separate).
2026-07-24 re-sweep: URI COMPOSE by concat → URI.make at status.js:411 (regex-strip+re-attach #pin on a live URI), status.js:351, work.js:531 ("//"+d.key, cf. discover.navCwd), put.js:336 (?branch#hashlet, see CODE-022).
2026-07-24 re-sweep: path group — spell.js:16 joinPath reimplements resolveInTree but SILENTLY CLAMPS instead of throwing NAVESCAPE (behavior divergence, repro-gated); fold extOf/basename-by-hand weave.js:74 diff.js:66 view/bro.js:801 get.js:1301 spot/ext.js:46; noSlash twin ls.js:108/list.js:80.
2026-07-24 re-sweep: concatBytes additional inline copies view/bro.js:258/512/729/792 + log.js:464/554 (12 sites total) — one home kills all.
Blockers and bummers
CODE-001..015 produced bullshit-quality "improvements" (see CODE board); keep every change behavior-preserving and gate the diff before landing.
Divergent copies (resolveHashlet, isMeta, weave-merge) cannot be blind-deduped — reconciling semantics may change behavior, so those are repro-first, not mechanical.
Ambient-global injection means moving code between files can hit load-order traps; preserve the binding contract when relocating.
Spin-off (NOT this ticket, file separately per todo own-ticket rule): put.js:336 dead ternary (both arms return hexish); eval() on address-bar input at views/bro/bro.js:76; dead code fold-decide.js:232 libDir and loop.js _nullSink (stale, drops flush); stale comment post.js:457.
Still open, re-verified in-tree: resolveHashlet copies persist (commit.js:129 vs log.js:121, differing gates); isMeta still 3-way divergent (classify.js:435, stage.js:51, util/ignore.js:143); no shared/resolve.js, shared/uriarg.js, view/hunkbuild.js, shared/util/fs.js; view/theme.js still lacks the tok32 codec.
Note: the JAB-003/JAB-004 reworks (hunk-output conversion aa61c49c/1e564190, plain-args verbs 11e4dddc) retired several listed copies as a side effect — re-scan fold-site line numbers before starting a group.