diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json
new file mode 100644
index 0000000..ca6962a
--- /dev/null
+++ b/.agents/plugins/marketplace.json
@@ -0,0 +1,20 @@
+{
+ "name": "labrat",
+ "interface": {
+ "displayName": "Lab Rat"
+ },
+ "plugins": [
+ {
+ "name": "labrat",
+ "source": {
+ "source": "local",
+ "path": "./plugin"
+ },
+ "policy": {
+ "installation": "AVAILABLE",
+ "authentication": "ON_INSTALL"
+ },
+ "category": "productivity"
+ }
+ ]
+}
diff --git a/.github/scripts/sync-versions.sh b/.github/scripts/sync-versions.sh
index c3c30bc..0f4ff85 100755
--- a/.github/scripts/sync-versions.sh
+++ b/.github/scripts/sync-versions.sh
@@ -16,7 +16,7 @@ version = json.loads((repo / "plugin/.claude-plugin/plugin.json").read_text())["
for rel in [
"plugin/.codex-plugin/plugin.json",
"plugin/.cursor-plugin/plugin.json",
- "plugin/gemini-extension.json",
+ "plugin/.antigravity-plugin/plugin.json",
".claude-plugin/marketplace.json",
".cursor-plugin/marketplace.json",
]:
diff --git a/.github/scripts/validate_plugins.py b/.github/scripts/validate_plugins.py
new file mode 100644
index 0000000..28c4caa
--- /dev/null
+++ b/.github/scripts/validate_plugins.py
@@ -0,0 +1,476 @@
+#!/usr/bin/env python3
+"""Validate Lab Rat plugin manifests, skills, hooks, and marketplace catalogs."""
+
+from __future__ import annotations
+
+import json
+import os
+import re
+import sys
+from pathlib import Path
+
+import yaml
+
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
+PLUGIN_DIR = REPO_ROOT / "plugin"
+CLAUDE_MARKETPLACE = REPO_ROOT / ".claude-plugin" / "marketplace.json"
+CODEX_MARKETPLACE = REPO_ROOT / ".agents" / "plugins" / "marketplace.json"
+CURSOR_MARKETPLACE = REPO_ROOT / ".cursor-plugin" / "marketplace.json"
+
+ANTIGRAVITY_SCHEMA = "https://antigravity.google/schemas/v1/plugin.json"
+ANTIGRAVITY_ALLOWED_KEYS = {
+ "$schema",
+ "name",
+ "displayName",
+ "description",
+ "version",
+ "disabled",
+ "logo",
+ "suggestedPrompts",
+ "skills",
+ "author",
+ "homepage",
+ "repository",
+ "license",
+ "keywords",
+ "extensions",
+}
+
+VALID_HOOK_EVENTS = {
+ "PreToolUse",
+ "PostToolUse",
+ "Stop",
+ "SubagentStart",
+ "SubagentStop",
+ "SessionStart",
+ "SessionEnd",
+ "UserPromptSubmit",
+ "PreCompact",
+ "Notification",
+}
+VALID_MODEL_ALIASES = {"inherit", "sonnet", "opus", "haiku", "fable"}
+VALID_AGENT_COLORS = {"red", "blue", "green", "yellow", "purple", "orange", "pink", "cyan"}
+REMOVED_TOOLS = {"BashOutput", "KillBash", "KillShell", "MultiEdit", "TaskOutput"}
+
+KEBAB_RE = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$")
+SEMVER_RE = re.compile(r"^\d+\.\d+\.\d+$")
+MAX_SKILL_BODY_BYTES = 24000
+
+
+def load_json(path: Path) -> dict | list | None:
+ """Load a JSON file, returning None if missing or invalid."""
+ if not path.exists():
+ return None
+ try:
+ return json.loads(path.read_text())
+ except json.JSONDecodeError:
+ return None
+
+
+def parse_frontmatter(content: str) -> tuple[dict | None, str]:
+ """Parse YAML frontmatter and markdown body from a skill, agent, or command file."""
+ if not content.startswith("---"):
+ return None, content
+ parts = content.split("---", 2)
+ if len(parts) < 3:
+ return None, content
+ try:
+ data = yaml.safe_load(parts[1])
+ except yaml.YAMLError:
+ return None, content
+ if not isinstance(data, dict):
+ return None, content
+ return data, parts[2].strip()
+
+
+def _is_valid_model(value: object) -> bool:
+ """Return True if value is an allowed model alias or full claude- model ID."""
+ return isinstance(value, str) and (value in VALID_MODEL_ALIASES or value.startswith("claude-"))
+
+
+def _has_author(author: object) -> bool:
+ """Return True if author is a non-empty string or an object with a non-empty name."""
+ if isinstance(author, str):
+ return bool(author.strip())
+ if isinstance(author, dict):
+ name = author.get("name")
+ return isinstance(name, str) and bool(name.strip())
+ return False
+
+
+def validate_manifests(plugin_dir: Path) -> list[str]:
+ """Validate Claude, Codex, Cursor, and Antigravity plugin manifests."""
+ errors: list[str] = []
+
+ if (plugin_dir / "gemini-extension.json").exists():
+ errors.append("plugin/gemini-extension.json: deprecated Gemini CLI manifest must be removed")
+
+ claude_path = plugin_dir / ".claude-plugin" / "plugin.json"
+ claude = load_json(claude_path)
+ if not isinstance(claude, dict):
+ label = "invalid JSON" if claude_path.exists() else "missing"
+ errors.append(f"plugin/.claude-plugin/plugin.json: {label}")
+ return errors
+
+ ref_name = claude.get("name")
+ ref_version = claude.get("version")
+ ref_desc = claude.get("description")
+
+ if not isinstance(ref_name, str) or not KEBAB_RE.match(ref_name):
+ errors.append(f"plugin/.claude-plugin/plugin.json: 'name' must be kebab-case ({ref_name!r})")
+ if not isinstance(ref_version, str) or not SEMVER_RE.match(ref_version):
+ errors.append(f"plugin/.claude-plugin/plugin.json: 'version' must be X.Y.Z semver ({ref_version!r})")
+ if not isinstance(ref_desc, str) or not ref_desc.strip():
+ errors.append("plugin/.claude-plugin/plugin.json: missing non-empty 'description'")
+ if not _has_author(claude.get("author")):
+ errors.append("plugin/.claude-plugin/plugin.json: missing 'author'")
+
+ hooks_rel = claude.get("hooks")
+ if hooks_rel is not None:
+ if not isinstance(hooks_rel, str) or not (plugin_dir / hooks_rel).is_file():
+ errors.append(f"plugin/.claude-plugin/plugin.json: 'hooks' target not found ({hooks_rel!r})")
+
+ sibling_paths = [
+ ("codex", plugin_dir / ".codex-plugin" / "plugin.json"),
+ ("cursor", plugin_dir / ".cursor-plugin" / "plugin.json"),
+ ("antigravity", plugin_dir / ".antigravity-plugin" / "plugin.json"),
+ ]
+ for label, path in sibling_paths:
+ data = load_json(path)
+ rel = path.relative_to(REPO_ROOT)
+ if not isinstance(data, dict):
+ state = "invalid JSON" if path.exists() else "missing"
+ errors.append(f"{rel}: {state} ({label} manifest)")
+ continue
+ if data.get("name") != ref_name:
+ errors.append(f"{rel}: 'name' ({data.get('name')!r}) != claude ({ref_name!r})")
+ if data.get("version") != ref_version:
+ errors.append(f"{rel}: 'version' ({data.get('version')!r}) != claude ({ref_version!r})")
+ if not isinstance(data.get("description"), str) or not data["description"].strip():
+ errors.append(f"{rel}: missing non-empty 'description'")
+
+ if label == "antigravity":
+ if data.get("$schema") != ANTIGRAVITY_SCHEMA:
+ errors.append(f"{rel}: '$schema' must be '{ANTIGRAVITY_SCHEMA}'")
+ extra_keys = sorted(set(data) - ANTIGRAVITY_ALLOWED_KEYS)
+ if extra_keys:
+ errors.append(f"{rel}: unsupported Antigravity manifest keys: {', '.join(extra_keys)}")
+ logo = data.get("logo")
+ if logo is not None:
+ if not isinstance(logo, str) or not logo.strip():
+ errors.append(f"{rel}: 'logo' must be a non-empty relative path")
+ else:
+ resolved = (plugin_dir / logo).resolve()
+ if not resolved.is_relative_to(plugin_dir.resolve()) or not resolved.is_file():
+ errors.append(f"{rel}: 'logo' target not found inside plugin ({logo!r})")
+
+ mcp_path = plugin_dir / ".mcp.json"
+ if mcp_path.exists():
+ mcp = load_json(mcp_path)
+ if not isinstance(mcp, dict) or not isinstance(mcp.get("mcpServers"), dict):
+ errors.append("plugin/.mcp.json: must define an 'mcpServers' object")
+ cursor_data = load_json(plugin_dir / ".cursor-plugin" / "plugin.json") or {}
+ if cursor_data.get("mcpServers") != "./.mcp.json":
+ errors.append('plugin/.cursor-plugin/plugin.json: must set "mcpServers": "./.mcp.json"')
+
+ return errors
+
+
+def validate_marketplaces(plugin_dir: Path) -> list[str]:
+ """Validate Claude, Codex, and Cursor marketplace manifests and alignment."""
+ errors: list[str] = []
+ claude_plugin = load_json(plugin_dir / ".claude-plugin" / "plugin.json")
+ if not isinstance(claude_plugin, dict):
+ return errors
+
+ expected_name = claude_plugin.get("name", "")
+ expected_version = claude_plugin.get("version", "")
+
+ marketplaces = [
+ ("claude", CLAUDE_MARKETPLACE),
+ ("codex", CODEX_MARKETPLACE),
+ ("cursor", CURSOR_MARKETPLACE),
+ ]
+ loaded: dict[str, dict] = {}
+ for label, path in marketplaces:
+ rel = path.relative_to(REPO_ROOT)
+ data = load_json(path)
+ if not isinstance(data, dict):
+ state = "invalid JSON" if path.exists() else "missing"
+ errors.append(f"{rel}: {state} ({label} marketplace)")
+ continue
+ loaded[label] = data
+ if data.get("name") != expected_name:
+ errors.append(f"{rel}: top-level 'name' ({data.get('name')!r}) != plugin ({expected_name!r})")
+ plugins = data.get("plugins")
+ if not isinstance(plugins, list) or not plugins:
+ errors.append(f"{rel}: 'plugins' must be a non-empty list")
+ continue
+ entry_names = [e.get("name") for e in plugins if isinstance(e, dict)]
+ if entry_names != [expected_name]:
+ errors.append(f"{rel}: plugin entries {entry_names!r} != [{expected_name!r}]")
+
+ for label in ("claude", "cursor"):
+ data = loaded.get(label)
+ if not data:
+ continue
+ rel = dict(marketplaces)[label].relative_to(REPO_ROOT)
+ owner = data.get("owner")
+ if not isinstance(owner, dict) or not isinstance(owner.get("name"), str) or not owner["name"].strip():
+ errors.append(f"{rel}: missing top-level 'owner.name'")
+ for entry in data.get("plugins", []):
+ if not isinstance(entry, dict):
+ continue
+ if entry.get("version") != expected_version:
+ errors.append(f"{rel}: entry version ({entry.get('version')!r}) != plugin ({expected_version!r})")
+ if not isinstance(entry.get("description"), str) or not entry["description"].strip():
+ errors.append(f"{rel}: entry missing non-empty 'description'")
+ source = entry.get("source")
+ if label == "cursor":
+ if not isinstance(source, str) or not (REPO_ROOT / source).is_dir():
+ errors.append(f"{rel}: 'source' directory not found ({source!r})")
+ elif label == "claude":
+ if isinstance(source, dict):
+ if source.get("source") != "git-subdir":
+ errors.append(f"{rel}: unexpected dict source type ({source.get('source')!r})")
+ url = source.get("url", "")
+ subpath = source.get("path", "")
+ if not isinstance(url, str) or not url.startswith("https://"):
+ errors.append(f"{rel}: git-subdir 'url' must use https:// ({url!r})")
+ if not isinstance(subpath, str) or not (REPO_ROOT / subpath).is_dir():
+ errors.append(f"{rel}: git-subdir 'path' directory not found ({subpath!r})")
+ elif not isinstance(source, str) or not (REPO_ROOT / source).is_dir():
+ errors.append(f"{rel}: 'source' directory not found ({source!r})")
+
+ codex = loaded.get("codex")
+ if codex:
+ rel = CODEX_MARKETPLACE.relative_to(REPO_ROOT)
+ interface = codex.get("interface")
+ if (
+ not isinstance(interface, dict)
+ or not isinstance(interface.get("displayName"), str)
+ or not interface["displayName"].strip()
+ ):
+ errors.append(f"{rel}: missing 'interface.displayName'")
+ for entry in codex.get("plugins", []):
+ if not isinstance(entry, dict):
+ continue
+ source = entry.get("source")
+ if not isinstance(source, dict) or source.get("source") != "local":
+ errors.append(f"{rel}: Codex entry must use {{'source': 'local', 'path': ...}}")
+ elif not isinstance(source.get("path"), str) or not (REPO_ROOT / source["path"]).is_dir():
+ errors.append(f"{rel}: local source path not found ({source.get('path')!r})")
+ policy = entry.get("policy")
+ if not isinstance(policy, dict) or not policy.get("installation") or not policy.get("authentication"):
+ errors.append(f"{rel}: entry missing 'policy.installation' or 'policy.authentication'")
+
+ return errors
+
+
+def validate_skills(plugin_dir: Path) -> list[str]:
+ """Validate skill directories, YAML frontmatter, and byte limits."""
+ errors: list[str] = []
+ skills_dir = plugin_dir / "skills"
+ if not skills_dir.is_dir():
+ return ["plugin/skills: directory missing"]
+
+ skill_dirs = sorted(p for p in skills_dir.iterdir() if p.is_dir())
+ if not skill_dirs:
+ return ["plugin/skills: no skill subdirectories found"]
+
+ for skill_path in skill_dirs:
+ prefix = f"plugin/skills/{skill_path.name}"
+ if not KEBAB_RE.match(skill_path.name):
+ errors.append(f"{prefix}: directory name must be kebab-case")
+
+ skill_md = skill_path / "SKILL.md"
+ if not skill_md.is_file():
+ errors.append(f"{prefix}: missing SKILL.md")
+ continue
+
+ frontmatter, body = parse_frontmatter(skill_md.read_text())
+ if not frontmatter:
+ errors.append(f"{prefix}/SKILL.md: missing or invalid YAML frontmatter")
+ continue
+
+ name = frontmatter.get("name")
+ if not isinstance(name, str) or not name:
+ errors.append(f"{prefix}/SKILL.md: missing 'name' string")
+ else:
+ if len(name) > 64:
+ errors.append(f"{prefix}/SKILL.md: 'name' exceeds 64 chars ({len(name)})")
+ if not KEBAB_RE.match(name):
+ errors.append(f"{prefix}/SKILL.md: 'name' must be kebab-case ({name!r})")
+ elif name != skill_path.name:
+ errors.append(f"{prefix}/SKILL.md: 'name' ({name!r}) != directory ({skill_path.name!r})")
+
+ desc = frontmatter.get("description")
+ if not isinstance(desc, str) or not desc.strip():
+ errors.append(f"{prefix}/SKILL.md: missing non-empty 'description' string")
+ elif len(desc) > 1024:
+ errors.append(f"{prefix}/SKILL.md: 'description' exceeds 1024 chars ({len(desc)})")
+
+ if "disable-model-invocation" in frontmatter and not isinstance(frontmatter["disable-model-invocation"], bool):
+ errors.append(f"{prefix}/SKILL.md: 'disable-model-invocation' must be boolean")
+
+ if not body or len(body) < 20:
+ errors.append(f"{prefix}/SKILL.md: body content too short")
+ elif len(body.encode("utf-8")) > MAX_SKILL_BODY_BYTES:
+ errors.append(f"{prefix}/SKILL.md: body exceeds {MAX_SKILL_BODY_BYTES} bytes ({len(body.encode('utf-8'))})")
+
+ return errors
+
+
+def validate_hooks(plugin_dir: Path) -> list[str]:
+ """Validate Claude hook placement, JSON schema, quoting, and executable targets."""
+ errors: list[str] = []
+
+ if (plugin_dir / "hooks" / "hooks.json").exists():
+ errors.append(
+ "plugin/hooks/hooks.json: must not exist at auto-discovered path; keep Claude hooks at the path in .claude-plugin/plugin.json"
+ )
+
+ claude = load_json(plugin_dir / ".claude-plugin" / "plugin.json") or {}
+ hooks_rel = claude.get("hooks")
+ if not isinstance(hooks_rel, str):
+ return errors
+
+ hooks_path = plugin_dir / hooks_rel
+ config = load_json(hooks_path)
+ rel = hooks_path.relative_to(REPO_ROOT)
+ if not isinstance(config, dict):
+ return errors if not hooks_path.exists() else [f"{rel}: invalid JSON"]
+
+ hooks_config = config.get("hooks")
+ if not isinstance(hooks_config, dict):
+ return [f"{rel}: must wrap events in a top-level 'hooks' object"]
+
+ for event, hook_list in hooks_config.items():
+ if event not in VALID_HOOK_EVENTS:
+ errors.append(f"{rel}: invalid hook event {event!r}")
+ continue
+ if not isinstance(hook_list, list):
+ errors.append(f"{rel}: '{event}' must be a list")
+ continue
+ for i, entry in enumerate(hook_list):
+ if not isinstance(entry, dict) or not isinstance(entry.get("hooks"), list):
+ errors.append(f"{rel}: {event}[{i}] must define a 'hooks' list")
+ continue
+ for j, hook in enumerate(entry["hooks"]):
+ if not isinstance(hook, dict):
+ errors.append(f"{rel}: {event}[{i}].hooks[{j}] must be an object")
+ continue
+ hook_type = hook.get("type")
+ if hook_type == "command":
+ cmd = hook.get("command")
+ if not isinstance(cmd, str) or not cmd.strip():
+ errors.append(f"{rel}: {event}[{i}].hooks[{j}] missing 'command'")
+ continue
+ if "${CLAUDE_PLUGIN_ROOT}" in cmd and '"${CLAUDE_PLUGIN_ROOT}' not in cmd:
+ errors.append(f"{rel}: {event}[{i}].hooks[{j}] must quote ${{CLAUDE_PLUGIN_ROOT}} in command")
+ refs = [cmd, *(hook.get("args") or [])]
+ for ref in refs:
+ if not isinstance(ref, str):
+ continue
+ for sub in re.findall(r'\$\{CLAUDE_PLUGIN_ROOT\}"?(/[^"\'\s;|&]+)', ref):
+ script_path = plugin_dir / sub.lstrip("/")
+ if not script_path.is_file():
+ errors.append(f"{rel}: script not found: ${{CLAUDE_PLUGIN_ROOT}}{sub}")
+ elif not os.access(script_path, os.X_OK):
+ errors.append(f"{rel}: script not executable: {script_path.relative_to(REPO_ROOT)}")
+ elif hook_type in {"prompt", "agent"}:
+ prompt = hook.get("prompt")
+ if not isinstance(prompt, str) or not prompt.strip():
+ errors.append(f"{rel}: {event}[{i}].hooks[{j}] missing 'prompt'")
+ else:
+ errors.append(f"{rel}: {event}[{i}].hooks[{j}] unsupported hook type {hook_type!r}")
+
+ return errors
+
+
+def validate_agents(plugin_dir: Path) -> list[str]:
+ """Validate optional custom agent definitions if present."""
+ errors: list[str] = []
+ agents_dir = plugin_dir / "agents"
+ if not agents_dir.is_dir():
+ return errors
+
+ for agent_file in sorted(agents_dir.iterdir()):
+ if not agent_file.is_file() or agent_file.suffix != ".md":
+ continue
+ prefix = f"plugin/agents/{agent_file.name}"
+ if not KEBAB_RE.match(agent_file.stem):
+ errors.append(f"{prefix}: filename must be kebab-case")
+ frontmatter, body = parse_frontmatter(agent_file.read_text())
+ if not frontmatter:
+ errors.append(f"{prefix}: missing YAML frontmatter")
+ continue
+ agent_name = frontmatter.get("name")
+ if not isinstance(agent_name, str) or not (3 <= len(agent_name) <= 50) or not KEBAB_RE.match(agent_name):
+ errors.append(f"{prefix}: 'name' must be 3-50 char kebab-case ({agent_name!r})")
+ desc = frontmatter.get("description")
+ if not isinstance(desc, str) or not (10 <= len(desc) <= 5000):
+ errors.append(f"{prefix}: 'description' must be 10-5000 chars")
+ if "model" in frontmatter and not _is_valid_model(frontmatter["model"]):
+ errors.append(f"{prefix}: invalid 'model' ({frontmatter['model']!r})")
+ if "color" in frontmatter and frontmatter["color"] not in VALID_AGENT_COLORS:
+ errors.append(f"{prefix}: invalid 'color' ({frontmatter['color']!r})")
+ for key in ("tools", "skills"):
+ if key in frontmatter and not isinstance(frontmatter[key], list):
+ errors.append(f"{prefix}: '{key}' must be a YAML list")
+ if removed := REMOVED_TOOLS.intersection(frontmatter.get("tools") or []):
+ errors.append(f"{prefix}: 'tools' lists removed tools: {', '.join(sorted(removed))}")
+ if not body or not (20 <= len(body) <= 10000):
+ errors.append(f"{prefix}: body must be 20-10000 chars")
+
+ return errors
+
+
+def validate_commands(plugin_dir: Path) -> list[str]:
+ """Validate optional legacy command files if present."""
+ errors: list[str] = []
+ commands_dir = plugin_dir / "commands"
+ if not commands_dir.is_dir():
+ return errors
+
+ for cmd_file in sorted(commands_dir.rglob("*.md")):
+ prefix = f"plugin/commands/{cmd_file.relative_to(commands_dir)}"
+ if not KEBAB_RE.match(cmd_file.stem):
+ errors.append(f"{prefix}: filename must be kebab-case")
+ content = cmd_file.read_text()
+ frontmatter, body = parse_frontmatter(content)
+ if frontmatter:
+ if "model" in frontmatter and not _is_valid_model(frontmatter["model"]):
+ errors.append(f"{prefix}: invalid 'model' ({frontmatter['model']!r})")
+ if "disable-model-invocation" in frontmatter and not isinstance(
+ frontmatter["disable-model-invocation"], bool
+ ):
+ errors.append(f"{prefix}: 'disable-model-invocation' must be boolean")
+ if not (body if frontmatter else content.strip()):
+ errors.append(f"{prefix}: command body is empty")
+
+ return errors
+
+
+def main() -> int:
+ """Run all plugin, skill, hook, and marketplace checks."""
+ all_errors = [
+ *validate_manifests(PLUGIN_DIR),
+ *validate_marketplaces(PLUGIN_DIR),
+ *validate_skills(PLUGIN_DIR),
+ *validate_hooks(PLUGIN_DIR),
+ *validate_agents(PLUGIN_DIR),
+ *validate_commands(PLUGIN_DIR),
+ ]
+ if all_errors:
+ print("Plugin validation failed:")
+ for err in all_errors:
+ print(f" - {err}")
+ return 1
+
+ print("All plugin, skill, and marketplace checks passed")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/.github/scripts/validate_providers.py b/.github/scripts/validate_providers.py
new file mode 100644
index 0000000..0cbb5ce
--- /dev/null
+++ b/.github/scripts/validate_providers.py
@@ -0,0 +1,242 @@
+#!/usr/bin/env python3
+"""Load and validate Lab Rat with the Claude Code, Codex, and Antigravity CLIs."""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import queue
+import subprocess
+import sys
+import tempfile
+import threading
+from pathlib import Path
+
+from validate_plugins import (
+ CODEX_MARKETPLACE,
+ PLUGIN_DIR,
+ REPO_ROOT,
+ load_json,
+ parse_frontmatter,
+)
+
+
+def expected_skills(plugin_name: str, prefixed: bool) -> set[str]:
+ """Return expected skill identifiers discovered under plugin/skills/."""
+ names: set[str] = set()
+ for skill_md in sorted(PLUGIN_DIR.glob("skills/*/SKILL.md")):
+ meta, _ = parse_frontmatter(skill_md.read_text())
+ if meta and isinstance(meta.get("name"), str):
+ skill_name = meta["name"]
+ names.add(f"{plugin_name}:{skill_name}" if prefixed else skill_name)
+ return names
+
+
+def _rel_file(raw_path: str) -> str:
+ """Return path relative to REPO_ROOT when possible."""
+ path = Path(raw_path)
+ try:
+ return str(path.relative_to(REPO_ROOT))
+ except ValueError:
+ return raw_path
+
+
+def claude_findings(env: dict[str, str]) -> list[str]:
+ """Run `claude plugin validate` on the marketplace root and plugin directory."""
+ plugin_meta = load_json(PLUGIN_DIR / ".claude-plugin" / "plugin.json") or {}
+ plugin_name = plugin_meta.get("name", "labrat")
+ findings: list[str] = []
+
+ for label, target in (("marketplace", REPO_ROOT), ("plugin", PLUGIN_DIR)):
+ result = subprocess.run(
+ ["claude", "plugin", "validate", str(target), "--json"],
+ capture_output=True,
+ text=True,
+ env=env,
+ )
+ try:
+ report = json.loads(result.stdout)
+ except json.JSONDecodeError:
+ detail = result.stderr.strip() or result.stdout.strip()
+ findings.append(f"claude ({label}): validate exited {result.returncode}: {detail}")
+ continue
+
+ if result.returncode != 0 or not report.get("success", False):
+ findings.append(f"claude ({label}): validation failed (exit {result.returncode})")
+
+ sections = [report.get("manifest"), *(report.get("contents") or [])]
+ for section in sections:
+ if not isinstance(section, dict):
+ continue
+ file_rel = _rel_file(section.get("file", str(target)))
+ for item in (*(section.get("errors") or []), *(section.get("warnings") or [])):
+ loc = f" {item['path']}" if item.get("path") else ""
+ findings.append(f"claude: {file_rel}:{loc} {item['message']}")
+
+ if target == PLUGIN_DIR:
+ loaded_skills = set(((report.get("provides") or {}).get("skills")) or [])
+ wanted = expected_skills(plugin_name, prefixed=True)
+ for missing in sorted(wanted - loaded_skills):
+ findings.append(f"claude: missing skill {missing}")
+ for extra in sorted(loaded_skills - wanted):
+ findings.append(f"claude: unexpected skill {extra}")
+
+ return findings
+
+
+def _codex_lists(cwd: Path, env: dict[str, str]) -> tuple[dict, dict]:
+ """Query hooks/list and skills/list from a stdio `codex app-server` process."""
+ proc = subprocess.Popen(
+ ["codex", "app-server"],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL,
+ text=True,
+ cwd=cwd,
+ env=env,
+ )
+ lines: queue.Queue[str] = queue.Queue()
+
+ def pump() -> None:
+ assert proc.stdout is not None
+ for line in proc.stdout:
+ lines.put(line)
+
+ threading.Thread(target=pump, daemon=True).start()
+
+ def call(req_id: int, method: str, params: dict) -> dict:
+ assert proc.stdin is not None
+ proc.stdin.write(json.dumps({"id": req_id, "method": method, "params": params}) + "\n")
+ proc.stdin.flush()
+ while True:
+ msg = json.loads(lines.get(timeout=60))
+ if msg.get("id") == req_id:
+ return msg["result"]
+
+ try:
+ call(0, "initialize", {"clientInfo": {"name": "ci", "version": "0"}})
+ assert proc.stdin is not None
+ proc.stdin.write(json.dumps({"method": "initialized"}) + "\n")
+ proc.stdin.flush()
+ hooks = call(1, "hooks/list", {"cwds": [str(cwd)]})["data"][0]
+ skills = call(2, "skills/list", {"cwds": [str(cwd)], "forceReload": True})["data"][0]
+ return hooks, skills
+ finally:
+ proc.kill()
+ proc.wait()
+
+
+def codex_findings(home: Path, env: dict[str, str]) -> list[str]:
+ """Install the Codex marketplace in an isolated home and verify skills and hooks."""
+ marketplace = load_json(CODEX_MARKETPLACE)
+ if not isinstance(marketplace, dict):
+ return ["codex: missing .agents/plugins/marketplace.json"]
+
+ entries = marketplace.get("plugins", [])
+ run = {"capture_output": True, "text": True, "env": env}
+ added = subprocess.run(["codex", "plugin", "marketplace", "add", str(REPO_ROOT)], **run)
+ if added.returncode:
+ return [f"codex: marketplace add failed: {added.stderr.strip()}"]
+
+ listed_res = subprocess.run(["codex", "plugin", "list", "--json", "--available"], **run)
+ if listed_res.returncode:
+ return [f"codex: plugin list failed: {listed_res.stderr.strip()}"]
+ listed = {p["name"] for p in json.loads(listed_res.stdout).get("available", [])}
+ findings = [f"codex: marketplace entry dropped: {e['name']}" for e in entries if e["name"] not in listed]
+
+ for name in sorted(listed):
+ installed = subprocess.run(["codex", "plugin", "add", f"{name}@{marketplace['name']}"], **run)
+ if installed.returncode:
+ findings.append(f"codex: plugin add {name} failed: {installed.stderr.strip()}")
+
+ hooks, skills = _codex_lists(home, env)
+ findings += [f"codex: hook: {item}" for item in (*hooks.get("warnings", []), *hooks.get("errors", []))]
+ findings += [f"codex: skill: {item['path']}: {item['message']}" for item in skills.get("errors", [])]
+
+ wanted = {skill for entry in entries for skill in expected_skills(entry["name"], prefixed=True)}
+ loaded = {s["name"] for s in skills.get("skills", []) if ":" in s["name"]}
+ findings += [f"codex: skill missing or renamed: {s}" for s in sorted(wanted - loaded)]
+ findings += [f"codex: unexpected skill: {s}" for s in sorted(loaded - wanted)]
+ return findings
+
+
+def antigravity_findings(home: Path, base_env: dict[str, str]) -> list[str]:
+ """Validate and install the plugin with `agy` in an isolated home."""
+ env = {k: v for k, v in base_env.items() if k not in ("GEMINI_HOME", "AGY_ACP_FORCE_FILE_STORAGE")}
+ env["HOME"] = str(home)
+ run = {"capture_output": True, "text": True, "env": env}
+
+ plugin_meta = load_json(PLUGIN_DIR / ".claude-plugin" / "plugin.json") or {}
+ plugin_name = plugin_meta.get("name", "labrat")
+ expected_version = plugin_meta.get("version", "")
+
+ findings: list[str] = []
+ val = subprocess.run(["agy", "plugin", "validate", "--strict", "--json", str(PLUGIN_DIR)], **run)
+ try:
+ report = json.loads(val.stdout)
+ except json.JSONDecodeError:
+ detail = val.stderr.strip() or val.stdout.strip()
+ findings.append(f"antigravity: validate exited {val.returncode}: {detail}")
+ return findings
+
+ if val.returncode != 0:
+ findings.append(f"antigravity: validate --strict exited {val.returncode}")
+ for item in report.get("findings", []):
+ if item.get("severity") in ("error", "warning"):
+ findings.append(f"antigravity: {item.get('file', '')}: {item.get('message', '')}")
+
+ inst = subprocess.run(["agy", "plugin", "install", str(PLUGIN_DIR)], **run)
+ if inst.returncode != 0:
+ findings.append(f"antigravity: install failed: {inst.stderr.strip() or inst.stdout.strip()}")
+ return findings
+
+ listed = subprocess.run(["agy", "plugin", "list", "--json"], **run)
+ if listed.returncode != 0:
+ findings.append(f"antigravity: list failed: {listed.stderr.strip()}")
+ return findings
+
+ entries = json.loads(listed.stdout)
+ match = next((e for e in entries if e.get("name") == plugin_name), None)
+ if not match:
+ findings.append(f"antigravity: installed plugin {plugin_name!r} missing from list")
+ return findings
+ if match.get("enabled") is not True:
+ findings.append(f"antigravity: plugin {plugin_name!r} is not enabled")
+ if match.get("source") != "antigravity":
+ findings.append(f"antigravity: source {match.get('source')!r} != 'antigravity'")
+ if expected_version and match.get("version") != expected_version:
+ findings.append(f"antigravity: version {match.get('version')!r} != {expected_version!r}")
+
+ loaded_skills = set(match.get("skills") or [])
+ wanted = expected_skills(plugin_name, prefixed=False)
+ findings += [f"antigravity: missing skill {s}" for s in sorted(wanted - loaded_skills)]
+ findings += [f"antigravity: unexpected skill {s}" for s in sorted(loaded_skills - wanted)]
+ return findings
+
+
+def main() -> int:
+ """Run selected provider CLI validators in isolated temporary directories."""
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("providers", nargs="*", choices=("claude", "codex", "antigravity"), help="defaults to all")
+ providers = parser.parse_args().providers or ["claude", "codex", "antigravity"]
+
+ findings: list[str] = []
+ with tempfile.TemporaryDirectory(prefix="providers-") as directory:
+ home = Path(directory)
+ (home / ".codex").mkdir()
+ env = {**os.environ, "HOME": str(home), "CODEX_HOME": str(home / ".codex")}
+ if "claude" in providers:
+ findings.extend(claude_findings(env))
+ if "codex" in providers:
+ findings.extend(codex_findings(home, env))
+ if "antigravity" in providers:
+ findings.extend(antigravity_findings(home, os.environ))
+
+ findings = list(dict.fromkeys(findings))
+ print("\n".join(findings) or f"{', '.join(providers)}: all plugins load cleanly")
+ return 1 if findings else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/.github/workflows/validate-plugins.yml b/.github/workflows/validate-plugins.yml
new file mode 100644
index 0000000..098d646
--- /dev/null
+++ b/.github/workflows/validate-plugins.yml
@@ -0,0 +1,65 @@
+name: Validate Plugins
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - "plugin/**"
+ - ".claude-plugin/**"
+ - ".cursor-plugin/**"
+ - ".agents/**"
+ - ".github/scripts/**"
+ - ".github/workflows/validate-plugins.yml"
+ pull_request:
+ branches: [main]
+ paths:
+ - "plugin/**"
+ - ".claude-plugin/**"
+ - ".cursor-plugin/**"
+ - ".agents/**"
+ - ".github/scripts/**"
+ - ".github/workflows/validate-plugins.yml"
+
+jobs:
+ validate:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+
+ - name: Set up Node
+ uses: actions/setup-node@v7
+ with:
+ node-version: 22
+
+ - uses: astral-sh/setup-uv@v7
+
+ - name: Install Python dependencies
+ run: |
+ uv venv
+ uv pip install pyyaml
+ echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
+
+ - name: Install Antigravity CLI
+ run: |
+ curl -fsSL https://antigravity.google/cli/install.sh -o "$RUNNER_TEMP/install-agy.sh"
+ bash "$RUNNER_TEMP/install-agy.sh" --dir "$RUNNER_TEMP/agy-bin"
+ echo "$RUNNER_TEMP/agy-bin" >> "$GITHUB_PATH"
+
+ - name: Install Claude Code and Codex CLIs
+ run: npm install -g @anthropic-ai/claude-code@2.1.330 @openai/codex@0.171.0
+
+ - name: Validate plugin, skill, and marketplace formats
+ run: python .github/scripts/validate_plugins.py
+
+ - name: Validate with Claude Code, Codex, and Antigravity CLIs
+ run: python .github/scripts/validate_providers.py
+
+ - name: Verify manifest versions stay in sync
+ run: |
+ bash .github/scripts/sync-versions.sh
+ git diff --exit-code
diff --git a/README.md b/README.md
index 0bd029d..441ea4b 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Lab Rat teaches your AI coding agent to work like a careful ML researcher: repro
+