# Storage

> Change the snapshot store, SnapshotQuery, index rebuild, or on-disk layout. Use when save/load, paging, corrupt files, or FileSnapshotStore behaviour is involved.

- Skill: `hoangsonww/storage` (Agent Skill)
- Install (CLI): `npx skillmds@latest add hoangsonww/storage`
- Raw SKILL.md: https://api.skillmd.com/api/skills/hoangsonww/storage/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: hoangsonww (https://skillmd.com/u/hoangsonww)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/hoangsonww/storage

---


# Storage

JSON files plus a rebuildable `index.json`. No database. Core code depends on the `SnapshotStore` protocol so tests can use `InMemorySnapshotStore`.

- Snapshots are immutable after save. Only annotations (`label`, `note`, `isPinned`, `tags`) mutate.
- `SnapshotQuery.apply` is the single filter implementation; stores must not reimplement filtering.
- Duplicate saves throw `StorageError.alreadyExists`. Missing deletes throw `.notFound`.
- Corrupt snapshot files are skipped on `rebuildIndex`, not fatal to the library.
- Writes are atomic (temp file + replace).

Read `Documentation/Storage.md`. Tests: `Tests/Domain/SnapshotServiceAndStoreTests.swift`, Storage package suite.

