agentleFS
zl3311zl3311/alpha-mining/.cursor/skills/hf-server/SKILL.md

hf-server

Skill2 starsChanged 4 months agoMITView on GitHub

How to use the HF submission queue server for BRAIN simulations. Covers submitting jobs, querying results, polling, health checks, and priority rules. Trigger on: submit, server, HF, queue, hf_submit, hf_query.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read from env HF_SERVER_URL (e.g.

    line 13
  2. Distinctive:

    Always tag with session ID for tracking.

    line 25
  3. Very specific:

    Before submitting, run --stats.

    line 53
  4. Distinctive:

    Use the canonical poller — do NOT write ad-hoc heredoc poll loops:

    line 57
  5. Very specific:

    If a job lingers, check its status.

    line 90
  6. Very specific:

    Default decay=6, neut=SUBINDUSTRY, universe=TOP3000.

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HF Submission Queue Server

Server URL

Read from env HF_SERVER_URL (e.g. https://<hf-user>-brain-submission-queue.hf.space)

Authentication

Requires HF_TOKEN and HF_API_KEY in .env.

Submit Expressions

uv run python3 scripts/hf_submit.py --expressions "expr1" "expr2" --priority 5 --tags daily_20260603 session_013

Always tag with session ID for tracking.

Query Results

uv run python3 scripts/hf_query.py --stats                                        # Server health
uv run python3 scripts/hf_query.py --gate-passers                                 # S>=1.0, F>=0.8 (default)
uv run python3 scripts/hf_query.py --gate-passers --min-fitness 1.0 --min-sharpe 1.25  # Strict (matches submission gates)
uv run python3 scripts/hf_query.py --new-24h                                      # Last 24h discoveries
uv run python3 scripts/hf_query.py --sql "SELECT ..."                             # Custom SQL

Priority Rules

Higher number = processed first.

PriorityUse
0Background sweep (hands-off)
3-5Normal session work
6-10Urgent / time-sensitive

Rate Limits

The server has 3 concurrent BRAIN sim slots. Do NOT submit multiple batches simultaneously -- they compete for slots and trigger 429s. Submit one batch, wait for results, then submit the next.

Health Check

Before submitting, run --stats. If worker_status is paused_backoff or budget is near zero, do not submit.

Polling for Results

Use the canonical poller — do NOT write ad-hoc heredoc poll loops:

uv run python3 scripts/hf_poll.py --tag <session_tag>
uv run python3 scripts/hf_poll.py --tag <session_tag> --interval 60 --stale-min 12 --json

It polls until every tagged job is terminal (done|failed|failed_permanent), flags STALE jobs (stuck in running past --stale-min), and prints a gate-passer table on completion.

Gate threshold note: hf_poll uses stricter thresholds (S>=1.25, F>=1.0) in its completion summary than hf_query --gate-passers defaults (S>=1.0, F>=0.8). If the poll summary shows zero gate-passers, always double-check with hf_query --gate-passers --tag <tag> at the default thresholds -- there may be candidates worth inspecting between the two thresholds.

Or filter completed gate-passers directly:

uv run python3 scripts/hf_query.py --gate-passers --tag <session_tag>

Realistic latency

A single sim averages ~2-3 minutes. BUT the background sweep keeps the queue deep: when /v1/stats shows pending_jobs in the thousands, even priority-9 session jobs wait behind in-flight work and can take 10-30 min to drain. Size your poll patience to the queue depth, not to a fixed "2-5 min". Submitting at higher priority jumps the PENDING line but cannot preempt RUNNING jobs.

WARNING != slow sim

If a job lingers, check its status. A BRAIN poll status of WARNING (or ERROR/FAILED) is a terminal EXPRESSION error, not a slow simulation — most often a FASTEXPR unit error (e.g. adding a unitless rank() to a price-unit term). The server now marks these failed_permanent immediately. If you ever see a job stuck in running for >12 min with concurrent_running: 0 in stats, it is a stale/zombie record — restart the Space with uv run python3 scripts/server_watchdog.py --restart.

Config

Default decay=6, neut=SUBINDUSTRY, universe=TOP3000. Override with --decay, --neutralization, --universe.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.