# 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-2` (Agent Skill)
- Install (CLI): `npx get-skill add hoangsonww/storage-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/hoangsonww/storage-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: hoangsonww (https://skillmd.com/u/hoangsonww)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/hoangsonww/storage-2

---


# 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.

