The prompts used to arrive at this change since the previous commit User reported the Dynamisch kwartaal Roundcube filter is empty and asked for a new file containing a dynamic invoice-quarter filter while keeping the rest of the plan approved. Any special observations that may be relevant for version management for this version. Be brief. invoice_dynamic_quarter.sieve uses Date header year capture plus regex month tests and compiles with sievec. Existing untracked financ.sieve, codex.session, roundcube.txt, plan.md, and verplaats_log.json were left untouched.
5.4 KiB
Restart Prompt
You are continuing the mailcat project in /Users/hanswienen/Documents/Development/Vibes/mailcat.
Current Goal
The real hans mailbox has been completely reordered, and Roundcube/Managesieve filters have been uploaded for ongoing incoming-mail sorting. The Python live sorter and web route-management interface are no longer needed.
The repository is intentionally reduced to the minimum tooling needed to:
- Repeat folder creation and historical reordering if needed.
- Keep/generate the Roundcube Sieve policy.
- Continue unsubscribe work.
- Run the daily report.
Do not run mailbox-affecting scripts yourself unless the user explicitly authorizes it. The user prefers to run those scripts personally.
Collaboration Rules
- Follow the git workflow from
AGENTS.md. - Before making file, code, or configuration changes, present a plan and wait for explicit approval.
- Work on branch
codexunless the user says otherwise. - Before every commit, rewrite this file from scratch as the current reconstruction prompt.
- Commit after each user-prompted code change using the required three-section commit message format.
- Keep runtime logs/state files unless the user explicitly says to delete them.
- Do not commit credentials.
Kept Files
Core configuration and IMAP helpers:
config.pyimap_utils.pyconfig.jsonis local-only and ignored; it contains account credentials.
Routing/reorder policy:
mail_routes.pydomain_routes.jsonmailinglist_routes.jsonmaak_mappen.pyverplaats_bestaand.py
Roundcube/Sieve:
mailcat_roundcube.sieveroundcube.txtis local-only user export/test evidence and should not be treated as production policy.
Unsubscribe:
unsubscribe.pydecisions.jsonunsubscribe_log.jsonis runtime state and should not be committed unless the user explicitly asks.
Daily report:
dagelijks_overzicht.pytests/test_dagelijks_overzicht.py
Logs/state kept:
backup_log.jsonverplaats_log.jsonverplaats_log_voor_aiwijzigingen.jsonverplaats_bestaand.logunsubscribe_log.json
Current Behavior
Roundcube/Sieve:
mailcat_roundcube.sieveis the generated Roundcube/Managesieve Sieve file for the current routing setup.invoice_dynamic_quarter.sieveis a standalone Roundcube/Managesieve Sieve file containing only the dynamic invoice-quarter rule. It uses the messageDateheader to setjaar, regex month tests to setkwartaal, then files intoINBOX.Financieel.Facturen.${jaar}.${kwartaal}.- It uses
INBOX.-prefixed mailbox names because the user's Roundcube export usedfileinto :copy "INBOX.Notes";. - It includes
Afmelden.*routes and usesfileintowithout:copy, so matching incoming messages are sorted instead of duplicated. - Rules have Roundcube-compatible
# rule:[...]names. - Financial rules are first; the invoice rule remains one dynamic quarter rule, then remaining financial rules and all other rules are alphabetically ordered by rule name.
- Duplicate destination names are disambiguated with
/ Mailing-listor/ Domainsuffixes.
Daily report:
dagelijks_overzicht.pybuilds an HTML digest for a selected date, defaulting to yesterday.- It supports
--accountand--mail-to. - It searches sorted folders, excluding inbox/system/archive/technical folders.
- It sends an HTML email via SMTP.
- Report rows fetch
Message-IDand render the subject as an Apple Mailmessage://link when aMessage-IDis present. - Apple Mail links are macOS-oriented and depend on Apple Mail having the message synced/indexed locally.
- Report HTML escapes folder labels, senders, subjects, and link attributes.
Historical reorder:
verplaats_bestaand.pydefaults to dry-run. Real moves require--uitvoerenand interactiveJA.- Account selection is explicit with
--account <naam>, for example--account hans. --auditis available in dry-run mode.- It logs to
verplaats_log.json.
Unsubscribe:
unsubscribe.pyreadsdecisions.json.- It processes entries with
keuze == "a"and aList-Unsubscribevalue. - It logs progress to
unsubscribe_log.json. - It may perform HTTP unsubscribe requests or send mailto unsubscribe messages via SMTP, so the user should run it personally.
NAS Daily Report
For the current NAS setup, only the daily report needs scheduling. A simple cron entry is enough:
0 6 * * * cd /share/homes/mailcat/mailcat && /opt/bin/python3 dagelijks_overzicht.py --account hans --mail-to hans@australius.nl >> /share/homes/mailcat/mailcat/daily_report.out 2>&1
Use the NAS-specific crontab mechanism if QNAP overwrites normal crontabs after reboot.
Verification Commands
Latest local verification should include:
python3 -m py_compile config.py imap_utils.py mail_routes.py maak_mappen.py verplaats_bestaand.py dagelijks_overzicht.py unsubscribe.py
python3 -m unittest discover -s tests
sievec -c /tmp/mailcat-sieve-test/dovecot.conf mailcat_roundcube.sieve /tmp/mailcat_roundcube.svbin
git diff --check
If /tmp/mailcat-sieve-test/dovecot.conf does not exist, recreate it for Dovecot 2.4.0:
mkdir -p /tmp/mailcat-sieve-test
printf 'dovecot_config_version = 2.4.0\ndovecot_storage_version = 2.4.0\nssl = no\n' > /tmp/mailcat-sieve-test/dovecot.conf
Next Expected Work
Likely next steps:
- Finish unsubscribe work, with the user running
unsubscribe.py. - Deploy the reduced project to the NAS if desired.
- Schedule
dagelijks_overzicht.pydaily at 06:00 on the NAS.