[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74MFFW891X09WNRHF918JX4":3,"skill-same:01M74MFFW891X09WNRHF918JX4":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M74MFFW891X09WNRHF918JX4","remote-compute-ssh",null,"Submit→wait_for_notification→harvest workflow for the user's SSH\u002FSLURM hosts. Load once you've decided to dispatch remote.","pengqianhan\u002FAI-Human-Research-OS","pengqianhan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F4286531?v=4","01M74M3DT9HNZ6HPAK8TX69EX9","PengqianHan","01M74M3DTVSN2GXW0JH2W396FK",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fclaude-science-skills\u002Fskills\u002Fremote-compute-ssh\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: remote-compute-ssh\ndescription: Submit→wait_for_notification→harvest workflow for the user's SSH\u002FSLURM hosts. Load once you've decided to dispatch remote.\nlicense: Apache-2.0\n---\n\nYou've decided to run this on the user's SSH host. This skill covers the\norchestration layer — partitions, env activation, job scripts, file transfer,\nrecovery — not the science; what to run and why comes from the task and its\nown skills. Each `c.submit_job()` puts an approval modal in front of the user\nand, once approved, spends their allocation; a string of failed submits costs\ntheir attention, their compute, and their trust. So the shape of a good run\nis: read what's already known about this host, ask once for what isn't, land\nthe first submit, and write down what you learned about the host or compute\nprovider so the next session goes straight to the job.\n\n## Workflow\n\nEvery `host.compute.*` call in this skill runs via the **`repl` tool**\n(the control-plane kernel), not the `python` tool. Job submission opens the\nuser's approval modal and the SSH connection from the orchestrator's own\nprocess; that has to happen outside the sandboxed data workspace, so\n`host.compute` simply isn't attached in the `python` tool (you'd see\n`host has no method 'compute'`). The two kernels share your workspace\ndirectory but not memory, so the rhythm is: prepare inputs in a `python`\ncell (write `.\u002Fin.dat`, pickle what the job needs), run\n`create → submit_job` in a `repl` cell and let the cell return — the\nkernel never blocks on compute. Then call the `wait_for_notification`\nbrain-tool to park until the daemon's poller emits the `compute_done`\nnotification, and return to the `python` tool to read the harvested\n`hpc\u002F\u003CjobId>\u002F` files. The `repl` tool is stdlib-only (`python -I -S`) —\nkeep pandas\u002Fnumpy work in the `python` tool and pass data through files.\n\nStart with the `compute_details({provider, mode:'read'})` tool, then bind once:\n`c = host.compute.create(provider)`. The doc's shape tells you how much\ndiscovery is left: `### env:` blocks and gotchas mean prior sessions did the\nlegwork — trust it. A bare `## Resources` header means first contact — spend\none batched `c.call_command('id; module avail 2>&1 | head -40; ls -la ~',\nintent=..., login_shell=True)` and one `ask_about_compute` now, before any\nsubmit. The header's `scheduler:` line is detection, not ground truth; `none`\non a thin login node means a heavy direct-exec job would crowd other users, so\nwhen the resources look thin and the details doc has no prior note, ask first.\n\nIf the prose doc has a known-working activation, write it directly into your\n`command` (e.g. `source \u003Cpath>\u002Factivate && \u003Ctool> ...`). If it doesn't, find\none via `c.call_command()` (`module avail X`, `conda env list`, likely app\ndirs) or ask. Install only once you've established the tool genuinely isn't\nthere — user-space (venv\u002Fconda under scratch), via `c.call_command()` for a\nquick install or as its own `c.submit_job()` if it needs a build node.\nWhichever route produced an activation, run the entrypoint once via\n`c.call_command()` before building the real job on it.\n\nThen `job = c.submit_job(...)` (see below). `inputs=[{src:'file', dst_filename:\n...}]` stages the file for you — there's no `c.upload()` step, and once\nsubmitted there's nothing to verify with `c.call_command('cat ...')`; the job\nreads `.\u002F\u003Cdst_filename>` from its own workdir. End the cell — `submit_job`\nreturns immediately and the daemon's background poller polls the remote,\nharvests everything the job wrote into your workspace under `hpc\u002F\u003CjobId>\u002F`,\nand emits a `compute_done` notification when done.\n\nPark on the `wait_for_notification` brain-tool until that notification\narrives. Its payload carries `{job_id, status, exit_code, featured_files,\noutput_file_count, ...}` — `featured_files` is the subset matching your\nfeatured `outputs:` globs (omitting `outputs:` features everything). Publish\nwhat you want with `save_artifacts(payload['featured_files'])` — that step is\nwhat gives them provenance and surfaces them in the artifact panel. If you\nneed the full result dict (all `output_files`, `left_on_remote`, etc.),\nre-enter a `repl` cell and call `r = c.attach_job(job_id).result()` — a\nnon-blocking read of what the poller already harvested.\n`open(r['output_files'][i])` reads any harvested file directly. Chain a\nremote-resident output via\n`inputs:[{remote_path: r['left_on_remote'][i]['uri']}]`. Between the\nnotification and `close()` you can still\n`c.download(f\"{job.workdir}\u002F\u003Cfile>\")` for anything the harvest missed.\n`c.download('\u002Fany\u002Fabsolute\u002Fhost\u002Fpath')` works for **any readable file on\nthe host**, not just job outputs — paths outside scratch\u002Fdata_roots raise an\napproval card the user clicks Allow on. When the user asks you to\nfetch a host file, call `c.download()` with the path they gave; the approval\ncard is the authorization gate, so don't refuse on their behalf and don't\n`cp` into scratch first to dodge it. Dotfiles \u002F paths under a dot-directory\n(`~\u002F.ssh\u002F*`, `.gitconfig`, `.env`, …) get a hardened per-file confirmation.\n`c.close()` once you've confirmed — it cleans up the job workdirs on the\nhost. Hand back the result verbatim.\n\n## What to record\n\nThe `compute_details()` tool is the only state that survives across sessions,\nand three of your inputs are the user teaching you how their host works: an\n`ask_about_compute` answer, a `User: \u003Ctext>` redirect from a declined approval\n(they clicked Respond and typed what to do instead), or guidance relayed in the\nconversation. When one arrives, treat it as a teach loop — read the durable\nfact, append it via the `compute_details({mode:'append'})` tool with a\n`per user \u003Cdate>` tag, echo\nback what you understood in your next `intent` so the user sees the teaching\nlanded, then act on it.\n\nRecord an activation\u002Fpartition\u002Faccount combination you watched succeed too,\ntagged with how you know: `verified \u003Cdate>` if you ran the entrypoint and saw\nexit 0, `per user` if from `ask_about_compute`, `untested` if inferred. A\nsingle inline gotcha (\"this tool needs `module load cuda\u002F\u003Cver>` here\") is worth\nkeeping; per-job state and transient errors aren't.\n\nWhen asking, ask once per gap and batch related questions (\"Which partition and\naccount for GPU jobs, and how do I activate `\u003Ctool>`?\"). Never ask what one\n`c.call_command()` would tell you — `module avail` first, then ask for what\nonly the user knows: their account string, which env they prefer, whether you\nmay install.\n\nThe test for whether something belongs here is whether it is true of the host\nor compute provider, or true of the work you ran on it. A preemption limit is\nabout the provider; a method choice or a result is about the project, and it\nwill sit in front of every future session on this machine — including\nunrelated projects — long after it has stopped being true. The same goes for\nwhat you learn about the user: that belongs in memory, where it is scoped and\ncorrectable. When a session ends and nothing new about the provider came up,\nthe right amount to write is nothing.\n\n## When the job fails\n\nRead `r['exit_code']` and the harvested log. An infrastructure failure (wrong\npartition, env not activated, missing module, OOM, walltime) is yours to fix —\nadjust `command`, record the fix, fresh `c.submit_job()`. A tool failure (the science tool ran but errored on inputs)\nmay be a bad flag or bad input data; one `c.call_command()` to inspect the log\nusually says which. Infrastructure-fix retries are cheap on a short smoke test\nand expensive on a long allocation, so after two failed submits on the same\njob, ask before a third.\n\nIf a tool returns `retry_after_user_action: true`, the host itself is\nunreachable (key not loaded, VPN, host down) — call `ask_about_compute` with\nthe error text and wait; don't loop on your own.\n\n## `c.submit_job()` on SSH\n\n`command` is a job script. The host hoists scheduler directives from the top\ninto the dispatch wrapper, so write them as if you were handing the file to\n`sbatch`\u002F`qsub` yourself — one directive per line starting with the scheduler\nprefix and a space. The host adds `--job-name`\u002F`--output` bookkeeping (yours\ncan't override those); GPU\u002Ftime\u002Fpartition\u002Faccount are yours. Don't write\n`--array`\u002F`--chdir`\u002F`--wrap` — submit one job per task instead. PBS\n(`#PBS -l ...`) and LSF (`#BSUB ...`) follow the same pattern with their\nprefix; for `scheduler: none`, omit directives entirely.\n\nThe job runs under a login shell, so tools on the host's default\n`module`\u002F`conda` PATH are visible — but writing the activation into `command`\nis still the reliable path (deterministic, and what gets recorded in the details doc).\nThe script runs under `bash -eo pipefail`. If you background subprocesses,\n`wait` alone returns 0 regardless of their exit codes — capture each pid and\n`wait $pid` (or `wait -n` in a loop) so a failing branch surfaces as a non-zero\n`exit_code`. `job.cancel()` sends SIGTERM to the process group; a child that\nignores TERM or re-`setsid`s won't be reached, so don't daemonize inside the\nscript. cwd is a fresh per-job workdir under scratch — inputs stage flat\nthere as `.\u002F\u003Cdst_filename>`. `dst_filename` is a bare filename (no `\u002F` —\nrejected at submit). Only files under that workdir are harvested; if\nyour tool takes an `--output-dir`, point it at `.\u002Fout` or `.`, not an\nabsolute path under your home or scratch — anything outside the workdir\nisn't auto-harvested (pull it afterward with `c.download('\u002Fabs\u002Fpath')`; see\nthe Workflow section for how the approval gate works).\nIf the tool insists on a subdir, end the script with a\nflatten-to-root step (`cp .\u002Fout\u002F*.\u003Cext> .\u002F 2>\u002Fdev\u002Fnull || true`) so your\n`outputs:` globs match, plus an `ls -lh` of the expected files so the log\nshows what's there before harvest. The `|| true` matters: under\n`-eo pipefail` a missing optional output would otherwise fail the job.\n`intent` is the approval-modal headline, the one\nline the user reads to decide whether to let this run on their allocation:\nname the tool, the target, and the scale; on a retry, say what's different.\n`inputs` with `{src}` (workspace-relative path or the literal `{{artifact:ID}}`\nmarker — not a kernel-resolved `\u002Fsessions\u002F...` path) are staged from this\nmachine; with `{remote_path}` (absolute, under a `data_roots:` entry or\nscratch) they're symlinked, no transfer. Anything over ~100 MB that already\nlives on the host should be a `{remote_path}`, not a `{src}` — staging is\nlink-rate and copies into the job workdir. `outputs` — bare string is a featured\ndeliverable; `{glob, visibility:'hidden'}` is diagnostic;\n`{glob, residency:'remote'}` stays on the cluster and comes back as\n`left_on_remote`. `harvest:{exclude:['work\u002F**'], max_file_mb, max_total_mb}`\ncaps what the poller pulls. Harvest likewise caps at ~100 MB per file: larger\noutputs stay on the cluster by\ndefault and come back in `left_on_remote` with `reason:'threshold'` — set\n`residency:'remote'` to choose that, or `max_file_mb`\u002F`max_total_mb` to tighten\nit. A `left_on_remote` URI is for chaining (`inputs:[{remote_path: uri}]`) or\npeeking (`c.call_command(f'head -c 4096 {uri_path}', intent=...)`);\n`c.download()` it only when you or the user actually need the bytes locally —\nit's link-rate-slow and the file is already where the next job needs it.\n\n```python\n# repl tool — host.compute isn't attached in the `python` tool\nc = host.compute.create('ssh:\u003Ccluster>')\njob = c.submit_job(\n    intent='\u003Ctool> on \u003Cinput> — 1 GPU, ~10 min',\n    command='''#SBATCH --gres=gpu:1\n#SBATCH --time=15\n#SBATCH --partition=\u003Cpartition>\n\nmodule load \u003Ctool>\u002F\u003Cver>\n\u003Ctool> .\u002Fin.dat --out .\u002Fout\ncp .\u002Fout\u002F*.result .\u002Fout\u002F*.json .\u002F 2>\u002Fdev\u002Fnull || true\nls -lh .\u002F*.result .\u002F*.json''',\n    inputs=[\n        {'src': 'in.dat', 'dst_filename': 'in.dat'},               # workspace-relative (prepared in a `python` cell)\n        {'src': '{{artifact:\u003Cid>}}', 'dst_filename': 'ref.dat'},   # artifact marker — either form works\n        # or chain a prior job's harvest: {'src': prev_featured[0], 'dst_filename': 'prev.out'}\n    ],\n    outputs=[\n        '*.result',                                                  # featured\n        {'glob': '*.json', 'visibility': 'featured'},\n        {'glob': '*.log',  'visibility': 'hidden'},\n    ],\n    timeout_seconds=900,\n)\nprint(job.job_id)   # cell ends here — kernel never blocks on compute\n```\n\nThen call the `wait_for_notification` brain-tool. The `compute_done`\nnotification payload carries `{job_id, status, exit_code, featured_files,\noutput_file_count, ...}`; act on it directly:\n\n```python\n# after wait_for_notification returns the compute_done payload —\n# featured_files paths are workspace-relative under hpc\u002F\u003CjobId>\u002F\nsave_artifacts(payload['featured_files'])   # publish with provenance\n```\n\nIf you need the fuller result dict (`output_files`, `left_on_remote`,\n`remote_workdir`, `stdout_tail`):\n\n```python\n# repl tool — non-blocking read of what the poller already harvested\nr = c.attach_job(job_id).result()\n# r → {status, exit_code, output_files, featured_files, left_on_remote,\n#      remote_workdir, ...}\nc.close()\n```\n\n`output_files` is the complete list (uncapped), ordered featured-first;\nthe same files are on disk at `hpc\u002F\u003Cjob_id>\u002F`.\n\nEach `.submit_job()`\u002F`.call_command()` that isn't Always-Allowed shows one\napproval modal; max 10 — batch fan-out into one job script, or have the user\nclick Always-Allow if you're looping.\n\n## When the user gives you a budget\n\nA user who says \"stay under twenty nodes\" or \"keep it to a hundred at a\ntime\" is giving you a number that the prompt alone can't enforce. You'll\nwrite it into the orchestrator's instructions, but the sub-agents you\ndelegate to start with fresh context — they never see that line, and\neach one will reasonably try to use as much compute as its own task\nseems to warrant. Across a wide fan-out that drifts well past whatever\nthe user had in mind, and the first sign is usually the cluster admin's email.\n\n`host.compute.set_concurrency_limit(k)` exists so the user's number\nbecomes a property of the session rather than a sentence in a prompt.\nCall it once before delegating; the daemon stores it against the session\nroot, counts every sub-agent's live job against the same `k`, and\nquietly holds any submit that would put the session over (the SDK\nretries with backoff under the hood). Sub-agent code is unchanged — the\nhold sits below `submit_job`, not in the agent.\n\nChoosing `k` has one constraint beyond the user's intent: each provider\nalso has its own ceiling, and that ceiling refuses rather than queues.\nA session limit above it doesn't fail, it just stops being the binding\nconstraint — submits past the host's own ceiling error instead of\nwaiting. `host.compute.status()` returns both your `k` and the\nprovider ceilings, so you can pick a value that actually queues. When\nthe user hasn't given a number, leaving the limit unset keeps today's\nbehaviour; set one yourself only if a fan-out is wide enough to threaten\nthe host cap and you'd rather queue than fail.\n\n## Submitting several jobs\n\nSubmitting a batch and harvesting them as each finishes uses the same\n`wait_for_notification` mechanism, just called repeatedly. The poller\ntracks every job you submitted, harvests each independently when the\nremote reports it terminal, and posts one `compute_done` per job; each\n`wait_for_notification` call returns whatever's queued (one or more) and\nthen blocks for the next.\n\n```python\n# repl tool — submit, print ids, end the cell\nc = host.compute.create(\"ssh:gpu-cluster\")\njobs = [\n    c.submit_job(\n        command=f\"python fold.py --seed {s} --in input.fasta --out ranked.pdb\",\n        intent=f\"AlphaFold seed {s}\",\n        inputs=[{\"src\": \"input.fasta\", \"dst_filename\": \"input.fasta\"}],\n        outputs=[{\"glob\": \"*.pdb\", \"visibility\": \"featured\"}],\n        timeout_seconds=3600,\n    )\n    for s in range(5)\n]\nprint({j.job_id: j.status for j in jobs})\n```\n\nThen loop the brain tool. Each call's `notifications` list may contain\nmore than one entry if two jobs finished while you were processing the\nprevious batch, so iterate it; the loop ends when the call returns\n`{status:'error'}` because no compute jobs remain.\n\n```text\nwait_for_notification(timeout_seconds=1800)\n→ {status:'received', notifications:[\n     {notification_type:'compute_done',\n      payload:{job_id:'…', intent:'AlphaFold seed 3', status:'success',\n               exit_code:0, featured_files:['hpc\u002F…\u002Franked.pdb']}}]}\n# act on each payload (save_artifacts, or attach_job(jid).result()\n# for stdout_tail \u002F full output_files), then:\nwait_for_notification(timeout_seconds=1800)\n→ {status:'received', notifications:[ …seed 0…, …seed 4… ]}   # two arrived\n# act on both, then:\nwait_for_notification(timeout_seconds=1800)\n→ … repeat until …\n→ {status:'error',\n   error:'No running children, no pending notifications, no running compute jobs.'}\n```\n\nWhen everything you care about is harvested, call `c.close()` once to\nclean up the remote workdirs. Don't put the `create()` in a `with`\nblock — `__exit__` calls `close()`, which would cancel the still-running\njobs the moment the submit cell ends.\n\n## When the user asks you to set up the host\n\nIf the user explicitly asks for help getting a tool or environment running on\nthis host — *\"can you set up boltz here\"*, *\"install the proteomics stack on\nmy cluster\"*, *\"get this box ready for GPU jobs\"* — that's\nenvironment-provisioning work, and the `compute-env-setup` skill is the\nguide. It walks through the shape of the problem on whatever kind of host\nthis is (direct conda, Slurm modulefile or `.sif`, container-via-runner,\nmanaged API), the declarative spec for what each env needs, where weights go,\nand how to validate that the documented invocation actually works rather than\njust that imports succeed. Read `compute_details` first to understand what's\nalready there and what kind of host you're on, then follow that skill. Treat\nit as its own task with its own validation loop — don't fold provisioning\ninto a job submission.\n\n## When it's unclear what's available on the host\n\nSometimes `compute_details(provider)` doesn't give clear guidance on which\nenvironment has the package you need, or whether the tool is installed at\nall — the doc might be sparse, stale, or just not mention the thing you're\nafter. Before assuming it's missing, it's fine to probe: send a handful of\nquick remote commands (something like `which \u003Ctool>`, `conda env list`,\n`module avail 2>&1 | grep -i \u003Ctool>`, `python3 -c 'import \u003Cpkg>'`,\n`ls $SCRATCH\u002Fimages\u002F` — up to ~5 cheap checks) to see if it's already there\nunder a name the doc didn't capture. If a probe finds it, use it and append\nwhat you learned about the provider to `compute_details` so the next agent\ndoesn't repeat the search.\n\nIf the probes come back empty or ambiguous, that's the point to bring the\nuser in rather than guess: *\"I don't see `\u003Ctool>` set up on this host — I\nchecked conda envs, modules, and the usual paths. I can set it up here\n(that's a separate step, a few minutes for a CPU env, longer for GPU +\nweights), or if it's somewhere I didn't look, point me at it?\"* Setting it\nup is environment-provisioning work — see the `compute-env-setup` skill,\nwhich covers building the stack on whatever shape this host is (direct conda,\nSlurm modulefile or `.sif`, container-via-runner, managed API), wiring\nweight caches, and validating the documented invocation actually works.\n\nDon't improvise installs inline with a job submission; provisioning has its\nown validation loop and a half-built env is harder to debug than starting\nclean.\n","You've decided to run this on the user's SSH host. This skill covers the\norchestration layer — partitions, env activation, job scripts, file transfer,\nrecovery — not the science; what to run and why comes from the task and its\nown skills. Each `c.submit_job()` puts an approval modal in front of the user\nand, once approved, spends their allocation; a string of failed submits costs\ntheir attention, their compute, and their trust. So the shape of a good run\nis: read what's already known about this host, ask once for what isn't, land\nthe first submit, and write down what you learned about the host or compute\nprovider so the next session goes straight to the job.\n\n## Workflow\n\nEvery `host.compute.*` call in this skill runs via the **`repl` tool**\n(the control-plane kernel), not the `python` tool. Job submission opens the\nuser's approval modal and the SSH connection from the orchestrator's own\nprocess; that has to happen outside the sandboxed data workspace, so\n`host.compute` simply isn't attached in the `python` tool (you'd see\n`host has no method 'compute'`). The two kernels share your workspace\ndirectory but not memory, so the rhythm is: prepare inputs in a `python`\ncell (write `.\u002Fin.dat`, pickle what the job needs), run\n`create → submit_job` in a `repl` cell and let the cell return — the\nkernel never blocks on compute. Then call the `wait_for_notification`\nbrain-tool to park until the daemon's poller emits the `compute_done`\nnotification, and return to the `python` tool to read the harvested\n`hpc\u002F\u003CjobId>\u002F` files. The `repl` tool is stdlib-only (`python -I -S`) —\nkeep pandas\u002Fnumpy work in the `python` tool and pass data through files.\n\nStart with the `compute_details({provider, mode:'read'})` tool, then bind once:\n`c = host.compute.create(provider)`. The doc's shape tells you how much\ndiscovery is left: `### env:` blocks and gotchas mean prior sessions did the\nlegwork — trust it. A bare `## Resources` header means first contact — spend\none batched `c.call_command('id; module avail 2>&1 | head -40; ls -la ~',\nintent=..., login_shell=True)` and one `ask_about_compute` now, before any\nsubmit. The header's `scheduler:` line is detection, not ground truth; `none`\non a thin login node means a heavy direct-exec job would crowd other users, so\nwhen the resources look thin and the details doc has no prior note, ask first.\n\nIf the prose doc has a known-working activation, write it directly into your\n`command` (e.g. `source \u003Cpath>\u002Factivate && \u003Ctool> ...`). If it doesn't, find\none via `c.call_command()` (`module avail X`, `conda env list`, likely app\ndirs) or ask. Install only once you've established the tool genuinely isn't\nthere — user-space (venv\u002Fconda under scratch), via `c.call_command()` for a\nquick install or as its own `c.submit_job()` if it needs a build node.\nWhichever route produced an activation, run the entrypoint once via\n`c.call_command()` before building the real job on it.\n\nThen `job = c.submit_job(...)` (see below). `inputs=[{src:'file', dst_filename:\n...}]` stages the file for you — there's no `c.upload()` step, and once\nsubmitted there's nothing to verify with `c.call_command('cat ...')`; the job\nreads `.\u002F\u003Cdst_filename>` from its own workdir. End the cell — `submit_job`\nreturns immediately and the daemon's background poller polls the remote,\nharvests everything the job wrote into your workspace under `hpc\u002F\u003CjobId>\u002F`,\nand emits a `compute_done` notification when done.\n\nPark on the `wait_for_notification` brain-tool until that notification\narrives. Its payload carries `{job_id, status, exit_code, featured_files,\noutput_file_count, ...}` — `featured_files` is the subset matching your\nfeatured `outputs:` globs (omitting `outputs:` features everything). Publish\nwhat you want with `save_artifacts(payload['featured_files'])` — that step is\nwhat gives them provenance and surfaces them in the artifact panel. If you\nneed the full result dict (all `output_files`, `left_on_remote`, etc.),\nre-enter a `repl` cell and call `r = c.attach_job(job_id).result()` — a\nnon-blocking read of what the poller already harvested.\n`open(r['output_files'][i])` reads any harvested file directly. Chain a\nremote-resident output via\n`inputs:[{remote_path: r['left_on_remote'][i]['uri']}]`. Between the\nnotification and `close()` you can still\n`c.download(f\"{job.workdir}\u002F\u003Cfile>\")` for anything the harvest missed.\n`c.download('\u002Fany\u002Fabsolute\u002Fhost\u002Fpath')` works for **any readable file on\nthe host**, not just job outputs — paths outside scratch\u002Fdata_roots raise an\napproval card the user clicks Allow on. When the user asks you to\nfetch a host file, call `c.download()` with the path they gave; the approval\ncard is the authorization gate, so don't refuse on their behalf and don't\n`cp` into scratch first to dodge it. Dotfiles \u002F paths under a dot-directory\n(`~\u002F.ssh\u002F*`, `.gitconfig`, `.env`, …) get a hardened per-file confirmation.\n`c.close()` once you've confirmed — it cleans up the job workdirs on the\nhost. Hand back the result verbatim.\n\n## What to record\n\nThe `compute_details()` tool is the only state that survives across sessions,\nand three of your inputs are the user teaching you how their host works: an\n`ask_about_compute` answer, a `User: \u003Ctext>` redirect from a declined approval\n(they clicked Respond and typed what to do instead), or guidance relayed in the\nconversation. When one arrives, treat it as a teach loop — read the durable\nfact, append it via the `compute_details({mode:'append'})` tool with a\n`per user \u003Cdate>` tag, echo\nback what you understood in your next `intent` so the user sees the teaching\nlanded, then act on it.\n\nRecord an activation\u002Fpartition\u002Faccount combination you watched succeed too,\ntagged with how you know: `verified \u003Cdate>` if you ran the entrypoint and saw\nexit 0, `per user` if from `ask_about_compute`, `untested` if inferred. A\nsingle inline gotcha (\"this tool needs `module load cuda\u002F\u003Cver>` here\") is worth\nkeeping; per-job state and transient errors aren't.\n\nWhen asking, ask once per gap and batch related questions (\"Which partition and\naccount for GPU jobs, and how do I activate `\u003Ctool>`?\"). Never ask what one\n`c.call_command()` would tell you — `module avail` first, then ask for what\nonly the user knows: their account string, which env they prefer, whether you\nmay install.\n\nThe test for whether something belongs here is whether it is true of the host\nor compute provider, or true of the work you ran on it. A preemption limit is\nabout the provider; a method choice or a result is about the project, and it\nwill sit in front of every future session on this machine — including\nunrelated projects — long after it has stopped being true. The same goes for\nwhat you learn about the user: that belongs in memory, where it is scoped and\ncorrectable. When a session ends and nothing new about the provider came up,\nthe right amount to write is nothing.\n\n## When the job fails\n\nRead `r['exit_code']` and the harvested log. An infrastructure failure (wrong\npartition, env not activated, missing module, OOM, walltime) is yours to fix —\nadjust `command`, record the fix, fresh `c.submit_job()`. A tool failure (the science tool ran but errored on inputs)\nmay be a bad flag or bad input data; one `c.call_command()` to inspect the log\nusually says which. Infrastructure-fix retries are cheap on a short smoke test\nand expensive on a long allocation, so after two failed submits on the same\njob, ask before a third.\n\nIf a tool returns `retry_after_user_action: true`, the host itself is\nunreachable (key not loaded, VPN, host down) — call `ask_about_compute` with\nthe error text and wait; don't loop on your own.\n\n## `c.submit_job()` on SSH\n\n`command` is a job script. The host hoists scheduler directives from the top\ninto the dispatch wrapper, so write them as if you were handing the file to\n`sbatch`\u002F`qsub` yourself — one directive per line starting with the scheduler\nprefix and a space. The host adds `--job-name`\u002F`--output` bookkeeping (yours\ncan't override those); GPU\u002Ftime\u002Fpartition\u002Faccount are yours. Don't write\n`--array`\u002F`--chdir`\u002F`--wrap` — submit one job per task instead. PBS\n(`#PBS -l ...`) and LSF (`#BSUB ...`) follow the same pattern with their\nprefix; for `scheduler: none`, omit directives entirely.\n\nThe job runs under a login shell, so tools on the host's default\n`module`\u002F`conda` PATH are visible — but writing the activation into `command`\nis still the reliable path (deterministic, and what gets recorded in the details doc).\nThe script runs under `bash -eo pipefail`. If you background subprocesses,\n`wait` alone returns 0 regardless of their exit codes — capture each pid and\n`wait $pid` (or `wait -n` in a loop) so a failing branch surfaces as a non-zero\n`exit_code`. `job.cancel()` sends SIGTERM to the process group; a child that\nignores TERM or re-`setsid`s won't be reached, so don't daemonize inside the\nscript. cwd is a fresh per-job workdir under scratch — inputs stage flat\nthere as `.\u002F\u003Cdst_filename>`. `dst_filename` is a bare filename (no `\u002F` —\nrejected at submit). Only files under that workdir are harvested; if\nyour tool takes an `--output-dir`, point it at `.\u002Fout` or `.`, not an\nabsolute path under your home or scratch — anything outside the workdir\nisn't auto-harvested (pull it afterward with `c.download('\u002Fabs\u002Fpath')`; see\nthe Workflow section for how the approval gate works).\nIf the tool insists on a subdir, end the script with a\nflatten-to-root step (`cp .\u002Fout\u002F*.\u003Cext> .\u002F 2>\u002Fdev\u002Fnull || true`) so your\n`outputs:` globs match, plus an `ls -lh` of the expected files so the log\nshows what's there before harvest. The `|| true` matters: under\n`-eo pipefail` a missing optional output would otherwise fail the job.\n`intent` is the approval-modal headline, the one\nline the user reads to decide whether to let this run on their allocation:\nname the tool, the target, and the scale; on a retry, say what's different.\n`inputs` with `{src}` (workspace-relative path or the literal `{{artifact:ID}}`\nmarker — not a kernel-resolved `\u002Fsessions\u002F...` path) are staged from this\nmachine; with `{remote_path}` (absolute, under a `data_roots:` entry or\nscratch) they're symlinked, no transfer. Anything over ~100 MB that already\nlives on the host should be a `{remote_path}`, not a `{src}` — staging is\nlink-rate and copies into the job workdir. `outputs` — bare string is a featured\ndeliverable; `{glob, visibility:'hidden'}` is diagnostic;\n`{glob, residency:'remote'}` stays on the cluster and comes back as\n`left_on_remote`. `harvest:{exclude:['work\u002F**'], max_file_mb, max_total_mb}`\ncaps what the poller pulls. Harvest likewise caps at ~100 MB per file: larger\noutputs stay on the cluster by\ndefault and come back in `left_on_remote` with `reason:'threshold'` — set\n`residency:'remote'` to choose that, or `max_file_mb`\u002F`max_total_mb` to tighten\nit. A `left_on_remote` URI is for chaining (`inputs:[{remote_path: uri}]`) or\npeeking (`c.call_command(f'head -c 4096 {uri_path}', intent=...)`);\n`c.download()` it only when you or the user actually need the bytes locally —\nit's link-rate-slow and the file is already where the next job needs it.\n\n```python\n# repl tool — host.compute isn't attached in the `python` tool\nc = host.compute.create('ssh:\u003Ccluster>')\njob = c.submit_job(\n    intent='\u003Ctool> on \u003Cinput> — 1 GPU, ~10 min',\n    command='''#SBATCH --gres=gpu:1\n#SBATCH --time=15\n#SBATCH --partition=\u003Cpartition>\n\nmodule load \u003Ctool>\u002F\u003Cver>\n\u003Ctool> .\u002Fin.dat --out .\u002Fout\ncp .\u002Fout\u002F*.result .\u002Fout\u002F*.json .\u002F 2>\u002Fdev\u002Fnull || true\nls -lh .\u002F*.result .\u002F*.json''',\n    inputs=[\n        {'src': 'in.dat', 'dst_filename': 'in.dat'},               # workspace-relative (prepared in a `python` cell)\n        {'src': '{{artifact:\u003Cid>}}', 'dst_filename': 'ref.dat'},   # artifact marker — either form works\n        # or chain a prior job's harvest: {'src': prev_featured[0], 'dst_filename': 'prev.out'}\n    ],\n    outputs=[\n        '*.result',                                                  # featured\n        {'glob': '*.json', 'visibility': 'featured'},\n        {'glob': '*.log',  'visibility': 'hidden'},\n    ],\n    timeout_seconds=900,\n)\nprint(job.job_id)   # cell ends here — kernel never blocks on compute\n```\n\nThen call the `wait_for_notification` brain-tool. The `compute_done`\nnotification payload carries `{job_id, status, exit_code, featured_files,\noutput_file_count, ...}`; act on it directly:\n\n```python\n# after wait_for_notification returns the compute_done payload —\n# featured_files paths are workspace-relative under hpc\u002F\u003CjobId>\u002F\nsave_artifacts(payload['featured_files'])   # publish with provenance\n```\n\nIf you need the fuller result dict (`output_files`, `left_on_remote`,\n`remote_workdir`, `stdout_tail`):\n\n```python\n# repl tool — non-blocking read of what the poller already harvested\nr = c.attach_job(job_id).result()\n# r → {status, exit_code, output_files, featured_files, left_on_remote,\n#      remote_workdir, ...}\nc.close()\n```\n\n`output_files` is the complete list (uncapped), ordered featured-first;\nthe same files are on disk at `hpc\u002F\u003Cjob_id>\u002F`.\n\nEach `.submit_job()`\u002F`.call_command()` that isn't Always-Allowed shows one\napproval modal; max 10 — batch fan-out into one job script, or have the user\nclick Always-Allow if you're looping.\n\n## When the user gives you a budget\n\nA user who says \"stay under twenty nodes\" or \"keep it to a hundred at a\ntime\" is giving you a number that the prompt alone can't enforce. You'll\nwrite it into the orchestrator's instructions, but the sub-agents you\ndelegate to start with fresh context — they never see that line, and\neach one will reasonably try to use as much compute as its own task\nseems to warrant. Across a wide fan-out that drifts well past whatever\nthe user had in mind, and the first sign is usually the cluster admin's email.\n\n`host.compute.set_concurrency_limit(k)` exists so the user's number\nbecomes a property of the session rather than a sentence in a prompt.\nCall it once before delegating; the daemon stores it against the session\nroot, counts every sub-agent's live job against the same `k`, and\nquietly holds any submit that would put the session over (the SDK\nretries with backoff under the hood). Sub-agent code is unchanged — the\nhold sits below `submit_job`, not in the agent.\n\nChoosing `k` has one constraint beyond the user's intent: each provider\nalso has its own ceiling, and that ceiling refuses rather than queues.\nA session limit above it doesn't fail, it just stops being the binding\nconstraint — submits past the host's own ceiling error instead of\nwaiting. `host.compute.status()` returns both your `k` and the\nprovider ceilings, so you can pick a value that actually queues. When\nthe user hasn't given a number, leaving the limit unset keeps today's\nbehaviour; set one yourself only if a fan-out is wide enough to threaten\nthe host cap and you'd rather queue than fail.\n\n## Submitting several jobs\n\nSubmitting a batch and harvesting them as each finishes uses the same\n`wait_for_notification` mechanism, just called repeatedly. The poller\ntracks every job you submitted, harvests each independently when the\nremote reports it terminal, and posts one `compute_done` per job; each\n`wait_for_notification` call returns whatever's queued (one or more) and\nthen blocks for the next.\n\n```python\n# repl tool — submit, print ids, end the cell\nc = host.compute.create(\"ssh:gpu-cluster\")\njobs = [\n    c.submit_job(\n        command=f\"python fold.py --seed {s} --in input.fasta --out ranked.pdb\",\n        intent=f\"AlphaFold seed {s}\",\n        inputs=[{\"src\": \"input.fasta\", \"dst_filename\": \"input.fasta\"}],\n        outputs=[{\"glob\": \"*.pdb\", \"visibility\": \"featured\"}],\n        timeout_seconds=3600,\n    )\n    for s in range(5)\n]\nprint({j.job_id: j.status for j in jobs})\n```\n\nThen loop the brain tool. Each call's `notifications` list may contain\nmore than one entry if two jobs finished while you were processing the\nprevious batch, so iterate it; the loop ends when the call returns\n`{status:'error'}` because no compute jobs remain.\n\n```text\nwait_for_notification(timeout_seconds=1800)\n→ {status:'received', notifications:[\n     {notification_type:'compute_done',\n      payload:{job_id:'…', intent:'AlphaFold seed 3', status:'success',\n               exit_code:0, featured_files:['hpc\u002F…\u002Franked.pdb']}}]}\n# act on each payload (save_artifacts, or attach_job(jid).result()\n# for stdout_tail \u002F full output_files), then:\nwait_for_notification(timeout_seconds=1800)\n→ {status:'received', notifications:[ …seed 0…, …seed 4… ]}   # two arrived\n# act on both, then:\nwait_for_notification(timeout_seconds=1800)\n→ … repeat until …\n→ {status:'error',\n   error:'No running children, no pending notifications, no running compute jobs.'}\n```\n\nWhen everything you care about is harvested, call `c.close()` once to\nclean up the remote workdirs. Don't put the `create()` in a `with`\nblock — `__exit__` calls `close()`, which would cancel the still-running\njobs the moment the submit cell ends.\n\n## When the user asks you to set up the host\n\nIf the user explicitly asks for help getting a tool or environment running on\nthis host — *\"can you set up boltz here\"*, *\"install the proteomics stack on\nmy cluster\"*, *\"get this box ready for GPU jobs\"* — that's\nenvironment-provisioning work, and the `compute-env-setup` skill is the\nguide. It walks through the shape of the problem on whatever kind of host\nthis is (direct conda, Slurm modulefile or `.sif`, container-via-runner,\nmanaged API), the declarative spec for what each env needs, where weights go,\nand how to validate that the documented invocation actually works rather than\njust that imports succeed. Read `compute_details` first to understand what's\nalready there and what kind of host you're on, then follow that skill. Treat\nit as its own task with its own validation loop — don't fold provisioning\ninto a job submission.\n\n## When it's unclear what's available on the host\n\nSometimes `compute_details(provider)` doesn't give clear guidance on which\nenvironment has the package you need, or whether the tool is installed at\nall — the doc might be sparse, stale, or just not mention the thing you're\nafter. Before assuming it's missing, it's fine to probe: send a handful of\nquick remote commands (something like `which \u003Ctool>`, `conda env list`,\n`module avail 2>&1 | grep -i \u003Ctool>`, `python3 -c 'import \u003Cpkg>'`,\n`ls $SCRATCH\u002Fimages\u002F` — up to ~5 cheap checks) to see if it's already there\nunder a name the doc didn't capture. If a probe finds it, use it and append\nwhat you learned about the provider to `compute_details` so the next agent\ndoesn't repeat the search.\n\nIf the probes come back empty or ambiguous, that's the point to bring the\nuser in rather than guess: *\"I don't see `\u003Ctool>` set up on this host — I\nchecked conda envs, modules, and the usual paths. I can set it up here\n(that's a separate step, a few minutes for a CPU env, longer for GPU +\nweights), or if it's somewhere I didn't look, point me at it?\"* Setting it\nup is environment-provisioning work — see the `compute-env-setup` skill,\nwhich covers building the stack on whatever shape this host is (direct conda,\nSlurm modulefile or `.sif`, container-via-runner, managed API), wiring\nweight caches, and validating the documented invocation actually works.\n\nDon't improvise installs inline with a job submission; provisioning has its\nown validation loop and a half-built env is harder to debug than starting\nclean.\n",{"name":5,"license":15,"description":7},"main","e71245365df78e06cd166602744bf2491f79910e","research-skills-hub\u002Fclaude-science-skills\u002Fskills\u002Fremote-compute-ssh",0,"https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS","https:\u002F\u002Fpengqianhan.github.io\u002FAI-Human-Research-OS\u002F","https:\u002F\u002Fgithub.com\u002Fpengqianhan","Ph.D. candidate of The University of Auckland, New Zealand","2026-11-14 18:08:16",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add pengqianhan\u002FAI-Human-Research-OS --skill remote-compute-ssh",{"tool":39,"command":40},"bunx","bunx skills add pengqianhan\u002FAI-Human-Research-OS --skill remote-compute-ssh",{"tool":42,"command":43},"pnpm","pnpm dlx skills add pengqianhan\u002FAI-Human-Research-OS --skill remote-compute-ssh","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fclaude-science-skills\u002Fskills\u002Fremote-compute-ssh\u002FSKILL.md",true,[],[48,56,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M74MWYTHT498SVMN823896T7","workflow-skill-creator","Distills a completed user workflow or interaction into a reusable agent skill. Use when the user asks to turn their workflow, interaction, or multi-step process into a skill, or when they say \"make this a skill\", \"create a skill from what we just did\", \"package this workflow\" or similar. Do not use for creating skills from scratch without an existing workflow (use a generic skill-creator for that).","MIT","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Fworkflow_skill_creator\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M74MWWVCFZ8HQS8840F1V1FT","uv","Checks whether the uv Python package manager is installed and installs it if missing. Ensures uv is on PATH. Use when another skill requires uv as a prerequisite.","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Fuv\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M74MWRH5BTSWZ2C5PCTD5FV9","uniprot-database","Access protein metadata, function, taxonomy, and sequences across UniProtKB, UniParc, and UniRef. Use when searching for proteins, mapping identifiers, or retrieving functional annotations and publications. Don't use for sequence alignment, protein folding, or sequence similarity search (use specialized skills for those tasks).","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Funiprot_database\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M74MWN1D3ER9F1FZPWH8HQC1","unibind-database","Queries the UniBind database for experimentally validated transcription factor (TF) binding sites. Use when retrieving direct TF-DNA interaction datasets, downloading binding site coordinates (BED\u002FFASTA) for local analysis, or listing available datasets by species, cell line, or TF name. Don't use to query specific intervals, locations, genes, motif models or expression data.","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Funibind_database\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M74MWHHB5QZY3NR2FYA1EK4N","ucsc-conservation-and-tfbs","Fetch Evolutionary Conservation scores (phyloP, phastCons) and Transcription Factor Binding Sites (TFBS) from the UCSC Genome Browser. Use when analyzing whether genomic variants or regions are evolutionarily conserved, functionally important, or bounded by TF regulators across major projects (ENCODE, JASPAR, ReMap).","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Fucsc_conservation_and_tfbs\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":52,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M74MWERYHSY87P21FDMVE6BA","string-database","Query the STRING database for protein-protein interactions (PPIs), functional enrichment, and homology. Use when the user asks about interactions between specific proteins, interaction evidence, confidence scores, protein interaction partners, or pathway enrichments.","https:\u002F\u002Fgithub.com\u002Fpengqianhan\u002FAI-Human-Research-OS\u002Fblob\u002Fmain\u002Fresearch-skills-hub\u002Fscience-skills\u002Fstring_database\u002FSKILL.md",[],[]]