Delete by id, never by filter, and build the id list from what you were asked to remove or from what you created yourself, at the moment you created it. We learned that rule three times before the end of September 2026, on three different things. One of the three cost 586 profiles that never came back.

A search for "probe" took a profile called "asd"

After a round of measurements we had a pile of test profiles, all with "probe" in the name. The tidy-up looked like this:

const l = await ipc('profiles.list', { search: 'probe', limit: 50 })
for (const r of l.ok.rows) { /* delete, then purge */ }

It purged five profiles that were not ours to purge. One was called asd, a name with no part of the word "probe" in it. Mosaic's profile search matches more than the name; the search box says "Search name, note or tag", and a note or a tag had matched.

The rule was already written down: delete by id. It had been read as a rule about the absence of a scope. It is about anything that is not an id. A search string looks precise and is a pattern match over fields nobody enumerated, and purging is irreversible.

All five came back, and only because a purge takes a safety snapshot of the library before it destroys anything. We restored them by id from the snapshot taken that morning. A sixth, lost to the same search in an earlier call, turned up when we previewed the snapshot against the live library: the preview's missing list is exactly "in the snapshot, not here now".

Everything the window does, from a script on your own computerIn Mosaic: REST API. Everything the window does, from your own scripts. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: REST API

An empty body purged 586 profiles

The one that did not come back happened earlier, and it was four words in a check script. The script creates test fixtures and removes them, and a new block ended:

await call('DELETE', `/profiles/${id}`)
await call('POST', '/trash/empty', {})     // meant "tidy up after myself"

POST /trash/empty with no body was documented as emptying the whole trash, and it did exactly that. The route, its validator and its docs were all correct. The fault was the default: whoever wrote the script read "empty the trash" as "empty the trash I filled". At that point purging deleted folders outright, there were no backups, and the machine had no local Time Machine snapshots. 586 profiles were gone.

Four changes followed, and only the last one really holds:

  • The script purges by id, with DELETE /trash/profiles/<id>.
  • An empty body on POST /trash/empty is a 400 now. You name a projectId, an os list, or send {"all": true}. That is one word longer to type and impossible to type by accident.
  • The MCP tool empty_trash refuses the same way, because a model that leaves out every argument would otherwise have emptied everything.
  • store.emptyTrash has no default and throws. That is the method every door goes through, including the window's own IPC, so it is the one place the rule cannot be skipped.

We proved it by making the call that caused it:

POST /trash/empty {}          400  "...it will not guess how much you meant."
POST /trash/empty {all:true}  200  {"purged": 3}
empty_trash, no arguments     Error: ...Name a projectId, an os list, or all: true.

On an update, an absent field means "leave it alone". On a route that destroys data, absent has to mean "refuse", never "everything".

A loop revoked a key nobody named

On 20 September we were asked to revoke six API keys named "engine measurement". The loop went over apiKeys.list() and revoked every row it returned. One of those rows was called Arche and belonged to the operator's own tool. Key secrets are stored hashed, so it could not be given back, only replaced and reconfigured by hand.

Mosaic API keys, each named after what uses it
One key per tool, so one can be revoked alone

The instruction named a set; the code took the whole collection. The correct loop differs by one filter:

for (const k of keys.filter((k) => k.name === 'engine measurement'))

A listing is a superset of the target by definition. Iterating it unfiltered is a decision to act on everything, written as if it were a decision to act on something. Ten minutes earlier in the same session, two other keys had been revoked correctly, by id, one call each. The habit did not carry over, because the written rule lived under a heading about profiles and this was keys.

Delete by id, not by filter: what we do now

  • Collect ids when you create the thing, and delete only those. Do not re-derive the set from a query later.
  • Before an irreversible loop, print what it is about to act on, by name, with a count. The window does this for free: revoking a key shows its name beside the button. A script shows nothing until it is done.
  • Make the wide version of a destructive route ask for itself by name. {"all": true} is a sentence; {} is not.
  • Keep a way back. The safety snapshot is why the first story is a near miss and the second is a loss.

Purging itself is quicker now too; emptying the trash used to stop the whole application. The routes involved are in the local REST API, and the same refusals hold on the MCP server. Trashing, as opposed to purging, closes the profile's browser first, as trashing a profile closes its browser explains.