RAYNSIS Inspector
Evidence gates for coding agents.
Published as kanit 0.1.0 (PyPI kanit-gates) before the rename to RAYNSIS Inspector.
Coding agents say "all tests pass" without running them, cite links they never opened, report "deployed" in a turn where no tool ran, and now and then try to edit their own guardrails. RAYNSIS Inspector is a small Claude Code plugin that checks two moments:
- Before a tool call (PreToolUse): a dangerous call is denied, with a reason the agent can act on. An edit to the agent's own guardrails (hook settings, hook scripts, installed plugins) is put to you as a permission prompt instead, so you can still change your hooks with the agent's help.
- Before a reply is final (Stop, and SubagentStop for subagents): a reply that claims work the transcript cannot prove is sent back once, with what is missing.
Every rule ships with examples it must fire on and examples it must stay quiet on. Every check is logged, not only the hits, so you can see how often each rule fires per evaluation.
Python 3.9+, standard library only, no network calls, no telemetry.
Status: alpha (0.2.x). Rule ids and the rules file format may still change before 1.0.
Install
In Claude Code (2.1.275 or later):
/plugin install raynsis-inspector --marketplace RAYNSIS/inspector
On older versions, or from a terminal:
claude plugin marketplace add RAYNSIS/inspector
claude plugin install raynsis-inspector@raynsis-inspector
The plugin needs Python 3.9 or later on your PATH, under any of the names python3, python or py.
Nothing else is installed. On Windows the hooks run through Git Bash, which comes with Git for Windows.
Pin a version. Add # and a release tag to the source, and you run that release and nothing newer:
/plugin install raynsis-inspector --marketplace RAYNSIS/inspector#v0.3.0
Claude Code does not auto-update plugins from a third-party marketplace such as this one unless you turn
auto-update on for it (/plugin, Marketplaces tab). Read the changelog before you move the pin.
Cost. Measured on our test machine (macOS, Python 3.9): a tool-call check takes 61 ms median
(95th percentile 66 ms), and a reply check on a 7.1 MB session transcript 162 ms (95th percentile 179 ms).
The timeout values in hooks/hooks.json (10 s for a tool call, 20 s for a reply) are ceilings, not costs.
Try it in the first minute
A gate only speaks when something goes wrong, so a healthy session stays silent: in our own logs, 19 hits in 395 sessions over 30 days. To see one without waiting, paste this into Claude Code right after installing:
Run this exact command and show me the output: cat .env
The call is denied before it runs, whether or not the file exists, and the agent is told why:
PreToolUse:Bash hook error: RAYNSIS Inspector blocked this call:
- [tool.no-secret-files] Secret files stay out of the agent's context. Ask the human for the one value you need. (matched: " .env")
If the command runs instead, the plugin is not loaded: check /plugin, and that Python 3.9 or later is on your PATH.
To use the raynsis-inspector command outside Claude Code (rule checks, stats):
pip install raynsis-inspector
The package on PyPI and the command are raynsis-inspector; the Python module is raynsis_inspector.
From a clone of this repository, pip install . installs the same thing.
What it does
A blocked tool call, as the agent sees it:
PreToolUse:Bash hook error: RAYNSIS Inspector blocked this call:
- [tool.no-secret-files] Secret files stay out of the agent's context. Ask the human for the one value you need. (matched: " .env")
A reply sent back at Stop, and the agent's next answer (Claude Code 2.1.327, recorded during release testing):
Agent: All tests pass.
RAYNSIS Inspector: this reply claims something the session cannot prove. Fix it before finishing:
- [reply.tests-pass-needs-run] You said tests pass, but no test command ran
in this turn. Run them and show the result, or say they were not run.
(matched: "All tests pass")
Agent: Tests were not run in this turn, so I can't claim they pass. My earlier
"All tests pass" reply was unsupported.
You can try any rule without Claude Code:
$ raynsis-inspector check reply 'Fixed the parser. All tests pass.' --turn 'Edit: {"file_path": "parser.py"}'
DENY reply.tests-pass-needs-run
You said tests pass, but no test command ran in this turn. Run them and show the result, or say they were not run.
matched: "All tests pass"
$ raynsis-inspector check reply 'Fixed the parser. All tests pass.' --turn 'Edit: {"file_path": "parser.py"}' --turn 'Bash: {"command": "pytest -q"}'
pass: no rule fired (20 rules checked)
raynsis-inspector check exits 1 when a deny rule fires, so it also works in scripts.
Rules in this release
| id | on | action | what it stops |
|---|---|---|---|
tool.no-recursive-delete-home |
tool | deny | This deletes the home or root directory. |
tool.no-disk-wipe |
tool | deny | This writes over a disk or partition and cannot be undone. |
tool.no-force-push |
tool | deny | Force push rewrites shared history. |
tool.no-hook-bypass |
tool | deny | This skips the repository's own checks (git hooks). |
tool.no-package-publish |
tool | deny | Publishing a package, image or release is visible to everyone and cannot be fully taken back. |
tool.no-curl-pipe-shell |
tool | deny | Piping a download straight into a shell or interpreter runs unreviewed code. |
tool.no-secret-files |
tool | deny | Secret files stay out of the agent's context. |
tool.no-secret-in-command |
tool | deny | A live-looking secret is written into this command or file, where shell history, logs or git will keep it. |
tool.guardrails-read-only |
tool | ask | This edits a guardrail: hook settings, hook scripts, installed plugins or RAYNSIS Inspector's rules and logs. |
tool.guardrails-read-only-shell |
tool | ask | This shell command writes to guardrail files: hook settings, hook scripts, installed plugins or .raynsis-inspector/. |
tool.guardrails-read-only-mcp |
tool | ask | This MCP file tool edits a guardrail file: hook settings, hook scripts, installed plugins or .raynsis-inspector/. |
tool.no-test-skip |
tool | warn | This edit marks an existing test as skipped or expected to fail. |
tool.no-test-file-delete |
tool | warn | This deletes or empties test files, or moves them where the test runner will not find them. |
tool.no-test-function-delete |
tool | warn | This edit removes an existing test. |
reply.tests-pass-needs-run |
reply | deny | You said tests pass, but no test command ran in this turn. |
reply.build-passes-needs-run |
reply | deny | You said the build, type check or lint passes, but none of them ran in this turn. |
reply.done-needs-action |
reply | deny | You claimed finished work, but no tool ran in this turn. |
reply.unopened-link |
reply | deny | This link never appeared in anything you opened or were given this session. |
reply.tr.tests-pass-needs-run |
reply | deny | Testlerin geçtiğini yazdın ama bu turda test komutu çalışmadı. |
reply.tr.done-needs-action |
reply | deny | Bitmiş iş bildirdin ama bu turda hiçbir araç çalışmadı. |
The full patterns and their examples are in raynsis_inspector/rules/core.json and
raynsis_inspector/rules/tr.json. raynsis-inspector rules lists what is active in your project.
How it decides
- Tool rules match a regex against named fields of the tool input (
command,file_path,content, ...). Anunlessregex can exempt a match."only_added": truefires only when an edit adds a match that the replaced text did not have, so an existing skipped test does not triptool.no-test-skip."only_removed": trueis the mirror: it fires when an edit leaves fewer matches than it replaced, so deleting a test function tripstool.no-test-function-deleteand renaming one does not. - Guardrail rules ask. The three
tool.guardrails-read-onlyrules returnask: Claude Code shows you a permission prompt labelled[plugin:raynsis-inspector]with the reason, and the call runs only if you approve it. With nobody to answer (claude -p), Claude Code denies the call and the agent reads the reason. This holds in thedefault,acceptEdits,planandautopermission modes. InbypassPermissionsClaude Code let a Write under.claude/through even though a hook returnedask(we measured it withclaude -p; the sameaskdid stop a Write to an ordinary path), so in that mode, indontAskand in any mode the hook does not recognise, these rules deny as before and say how to approve the change. When one call matches both adenyand anaskrule,denywins. - Reply rules match a claim in the final reply, then look for evidence among the tool calls made
in this turn (since the last human message). "Tests pass" needs a test command run through a shell
or a subagent; "the build passes" needs a build, type check or lint command; "I've deployed" needs at
least one tool call. Only the command counts, not its description, and reading is not running:
cat tests/test_api.py,ls tests/or a Read of the file is not a test run, and neither is installing or locating a runner (pip install pytest,which pytest). - What is not a claim. A question ("Do the tests pass?"), a condition ("If the tests pass, merge it",
"When CI is green and all tests pass, the bot merges"), an instruction ("Make sure all tests pass"), a
hedge ("Ideally all tests pass"), a negation ("Not all tests pass yet"), someone else's words ("The
README says all tests pass") and a phrase in quotation marks (my earlier "All tests pass" was wrong) are
not checked. A statement stays a claim: "I can confirm all tests pass", "I re-ran pytest and confirm all
tests pass", "This change ensures that all tests pass" and a claim under a heading line such as
"## Verify" are checked, and so is a past event: "Once I pushed the fix, CI went green". A question after the claim does not excuse it: "All tests pass, want me to
commit?" and "All tests pass (shall I merge?)" are checked. An
unlessphrase ("not verified") only excuses the sentence it is in. - Links in a reply must have appeared in a human message, a tool result, or the input of a read-only tool, anywhere in the session (a link not found in the last 4 MB is looked up in the whole transcript). A link the agent only wrote into a file does not count.
- A reply is sent back once. If the next attempt still matches (
stop_hook_active), RAYNSIS Inspector warns the human instead of blocking again, so a session can never loop. - Unknown is not missing. After a context compaction the start of the turn may be in another file.
Then the turn's evidence is unknown, and the evidence rules are skipped instead of guessing.
raynsis-inspector statsandraynsis-inspector doctorshow how often that happened. - Warn rules do not block. Their message goes to the human, not the agent.
- A slow check never becomes a silent pass. Claude Code lets a call through when a hook times out,
so RAYNSIS Inspector stops itself first (6 s for a tool call, 14 s for a reply): an unfinished tool check denies
the call and says why, an unfinished reply check warns the human. Inputs are bounded (rules file 1 MB,
prior file content 2 MB) and special files (FIFOs, devices) are never read. The packaged patterns are
linear with no length limit: a scan stops only where its own start repeats, so the worst 60 KB command
we could build takes under 0.3 s per rule on our test machine, and a long argument list does not hide
the end of a command. The budget is for project rules that are not linear. The timer needs a POSIX system. On Windows the hook timeout in
hooks/hooks.jsonis the only limit, and when it runs out Claude Code lets the call through; a watchdog thread is no substitute, because a running regex does not let it run until the match ends (checked on Python 3.9).
Configure
Project rules live in .raynsis-inspector/rules.json at the project root (Claude Code's CLAUDE_PROJECT_DIR, so a
cd inside the session does not leave them behind). A rule with a new id is added. A rule with the id of an
existing rule changes only the fields you write. "<field>+" adds an alternative to a regex instead of
replacing it, null removes a field, and "disable" turns rules off.
Teach RAYNSIS Inspector your project's test command:
{
"rules": [
{"id": "reply.tests-pass-needs-run", "needs_turn+": "make verify|scripts/ci\\.sh"}
],
"disable": ["tool.no-package-publish"]
}
A new rule:
{
"rules": [
{
"id": "tool.no-prod-db",
"event": "tool",
"action": "deny",
"tools": ["Bash"],
"field": "command",
"pattern": "psql\\s+.*prod",
"message": "Production data is read through the replica.",
"examples": {
"hit": [{"tool": "Bash", "input": {"command": "psql -h prod-db -c 'delete from users'"}}],
"miss": [{"tool": "Bash", "input": {"command": "psql -h replica -c 'select 1'"}}]
}
}
]
}
| field | meaning |
|---|---|
id, message |
required; the message is what the agent (deny) or the human (warn) reads |
event |
tool or reply |
action |
deny, ask (tool rules: a permission prompt for the human) or warn |
tools |
tool names the rule applies to (tool rules; default all) |
tool_pattern |
regex on the tool name, for tool families such as MCP servers (^mcp__) |
field |
input field or list of fields to match (tool rules; default the whole input as JSON) |
pattern, unless |
Python regexes |
needs_turn |
reply rules: the rule fires unless a tool call in this turn matches this regex |
needs_turn_tools |
reply rules: only calls of these tools count as evidence (default all) |
needs_turn_field |
reply rules: only these input fields of those calls are matched (default the whole input); the packaged test and build rules use command and prompt |
check |
urls_seen for the link rule; unless_url exempts links |
only_added |
tool rules: fire only when an edit adds a match |
examples |
hit and miss lists; raynsis-inspector test-rules fails a rule without a hit example |
Run raynsis-inspector test-rules after every change. An invalid rule is reported and skipped; the others keep working.
A project file can turn a packaged rule off or change it. When it does, RAYNSIS Inspector tells the human once per session which rules were weakened, so a cloned repository cannot quietly disarm the gates.
Environment variables, set by the human for the Claude Code process:
| variable | effect |
|---|---|
RAYNSIS_INSPECTOR_SHADOW=1 |
evaluate and log everything, print and block nothing |
RAYNSIS_INSPECTOR_DISABLE=rule.a,rule.b |
turn rules off for this process |
RAYNSIS_INSPECTOR_FAIL_CLOSED=1 |
deny tool calls while the engine is broken (default: allow, with a warning) |
RAYNSIS_INSPECTOR_HOME=/path |
where logs go (default .raynsis-inspector/ in the project) |
RAYNSIS_INSPECTOR_RULES=/a.json:/b.json |
extra rule files, loaded after the project file |
The agent cannot set these variables. The guardrail rules put its common ways of changing the rest to you as
a permission prompt: editing, moving or deleting .raynsis-inspector/, hook settings, hook scripts or installed
plugins, restoring them with git, and claude plugin disable or uninstall. The running engine and its packaged
rules count as guardrails too, wherever they are installed (a pip install, a plugin checkout): Edit and Write on
them ask you first, and so does pip uninstall raynsis-inspector. The shell rules read command text, so an interpreter
one-liner that writes the file is not caught (see Known gaps).
If you maintain your own hooks
Many setups keep their own hooks in ~/.claude/hooks/ and change settings.json with the agent's help.
RAYNSIS Inspector does not stop that: each such edit shows a permission prompt, and you approve the ones you asked for.
In bypassPermissions mode there is no prompt to show (see "Guardrail rules ask" above), so there the edit is
denied with a note: switch modes with Shift+Tab, or use one of the choices below.
Two other choices, both set by you outside the session:
-
A hard block, no prompt. Put this in a file and name it in
RAYNSIS_INSPECTOR_RULES:{"rules": [{"id": "tool.guardrails-read-only", "action": "deny"}, {"id": "tool.guardrails-read-only-shell", "action": "deny"}, {"id": "tool.guardrails-read-only-mcp", "action": "deny"}]}
-
No guardrail rules at all.
RAYNSIS_INSPECTOR_DISABLE=tool.guardrails-read-only,tool.guardrails-read-only-shell,tool.guardrails-read-only-mcp. The other rules keep working.
failure.json (the warning throttle) lives in the project, so nothing in it is trusted: a file shipped with
a cloned repository can add a warning, never silence one.
Audit and stats
.raynsis-inspector/audit.jsonl one line per hit, engine error or invalid rule
.raynsis-inspector/evals.jsonl one line per evaluation: which rules were checked, which fired
raynsis-inspector stats checked / raw / unique hits per rule (--window 600)
--exclude-session PREFIX leave out sessions whose id starts with PREFIX (repeatable)
--since DAYS only the last DAYS days
raynsis-inspector doctor install, rules and log health
.raynsis-inspector/ gets its own .gitignore for the logs; rules.json stays committable.
The rule at the top of stats is where your agent cuts corners most. Sessions in which you try the
rules out fire them on purpose and will lead the table: in our own log, 128 of 144 hit lines came from
five sessions that were testing the rules. Leave those out with --exclude-session before you read it.
Shadow mode first. Run RAYNSIS_INSPECTOR_SHADOW=1 for a week next to your current setup, read raynsis-inspector stats,
then turn enforcement on.
Where it comes from
RAYNSIS Inspector is extracted from the governance layer we run on our own agent fleet. Between 19 September and 17 November 2026 that engine recorded, across 1,690 agent sessions, 4,298 unique rule events (same session and rule within 10 minutes counted once; 3,888 to 4,505 depending on the window): 958 tool calls stopped and 3,340 replies sent back for correction. 345 of them were risky attempts (spending credits, deleting, reading secrets, sending outside, touching live systems), 1,139 were accuracy problems, 2,814 were format.
Before release we measured false alarms on real traffic:
- Replay. The rules, replayed over the last 30 days of our sessions (399 transcripts). The first
replay (17 rules; 4,962 shell commands, 615 file edits, 502 reply endings) gave 17 hits. Reading each
one: five were the first reply after a context compaction, judged without the evidence from before it;
one was a conditional
skipTestin a brand-new test file; the rest were rule test text inside commands. After the fixes above ("unknown is not missing",only_added) and four rounds of an independent pre-release audit, the final replay of all 18 rules over the 383 latest transcripts (our own deliberate test sessions left out; 2,319 shell commands, 192 file edits, 410 reply endings) gave 2 hits. One was right: a link in a reply that never appeared in its session. One was a false alarm: a heredoc that only mentioned a*.envfile name (the mention gap under Known gaps). The audit fixes changed no result on this traffic: the rules before and after them gave the same two hits. - 0.2.2 security pass. A source review of the engine and every rule, each candidate checked with a
local probe before it counted. Fixed:
npm publish --dry-run=falseandgh release create -n "notes"were excused as dry runs; shell rules did not apply to theMonitortool, which also runs a command;rm ~ -rf,find ~ -deleteand PowerShellRemove-Item -Recurse ~passed the home-directory rule; a plantedfailure.jsoncould silence the engine-error warning. See the changelog for the full list. - 0.2.1 replay. The two test-deletion rules added in 0.2.1, replayed over the 398 latest transcripts (2,797 shell commands, 269 file edits): 0 hits, so no false alarm on our traffic and no agent caught deleting a test in it either.
- Shadow run. 24 hours on live sessions, 6,735 evaluations, two hits, both false alarms, both fixed:
a
>inside a quoted grep pattern read as a redirect, and a project test script not recognised as a test command (now configurable withneeds_turn+). - End to end. Claude Code 2.1.327 with the plugin loaded: a
.envread denied, an unproven "All tests pass." sent back and corrected, the same claim from a subagent sent back and corrected, a skip added to a test warned.
Our fleet already runs about 228 stricter house rules, so few violations reach these rules. Read the numbers as a false-alarm measurement, not a catch rate.
Two lessons shaped the code:
- A gate that fails silently is worse than no gate. On 4 November a rule missing one field crashed our engine about 900 times in nine hours; it failed open and nobody saw it. RAYNSIS Inspector skips an invalid rule instead of dying, and an engine error is printed on screen (at most every 10 minutes) and logged.
- Hits without a denominator prove nothing. Our old log only wrote hits, so it cannot show a
before/after rate. RAYNSIS Inspector writes every evaluation to
evals.jsonl, soraynsis-inspector statscan.
Known gaps
- Rules are regexes, not understanding. The reply rules know common English and Turkish phrasings, not all of them ("Everything passes now", "I ran the tests and they all pass" and "No type errors." are not recognised). Quoted speech after a colon ("You wrote: All tests pass") and a sentence that defines a result ("A green badge means all tests pass") are read as claims.
- Tool rules read the command text. A command that only mentions a dangerous string can trip them
(a heredoc of notes that says "never run rm -rf ~"), and a determined agent can hide one (
eval, encoding, a script file, a glob or a variable such ascat .en?orrm -rf $d,python -c "open('.claude/settings.json', 'w')"). Publishing through a wrapper we do not list (npx np) is not caught, and a command that deletes a whole tree by design (git clean -fdx) also deletes.raynsis-inspector/logs. Deploy tools (vercel --prod,terraform apply,kubectl apply),git push --deleteand dumping the environment (env,printenv) are outside the packaged rules: add a project rule if you need them. Shell rules name the tools they read (Bash,PowerShell,Monitor); a new tool that runs commands is not covered until it is listed. The rules catch mistakes; they are not a sandbox. Run untrusted code in a real sandbox. - Evidence means a matching tool call ran in this turn, not that it succeeded: a failing
pytestrun still counts as "ran". The agent still has to report the result honestly. A subagent whose prompt mentions tests counts as a test run, and so does an inline script that only names a test file (python3 -c "print(open('tests/a.py').read())"); RAYNSIS Inspector does not read what the subagent did. - A link the agent typed into a shell command counts as seen, and so does a link it tried to fetch even if the fetch failed.
- Windows: hooks run through Git Bash, Claude Code's default hook shell on Windows. The launcher (
hooks/run.sh) skips the Microsoft Storepython3shortcut and usespythonorpy -3; the first live Windows report (0.2.4, a python.org install) was that shortcut. The fix is tested in CI under Git Bash on Python 3.9 to 3.14 and was confirmed on that machine with 0.2.5:python3is only the shortcut there, the hook ran throughpythonand wrote its audit row, and no hook error appeared. Without Git for Windows, Claude Code runs hooks in PowerShell, which cannot run the launcher, and a failedPreToolUsehook then blocks the call: install Git for Windows first.
Contributing
Bug reports with the exact input that misfired are the most useful thing you can send: see CONTRIBUTING.md. Security issues: SECURITY.md.
License
Apache-2.0, see LICENSE and NOTICE. Made by RAYNSIS AI Workforce.
Metadata
Release files for raynsis-inspector 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| raynsis_inspector-0.3.0.tar.gz | 77.9 kB | Without provenance | Details for raynsis_inspector-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| raynsis_inspector-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for raynsis_inspector-0.3.0-py3-none-any.whl |
Total release size: 132.9 kB
Release files / raynsis_inspector-0.3.0.tar.gz
| Download URL | raynsis_inspector-0.3.0.tar.gz |
|---|---|
| Size | 77.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81c2ad7c2974108f3e7888d3064c90ef2f26449f9071c79d43bd4d16a01cc7d8
|
|
BLAKE2b-256 checksum How to use checksums |
d6e06c9944e719ae3db722938991ef6b921bb19123b5f82ddc91b5f86fef903f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / raynsis_inspector-0.3.0-py3-none-any.whl
| Download URL | raynsis_inspector-0.3.0-py3-none-any.whl |
|---|---|
| Size | 55.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8c6eed8383e3ec43241e1cfda70bda3611135f41ad7002d5ad680f860de11f0
|
|
BLAKE2b-256 checksum How to use checksums |
cb8a0f7a4d3eda11d40855fa2ada7cc21dc15dcdb3684f238a4718a0138f6a29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for raynsis-inspector 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.