Skip to content

The agent that grows with you

test: consolidate skill policy and preserve specific obligations

ethernetcc45adb7fa1a
diff --git a/tests/skills/test_actual_setup_skill.py b/tests/skills/test_actual_setup_skill.py
deleted file mode 100644
index 36c890e027a..00000000000
--- a/tests/skills/test_actual_setup_skill.py
+++ /dev/null
@@ -1,68 +0,0 @@
-"""
-Smoke tests for the actual-setup optional skill.
-
-Validates:
- - SKILL.md frontmatter conforms to the ≤60-char description standard
- - Frontmatter has required fields
- - The skill references the first-class ``actual`` provider (not the
- legacy custom-provider config path that conflicts with it)
- - The bundled OpenCode reference exists
-"""
-from __future__ import annotations
-
-import re
-from pathlib import Path
-
-import pytest
-import hermes_yaml as yaml
-
-SKILL_DIR = (
- Path(__file__).resolve().parents[2]
- / "optional-skills"
- / "devops"
- / "actual-setup"
-)
-
-
[email protected](scope="module")
-def skill_source() -> str:
- return (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8")
-
-
[email protected](scope="module")
-def frontmatter(skill_source) -> dict:
- m = re.search(r"^---\n(.*?)\n---", skill_source, re.DOTALL)
- assert m, "SKILL.md missing YAML frontmatter"
- return yaml.safe_load(m.group(1))
-
-
-def test_skill_dir_exists() -> None:
- assert SKILL_DIR.is_dir(), f"missing skill dir: {SKILL_DIR}"
-
-
-def test_description_under_60_chars(frontmatter) -> None:
- desc = frontmatter["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars (limit ≤60): {desc!r}"
-
-
-def test_has_required_frontmatter_fields(frontmatter) -> None:
- for field in ("name", "description", "version", "license"):
- assert field in frontmatter, f"missing required field: {field}"
-
-
-def test_credits_contributor(frontmatter) -> None:
- assert "shl0ms" in str(frontmatter.get("author", "")), (
- "author must credit the human contributor first"
- )
-
-
-def test_uses_first_class_provider_not_custom_provider(skill_source) -> None:
- # The legacy setup configured Actual as providers.actual.* custom entries,
- # which now collides with the built-in provider of the same name.
- assert "--provider actual" in skill_source
- assert "hermes config set providers.actual.api " not in skill_source
- assert "key_env" not in skill_source
-
-
-def test_opencode_reference_exists() -> None:
- assert (SKILL_DIR / "references" / "opencode.md").is_file()
diff --git a/tests/skills/test_darwinian_evolver_skill.py b/tests/skills/test_darwinian_evolver_skill.py
deleted file mode 100644
index d9380b3504b..00000000000
--- a/tests/skills/test_darwinian_evolver_skill.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""
-Smoke tests for the darwinian-evolver optional skill.
-
-We can't actually run the evolution loop in CI (it needs network + a paid LLM),
-so these tests verify:
- - SKILL.md frontmatter conforms to the hardline format
- - shipped scripts parse as valid Python
- - the scripts reference the right env var / module paths
-"""
-from __future__ import annotations
-
-import ast
-import re
-from pathlib import Path
-
-import pytest
-import hermes_yaml as yaml
-
-SKILL_DIR = Path(__file__).resolve().parents[2] / "optional-skills" / "research" / "darwinian-evolver"
-
-
[email protected](scope="module")
-def frontmatter() -> dict:
- src = (SKILL_DIR / "SKILL.md").read_text()
- m = re.search(r"^---\n(.*?)\n---", src, re.DOTALL)
- assert m, "SKILL.md missing YAML frontmatter"
- return yaml.safe_load(m.group(1))
-
-
-def test_skill_dir_exists() -> None:
- assert SKILL_DIR.is_dir(), f"missing skill dir: {SKILL_DIR}"
-
-
-
-
-def test_description_under_60_chars(frontmatter) -> None:
- desc = frontmatter["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars (hardline ≤60): {desc!r}"
-
-
-
-
-def test_platforms_excludes_windows(frontmatter) -> None:
- # Upstream uses func_timeout (POSIX signals) and uv subprocess pipelines; the
- # skill is gated [linux, macos]. If we ever port to Windows, update this test
- # to assert ["linux", "macos", "windows"].
- assert "windows" not in frontmatter["platforms"]
- assert set(frontmatter["platforms"]) >= {"linux", "macos"}
-
-
-def test_author_credits_contributor(frontmatter) -> None:
- author = frontmatter["author"]
- assert "Bihruze" in author, f"author should credit the original contributor: {author!r}"
-
-
-
-
- "path",
- [
- "scripts/parrot_openrouter.py",
- "scripts/show_snapshot.py",
- "templates/custom_problem_template.py",
- ],
-)
-def test_shipped_scripts_parse(path: str) -> None:
- src = (SKILL_DIR / path).read_text()
- ast.parse(src) # raises SyntaxError on broken Python
-
-
-def test_parrot_script_uses_openrouter() -> None:
- src = (SKILL_DIR / "scripts" / "parrot_openrouter.py").read_text()
- assert "OPENROUTER_API_KEY" in src, "parrot driver should read OPENROUTER_API_KEY"
- assert "openrouter.ai/api/v1" in src, "parrot driver should target OpenRouter"
- assert "EVOLVER_MODEL" in src, "model should be overridable via EVOLVER_MODEL"
-
-
-
-
-
-
diff --git a/tests/skills/test_decision_questionnaire_skill.py b/tests/skills/test_decision_questionnaire_skill.py
deleted file mode 100644
index d32c4710947..00000000000
--- a/tests/skills/test_decision_questionnaire_skill.py
+++ /dev/null
@@ -1,62 +0,0 @@
-"""Tests for optional-skills/productivity/decision-questionnaire."""
-
-import re
-from pathlib import Path
-
-import pytest
-import hermes_yaml as yaml
-
-SKILL_MD = (
- Path(__file__).resolve().parents[2]
- / "optional-skills"
- / "productivity"
- / "decision-questionnaire"
- / "SKILL.md"
-)
-
-
-def _frontmatter():
- text = SKILL_MD.read_text(encoding="utf-8")
- m = re.match(r"^---\n(.*?)\n---\n", text, re.DOTALL)
- assert m, "SKILL.md missing YAML frontmatter"
- return yaml.safe_load(m.group(1))
-
-
-class TestFrontmatter:
- def test_name_matches_directory(self):
- assert _frontmatter()["name"] == "decision-questionnaire"
-
- def test_description_length_and_period(self):
- desc = _frontmatter()["description"]
- assert len(desc) <= 60
- assert desc.endswith(".")
-
- def test_license_and_platforms(self):
- fm = _frontmatter()
- assert fm["license"] == "MIT"
- assert set(fm["platforms"]) == {"linux", "macos", "windows"}
-
-
-class TestBody:
- def _body(self):
- return SKILL_MD.read_text(encoding="utf-8")
-
- def test_template_sections_present(self):
- body = self._body()
- for section in ("## Context", "## How to answer", "## Anything else?"):
- assert section in body, f"template missing {section}"
-
- def test_output_filename_convention(self):
- assert "decision-questionnaire-<slug>.md" in self._body()
-
- def test_interview_the_send_principle(self):
- assert "Interview the Send" in self._body()
-
- def test_no_upstream_harness_residue(self):
- lower = self._body().lower()
- for token in ("claude", "slash command", "disable-model-invocation"):
- assert token not in lower, f"upstream residue: {token}"
-
-
-if __name__ == "__main__":
- raise SystemExit(pytest.main([__file__, "-q"]))
diff --git a/tests/skills/test_email_inbox_triage_skill.py b/tests/skills/test_email_inbox_triage_skill.py
deleted file mode 100644
index 6c855274f64..00000000000
--- a/tests/skills/test_email_inbox_triage_skill.py
+++ /dev/null
@@ -1,89 +0,0 @@
-"""Tests for the email-inbox-triage bundled skill."""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-SKILL_PATH = (
- Path(__file__).resolve().parents[2]
- / "skills"
- / "email"
- / "email-inbox-triage"
- / "SKILL.md"
-)
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "email-inbox-triage"
- hermes = fm["metadata"]["hermes"]
- assert hermes["tags"]
- assert "related_skills" in hermes
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent"), "human contributor must be credited first"
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- repo_root = SKILL_PATH.parents[3]
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(repo_root.glob(f"skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_body_structure_and_size():
- _, body = _frontmatter_and_body()
- for section in ("## When to Use", "## Procedure", "## Pitfalls", "## Verification"):
- assert section in body, f"missing section: {section}"
- assert len(SKILL_PATH.read_text(encoding="utf-8")) <= 100_000
-
-
-def test_no_machine_local_paths():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert "/home/" not in content
- assert not re.search(r"[A-Z]:\\\\Users", content)
-
-
-def test_steps_have_completion_criteria():
- _, body = _frontmatter_and_body()
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## )", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 5
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
-
-
-def test_mutation_boundary_is_default_safe():
- _, body = _frontmatter_and_body()
- assert "read + draft" in body, "scope step must default to read+draft, not send/delete"
- assert "does not imply permission" in body
diff --git a/tests/skills/test_github_skill.py b/tests/skills/test_github_skill.py
deleted file mode 100644
index 1b068c30b1f..00000000000
--- a/tests/skills/test_github_skill.py
+++ /dev/null
@@ -1,130 +0,0 @@
-"""Tests for the github merged skill (formerly six github-* skills).
-
-The issue-to-pr workflow (originally the github-issue-to-pr skill,
-author benbarclay) now lives complete in references/issue-to-pr.md of the
-merged software-development/github skill. Frontmatter contracts apply to
-the merged SKILL.md; the content pins that guarded the issue-to-pr
-disciplines now check the reference body.
-"""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-SKILL_DIR = (
- Path(__file__).resolve().parents[2]
- / "skills"
- / "software-development"
- / "github"
-)
-SKILL_PATH = SKILL_DIR / "SKILL.md"
-ISSUE_TO_PR_REF = SKILL_DIR / "references" / "issue-to-pr.md"
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_all_workflow_references_exist():
- for ref in (
- "auth.md",
- "issues.md",
- "pr-workflow.md",
- "issue-to-pr.md",
- "code-review.md",
- "repo-management.md",
- ):
- assert (SKILL_DIR / "references" / ref).is_file(), f"missing reference: {ref}"
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "github"
- hermes = fm["metadata"]["hermes"]
- assert hermes["tags"]
- assert "related_skills" in hermes
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent"), "human contributor must be credited first"
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- repo_root = SKILL_PATH.parents[3]
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(repo_root.glob(f"skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_body_routes_every_workflow():
- _, body = _frontmatter_and_body()
- for ref in (
- "references/auth.md",
- "references/issues.md",
- "references/pr-workflow.md",
- "references/issue-to-pr.md",
- "references/code-review.md",
- "references/repo-management.md",
- ):
- assert ref in body, f"routing table missing: {ref}"
- assert len(SKILL_PATH.read_text(encoding="utf-8")) <= 100_000
-
-
-def test_no_machine_local_paths():
- for p in (SKILL_PATH, ISSUE_TO_PR_REF):
- content = p.read_text(encoding="utf-8")
- assert "/home/" not in content
- assert not re.search(r"[A-Z]:\\\\Users", content)
-
-
-def test_issue_to_pr_steps_have_completion_criteria():
- body = ISSUE_TO_PR_REF.read_text(encoding="utf-8")
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## |\Z)", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 6
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
-
-
-def test_issue_to_pr_core_disciplines_present():
- """The learnings folded in from maintainer practice must survive edits."""
- body = ISSUE_TO_PR_REF.read_text(encoding="utf-8")
- assert "--comments" in body, "must read the full issue thread"
- assert "pr list --search" in body, "must sweep for duplicate PRs before coding"
- assert re.search(r"git log -p -S", body), "must check design intent via history"
- assert "sabotage" in body.lower() or "FAILS" in body, "must prove the regression test bites"
- assert "sibling" in body, "must fix the class, not the site"
- assert "dispatches CI" in body, "must open the PR immediately after work exists"
-
-
-def test_issue_to_pr_not_a_router():
- """Reference steps must carry their own procedure, not route elsewhere."""
- body = ISSUE_TO_PR_REF.read_text(encoding="utf-8")
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## |\Z)", body, re.MULTILINE | re.DOTALL)
- routing = [s for s in steps if re.match(r"^### \d+\.[^\n]*\n+Load `", s)]
- assert len(routing) == 0, "steps must not open by delegating to another skill"
diff --git a/tests/skills/test_mcp_oauth_remote_gateway_skill.py b/tests/skills/test_mcp_oauth_remote_gateway_skill.py
index 9b80a55f9b0..3aaa9e04f27 100644
--- a/tests/skills/test_mcp_oauth_remote_gateway_skill.py
+++ b/tests/skills/test_mcp_oauth_remote_gateway_skill.py
@@ -1,8 +1,6 @@
"""Tests for the mcp-oauth-remote-gateway optional skill.
-Covers the diagnose-oauth-mcp.py decision tree (TOKEN_OK / REFRESH_FIXED /
-SESSION_REVOKED / REFRESH_DEAD), the HERMES_HOME resolution fallback, the
-atomic --write persistence path, and SKILL.md frontmatter invariants.
+Covers diagnose-oauth-mcp.py's TOKEN_OK / no-refresh-token branches and UA.
No live network calls — urllib is mocked throughout.
"""
from __future__ import annotations
@@ -10,14 +8,11 @@ from __future__ import annotations
import importlib.util
import io
import json
-import re
import sys
import urllib.error
from pathlib import Path
from unittest.mock import patch
-import pytest
-
SKILL_DIR = (
Path(__file__).resolve().parents[2]
/ "optional-skills"
@@ -25,7 +20,6 @@ SKILL_DIR = (
/ "mcp-oauth-remote-gateway"
)
SCRIPT_PATH = SKILL_DIR / "scripts" / "diagnose-oauth-mcp.py"
-SKILL_MD = SKILL_DIR / "SKILL.md"
def load_module():
@@ -124,16 +118,6 @@ def test_refresh_dead_no_refresh_token(tmp_path):
assert "BRANCH=REFRESH_DEAD" in out
-
-
-
-
-
-
-
-
-
-
def test_requests_send_httpx_user_agent(tmp_path):
"""Cloudflare 403s bare urllib UAs — every request must carry the httpx UA."""
mod = load_module()
@@ -142,14 +126,3 @@ def test_requests_send_httpx_user_agent(tmp_path):
_, calls = _run_main(mod, tokens_dir, ["stripe"], [FakeResponse(200, _init_ok_body())])
for req in calls:
assert req.get_header("User-agent") == mod.UA
-
-
-def test_skill_md_frontmatter_invariants():
- yaml = pytest.importorskip("hermes_yaml")
- content = SKILL_MD.read_text()
- assert content.startswith("---\n")
- fm = yaml.safe_load(re.search(r"^---\n(.*?)\n---", content, re.DOTALL).group(1))
- assert len(fm["description"]) <= 60
- assert fm["description"].endswith(".")
- assert "platforms" in fm and len(fm["platforms"]) >= 1
- assert fm["author"].split(",")[0].strip() != "Hermes Agent" # human credited first
diff --git a/tests/skills/test_meeting_action_items_skill.py b/tests/skills/test_meeting_action_items_skill.py
deleted file mode 100644
index b8c79014fbb..00000000000
--- a/tests/skills/test_meeting_action_items_skill.py
+++ /dev/null
@@ -1,96 +0,0 @@
-"""Tests for the meeting-action-items bundled skill."""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-SKILL_PATH = (
- Path(__file__).resolve().parents[2]
- / "skills"
- / "productivity"
- / "meeting-action-items"
- / "SKILL.md"
-)
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "meeting-action-items"
- hermes = fm["metadata"]["hermes"]
- assert hermes["tags"]
- assert "related_skills" in hermes
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent"), "human contributor must be credited first"
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- repo_root = SKILL_PATH.parents[3]
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(repo_root.glob(f"skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_no_phantom_connectors_in_prose():
- """Prose must not name tracker connectors that don't exist as skills."""
- _, body = _frontmatter_and_body()
- assert not re.search(r"\bLinear\b", body), "no phantom 'Linear' connector references"
-
-
-def test_body_structure_and_size():
- _, body = _frontmatter_and_body()
- for section in ("## When to Use", "## Procedure", "## Pitfalls", "## Verification"):
- assert section in body, f"missing section: {section}"
- assert len(SKILL_PATH.read_text(encoding="utf-8")) <= 100_000
-
-
-def test_no_machine_local_paths():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert "/home/" not in content
- assert not re.search(r"[A-Z]:\\\\Users", content)
-
-
-def test_steps_have_completion_criteria():
- _, body = _frontmatter_and_body()
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## )", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 5
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
-
-
-def test_core_disciplines_present():
- _, body = _frontmatter_and_body()
- assert "never invent" in body, "due-date invention ban must be present"
- assert "before creating anything" in body, "reconcile-before-create must be present"
- assert "`unresolved`" in body, "missing owners/dates stay visibly unresolved"
diff --git a/tests/skills/test_optional_skill_scripts.py b/tests/skills/test_optional_skill_scripts.py
new file mode 100644
index 00000000000..0d0747f6561
--- /dev/null
+++ b/tests/skills/test_optional_skill_scripts.py
@@ -0,0 +1,84 @@
+"""Execute optional research helpers offline; upstream/SDK doubles are boundary spies.
+
+This covers importability and client routing, not the paid evolution loop or a
+live vector service. Document policy belongs to test_skill_document_contracts.
+"""
+import pickle
+from pathlib import Path
+import runpy
+import sys
+from types import ModuleType, SimpleNamespace
+from unittest.mock import Mock
+
+import pytest
+
+RESEARCH = Path(__file__).resolve().parents[2] / "optional-skills/research"
+
+
[email protected]("script", ["rag_pipeline.py", "memory_manager.py"])
+def test_pinecone_client_uses_key_and_rejects_missing_key(script, monkeypatch, capsys):
+ sdk = ModuleType("pinecone")
+ constructor = Mock()
+ monkeypatch.setattr(sdk, "Pinecone", constructor, raising=False)
+ monkeypatch.setitem(sys.modules, "pinecone", sdk)
+ get_client = runpy.run_path(str(RESEARCH / "pinecone-research/scripts" / script))["get_pinecone_client"]
+ monkeypatch.setenv("PINECONE_API_KEY", "test-only-key")
+ assert get_client() is constructor.return_value
+ constructor.assert_called_once_with(api_key="test-only-key")
+ monkeypatch.delenv("PINECONE_API_KEY")
+ with pytest.raises(SystemExit, match="1"):
+ get_client()
+ assert "PINECONE_API_KEY" in capsys.readouterr().err
+ assert constructor.call_count == 1
+
+
[email protected]("relative", [
+ "scripts/parrot_openrouter.py", "templates/custom_problem_template.py",
+])
+def test_evolver_provider_routing(relative, monkeypatch):
+ # The upstream package is optional/AGPL; only its imported types are needed
+ # to load these scripts and exercise their own provider client functions.
+ class UpstreamType:
+ def __class_getitem__(cls, _):
+ return cls
+
+ for module, names in {
+ "cli_common": "build_hyperparameter_config_from_args register_hyperparameter_args parse_learning_log_view_type",
+ "evolve_problem_loop": "EvolveProblemLoop",
+ "learning_log": "LearningLogEntry",
+ "problem": "EvaluationFailureCase EvaluationResult Evaluator Mutator Organism Problem",
+ }.items():
+ stub = ModuleType(f"darwinian_evolver.{module}")
+ for name in names.split():
+ setattr(stub, name, UpstreamType)
+ monkeypatch.setitem(sys.modules, stub.__name__, stub)
+ import openai
+
+ constructor = Mock()
+ monkeypatch.setattr(openai, "OpenAI", constructor)
+ monkeypatch.setenv("OPENROUTER_API_KEY", "test-only-key")
+ monkeypatch.setenv("EVOLVER_MODEL", "test/provider-model")
+ script = runpy.run_path(str(RESEARCH / "darwinian-evolver" / relative))
+ create = constructor.return_value.chat.completions.create
+ create.return_value = SimpleNamespace(choices=[SimpleNamespace(message=SimpleNamespace(content="reply"))])
+ assert script["_prompt_llm"]("question") == "reply"
+ constructor.assert_called_once_with(api_key="test-only-key", base_url="https://openrouter.ai/api/v1")
+ assert create.call_args.kwargs["model"] == "test/provider-model"
+ assert create.call_args.kwargs["messages"] == [{"role": "user", "content": "question"}]
+ monkeypatch.delenv("OPENROUTER_API_KEY")
+ with pytest.raises(SystemExit, match="OPENROUTER_API_KEY"):
+ script["_client"]()
+ assert constructor.call_count == 1
+
+
+def test_snapshot_requires_trust_before_unpickling(tmp_path, monkeypatch, capsys):
+ snapshot = tmp_path / "snapshot.pkl"
+ snapshot.write_bytes(pickle.dumps({"population_snapshot": pickle.dumps({"organisms": []})}))
+ script = RESEARCH / "darwinian-evolver/scripts/show_snapshot.py"
+ main = runpy.run_path(str(script))["main"]
+ monkeypatch.setattr(sys, "argv", [str(script), str(snapshot)])
+ with pytest.raises(SystemExit, match="refusing to unpickle"):
+ main()
+ monkeypatch.setattr(sys, "argv", [str(script), str(snapshot), "--i-trust-this-file"])
+ assert main() == 0
+ assert "# organisms: 0" in capsys.readouterr().out
diff --git a/tests/skills/test_pinecone_research_skill.py b/tests/skills/test_pinecone_research_skill.py
deleted file mode 100644
index d8de13b7762..00000000000
--- a/tests/skills/test_pinecone_research_skill.py
+++ /dev/null
@@ -1,82 +0,0 @@
-"""
-Smoke tests for the pinecone-research optional skill.
-
-Validates:
- - SKILL.md frontmatter conforms to the ≤60-char description standard
- - The skill name is distinct from the existing mlops/pinecone skill
- - Frontmatter has required fields
-"""
-from __future__ import annotations
-
-import re
-from pathlib import Path
-
-import pytest
-import hermes_yaml as yaml
-
-SKILL_DIR = (
- Path(__file__).resolve().parents[2]
- / "optional-skills"
- / "research"
- / "pinecone-research"
-)
-
-MLOPS_PINECONE_DIR = (
- Path(__file__).resolve().parents[2]
- / "optional-skills"
- / "mlops"
- / "pinecone"
-)
-
-
[email protected](scope="module")
-def frontmatter() -> dict:
- src = (SKILL_DIR / "SKILL.md").read_text(encoding="utf-8")
- m = re.search(r"^---\n(.*?)\n---", src, re.DOTALL)
- assert m, "SKILL.md missing YAML frontmatter"
- return yaml.safe_load(m.group(1))
-
-
-def test_skill_dir_exists() -> None:
- assert SKILL_DIR.is_dir(), f"missing skill dir: {SKILL_DIR}"
-
-
-
-
-def test_description_under_60_chars(frontmatter) -> None:
- desc = frontmatter["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars (limit ≤60): {desc!r}"
-
-
-
-
-
-
-def test_has_required_frontmatter_fields(frontmatter) -> None:
- for field in ("name", "description", "version", "license"):
- assert field in frontmatter, f"missing required field: {field}"
-
-
-
-
- "path",
- [
- "scripts/rag_pipeline.py",
- "scripts/memory_manager.py",
- ],
-)
-def test_shipped_scripts_parse(path: str) -> None:
- """Shipped scripts must be valid Python (ast.parse raises SyntaxError otherwise)."""
- import ast
-
- src = (SKILL_DIR / path).read_text(encoding="utf-8")
- ast.parse(src) # raises SyntaxError on broken Python
-
-
-def test_scripts_use_pinecone_client() -> None:
- """Both scripts should reference the Pinecone SDK."""
- for script in ("scripts/rag_pipeline.py", "scripts/memory_manager.py"):
- src = (SKILL_DIR / script).read_text(encoding="utf-8")
- assert "PINECONE_API_KEY" in src, f"{script} should read PINECONE_API_KEY"
- assert "Pinecone" in src, f"{script} should import/use Pinecone client"
diff --git a/tests/skills/test_product_price_monitor_skill.py b/tests/skills/test_product_price_monitor_skill.py
deleted file mode 100644
index 8f03440d137..00000000000
--- a/tests/skills/test_product_price_monitor_skill.py
+++ /dev/null
@@ -1,117 +0,0 @@
-"""Tests for the product-price-monitor skill and its price-watch blueprint."""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-SKILL_PATH = (
- Path(__file__).resolve().parents[2]
- / "skills"
- / "productivity"
- / "product-price-monitor"
- / "SKILL.md"
-)
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "product-price-monitor"
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent")
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- repo_root = SKILL_PATH.parents[3]
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(repo_root.glob(f"skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_no_phantom_connectors_in_prose():
- _, body = _frontmatter_and_body()
- assert "flight-research" not in body, "no phantom 'flight-research' skill references"
-
-
-def test_setup_tick_split():
- """The skill must separate one-time setup from the recurring cron tick."""
- _, body = _frontmatter_and_body()
- assert "Setup (foreground, once)" in body
- assert "Tick (each scheduled run)" in body
- assert "cronjob(action=" in body, "must wire scheduling through the cronjob tool"
- assert "Do not schedule until one foreground fetch works" in body
-
-
-def test_state_discipline_present():
- _, body = _frontmatter_and_body()
- assert "never overwrite the last good observation" in body
- assert "fingerprint" in body
-
-
-def test_steps_have_completion_criteria():
- _, body = _frontmatter_and_body()
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## )", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 5
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
-
-
-def test_no_machine_local_paths():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert not re.search(r"/home/(?!.*price-watches)", content)
- assert "/home/bb" not in content
-
-
-def test_price_watch_blueprint_registered():
- from cron.blueprint_catalog import CATALOG
-
- bp = next((b for b in CATALOG if b.key == "price-watch"), None)
- assert bp is not None, "price-watch blueprint missing from catalog"
- assert "product-price-monitor" in bp.skills, "blueprint must load the skill"
- slot_names = {s.name for s in bp.slots}
- assert {"item", "condition", "interval_h", "deliver"} <= slot_names
- assert "[SILENT]" in bp.prompt_template, "silent path must be explicit"
- assert "{item}" in bp.prompt_template and "{condition}" in bp.prompt_template
-
-
-def test_price_watch_blueprint_schedule_resolves():
- from cron.blueprint_catalog import CATALOG
-
- bp = next(b for b in CATALOG if b.key == "price-watch")
- interval_slot = next(s for s in bp.slots if s.name == "interval_h")
- for opt in interval_slot.options:
- expr = bp.schedule_template.format(interval_h=opt)
- fields = expr.split()
- assert len(fields) == 5, f"invalid cron expr: {expr}"
- assert fields[1] == f"*/{opt}"
diff --git a/tests/skills/test_skill_blueprint_contracts.py b/tests/skills/test_skill_blueprint_contracts.py
new file mode 100644
index 00000000000..99f6d2fc247
--- /dev/null
+++ b/tests/skills/test_skill_blueprint_contracts.py
@@ -0,0 +1,56 @@
+"""Blueprint-to-skill relationships, independent of the generic catalog/renderer tests."""
+from datetime import datetime, timedelta, timezone
+from pathlib import Path
+
+import pytest
+from croniter import croniter
+
+from cron.blueprint_catalog import CATALOG, fill_blueprint, get_blueprint
+
+REPO = Path(__file__).resolve().parents[2]
+
+
[email protected]("key,skill", [
+ ("morning-brief", "google-workspace"), ("important-mail", "email-inbox-triage"),
+ ("weekly-review", "weekly-review-planning"), ("price-watch", "product-price-monitor"),
+])
+def test_task_blueprint_loads_procedure(key, skill):
+ blueprint = get_blueprint(key)
+ assert blueprint is not None, key
+ assert skill in blueprint.skills
+ if key == "weekly-review":
+ assert skill in fill_blueprint(blueprint, {})["prompt"]
+
+
+def test_every_blueprint_skill_is_bundled():
+ bundled = {path.parent.name for path in (REPO / "skills").rglob("SKILL.md")}
+ for blueprint in CATALOG:
+ assert set(blueprint.skills) <= bundled, blueprint.key
+
+
[email protected]("hours", next(
+ slot.options for bp in CATALOG if bp.key == "price-watch"
+ for slot in bp.slots if slot.name == "interval_h"
+))
+def test_price_watch_fills_and_persists_with_chosen_cadence(hours, tmp_path, monkeypatch):
+ from cron import jobs
+
+ monkeypatch.setattr(jobs, "CRON_DIR", tmp_path)
+ monkeypatch.setattr(jobs, "JOBS_FILE", tmp_path / "jobs.json")
+ blueprint = get_blueprint("price-watch")
+ assert blueprint is not None
+ spec = fill_blueprint(blueprint, {
+ "item": "https://example.test/widget", "condition": "below 42 credits",
+ "interval_h": hours, "deliver": "local",
+ })
+ created = jobs.create_job(**spec)
+ saved = jobs.get_job(created["id"])
+ assert saved is not None
+ assert "product-price-monitor" in saved["skills"]
+ assert saved["deliver"] == "local"
+ for text in ("https://example.test/widget", "below 42 credits", "[SILENT]"):
+ assert text in saved["prompt"], text
+ ticks = croniter(saved["schedule"]["expr"], datetime(2026, 1, 1, tzinfo=timezone.utc))
+ # Span a day boundary: wrong-field steps can otherwise look valid once.
+ times = [ticks.get_next(datetime) for _ in range(26)]
+ assert {b - a for a, b in zip(times, times[1:])} == {timedelta(hours=int(hours))}
diff --git a/tests/skills/test_skill_document_contracts.py b/tests/skills/test_skill_document_contracts.py
new file mode 100644
index 00000000000..d512c386e55
--- /dev/null
+++ b/tests/skills/test_skill_document_contracts.py
@@ -0,0 +1,118 @@
+"""Specific shipped-document obligations; generic policy lives in test_authoring_standards.
+
+These are document contracts, not proof that an agent obeys the instructions.
+Section ordering, step counts and other prose quality remain review-owned.
+"""
+from pathlib import Path
+import re
+
+import pytest
+
+from agent.skill_utils import parse_frontmatter, skill_matches_platform
+
+REPO = Path(__file__).resolve().parents[2]
+GITHUB = "skills/software-development/github"
+QUESTIONNAIRE = "optional-skills/productivity/decision-questionnaire"
+ACTUAL = "optional-skills/devops/actual-setup"
+DARWINIAN = "optional-skills/research/darwinian-evolver"
+PINECONE = "optional-skills/research/pinecone-research"
+EMAIL = "skills/email/email-inbox-triage"
+MEETING = "skills/productivity/meeting-action-items"
+PRICE = "skills/productivity/product-price-monitor"
+WEEKLY = "skills/productivity/weekly-review-planning"
+SOCIAL = "optional-skills/creative/social-media-content-calendar"
+MCP = "optional-skills/mcp/mcp-oauth-remote-gateway"
+
+
+def _document(skill):
+ return parse_frontmatter((REPO / skill / "SKILL.md").read_text(encoding="utf-8"))
+
+
[email protected]("skill,contributor", [
+ (GITHUB, "benbarclay"), (MEETING, "benbarclay"), (PRICE, "benbarclay"),
+ (WEEKLY, "benbarclay"), (EMAIL, "benbarclay"), (SOCIAL, "benbarclay"),
+ (ACTUAL, "shl0ms"), (DARWINIAN, "Bihruze"),
+ (QUESTIONNAIRE, "mattpocock"), (PINECONE, None), (MCP, None),
+])
+def test_required_document_and_credit(skill, contributor):
+ metadata, _ = _document(skill) # A corpus glob alone cannot catch a deleted skill.
+ if contributor:
+ assert contributor in metadata["author"]
+ if skill != PINECONE:
+ assert not metadata["author"].startswith("Hermes Agent")
+
+
[email protected]("skill,references", [
+ (GITHUB, ("auth.md", "issues.md", "pr-workflow.md", "issue-to-pr.md",
+ "code-review.md", "repo-management.md")),
+ (ACTUAL, ("opencode.md",)),
+])
+def test_required_references_are_present_and_routed(skill, references):
+ _, body = _document(skill)
+ for reference in references:
+ relative = f"references/{reference}"
+ assert (REPO / skill / relative).is_file(), relative
+ assert relative in body, relative
+
+
[email protected]("skill,required,forbidden", [
+ (QUESTIONNAIRE, ("## Context", "## How to answer", "## Anything else?",
+ "decision-questionnaire-<slug>.md", "Interview the Send"),
+ ("claude", "slash command", "disable-model-invocation")),
+ (ACTUAL, ("--provider actual",), ("hermes config set providers.actual.api ", "key_env")),
+ (MEETING, ("never invent", "before creating anything", "`unresolved`"), (r"\bLinear\b",)),
+ (PRICE, ("Setup (foreground, once)", "Tick (each scheduled run)", "cronjob(action=",
+ "Do not schedule until one foreground fetch works",
+ "never overwrite the last good observation", "fingerprint"), ("flight-research",)),
+ (EMAIL, ("read + draft", "does not imply permission"), ()),
+ (SOCIAL, (), ("image-generation-workflow",)),
+])
+def test_document_obligations(skill, required, forbidden):
+ _, body = _document(skill)
+ for text in required:
+ assert text in body, text
+ for pattern in forbidden:
+ assert not re.search(pattern, body, re.I), pattern
+ if skill == SOCIAL:
+ assert "handed-off, not published" in body or "handed-off slots" in body
+
+
[email protected]("relative", [
+ f"{GITHUB}/references/issue-to-pr.md",
+ *(f"{skill}/SKILL.md" for skill in (MEETING, PRICE, WEEKLY, EMAIL, SOCIAL)),
+])
+def test_procedure_steps_have_completion_criteria(relative):
+ body = (REPO / relative).read_text(encoding="utf-8")
+ steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## |\Z)", body, re.M | re.S)
+ assert steps, relative
+ for step in steps:
+ assert "Done when" in step, step[:80]
+ if relative.endswith("issue-to-pr.md"):
+ assert not re.match(r"^### \d+\.[^\n]*\n+Load `", step)
+
+
+def test_issue_to_pr_disciplines():
+ body = (REPO / GITHUB / "references/issue-to-pr.md").read_text(encoding="utf-8")
+ for text in ("--comments", "pr list --search", "git log -p -S", "sibling", "dispatches CI"):
+ assert text in body, text
+ assert "sabotage" in body.lower() or "FAILS" in body
+ assert "/home/" not in body and not re.search(r"[A-Z]:\\+Users", body)
+
+
+def test_optional_platform_declarations():
+ darwinian, _ = _document(DARWINIAN)
+ assert "windows" not in darwinian["platforms"] # func_timeout relies on POSIX signals.
+ assert {"linux", "macos"} <= set(darwinian["platforms"])
+ assert _document(MCP)[0]["platforms"]
+
+
[email protected]("skill", [QUESTIONNAIRE, DARWINIAN])
+def test_optional_skill_available_on_posix(skill):
+ assert skill_matches_platform(_document(skill)[0])
+
+
+def test_optional_skill_availability_on_windows():
+ assert skill_matches_platform(_document(QUESTIONNAIRE)[0])
+ assert not skill_matches_platform(_document(DARWINIAN)[0])
diff --git a/tests/skills/test_social_media_content_calendar_skill.py b/tests/skills/test_social_media_content_calendar_skill.py
deleted file mode 100644
index 64cf30954b3..00000000000
--- a/tests/skills/test_social_media_content_calendar_skill.py
+++ /dev/null
@@ -1,91 +0,0 @@
-"""Tests for the social-media-content-calendar optional skill."""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-SKILL_PATH = (
- Path(__file__).resolve().parents[2]
- / "optional-skills"
- / "creative"
- / "social-media-content-calendar"
- / "SKILL.md"
-)
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "social-media-content-calendar"
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent")
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- repo_root = SKILL_PATH.parents[3]
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(repo_root.glob(f"skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(repo_root.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_no_phantom_skill_references():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert "image-generation-workflow" not in content, "phantom skill ref must be gone"
-
-
-def test_honest_handoff_language():
- _, body = _frontmatter_and_body()
- assert "handed-off, not published" in body or "handed-off slots" in body, (
- "platforms without connectors must end at handoff, not claimed publication"
- )
-
-
-def test_body_structure_and_size():
- _, body = _frontmatter_and_body()
- for section in ("## When to Use", "## Procedure", "## Pitfalls", "## Verification"):
- assert section in body, f"missing section: {section}"
- assert len(SKILL_PATH.read_text(encoding="utf-8")) <= 100_000
-
-
-def test_no_machine_local_paths():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert "/home/" not in content
-
-
-def test_steps_have_completion_criteria():
- _, body = _frontmatter_and_body()
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## )", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 6
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
diff --git a/tests/skills/test_weekly_review_planning_skill.py b/tests/skills/test_weekly_review_planning_skill.py
deleted file mode 100644
index d5ccd4aff70..00000000000
--- a/tests/skills/test_weekly_review_planning_skill.py
+++ /dev/null
@@ -1,119 +0,0 @@
-"""Tests for the weekly-review-planning skill and blueprint->skill wiring."""
-import re
-from pathlib import Path
-
-import hermes_yaml as yaml
-
-REPO_ROOT = Path(__file__).resolve().parents[2]
-SKILL_PATH = (
- REPO_ROOT / "skills" / "productivity" / "weekly-review-planning" / "SKILL.md"
-)
-
-
-def _frontmatter_and_body():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert content.startswith("---")
- m = re.search(r"\n---\s*\n", content[3:])
- assert m, "frontmatter must close with ---"
- fm = yaml.safe_load(content[3 : m.start() + 3])
- body = content[m.end() + 3 :]
- return fm, body
-
-
-def test_skill_file_exists():
- assert SKILL_PATH.is_file()
-
-
-def test_frontmatter_required_fields():
- fm, _ = _frontmatter_and_body()
- for field in ("name", "description", "version", "author", "license", "platforms"):
- assert field in fm, f"missing frontmatter field: {field}"
- assert fm["name"] == "weekly-review-planning"
-
-
-def test_description_hardline():
- fm, _ = _frontmatter_and_body()
- desc = fm["description"]
- assert len(desc) <= 60, f"description is {len(desc)} chars; hardline is 60"
- assert desc.endswith(".")
-
-
-def test_author_credits_human_first():
- fm, _ = _frontmatter_and_body()
- assert not fm["author"].startswith("Hermes Agent")
- assert "benbarclay" in fm["author"]
-
-
-def test_related_skills_resolve_in_repo():
- fm, _ = _frontmatter_and_body()
- for name in fm["metadata"]["hermes"]["related_skills"]:
- hits = (
- list(REPO_ROOT.glob(f"skills/*/{name}/SKILL.md"))
- + list(REPO_ROOT.glob(f"optional-skills/*/{name}/SKILL.md"))
- + list(REPO_ROOT.glob(f"skills/*/*/{name}/SKILL.md"))
- )
- assert hits, f"related_skills entry does not resolve in-repo: {name}"
-
-
-def test_body_structure_and_size():
- _, body = _frontmatter_and_body()
- for section in ("## When to Use", "## Procedure", "## Pitfalls", "## Verification"):
- assert section in body, f"missing section: {section}"
- assert len(SKILL_PATH.read_text(encoding="utf-8")) <= 100_000
-
-
-def test_no_machine_local_paths():
- content = SKILL_PATH.read_text(encoding="utf-8")
- assert "/home/" not in content
-
-
-def test_steps_have_completion_criteria():
- _, body = _frontmatter_and_body()
- steps = re.findall(r"^### \d+\..*?(?=^### \d+\.|^## )", body, re.MULTILINE | re.DOTALL)
- assert len(steps) >= 6
- for step in steps:
- assert "Done when" in step, f"step missing completion criterion: {step[:60]!r}"
-
-
-def _skill_dir_exists(name: str) -> bool:
- return bool(
- list(REPO_ROOT.glob(f"skills/*/{name}/SKILL.md"))
- + list(REPO_ROOT.glob(f"skills/*/*/{name}/SKILL.md"))
- )
-
-
-def test_blueprint_loads_this_skill():
- from cron.blueprint_catalog import CATALOG
-
- bp = next(b for b in CATALOG if b.key == "weekly-review")
- assert "weekly-review-planning" in bp.skills
- assert "weekly-review-planning" in bp.prompt_template
-
-
-def test_every_blueprint_skill_resolves_in_repo():
- """Invariant: any skill a blueprint loads must exist as a bundled skill."""
- from cron.blueprint_catalog import CATALOG
-
- for bp in CATALOG:
- for skill_name in bp.skills:
- assert _skill_dir_exists(skill_name), (
- f"blueprint {bp.key!r} loads nonexistent skill {skill_name!r}"
- )
-
-
-def test_task_skill_blueprints_are_wired():
- """The recurring-task blueprints must load their procedure skills."""
- from cron.blueprint_catalog import CATALOG
-
- expected = {
- "morning-brief": "google-workspace",
- "important-mail": "email-inbox-triage",
- "weekly-review": "weekly-review-planning",
- "price-watch": "product-price-monitor",
- }
- by_key = {b.key: b for b in CATALOG}
- for key, skill_name in expected.items():
- assert key in by_key, f"blueprint {key!r} missing from catalog"
- assert skill_name in by_key[key].skills, (
- f"blueprint {key!r} must load skill {skill_name!r}"
- )