reach.catalog¶
Filesystem scanning, discovery, and YAML frontmatter parsing routines.
Load skills from a repository root and compose them into catalogs for evaluation.
build_catalogs ¶
build_catalogs(
skills: Sequence[Skill],
mode: CatalogMode,
size: int = 20,
rivals: int = 10,
seed: int = 0,
scorer: Scorer | None = None,
target_skill: str | None = None,
) -> list[Catalog]
Assemble skill catalogs from a corpus using the specified cataloging mode.
Source code in src/reach/catalog.py
build_neighborhood_catalogs ¶
build_neighborhood_catalogs(
skills: Sequence[Skill],
size: int = 20,
rivals: int = 10,
seed: int = 0,
scorer: Scorer | None = None,
) -> list[Catalog]
Generate fixed-size catalogs per skill containing target, rivals, and filler.
Source code in src/reach/catalog.py
build_scaling_catalogs ¶
build_scaling_catalogs(
skills: Sequence[Skill],
target_skill: str,
scales: Sequence[int],
rivals_share: float = 0.5,
seed: int = 0,
scorer: Scorer | None = None,
) -> list[Catalog]
Generate multi-scale catalogs for a target skill across requested scales.
Source code in src/reach/catalog.py
corpus_digest ¶
corpus_digest(skills: Sequence[Skill]) -> str
Compute deterministic 12-char SHA-256 digest of corpus names/descriptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skills
|
Sequence[Skill]
|
Sequence of resident Skill objects. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A 12-character hexadecimal SHA-256 digest identifying the corpus selection surface. |
Source code in src/reach/catalog.py
load_registry_skills ¶
load_registry_skills(
project: str,
location: str = "global",
publisher: str | None = None,
fresh: bool = False,
no_cache: bool = False,
cache_ttl_seconds: int = 300,
cache_root: Path | str | None = None,
) -> list[Skill]
Fetch and load skills from Google Cloud Agent Registry via local cache mirror.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Google Cloud project ID. |
required |
location
|
str
|
Registry location (default: 'global'). |
'global'
|
publisher
|
str | None
|
Optional publisher filter. |
None
|
fresh
|
bool
|
If True, bypass metadata TTL and query live. |
False
|
no_cache
|
bool
|
If True, run in ephemeral memory/tempdir. |
False
|
cache_ttl_seconds
|
int
|
TTL in seconds for metadata cache validity. |
300
|
cache_root
|
Path | str | None
|
Optional custom cache directory. |
None
|
Returns:
| Type | Description |
|---|---|
list[Skill]
|
Sorted list of resident Skill objects. |
Source code in src/reach/catalog.py
load_skills ¶
load_skills(root: Path | str) -> list[Skill]
Load and parse all skills under a directory root, sorted by skill name.
Deduplicates skills sharing the same name by selecting the shortest path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | str
|
Directory path containing skill subdirectories or SKILL.md files. |
required |
Returns:
| Type | Description |
|---|---|
list[Skill]
|
Sorted list of resident Skill objects found under the directory. |
Raises:
| Type | Description |
|---|---|
NotADirectoryError
|
If the resolved path does not exist or is not a directory. |
Source code in src/reach/catalog.py
parse_frontmatter ¶
parse_frontmatter(text: str, path: Path) -> Skill | None
Parse a SKILL.md file's YAML frontmatter into a validated Skill model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw markdown file contents including frontmatter block. |
required |
path
|
Path
|
Filesystem path to the SKILL.md file (used for fallback naming). |
required |
Returns:
| Type | Description |
|---|---|
Skill | None
|
A validated Skill model instance, or None if frontmatter cannot be parsed. |
Source code in src/reach/catalog.py
resolve_catalog ¶
Retrieve a catalog by identifier from a sequence of catalogs.