You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add Loro skill repository guide
* refactor: focus Loro skill on user onboarding
* docs: index Loro language bindings in skill
---------
Co-authored-by: Zixuan Chen <zx@loro.dev>
description: "Comprehensive guide for using Loro across document modeling, synchronization, versioning, rich text editors, app-state mirroring, performance tradeoffs, and wasm bindings. Use when Codex needs to work with `loro-crdt`, `loro`, `loro-prosemirror`, `loro-mirror`, or `crates/loro-wasm` for: (1) Choosing CRDT container types and document structure, (2) Designing sync, persistence, checkout, or history workflows, (3) Integrating rich-text editors and stable selections, (4) Mirroring app state with schemas and React, (5) Reasoning about versions, events, import status, or Inspector output, or (6) Maintaining the WASM binding layer."
3
+
description: "Practical guide for helping app developers evaluate, adopt, and use Loro for local-first collaboration. Use when Codex needs to answer questions or write examples for `loro-crdt`, `loro`, `loro-prosemirror`, `loro-codemirror`, `loro-mirror`, language bindings such as Swift/Python/C#/Go/React Native, or Loro-powered apps about: (1) Deciding whether Loro fits a product, (2) Getting started in JavaScript/TypeScript, Rust, or another supported binding, (3) Choosing CRDT containers and document structure, (4) Designing sync, persistence, snapshots, versioning, undo, presence, or time travel, (5) Integrating rich-text editors and stable selections, (6) Mirroring app state with React, or (7) Understanding performance and tradeoffs."
4
4
---
5
5
6
6
# Loro
7
7
8
-
Use this skill as the single entry point for all Loro work. Load one primary chapter first. Load a second chapter only when the task clearly crosses domains.
8
+
Use this skill to help users build applications with Loro. Start from the user's product goal, then choose the narrowest chapter that answers it. Load a second chapter only when the task crosses domains.
9
9
10
10
## Select A Chapter
11
11
12
12
- Read [references/topic-map.md](references/topic-map.md) if the task is broad and you need to route it.
13
-
- Read [references/fit-and-architecture.md](references/fit-and-architecture.md) for CRDT fit, local-first framing, setup, and high-level architecture.
14
-
- Read [references/containers-and-encoding.md](references/containers-and-encoding.md) for container choice, composition, encoding, persistence, shallow snapshots, and redaction.
15
-
- Read [references/sync-versioning-and-events.md](references/sync-versioning-and-events.md) for sync flows, frontiers, version vectors, checkout, import status, timestamps, event timing, and Inspector.
13
+
- Read [references/fit-and-architecture.md](references/fit-and-architecture.md) for product fit, installation, language/package choices, first examples, and core mental models.
14
+
- Read [references/containers-and-encoding.md](references/containers-and-encoding.md) for choosing containers, shaping documents, exporting updates, snapshots, persistence, shallow snapshots, and redaction.
15
+
- Read [references/sync-versioning-and-events.md](references/sync-versioning-and-events.md) for realtime/offline sync, version vectors, frontiers, checkout, undo, presence, timestamps, events, and Inspector.
16
16
- Read [references/richtext-and-editors.md](references/richtext-and-editors.md) for `LoroText`, cursors, `applyDelta`, `updateByLine`, `loro-prosemirror`, Tiptap, and CodeMirror.
17
17
- Read [references/mirror-and-react.md](references/mirror-and-react.md) for `loro-mirror`, `$cid`, `idSelector`, validation, selectors, and React integration.
18
-
- Read [references/wasm-maintenance.md](references/wasm-maintenance.md) for `crates/loro-wasm`, `#[wasm_bindgen]`, pending-event flushing, wrapper decoration, and tests.
19
-
- Read [references/performance-and-research.md](references/performance-and-research.md) for benchmarks, Eg-Walker tradeoffs, movable-tree context, rich-text design context, and project history.
18
+
- Read [references/performance-and-tradeoffs.md](references/performance-and-tradeoffs.md) for scaling, document/update size, loading speed, and workload tradeoffs.
20
19
21
20
## Route Common Tasks
22
21
22
+
- “I am new to Loro / should I use it / show me a first example”
23
+
- Start with `fit-and-architecture.md`
24
+
- “Which language package or binding should I use?”
25
+
- Start with `fit-and-architecture.md`
23
26
- “Build a collaborative document model / choose data types / persist history”
24
27
- Start with `containers-and-encoding.md`
25
28
- Add `sync-versioning-and-events.md` if version/history behavior matters
short_description: "Complete Loro guide for modeling, sync, editors, and wasm"
4
-
default_prompt: "Use $loro to solve a Loromodeling, sync, editor, mirror, versioning, or wasm-maintenance task."
3
+
short_description: "Guide for adopting and using Loro in apps"
4
+
default_prompt: "Use $loro to design or explain a Loro-powered app, from choosing a language binding through modeling, sync, editors, React state, and performance."
- Authorization decisions that must be enforced at write time.
15
15
- Arbitrary graph-shaped or non-JSON-like data without an adaptation layer.
16
16
17
+
## Install
18
+
19
+
- JavaScript/TypeScript: install `loro-crdt`.
20
+
- Rust: install the `loro` crate.
21
+
- Use editor integrations when available instead of writing editor sync from scratch:
22
+
-`loro-prosemirror` for ProseMirror and Tiptap-style editors.
23
+
-`loro-codemirror` for CodeMirror 6.
24
+
- Use `loro-mirror` and `loro-mirror-react` when the app already thinks in immutable state and actions.
25
+
26
+
## Language And Package Index
27
+
28
+
- JavaScript/TypeScript: [`loro-crdt`](https://www.npmjs.com/package/loro-crdt). Start here for web apps and most examples in the Loro docs.
29
+
- Rust: [`loro`](https://crates.io/crates/loro) and [`docs.rs/loro`](https://docs.rs/loro). Use for native Rust apps, services, CLIs, and custom infrastructure.
30
+
- Swift: [`loro-swift`](https://github.com/loro-dev/loro-swift). Use for Swift/iOS/macOS experiments and native apps.
31
+
- Python: [`loro-py`](https://github.com/loro-dev/loro-py). Use for Python apps, scripts, and server-side tooling.
32
+
- React Native: [`loro-react-native`](https://github.com/loro-dev/loro-react-native). Use for mobile apps that need native React Native bindings.
33
+
- C#: [`loro-cs`](https://github.com/sensslen/loro-cs). Community-maintained .NET/C# binding; check its README and release state before adopting.
34
+
- Go: [`loro-go`](https://github.com/aholstenson/loro-go). Community-maintained Go binding; check platform support and API completeness before adopting.
35
+
- Cross-language FFI base: [`loro-ffi`](https://github.com/loro-dev/loro-ffi). Use this as the reference for generated/native bindings and as a starting point for new language bindings.
36
+
37
+
Prefer the official JS/TS or Rust package when there is no product reason to choose another language. For community bindings, verify platform binaries, Loro core version, and API coverage before making product commitments.
Use this chapter when users ask whether Loro can handle a workload, how to store data efficiently, or why one sync/storage design is preferable to another.
4
+
5
+
## What To Compare
6
+
7
+
- Encoded document size and update size.
8
+
- Snapshot export/import time.
9
+
- Update import time.
10
+
- Memory footprint while editing and loading.
11
+
- Conflict-heavy collaboration versus mostly independent edits.
12
+
- Initial load path versus steady-state sync path.
13
+
14
+
## Practical Defaults
15
+
16
+
- Use update exchange for live collaboration.
17
+
- Use snapshots for fast startup checkpoints.
18
+
- Store frequent small updates between snapshots when durable replay is needed.
19
+
- Recompact by exporting a fresh snapshot after enough updates accumulate.
20
+
- Consider shallow snapshots when old history can be archived or discarded.
21
+
22
+
## Workload-Specific Advice
23
+
24
+
- Collaborative text: use `LoroText`; do not model text as a plain string just to reduce apparent complexity.
25
+
- Reorder-heavy collections: use `LoroMovableList` instead of delete+insert if move identity matters.
26
+
- Hierarchies: use `LoroTree`; avoid forcing tree-shaped data into ad hoc map/list structures.
27
+
- High-frequency presence or cursor movement: use `EphemeralStore`, not the persisted document.
28
+
- Hard invariants such as balances, bookings, or permissions still need application/server-side validation outside the CRDT merge.
29
+
30
+
## Benchmark Interpretation
31
+
32
+
- Treat benchmarks as workload indicators, not universal rankings.
33
+
- A smaller full snapshot does not automatically mean smaller incremental updates.
34
+
- A fast import path matters most for startup and bulk sync.
35
+
- A compact update path matters most for live collaboration and bandwidth-constrained clients.
36
+
- Shallow snapshots reduce retained history, but peers with only older history may need a fresh snapshot or archived history to sync.
37
+
38
+
## Explain Tradeoffs
39
+
40
+
- Loro optimizes for local editing, automatic merging, history, and version control.
41
+
- Strong eventual consistency means peers converge after receiving the same operations.
42
+
- Loro does not provide central locking, serializable transactions, or write-time authorization by itself.
43
+
- Pick containers by merge semantics first, then tune storage and sync format for performance.
0 commit comments