seed-control
Skill0 starsChanged 45 days agoMITView on GitHub
Read-only scan for UNSEEDED randomness (Python random/np.random without a seed, any JS Math.random); file:line, exit 1 on findings, seed-ok suppresses. Use when: "did I forget to seed", "reproducibility check", before pinning a frozen run.
In this repository34 other files it gives its agents.
- audit-codeSkill
- audit-docsSkill
- auditSkill
- bisect-driverSkill
- coding-conventionsSkill
- commit-gateSkill
- compact-ioSkill
- cron-task-manageSkill
- cve-auditSkill
- data-integrity-auditSkill
- decision-logSkill
- deck-builderSkill
- determinism-guardSkill
- etl-validateSkill
- experiment-logSkill
- fetch-firstSkill
- flaky-test-detectorSkill
- github-repo-polishSkill
- golden-lockSkill
- history-leak-scanSkill
- landing-checkSkill
- llm-eval-harnessSkill
- local-secrets-manageSkill
- long-taskSkill
- milestone-trackSkill
- opus-workersSkill
- path-quirk-auditSkill
- reorg-proposalSkill
- research-briefSkill
- shell-portabilitySkill
- skill-vetSkill
- small-taskSkill
- token-squeezeSkill
- venue-fitSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 69
NOT count — the scanner only sees random.seed(/np.random.seed(/default_rng( *in the same file* as the draw.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
seed-control — catch unseeded randomness before it breaks reproducibility
The engine is seed-control.js (portable Node, zero deps). It statically scans
.py / .js / .ts source for random draws that have no seed governing them.
An unseeded draw makes a run non-repeatable: the motivating case is a
backtest or simulation whose frozen regression tests are pinned byte-exact —
one stray random.random(), np.random.rand(), or Math.random() with no seed
silently turns a byte-for-byte-stable report into a moving target, and the
frozen test starts flapping for reasons unrelated to any real change.
Purely read-only: it opens files, never writes to the scanned tree (canary experiments are confined to a temp dir).
Rules (same-file heuristic)
| Lang | Use flagged | Silenced when the file contains |
| Python | random.<fn>( | random.seed( anywhere in that file |
| Python | np.random.<fn>( | np.random.seed( or default_rng( in that file |
| JS/TS | Math.random( | never — JS has no stdlib seed API |
Math.random() is always flagged because there is no way to seed it; the fix is
a seeded PRNG (mulberry32, seedrandom, etc.). A per-line
# seed-ok (Python) or // seed-ok (JS/TS) comment suppresses that one finding
when the randomness is intentionally unseeded (jitter, nonces, sampling you don't
need to reproduce).
Commands
node seed-control.js scan <path> [<path>...]
node seed-control.js --canary- scan takes files or directories. Directories recurse over
.py/.js/.tsand skipnode_modules,.git,__pycache__,.venv/venv,dist,build. Each finding prints asfile:line:snippet. Exit 1 if any finding, else 0.
Examples
- Guard a backtest before freezing its report (must stay byte-exact):
node seed-control.js scan /path/to/backtest— any hit is a draw that can drift the frozen baseline; seed it or mark# seed-ok, then re-run. - Scan a web app's frontend/backend for stray
Math.random()(token/ID generation that should use a seeded or crypto source):node seed-control.js scan /path/to/app. - Check a single file:
node seed-control.js scan sim.py.
Windows notes
- PowerShell 5.1 and Git Bash both run it the same way; paths with spaces go in
double quotes:
node seed-control.js scan "D:\path with space". - Pure Node stdlib — no
&&/||chaining, ternary, or encoding gotchas involved; nothing is written, so no Set-Content / UTF-8 concerns apply.
Known limitations (read before trusting a clean result)
- Same-file heuristic, no cross-module tracking. A seed set in
conftest.py, a sharedset_seed()helper, or a fixture in another module does NOT count — the scanner only seesrandom.seed(/np.random.seed(/default_rng(in the same file as the draw. This yields false positives for centrally-seeded projects; triage each hit and add# seed-okwhere a real upstream seed exists. Conversely, a seed in one file does not vouch for an unseeded draw in another — each file is judged alone. - Textual, not semantic. It matches
random./np.random./Math.random(token patterns; it does not parse scope or data flow. Arandom.seed()guarded behind a branch that never runs still reads as "seeded". Aliased imports (from random import random as r;import numpy.random as npr) are NOT matched — only therandom./np.random./Math.randomspellings are. - Python
randommodule only for the bare form —secrets.token_*(which is intentionally unseedable and correct for tokens) is not flagged. - Seeding is necessary, not sufficient, for reproducibility: thread/process ordering, dict iteration, hardware floats, and library-internal RNGs can still cost you determinism. This scan removes the most common and silent cause, not all of them.
Exit codes
0 clean · 1 findings or canary failure · 2 usage error (no files, unknown
command).
Verification (the done-check)
node seed-control.js --canarySelf-tests both directions in a throwaway temp dir: an unseeded random.random()
IS flagged, a random.seed()ed file stays clean, unseeded np.random is flagged
while np.random.seed()/default_rng() clear it, Math.random() is flagged in
.js and .ts, and both # seed-ok / // seed-ok suppressions silence a line —
plus end-to-end exit 1 (findings) vs. exit 0 (clean). MUST print
CANARY PASS 16/16 before you trust a scan.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

