data-loss-gate

data-loss-gate is a skill for Claude Code, Codex from garrytan/gbrain. It costs 89 tokens per session (2,560 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 CodeCodex

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

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 · 29,591 stars · on GitHub

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.

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

Made for: Claude Code, Codex.

Or install gbrain-coding, the plugin that ships this one along with the rest of its 20 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.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.svg" alt="Measured on agentmods" 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 2,560 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
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 $0.00089 $0.02560
Opus 5 $0.00044 $0.01280
Sonnet 5 $0.00018 $0.00512
Haiku 4.5 $0.00009 $0.00256

Measured 5d ago against content hash 95ed4cf41dee, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 5d 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 · 242 lines

How it starts

The opening of the file, as written. The whole thing — 242 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 sweepsgbrain 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 purge-deleted — permanently removes soft-deleted pages. This is the point of no return for the soft-delete safety net.
  • Source removalgbrain sources remove <id> deletes the source AND every page in it. The --confirm-destructive flag does not substitute for the card.
  • Mount removalgbrain 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 · 242 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. 5d 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 (29,591 stars, last pushed yesterday), licensed MIT. It adds 89 tokens to every session and 2,560 once invoked, about $0.0004 per session on Opus 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

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

chronicle

Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…

microsoft/vscode · 72 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens