python-runtime-to-rust — Claude Code rule: steer new Python to Rust
python-runtime-to-rust — a review rule for Claude: when a pull request adds or grows Python under src/, the agent asks whether that logic belongs in the Rust runtime.
Apache-2.0 ★ 1,118 updated 2026-10-24
.claude/rules/python-runtime-to-rust.mdWhat python-runtime-to-rust does
The rule fires on the pull request diff. New *.py files under src/, or existing ones that got bigger, produce a single finding: a question about whether that runtime logic should move into Rust (rust/crates/). The list covers hot-path work such as command parsing, matching, classification, decisions, scanning, hashing, secure file I/O and hook handling.
Plenty is left alone. The rule skips tests/, ci/ and scripts/. Deleted or shrinking Python files stay out too. So do thin shims that only call the native runtime, and fixes to existing Python that has no Rust counterpart yet.
The finding arrives as a question, not a blocker: the pull request will not stall on it, though the author still has to justify the language choice. For Claude the rule is a file at .claude/rules/python-runtime-to-rust.md, and the repository ships variants for Cursor, GitHub Copilot, Windsurf and Cline.
What it helps with
- catch new Python in
src/that belongs in the Rust runtime - ask the language question during review, not after merge
- keep findings off tests, scripts and thin shims
- flag growth of an existing
*.pyfile - leave fixes to Python with no Rust counterpart alone
Example prompts for the agent
- Review this diff and tell me if the new
src/Python should be Rust - Run the
python-runtime-to-rustrule over my pull request - Check the growth in
src/matcher.pyand raise the Rust question if it is hot-path code
How to install python-runtime-to-rust
Manually: put the files in place
.claude/rules/python-runtime-to-rust.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/python-runtime-to-rust.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/python-runtime-to-rust.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/python-runtime-to-rust.mdManually: put the files in place
.clinerules/python-runtime-to-rust.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about python-runtime-to-rust
How do I install python-runtime-to-rust in Claude Code?
Put the rule file at .claude/rules/python-runtime-to-rust.md in your project.
What does python-runtime-to-rust do?
It reads the pull request diff and, for new or grown *.py files in src/, raises one question about moving that logic into Rust (rust/crates/).
Does the rule block a pull request?
No. The finding is raised as a question, so the merge does not stop. Answering why the code stays in Python is enough.
Source text
python-runtime-to-rust.md · Apache-2.0
# Python runtime policy HOL Guard is moving its runtime from Python to Rust (`rust/crates/`). When a pull request adds or grows `*.py` code under `src/`, report one finding asking whether the new runtime logic (command parsing, matching, classification, decisions, scanning, hashing, secure file I/O, hook handling, or other hot-path work) belongs in Rust instead. Do not report `tests/`, `ci/`, `scripts/`, deleted or shrinking Python, thin shims that only call the native runtime, or fixes to existing Python that has no Rust equivalent yet. Raise it as a question, not a blocker.
© hashgraph-online · Apache-2.0 · hashgraph-online/hol-guard