~/projects-hub/projects/google-drive-work-sync
Google Drive Work Sync icon
Active
Last updated:

Google Drive Work Sync

Native Windows 11 desktop application (WinUI 3 / .NET 9) that syncs work directories and AI agent context to Google Drive via native Rust engine with BLAKE3 SIMD and Google Apps Script.

WindowsProductivityDeveloper ToolsAutomation
C# 13.NET 9RustWinUI 3Windows App SDKBLAKE3 SIMDP/Invoke FFIGoogle Apps ScriptxUnit

The Problem

Keeping work directories and AI agent context (CLAUDE.md, skills, memory files) synced to Google Drive without a heavyweight sync client, without re-uploading unchanged files, and without accidentally leaking secrets.

The Solution

A WinUI 3 system tray app powered by a native Rust engine (FFI P/Invoke) that uploads only new or modified files to a self-hosted Google Apps Script Web App, using ultra-fast BLAKE3 SIMD hashing and Rayon multithreading before transferring, retrying transient failures with exponential backoff, supporting gitignore-style glob exclusions (.syncignore) and safe Restore from Drive, discovering AI agent context recursively while excluding nested repositories and worktrees, and running a three-tiered secret filter.

Key Learnings

  • Batch Uploads & Orphan Reconciliation: Batch packaging for Claude context sync with live progress reporting, busy indicators for scans, and destructive action confirmations when purging duplicates or orphans in Google Drive.
  • Crash-Safe Hash Index: The sync index is written to a temp file and swapped in atomically, so an interrupted run can never leave it empty.
  • Three-Tiered Secret Filter: A filename blacklist, a regex scan of the first 64 KB for known token patterns (PAT, AWS, SSH), and a fail-closed sanitizer for MCP configuration files.
  • Nested Repository & Worktree Detection: A BFS traversal that identifies git roots (both .git directories and linked worktree files) so tracked CLAUDE.md files are never misclassified as untracked scratch notes.
  • No Silent Skips: Locked files or unlistable folders are reported as errors instead of counted as 'unchanged', so the 'Up to date' status can always be trusted.
  • Native Rust Engine via FFI & BLAKE3 SIMD (v1.9.0): Integrated a native Rust cdylib crate with Rayon parallelism and SIMD-accelerated BLAKE3 hashing through a zero-allocation P/Invoke interop bridge, featuring transparent in-place hash index migration without re-uploading.
  • Glob Exclusions & Safe Restore (v1.10.0): Pruned traversal via .syncignore rules and chunked Restore from Drive with atomic writes, path traversal rejection, and Windows Recycle Bin protection on overwrites.

Incremental Sync with Cryptographic Verification

Google Drive Work Sync pairs a metadata fast-path (timestamp and size) with ultra-fast BLAKE3 SIMD cryptographic verification via native Rust engine only when there are real signs of change, batching files into groups of up to 8 files or 9 MB to respect Google Apps Script’s execution quotas.

  • Crash-Safe Persistent Index: Sync state is stored in sync_hashes.json via a temp-file write and atomic swap, preventing a corrupted index after an unexpected interruption.
  • Transient Failure Recovery: HTTP errors (429, 500, 503) are persisted and can be retried with a single click, re-hashing the current file before retrying.

AI Agent Context Discovery & Security

  • Git-Aware BFS Traversal: Detects repository roots and linked worktrees to exclude them from the scan, and uses git ls-files to tell tracked documentation apart from untracked local scratch notes.
  • Three-Layer Secret Redaction: A known-filename filter, a regex scan for common token patterns, and an MCP configuration parser that fails closed on any doubt before the file is backed up.

Note: The full source code, architectural decisions, and build instructions are available in the GitHub repository.

This page is a high-level summary. The GitHub repository is the source of truth for each tool's current features. GitHub ↗

Back to Hub