Compute Env Setup 标志

Compute Env Setup

组织热门
aipoch
compute-env-setup

准备可复现的设置说明,并在 Open-Science SSH Compute Host 上验证由用户管理的命名软件环境,包括直接通过 SSH 连接的主机和 Slurm 主机。适用于远程任务需要主机未预先提供的软件包、模块、缓存变量或可重复激活的环境时。

Add to TypingMind

概览

发布者aipoch
代码仓库open-science
技能名称compute-env-setup
星标数
5.5K
复刻数
512
附带文件
仅含指令
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 aipoch 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Compute Env Setup AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/aipoch/open-science/tree/main/resources/skills/compute-env-setup
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/aipoch/open-science.git /tmp/open-science
mkdir -p .claude/skills
cp -r /tmp/open-science/resources/skills/compute-env-setup .claude/skills/compute-env-setup
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Compute Env Setup,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Compute Env Setup。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Compute Env Setup 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Compute environment setup

Prepare one reproducible environment definition and instructions for one small user-managed host activation file. Open-Science resolves submitJob(..., { environment: '<name>' }) by sourcing ~/.open-science/environments/<name>.sh before the workload. Existing ~/.openscience/environments/<name>.sh definitions remain readable in place. Before creating an activation, check both names: update the existing definition at its exact location; if both exist, ask the user which to retain. Never create a second activation just to rename the brand. The file contains activation only; it does not install packages when a job starts.

The environment, package caches, images, and activation file are user-managed durable resources, not Open-Science-owned components. This Skill may inspect them and prepare exact setup/removal commands, but must not execute commands that create, replace, or remove those resources. The user or host administrator runs those commands outside Open-Science and owns their lifecycle. Do not interpret the ~/.openscience path as app ownership.

Use host.compute only in repl_execute JavaScript. Python and R data kernels do not expose it. Start from the Session catalog and do not guess a provider id:

javascript
const hosts = await host.compute.listHosts()
const selected = hosts.filter((candidate) => candidate.role === 'selected')
const candidates = selected.length > 0 ? selected : hosts

Choose the requested host, or a suitable candidate when the user left the target open. Read its knowledge and probe snapshot before changing it:

javascript
const providerId = candidates[0].provider_id
const executionMode = candidates[0].execution_mode
const details = await host.compute.details(providerId, { mode: 'read' })
const compute = host.compute.create(providerId)

If no eligible host exists, or the selected host is unsuitable, explain the concrete blocker. Do not install locally as a substitute for a requested remote environment.

Define the environment

Keep the reproducible source in the user's project: an environment.yml, requirements or lock file, container definition, or a short setup script appropriate to the stack. When installation must run on a compute node, include exact user- or administrator-run staging and scheduler commands in the plan; do not submit that installation through Open-Science. Do not store project package lists or secrets in the host knowledge document.

Use a logical name containing 1–64 letters, numbers, periods, underscores, or hyphens, starting with a letter or number. Its host activation file is:

text
~/.open-science/environments/<name>.sh

The activation file itself and every path it references must be visible at the same path on the execution node. A shared home directory satisfies this. If login and compute nodes have separate homes, copy the activation file to the compute-node home at the same path and use shared software and data paths inside it; if the host offers no durable way to do that, explain the limitation.

Prefer the host's existing environment system:

  • Conda or micromamba: create the environment from the project definition, then source the shell hook and activate it in the activation file.
  • Modules: load the exact module versions in the activation file. Combine modules with a venv or conda environment when Python packages are also needed.
  • Apptainer or Singularity: installation and image creation are cluster-specific. Use an existing shared image when possible. Do not claim that environment wraps an arbitrary command in a container; the activation contract only sources shell setup.

Set cache paths and bounded thread variables in the activation file when the workload needs them. Keep credentials out of it. Avoid sudo, system package changes, shell-profile edits, and unrequested changes to other named environments.

Before installing, use one batched, read-only probe to identify the scheduler, available environment tools, relevant modules, quotas, and shared scratch. A typical direct/Slurm probe is:

javascript
const probe = await compute.callCommand(
  'command -v conda || true; command -v micromamba || true; command -v module || true; command -v sbatch || true; printf "HOME=%s\\n" "$HOME"; printf "SCRATCH=%s\\n" "${SCRATCH-}"',
  'Inspect environment tooling',
  { loginShell: true, timeoutSeconds: 60 }
)

Ask the user only for facts the host cannot reveal, such as an allocation account, a required module family, or permission to choose among materially different package stacks.

Prepare user-owned installation and removal

Produce a bounded, copyable installation plan for the user or host administrator. When the host is configured for Slurm, explain whether the plan must be run in an interactive allocation or submitted with provider-approved #SBATCH directives. Do not run the bootstrap through callCommand or submitJob: package installation, image pulls, caches, and activation files outlive the Open-Science process and have no application-owned receipt or uninstall lifecycle.

