brain-ingest-gate
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
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
$ npx -y skills add garrytan/gbrain --skill data-loss-gate --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/data-loss-gateContext preview
The summary Claude sees to decide when to auto-load this skill.
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
name: data-loss-gate version: 1.0.0 description: > 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. triggers: - "bulk delete" - "wipe the" - "rm -rf" - "purge the" - "truncate" - "free up space" - "bulk forget" - "remove the source" - "drop the table" mutating: true writes_pages: true writes_to: - daily/ upstream: data-loss-gate@fc834ee # Brain-first applies in its inspection form: before deleting brain pages, # check backlinks / graph dependencies (get_backlinks, graph) so the card's # "what we'd lose" section is grounded in the actual target, not guesses. brain_first: true
> **Convention:** see [conventions/brain-first.md](../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](../_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:
Brain / database level (gbrain-specific):
facts. One forget is a considered, idempotent act; a forget sweep is data loss.
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.
the point of no return for the soft-delete safety net.
every page in it. The `--confirm-destructive` flag does not substitute for the card.
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.
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](../ask-user/SKILL.md) choice-gate pattern — this skill supplies the card content and the explicit-yes strictness; ask-user supplies the stop-and-wait discipline.
After confirmation:
1. Log what was deleted to `daily/notes/YYYY-MM-DD.md` under `## Data Deletions` 2. Include: timestamp, what, count, size, recovery path 3. If the deletion is large (>1GB or >1000 files/pages), do it in chunks with progress updates
##
Give the agent you already use a memory you control. GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents.
Repo: garrytan/gbrain
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
When you report a brain page to the user — created, edited, committed, or relayed from a subagent — a working link is part of the deliverable, in the SAME…
Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking.…
Deduplicate and synthesize raw concept stubs into a tiered intellectual map (T1 Canon to T4 Riff), tracing idea evolution across sources over time. Transforms…
Token-hygiene audit of the always-loaded context stack — CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md,…
When the user corrects a factual error, root-cause it immediately. Don't just note the correction — trace the error to its source, fix the source, and prevent…