К основному содержанию
плагин CX Codex

codex-rg-guard — плагин для Claude Code: поиск и установка

Плагин codex-rg-guard для Claude Code сужает широкие поисковые запросы через бюджетный MCP-инструмент. Он отбирает файлы и ограничивает выдачу строк.

MIT ★ 1 596 обновлён 2026-10-29

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add hashgraph-online/awesome-codex-plugins
/plugin install codex-rg-guard@awesome-codex-plugins
Открыть на GitHub

Что делает codex-rg-guard

Плагин codex-rg-guard заменяет прямой rg или grep поиском с ограниченным бюджетом. Сначала он находит подходящие файлы без фрагментов, затем ищет строки только внутри выбранных путей. MCP-интерфейс сводится к инструменту cxs(op,args) с операциями find, files, symbol, json и self_check.

Результаты могут ограничиваться числом совпадений, длиной строк, размером вывода и временем выполнения; для постраничного просмотра используется next_page.offset. Есть поиск по JSON, JSONL, NDJSON, CSV и TSV, а также облегчённый поиск определений. Для Rust-пакета и Python-версии нужен rg; Python-реализация требует Python 3.10+, а сборка Rust из исходников требует Rust toolchain.

Какие задачи решает

  • сузить поиск по большому репозиторию до списка файлов
  • ограничить число строк и объём вывода для агента
  • найти определения символов по шаблону
  • искать поля в JSON, CSV и TSV
  • повторить оборванный список файлов с next_page.offset

Примеры запросов агенту

  • Найди ExactIdentifier сначала только среди файлов в docs и src.
  • Покажи совпадения ExactIdentifier только в src/example.py и ограничь выдачу 20 строками.
  • Проверь окружение и зависимости через операцию self_check.

Как установить codex-rg-guard

Через маркетплейс плагинов

/plugin marketplace add hashgraph-online/awesome-codex-plugins
/plugin install codex-rg-guard@awesome-codex-plugins

По шагам, с командами для каждой платформы: Плагины Claude Code: маркетплейсы, установка и как собрать свой

Вопросы о codex-rg-guard

Как установить codex-rg-guard в Claude Code?

Выполните /plugin marketplace add hashgraph-online/awesome-codex-plugins? No. Установите через команды /plugin marketplace add hashgraph-online/awesome-codex-plugins и /plugin install codex-rg-guard@awesome-codex-plugins.

Что делает codex-rg-guard?

Он разбивает широкий поиск на два шага: сначала отбирает файлы, затем выдаёт ограниченные совпадения внутри них. Плагин также ищет символы и структурированные данные через MCP.

Что нужно для работы codex-rg-guard?

Для Rust prebuilt package и Python-версии нужен rg. Python-версия требует Python 3.10+, а сборка Rust из исходников требует Rust toolchain и rg.

Исходный текст

codex-rg-guard · MIT
<div align="center">

# Codex rg Guard

**Low-context `rg` / `grep` replacement for Codex that reduces search noise and context waste.**

Use a budgeted MCP search tool before broad repository searches flood the model
with raw matches, repeated snippets, or truncated shell output.

</div>

<br/>
<p align="center">
  <a href="README.md"><img src="https://img.shields.io/badge/Docs-README-FFD700?style=for-the-badge" alt="Documentation"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License: MIT"></a>
  <a href="https://github.com/Rycen7822/codex-rg-guard/releases"><img src="https://img.shields.io/badge/Download-Releases-FF6600?style=for-the-badge" alt="Releases"></a>
  <a href=".mcp.json"><img src="https://img.shields.io/badge/MCP-single%20tool-2ea44f?style=for-the-badge" alt="MCP: single tool"></a>
  <a href="rust-version/README.md"><img src="https://img.shields.io/badge/Runtime-Python%20%7C%20Rust-5865F2?style=for-the-badge" alt="Runtime: Python and Rust"></a>
</p>

> This project is intended for large or many-file projects where raw `rg` /
> `grep` can waste Codex context. For known files, tiny repositories, or narrow
> local checks, normal file reads and direct shell tools are usually simpler.

## Why

Raw search is great for humans, but it is often wasteful for coding agents:

- too many matches enter the conversation at once;
- long lines and repeated hits pollute context;
- shell output can be truncated before Codex sees the useful part;
- broad searches usually need file narrowing before line-level inspection.

Codex rg Guard keeps `ripgrep` as the underlying search engine, but wraps it in
a small budgeted interface designed for staged agent workflows.

## Features

- **Single MCP tool**: Codex sees only `cxs(op,args)`, keeping tool-list context small.
- **Files-first search**: `find(files_only:true)` identifies candidate files without snippets.
- **Bounded line hits**: line snippets are capped by total hits, per-file hits, line length, total output, process bytes, and timeout.
- **Pagination hints**: truncated files-only results expose `next_page.offset`.
- **Structured data search**: `json` searches JSON, JSONL, NDJSON, CSV, and TSV with field projection.
- **Symbol lookup**: lightweight regex-based `symbol` search for common language definitions.
- **Optional `rg` shim**: common `rg -n` calls can be intercepted and returned as compact JSON.
- **Two runtimes**: Python implementation for simple hacking, Rust implementation for faster native distribution.

