data-loss-gate

data-loss-gate is a skill for Claude Code from garrytan/gbrain. It costs 89 tokens per session (3,201 once invoked), scanned C, original, MIT.

A confirmation step before bulk deletion, cleanup, or another action that could permanently remove data.

In plain words
What is it for?
Use it before destructive shell, Git, brain, or database operations, such as deleting files, purging pages, or removing source data.
Why use it?
It makes the agent inspect the exact targets and explain what can be recovered before asking the user to approve the operation. It reduces accidental loss but is a convention, not a technical block on every delete.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter. Also seen: built for gbrain.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is **Convention:** see [conventions/brain-first.md](../conventions/brain-first.md) —.

Part of the gbrain-coding plugin — 21 skills shipped together

Good fit Use it before destructive shell, Git, brain, or database operations, such as deleting files, purging pages, or removing source data.

Compare 6 skills from other repositories ↓
About the project

GBrain is a memory and retrieval layer for AI agents that searches, connects, and synthesizes information from stored sources. It is used to give coding agents and autonomous agents access to knowledge beyond their current code, including shared company information with access controls. The catalogue add-ons help agents operate GBrain and connect it to agent workflows.

garrytan/gbrain · 33,897 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/garrytan/gbrain
agentmods
npx agentmods add skills/garrytan/gbrain/data-loss-gate

Made for: Claude Code.

Or install gbrain-coding, the plugin that ships this one along with the rest of its 21 skills.

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 data-loss-gate

README.md
[![agentmods](https://agentmods.dev/badge/skills/garrytan/gbrain/data-loss-gate/github.svg)](https://agentmods.dev/skills/garrytan/gbrain/data-loss-gate)
Your own site
<a href="https://agentmods.dev/skills/garrytan/gbrain/data-loss-gate"><img src="https://agentmods.dev/badge/skills/garrytan/gbrain/data-loss-gate/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 data-loss-gate

Your own site · 80×15
<a href="https://agentmods.dev/skills/garrytan/gbrain/data-loss-gate"><img src="https://agentmods.dev/badge/skills/garrytan/gbrain/data-loss-gate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,201 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00089 $0.03201
Opus 5.5 $0.00036 $0.01280
Sonnet 5.5 $0.00018 $0.00640
Haiku 4.5 $0.00009 $0.00320

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

Security

Grade C, and why

data-loss-gate scanned grade C 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 11d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

that could result in data loss — shell-level (rm -rf, git rm, bulk sed) or
plugin-variants/gbrain-coding/skills/data-loss-gate/SKILL.md · 267 lines

How it starts

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

Data Loss Gate — Confirmation Before Destructive Operations

Convention: see conventions/brain-first.md — inspect the actual target before proposing deletion: get_backlinks, gbrain graph <slug>, git log on the underlying files. The confirmation card below is only as good as the inspection behind it.

Convention: see _brain-filing-rules.md — the post-confirmation deletion log files date-keyed under daily/.

What This Is

A gate that fires BEFORE any destructive operation and requires explicit user confirmation. The agent stops, presents a recoverability card, and waits.

Scope honesty: this gate is a routing convention — the harness resolves it into context when a destructive intent matches, and a well-behaved agent follows it. It is NOT an operation-boundary enforcement: nothing in the gbrain runtime mechanically blocks a delete if the skill never loads. (A native confirm gate at the operation boundary is a filed TODO; until it lands, this convention is the line of defense.) Some CLI surfaces carry their own flag gates — e.g. gbrain sources remove requires --confirm-destructive — but the flag confirms that the AGENT is sure. This skill exists to confirm that the USER is.

When This Fires

Before ANY of these operations:

Shell / filesystem level:

  • rm -rf on any directory with data
  • rm / unlink on more than 10 files
  • sed -i that modifies more than 10 files
  • git rm on tracked files
  • Truncating or stripping content from files in bulk
  • Overwriting files with smaller versions (content stripping)
  • Any operation described as "cleanup" or "freeing space" that touches data files

Brain / database level (gbrain-specific):

  • Bulk forget — scripting or looping gbrain forget <fact-id> over many facts. One forget is a considered, idempotent act; a forget sweep is data loss.
  • Page-delete sweeps — gbrain delete <slug> in a loop, or any script that sweeps delete_page across a set of slugs. Deletes are soft (recoverable via gbrain restore <slug>) until purged — say so on the card, then gate anyway: a sweep that's wrong in bulk is expensive to un-wrong in bulk.
  • gbrain delete --purge — skips the 72-hour soft delete and removes the page at once with its chunks, versions, takes, timeline, links, raw data and the facts filed on it. gbrain restore cannot undo it. Every purge needs the user's explicit go for that purge: a request to "scrub the repo", "clean up the files" or "remove it from Git" is not a go to purge database pages. After the go, purge one page at a time (never a parallel xargs or a background loop), confirm each one is gone (gbrain get <slug> --include-deleted reports page_not_found; a receipt with purge_held was kept soft-deleted to keep its derived pages private) before the next, and stop the batch at the first refusal. A purge batch that was stopped (SIGTERM, a write freeze, a timeout) stays stopped: report what finished and ask again before relaunching it.
  • gbrain pages purge-deleted — permanently removes soft-deleted pages from every source of the brain. This is the point of no return for the soft-delete safety net. Show the user gbrain pages purge-deleted --dry-run --json first; the command itself asks (exit 3 without a terminal) and runs with --yes only after the user agrees. It keeps a file committed at the source's last synced commit or at HEAD (the page waits or goes database-only), unless a person's delete of the page never removed the file (e.g. another page shared it).
  • Source removal — gbrain sources remove <id> deletes the source AND every page in it. The --confirm-destructive flag does not substitute for the card. A managed removal deletes pages in committed batches: one that stops early (write_pending) has already deleted some, so say so and rerun it to finish.
  • Mount removal — gbrain mounts remove <id> only removes the local registration (the mounted brain's database survives; re-add to recover). Gate it anyway when the flow ALSO plans to delete the mount's underlying database or files — then the full card applies to those.
  • Raw-SQL truncation — any DROP TABLE, TRUNCATE, or DELETE without a narrow WHERE against the brain database, via any path (psql, a migration script, an engine executeRaw call).
  • Deleting database rows in bulk; dropping tables, collections, or indexes.

Read the full file on GitHub · 267 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago Changed · -3 lines 69bfc47a654c
  2. 20d ago Changed 224f68cbd502
  3. 24d ago Changed · +2 lines 84ee96295213
  4. 25d ago Changed · +2 lines da5db19bc6ae
  5. 1mo ago Changed · +12 lines fe4466c283ed
  6. 1mo ago Changed · +3 lines fde8d9a3a483
  7. 1mo ago Changed · +1 lines 9e10beb28b3c
  8. 2mo ago Changed · +8 lines 790407f6a91d
  9. 3mo ago First seen · 242 lines · 89 tokens per session scan C 95ed4cf41dee

Subscribe to this mod's changes

data-loss-gate is a skill published in the GitHub repository garrytan/gbrain (33,897 stars, last pushed today), licensed MIT. It adds 89 tokens to every session and 3,201 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

data-loss-gate compared with skills from other repositories

data-loss-gate next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
data-loss-gategarrytan/gbrainSkill34ktodayMITC89Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill82ktodayMITA200Claude Code, Codex
imagegenopenai/codexSkill137ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill102ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill396ktodayMITA36Claude Code
free-llm-apismnfst/awesome-free-llm-apisSkill15ktodayCC0-1.0A113Claude Code, Codex
systematic-debuggingobra/superpowersSkill333k7d agoMITA21Claude Code