Some checks failed
Auto-update PR branches / Update open PR branches (push) Has been cancelled
CI / Frontend Static Quality Checks (push) Has been cancelled
CI / Frontend Tests & Coverage (push) Has been cancelled
CI / Rust Tests & Quality Checks (push) Has been cancelled
CI / Linux build verification (push) Has been cancelled
Release (Alpha) / Compute alpha version (push) Has been cancelled
Release (Alpha) / Build release artifacts (push) Has been cancelled
Release (Alpha) / GitHub Release (alpha) (push) Has been cancelled
Release (Alpha) / Update docs and release pages (push) Has been cancelled
Deploy docs / Build VitePress site (push) Has been cancelled
Deploy docs / Deploy to GitHub Pages (push) Has been cancelled
1.9 KiB
1.9 KiB
type, id, title, status, date
| type | id | title | status | date |
|---|---|---|---|---|
| ADR | 0004 | Vault vs app settings for state storage | active | 2026-03-24 |
Context
As features were added, there was recurring ambiguity about where to persist configuration and state: in the vault (as frontmatter in .md files) or in app settings (~/.config/com.laputa.app/settings.json / localStorage). Without a clear rule, some decisions were inconsistent.
Decision
Ask: "Would the user want this to follow the vault across all their installations?"
- If yes → store in the vault (as frontmatter in the relevant
.mdfile, using the_convention for system properties) - If no → store in app settings
Examples:
| Data | Storage | Reason |
|---|---|---|
Note type icon (_icon) |
Vault frontmatter | Follows the vault everywhere |
Note type color (_color) |
Vault frontmatter | Follows the vault everywhere |
| Note sort preference | Vault frontmatter (type file) | Per-vault, consistent across devices |
| API keys (Anthropic, OpenAI) | App settings | Installation-specific |
| GitHub token | App settings | Installation-specific |
| Window size / zoom | App settings | Device-specific |
| Editor zoom level | App settings | Device-specific |
| Telemetry consent | App settings | Installation-specific |
Alternatives considered
- Everything in localStorage: simple, but breaks cross-device sync for vault-level config.
- Everything in vault: pure, but makes device-specific settings (zoom, window size) propagate to all devices — confusing.
Consequences
- Config that "belongs to a note or type" lives in frontmatter — readable/diffable in git
- The
_prefix convention (see ABSTRACTIONS.md) distinguishes system properties from user properties - App rebuilds from vault state on open — no stale config files to manage
- Triggers re-evaluation if: vault files become too polluted with system frontmatter properties