Cross-repo audit + a new toolkit repo

toolkit • 2026-08-18

Cross-repo audit + a new toolkit repo β€” Aug 18

TL;DR

Fanned out 5 subagents across all 24 repos in ~/code/ to find duplicated code and cool ideas worth stealing. Built a new shared repo, xpoes123/toolkit, that extracts four proven pieces: sage's error-handling kit, SharpLab's odds math, the hash-seeded avatar trick from nsba-cardai, and a VPS deploy script + shared design system. Nothing in sage/stavid/SharpLab/nsba-markets was touched β€” v1 is standalone, migration is a deliberate next step. A second research pass came back with 7 ranked ideas for what to build next; the strongest one wires arxiv-scrape's nightly-agent pattern into nsba-markets' strategy builder.

What I was asked to do

Look across all of David's repos for things worth abstracting into a shared toolkit, and for cool ideas/engineering practices worth replicating elsewhere or writing into memory/CLAUDE.md β€” specifically flagged nsba-markets' card avatar generation and the general Discord-bot patterns as promising.

The audit

Five agents covered: the Discord bots (sage, stavid, LeBot, nsba-results-bot), the NSBA/prediction-market family (nsba, nsba-markets, nsba-cardai, sharp-nba), the sports/quant repos (SharpLab, nba-modeling, poverty-football), the web apps (scibowl-org, david-share, davidJ, finance), and the smaller/misc projects (party, pokemon-cards, games, arxiv-scrape, the vigil-* worktrees).

The standout: hash-seeded avatar generation

nsba-cardai's CuteAvatar.tsx generates a unique, good-looking mascot for every player card with zero image files, zero AI API calls, zero server round-trip:

Same name always produces the same avatar, computed in microseconds, no storage or CDN needed. This is now a standalone module in the toolkit (see below) so any other bot β€” Discord avatars, Stavid's habit-tracker mascots, a PokΓ©mon-cards "trainer" badge β€” can reuse the exact mechanism with its own art.

Real duplication found

PatternDuplicated inNow consolidated?
Odds/probability math (American↔decimal↔prob, de-vig, Kelly)SharpLab, nba-modeling (Γ—2), nsba, sharp-nbaYes β€” \1
Discord error handling (sanitize + dedupe-by-fingerprint)sage has it, stavid has noneYes β€” \1
Hash-seeded avatar mechanismnsba-cardai only, but reusable anywhereYes β€” \1 + \1
Tokyo Night CSS variablesfinance + david-share, copy-pasted hex valuesYes β€” \1
git-pull-deploy patterndavid-share has it, finance has no deploy script at allYes β€” \1
LMSR market math\1 vs \1, ported verbatimNot yet β€” flagged in \1
Config loadingpydantic-settings in some repos, raw \1 in othersNot yet β€” flagged as drift to fix opportunistically

Also flagged: nsba-cardai turned out to be a stale full fork of nsba-markets's backend, not a distinct project β€” bug fixes there won't propagate. fantasy-football and pokemon-masterset are empty, candidates to archive.

What I built: `xpoes123/toolkit`

A new private repo at ~/code/toolkit, pip-installable, with an assert-based self-check in every module (python3 djtoolkit/oddsmath.py etc β€” no test framework needed):

Deliberately not done: wiring any existing repo to actually import from djtoolkit yet. sage, stavid, SharpLab, nba-modeling, and nsba-markets all keep running their current local copies unchanged β€” several are live production systems (real Discord users, real trades), so that migration happens one repo at a time, on request.

What to build next β€” a ranked shortlist

A second research pass (informed by the audit) came back with 7 ideas, ranked. The full report is worth reading end to end, but the top 3:

(Full list of 7, including a play-money LMSR market inside stavid for apartment-life predictions, and durable Temporal timers for sage's reminders, is in the session β€” ask if you want the complete writeup.)

Recommendations, in order