UR

unblocked/repo-rules-agent

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

80 stars Качество 63 Тренд 8MIT

Извлекать и индексировать инструкции кодирования ИИ из файлов правил

Обзор

Извлекать и индексировать инструкции кодирования ИИ из файлов правил (CLAUDE.md, AGENTS.md, .cursorrules и др.). Ты написал правила. В корне есть CLAUDE.md, AGENTS.md для Codex, файл .cursorrules и все остальное под .cursor/rules/ или .github/instructions/. Но когда вы открываете сессию агента и говорите «просмотрите этот PR», он не видит их всех. Repo-rules-agent создает один запрашиваемый индекс из каждого файла правил в вашем РЕПО. Запрос, направленный на работу перед вами — например, проверка кода задачи — Lang py — Severity, должен — возвращает ~15 правил, которые действительно применяются, а не 8 000 токенов файлов правил. - охватывает ~40 известных соглашений о файлах правил на четырех уровнях приоритета - корневые файлы, пути для конкретных инструментов, каталоги правил с шариками и рекурсивный * * Экстракт * * Индекс * * Запрос * * возвращает правила, относящиеся к текущей задаче. Фильтр по задаче, языку, серьезности, объему; вывод в виде таблицы, JSON или готового к работе блока.

Обзор (машинный перевод)

Извлекать и индексировать инструкции кодирования ИИ из файлов правил (CLAUDE.md, AGENTS.md, .cursorrules и др.).

##Почему?

Ты написал правила. Есть CLAUDE.md в корне, AGENTS.md для Кодекса, .cursorrules файл, и все остальное живет под .cursor/rules/ или .github/instructions/. Но когда вы открываете сессию агента и говорите «просмотрите этот PR», он не видит их всех.

Repo-rules-agent создает один запрашиваемый индекс из каждого файла правил в вашем РЕПО. Запрос, направленный на работу перед вами, например, --task code-review --lang py --severity must, возвращает ~15 правил, которые фактически применяются, а не 8000 токенов файлов правил.

Как это работает

Четыре этапа: ** Discover → extract → index → query**.

Discover охватывает ~40 известных соглашений о файлах правил на четырех уровнях приоритета — корневые файлы, пути, специфичные для инструмента, каталоги правил с шариками и рекурсивный уровень **. В этом случае [[7]], [[8]], [[9]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], [[T]], Extract отправляет каждый файл в LLM через протокол вызова инструмента OpenAI. Модель заполняет проверяемую пидантом схему — см. Модель правил.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

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
Открыть полный README на GitHub

Рекомендуемые инструменты

Попробуйте другой запрос или уберите фильтр.

Установка

npx skillfish add unblocked/repo-rules-agent
Новичок в MCP? Начните с руководства на mcpskill.org →