broker-schedule: Repricing Interval & Scheduler
Sets the repricing cycle and registers the system timer that drives automatic price adjustments.
Workflow
- Ask user for interval in days (default: 7)
- Write interval to the listing's state via state_manager
- Register (or update) the system-level daily check job:
- macOS: LaunchAgent plist at
~/Library/LaunchAgents/com.skillhub.broker-repricing.plist - Linux: crontab entry
- macOS: LaunchAgent plist at
What the Daily Check Does
- Scans all active listings
- For listings whose
next_repricing_date≤ today:- Search platform prices using stored sessions
- Calculate new recommended price
- Floor validation (MANDATORY GATE): If new price < floor → BLOCKED. Repricing paused, user notified, event logged to audit trail.
- If new price ≥ floor: auto-adjust, log repricing to audit trail.
- Also checks each listing's status on platform:
- If found as "sold" on any platform → auto-trigger broker-delist on all others
- All decisions logged: Every repricing, floor block, and delist event is recorded in
~/.broker/audit.jsonl
Script
python3 scripts/schedule.py --item-id <id> --interval 7 # Set interval
python3 scripts/schedule.py --item-id <id> --status # Check schedule
python3 -m broker_core.scheduler register # Register cron/launchd