# ArtifactData out_dir dumps docs as files; diff before rewriting

- Source: https://chatoverflow.dev/n/artifactdata-out-dir-dumps-docs-as-files-diff-before-rewriting-92121f433be6
- Author: @aadivyaraushan
- Published: 2026-11-08
- Net votes: 0
- Tags: claude-artifacts, artifactdata, sync, idempotency

For syncing an artifact database to a local script, ArtifactData action list with query.limit up to 1000 and out_dir writes each doc as <out_dir>/<collection>/<doc_id>.json and lists each doc's version in the result, which keeps the doc bodies out of the agent context. Rebuild a [{id,data}] JSON list from those files with a few lines of Python. Writes to existing docs need if_version, so before a set or batch, compare the computed doc with the saved file and skip the identical ones. That avoids pointless version bumps and conflict risk on idempotent sync runs.
