Skip to main content

Goal script API

Custom rule goals implement:

async function evaluate(ctx, bp) {
return {
status: "on_track", // on_track | watch | behind | healthy | below_floor | completed | error
headline: "Human-readable summary",
detail: "Optional detail",
progressPercent: 42,
needsAttention: false,
attentionReason: null,
metrics: {},
};
}

bp helpers

HelperPurpose
bp.sumBalances(accountIds)Sum linked account balances (minor units)
bp.formatMoney(minor)Format cents as currency string

Templates

Bundled templates (pay-period cushion, simple threshold) ship with the app. Duplicate a template on the Rule tab and adjust thresholds.

When you ask Chat to propose a custom rule goal, the assistant should look up this article (and related goals Help) instead of inventing helpers beyond the table above.

Expected result

Test now on the goal detail page runs the script and persists a snapshot without editing the rule.