set-custom-rules

set-custom-rules is a command for Claude Code from waleedkhanbaloch/claude-code-safety-net. It costs 6 tokens per session (724 once invoked), scanned A, original, MIT.

A guided command for configuring custom blocking rules in claude-code-safety-net. Rules can apply to all projects for a user or only to the current project.

In plain words
What is it for?
Use it to choose a configuration scope, describe commands to block, and create rules such as preventing blanket Git staging or global package installs.
Why use it?
It helps turn plain-language restrictions into the JSON configuration that Safety Net uses to block risky commands.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Part of the safety-net plugin — 2 commands, 1 hook shipped together

Good fit Use it to choose a configuration scope, describe commands to block, and create rules such as preventing blanket Git staging or global package installs.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/waleedkhanbaloch/claude-code-safety-net/set-custom-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/waleedkhanbaloch/claude-code-safety-net

Made for: Claude Code.

Or install safety-net, the plugin that ships this one along with the rest of its 2 commands, 1 hook.

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 set-custom-rules

README.md
[![agentmods](https://agentmods.dev/badge/commands/waleedkhanbaloch/claude-code-safety-net/set-custom-rules.svg)](https://agentmods.dev/commands/waleedkhanbaloch/claude-code-safety-net/set-custom-rules)
Your own site
<a href="https://agentmods.dev/commands/waleedkhanbaloch/claude-code-safety-net/set-custom-rules"><img src="https://agentmods.dev/badge/commands/waleedkhanbaloch/claude-code-safety-net/set-custom-rules.svg" alt="Measured on agentmods" height="20"></a>
Per session 6 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00006 $0.00724
Opus 5 $0.00003 $0.00362
Sonnet 5 $0.00001 $0.00145
Haiku 4.5 $0.00001 $0.00072

Measured 8d ago against content hash f0abe1bd448a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

set-custom-rules scanned grade A with 0 findings 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 8d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/set-custom-rules.md · 133 lines

How it starts

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

You are helping the user configure custom blocking rules for claude-code-safety-net.

Context

Schema Documentation

!npx -y cc-safety-net --custom-rules-doc

Your Task

Follow this flow exactly:

Step 1: Ask for Scope

Use AskUserQuestion to let user select scope:

{
  "questions": [
    {
      "question": "Which scope would you like to configure?",
      "header": "Configure",
      "multiSelect": false,
      "options": [
        {
          "label": "User",
          "description": "(`~/.cc-safety-net/config.json`) - applies to all your projects"
        },
        {
          "label": "Project",
          "description": "(`.safety-net.json`) - applies only to this project"
        }
      ]
    }
  ]
}

Step 2: Show Examples and Ask for Rules

Show examples in natural language:

  • "Block git add -A and git add . to prevent blanket staging"
  • "Block npm install -g to prevent global package installs"
  • "Block docker system prune to prevent accidental cleanup"

Ask the user to describe rules in natural language. They can list multiple.

Step 3: Generate and Show JSON Config

Parse user input and generate valid schema JSON using the schema documentation above.

Then show the generated config JSON to the user.

Step 4: Ask for Confirmation

Use AskUserQuestion to let user choose:

{
  "questions": [
    {
      "question": "Does this look correct?",
      "header": "Confirmation",
      "multiSelect": false,
      "options": [
        {
          "label": "Yes",
        },
        {
          "label": "No",
        }
      ]
    }
  ]
}

Step 5: Check and Handle Existing Config

  1. Check existing User Config with cat ~/.cc-safety-net/config.json 2>/dev/null || echo "No user config found"
  2. Check existing Project Config with cat .safety-net.json 2>/dev/null || echo "No project config found"

If the chosen scope already has a config:

Show the existing config to the user. Use AskUserQuestion tool to let user choose:

{
"questions": [
    {
    "question": "The chosen scope already has a config. What would you like to do?",
    "header": "Configure",
    "multiSelect": false,
    "options": [
        {
        "label": "Merge",
        },
        {
        "label": "Replace",
        }
    ]
    }
]
}

Read the full file on GitHub · 133 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. 8d ago First seen · 133 lines · 6 tokens per session scan A f0abe1bd448a

Subscribe to this mod's changes

set-custom-rules is a command published in the GitHub repository waleedkhanbaloch/claude-code-safety-net (2 stars, last pushed today), licensed MIT. It adds 6 tokens to every session and 724 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.