railguard: Instructions file for Claude Code

CLAUDE.md

railguard CLAUDE.md is an instructions file for Claude Code from railyard-dev/railguard. It costs 627 tokens per session, scanned B, original, MIT.

Session instructions for Railguard, a tool that checks coding-agent actions, records them, and saves copies of edited files.

In plain words
What is it for?
Use them when a command is denied, approval is requested, or you need session details, change comparisons, or a rollback.
Why use it?
They explain what blocked or approval-required commands mean and how to inspect or undo changes safely.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths.

This is railyard-dev/railguard's own configuration. It tells Claude Code how to work on railguard itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything railguard configures →

Reuse

Borrowing it

Nothing to install: this file belongs to railyard-dev/railguard. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/railyard-dev/railguard/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/railyard-dev/railguard

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for railguard CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/railyard-dev/railguard/claude-md/github.svg)](https://agentmods.dev/instructions/railyard-dev/railguard/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/railyard-dev/railguard/claude-md"><img src="https://agentmods.dev/badge/instructions/railyard-dev/railguard/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for railguard CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/railyard-dev/railguard/claude-md"><img src="https://agentmods.dev/badge/instructions/railyard-dev/railguard/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 627 This file is loaded in full into every session.
When invoked 627 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00627 $0.00627
Opus 5.5 $0.00251 $0.00251
Sonnet 5.5 $0.00125 $0.00125
Haiku 4.5 $0.00063 $0.00063

Measured 1mo ago against content hash 78ddb4ab9d67, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

railguard CLAUDE.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Modify `~/.claude/settings.json` — it will be blocked.
CLAUDE.md · 48 lines

How it starts

The opening of the file, as written. The whole thing — 48 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Railguard — Active Guardrails

Railguard is monitoring this session. Every tool call (Bash, Write, Edit, Read) passes through Railguard before execution.

What you need to know

  • Some commands will be blocked. If you see a "denied" response from a hook, it means Railguard blocked the command. Do NOT retry the same command — find a safer alternative.
  • Some commands require human approval. If you see an "ask" response, the human will be prompted to approve or deny.
  • File writes are snapshotted. Every Write/Edit you make is backed up before execution. The human can rollback any change.
  • Everything is logged. All tool calls and decisions are recorded in .railguard/traces/.

If something goes wrong

If the human asks you to undo changes, fix a mistake, or rollback:

  1. Get context first. Run: railguard context --session $SESSION_ID --verbose This shows you exactly what changed, diffs, blocked commands, and available rollback commands.

  2. Check what changed. Run: railguard diff --session $SESSION_ID Or for a specific file: railguard diff --session $SESSION_ID --file <path>

  3. Rollback options:

    • Undo the last edit: railguard rollback --session $SESSION_ID --steps 1
    • Undo the last N edits: railguard rollback --session $SESSION_ID --steps N
    • Restore a specific file: railguard rollback --session $SESSION_ID --file <path>
    • Restore everything: railguard rollback --session $SESSION_ID
    • Restore a specific snapshot: railguard rollback --session $SESSION_ID --id <snapshot-id>
  4. Find your session ID. Run: railguard log This lists all sessions. Pick the most recent one.

Configuring Railguard

You can help the user customize their Railguard policy. This is encouraged:

  • Read railguard.yaml to understand the current policy.
  • Propose edits to railguard.yaml — the user will be prompted to approve before any change is applied.
  • Run railguard init to generate a starter railguard.yaml if one doesn't exist (user approves).
  • Run railguard status to show the current protection state. All changes to Railguard policy require explicit human approval. You generate the change, the user reviews and accepts or rejects it. Changes take effect on the next tool call — no restart needed.

Read the full file on GitHub · 48 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 48 lines · 627 tokens per session scan B 78ddb4ab9d67

Subscribe to this mod's changes

railguard CLAUDE.md is an instructions file published in the GitHub repository railyard-dev/railguard (39 stars, last pushed 7mo ago), licensed MIT. It adds 627 tokens to every session, about $0.0025 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.