Skip to content

Compose task rules: on a date or when something happens - #601

Merged
clstaudt merged 6 commits into
mainfrom
task-rules
Oct 23, 2026
Merged

clstaudt merged 6 commits into
mainfrom
task-rules

Conversation

@clstaudt

Copy link
Copy Markdown
Contributor

Relates to #502 and #597. Builds on the idea in #598 (configurable contract-end and overdue reminders).

What

  • Rules make the tasks. The Tasks view gets a Tasks | Rules switch. A rule is either on a date (once or repeating) or when something happens to a contract, project, invoice or financial goal: before, on or after one of its dates, or when its status changes. The trigger reads as one sentence, and a live preview shows the tasks the rule makes today and the next one.
  • Events come from the records. tuttle/app/tasks/rules.py lists each record's dates and the statuses Tuttle already shows (project board stage, contract and invoice status); the 20 events derive from that.
  • Statuses. Open ones (overdue, lead, offer, agreed) include records already in them. Final ones (paid, cancelled, completed, reached) only count records that reach them after the rule is made, so a "thank them for paying" rule doesn't make a task for every old payment. A status change has no date, so the rule notes the day it first sees one (TaskRuleNotice).
  • No floods. A repeating rule makes one task, for its latest day. Contract and project dates before the rule was made are left alone. A task closes itself when it's no longer worth doing (invoice paid, contract completed).
  • Built-in rules. The overdue-invoice task and a heads-up 30 days before a contract ends are now ordinary rules every user starts with, to edit, pause or delete. The migration moves existing overdue tasks over with their status. Getting-started tasks stay built in.
  • Tasks show their date, link to their record and to the rule that made them. The sidebar counts pending tasks. Harry's demo data has rules of each kind.
  • Speed. Task generation loads each kind of record once per pass: 3.2 s → 0.2 s with 56 rules on the demo data.

Screenshots

Tasks made by rules

tasks

Rules

rules

New rule: when something happens

composer, event

On a date Light and dark
composer, date composer, dark
Open status: overdue invoices already out count Final status: from today
open status final status

Checks

1090 tests pass, 196 of them new: the rule engine; the composer's RPC calls with the UI's exact payloads on the demo database; and a simulation that runs a rule for every event over two years of days, checking that no task comes early, twice, or back after it was done, and that a second pass on the same day changes nothing. tsc passes. Drove the app with Playwright on a scratch demo install: creating, editing, pausing and deleting rules, every preview, links to records, dark mode and a narrow window, with no console errors. Upgraded a copy of an existing dev database.

🤖 Generated with Claude Code

clstaudt and others added 2 commits October 16, 2026 06:58
Tasks now come from rules people compose in the Tasks view instead of
fixed code: on a date (once or repeating), or around a contract, project,
invoice or financial goal, before, on or after one of its dates, or when
its status changes. Each record declares its dates and the statuses
Tuttle already shows, and the events derive from that.

The overdue-invoice task and a heads-up before a contract ends become
built-in rules that can be edited, paused or deleted; existing overdue
tasks keep their status. Getting-started tasks stay built in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clstaudt clstaudt self-assigned this Oct 16, 2026
@clstaudt
clstaudt requested a review from aaronspring October 16, 2026 05:07
@clstaudt
clstaudt marked this pull request as ready for review October 16, 2026 17:12
clstaudt and others added 4 commits October 23, 2026 23:42
Harry's task rules move into the revised demo data, as
create_demo_task_rules beside the other demo builders. The Tasks view
takes today's date from main's localDateIso instead of its own copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contracts no longer default to one (#629).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clstaudt
clstaudt added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit f6f637e Oct 23, 2026
3 checks passed
@clstaudt
clstaudt deleted the task-rules branch October 23, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contract end and invoice overdue task reminders with configurable lead times

1 participant