Skip to main content

Google Drive Watchers

Google Drive watchers keep documents in one directly shared folder synchronized into a Synth project. They use a read-only Google service account, preserve a file's identity when it is renamed or moved, and periodically verify the full folder so missed changes can be repaired safely.

Use a dedicated folder while validating the scope. Watchers normally start with Auto-sync on and resume after server restarts. For a controlled first review, turn Auto-sync off on the saved card, use Refresh and Sync manually, and inspect the resulting pages before turning it back on.

Use Refresh to compare Drive with published knowledge without processing or publishing files. Use Sync to check Drive again and then apply changes. Full refresh is shown for Shared Drive change-feed mode, where it forces a complete read-only folder comparison; My Drive already uses a complete snapshot for ordinary Refresh. Open More on the watcher card to find Full refresh when it is available. See Refresh, Sync, And Auto-sync.

What Is Supported​

Drive contentSynth materialization
Google DocsMarkdown export
Google Slides and DrawingsPDF export
PDFNative download
DOCXNative download
Markdown and textNative download
Google SheetsNot currently ingested
ShortcutsRecorded as unsupported; targets are not followed

Folder traversal is recursive by default. A folder URL or bare folder ID is accepted. Link-only resource keys are not supported; share the folder directly with the service-account email instead.

1. Create A Dedicated Google Cloud Project​

  1. Create or select a Google Cloud project used only for the watcher.
  2. Enable Google Drive API in that project.
  3. Create a service account such as synth-drive-reader.
  4. Create a JSON key for that service account and save it outside the Synth project and source repository.
  5. Restrict the key file to the account running Synth (chmod 600 on Linux or macOS).

The watcher requests only the drive.readonly OAuth scope. It does not need Editor access to the folder.

2. Share The Folder​

  1. In Google Drive, create or choose the root folder to synchronize.
  2. Open Share and add the service-account email from the JSON key.
  3. Grant Viewer access.
  4. Copy the folder URL. The value after /folders/ is the folder ID.

Sharing a parent workspace or relying on “Anyone with the link” is not a substitute for direct service-account access. Preview and the first sync will fail closed if the configured root is not an accessible folder.

3. Save The Credential In Synth​

In Settings → Credentials, create a Personal Google Drive Service Account credential. Use Personal for a key that belongs to you or your Drive folder. An administrator may instead create an Organization credential in Global Settings → Credentials when every authorized Synth user should be able to select the same service account.

Upload the JSON key file. Synth validates that it is a service-account key before saving it and shows only safe identity details such as the service-account email and Google Cloud project ID. The private key is not shown again after the credential is saved.

After saving, open More actions → View details, use Copy email, and share the Drive folder with that exact address as Viewer. Delete any unnecessary downloaded copy of the JSON key after the watcher is proven, and rotate the key immediately if it was pasted into chat, a ticket, a screenshot, or any other untrusted place.

Watcher configuration stores only the credential ID, which references the saved credential. The JSON key does not need to be copied into watcher configuration or CaSC.

4. Configure With CaSC​

Add the watcher to the project’s .synth/config.yaml:

version: 1
default_provider: openai
default_model: gpt-4o-mini
watchers:
drive-docs:
type: gdrive
interval: 300
auto_start: true
auto_sync: true
credential: your-saved-credential-id
config:
folder_id: your-folder-id
recursive: true
follow_shortcuts: false
max_file_bytes: 52428800
max_batch_items: 200
max_batch_bytes: 536870912
max_scope_items: 100000
full_reconcile_interval_seconds: 86400
removal_policy: tombstone

Set default_provider and default_model to a provider already configured for the project. The API key remains in the provider environment or secret store; it does not belong in CaSC.

Keep credential at the watcher level. Do not put JSON, private keys, access tokens, credentials_file, or resource keys in CaSC. Invalid or unsafe Drive entries are rejected with a configuration warning instead of being partially started.

auto_sync is a top-level watcher policy in CaSC and defaults to true. Set it to false to keep scheduled Drive checks running without automatically publishing detected changes. The card reports Changes pending until a user selects Sync. It is separate from auto_start, which controls startup after a Synth restart.

For a smaller initial sync, reduce max_scope_items, max_batch_items, and max_batch_bytes. The minimum polling interval is 30 seconds; 300 seconds is a safer production default.

