Database Schema
CommitT’s database schema (backend/convex/db/schema.ts) is designed for absolute enforcement. It relies on immutable snapshots and time-locked vaults to prevent users from escaping their commitments.
The Instance-Dependent Architecture
Unlike standard to-do apps, a “Task” in CommitT is just a template. The real enforcers are Task Instances (taskInstances). When a task is created, the backend generates instances for the next 365 days.
tasks Table
The master template. Contains the recurrence schedule, global strict mode lock, and the master accountability contract.
taskInstances Table
The temporal execution units. Contains the specific start/end epochs, verification checkpoints, and snapshotted rules.
Immutable Rule Snapshots
When an instance is generated, thepenalty and penalty_waiver rules from the parent task are snapshotted (copied) onto the instance.
Why? To prevent retroactive manipulation.
If a user commits to a ₹500 penalty, fails the task, and then quickly edits the parent task to reduce the penalty to ₹10, the instance retains the original ₹500 rule. The punishment contract cannot be changed after the fact.
The Steel Vault (Strict Mode)
Strict Mode is the ultimate self-binding mechanism.Implementation
- Master Rule: The
taskstable stores astrict_untiltimestamp. Any future generation cycles will respect this. - Instance Locking: Every existing future instance within the timeframe is individually patched with
strict_until = instance.end.
Enforcement
The backend strictly rejects any mutation or deletion of an instance as long asDate.now() < strict_until. The user voluntarily surrenders control.
Central Asset Registry
All binary assets (penalty photos, videos, PDFs) are managed in a singlefiles table.
- Unified Security: Enforces ownership and ACLs in one place.
- Performance: Single index for “User’s Recent Activity” across all media types.
- Direct URLs: When a penalty with a photo is created, the backend resolves the permanent public HTTPS URL and embeds it in the config, saving the client an extra
getUrl()call on load.
Accountability Presets
The database acts as a persistent memory of a user’s commitment style via theaccountabilityPresets, locationPresets, and digitalCommitmentPresets tables.
- Decoupled: Penalty configurations survive even if tasks are deleted.
- Zero-Friction: New tasks can be “pre-armed” with the user’s usual contract.
- Smart Pre-fill: Tracks
last_used_at(recency) andusage_count(popularity) to suggest the most likely settings to the user.