Name every path the plan will create, its expected storage/network impact, and a matching idempotent removal command. Preserve shared modules, package caches, base Conda installations, and images unless the user explicitly identifies them as exclusively theirs. Never use recursive deletion on a path derived only from an environment name; give the user the exact canonical path to verify first.

The user-run plan should create the environment before installing its activation file. It should write the activation file atomically: create a temporary file, set mode 600, and rename it to <name>.sh only after the environment succeeds. A conda activation file can be as small as:

bash
source "$HOME/miniforge3/etc/profile.d/conda.sh" || return $?
conda activate protein-gpu || return $?
export HF_HOME="${SCRATCH:-$HOME/.cache}/huggingface"
export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK:-1}"

Guard every required setup command with || return $? so a missing module, activation failure, or invalid export stops before the workload. Open-Science also treats any non-zero result from sourcing the activation file as a job failure. Do not append repeatedly or put activation in .bashrc; the named file makes job behavior deterministic without changing the user's interactive shell.

End the plan with an explicit removal procedure for the exact activation file and exclusively user-owned environment prefix. Removal must be safe to repeat and must not scan for similarly named resources. If ownership or sharing is unclear, remove only the activation file after the user verifies its contents and leave the environment/cache/image for the administrator.

Validate where jobs run

Validate the exact activation file, the imports or executables the task needs, and a small output witness. An import alone is insufficient for compiled or GPU software.

For direct SSH, run the witness with callCommand:

javascript
const witness = await compute.callCommand(
  '. "$HOME/.open-science/environments/protein-gpu.sh" && python -c "import sys; print(sys.executable)"',
  'Validate protein-gpu environment',
  { loginShell: true, timeoutSeconds: 120 }
)

For Slurm, run the witness through the same job path users will use. Put the provider-known #SBATCH directives first, select the new logical environment, and request a small text output:

javascript
const job = await compute.submitJob(
  'Validate protein-gpu on one Slurm node',
  '#SBATCH --partition=<provider-known-partition>\n#SBATCH --time=00:05:00\npython -c "import sys; print(sys.executable)" > environment-witness.txt',
  {
    environment: 'protein-gpu',
    outputs: ['environment-witness.txt'],
    timeoutSeconds: 600
  }
)
await new Promise((resolve) => setTimeout(resolve, 2000))
return compute.attachJob(job.job_id).result()

The immediate result read is a single non-blocking failure check. End the cell afterward; Open Science polls and harvests the job in the background and starts the analysis turn when it finishes. Do not poll.

When validation fails, diagnose the layer identified by the error: environment definition, activation, shared filesystem visibility, scheduler request, binary compatibility, or cache population. Prepare revised user-run commands; do not mutate the durable environment, add a readiness flag, or bypass the named activation file.

Record reusable host facts

After a successful witness, append a concise host-scoped note with the environment name, activation path, environment system, shared paths, scheduler requirements, and validation date. Keep the project definition in the project and reference its path rather than copying it into the note.

Record only facts established by host documentation or an explicit check. A successful witness proves that the environment was visible on that allocation; it does not by itself prove that home directories or software paths are shared across every compute node. Describe filesystem scope as unknown or limited to the observed allocation unless stronger evidence establishes it. Likewise, do not infer sudo, package-manager, network, quota, or administrator permissions from a missing tool or one failed install command. Separate known host facts, this witness's observations, and assumptions that still need confirmation in both the project reproduction notes and host knowledge.

javascript
await host.compute.details(providerId, {
  mode: 'append',
  text: '\n### Environment: protein-gpu\nActivation: ~/.open-science/environments/protein-gpu.sh\nDefinition: environment.yml in the project\nValidated: <date>, direct or Slurm witness succeeded\n'
})

If the requested environment already exists and the exact witness passes, leave it unchanged and record only genuinely new host knowledge.

常见问题

Compute Env Setup AI 技能有什么作用?

准备可复现的设置说明,并在 Open-Science SSH Compute Host 上验证由用户管理的命名软件环境,包括直接通过 SSH 连接的主机和 Slurm 主机。适用于远程任务需要主机未预先提供的软件包、模块、缓存变量或可重复激活的环境时。

为什么在 TypingMind 中使用 Compute Env Setup?

因为您只需安装一次,就能搭配任何模型使用。Compute Env Setup 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Compute Env Setup?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/aipoch/open-science/tree/main/resources/skills/compute-env-setup。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Compute Env Setup?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Compute Env Setup 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Compute Env Setup 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Compute Env Setup AI 技能免费吗?

是的。aipoch 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