Split a research project between a local machine and a Slurm cluster, with code and results kept in sync through a private git repo. Light work (editing, plotting, quick checks) stays local; heavy compute runs as Slurm jobs. Covers the daily loop, what goes through git versus rsync, submitting and watching jobs, fair-share priority, and squashing accumulated result commits. Per-cluster profiles in `clusters/`: MIT Engaging (ORCD, orcd-login) and MIT subMIT (submit.mit.edu, the submit and tier3 partitions, /work/submit, /ceph/submit) and Stanford Sherlock (login.sherlock.stanford.edu, the gpu partition, Duo). Use when the user mentions Engaging, ORCD, subMIT, Sherlock, SRCC, GPUs on a cluster, sbatch/squeue over ssh, a cluster login node, queue priority or fair share, moving runs to a cluster, syncing results back, or a project that already has this setup (a cluster clone, a deploy key, slurm/ scripts).
Ships in hybrid-compute. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
First, read the profile for the cluster you are on. It carries everything that differs by site: how to connect, where storage lives, which partitions exist and what breaks there.
| Cluster | Profile |
|---|---|
| MIT Engaging (ORCD) | clusters/engaging.md |
| MIT subMIT | clusters/submit.md |
| Stanford Sherlock (GPUs) | clusters/sherlock.md |
No profile for the cluster yet? Work from the nearest one, and write a new profile as you go: the four headings are Connecting, Storage, Partitions and caps, Site-specific breakage. That file is the only thing a new cluster needs.
The rest of this file is the workflow, and it is the same everywhere.
One repo, two working copies:
local machine GitHub (private repo) cluster (clone)
edit, commit, push ─────────────▶ origin ◀──── pull (deploy key) ──── login node: git pull, sync env, sbatch
pull --rebase, plot ◀──────────── ◀──── push_results.sh ─────── after jobs finish
push_results.sh and pulled locally.rsync, never through git (see Git or rsync).Read setup.md (next to this file) for the one-time setup, and the profile for the site-specific
half of it.
Assumes 1Password on the local machine: its SSH agent holds the cluster key and signs commits, so
a locked 1Password shows up as SSH or commit failures. Other agents work; setup.md is written for
1Password.
The profile gives the recipe, because this is where clusters differ most — some gate every login behind a second factor, some take a key and nothing else. Two things hold everywhere:
ssh -o BatchMode=yes <alias> '<cmd>'. BatchMode makes a refused key
fail fast instead of hanging on a prompt.Never touch ~/.ssh/authorized_keys on the cluster.
If a connection fails, read the error and stop. Don't retry in a loop: on a cluster with a second-factor gate, repeated attempts can trigger a lockout. The profile lists that cluster's failure messages and what each one means.
git, dependency installs, rsync,
sbatch/squeue/sacct/scancel, reading logs, tiny file inspection. Everything else goes in a
job — the profile names the short-test partition for anything brief.sbatch, check the job against that cluster's caps (wall time, CPUs, GPUs, memory per
user). If it only fits a tier the project isn't on, don't submit: say which limit it exceeds, and
offer the alternatives — split it, checkpoint and resubmit, a job array, or a preemptable partition
with --requeue.push_results.sh commits every
.json in an experiment folder, so no credentials go in those folders, and job logs print only
named switches, never the whole environment.--no-gpg-sign, changing config).ssh -o BatchMode=yes <alias> 'cd <cluster-repo> && git pull -q --rebase --autostash && git log --oneline -1 && grep -c "<a symbol you just added>" <file>'
Sync the environment only if the lockfile changed (it's an install, so fine on the login node).
Why verify: if the local commit silently failed (e.g. signing), the cluster runs the old code
and you only find out hours later.sbatch, usually the generic array script scripts/run_modes.sh (one mode per
task). Give jobs descriptive names: they're how you watch them.scripts/push_results.sh "<what these results are>" commits
figures and small arrays from the experiment folders and pushes.git fetch -q && git log --stat HEAD..@{u}
Cluster commits should touch only result files in experiment folders. If one changes code, scripts
or config, stop and tell the user before pulling: the deploy key may be misused. Then
git pull --rebase, plot, analyse and write notes.The division isn't by file type. It's by whether you would ever read a diff of the thing.
Git carries what you want to see before you trust it: code, figures, small arrays
(.npz/.json), result tables, notes. The reason isn't convenience — it's step 6 above. The cluster
pushes with a deploy key that has no passphrase and sits on a shared machine, so every cluster commit
gets read before it's pulled, and that check only works on what a diff can show you: a file list and
sizes you can sanity-check. So keep what goes through git small enough that git log --stat stays
readable, and cheap enough to regenerate that losing it costs a rerun rather than a week.
rsync carries what you'd only ever look at whole: raw simulation snapshots, caches, checkpoints, anything big or numerous. These never go in git. A diff tells you nothing about them, and git keeps every version forever — which is the problem the next section exists to clean up.
Slurm logs are a third case: they stay on the cluster and you read them over ssh. They're git-ignored, and they're not worth syncing.
Worked examples: a 40 kB figure → git. A 3 MB .npz of fit parameters → git. A one-page summary
table → git. A 200 MB snapshot → rsync. A checkpoint directory → rsync. Job logs → neither.
Running the transfer. Use scripts/sync_data.sh, run locally from anywhere inside the local
clone. It moves one folder, at the same path relative to the repo root on both sides:
scripts/sync_data.sh pull <alias> <cluster-repo> <dir> # cluster → local: results, snapshots
scripts/sync_data.sh push <alias> <cluster-repo> <dir> # local → cluster: big inputs
It leaves out .git/, .venv/, __pycache__/ and slurm/, runs ssh with BatchMode, and on a
push creates the folder on the cluster first. It uses only options the macOS rsync (openrsync) also
has, so --info=progress2 is out; it prints --stats at the end instead. To copy from a scratch
filesystem outside the clone, pass that scratch root as <cluster-repo>.
--delete sync at the cluster repo. slurm/ exists only there and is
git-ignored, so a deleting push from the local tree wipes the logs and the job scripts' output
directory. The script refuses the repo root and slurm/. Given --delete as a fifth argument,
it prints a dry run of what would be removed and stops (exit 3). Show that list to the user. Only
after their yes, run it again with CONFIRM_DELETE=1. A push --delete deletes on the cluster,
which is on the ask-first list above.rsync goes over ssh, so on a cluster whose profile describes a shared connection it needs that
connection open, same as any other command.-t 00:08:00) gives the
per-step time and memory; size the real jobs from it. Run it at two CPU counts in parallel and
compare the step times: they often land on the same node, which makes the comparison clean. seff <jobid> gives CPU efficiency and peak memory even for a pilot killed at its time limit. Node speed
varies between nodes and between clusters, so set --time from the slowest pilot plus a wide
margin.--export=ALL,KEY=val,.... --export splits on
commas, so never put a comma inside a value: KAPPAS=8,4,2,1 arrives as KAPPAS=8. Use another
separator (8:4:2:1).SLURM_ARRAY_TASK_ID, never from a rewritten argv: in one run, a runner that reset sys.argv
silently computed the default grid instead of the requested one. Printing the configuration catches
this on the first lines.sacct -j <id> -o JobID,Elapsed,MaxRSS,ReqMem, or seff <jobid>,
plus a cushion. On some clusters memory is a consumable like CPUs, so a job holding a node's memory
blocks that node even with idle CPUs; on others it only limits how many of your jobs pack on at
once. Either way, request what you need, not the maximum.sbatch --dependency=afterok:<jobid> .... afterok only sees the exit
code, and a fit that converged to the wrong solution still exits 0 — so have the upstream step exit
non-zero when its result is unusable, and the downstream jobs never start.#SBATCH -o slurm/logs/%x-%j.out (arrays: %x-%A_%a.out). The directory must exist
before sbatch.os.cpu_count() reports the whole node, not your allocation. Pin
threads (OMP_NUM_THREADS, XLA_FLAGS, etc.) to $SLURM_CPUS_PER_TASK if oversubscription shows
up.~/.local/bin aren't on the non-interactive PATH. Call them by full path
in job scripts.Queue priority on a shared cluster is mostly fair share: how much of your share you have used lately. Every CPU-hour you run lowers the priority of your next job, and usage decays over a half-life of days, so last week's runs still count. A day of broad sweeps can leave the user near the bottom of the queue for a week. Treat CPU-hours as a budget.
Check the live values; sites retune them and the profile records what they were:
scontrol show config | grep ^Priority # the weights, and the decay half-life
scontrol show partition <p> | grep TRES # what is billed (usually allocated CPUs × elapsed)
sshare -l -u $USER # LevelFS = share / usage; below 1 is over your share
sprio -j <jobid> # one pending job's priority, broken down
FairShare in sshare is your rank among all users from 0 to 1, not a ratio: 0.03 means about
the bottom 3%. Requested CPUs are billed even when idle.
Before submitting, ask what question the batch answers, and run the smallest set of jobs that answers it:
Right-size every request:
-c: only what the code actually uses. Check sacct -j <id> -o Elapsed,TotalCPU,AllocCPUS: if
TotalCPU ≪ Elapsed × AllocCPUS, most of the allocated CPUs sat idle and were still billed.-t: a realistic limit from past runs plus a margin, not the partition maximum. Charging uses
elapsed time, so this doesn't change cost. It changes wait: the backfill scheduler slots jobs with
short, accurate limits into idle gaps ahead of higher-priority jobs. That's how a low-priority job
starts while CPUs sit idle.--mem: from MaxRSS history plus a cushion.When priority is already low: submit the most informative job first and hold the rest
(scontrol hold <id> / scontrol release <id>) instead of queueing everything, so the job that
matters runs first. Holding doesn't restore priority; only not running does. Prefer the short-test
partition for anything that fits — tiny jobs backfill easily. LevelFS reaches 1 after usage decays by
a factor of 1/LevelFS, which takes about half-life × log2(1/LevelFS) with no new runs; tell the user
roughly how long that is.
Use scripts/watch_jobs.sh '<name-regex>' <alias> <cluster-repo> <seconds> (or the same loop inline)
as a background task:
squeue --me -h -o %j | grep -cE '<regex>'. Don't use
squeue -j id1,id2,...: one invalid or finished ID makes squeue print nothing, which looks like
"all done".Useful checks:
squeue --me -o "%i %j %T %M %l %R" # state, elapsed, limit, reason or node
sacct -X -n -S <date> -o JobID%14,JobName%22,State%12,Elapsed
seff <jobid> # CPU and memory efficiency of a finished job
scontrol show res | grep -E "ReservationName|StartTime" # maintenance windows
Common pending reasons: Priority is normal queueing, and a long wait under it usually means low
fair share. Dependency is waiting on an upstream job. Resources means the partition is full.
Anything about a per-user cap means your jobs start in waves — to free slots, cancel your own jobs
that have become uninformative. The profile lists that cluster's own reasons, including maintenance
reservations.
NN_short_name/) with a runnable script, so
push_results.sh can glob results by folder.push_results.sh commits on every collection, so a long project accumulates hundreds of results:
commits, each carrying a fresh copy of every figure that changed. Git keeps all of them forever.
Squash them when a project phase closes.
The branch ruleset setup.md has you add blocks force pushes on main on purpose — it is the
guard against a stolen deploy key rewriting your history. Squashing is a rewrite, so the two collide.
The way through is to lower the guard deliberately for a few minutes, not to work around it.
First, confirm nothing is in flight. A job that starts mid-squash reads whatever the clone has, and an unpushed cluster commit is destroyed in step 5.
ssh -o BatchMode=yes <alias> 'squeue --me' # no queued or running jobs
ssh -o BatchMode=yes <alias> 'cd <cluster-repo> && git status --short && git log --oneline @{u}..'
Both must come back empty. Then:
main ruleset → disable it.<base> is the last commit you want to keep:
git log --oneline <base>..HEAD # check this really is only results: commits
git reset --soft <base>
git commit -m "results: <phase name>"
git push --force-with-lease. If it's refused, stop and ask the user — it means someone or
something pushed after your last fetch, so something was in flight after all. Don't merge, and
don't force without the lease.git -C <cluster-repo> fetch && git -C <cluster-repo> reset --hard origin/main.
This is destructive — it discards anything uncommitted in the clone, which is what the check
above was for.git reflog expire --expire=now --all && git gc --prune=now. Until this runs, the old
blobs are still on disk. GitHub reclaims its own copy on its own schedule.Steps 1, 3 and 4 are the user's: an agent doesn't disable branch protection or force-push over history.
Squash earlier than a phase boundary if git count-objects -vH shows the repo past a few hundred
MB, or if results: commits crowd out everything else in git log --oneline | head -50. Wait for the
next quiet moment rather than the next phase.
Revoke the deploy key in the repo settings. Squash the result commits (above). Archive or delete large cluster data you no longer need — the profile says which filesystems are yours to keep tidy and which are wiped for you.
card.json (opens in a new tab)clusters/engaging.md (opens in a new tab)clusters/sherlock.md (opens in a new tab)clusters/submit.md (opens in a new tab)scripts/engaging/duo-askpass (opens in a new tab)scripts/engaging/engaging-connect (opens in a new tab)scripts/push_results.sh (opens in a new tab)scripts/run_modes.sh (opens in a new tab)scripts/sync_data.sh (opens in a new tab)scripts/watch_jobs.sh (opens in a new tab)setup.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/hybrid-compute:hybrid-computefrom hybrid-compute
npx claudepluginhub nstarman/skills --plugin hybrid-compute