Surface aging customers, propose dunning steps
cron0 6 * * *| name | required | type / hint |
|---|---|---|
threshold_days | optional | — |
tier_definitions | optional | — |
agingv_ar_agingSELECT customer_id, customer_name, SUM(amount) AS total_open, MAX(days_overdue) AS max_overdue FROM v_ar_aging WHERE days_overdue >= ?threshold_days GROUP BY customer_id
prior_actionsproposed_actionsSELECT customer_name, MAX(proposed_at) FROM proposed_actions WHERE action_type='collection_action' AND status='applied' GROUP BY customer_name
| check | rule | severity |
|---|---|---|
aging_data_fresh | MAX(sync_log.completed_at WHERE sync_type='scheduled_hot_customer_payments') > now - 2 hours | warn |
Risk level 3 ≥ 3 — runner stages a proposed_actions row before fan-out runs. Mike must approve in proposed-actions.html before any side-effect step executes (real or stub).
workflow_ar_aging_action_plan (proposal envelope)workflow:ar_aging_action_plan:run_<run_id>draft_per_tier loop_over_aging STUBloop_over_agingstage proposed_action with tier-specific draft bodysrc/lib/workflow_runner.ts (kind loop_over_aging hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.pause_on_hold_check flag STUBstage propose_customer_program with type=service_holdcustomer.days_overdue > 90 AND customer.total_open > 25000src/lib/workflow_runner.ts (kind flag hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.sales_rep_notify hitl_email_draft STUBpropose_email_to_customersrc/lib/workflow_runner.ts (kind hitl_email_draft hits the placeholder branch at line ~340 and emits step status 'stub'). Documented intent only.| id | action | source |
|---|---|---|
runner_log_run | INSERT into workflow_run_log (run_id, workflow_type, status, started_at, completed_at, summary_json) | runner automatic |
runner_reflexion | INSERT into reflexion_log (tags=ar_aging_action_plan, run_id, narrative) | runner automatic (reflexion_enabled=1) |
log_run | INSERT workflow_runs | declared in contract |
reflexion | INSERT reflexion_log with tags=ar_aging_tick | declared in contract |
daily_digest | INSERT ar_aging_summary row for trending | declared in contract |
workflow_verify_results (pending — verify cron not yet wired)actions_stagedSELECT COUNT(*) FROM proposed_actions WHERE action_type='collection_action' AND proposed_at > ?
2linear5000true| system | table / resource | action | status | source |
|---|---|---|---|---|
| D1 | workflow_run_log | INSERT (run summary) | REAL | runner automatic |
| D1 | reflexion_log | INSERT (tags=ar_aging_action_plan) | REAL | runner automatic |
| Event | workflow.completed (or workflow.failed) | fire | REAL | runner automatic |
| D1 | workflow_verify_results | INSERT pending × 1 | REAL | runner verify staging |
| D1 | proposed_actions | INSERT (HITL gate envelope) | REAL | runner HITL gate |
| Loop | aging | iterate inner steps | STUB | fan-out #1 (draft_per_tier) |
| D1 | flags / status field | set = | STUB | fan-out #2 (pause_on_hold_check) |
| D1 | proposed_actions | INSERT (email draft via propose_email_to_customer) | STUB | fan-out #3 (sales_rep_notify) |