{"version":"2.1.242","anchor":"artifact-write-db-accepts-a-batch-of-writes-under-one-approv","canonical_anchor":"artifact-write-db-accepts-a-batch-of-writes-under-one-approv","heading":"Artifact write_db accepts a batch of writes under one approval","tier":"use","area":"Artifacts","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242\/e\/artifact-write-db-accepts-a-batch-of-writes-under-one-approv","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242","markdown":"### Artifact `write_db` accepts a batch of writes under one approval\n\nArtifact database writes can be batched so several documents commit under one approval.\n\n**What**\n\nThe artifact database tool takes `db_op: \"batch\"` with a `writes` array, so several set, update and delete operations commit together under a single approval instead of prompting once per call. Each entry can supply its document inline or point at a local JSON file to read it from. The tool description now tells the model to prefer a batch over separate calls when it has more than a couple of documents to write.\n\n**Details**\n\n- each entry in `writes` names an op of set, update or delete, plus `collection`, `doc_id`, and exactly one of `data` (the document inline) or `file_path` (a local file holding a JSON object to use as the document)\n- a batch is capped at a fixed number of entries\n- where the server supports batch writes the whole batch commits all-or-nothing; where it does not, the entries are applied one at a time in order, the result states which of the two modes ran, and a failure part-way through names the entries already written\n- two entries targeting the same document in one batch are refused with the error `db_batch_duplicate`\n- reading a `file_path` goes through the normal Read permission rules, and the approval is re-checked before the batch runs so entries cannot be added, removed or switched between inline and file after you approved it\n- collection paths were tightened from 1-31 to 1-15 slash-separated segments, each segment allowing letters, digits and `_ - . ~ : @ +`, so subcollections nest like `boards\/b1\/columns`\n- available wherever the artifact tool is offered, with no separate flag or setting to turn it on\n\n**Evidence**\n\n`applied one at a time in order (this server has no batch write yet); a failure part-way leaves earlier entries written`, `such writes at once`, `Database collection path: 1-15 \"\/\"-separated segments (letters, digits, _ - . ~ : @ + per segment), so subcollections nest like \"boards\/b1\/columns\". Required for read_db and write_db.`\n\n- Area: Artifacts\n- Names: `write_db`\n- Tier: Use it now\n- Useful: 3\/5\n- Signal: 2\/5"}