cli-write-safety

cli-write-safety is a cursor rule for Cursor from CiscoDevNet/essentials. It costs 1,053 tokens per session, scanned A, original, Apache-2.0.

A command-line safety rule for tools that change or delete local or remote data. It requires a preview mode, confirmation by default, and a `--yes` option to skip confirmation.

In plain words
What is it for?
Use it when building command-line tools that modify files, services, accounts, environments, or other state.
Why use it?
It reduces accidental writes, deletions, and credential changes by making the intended changes visible before they happen.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when building command-line tools that modify files, services, accounts, environments, or other state.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ciscodevnet/essentials/cli-write-safety
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/CiscoDevNet/essentials

Made for: Cursor.

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 cli-write-safety

README.md
[![agentmods](https://agentmods.dev/badge/rules/ciscodevnet/essentials/cli-write-safety/github.svg)](https://agentmods.dev/rules/ciscodevnet/essentials/cli-write-safety)
Your own site
<a href="https://agentmods.dev/rules/ciscodevnet/essentials/cli-write-safety"><img src="https://agentmods.dev/badge/rules/ciscodevnet/essentials/cli-write-safety/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 cli-write-safety

Your own site · 80×15
<a href="https://agentmods.dev/rules/ciscodevnet/essentials/cli-write-safety"><img src="https://agentmods.dev/badge/rules/ciscodevnet/essentials/cli-write-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,053 This file is loaded in full into every session.
When invoked 1,053 The same file — it is already loaded in full.
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.01053 $0.01053
Opus 5.5 $0.00421 $0.00421
Sonnet 5.5 $0.00211 $0.00211
Haiku 4.5 $0.00105 $0.00105

Measured 21d ago against content hash 20ce9f62dffe, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cli-write-safety 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 21d 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.

.cursor/rules/cli-write-safety.mdc · 100 lines

How it starts

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

CLI Write Safety

Applies to every command-line tool produced in this repo, whatever the language or argument parser: Click groups, argparse scripts under tools/, Django management commands, TypeScript bin entries, and shell scripts.

The three requirements

Any command that writes remote or local state, deletes, rotates a credential, or is otherwise not trivially reversible must have all three:

  1. --dry-run — runs the same code path, prints exactly what would change, exits 0, and touches nothing. It is not a separate "plan" branch that can drift from the real one; resolve the same targets and build the same payloads, then stop before the write.
  2. Confirmation by default — print a summary of what is about to happen (counts, target names, account/stack/environment), then prompt. Abort on anything but yes.
  3. --yes (alias -y) — bypasses the prompt, and nothing else. It must never imply or cancel --dry-run.

Use these exact flag names

--dry-run and --yes. Do not invent --apply, --submit, --commit, --force, --no-confirm, or --for-real.

Opt-in-to-write flags look safe but are not: they make the safe path the one the operator has to remember, and every tool picks a different word for it, so muscle memory from one tool does nothing for the next. Prompting by default gives the same protection without depending on recall.

Precedence and non-interactive runs

  • --dry-run wins if both flags are passed.
  • When a real write would occur, never silently proceed without explicit consent. Without a TTY, or in --json mode, fail and tell the operator to pass --yes. --dry-run skips this check because nothing is written.

Read-only commands

Must not prompt, and must not offer --dry-run — there is nothing to preview.

Where the flags live

Put --dry-run on the group when it governs every subcommand, and --yes on each write command. keys delete in packages/python/ess-langsmith-client/src/ess_langsmith_client/tools/keys.py shows the confirmation half: it lists the keys it will delete, prompts by default, and accepts --yes. It does not yet offer --dry-run, and its prompt goes to stdout; do not copy those two gaps. The complete shape:

Read the full file on GitHub · 100 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. 21d ago First seen · 100 lines · 1,053 tokens per session scan A 20ce9f62dffe

Subscribe to this mod's changes

cli-write-safety is a cursor rule published in the GitHub repository CiscoDevNet/essentials (7 stars, last pushed 10d ago), licensed Apache-2.0. It adds 1,053 tokens to every session, about $0.0042 per session on Opus 5.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-09-25.