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.
89%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
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/.
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.
Before ANY of these operations:
Shell / filesystem level:
rm -rf on any directory with datarm / unlink on more than 10 filessed -i that modifies more than 10 filesgit rm on tracked filesBrain / database level (gbrain-specific):
gbrain forget <fact-id> over many
facts. One forget is a considered, idempotent act; a forget sweep is data loss.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) 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.gbrain sources remove <id> deletes the source AND
every page in it. The --confirm-destructive flag does not substitute for
the card.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.DROP TABLE, TRUNCATE, or DELETE without a
narrow WHERE against the brain database, via any path (psql, a migration
script, an engine executeRaw call).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:
⚠️ DATA DELETION — Confirmation Required
What: [exactly what will be deleted/modified]
Count: [number of files/rows/pages/facts affected]
Size: [how much data will be removed]
Location: [exact paths, slugs, or source/mount ids]
Why: [the reason for the deletion]
Recoverable?
- [ ] Backed up to a remote (git remote, database backup, object storage)
- [ ] In git history (can git checkout)
- [ ] Soft-deleted in the brain (restorable via `gbrain restore` until purged)
- [ ] Re-fetchable from an upstream source (which one, how long)
- [ ] NOT recoverable — permanent data loss
What we'd lose:
- [specific data/capability that would be gone]
- [any downstream systems that depend on this data]
Alternative to deletion:
- [compress instead of delete?]
- [move to cold storage?]
- [archive to a remote backup?]
- [soft-delete and defer the purge?]
Proceed? (yes/no)For the mechanics of presenting the gate and stopping the turn, use the ask-user choice-gate pattern — this skill supplies the card content and the explicit-yes strictness; ask-user supplies the stop-and-wait discipline.
After confirmation:
daily/notes/YYYY-MM-DD.md under ## Data DeletionsThere are no categories of data that are disposable by default. Old logs, git stash entries, build artifacts, caches — each of these has, at some point, been the source of truth for something. Disposability is a property of the SPECIFIC target, verified by inspecting it (backlinks, git status, what depends on it, whether it's re-fetchable and at what cost) — never a property of its category. If the inspection genuinely shows the target is ephemeral and regenerable, the card is quick to fill out and the user's "yes" is quick to get. That's the cost of the gate working.
A downstream agent once deleted a multi-gigabyte cache of raw source files from its brain's data directory to free disk space. The files looked like "just cache" — but they were the source data for a planned feature. The data happened to be re-fetchable from its upstream source, but the deletion was still wrong because:
The rule: if it's data and it's bulk, ASK FIRST. Always.
Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:
confirmation_required) or asks for --confirm-destructive: that flag confirms the agent is sure, not the user. Show the recoverability card and wait for the user's explicit yes.gbrain pages purge-deleted removes soft-deleted pages for good, so gbrain restore cannot bring them back afterwards: say so on the card. Never promise physical erasure or a recovery you cannot verify.write_pending (exit 10): it was accepted and is still pending, so it may still commit. It is not "not found" or "failed": poll the receipt (gbrain write-request <request_id>) before writing the deletion log entry, and never re-run the deletion or move to a wider one because of it.This skill guarantees:
daily/notes/YYYY-MM-DD.md under
## Data Deletions with timestamp, scope, and recovery path.writes_to:.The full behavior contract is documented in the body sections above; this section exists for the conformance test.
Two artifacts:
daily/notes/YYYY-MM-DD.md:## Data Deletions
- **[HH:MM]** [what was deleted] — [count], [size]. Reason: [why].
Recovery: [backup/git/restore path, or "none — permanent"].garrytan/gbrain
a89a5ad
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.