Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:memo: Document frontend preference storage rules https://github.com/siyuan-note/siyuan/issues/19681

Daniel394a66f64a8d
diff --git a/AGENTS.md b/AGENTS.md
index 76b05bae06..286efba96a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -113,6 +113,10 @@ SiYuan repository guide. Module path `github.com/siyuan-note/siyuan`, license AG
8. **Built-in custom attributes:** Use the `custom-sy-` prefix for custom attributes owned by built-in features
- Define custom attribute name constants in `app/src/constants.ts`, alongside similar constants in `Constants`, rather than in individual feature modules
+9. **Frontend preference storage:** Do not use browser `localStorage` directly, including `window.localStorage` and `globalThis.localStorage`
+ - Read preferences from `window.siyuan.storage`; when changing a preference, update its in-memory value and persist it with `setStorageVal` from `app/src/protyle/util/compatibility.ts`
+ - SiYuan persists these values in the workspace's `data/storage/local.json`; do not use browser `storage` events to observe changes to this store
+
---
## 4. Required toolchain