nemo_gym.skills

View as Markdown

Agent skills: a directory of skills made available to an agent at rollout time.

Skills follow the open Agent Skills standard <https://agentskills.io/specification>_ used by Codex CLI and Claude Code. A skill is a directory containing a SKILL.md file (YAML frontmatter + markdown body) plus optional supporting files. The skills.path config points at a directory of such skill directories.

Skills are a run-level knob (specified on gym eval run), applied to a fixed, skill-agnostic dataset — mirroring how prompt.py applies a prompt template. They are not a dataset-row field, so the same dataset is reusable across skill variants. Each rollout result is stamped with a skills_ref for provenance/grouping in reward profiling.

The skills_ref carries a content hash (a short sha256 over the skill directory’s sorted relative paths + file bytes) so that variants that mutate a skill in place at the same path — as optimizer loops like ACE, GEPA, and EvoSkill commonly do — remain distinguishable when comparing rollouts. Identity is derived from bytes on disk, so it requires no cooperation from the optimizer.

Module Contents

Classes

NameDescription
SkillMetadataMetadata parsed from a single skill’s SKILL.md YAML frontmatter.
SkillsConfigRun-level skills config: skills.path points at a directory of skill directories.
SkillsRefProvenance stamp describing the skills made available for a run.

Functions

NameDescription
_resolve_skills_pathResolve a skills path. Relative paths check cwd first, then the Gym root (PARENT_DIR).
hash_skill_dirCompute a stable short sha256 over a skill directory’s contents.
load_skill_directoryLoad a directory of skills, returning a SkillsRef (path, content hash, metadata).
parse_skill_mdParse a SKILL.md file’s YAML frontmatter into SkillMetadata.
stage_skillsCopy the directory of skills at path into dest_skills_dir.

Data

SKILL_MD_FILENAME

_HASH_PREFIX_LEN

API

class nemo_gym.skills.SkillMetadata()

Bases: BaseModel

Metadata parsed from a single skill’s SKILL.md YAML frontmatter.

description
Optional[str] = None
name
str
version
Optional[str] = None
class nemo_gym.skills.SkillsConfig()

Bases: BaseModel

Run-level skills config: skills.path points at a directory of skill directories.

path
str
class nemo_gym.skills.SkillsRef()

Bases: BaseModel

Provenance stamp describing the skills made available for a run.

Stamped onto rollout result rows (not source datasets). hash is a content digest so two skill versions at the same path do not collide in profiling.

hash
str
path
str
skills
List[SkillMetadata]
nemo_gym.skills._resolve_skills_path(
path: str
) -> pathlib.Path

Resolve a skills path. Relative paths check cwd first, then the Gym root (PARENT_DIR).

This matches how input_jsonl_fpath and config_paths are resolved.

nemo_gym.skills.hash_skill_dir(
root: pathlib.Path
) -> str

Compute a stable short sha256 over a skill directory’s contents.

Walks files in sorted relative-path order, folding each file’s relative path and bytes into the digest. Including the relative path means renaming or adding/removing files also changes the hash — a skill is its file layout, not just SKILL.md’s bytes.

nemo_gym.skills.load_skill_directory(
path: str
) -> nemo_gym.skills.SkillsRef

Load a directory of skills, returning a SkillsRef (path, content hash, metadata).

The directory at path contains one subdirectory per skill, each with a SKILL.md. Raises ValueError with an actionable message if the path is missing, is not a directory, contains no skills, or contains a malformed skill.

nemo_gym.skills.parse_skill_md(
skill_md_path: pathlib.Path
) -> nemo_gym.skills.SkillMetadata

Parse a SKILL.md file’s YAML frontmatter into SkillMetadata.

Frontmatter is delimited by lines containing only ---. Raises ValueError with a clear message if the frontmatter is missing, malformed, or lacks a name.

nemo_gym.skills.stage_skills(
path: str,
dest_skills_dir: pathlib.Path
) -> None

Copy the directory of skills at path into dest_skills_dir.

Used by agent runtimes to materialize skills into a location their native discovery mechanism scans (e.g. <CLAUDE_CONFIG_DIR>/skills/ for Claude Code). dest_skills_dir must not already exist. Raises ValueError if the source path is missing or not a directory.

nemo_gym.skills.SKILL_MD_FILENAME = 'SKILL.md'
nemo_gym.skills._HASH_PREFIX_LEN = 12