-
Notifications
You must be signed in to change notification settings - Fork 11
09 Consequence System
Vicky Patel edited this page Sep 14, 2026
·
1 revision
Architectural specification for the commitment state machine and consequence resolution engine.
stateDiagram-v2
[*] --> Active: Task Sealed with Commitment
Active --> Completed: Proof Verified / Marked Complete (Before Deadline)
Active --> Breached: Deadline Expired (deadline_at < NOW())
Breached --> Activated: Sweeper Cron Activates Consequence
Active --> Waived: Waiver Approved (Grace Period)
Activated --> Resolved: Consequence Reflection / Penalty Fulfilled
Completed --> [*]
Resolved --> [*]
Waived --> [*]
-
Active: The commitment is live. The user has until
deadline_atto complete the task or submit proof of work. - Completed: The task was successfully completed before deadline expiration. Streak multipliers increment.
-
Breached: The deadline expired without completion. Evaluated server-side by
/api/cron/sweep-deadlines. -
Activated: The consequence payload is unmasked and activated (
is_activated = true). Notifications are dispatched. -
Waived: A grace period waiver request (
commitment_waivers) was approved with valid justification. - Resolved: The activated consequence penalty has been fulfilled by the user.
| Consequence Type | Payload Structure | Execution Details |
|---|---|---|
written_reflection |
{ prompt: string, minWords: number } |
Mandates a structured post-mortem reflection before unlocking new task creation. |
public_declaration |
{ message: string, channel: string } |
Dispatches an automated breach announcement to linked notification channels. |
emergency_task |
{ title: string, durationMinutes: number } |
Injects an immediate high-priority recovery task into the user's daily planner. |
financial_pledge |
{ pledgeCents: number, charityId: string } |
Records a financial penalty transaction logged against the user's discipline ledger. |
- Automated 1-minute cron job scans PostgreSQL for expired commitments:
SELECT * FROM commitments WHERE status = 'active' AND deadline_at < NOW();
- Expired commitments transition status to
breached, settasks.status = 'missed', and executeconsequences.is_activated = true. - Dispatcher pushes deadline breach alerts to user notification channels.
| 🏛️ Project Hub | 🛠️ Developer Docs | 💬 Community & Support |
|---|---|---|
| GitHub Repository | System Architecture | GitHub Discussions |
| Beginner Issue Catalog | Design System | Open Issues |
| Production Deployment | API Reference | Pull Requests |
| Project Roadmap | Testing & QA Matrix | Maintainer Governance |
- Codebase Tour
- Domain Model
- Database Architecture
- Security Model
- Financial System
- Consequence System
- External Integrations
- Discipline Intelligence
- Data Portability & Sync