UR

unblocked/repo-rules-agent

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

80 stars 品質 63 トレンド 8MIT

ルールファイルからAIコーディングの指示を抽出し、インデックス化

概要

ルールファイル(CLAUDE.md、AGENTS.md、.cursorrulesなど)からAIコーディングの指示を抽出し、インデックス化します。 ルールを書きました。 ルートにCLAUDE.md、Codex、.cursorrulesファイル用のAGENTS.mdがあり、その他のものは.cursor/rules/または.github/instructions/下に住んでいます。 しかし、エージェントセッションを開き、「このPRを見直す」と言うと、そのすべてが見えない。 repo-rules-agent は、リポジトリ内のすべてのルールファイルから 1 つのクエリ可能なインデックスを構築します。 --task code-review --lang py --severity --severity は、実際に適用する ~15 のルールを、 8,000 トークンのルールファイルではなく返す必要があります。 - ルートファイル、ツール固有のパス、グロブ付きのルールディレクトリ、および再帰的な**Index**Query**は、現在のタスクにスコープされたルールを返す4つの優先順位の階層に~40の既知のルールファイル規則をスワイプします。 タスク、言語、重度、スコープによるフィルタリング。テーブル、JSON、または迅速な対応ブロックとして出力します.

概要(AI 翻訳)

ルールファイル(CLAUDE.md、AGENTS.md、.cursorrulesなど)からAIコーディングの指示を抽出し、インデックス化します。

なぜ?

ルールを書きました。 CLAUDE.md]のルートには、Codexの[AGENTS.md]、 [.cursorrules]のファイル、および[.cursor/rules/]または[.github/instructions/に住んでいます。 しかし、エージェントセッションを開き、「このPRを見直す」と言うと、そのすべてが見えない。

repo-rules-agent は、リポジトリ内のすべてのルールファイルから 1 つのクエリ可能なインデックスを構築します。 [--task code-review --lang py --severity must のように、作業の前にスコープ付けされたクエリは、実際に適用する ~15 ルールを、ルールファイルの 8,000 トークンではなく返します。

使い方

4つの段階:discover →のエキスの→の索引の→のクエリ。

-Discoverは4つの優先層に渡る40の既知のルールファイル条約をスワイプします。ルートファイル、ツール固有のパス、グロブ付きのルールディレクトリ、および再帰的[[T6]ティア。 [@include-style ディレクティブを解決するので、[CLAUDE.md] のポインタだけ AGENTS.md] は 1 つのソースとしてカウントされます。 -Extractは、OpenAIツール呼び出しプロトコルを介して各ファイルをLMに送信します。 モデルはpydantic-validatedスキーマを埋めます.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

Rules Agent

Extract and index AI coding instructions from rules files (CLAUDE.md, AGENTS.md, .cursorrules, etc.).

Why?

You’ve written the rules. There’s a CLAUDE.md at the root, an AGENTS.md for Codex, a .cursorrules file, and whatever else lives under .cursor/rules/ or .github/instructions/. But when you open an agent session and say “review this PR,” it doesn’t see all of them.

repo-rules-agent builds one queryable index from every rules file in your repo. A query scoped to the work in front of you — e.g. --task code-review --lang py --severity must — returns the ~15 rules that actually apply, not 8,000 tokens of rules files.

How it works

Four stages: discover → extract → index → query.

  • Discover sweeps ~40 known rules-file conventions across four priority tiers — root files, tool-specific paths, rules directories with globs, and a recursive ** tier. It resolves @include-style directives, so a CLAUDE.md that’s just a pointer to AGENTS.md counts as one source, not two.
  • Extract sends each file to an LLM via the OpenAI tool-calling protocol. The model fills a pydantic-validated schema — see Rule Model. Large files are chunked on Markdown headings via chonkie.
  • Index merges near-duplicates by text similarity and flags potential conflicts — similar rules with contradictory severities — for human resolution.
  • Query returns rules scoped to the current task. Filter by task, language, severity, scope; output as a table, JSON, or a prompt-ready block.

Dependencies

  • uv — Python package manager
  • git — used for blob SHA computation during indexing
  • Ollama — required if you use the default local provider; not needed if you configure OpenAI, Anthropic, or another hosted provider

Setup

# Install dependencies
uv sync

Configuration

The tool works with any OpenAI-compatible API provider. By default, it connects to a local Ollama instance; OpenAI and Anthropic are also supported.

Copy .env.example to .env and uncomment the provider you want to use:

cp .env.example .env
# Edit .env with your API keys

The .env file is gitignored and loaded automatically at startup via python-dotenv. Shell environment variables take precedence over .env values, so you can always override a .env setting with an explicit export.

Providers

Local (Ollama — default, no API key needed):

ollama pull glm-4.7-flash:latest
uv run repo-rules-agent index /path/to/repo

Local models vary in tool-calling reliability; for the highest-quality extraction, use OpenAI or Anthropic.

Anthropic (add to .env):

RULES_AGENT_LLM__BASE_URL=https://api.anthropic.com/v1
RULES_AGENT_LLM__API_KEY_ENV=ANTHROPIC_API_KEY
RULES_AGENT_LLM__EXTRACTION_MODEL=claude-haiku-4-5
GitHub で README 全文を見る

推奨ツール

別のキーワードを試すか、フィルタを外してください。

インストール

npx skillfish add unblocked/repo-rules-agent
MCP 初心者?mcpskill.org のガイドから始めましょう →