Skip to content

wangmiaozero/laya-router-skill

laya-router

Verified

Cross-platform local decision routing for AI coding agents using Laya and Laya-MLX. Use for fast task classification, complexity estimation, model escalation hints, tool-use routing, and lightweight risk assessment. Advisory only.

FileKindSize
SKILL.mdskill md1.6 KB
agents/openai.yamlconfig219 B
assets/icon.svgother2.9 KB
references/AGENTS.mdmarkdown1.1 KB
references/AGENT_E2E.mdmarkdown8.2 KB
references/ARCHITECTURE.mdmarkdown1.2 KB
references/BACKENDS.mdmarkdown967 B
references/RC_VALIDATION.mdmarkdown5.0 KB
scripts/decide.pyscript561 B
scripts/decide.shexecutablescript64 B
scripts/healthcheck.pyscript3.3 KB
scripts/healthcheck.shexecutablescript69 B
scripts/install.ps1script226 B
scripts/install.pyscript12.3 KB
scripts/install.shexecutablescript65 B
scripts/uninstall.pyscript6.5 KB
scripts/uninstall.shexecutablescript73 B

scripts/healthcheck.py

View on GitHub
#!/usr/bin/env python3
"""Lightweight health check; never downloads model weights."""
from __future__ import annotations

import argparse
import importlib.util
import json
import os
from pathlib import Path
import shutil
import subprocess
import sys

sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "runtime"))
from laya_router import __version__
from laya_router.config import CONFIG_PATH, load_config
from laya_router.router import RouterCore
from install import data_dir, python_in_venv, skill_paths


def inspect() -> dict:
    base = data_dir()
    cfg = load_config()
    info = RouterCore(config=cfg).info()
    runtime = info.get("runtime")
    package = "laya_mlx" if runtime == "laya-mlx" else "laya"
    agents = {name: {"detected": bool(shutil.which(name)), "skill": path.exists()} for name, path in skill_paths().items()}
    hub = Path(os.environ.get("HF_HUB_CACHE", Path(os.environ.get("HF_HOME", Path.home() / ".cache" / "huggingface")) / "hub"))
    cached = bool(list(hub.glob("models--aac6fef--laya*")) + list(hub.glob("models--convaiinnovations--laya*"))) if hub.exists() else False
    codex_mcp = "SKIP"
    if shutil.which("codex"):
        try:
            cli = subprocess.run(["codex", "--version"], capture_output=True, timeout=5)
            if cli.returncode != 0:
                codex_mcp = "UNAVAILABLE"
            else:
                codex_mcp = "OK" if subprocess.run(["codex", "mcp", "get", "laya-router"], capture_output=True, timeout=5).returncode == 0 else "ABSENT"
        except (OSError, subprocess.TimeoutExpired):
            codex_mcp = "UNAVAILABLE"
    return {"version": __version__, "platform": info.get("platform"), "python": sys.version.split()[0],
            "backend": info.get("backend"), "runtime": runtime, "runtime_package": importlib.util.find_spec(package) is not None,
            "torch": importlib.util.find_spec("torch") is not None, "mlx": importlib.util.find_spec("mlx") is not None,
            "device": info.get("device"), "model_cache": "present (unverified)" if cached else "absent", "config": str(CONFIG_PATH),
            "config_exists": CONFIG_PATH.exists(), "venv": (base / ".venv").exists(), "agents": agents,
            "mcp_adapter": importlib.util.find_spec("mcp") is not None, "codex_mcp": codex_mcp,
            "status": "READY" if info.get("status") == "ready" else "UNAVAILABLE", "fail_open": True}


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--json", action="store_true")
    parser.add_argument("--lightweight", action="store_true")
    args = parser.parse_args(argv)
    private_python = python_in_venv(data_dir() / ".venv")
    if private_python.exists() and Path(sys.executable).resolve() != private_python.resolve():
        os.execv(str(private_python), [str(private_python), str(Path(__file__).resolve()), *(argv if argv is not None else sys.argv[1:])])
    result = inspect()
    if args.json:
        print(json.dumps(result, indent=2))
    else:
        print("Laya Router Health")
        for key, value in result.items():
            if key != "agents":
                print(f"{key:18} {value}")
        for name, detail in result["agents"].items():
            print(f"{name:18} {'SKIP' if not detail['detected'] else 'OK' if detail['skill'] else 'WARN'}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexUnverifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall