cursorrules

A collection of repository rules and lessons for a machine-learning project and its development workflow. It includes guidance on custom hardware or model architectures, tests, browser checks, coding style, and commits.

In plain words
What is it for?
Use it when developing or verifying the project, especially for custom architecture support, multi-device training checks, package smoke tests, dashboard edits, and commit formatting.
Why use it?
It records project-specific constraints that ordinary coding instructions may miss, helping future changes remain compatible with supported setups and established checks.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/naxium-oss/distribai/cursorrules
Clone the repo
git clone --depth 1 https://github.com/naxium-oss/DistribAI

Made for: Cursor.

Per session 1,478 This file is loaded in full into every session.
When invoked 1,478 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01478 $0.01478
Opus 5 $0.00739 $0.00739
Sonnet 5 $0.00296 $0.00296
Haiku 4.5 $0.00148 $0.00148

Measured 2d ago against content hash 8d23e5489be0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursorrules · 48 lines

How it starts

The opening of the file, as written. The whole thing — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lessons

User Specified Lessons

  • Use .venv312 on this host (broken venv). Prefer uv pip when available.
  • Commit attribution: conventional subjects only — never [Cursor] or Co-authored-by Cursor.
  • User: finish all unfinished items without stopping.
  • Custom architectures: support EVERY external/custom arch path (HF auto_map, local dirs, declarative knobs), not a shortlist of named repos. Never put specific Hub model names in tests/commits.

Cursor learned

  • Parallel paraphrase agents can corrupt files mid-write — re-run gates after agents settle.
  • Static audit forbids placeholder="..." ellipses in dashboard HTML.
  • Playwright webServer failures cascade as ERR_CONNECTION_REFUSED — fix server boot first.
  • Dashboard remake slop clusters in index-preview.js (// ▸ banners) and redundant HTML <!-- Section --> labels.
  • PowerShell mangles inline Python with regex braces — write a temp .py file and run it instead.
  • Never style bare header {} for site chrome — nested <header> in cards (e.g. help trouble heads) inherit sticky/z-index and cover the page. Scope to body > header.
  • Never reuse id="searchResults" on Help — node header already owns it; help search must use a unique id (e.g. helpTopicResults) or getElementById hits the wrong panel.
  • Header global search: #searchInput markup alone is not enough — wire in scripts.js, and add .search-results.show { display:block } (base rule is display:none). Prefer flex .search-field over absolute icon + top:50% (icons.css reload after styles.css can also override icon size via 1em).
  • Never put position:absolute; top:50% search icons on a wrapper that also contains results/meta — when the panel opens, 50% jumps and the glyph overlays “0 results”. Wrap icon+input in their own flex field.
  • Named decoder profiles must default n_kv_heads to n_heads when omitted so GQA stays opt-in.
  • PyInstaller onedir: EXE(..., exclude_binaries=True) then COLLECT; optional TLS datas; hidden import is executor not job_executor.
  • PyInstaller a.binaries can contain duplicate-path 3-tuples across deps (clr_loader/pythonnet DLL scans) — dict(a.binaries) chokes; dedupe by first element manually instead.
  • Never exclude unittest in a PyInstaller spec when bundling torch — torch.distributed.config imports it directly and the frozen app crashes with ModuleNotFoundError: No module named 'unittest'.
  • JobSubmissionHandler in job_submission.py was instantiated fresh per-route (5x) and its allowed_orgs set was never populated anywhere (no admin endpoint called add_allowed_org) — every org got a permanent 403 on /jobs/*. Fixed: one shared handler instance across routes + default-open org policy (DISTRIBAI_ALLOWED_ORGS env var to restrict).
  • bench_network._try_download must raise ValueError on non-HTTPS URLs (not return None) — two tests disagreed on this contract; raising is the one that matches the "Invalid benchmark URL" security-intent test name. bench_download catches it and moves to the next URL.
  • Local blob paths (windows drive paths, bare paths, file://) are gated by services_python/blob_url_policy.py::_is_under_runtime_roots — tests using arbitrary tmp_path must set GRADIENT_LOCAL_ROOT env var or they get "Unauthorized batch blob URL".
  • Dashboards had no per-install org identity — job submissions hardcoded org: 'DistribAI' for every user. Added client/lib/identityStore.js (org_id/node_id persisted in desktop.json, /api/settings/org-id) and wired fetchOrgId() into the create-job flows in jobs.html, orchestrator-jobs.html, index-preview.js.
  • transformers/huggingface_hub/tokenizers were never in requirements.txt despite being a hard import in external_arch.py/hf_integration.py — every real external/custom-arch job would RuntimeError: transformers is required... on a clean install. Added to requirements.txt.
  • load_external_architecture(..., from_scratch=True, config_overrides={...}) builds via AutoModelForCausalLM.from_config (no pretrained weight download) — lets a job train a tiny/custom-sized instance of a real Hub architecture (including gated or huge checkpoints) without ever touching the actual weights.
  • executor._is_language_model only recognized DistribAIModelWrapper, so every external/HF architecture silently fell into the toy MSE batch/loss path and crashed (model(inputs) on byte-batch + functional.mse_loss on a ModelOutput). Fixed by also recognizing transformers.PreTrainedModel and reading outputs.logits when present.
  • _collect_gradients crashed with TypeError: Got unsupported ScalarType BFloat16 in numpy() — published Hub archs often default torch_dtype: bfloat16. Upcast grads to float32 before compression/serialization.
  • Bespoke Hub repos with no auto_map/AutoModel entrypoint (raw nn.Module + custom checkpoint loader, no from_pretrained) cannot go through load_external_architecture at all — reproduce their architecture DNA (e.g. looped shared block + windowed attention) via DistribAI's own declarative knobs (n_unique_layers < n_logical_layers, sliding_window) instead.

Read the full file on GitHub · 48 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 48 lines · 1,478 tokens per session scan A 8d23e5489be0

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository naxium-oss/DistribAI (11 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 1,478 tokens to every session, about $0.0074 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.