Skip to main content

Overview

The corsa-rule-authoring skill adds Corsa rule engine knowledge to your coding tool (Cursor, Claude Code, VS Code, etc.) so it can help you create, manage, and test transaction monitoring rules. It covers the full rule lifecycle, condition syntax, aggregation thresholds, and evaluation.

What It Helps With

  • Creating custom rules from scratch or from pre-built templates
  • Configuring conditions with property checks, boolean logic, and aggregation thresholds
  • Setting up actions (alert creation, transaction halting)
  • Managing rule lifecycle (draft, activate, disable, delete, versioning)
  • Testing rules with on-demand evaluation
  • Understanding how rules generate alerts in production

Quick Start

After installing the skill, ask your coding tool questions like:
  • “Create a rule that alerts on withdrawals over $50K in 24 hours”
  • “Copy a rule template and customize the thresholds”
  • “What aggregation operators are available for conditions?”
  • “Test my rule against a sample transaction”
  • “How do I update an active rule without downtime?”

What the Skill Knows

Rule Lifecycle

  • Only active rules evaluate incoming transactions automatically
  • Updating an active rule creates a new version atomically
  • Active rules must be disabled before deletion
  • activate, disable, and delete accept optional reason for audit trail

Conditions

  • Entity targets: transaction, client, wallet, bankAccount
  • Boolean logic: all (AND) and any (OR) groups with arbitrary nesting
  • Operators: equal, notEqual, greaterThan, lessThan, greaterThanInclusive, lessThanInclusive, contains, doesNotContain, startsWith, endsWith, in, notIn, between, isNull, isNotNull
  • Prefix/suffix: startsWith / endsWith are case-insensitive (same as string contains). A missing fact does not match. Use these instead of contains when a mid-string hit would be a false positive (IDs, hashes, account numbers).
  • Ranges: numeric facts (amount, balances, numeric custom fields) and dates accept between with an inclusive [min, max] array — for example { "entity": "transaction", "property": "amount", "operator": "between", "value": [1000, 50000] }
  • Null checks: isNull / isNotNull (“is empty” / “is set” in the Rule Builder) take no value — they match fields that are missing, null, or an empty string "" (0 and false count as set). Only use them on facts that list them in supportedOperators: facts stored with a default (KYC Status, Activity Status, client Risk Score, built-in yes/no flags such as Is PEP) are never empty and do not offer them — use kycLevel for “KYC tier not set” and pepScore for “PEP screening not run”
  • Entity relationships: all, sender, receiver for client-scoped conditions

Aggregation Thresholds

Rolling time-window conditions for velocity checks and structuring detection:
  • Operators: sum, count, avg, min, max, median, stddev, percentile, countDistinct, first, last
  • Time windows: in_the_last, all_time, after, before, between
  • Periods: minutes, hours, days, weeks, months, years
  • Filters: Narrow which transactions are aggregated (e.g., only withdrawals)

Actions

When multiple rules match one transaction, alerts are consolidated — one alert with the highest priority across all matching rule configs.

Templates

Pre-built rule templates for common compliance scenarios. Copy a template to your workspace, customize the conditions, and activate:

Evaluation

  • Automatic: Active rules evaluate every ingested transaction and trigger actions (alert creation)
  • On-demand: POST /v1/evaluation/evaluate tests rules without creating alerts
  • History: Query evaluation results by transaction or by rule

Key Distinction: Evaluate API vs Production Alerts

The on-demand evaluate endpoint (client.evaluation.evaluate()) returns match results and decisions but does not create alerts. Alerts are only created when transactions flow through the normal ingestion pipeline and match active rules. Use the evaluate API for testing and validation.

Common Mistakes It Prevents


Source

GitHub Repository

View the full skill source with detailed condition examples and SDK method reference.