06 / 06 AI 開發規則AI coding rules

RuleLion

多工具 AI 開發規則產生、事實校驗與同步 CLI

Generate, verify and sync AI coding rules across tools

一份 AGENTS.md,同步到每一個 AI 編輯器——而且每條規則都查證過。

One AGENTS.md, synced to every AI editor — with every claim checked against the repo.

RuleLion icon
執行環境Runtime
Node.js ≥ 18Node.js ≥ 18
目標Targets
7 個規則檔7 rule files
網路Network
--no-llm 時零請求zero requests with --no-llm
技術Built with
  • CLI
  • ts-morph
  • TypeScript
  • MCP (stdio)
  • GitHub Action

(01) 為什麼Why

Claude Code、Cursor、Copilot、Windsurf、Cline 與 Gemini 各自從不同檔案讀規則,手寫的規則又會和程式碼漸行漸遠。RuleLion 從 repo 靜態擷取事實、校驗每一條宣稱,再從單一來源同步出去。

Claude Code, Cursor, Copilot, Windsurf, Cline and Gemini each read rules from a different file, and hand-written rules drift away from the code. RuleLion extracts facts statically, verifies every claim and syncs from a single source.

(02) 06 項items

它做什麼What it does

  1. 01

    靜態擷取事實Static fact extraction

    套件管理器、框架版本、scripts、tsconfig、lint 設定、目錄結構、import/export/錯誤處理模式與 commit 風格,每項都附檔案證據。

    Package manager, framework versions, scripts, tsconfig, lint config, directory layout, import / export / error-handling patterns and commit style — each with file evidence.

  2. 02

    校驗宣稱Claim verification

    產生的規則裡的指令、路徑、套件與版本都會對照 repo 檢查,查無實據的直接移除。

    Commands, paths, packages and versions in generated rules are checked against the repo; unverified ones are removed.

  3. 03

    可完全離線Works offline

    --no-llm 不發出任何網路請求;使用模型(Anthropic、OpenAI、Gemini)時只送出 Facts JSON,從不送原始碼。

    --no-llm makes zero network requests; with a model (Anthropic, OpenAI, Gemini) only the Facts JSON is sent — never source code.

  4. 04

    單一來源同步One source, synced

    維護 AGENTS.md 並同步到每個目標;只改寫 <!-- rulelion:start --> 與 <!-- rulelion:end --> 之間,手寫內容不會被覆蓋。

    Keep AGENTS.md and sync it to every target; only the block between <!-- rulelion:start --> and <!-- rulelion:end --> is rewritten, so hand-written content survives.

  5. 05

    CI 評分 0–100CI score, 0–100

    依可執行指令、目錄結構、技術版本、具體慣例、無過時內容、禁區清單與長度清晰度評分,標出過時的路徑、scripts、版本與空泛建議。

    Scores executable commands, verified structure, matching versions, concrete conventions, no stale content, a do-not-touch list and clarity — flagging stale paths, scripts, versions and vague advice.

  6. 06

    內建 MCP ServerBuilt-in MCP server

    rulelion mcp 提供 get_facts、check_rules、get_commands 三個工具。

    rulelion mcp exposes get_facts, check_rules and get_commands.

(03) 怎麼運作How it works

一個來源,七個目標One source, seven targets

  1. 01

    擷取Extract

    rulelion facts 讀出附證據的事實。

    rulelion facts reads evidence-backed facts.

  2. 02

    產生Generate

    離線模板或用模型潤飾。

    Offline template, or a model to polish.

  3. 03

    校驗Verify

    查無實據的宣稱被移除。

    Unverified claims are removed.

  4. 04

    同步Sync

    AGENTS.md → CLAUDE.md、Cursor、Copilot、Windsurf、Cline、Gemini。

    AGENTS.md → CLAUDE.md, Cursor, Copilot, Windsurf, Cline, Gemini.

  5. 05

    檢查Check

    CI 以最低分數擋下過時規則。

    CI blocks stale rules with a minimum score.

同步目標Sync targets
工具Tool檔案File
Codex / AmpAGENTS.md
Claude CodeCLAUDE.md
Cursor.cursor/rules/rulelion.mdc
Copilot.github/copilot-instructions.md
Windsurf.windsurfrules
Cline.clinerules
GeminiGEMINI.md

(04) README

快速開始Quick start

Repo 目前為私有,npx 指令要等開源後才能直接使用。安裝約 35 MB(AST 分析需要 ts-morph 與 TypeScript)。

The repo is private for now, so npx works once it is open-sourced. The install is about 35 MB (ts-morph and TypeScript for AST analysis).

快速開始Quick start
npx rulelion init
npx rulelion generate --no-llm --yes
npx rulelion check --ci --min-score 80
npx rulelion sync
npx rulelion facts --json

(05) 實測Measured

真實模型檢查Real-model check

2026-11-02 · 在 RuleLion 自己的 repo 上執行 generate · claude-haiku-5-52026-11-02 · generate on RuleLion’s own repo · claude-haiku-5-5

耗時Time被移除的未驗證宣稱Unverified claims removed保留內容Kept content
約 9–10 秒≈ 9–10 s1每個指令、路徑、版本都存在every command, path and version exists

(06) 安全Security

安全Security

  • 從不讀取 .env 的值,只讀 .env.example 的鍵名。Never reads .env values — only key names from .env.example.
  • 看起來像金鑰或 Token 的字串會從 Facts 中遮蔽。Strings that look like keys or tokens are redacted from Facts.
  • 遵守 .gitignore。Respects .gitignore.
  • 金鑰存在 ~/.config/rulelion/credentials.json(權限 600),只顯示遮罩。Keys live in ~/.config/rulelion/credentials.json (mode 600) and are only shown masked.

目前狀態Status

  • Repo 目前為私有,準備開源中。Repo currently private — coming to open source.
  • README 宣告 MIT 授權。README declares the MIT licence.

想先試用 RuleLion?Want to try RuleLion early?

所有 repo 目前都是私有的,準備開源中。想搶先試用,請透過 GitHub 個人頁聯絡。All repos are private for now and on their way to open source. To try one early, get in touch via the GitHub profile.