5. Preview And Run The First Sync​

  1. Open Watchers → New Watcher → Google Drive.
  2. Select the saved service-account credential.
  3. Paste the folder URL or ID.
  4. Select Preview files and cost. Preview is read-only: it does not process documents, use a model, or change synchronization progress. It checks root access, change tracking, recursive coverage, and supported content.
  5. Expand the manifest and verify the exact relative paths, Drive/MIME type, export format, modified time, size or token estimate, and the reason for every excluded, unsupported, inaccessible, or truncated item.
  6. Review the files expected to need processing and the estimated cost. The calculation shows the selected model, catalog rate and timestamp, and the weekly processing budget. Estimates are planning guidance; the final charge depends on the extracted content and model usage.
  7. Save the watcher. Auto-sync is on by default. If you want to review every detected change before publication, turn it off in the card's Auto-sync panel.
  8. Select Refresh and review the detected files without publishing them. The card shows Sync · Changes pending while published knowledge remains available.
  9. Select Sync, follow the logs, and inspect the created pages. A completed watcher should show Sync · Synced and Health · Healthy.
  10. Leave Auto-sync on for normal scheduled publication, or turn it on after the controlled first sync. Select Edit automation to change the interval.

Changing the folder, credential, recursion setting, or file rules invalidates an older preview. Run preview again before saving. For a large folder, a truncated or incomplete preview is not proof of the complete scope; narrow the folder or filters before starting the watcher.

Verify The Knowledge Base​

After the first run reports success:

  1. Open Knowledge for the same Project named in the watcher review step.
  2. Wait for the tree to finish loading. A loading or refresh-error state is not proof that the knowledge base is empty.
  3. Confirm the original Drive title and relative folder path are shown as the primary labels.
  4. Open a result and use Open in Drive to verify its source provenance. Watcher-managed source and generated pages are read-only in Synth.
  5. Search Explore for a distinctive phrase from the document. Results should show a bounded passage around the match and the original Drive title/path.

Knowledge refreshes after a watcher publishes successfully. If that refresh reports an error, retry Refresh before diagnosing a missing file; do not recreate the watcher or re-upload the document first.

To rotate the key for the same service account, edit the saved credential and upload the replacement JSON. Synth validates the replacement before saving it. Restart or update the watcher to use the replacement, then select Sync. If the service-account email changes, create a new credential and update each watcher explicitly rather than replacing the identity in place.

Preview And Runtime Counts​

The counts describe different stages and are not expected to be identical:

CountMeaning
Preview filesDrive objects currently in scope before extraction.
Next-sync workNew or changed supported files expected to need processing.
Ingested itemsSource artifacts handed to extraction.
Knowledge pagesSource and derived pages published into the Project. One file can create several pages.
ConnectionsGraph relationships extracted from the published pages.

When the weekly budget is exhausted, the watcher keeps the pending source work, shows a budget-paused state, and resumes after the next budget window. It does not mark pending work complete until the updated knowledge has been published.

Reading Drive Upload Logs​

When a new or changed Drive file needs processing, watcher logs report one continuous lifecycle. For example, uploading a PDF named Quarterly Report.pdf can produce:

[drive-docs] Scheduled check found 1 item
[drive-docs] Queued "Quarterly Report.pdf" for ingestion
[drive-docs] Sync complete: 4 pages, 4 connections from 1 item [ok] — "Quarterly Report.pdf"

The exact page and connection counts depend on the document. They describe knowledge created or refreshed by extraction, not the number of Drive files. A single PDF can produce several knowledge pages and connections.

Log or card signalMeaningOperator action
Scheduled check found 1 itemThe Drive scan detected one supported new or changed file.Keep following the current run.
Queued "Quarterly Report.pdf" for ingestionSynth accepted that Drive file for processing. This is an in-progress handoff, not a completed warning or success.Wait for the terminal result; do not start a duplicate run.
Waiting for Google Drive ingestion workerThe watcher is waiting for document processing or recovering interrupted work.Leave the watcher running and follow logs.
Sync complete: 4 pages, 4 connections from 1 item [ok] — "Quarterly Report.pdf"The named file was processed and its pages were published successfully.Inspect the resulting pages if this is a first sync or a high-impact document.
Drive checkpoint 12 committed and 4 live files in the trusted snapshotThe published knowledge and current Drive folder state were saved successfully.No action when freshness is Current.
No new changes [ok]The scheduled poll completed normally without extraction work.No action.
Google Drive ingestion failed: ... or BlockedDocument processing or publication did not finish, so the affected changes remain pending.Repair the reported cause, then select Sync.

The watcher reports completion as soon as document processing finishes; it does not wait for the next polling interval. If Synth restarts during a sync, pending work is recovered before later Drive changes are processed.

For a multi-file batch, logs name up to three Drive files and summarize the remainder as + N more. Logs use recognizable Drive titles. Use Clear only when you no longer need the older log history.

Freshness And Checkpoint Safety​

Synth keeps the same source identity when a Drive file is renamed or moved within the watched folder, so the corresponding knowledge is updated rather than duplicated.

A change is marked complete only after its updated knowledge has been published. If download, document processing, model use, or publication fails, the watcher becomes Blocked and keeps the affected changes pending. After repairing the reported cause, select Sync to retry without silently skipping the failed version.

Scheduled Complete Refresh​

Incremental change tracking is efficient, but it is not the only source of truth. Synth runs a bounded complete traversal at the configured complete-scan interval and when change history is no longer valid, folder access changes, or the scope configuration changes.

For a directly shared My Drive folder, Synth takes this bounded complete snapshot on every poll. Google’s service-account change feed can omit edits made by the folder owner in this topology. For a Shared Drive, Synth uses the changes feed for low-latency updates and retains scheduled complete refresh as the repair path. Watcher status identifies the active change detection strategy.

A complete snapshot may repair missed additions, renames, and moves. Absence is handled conservatively: a previously live source must be absent from two matching complete snapshots before absence alone can retire it. Incomplete search, access loss, rate limiting, and permission errors never count as proof of deletion.

After changing recursive scope, moving large subtrees, restoring permissions, rotating a credential, or repairing a stale/blocked state, select Refresh and review the comparison. In Shared Drive change-feed mode, use Full refresh when the card says a complete comparison is required. Select Sync to apply the verified changes. My Drive does not show Full refresh because its ordinary Refresh already performs a complete comparison.

Operational States​

What the card showsMeaningAction
Sync · Synced and Health · HealthyThe latest successful check found published knowledge current, and polling is healthy.No action.
Sync · Changes pending and Health · HealthyDrive changes were detected but have not been published.Review the source summary, then select Sync.
Sync · Checking or Sync · Syncing and Health · ProgressingThe watcher is comparing, processing, or publishing Drive changes.Follow logs; do not start a second run.
Health · Blocked or Health · DegradedA sync, credential, scope, budget, or publication problem needs attention.Repair the reported cause, then select Refresh or Sync as directed by the card.
The main message requests a complete comparisonChange history, scope, or folder access requires a complete scan.Open More, select Full refresh, review the comparison, then select Sync.
Health · StoppedThe watcher is saved but scheduled polling is stopped.Open More and start it after the configuration is ready.

Troubleshooting​

SymptomLikely causeFix
Root access deniedFolder was not directly shared with the service account.Share the root with the exact service-account email as Viewer.
Credential invalidJSON is incomplete, revoked, or not a service-account key.Create a new key, replace the saved credential, and select Refresh to verify access before selecting Sync.
Unsupported filesSheets, shortcuts, or unrecognized binary types are in scope.Move them out of scope or narrow MIME/extension filters.
Batch capacity exceededThe scope or one batch exceeds configured item/byte bounds.Narrow the scope or deliberately raise the relevant bound.
Ingestion blockedDocument processing, model access, or knowledge publication failed.Fix the reported error, then select Sync.
Filename appears as queued with no terminal resultExtraction is still running, the worker is retrying, or a restart recovery is in progress.Follow logs and worker health; do not start another run while the card says Syncing.
Pages exceed changed file countOne document was decomposed into multiple knowledge pages.Expected; inspect the cited source and generated pages if the count looks surprising.
Knowledge briefly shows no filesThe authoritative tree is still loading or a refresh failed.Wait for loading to finish, retry refresh, and confirm the selected Project; do not treat an unready view as an empty KB.
A preview disappeared after editing settingsFolder, credential, recursion, or filter changes invalidated the old result.Preview again so the manifest and cost match the settings you will save.
Another watcher already owns a fileTwo watcher scopes overlap the same stable Drive object.Keep one owner or narrow the folders; Synth does not silently transfer source ownership.
No changes after renameContent hash is unchanged.Expected: metadata updates without redundant re-extraction.
Missing file is still liveAbsence has only one complete-snapshot confirmation.Confirm the scope is correct, then allow the next complete scan. My Drive scans completely on every run; Shared Drives use the configured complete-scan interval.

Never troubleshoot by pasting the JSON key into logs, chat, issues, CaSC, or a shell command. Use a protected file or the Synth credential store.

Source removal and recovery​

Confirmed Drive removals publish safe exclusions before new-content processing. The source checkpoint can complete while remaining-evidence rebuilding is pending. Existing absence confirmation and removal-policy settings still apply. See Removed Sources and Shared Pages for the workflow, permissions and recovery limits.