Note
LLM & AI Agent Context: A structured machine-readable sitemap, architectural overview, and API guide is available at llms.txt.
🇬🇧 English | 🇩🇪 Deutsche Version | 🇪🇸 Spanish Version | 🇫🇷 French Version | 🇯🇵 Japanese Version | 🇨🇳 Simplified Chinese Version | 🇵🇹 Portuguese Version | 🇷🇺 Russian Version | 🇸🇦 Arabic Version | 🇮🇳 Hindi Version | 🇧🇩 Bengali Version | 🤝 Contributing | 🛡️ Security Policy | 📝 Changelog | 📋 llms.txt
- Executive Summary & Core Identity
- Visual Architecture Topology & Decoupled Layers
- End-to-End Snapshot & Synchronization Lifecycle
- Target Personas & High-Intent SEO Queries
- Implemented Behavior & Limits
- Governance & Runtime Invariants Matrix
- Core Capabilities & Decoupled Features
- Read-Only Application Projections
- Installation & Prerequisites
- Quickstart & Multi-Node Workflow
- Configuration Reference & Credential Triggers
- Republica Showcase & Cipher Method
- Python API & Extension Points
- Safety, Threat Model & Operational Limits
- Third-Party License Inventory
- Ecosystem, Sibling Tools & Bundles
- Testing, Verification & CI Matrix
- Statutory Notice, Liability Limitation & License (§ 521 BGB)
Version, module status, visibility and verification-date authority are defined
in METADATA_CONTRACT.md; they do not constitute a
release or public-upload approval.
Local-first synchronization for independent SQLite databases through snapshots checked for integrity and application-selectable merge policies. Sender authentication is optional through an API-injected HMAC authenticator. It is extracted from the BACH ProSync architecture without BACH, OneDrive, host-name, or user-path dependencies.
This is not a distributed SQL server. Every node owns and opens only its
local database. A shared folder, object-store mount, removable drive, or other
file transport carries closed snapshots plus manifests. Pulling checks SHA-256 and SQLite PRAGMA quick_check before merging a snapshot into the local database inside one transaction. HMAC sender authentication is checked only when an authenticator is configured.
Pairs well with sync-master
(same module family): a sync-master yard is a natural transit transport —
point --transit at a tool-owned db-transit/<namespace>/ zone inside the
yard (its protocol rule R9). sync-master carries the documents, this module
owns database integrity and merging; both stay independent.
The following diagram illustrates the multi-node decoupled topology where local SQLite databases are bridged exclusively through closed snapshot bundles checked for integrity against their manifests:
flowchart TD
subgraph NODE_A ["Publisher Node (Host A)"]
DB_A[("Local SQLite DB<br/>(app.db)")]
BACKUP_A["Online Backup API<br/>(sqlite3.backup)"]
REDACT_A["Table Redaction &<br/>VACUUM Engine"]
SHIELD_A["Configured Credential-Pattern Scan<br/>(default rules — not exhaustive)"]
HMAC_A["Optional HMAC Authenticator<br/>(API-injected)"]
STATE_A["Local State Ledger<br/>(node-state.json)"]
end
subgraph TRANSIT ["Shared Transit Zone (Yard / Transport)"]
SNAP["Closed Atomic Snapshot<br/>(*.snapshot.sqlite)"]
SIG["Optional HMAC Envelope<br/>(if configured)"]
HASH["SHA-256 Digest<br/>(*.manifest.json)"]
RETENTION["Retention Policy Engine<br/>(Conservative GC)"]
end
subgraph NODE_B ["Subscriber Node (Host B)"]
GUARD_B["Path Traversal Guard<br/>(Fail-Closed Root)"]
VERIFY_B["SHA-256 Integrity Check<br/>(HMAC if configured)"]
SANITY_B["SQLite PRAGMA quick_check<br/>(Corruption Check)"]
MERGE_B["Row-Level Merge Engine<br/>(LWW / Tombstones / Drift)"]
DB_B[("Local SQLite DB<br/>(app.db)")]
STATE_B["Local State Ledger<br/>(node-state.json)"]
end
subgraph SHOWCASE ["Showcase Layer (Republica Mode)"]
REP_EXP["SQL Dump & Gzip<br/>(Curated Export)"]
REP_FER["Fernet Symmetric Cipher<br/>(AES-128-CBC + HMAC)"]
REP_RO[("Read-Only Showcase DB<br/>(republica_root/)")]
end
DB_A --> BACKUP_A
BACKUP_A --> REDACT_A
REDACT_A --> SHIELD_A
SHIELD_A --> HASH
HASH --> SNAP
SNAP --> SIG
HMAC_A -.-> SIG
SNAP --- TRANSIT
SIG --- TRANSIT
HASH --- TRANSIT
TRANSIT --> RETENTION
SNAP --> GUARD_B
SIG --> GUARD_B
HASH --> GUARD_B
GUARD_B --> VERIFY_B
VERIFY_B --> SANITY_B
SANITY_B --> MERGE_B
MERGE_B --> DB_B
MERGE_B --> STATE_B
DB_A -.-> REP_EXP
REP_EXP --> REP_FER
REP_FER --> REP_RO
+-------------------------------------------------------------------------------------------------------------------+
| SQLITE-TRANSIT-SYNC: FOUR-VIEW ARCHITECTURAL TOPOLOGY |
+-------------------------------------------------------------------------------------------------------------------+
| [VIEW 1: PUBLISHER NODE] [VIEW 2: SHARED TRANSIT YARD] [VIEW 3: SUBSCRIBER NODE] |
| |
| +-------------------------+ +-----------------------------+ +---------------------------+ |
| | Local SQLite Database | | Closed Transit Zone | | Path Traversal Guard | |
| | (app.db - Exclusive RW) | | (Folder / Sync-Master / S3)| | (Canonical Bounds Check) | |
| +------------+------------+ +--------------+--------------+ +-------------+-------------+ |
| | ^ | |
| v (sqlite3.backup) | v |
| +------------+------------+ | +-------------+-------------+ |
| | Online Consistent Backup| | | SHA-256 Integrity Check | |
| | (Closed Rollback-Journal| | | Optional HMAC if set | |
| +------------+------------+ | +-------------+-------------+ |
| | | | |
| v | v |
| +------------+------------+ | +-------------+-------------+ |
| | Redaction & VACUUM | | | SQLite PRAGMA quick_check | |
| | (Exclude Sensitive Data)| | | (Integrity Verification) | |
| +------------+------------+ | +-------------+-------------+ |
| | | | |
| v | v |
| +------------+------------+ | +-------------+-------------+ |
| | Pattern Scan | | | Transactional Row Merge | |
| | (default rules; limited) | | | (Row-Level LWW / Drift) | |
| +------------+------------+ | +-------------+-------------+ |
| | | | |
| v | v |
| +------------+------------+ +--------------+--------------+ +-------------+-------------+ |
| | Optional HMAC Adapter | | *.snapshot.sqlite (Atomic) | | Local SQLite Database | |
| | (API-injected if set) |- - - - - - ->| *.manifest.json (Digest) |----------->| (app.db - Merged State) | |
| +-------------------------+ | Retention Engine (Scoped) | +-------------+-------------+ |
| +-----------------------------+ | |
| v |
| +-------------+-------------+ |
| | Local State Ledger | |
| | (node-state.json) | |
| +---------------------------+ |
+-------------------------------------------------------------------------------------------------------------------+
| [VIEW 4: REPUBLICA SHOWCASE / COURIER ENVELOPE (OPTIONAL ZERO-TRUST TRANSPORT)] |
| |
| Local Database ----> Curated SQL Dump ----> Gzip Compression ----> AES-128-CBC (Fernet) ----> Encrypted Outpost |
| (Source Node) (FTS Rebuilt on Dest) (53MB -> 11MB) (Pre-Shared Key) (republica_root/) |
| |
| Single Secret File -> Fernet Cipher Envelope -> Courier Transit -> Destination Directory (Mode 0600, Transit Clr) |
+-------------------------------------------------------------------------------------------------------------------+
The workflow keeps live database files out of file-level synchronization. It checks snapshot bytes against a SHA-256 manifest, runs the configured credential-pattern scan when enabled (default: on), and merges accepted rows transactionally. Sender authentication is available only when an API-injected HMAC authenticator is configured. Peers see changes only after a successful push/pull exchange:
sequenceDiagram
autonumber
participant App as Application / Node A
participant CoreA as sqlite-transit-sync (Push)
participant Shield as Credential-Pattern Scan (default on — configurable)
participant Transit as Shared Transit (db-transit)
participant CoreB as sqlite-transit-sync (Pull)
participant Target as Local DB / Node B
Note over App,CoreA: Phase 1: Local Online Snapshot & Redaction
App->>CoreA: push(config, db)
CoreA->>CoreA: Online Snapshot via SQLite Backup API
CoreA->>CoreA: Drop Excluded Tables & VACUUM
CoreA->>Shield: Scan Content for Secret Patterns (credential-triggers.json)
Shield-->>CoreA: No configured pattern matched (if enabled)
Note over CoreA,Transit: Phase 2: Snapshot Digest & File Publication
CoreA->>CoreA: Calculate SHA-256 digest and size
CoreA->>Transit: Write Temporary Snapshot & Atomic os.replace
Note over CoreA,Transit: Phase 3: Optional Manifest Authentication & Publication
CoreA->>CoreA: Optionally HMAC-sign manifest (if configured)
CoreA->>Transit: Atomically write manifest with SHA-256 — HMAC only if configured (*.manifest.json)
Note over Transit,CoreB: Phase 4: Transit Ingestion & Boundary Guard
CoreB->>Transit: Discover Manifests & Validate Path Bounds (Anti-Traversal)
CoreB->>CoreB: Verify HMAC first if configured
CoreB->>CoreB: Verify snapshot size and SHA-256 (integrity only)
CoreB->>CoreB: Run PRAGMA quick_check on Isolated Snapshot
Note over CoreB,Target: Phase 5: Transactional Row Merge & State Advance
CoreB->>Target: BEGIN IMMEDIATE Transaction
CoreB->>Target: Apply Row-Level Merge Policy (LWW per PK / Tombstones)
CoreB->>Target: Reconcile Shared Column Schema Drift
CoreB->>Target: COMMIT Transaction
CoreB->>CoreB: Advance Local State Ledger (node-state.json)
Note over Target: Peer state reflects successful exchange — no background convergence guarantee
Designed for modular, decentralized ecosystems, sqlite-transit-sync addresses 4 core stakeholder personas:
[PERSONA-01]Autonomous AI Agent Engineers & Multi-Host Swarm Architects:- Challenge: Multi-agent swarms operating across workstations, laptops, and servers require local state persistence without file-lock collisions.
- Solution: The default-on scan can stop publication when a configured credential pattern matches. This is a safety net, not proof that a snapshot contains no secrets. Peers receive changes after a successful push/pull exchange.
[PERSONA-02]Multi-Device Desktop & Edge Application Developers:- Challenge: Power users exchanging personal notes and task databases over file sync (e.g. sync-master, Syncthing, Nextcloud) suffer database corruption and
-wallock-ups. - Solution: The SQLite backup API and per-file publication keep live SQLite database files out of the file-sync path; transit snapshots are the files exchanged by that transport.
- Challenge: Power users exchanging personal notes and task databases over file sync (e.g. sync-master, Syncthing, Nextcloud) suffer database corruption and
[PERSONA-03]Local-First & Configurable-Transit Tool Builders:- Challenge: Applications requiring data sovereignty cannot tolerate cloud lock-in, recurring database hosting fees, or uncontrolled background network egress.
- Solution: The module exchanges snapshot files through a configured filesystem path. That path may be local or removable; shared or network-mounted transport remains outside the module’s control.
[PERSONA-04]Enterprise Security, Privacy & Compliance Officers:- Challenge: Strict zero-trust mandates forbid accidental credential synchronization, unverified binary blobs, and privileged background services.
- Solution: The default-on scan checks configured credential patterns before publication; SHA-256 checks snapshot integrity against the manifest. An API-injected HMAC authenticator can be enabled for sender authentication. The process inherits the permissions of its launcher.
| Intent Category | English (EN) Search Queries | German (DE) Suchbegriffe |
|---|---|---|
| Local-First Synchronization | sqlite synchronization python zero-dependency, local-first database snapshot sync, offline sqlite multi-device sync |
lokale datenbank synchronisation offline snapshots, sqlite abgleich python ohne abhängigkeiten, lokale datenbank replikation dateibasiert |
| Integrity & Configured Credential-Pattern Scan | configured credential-pattern scan sqlite sync, configured filesystem transit sqlite sync, optional hmac sqlite snapshot manifest |
konfigurierter credential musterscan sqlite sync, dateipfad transit sqlite sync, optional hmac snapshot manifest |
| Row-Level Merge & Conflicts | row level merge lww sqlite offline, sqlite last write wins schema drift tolerance, tombstone merge policy sqlite |
row level merge lww sqlite offline, last-write-wins datenbank abgleich zeitstempel, schema drift toleranz sqlite merge |
| Decoupled Architecture | sqlite multi-node sync without distributed sql, sqlite over syncthing without corruption, sqlite transit yard architecture |
sqlite synchronisation ohne verteilten server, sqlite über cloud sync ohne datenbankkorruption, transit yard sqlite synchronisation |
For detailed persona breakdowns, high-intent search queries, and competitive positioning, consult MARKETING-LOG.txt.
This section records the project’s implemented behavior and limits. It is not a current head-to-head audit of other products.
| Dimension | Invariant | Implemented behavior | Limit / boundary |
|---|---|---|---|
| 1. Local processing and transport | INV-LOCAL-01 |
Reads local SQLite databases and publishes snapshots to a configured transit path; no central database server is required. | The configured path may be a shared or network-mounted location. Access and behavior of that transport remain outside this module. |
| 2. Snapshot publication | INV-SNAP-02 |
Captures an online backup and publishes the snapshot file with a temporary file and os.replace. |
Per-file replacement does not make the snapshot and manifest one multi-file transaction. |
| 3. Sidecars and process scope | INV-ROLL-03 |
Closes snapshots in rollback-journal mode and fails closed when temporary SQLite sidecars cannot be cleaned. | Run one sync process per node unless the host application adds a process lock. |
| 4. Transit path containment | INV-PATH-04 |
Restricts manifest and snapshot paths to direct regular files under the canonical transit root. | This does not control who can write to the transit location. |
| 5. Integrity checks | INV-VERIFY-05 |
Compares snapshot bytes with the manifest SHA-256 and runs SQLite PRAGMA quick_check. |
A matching digest does not authenticate the sender or transport. |
| 6. Credential-pattern scan | INV-SHIELD-06 |
By default, checks snapshot content against configured patterns and aborts publication on a match, reporting table.column but not the value. |
The vendor-prefixed rules are a safety net, not a guarantee. A clean scan means no known pattern matched; bespoke or unprefixed secrets can pass. |
| 7. Sender authentication | INV-HMAC-07 |
An application can opt in to API-injected HMAC-SHA256 authentication for the canonical manifest. | Without a configured authenticator there is no sender authentication. Shared-key HMAC is not a freshness protocol or a public-key signature. |
| 8. Row merge | INV-MERGE-08 |
Applies a configurable row-level merge policy, with timestamp-based LWW as the default for supported tables. | The integrating application owns clock assumptions, deletion semantics, migrations and domain conflict rules. |
| 9. Retention and deletion scope | INV-RET-09 |
Cleanup is dry-run by default and scoped to local-node artifacts unless cross-node authority is explicitly enabled. | Retention cleanup is not a backup or recovery service. |
| 10. Process permissions and security policy | INV-SLA-10 |
The process uses the permissions of the process that launches it. SECURITY.md states the reporting policy: acknowledgment within 48 hours and triage within 5 business days. |
The module does not enforce standard-user privileges or request elevation. The response times are a reporting policy, not a runtime feature. |
| Aspect | sqlite-transit-sync behavior |
Limit / boundary |
|---|---|---|
| Basic model | Each node has its own local SQLite database; snapshots move through a configured transit path. | There is no single globally authoritative database. |
| Writes | Applications write locally; a caller runs push and pull to exchange snapshots. | There is no automatic background synchronization. |
| Visibility | A peer can see changes after a successful exchange and merge. | The module does not promise immediate or globally consistent visibility. |
| Global transactions | Not provided. | The application cannot commit one transaction across multiple nodes. |
| Offline operation | A local database can be used independently while a node is offline. | Snapshot exchange waits until the configured transit is available. |
| Conflicts | The configured MergePolicy decides how rows are combined; timestamp LWW is the default. |
Application clocks, deletion rules and domain semantics remain integration responsibilities. |
| Schema changes | Shared-column merge supports limited schema drift. | Applications remain responsible for migrations and schema compatibility. |
| Failure handling | Local data is stored in SQLite and transit snapshots are separate files. | The module does not provide automatic replication, failover or transit backups. |
| System | Advantages | Disadvantages | Good use cases | Poor use cases |
|---|---|---|---|---|
sqlite-transit-sync |
Small local footprint; no central database server; offline local work; configurable file transport; application-selectable merge policies. | Changes require push/pull to reach peers; no global transaction or automatic failover; clocks, deletions, migrations and conflicts need application rules. | Personal or task databases; local agent state; intermittently connected laptops, workstations or edge devices; research notes. | Workloads requiring globally committed transactions, immediate shared state, automatic failover or many concurrent writers. |
| Requirement | Fit |
|---|---|
| Nodes need to keep using their own local database while offline | sqlite-transit-sync |
| Updates may reach peers after an explicit push/pull exchange | sqlite-transit-sync |
| The application can define its merge, clock, deletion and migration rules | sqlite-transit-sync |
| Every write must be globally authoritative immediately | Use an architecture with that consistency contract |
| Global transactions, automatic failover or many concurrent writers are required | Evaluate an architecture that provides those behaviors |
For a small number of intermittently connected devices, this module may fit when delayed exchange and application-owned merge rules are acceptable. If the workload requires global transactions, immediate shared state or automatic failover, choose a design whose documented contract provides those behaviors.
The matrix below records the project’s 10 governance and runtime invariants, with the implemented behavior and relevant limits:
| # | Invariant | Architectural Scope | Documented behavior and limits |
|---|---|---|---|
| 1 | INV-LOCAL-01: Local SQLite Processing & Configured Transit | System Architecture | Reads local SQLite databases and publishes snapshots through the configured transit path. The path may be shared or network-mounted; host and transport behavior are outside this module. |
| 2 | INV-SNAP-02: Offline Snapshot Atomicity | Transit Publication | Live database files are never shared over file-sync. Online snapshots are taken via sqlite3.backup and published via atomic os.replace. |
| 3 | INV-ROLL-03: Rollback Journal Clean Isolation | Sidecar Prevention | Backups are closed in rollback-journal mode; all temporary SQLite sidecars (-wal, -shm, -journal) are cleaned fail-closed before manifest creation. |
| 4 | INV-PATH-04: Strict Transit Path Containment | Filesystem Boundary | Manifest and snapshot paths must be direct regular files within canonical transit root. Path traversal (../), symlinks, and reparse points fail closed. |
| 5 | INV-VERIFY-05: Two-Stage Integrity & Sanity Verification | Pre-Merge Validation | Every received snapshot must pass SHA-256 cryptographic digest matching and SQLite PRAGMA quick_check before inspecting or merging data. |
| 6 | INV-SHIELD-06: Pre-Publication Credential Shielding | Content Inspection | By default, configured credential patterns are checked against snapshot content; a match aborts publication and reports table.column, not the value. Vendor-prefixed patterns are a safety net, not a guarantee; no match does not prove that a snapshot is secret-free. |
| 7 | INV-HMAC-07: Optional HMAC Authentication | Sender Authentication | Optional API-injected HMAC-SHA256 envelope over the canonical manifest payload (protocol, namespace, sender ID, filename, SHA-256, size, redaction list). Shared-key HMAC is not a freshness protocol or public-key signature; without it, the manifest does not authenticate the sender. |
| 8 | INV-MERGE-08: Deterministic Row-Level Merge | Data Convergence | Transactional row-level merge (LWW per PK, shared column union for schema drift, explicit tombstone policy). Content hash tie-breaker ensures deterministic convergence. |
| 9 | INV-RET-09: Conservative Retention & Authority Scoping | Garbage Collection | Snapshot cleanup is dry-run by default, scoped strictly to the local node's artifacts. Cross-node deletion (--all-nodes) requires explicit administrative opt-in. |
| 10 | INV-SLA-10: Process Permissions & Security Policy | Runtime Context | The process inherits the permissions of its launcher; this module does not enforce standard-user privileges or request elevation. SECURITY.md states acknowledgment within 48 hours and triage within 5 business days. |
sqlite-transit-sync is a companion to
dev-bricks/sync-master in the
same module family: sync-master owns file transport (sync.files), this
module owns database integrity and merging (sync.database). Both work
standalone or composed into stacks from the
ellmos-ai family — see the
ellmos-ai/stacks catalog. Its role in
that toolkit: no live SQLite over file-sync — only snapshots that pass manifest and SQLite integrity checks, plus
application-selectable merge policies.
- consistent online snapshots through SQLite's backup API;
- atomic publication using a temporary file and
os.replace; - closed, rollback-journal snapshots with fail-closed cleanup of every temporary SQLite sidecar before publication;
- manifest and snapshot paths are restricted to direct regular files in the canonical transit directory; traversal, absolute paths, symlinks and reparse points fail closed before hashing or merge;
- SHA-256 manifest and
PRAGMA quick_checkverification; - optional API-injected HMAC-SHA256 authentication over the canonical manifest, sender identity, protocol version and snapshot hash, with explicit key IDs;
- per-node local pull state and idempotent replay;
- row-level last-write-wins per primary key for timestamped tables;
- an opt-in
TombstoneMergePolicyreference adapter for explicit deletions; - shared-column merge for basic schema drift tolerance;
- configurable table exclusion and snapshot redaction with post-delete VACUUM;
- a default-on content scan that aborts publication when a configured credential
pattern matches (reports
table.column, never the value). The vendor-prefixed rules are a safety net; a clean scan does not prove that the snapshot has no secrets; - custom
MergePolicysupport for domain rules, tombstones or CRDTs; - verified snapshot cleanup with a dry-run default, local-node scope by default, and explicit opt-ins for deletion and foreign-node administration;
- selected pending pulls for thin application lifecycle adapters without duplicating merge or state-advancement logic;
- strict versioned read-only projection contracts with exact schema/privacy allowlists, provenance, checkpoint, loop and offline-tombstone verification;
- an optional Republica showcase mode that distributes a database one way as an encrypted payload and materialises it as a separate read-only showcase, instead of merging it;
- dependency-free Python API and JSON CLI (Republica mode adds
cryptography).
verify-projection validates a closed, application-owned SQLite projection
without copying, merging, migrating, scheduling, or advancing state. The
application supplies its consumer identity and reviewed maximum offline interval;
the verifier rejects loops, stale checkpoints, insufficient tombstone retention,
unlisted tables or columns, and non-opaque record references.
Six narrow contracts are bundled for account-balance summaries, AboTracker subscription status, HausLagerist replenishment dates, medication due/inventory-warning state, routine due/completion state, and insurance deadlines. The AboTracker contract is status-only because export schema v1 has no confirmed next due or renewal date; it never derives a reminder from payment date plus billing cycle. Test fixtures are synthetic JSON recipes, and domain identities or private details remain outside the allowlists.
The bundled names are abotracker-subscription-status-projection.v1,
accounts-balance-projection.v1, hauslagerist-replenishment-projection.v1,
mediplaner-reminder-projection.v1,
routinika-reminder-projection.v1, and
versicherungsmanager-deadline-projection.v1.
See Read-only projection contracts and the
German companion.
sqlite-transit-sync verify-projection \
--contract mediplaner-reminder-projection.v1 \
--database ./closed-projection.sqlite \
--consumer-id reminder-consumer \
--minimum-offline-seconds 2592000 \
--previous-checkpoint 41python -m pip install -e .Create a config on every node. Each node uses its own database and state file, but the same transit directory and namespace.
sqlite-transit-sync init \
--config node.json \
--database ./app.db \
--transit ./shared-transit \
--node-id laptop \
--namespace my-app
sqlite-transit-sync push --config node.json
sqlite-transit-sync pull --config node.json --dry-run
sqlite-transit-sync pull --config node.json
sqlite-transit-sync status --config node.json
sqlite-transit-sync verify --config node.json
sqlite-transit-sync cleanup --config node.json
# Review the JSON plan, then explicitly apply it:
sqlite-transit-sync cleanup --config node.json --applyThe application schema must already exist on each node. Automatic first-copy is intentionally disabled because a generic module cannot decide which schema, secrets, local tables or migrations belong to an application.
Developers integrating sqlite-transit-sync directly into agent frameworks, daemons, or background workers can run this self-contained, copy-pasteable script to verify end-to-end multi-node synchronization with zero external dependencies:
import sqlite3
from contextlib import closing
import tempfile
from pathlib import Path
from sqlite_transit_sync import SyncConfig, TransitSync
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
transit = root / "transit"
transit.mkdir()
# 1. Initialize Node A and record local data
db_a = root / "node_a.db"
with closing(sqlite3.connect(db_a)) as conn, conn:
conn.execute("CREATE TABLE notes (id INTEGER PRIMARY KEY, title TEXT, updated_at TEXT)")
conn.execute("INSERT INTO notes VALUES (1, 'Hello from Node A', '2026-10-18T08:00:00Z')")
# 2. Publish atomic snapshot from Node A to shared transit
cfg_a = SyncConfig(database=db_a, transit=transit, state=root / "state_a.json", node_id="node_a", namespace="demo")
snapshot = TransitSync(cfg_a).push()
print(f"Node A published snapshot: {snapshot.path.name} (SHA-256: {snapshot.sha256[:8]}...)")
# 3. Initialize Node B with schema and pull snapshot
db_b = root / "node_b.db"
with closing(sqlite3.connect(db_b)) as conn, conn:
conn.execute("CREATE TABLE notes (id INTEGER PRIMARY KEY, title TEXT, updated_at TEXT)")
cfg_b = SyncConfig(database=db_b, transit=transit, state=root / "state_b.json", node_id="node_b", namespace="demo")
reports = TransitSync(cfg_b).pull()
# 4. Verify converged state in Node B
with closing(sqlite3.connect(db_b)) as conn, conn:
rows = conn.execute("SELECT id, title, updated_at FROM notes").fetchall()
print(f"Node B converged records: {rows}")
assert rows == [(1, "Hello from Node A", "2026-10-18T08:00:00Z")]{
"database": "./app.db",
"transit": "./shared-transit",
"state": "./node-state.json",
"node_id": "laptop",
"namespace": "my-app",
"timestamp_columns": ["updated_at", "modified_at", "created_at"],
"exclude_tables": ["secrets", "sqlite_sequence"],
"snapshot_exclude_tables": ["secrets"],
"scan_snapshot_for_secrets": true,
"secret_scan_skip_tables": [],
"secret_scan_extra_patterns": [],
"secret_patterns_file": null
}Relative paths are resolved from the config file. The live database must never
be located inside the transit directory, and the state file must be outside the
transit tree. SyncConfig, from_file, from_bytes and CLI init reject an
invalid state path before creating transit or state directories; no migration is
performed automatically.
Applications that need an audit hash for exactly the parsed configuration can read the bytes once and use the same source-relative parser without a second file read:
import hashlib
from pathlib import Path
from sqlite_transit_sync import SyncConfig
config_path = Path("node.json").resolve()
payload = config_path.read_bytes()
config = SyncConfig.from_bytes(payload, source_path=config_path)
config_sha256 = hashlib.sha256(payload).hexdigest()| Key | Default | Meaning |
|---|---|---|
database |
(required) | Live SQLite database owned by this node |
transit |
(required) | Shared directory carrying snapshots and manifests |
state |
./.sync-state.json |
Per-node pull state; keep it out of the transit |
node_id |
machine hostname | Identifies the publishing node in snapshot names |
namespace |
"default" |
Separates unrelated datasets in one transit |
timestamp_columns |
["updated_at","modified_at","created_at"] |
Columns consulted for last-write-wins |
exclude_tables |
["secrets","sqlite_sequence"] |
Tables never merged into the local database |
snapshot_exclude_tables |
["secrets"] |
Tables whose rows are deleted from the snapshot before publication (then VACUUM) |
scan_snapshot_for_secrets |
true |
Abort publication when snapshot content still looks like a credential |
secret_scan_skip_tables |
[] |
Tables the scan ignores — use for a single noisy table instead of disabling the scan |
secret_scan_extra_patterns |
[] |
Additional regexes, on top of the trigger file |
secret_patterns_file |
null (bundled file) |
Path to your own trigger file; replaces the built-in patterns |
key_file |
null, else $SQLITE_TRANSIT_SYNC_KEY_FILE |
Fernet key for Republica mode; must stay outside the transit |
republica_root |
~/.republica |
Where imported showcases are written; must stay outside the transit |
allow_key_in_synced_folder |
false |
Waives the check that refuses a key inside a cloud-sync folder |
The state default in this table applies when a JSON configuration is loaded
without that key. sqlite-transit-sync init instead writes
.<config-stem>-state.json when --state is omitted (for node.json:
.node-state.json).
The active scanner binds main.table_list, table_xinfo, index_xinfo and
sqlite_schema (including schema DDL, triggers, view definitions, ordinary
table columns, generated values and implicit rowids). Expression indexes and
opaque BLOB encodings fail closed. Untyped TransitSync.push() rejects all
virtual and shadow tables ([virtual-or-shadow]). For untyped
RepublicaTransit (fts_contract=None), verified external-content FTS5
(content=<ordinary_table>) is admitted only after prototype shadow-layout
verification, base-table non-redaction, FTS config scanning and FTS5
'integrity-check' against stale or orphaned index tokens; internal,
contentless and FTS3/4 tables still fail closed unless explicit scan_snapshot_for_secrets=false
opt-out or typed format-2 FTS5 contracts are used.
snapshot_exclude_tables can only drop a table you already anticipated. The scan
answers the question that rule cannot: did a credential end up pasted into a
free-text column — a note, a log line, a session summary? It runs on the snapshot
copy after redaction and before publication. On a match it raises SyncError
naming table.column; the matched value is never included, so the credential does
not travel into logs, tracebacks or CI output. The partial snapshot is discarded,
so nothing reaches the transit directory.
Preparation and publication boundary: Raw backups, redaction and scanning run in a per-call temporary directory under the configured local-state parent, outside the canonical transit. Republica also prepares its plaintext SQL/gzip there and encrypts before copying anything to transit. Keep that state parent local, private and outside shared/synchronized folders; other sync roots and processes using the same OS account are outside this guarantee. The optional pattern scan is not complete secret detection.
Only checked snapshot bytes (ordinary push) or ciphertext (Republica) are copied into an exclusively created transit temporary file, verified by size/hash, then renamed within that target filesystem. The manifest follows; the file pair is not one atomic transaction. Private cleanup errors propagate. Crashes may leave private workspaces; there is no secure-erasure or automatic cleanup of historical/foreign artifacts.
Turning it off is a legitimate choice, not a workaround. If your transit is a storage location you control and trust — your own server, an EU-hosted volume under your contract, an encrypted removable drive — and you want credentials to travel with the data, then set:
{ "scan_snapshot_for_secrets": false }Prefer secret_scan_skip_tables when only one table produces false positives:
keeping the scan on everywhere else is worth more than silencing it globally.
Patterns live in data, not code — sqlite_transit_sync/credential-triggers.json —
so detection can be tightened over time without waiting for a release:
{
"version": 1,
"patterns": [
{ "name": "github", "regex": "gh[pousr]_[A-Za-z0-9]{16,}", "prefilter": "gh" },
{ "name": "acme-internal", "regex": "ACME-[0-9]{4}", "prefilter": "ACME-" }
]
}prefilteris an optional literal used as a cheap SQLLIKEpre-filter so large snapshots stay fast. It must appear in every value the regex can match, otherwise findings are missed. Omit it when no such literal exists — the scanner then reads the column in full for correctness.- Point
secret_patterns_fileat your own copy to replace the defaults entirely, or usesecret_scan_extra_patternsto add to them.
Patterns are deliberately vendor-prefixed. A generic "long hexadecimal string" rule would flag checksums, UUIDs and git SHAs, which are legitimate database content — and a scanner with a high false-positive rate gets switched off, which protects nothing. Treat a clean scan as "no known pattern matched", never as "this snapshot is free of secrets".
The scan can stop publication when a configured pattern matches; it does not guarantee that every credential will be detected, and it does not distribute credentials. If your actual problem is "my machines need the same passwords or API keys", this module is the wrong tool — and so is any document-sync folder. Consider a purpose-built secrets tool and review its deployment and trust model:
| Approach | Good for | Notes |
|---|---|---|
| Vaultwarden (self-hosted Bitwarden) | humans + CLI on several machines | Runs on a small always-on box; reach it over a private network (WireGuard, Tailscale) instead of exposing it. Official Bitwarden clients, browser extensions and the bw CLI work against it, so scripts and agents can fetch secrets too. |
| SOPS + age | secrets that belong next to code | Encrypted files are safe to commit and safe to put in any sync folder, because only ciphertext travels. Per-recipient keys, works well with git review. |
pass (GPG) + git |
Unix-minded single users and small teams | One file per secret, ordinary git remote, no server at all. |
| KeePassXC database over Syncthing | no server, no cloud account | Peer-to-peer file sync; the vault itself stays a single encrypted file. |
| Infisical / OpenBao (Vault fork) | teams, machine identities, rotation | Real secret servers with audit logs and dynamic credentials — more moving parts than a household needs. |
| Platform-native stores | one machine, one app | macOS Keychain, Windows DPAPI/Credential Manager, systemd-creds, or your CI's secret store. No sync, but no exposure either. |
Whichever you choose, the split that matters is the same: one channel for data, another for credentials. This module can block a snapshot when a configured pattern matches; it cannot guarantee that every secret is detected.
Each machine puts an encrypted showcase of its database into a shared file area. Every other machine can look at it; none can change it. Hence the name — a re-publication of a database, readable only by whoever holds the key.
Use Republica when push/pull does not fit: you want to read another node’s data without merging it into your rows, or the machines share only a folder—no server, open ports or dedicated peer tunnel for Republica itself, although a shared Fernet key is still required—and the folder must not see your content in the clear.
With the same SyncConfig, push/pull and Republica use the same configured transit path. push/pull publish snapshots and merge them into the local database; Republica publishes encrypted replicas beneath a per-node subdirectory in that transit and imports them as separate read-only databases under republica_root. It changes encryption and merge behavior, not the transport.
| Condition | File-transit sync (push/pull) |
Republica |
|---|---|---|
| A peer machine is offline | A node can publish while peers are offline; pull can merge snapshots already in transit. New data waits until its source node publishes. |
A publisher can stage an encrypted replica for later import. Data from an offline source likewise waits for publication. |
| VPN/SSH tunnel unavailable | Requires the configured file path to remain reachable; push/pull do not open peer tunnels. |
Same transit dependency; VPN/SSH matters only if it makes the configured path unavailable. |
| Configured transit unavailable | Cannot publish or retrieve through an unavailable configured path. | Same; Republica has no alternate transport. |
| Key rotation or trust setup pending | HMAC is optional. If an authenticator is configured, its key/trust setup must match; without it, SHA-256 checks integrity but does not authenticate the sender. | Publishing and importing require the compatible shared Fernet key; rotations must be coordinated. |
| No application-specific merge policy is configured | Uses the configured MergePolicy, or timestamp LWW by default; choose a domain-specific policy if that default does not fit. |
Imports a separate read-only database and does not merge rows. |
Republica is useful when encrypted, separate read-only copies are needed. It does not provide transport failover; that would require separately configured, independently available transit paths.
The shared key must reach the other machines through some channel that is not the transport itself — an existing encrypted tunnel, a password manager, a USB stick, reading it out over the phone. Once. After that a plain shared folder is enough, forever, even one you do not trust.
republica_root/
laptop/my-app.sqlite <- read-only showcase of laptop's database
workstation/my-app.sqlite <- read-only showcase of workstation's database
# Once per key, on local disk - never inside the transit, never in a synced folder.
# Then copy this file to the other machines out of band; do NOT run keygen there.
sqlite-transit-sync keygen --key-file ~/.keys/republica.key
sqlite-transit-sync init --config node.json \
--database ./app.db --transit ./shared-transit \
--node-id laptop --namespace my-app \
--key-file ~/.keys/republica.key
sqlite-transit-sync republica-publish --config node.json # encrypt and publish
sqlite-transit-sync republica-list --config node.json # what other nodes offer
sqlite-transit-sync republica-import --config node.json # materialise them locallyRequires the optional cipher: pip install 'sqlite-transit-sync[crypto]'.
What travels is not a database file but a curated SQL dump, gzip-compressed and
Fernet-encrypted. On a real 53.6 MB knowledge database that is 11.0 MB in transit, because
full-text index internals are rebuilt on arrival instead of shipped (35370 of 49636 dump
statements). The publication passes the same gate as a merge snapshot — redaction,
credential scan, quick_check, manifest.
What it protects: the transport sees ciphertext, and Fernet's HMAC detects deliberate modification even when the manifest hash was recomputed to match.
What it does not: Fernet authenticates the key, not the sender — anyone holding it
can publish a valid snapshot. That is exactly why a replica is kept separate and never
merged. Keep the key out of the transport: a key inside the transit directory is refused,
and so is one in a folder that looks synchronised (override with
allow_key_in_synced_folder). The same rule applies to republica_root — a decrypted
replica inside the transit would be redistributed in the clear.
Limit: a full-text index without its own content (content='') cannot be rebuilt,
because there is nothing to rebuild it from. Such tables are reported in the manifest as
contentless_fts instead of arriving silently empty.
The bootstrap problem: two machines share no secure channel yet, and that is exactly why a credential has to cross. The same key and the same folder can carry a single encrypted file.
sqlite-transit-sync envelope-send --config node.json --file ./api-token.txt --label api-token
sqlite-transit-sync envelope-receive --config node.json --into ~/credentialsThe file arrives as a file (mode 0600), named <source-node>__<filename>, and never
enters a database — a secret in a database gets copied onward by every backup, index and
sync that touches it. Notes should record where a secret lives, never the secret.
Two showcase rules are inverted on purpose: the credential scan does not apply (it would block the very payload being moved), and the envelope is removed from the transit after receipt, so a secret does not linger in a shared folder. Unsealing into the transit or into a folder that looks cloud-synced is refused, and the filename is re-sanitised on arrival so a crafted manifest cannot write outside the target directory.
This is a courier, not a password manager and not file sync — keep envelopes few and small.
from sqlite_transit_sync import SyncConfig, TransitSync
sync = TransitSync(SyncConfig.from_file("node.json"))
snapshot = sync.push()
pending = sync.pending()
selected_reports = sync.pull_selected([pending[-1].path.name]) if pending else []
reports = sync.pull()
cleanup_plan = sync.cleanup()
print(
snapshot.sha256,
[report.as_dict() for report in reports],
[report.as_dict() for report in selected_reports],
cleanup_plan,
)pull_selected() accepts only explicitly named snapshots that are currently pending and reuses
the same verification, merge and state gates as pull(). A thin lifecycle adapter can therefore
choose one eligible snapshot without copying the carrier's data mechanics.
An integrating application can describe keys with non-secret
HMACKeyReference values. load_hmac_authenticator() obtains the bytes only
through an injected SecretResolver; OSKeyringSecretResolver is an optional,
lazy adapter for the separately installed keyring package. JSON config and
the CLI never carry key material:
from sqlite_transit_sync import (
HMACKeyReference,
OSKeyringSecretResolver,
load_hmac_authenticator,
verify_authenticated_snapshot,
)
auth = load_hmac_authenticator(
[HMACKeyReference(
key_id="node-a-v2",
service="ellmos-ocean-transit",
account="node-a-v2",
sender="node-a",
)],
active_key_id="node-a-v2",
resolver=OSKeyringSecretResolver(),
trusted_senders={"node-a"},
)
snapshot = verify_authenticated_snapshot(
manifest_path,
snapshot_path,
authenticator=auth,
)The reference adapter uses shared-key HMAC-SHA256, not non-repudiating public
signatures. Its canonical payload covers protocol, namespace, node, snapshot
name, SHA-256, size, redaction list and the algorithm/key/sender/trust-source header. Keep
old keys in the verifier key ring during rotation. A configured verifier rejects
missing, malformed, foreign or mismatched signatures. The explicit preflight
also rejects missing files and SQLite sidecars before hashing; it never opens
SQLite, merges rows, or reads/writes sync state. Its success authenticates the
named file bytes, not their SQLite schema or application semantics.
TransitSync(..., authenticator=auth) remains available for existing callers;
an already-pulled replay is a state-backed no-op, not a freshness guarantee. An
unconfigured reader makes no authenticity claim. Freshness and key storage
remain application concerns.
For applications that need deletions, call ensure_tombstone_table() during
their own schema setup and use TombstoneMergePolicy. The reserved table stores
table_name, a canonical JSON array of primary-key values, and deleted_at as
the deletion version. A tombstone wins ties and older rows; a later row timestamp
may resurrect the key. The adapter never infers deletion from a missing row and
never prunes tombstones, so retention must cover the maximum offline interval.
Unknown tables and schema mismatches are left protected or fail closed; no
automatic migration is attempted.
Pass an object implementing MergePolicy.merge(local, remote, snapshot) to
TransitSync when timestamp LWW is not sufficient.
Retention is explicit and dry-run by default. It never infers deletion from a
filename: only a verified snapshot in the configured namespace, owned by the
current node, no longer pending, and accepted by the caller's acknowledge
callback can be eligible. Foreign, unknown, incomplete, unverified and
unacknowledged artifacts are retained. Age boundaries are strict (age > max_age); keep_latest and max_age may be combined.
from datetime import timedelta
from sqlite_transit_sync import SnapshotRetentionPolicy
policy = SnapshotRetentionPolicy(
max_age=timedelta(days=30),
keep_latest=3,
acknowledge=lambda snapshot: application_has_acked(snapshot),
)
report = sync.apply_retention(policy, dry_run=True, audit_path="retention-report.json")
# Apply only after reviewing exact planned paths and reasons:
report = sync.apply_retention(policy, dry_run=False, audit_path="retention-report.json")The mutation re-reads and verifies every planned pair, deletes only its exact snapshot and manifest, records errors without broad cleanup, and is safe to repeat. Sidecars and incomplete artifacts stay retained. This is a neutral core contract, not a BACH retention adapter.
Before any BACH compatibility adapter, run the committed synthetic comparison:
python scripts/compare_bach_golden.py --output golden/bach_compatibility_report.jsonThe seven fixtures cover closed backup, manifest/integrity failure,
redaction/credential abort, timestamp/schema merge, pull acknowledgement,
rollback and retention ownership. The report intentionally remains
blocked_no_authorized_bach_golden until an authorized BACH reference result
exists for every scenario; no adapter or compatibility claim follows.
- Never open a live SQLite database from a network or cloud-sync folder.
- Keep per-node state outside the shared transit; invalid equal/child paths are rejected before any directory or state write.
- Manifest reads accept one relative snapshot filename only; path containment and link/reparse checks happen before SHA-256, SQLite verification or merge.
- SHA-256 detects corruption but does not authenticate a hostile transport.
- HMAC authentication is optional shared-key identity checking, not a key distribution service, freshness protocol or public-key signature.
- Default LWW assumes comparable timestamps and does not infer deletions.
- Tombstone retention, clocks, key storage and application migrations remain integration responsibilities.
- Equal timestamps converge through a deterministic content tie-breaker; this is a technical fallback, not a substitute for domain conflict rules.
- Tables without a primary key or timestamp column are skipped.
- Snapshot redaction deletes listed tables and VACUUMs the snapshot, but it must still list every table containing credentials or private data; the generic module cannot discover domain secrets reliably.
- Application migrations, clock policy, retention parameters and conflict semantics stay
with the integrating application.
cleanupsupplies only the mechanism: it verifies every pair, performs a dry-run by default, keeps the newest ten snapshots per node, and manages foreign nodes only when--all-nodesis explicit. - Run only one sync process per node unless the host application adds a process lock.
See ARCHITECTURE.md, README_de.md and SECURITY.md.
sqlite-transit-sync is a local-first SQLite synchronization package. It exchanges snapshots through a configured filesystem transit path; host, mount and transport behavior are outside this module. Core operations have no external runtime dependencies.
- Zero Runtime Dependencies: The core synchronization engine requires only the Python Standard Library (
>=3.10). - Optional Showcase Layer: The Republica encrypted showcase mode optionally utilizes
cryptography(Apache-2.0 / BSD-3-Clause). Optional OS keyring HMAC lookup useskeyring(MIT). - Inventory Record and Security Policy: The project-maintained inventory records MIT, Apache-2.0, BSD-3-Clause and PSF license identifiers and a record date of 2026-10-02; this is not an independent audit or certification. INV-SLA-10 points to the security reporting policy (48-hour acknowledgment and 5-business-day triage); runtime permissions follow the invoking process, with no built-in privilege enforcement.
- Project-Maintained License Inventory: The repository records package-license identifiers and license texts in THIRD_PARTY_LICENSES.md. This record is not an independent audit or certification.
- Formal Attribution: Legal attribution notice is recorded in NOTICE.
sqlite-transit-sync is part of the ellmos-ai and open-bricks local-first software ecosystem. Together with its sister repositories, it forms a modular suite for resilient, offline-first development, documentation, and agent orchestration:
| Repository | Focus / Domain | Description |
|---|---|---|
| dev-bricks/sync-master | File Sync Yard | Robust local-first file transport companion (sync.files) powering transit zones. |
| ellmos-ai/policy-registry | Policy Registry | Cryptographic policy evaluation and capability-bound agent execution. |
| ellmos-ai/system-gap-master | System Topology | System drift inspection, sync yard health auditing, and topology validation. |
| ellmos-ai/lock-master | Lock Management | Multi-agent concurrency coordinator with cooperative locking and deadlock detection. |
| ellmos-ai/ticket-master | Task Tracking | Local-first ticket and milestone tracking without external server dependencies. |
| ellmos-ai/clutch | Process Bridge | Subprocess management, stdio isolation, and process supervision for LLM tools. |
| ellmos-ai/memoryhooker | Long-Term Memory | Persistent memory and context hooks for LLM interactions. |
| ellmos-ai/workflowhooker | Workflow Automation | Event-driven pipeline interception and automated lifecycle hooks. |
| ellmos-ai/ellmos-controlcenter-mcp | Control Center MCP | Unified orchestration gateway for tools, models, stacks, and subagents. |
| ellmos-ai/ellmos-filecommander-mcp | File Commander MCP | Safe, hardened file system operations with audit logs and boundary enforcement. |
| ellmos-ai/ellmos-codecommander-mcp | Code Commander MCP | High-level code analysis, AST transformations, and import diagnostic MCP server. |
| dev-bricks/automation-master | Automation Engine | Local event-sourced automation pipeline with projection-based execution. |
| dev-bricks/DevCenter | Developer Cockpit | Desktop GUI for managing projects, environments, and multi-repo workflows. |
| dev-bricks/CodeBox | Code Management | Local-first code library and AST pattern index. |
| doc-bricks/PDFtoPDFocr | Document OCR | Searchable PDF conversion with an OCR layer; this guide does not assess its network or privacy behavior. |
| open-bricks/open-bricks | Umbrella Hub | Meta-repository and umbrella documentation for all open-source bricks. |
| ellmos-ai/coma | Agent job and process lifecycle | Manages local job files and starts or checks agent process status; a separate concern from SQLite snapshot verification and row-level merge. |
Generated discovery projection for module:sqlite-transit-sync from catalog:v4-bundles (546290dafbaafd810df1d59ef5a3d7183738472b48cd5a8a81f1e8f2b64d852e).
Target repository visibility: public. Bundle manifests remain the membership authority; this section does not install or activate components.
Discovery approval: public module-registry record, explicit default-deny bundle allowlist.
- Bundle recipe visibility:
private; role:declared-component; requirement:recommended. - module partners:
module:cloud-safe-exporter,module:direct-beam,module:receipt-validator,module:sync,module:system-explorer-export,module:system-gap-master. - skill partners:
skill:agent-config-sync,skill:mcp-config-sync,skill:system-onboarding.
Composition and runtime details are intentionally omitted.
For AI agents, LLMs, and automated tools, a structured sitemap and API index is available at llms.txt.
python -m unittest discover -s tests -v
python -m pytest -q -ra
python -m pytest --collect-only -qThe suite uses only synthetic databases and temporary transit directories. The CLI help, retention contract, golden comparison and JSON init/status/push/list/verify/pull smoke are part of the verified test collection; no live database, BACH runtime or external transport is used.
Dieses Open-Source-Softwareprodukt wird als unentgeltliche Schenkung im Sinne der §§ 516 ff. BGB bereitgestellt. Gemäß § 521 BGB ist die Haftung des Urhebers und der Beitragenden auf Vorsatz und grobe Fahrlässigkeit beschränkt. Ergänzend gelten die nachstehenden Haftungsausschlüsse der MIT-Lizenz.
Nutzung auf eigenes Risiko. Keine Wartungsverpflichtung, keine Verfügbarkeitszusicherung, keine Gewähr für Fehlerfreiheit oder Eignung für einen bestimmten Einsatzzweck.
This project is an unpaid open-source donation. In accordance with § 521 of the German Civil Code (BGB), liability is restricted strictly to cases of intentional misconduct and gross negligence. Supplemental liability disclaimers are set forth in the MIT License below.
Use entirely at your own risk. No maintenance commitments, no availability guarantees, and no warranties regarding fitness for any particular purpose.
Distributed under the terms of the MIT License.
Copyright (c) 2026 Lukas Geiger. See LICENSE and NOTICE for full details.
The project-maintained third-party dependency/license inventory and plain-text copy are in THIRD_PARTY_LICENSES.md and THIRD_PARTY_LICENSES.txt.
Extracted in 2026 from BACH system/hub/db_sync.py (ProSync). The standalone
module replaces BACH-specific paths, handlers, secrets and table assumptions
with configuration and policy interfaces. It also merges per primary key and
adds verified manifests.
Applications requiring direct FTS5 snapshot synchronization, observed row-level
merging or typed encrypted replicas can pass keyword-only fts_contract=FtsSnapshotContract(...),
optional fts_limits=FtsReceiveLimits(...) and fts_merge_contract=FtsMergeContract(...)
to TransitSync / RepublicaTransit (with HMACSnapshotAuthenticator). Private
staging revalidates paths, identities and key containment across preparation and
publication, retires absent SQLite sidecars at verified closed=True boundaries,
and preserves binary input bytes on Windows (O_BINARY). See ARCHITECTURE.md
and DECISIONS.md for full contract semantics.