## Install

| Variant | Best for | Runtime requirements |
| --- | --- | --- |
| Rust prebuilt package | Normal use and distribution | `rg` |
| Python version | Editing or debugging the original implementation | Python 3.10+, `rg` |
| Rust from source | Development and platform-specific builds | Rust toolchain, `rg` |

### Agent Self-Install Prompts

Copy the matching prompt into a Codex agent when you want it to install the
plugin for itself.

Rust prebuilt package, recommended for normal use:

```text
Install Codex rg Guard for yourself globally from repo `https://github.com/Rycen7822/codex-rg-guard`. Use the Rust prebuilt asset `https://github.com/Rycen7822/codex-rg-guard/releases/download/v0.2.4/codex-rg-guard-rust-0.2.4-x86_64-unknown-linux-gnu.tar.gz`, install it under `~/.codex/plugins/codex-rg-guard`, enable `codex-rg-guard@local-personal`, register MCP `cxs-rg-guard` to `~/.codex/plugins/codex-rg-guard/bin/cxs-mcp-server`, and verify with `cxs --help`, `codex mcp list`, and MCP `self_check`.
```

Python version, for editing or debugging the original implementation:

```text
Install the Python/source version of Codex rg Guard for yourself from repo `https://github.com/Rycen7822/codex-rg-guard`, not the Rust prebuilt package. Put the source tree under `~/.codex/plugins/codex-rg-guard`, register MCP `cxs-rg-guard` with `python3 ~/.codex/plugins/codex-rg-guard/mcp/cxs_mcp_server.py`, and verify the Python CLI/MCP path.
```

Rust from source, for platform-specific builds:

```text
Build Codex rg Guard from source for your platform by cloning `https://github.com/Rycen7822/codex-rg-guard`, then running `cd rust-version && cargo build --release --bins`. Package/install it with `rust-version/scripts/package-plugin.sh`, register the installed Rust MCP binary, and verify.
```

### Rust Prebuilt Package

Build the distributable package on the target platform or in CI:

```bash
bash rust-version/scripts/package-plugin.sh
```

The archive is written to:

```text
rust-version/dist/codex-rg-guard-rust-<version>-<target>.tar.gz
```

Install on the target machine:

```bash
tar -xzf codex-rg-guard-rust-<version>-<target>.tar.gz
./codex-rg-guard-rust-<version>-<target>/install-local.sh
```

Restart Codex, then enable **Codex rg Guard**.

Fallback direct MCP registration:

```bash
codex mcp add cxs-rg-guard -- ~/.codex/plugins/codex-rg-guard/bin/cxs-mcp-server
```

Optional shell tools:

```bash
export PATH="$HOME/.codex/plugins/codex-rg-guard/bin:$PATH"
```

### Python Version

Use this path when you want the original Python implementation or want to edit
the Python code directly.

```bash
unzip codex-rg-guard.zip
cd codex-rg-guard
./scripts/install-local.sh
```

Fallback direct MCP registration:

```bash
codex mcp add cxs-rg-guard -- python3 ~/.codex/plugins/codex-rg-guard/mcp/cxs_mcp_server.py
```

### Rust From Source

```bash
cd rust-version
cargo build --release --bins
cargo test
cargo clippy --all-targets --all-features -- -D warnings
```

From the repository root, build a package for a specific installed Rust target:

```bash
TARGET=x86_64-unknown-linux-musl bash rust-version/scripts/package-plugin.sh
```

## How It Works

Use broad search as a staged workflow instead of dumping raw matches:

1. Ask for matching files only.
2. Search only inside the candidate files for bounded line hits.
3. Read exact files or small spans with Codex-native file tools after a concrete file and line are known.
4. If a files-only result is truncated, repeat with `next_page.offset`.

Example first stage:

```json
{"op":"find","args":{"query":"ExactIdentifier","scopes":["docs","src"],"files_only":true}}
```

Example second stage:

```json
{"op":"find","args":{"query":"ExactIdentifier","paths":["src/example.py"],"max_total_hits":20}}
```

## MCP Operations

| Operation | Purpose |
| --- | --- |
| `find` | Content search with budgeted snippets or files-only output |
| `files` | File/path search without reading file contents |
| `symbol` | Lightweight definition lookup |
| `json` | Bounded structured-data search |
| `self_check` | Runtime and dependency check |

Codex sees one MCP tool:

```json
{"op":"find","args":{"query":"ExactIdentifier","scopes":["docs","analysis"]}}
```

## CLI

```bash
bin/cxs self-check
bin/cxs find "ExactIdentifier" --scope docs --scope analysis
bin/cxs find "ExactIdentifier" --files-only --scope docs --scope src
bin/cxs find "ExactIdentifier" --files-only --scope docs --scope src --offset 30
bin/cxs symbol train_loop
bin/cxs json --filter doc_id=doc-123 --field doc_id --field token_count --scope analysis
```

All outputs are compact JSON by default. Add `--pretty` for manual inspection.

## Optional rg Shim

```bash
export PATH="$HOME/.codex/plugins/codex-rg-guard/bin:$PATH"
```

Common `rg -n` calls return compact, budgeted JSON. Escape hatch:

```bash
CXS_RAW_RG=1 rg -n "pattern" .
```

## Project Layout

| Path | Description |
| --- | --- |
| `.mcp.json` | Python MCP registration used by the source plugin |
| `mcp/cxs_mcp_server.py` | Python MCP server |
| `cxs/` | Python core, CLI, and MCP implementation |
| `rust-version/` | Rust implementation, tests, and packaging scripts |
| `skills/rg-budget-search/SKILL.md` | Short Codex routing rule |
| `bin/` | Python-version CLI and shim entrypoints |

## Development

Python checks:

```bash
python3 -m unittest discover -s tests -v
python3 scripts/self_check.py
```

Rust checks:

```bash
cd rust-version
cargo fmt --check
cargo test
cargo clippy --all-targets --all-features -- -D warnings
```

Python/Rust semantic compatibility check:

```bash
python3 rust-version/scripts/compare_python.py
```

## Notes

- `read` was intentionally removed; use Codex-native file reads after search narrows to a concrete file or span.
- `ast-grep` is optional and not used by the current implementation.
- Vector search, SQLite, embeddings, `jq`, and `fd` are not required.

## License

MIT

© hashgraph-online · MIT · hashgraph-online/awesome-codex-plugins

Похожие плагины

Все плагины по теме «Настройка агента: память, контекст, субагенты» →
find-past-conversation donnfelker Скилл find-past-conversation ищет прошлые сессии Claude Code в каталоге ~/.claude/projects/ по ключевым фразам, ошибкам или темам. Помогает вспомнить решения и найти нужный transcript. CX Codex +1 765установок gh-guard sbom-tool Плагин gh-guard настраивает защиту CI/CD в GitHub Actions для Rust-проектов. Он выявляет уязвимости цепочки поставок и создаёт проверенные конфигурации безопасности. ★ 15звёзд репо compact-guard Rohit Ghumare Команда compact-guard сохраняет состояние работы перед сжатием контекста и восстанавливает критичные данные после. CX Codex +1 ★ 2 966звёзд репо devcontainer-setup trailofbits Скилл devcontainer-setup для Claude Code создаёт изолированный devcontainer с предустановленным Claude Code, инструментами для Python, Node, Rust или Go и постоянными томами. Контейнер изолирует запуск агента в песочнице проекта. CX Codex +1 5 800установок iii-core-primitives iii-hq Скилл iii-core-primitives для Claude Code помогает подключать функции iii, настраивать события и управлять воркерами. Агент использует его при работе с вызовами, наблюдателями и реестром движка. CX Codex +1 4 900установок ctx-search mksglu Скилл ctx-search ищет информацию в сохранённой базе проекта без перечитывания исходников в контекст. Работает с индексированным контентом, документацией и истории сессий через FTS5. CX Codex +1 1 100установок

Из того же набора391

Весь набор →
codex-usage-and-resets Плагин codex-usage-and-resets показывает расход недельного лимита Codex, темп использования и сроки сброса. Помогает оценить, хватит ли лимита на запланированную работу. CX Codex ★ 1 596звёзд репо codex-tui-proof Плагин codex-tui-proof для Claude Code проверяет терминальные интерфейсы в браузере Codex: вводит клавиши и прикладывает скриншоты. Запускается по просьбе проверить TUI. CX Codex ★ 1 596звёзд репо codex-tasklist Плагин codex-tasklist создаёт живую панель задач для сессий Codex CLI с автосохранением в SQLite и переключением на tmux при отсутствии нативных панелей терминала. CX Codex ★ 1 596звёзд репо codex-skin-pack-installer Плагин codex-skin-pack-installer загружает и проверяет безопасные наборы скинов Codex из релизов GitHub. Он пригодится, когда нужны фон, оформление и понятный путь восстановления. CX Codex ★ 1 596звёзд репо codex-reviewer Плагин codex-reviewer проводит независимое ревью планов и написанного кода в проектах под управлением Claude. Помогает находить логические дыры до мёржа. CX Codex ★ 1 596звёзд репо codex-quota-title Плагин codex-quota-title показывает остаток квоты Codex и время сброса в заголовке окна Codex Desktop. Работает на Windows и сохраняет исходный заголовок. CX Codex ★ 1 596звёзд репо codex-quota-optimizer Плагин codex-quota-optimizer для Claude Code направляет задачи к подходящей модели и сужает контекст. Он также задаёт послойную проверку изменений. CX Codex ★ 1 596звёзд репо codex-process-jobs Плагин codex-process-jobs запускает долгие команды сборки, тестов или бенчмарков как изолированные фоновые процессы на macOS и Linux с сохранением логов и статуса. CX Codex ★ 1 596звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой