Skip to content

Feature request: AutoSave & version history to a storage target you own (local/NAS, Google Drive, OneDrive, S3/R2 via rclone), with paragraph-level co-editing as a later phase #518

Open

Description

@fernandodilland

TL;DR

In Word, AutoSave, Version History and co-authoring only work for files stored on OneDrive/SharePoint. Please add an open equivalent: one central "Save target" setting so a document can autosave to storage the user owns (local/NAS folder, Google Drive, OneDrive, S3-compatible such as Cloudflare R2, or anything rclone supports), keep automatic version history, avoid overwrites with a lease file, and optionally grow into paragraph-level co-editing. Opt-in, no vendor server, no telemetry.

Why

  • Unsaved documents are the classic way writers lose work. I couldn't find AutoRecover/AutoSave in the README (I couldn't read the source, so please correct me).
  • A .docx is small, so syncing whole files is cheap: a lot of safety for little engineering.
  • People who self-host can't use OneDrive-based features.

How Word does it

  • AutoSave is on by default only for files in OneDrive, OneDrive for Business or SharePoint Online. The first edit creates a version, then a new one is added roughly every 10 minutes. Without it only local AutoRecover remains (10 minutes by default in the docs I found).
  • Co-authoring is server-side: File > Save pushes your changes, pulls other authors' changes and updates version history. Microsoft's own Q&A says Word still uses paragraph-level locking in some scenarios. When edits collide, users fall back to Review > Compare > Combine.
  • On a plain network share Office uses a hidden ~$ owner file as a soft lock, which goes stale after a crash.

What WordCraft has today (README only)

.docx read/write, track changes with accept/reject, comments, Compare documents, undo/redo, 389 commands shared by UI/CLI/control channel/MCP, web build.

Proposal

Phase 0, AutoSave + crash recovery (local): debounced autosave from an immutable snapshot; atomic writes (temp -> fsync -> rename) into a recovery journal; recovery prompt on next start; a file.autoSave command; default in the Save options.
Phase 1, pluggable Save target: see shared building blocks below.
Phase 2, version history: periodic immutable snapshots (similar cadence to Word, grouped per session), named versions, restore, and "Compare with this version" built on the existing Compare.
Phase 3, safe sharing without a server: a lease file next to the document (holder, device, expires, heartbeat; TTL so a crash can't leave a phantom lock), writes with IfMatch(last_seen_etag), and on conflict a paragraph-level three-way merge. If it can't merge cleanly, bring the remote edits in as tracked changes (reusing Compare) so the user accepts or rejects them, the same experience as Word's Combine. Last resort: a conflict copy, never an overwrite.
Phase 4 (stretch), real-time co-editing: per-paragraph operations over the command stream; needs stable paragraph/run ids in the model; evaluate a rich-text CRDT (Yrs, Automerge, Loro) vs OT; presence cursors; ops carried over the storage target or P2P (iroh; browsers always go through a relay).

Shared building blocks (same design as storytold/gridcraft#NNN so the apps interoperate): a small StorageBackend abstraction with capability probing; backends = local/NAS/synced folder, rclone (desktop: Google Drive, OneDrive, S3/R2, WebDAV/SFTP, crypt) used as a transport rather than a sync engine, and native Rust S3/Graph/Drive clients for the wasm build; safe overwrite via If-Match/If-None-Match on S3/R2 and ETag on OneDrive, a TTL lease file where there is no compare-and-swap (Google Drive); credentials in the OS keychain.

Notes

  • .docx round trips must stay faithful. Keep the original as version 0 on the first overwrite and warn before replacing a file that uses features WordCraft can't model.
  • No network I/O on the typing path.

Open questions

  1. Is .docx the only working format, or is there a native one that should be the autosave format?
  2. Do paragraphs/runs have stable ids in the document model?
  3. Where does the recovery journal live in the web build (OPFS)?

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions