agentleFS
liuhlabliuhlab/liulab-skills/skills/lab-hpc/SKILL.md

lab-hpc

Skill1 starsChanged 14 days agoMITView on GitHub

Lab HPC clusters (arc/chimera GPU, ircbc CPU) and remote compute on them. Use whenever a task involves ssh to a lab server, Slurm jobs (sbatch, srun, squeue, salloc), compute or login nodes, running code remotely, or moving files to a cluster. Read it BEFORE the first ssh of a session: it decides where every command runs. Covers the zhoulab_gpu_priority partition, syncing code local -> GitHub -> remote, host aliases, choosing a cluster, per-user config, and the rule that work belongs on a compute node, never on the shared login node.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

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

    Before designing a large-data pipeline or starting a long data job, read and apply cluster-run, including on a held node.

    line 16
  2. Very specific:

    Run bash scripts/check-hpc-config.sh (--live also tests ssh).

    line 21
  3. Very specific:

    Read ~/.claude/lab/personal.md — usernames, code dirs, the standing job, sbatch defaults.

    line 25
  4. Distinctive:

    Ask which cluster unless context pins it down.

    line 27
  5. Very specific:

    Run project code on a cluster through pixi run,: not the system python3.

    line 35
  6. Distinctive:

    Only two reasons justify a login node:

    line 42
  7. Very specific:

    Check personal.md, then probe aliases with ssh -o BatchMode=yes -o ConnectTimeout=10 <alias> true.

    line 52
  8. Very specific:

    Put each probe's commands into one ssh call: every call is a connection through the login node.

    line 56
  9. Distinctive:

    No node anywhere?: Only then use the login node, and only to fix that: show the exact sbatch/salloc, get confirmation, submit, poll to …

    line 59
  10. Very specific:

    If ssh to ircbc hangs, stop and tell the user to check the VPN (atrust, managed by hand).

    line 80

≈ “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.

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

Lab HPC clusters & remote-compute workflow

Per-cluster detail is in references/: *-hpc.md for hosts, network and storage; *-slurm.md for partitions and submitting.

Before designing a large-data pipeline or starting a long data job, read and apply cluster-run, including on a held node.

Step 0 — before the first ssh

  1. Run bash scripts/check-hpc-config.sh (--live also tests ssh). If the cluster the task needs is NOT CONFIGURED, refuse: name the missing aliases, point at the README's "Per-user config", never improvise with raw addresses or keys, and resolve hosts from ~/.ssh/config only. config dir: OLD LOCATION → refuse too, and relay the printed fix for the user to run.
  2. Read ~/.claude/lab/personal.md — usernames, code dirs, the standing job, sbatch defaults. It overrides this skill. Say so if it is absent.
  3. Ask which cluster unless context pins it down. Then develop locally, push to GitHub, and git pull on the remote — code reaches a cluster through git, not scp.

Shell and environment

  • The local shell on lab Macs is zsh. Quote every URL (? and * are globs). An unquoted $var is not split into words, so use an array. End a probe that may find nothing with || true, so an empty result doesn't hide real errors.
  • Run project code on a cluster through pixi run, not the system python3.

Work on a compute node, not the login node

Get onto a compute node and stay there. A login node is one shared machine per cluster, and a fan-out of "small" agent commands takes it down. ssh arc '<cmd>' is the wrong reflex even for a one-liner: the whole Slurm client (squeue, sbatch, scancel) runs on the compute node. Only two reasons justify a login node:

  1. You hold no job, so no compute node is yours yet. Only a login node can submit that first one.
  2. The compute node lacks what you need: on ircbc, internet and git. On arc, nothing: its compute nodes have internet and a full toolchain, so once you hold one, never leave.

SOP — take a foothold, then keep it

  1. Find and reuse the node you already hold. The lab parks a long-lived idle GPU job on arc for this. Check personal.md, then probe aliases with ssh -o BatchMode=yes -o ConnectTimeout=10 <alias> true. Judge by exit status, not stderr.
  2. Land and stay. On arc, wrap commands in a login shell — ssh <node> 'bash -lc "…"' — or pixi and other user-installed tools are invisible. Put each probe's commands into one ssh call: every call is a connection through the login node. If ssh hangs after a network drop, clear the stale shared connection with ssh -O exit <alias>, then retry once.
  3. No node anywhere? Only then use the login node, and only to fix that: show the exact sbatch/salloc, get confirmation, submit, poll to RUNNING, ssh in, and leave. If a foothold is preempted, repeat this step.

Watching a job

Poll a job only with bash scripts/watch-job.sh <alias> <jobid> [file] in the background, never a sleep loop; -h lists its exit codes. Every job-watching subagent's brief names it.

Hard rules

  • Work on a compute node; the login node has exactly the two uses above.
  • No sbatch/srun outside an approved run plan. Approved before the pilot, sized for the full run, scripts shown: work folder, partitions, most CPU, memory and wall time per job, most jobs at once, target measure and range. Inside it, submit and cancel its own jobs unasked. A job or pilot estimate past a limit needs a revised plan. Cancelling a job the plan did not start, and writes to shared data or the shared package store, need a yes. Post it on the run's issue (or work folder README); quote it verbatim in subagent briefs. It ends with the run. No plan: a yes per script. Probes like squeue need none.
  • Reachable never means permitted. ircbc lets you ssh to a node you hold no job on; working there steals from the scheduler. Hold an allocation.
  • If ssh to ircbc hangs, stop and tell the user to check the VPN (atrust, managed by hand). arc is not behind it. Never retry in a loop.

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.