data-loss-gate
What it does
This skill sets a confirmation step before the AI agent runs destructive operations on files or the knowledge brain. It is for anyone who wants a safety check before large deletions.
When to use it
- βWhen your agent is about to run a bulk delete or a command like rm -rf.
- βWhen a cleanup would remove many brain pages or a whole data source.
- βWhen an operation cannot be undone and you want to see what will be lost first.
Skill link
https://github.com/garrytan/gbrain/blob/master/plugin-variants/gbrain-coding/skills/data-loss-gate/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βClean up all the old draft files in this folder, but show me what will be deleted first.β
5 new skills a week. 1 minute to read.
How it works
The agent inspects the targets, shows a recoverability summary of what would be lost, and waits for your explicit yes before proceeding.
Technical content (original SKILL.md)
Original text by the author, straight from 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 logon 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 -rfon any directory with datarm/unlinkon more than 10 filessed -ithat modifies more than 10 filesgit rmon 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 sweepsdelete_pageacross a set of slugs. Deletes are soft (recoverable viagbrain 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 restorecannot 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 parallelxargsor a background loop), confirm each one is gone (gbrain get <slug> --include-deletedreportspage_not_found) 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 usergbrain pages purge-deleted --dry-run --jsonfirst; the command itself asks (exit 3 without a terminal) and runs with--yesonly after the user agrees.- Source removal β
gbrain sources remove <id>deletes the source AND every page in it. The--confirm-destructiveflag does not substitute for the card. - 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, orDELETEwithout a narrowWHEREagainst the brain database, via any path (psql, a migration script, an engineexecuteRawcall). - Deleting database rows in bulk; dropping tables, collections, or indexes.
What To Do
Step 1: STOP before executing
Do NOT run the destructive command. Inspect the actual target first (backlinks, graph edges, git history, file contents β whatever grounds the card), then present the user with:
Step 2: The Confirmation Card
β οΈ DATA DELETION β Confirmation Required
What: [exactly what will be deleted/modified]
Count: [number of files/rows/pages/facts affected]
Size: [how much
FAQ
Is it a hard technical block?
The skill says it is a routing convention that a well-behaved agent follows, not an enforced lock.
What does it check before asking?
It inspects the actual targets, such as backlinks and git history, so the summary is accurate.
Where are deletion logs kept?
The skill says deletion logs are filed by date under the daily folder after confirmation.
Details
Original description by the author
Confirmation gate before any bulk delete, cleanup, or destructive operation that could result in data loss β shell-level (rm -rf, git rm, bulk sed) or brain-level (bulk forget, delete sweeps, purge-deleted, source removal, raw-SQL truncation). Presents a recoverability card and requires an explicit "yes" from the user before proceeding. Routing convention, not an operation-boundary enforcement.
repo: garrytan/gbrain
Popularity
- GitHub stars
- 31k
- Ranking position
- #9254
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
gbrain
31kLets your agent search a shared company knowledge brain for facts about people, projects and decisions, and save durable notes to it.
brain-ingest-gate
31kChecks new content against an existing knowledge brain before it is added, to avoid duplicates and resolve named entities first.
brain-link-discipline
31kMakes sure your agent includes a working link to each brain page it reports, in the same message, so you can open it right away.
brain-ops
31kGives your agent the core routine for a knowledge brain: check existing context first, save explicit notes with their source, and link related pages.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.