Deleting prompts locally

mask-delete lets you remove prompts (queries or models) from your local .mask/ data files and regenerate the compiled modules — without calling Mask Databases. This is useful when you want to clean up old, unused, or test prompts from your local environment.

Local only. This command modifies your local .mask/ data. It does not delete anything from Mask Databases — use the project dashboard for server-side deletions.

Availability

mask-delete ships with the Mask package. If you already have node mask.compile.cjs, mask-sync-push, and mask-sync-fetch you also have mask-delete. Run it from your project root (the directory containing mask.compile.cjs and .mask/).

Quick reference

CommandDescription
npx mask-deleteOpen the interactive shell
npx mask-delete --listList all prompts with their hashes
npx mask-delete --hash <hash>Delete prompt(s) by hash
npx mask-delete --prompt "<text>"Delete a prompt by its full text

Listing prompts

Before deleting, list all compiled prompts to find the hash or text you want to remove:

$ npx mask-delete --list

  Queries (3):
    [07ce3627]  insert a new user with name, email, age and status.
    [c345f113]  fetch all users
    [5908318d]  insert a new user with name, password.

  Models (1):
    [81085c2e]  User model. Collection users. Fields: name (string), password (stri...

Each line shows [hash] followed by the prompt text (truncated to 70 characters). Both query and model prompts are listed.

Delete by hash

Pass the 8-character hash shown in --list output:

$ npx mask-delete --hash 07ce3627

[Mask] Deleted 1 prompt(s) for hash "07ce3627". Generated files updated.

If multiple prompts resolve to the same hash (rare), all of them are removed. The associated data is cleaned up and the generated code is rebuilt automatically.

Delete by prompt text

Pass the full prompt text in quotes:

$ npx mask-delete --prompt "insert a new user with name, email, age and status."

[Mask] Deleted 1 prompt(s). Generated files updated.

The text must match exactly as it was used in your code with MaskDatabase.prompt() or MaskModels.define().

Interactive shell

Run mask-delete with no arguments to open a REPL (similar to mongosh or php artisan tinker):

$ npx mask-delete

  Mask interactive shell — manage local prompts
  Commands: list, delete <hash>, delete-prompt "<text>", help, exit

mask> list

  Queries (3):
    [07ce3627]  insert a new user with name, email, age and status.
    [c345f113]  fetch all users
    [5908318d]  insert a new user with name, password.

  Models (1):
    [81085c2e]  User model. Collection users. Fields: ...

mask> delete 07ce3627
  Deleted 1 prompt(s) for hash "07ce3627". Generated files updated.

mask> delete-prompt "fetch all users"
  Deleted 1 prompt(s). Generated files updated.

mask> exit
[Mask] Bye.
Shell commandDescription
list or lsList all prompts with hashes
delete <hash>Delete by hash
delete-prompt "<text>"Delete by prompt text
help or ?Show available commands
exit or quitClose the shell

What gets deleted

When a prompt is deleted, the following happens automatically:

  1. The prompt and its associated compiled data are removed from local files.
  2. If the prompt had failed or was flagged for review, those entries are cleaned up too.
  3. The generated query and model code is rebuilt from the remaining data — the deleted prompt's code is no longer in the output.

No network calls are made. Everything happens locally using your compiled .mask/ data (from your last node mask.compile.cjs run).

Interaction with sync

mask-delete only touches local data:

  • With sync enabled (syncApiKey set) — only your local data is modified. Server data is unchanged. A subsequent mask-sync-push will not re-push deleted prompts.
  • Without sync — local data files are modified directly.

If a teammate has already pushed the prompt you delete locally, it will still exist on Mask Databases. Running mask-sync-fetch will bring it back. To permanently remove it from the server, use the project dashboard on Mask Databases.

Example workflow

# 1. See what you have
npx mask-delete --list

# 2. Delete a test prompt you no longer need
npx mask-delete --hash 5908318d

# 3. Verify it is gone
npx mask-delete --list

# 4. Or use the interactive shell for multiple deletions
npx mask-delete
mask> delete 07ce3627
mask> delete-prompt "fetch all users"
mask> list
mask> exit