ruhui
БесплатноБез исполняемых скриптовНе проверенUse when building a feature that needs programmable common sense, when an LLM prompt-and-parse step should become a structured decision, or when routing…
от anyforge395 установок в других каталогахОб этом скилле
Build with Ruhui (如晦)
Ruhui makes units of AI intelligence usable like programming primitives: small judgments you can compose into larger capabilities. Its System 1 models return fast, typed, calibrated answers — not generated text. Code owns the workflow; the model supplies programmable common sense where ordinary code needs semantic understanding.
Ruhui is the open-source alternative to TypeSafe's Jev: same typed-decision paradigm (choice / noul / score), but self-hosted, bilingual (Chinese + English), and free. Where Jev is a closed hosted API, Ruhui is a pip package you run locally.
Prerequisites
Python 3.10+ required.
Install the package:
# 默认走清华镜像(国内快);失败或需要最新版时回退官方 PyPI pip install ruhui # 用 pip 全局配置的源(国内通常已是清华) pip install ruhui -i https://pypi.tuna.tsinghua.edu.cn/simple # 显式清华源 pip install ruhui -i https://pypi.org/simple # 官方源兜底The llm backend additionally needs
peft(pulled in automatically).Download the model first, then load by local path. Models are published on ModelScope and Hugging Face under
anyforge/ruhui:Backend ModelScope Hugging Face llm (0.8B, recommended) anyforge/ruhui/0.8Banyforge/ruhui/0.8Bbert (322M) anyforge/ruhui(root)anyforge/ruhui(root)Prefer ModelScope for downloads — it is the fastest and most reliable source from within mainland China.
Download the model (ModelScope first, HF fallback)
Pick the download source by probing reachability, then fetch the checkpoint to a local directory. The model is only downloaded once; load from that path afterwards.
import os, shutil, subprocess, sys
def reachable(url, timeout=5):
"""True if a host answers quickly. Used to pick ModelScope vs HF."""
host = url.split("/")[2]
cmd = ["curl", "-sI", "--max-time", str(timeout), "-o", "/dev/null", "-w", "%{http_code}", url]
try:
out = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout + 2)
return out.stdout.strip() in ("200", "302", "301")
except Exception:
return False
def download_model(repo_sub, local_dir):
"""Download a subfolder of anyforge/ruhui into local_dir, choosing the best source."""
if os.path.isdir(local_dir) and os.listdir(local_dir):
print(f"already present: {local_dir}")
return local_dir
ms_url = f"https://www.modelscope.cn/models/anyforge/ruhui"
hf_url = f"https://huggingface.co/anyforge/ruhui"
if reachable(ms_url):
# ModelScope path
try:
from modelscope.hub.snapshot_download import snapshot_download
d = snapshot_download("anyforge/ruhui", repo_type="model",
allow_patterns=[f"{repo_sub}/*"] if repo_sub else None)
if repo_sub:
d = os.path.join(d, repo_sub)
print(f"downloaded via ModelScope -> {d}")
return d
except Exception as e:
print(f"ModelScope download failed ({e}); trying Hugging Face")
if reachable(hf_url):
from huggingface_hub import snapshot_download
d = snapshot_download("anyforge/ruhui",
allow_patterns=[f"{repo_sub}/*"] if repo_sub else None)
if repo_sub:
d = os.path.join(d, repo_sub)
print(f"downloaded via Hugging Face -> {d}")
return d
raise RuntimeError("Neither ModelScope nor Hugging Face is reachable")
Use it before loading:
llm_dir = download_model("0.8B", "./models/ruhui-0.8b") # recommended llm backend
bert_dir = download_model(None, "./models/ruhui-bert") # root = bert backend
Load and use (llm backend recommended)
Two backends, one interface. Prefer the llm backend — it generalizes better and handles harder states. Fall back to the bert backend when you need ~33 ms latency, run on CPU, or deploy to a resource-constrained environment.
| Backend | Size | Latency | Deploy | Use when |
|---|---|---|---|---|
| llm (recommended) | 0.8B+ | hundreds of ms | GPU | general decisions, complex states |
| bert | 322M | ~33 ms | CPU or GPU | high throughput, low latency, edge |
Both read Chinese and English in the same checkpoint.
llm backend (recommended)
from ruhui.llm import LLMAgent
agent = LLMAgent(checkpoint_dir="./models/ruhui-0.8b") # the local path you downloaded
result = agent.predict(state, questions)
bert backend (fast fallback)
import ruhui
agent = ruhui.load("./models/ruhui-bert") # local path
result = agent.predict(state, questions)
The predict(state, questions) shape is identical for both — swap backends
without changing the call.
Load once, reuse the agent. Loading the model reads weights into memory and
costs seconds (bert ~1–2 s, llm ~5–10 s); predict is then fast and cheap.
Do not create the agent inside
Установить ruhui в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ruhui?
Use when building a feature that needs programmable common sense, when an LLM prompt-and-parse step should become a structured decision, or when routing, ranking, extraction, verification, moderation, or triage needs a fast, local, bilingual (Chinese + English) judgment. Ruhui (如晦) is an open-source, self-hosted System 1 decision engine that turns natural language and app state into typed choice/noul/score answers with calibrated probabilities — no text generation, no parsing, no hallucination. Two backends: a Qwen3.5 LoRA model (recommended) and a 322M bert encoder (~33 ms). Runs offline, no API key.
Как установить скилл ruhui?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ruhui запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic