Revenue leakage auditor
Audit one account-period for revenue leakage by comparing usage against billing, emitting only bounded adjustment ceilings as data for eligible under-billed accounts.
You’re reading version sha-52347e9672db. Go to the current version
Overview
revenue-leakage-auditor is a finance review skill. It reads one account's
usage record, billing history, discount policy, threshold, and parent adjustment
bounds, then decides whether an under-billing gap is real enough to recover. It
does not charge a customer, refund money, mint authority, or settle an
adjustment.
The output is a typed review decision plus zero or more bounded
AttenuationRequest ceilings carried as data. A downstream driver may hand a
ceiling to the core spend/refund accepting runner, which alone owns child grant
minting, reservation, settlement, and receipt sealing. This skill only records
the review and the bounded data a later governed runner may consume.
In the manual
Runner
audit
Declared by its execution profile. Read the profile
SKILL.md
Revenue Leakage Auditor
revenue-leakage-auditor is a finance review skill. It reads one account's
usage record, billing history, discount policy, threshold, and parent adjustment
bounds, then decides whether an under-billing gap is real enough to recover. It
does not charge a customer, refund money, mint authority, or settle an
adjustment.
The output is a typed review decision plus zero or more bounded
AttenuationRequest ceilings carried as data. A downstream driver may hand a
ceiling to the core spend/refund accepting runner, which alone owns child grant
minting, reservation, settlement, and receipt sealing. This skill only records
the review and the bounded data a later governed runner may consume.
What This Skill Does
- Reads durable per-account reconciliation state through
registry:runx/data-store@0.1.2. - Matches
usage_records.account_idtobilling_history.account_idfor the same billing period. - Computes the billed-vs-usage gap only from supplied records.
- Applies
charge_threshold_pctbefore treating a gap as leakage. - Drops accounts excluded by
discount_policy.excluded_accounts. - Drops gaps covered by
discount_policy.known_discounts. - Emits one bounded ceiling per eligible under-billed account, clamped to
parent_adjustment_bounds. - Appends a reconciliation event with a CAS
append_eventusing a stable idempotency key keyed by account and period.
Inputs
usage_records:
account_id: string
usage_amount: number
period: string
billing_history:
account_id: string
billed_amount: number
period: string
discount_policy:
excluded_accounts: [string]
known_discounts: array
charge_threshold_pct: number
parent_adjustment_bounds: objectThe usage and billing records may include currency and evidence_ref. When an
evidence ref is absent, the reviewer derives a stable reference from
account_id and period rather than inventing an external source.
Output
decision:
leakage_found: boolean
reason: string
ceilings:
- schema: runx.attenuation_request.v1
form: data
account_id: string
amount:
amount: number
currency: string
currency: string
scopes: [spend.reserve, spend.settle, receipt.seal]
usage_evidence_ref: string
billing_evidence_ref: string
idempotency_key: string
downstream_runner: registry:runx/spend@0.1.1
escalation:
required: boolean
lane: human_approval
reason: string
data_store:
package_ref: registry:runx/data-store@0.1.2
read_projection: object
append_event: object
observations: objectceilings is empty when no leakage is found, the account is excluded, a known
discount covers the gap, records are incomplete, or the gap stays inside the
threshold. A ceiling is a review artifact only; it is not a reservation, subset
proof, mint, settlement, or proposal envelope.
Decision Rules
- Leakage found only when account and period match, usage and billing amounts
are complete, currency is compatible, the account is not excluded, no known
discount covers the gap, and the under-billed percentage exceeds
charge_threshold_pct. - No change when billing is at or above usage, the gap is within threshold, or a known discount covers the difference.
- Needs agent when account, period, usage amount, billed amount, currency, threshold, or parent bounds are missing or contradictory.
- Human approval lane is named whenever a downstream runner would consume a ceiling. The approval happens outside this review skill.
Data-Store Handoff
This skill carries the registry:runx/data-store@0.1.2 handoff contract in the
review packet and executes the same governed data operation envelope through
data.source graph steps.
read_projectionreadsresource: account_reconciliationsfor the account aggregate.append_eventwrites eitherrevenue_leakage.detectedorrevenue_leakage.no_change.idempotency_keyis keyed by account id, period, and review outcome.expected_versionis supplied by the review packet so CAS failures are visible instead of overwritten.
The event is evidence of the review. It is not authority to charge, refund, or settle anything.
Adjustment Handoff
Each ceiling is a typed value, not an effect. A downstream driver must:
- pass the ceiling to the core spend/refund accepting runner;
- mint any attenuated child grant there, never here;
- reserve, settle, and seal under the accepting runner's charter;
- fail closed when a request exceeds the ceiling amount, currency, or scopes; and
- require human approval before consuming the ceiling.
Stop Conditions
account_mismatch: usage and billing records name different accounts.period_mismatch: usage and billing records cover different periods.missing_usage_evidence: usage amount is absent or not numeric.missing_billing_evidence: billed amount is absent or not numeric.currency_mismatch: usage, billing, or parent bounds currencies differ.excluded_account: discount policy excludes the account.known_discount: discount policy covers the apparent gap.below_threshold: the under-billed percentage is at or below the threshold.bounds_missing: parent adjustment bounds cannot clamp the ceiling.
Verification Notes
The harness carries exactly two cases:
revenue-leakage-auditor-underbilling-ceilingseals a leakage review with a boundedAttenuationRequestceiling as data and a CAS append event.revenue-leakage-auditor-stop-needs-agentomits caller answers so the review blocks atneeds_agentwith no ceiling, no mint, no settlement, and no append event.
The dogfood run should execute the published package after install and verify the receipt from that post-publish run, not a local harness fixture receipt.
Published execution profile
The execution profile published with sha-52347e9672db, shown as its exact bytes.
| Runner |
|
|---|---|
| Profile digest | sha256:22a48714446e607e6dda0279001ac61a85c374bc76aa7c36e9b3b1bbda138932 |
skill: revenue-leakage-auditor
version: 0.1.1
catalog:
kind: graph
audience: operator
visibility: public
role: context
part_of:
- runx/spend
- runx/refund
category: payments
connectors:
store:
operations:
- events.append
- projection.read
runners:
audit:
default: true
inputs:
data_source_ref:
type: string
required: true
description: Logical data source holding per-account revenue reconciliation state.
store_id:
type: string
required: false
description: Optional deterministic local fixture store id.
usage_records:
type: json
required: true
description: usage_records{account_id,usage_amount,period}.
billing_history:
type: json
required: true
description: billing_history{account_id,billed_amount,period}.
discount_policy:
type: json
required: true
description: discount_policy{excluded_accounts,known_discounts}.
charge_threshold_pct:
type: number
required: true
description: Minimum under-billed percentage required before emitting a ceiling.
parent_adjustment_bounds:
type: json
required: true
description: AuthorityBounds clamp for any adjustment ceiling emitted as data.
steps:
- id: read-account
operation: store/projection.read
input:
data_source_ref: $input.data_source_ref
resource: account_reconciliations
aggregate_id: $input.usage_records.account_id
- id: judge-leakage
label: decide revenue leakage and bounded adjustment ceilings
agent:
role: finance
task: revenue-leakage-auditor
outputs:
leakage_audit_packet:
required: false
inputs:
usage_records: $input.usage_records
billing_history: $input.billing_history
discount_policy: $input.discount_policy
charge_threshold_pct: $input.charge_threshold_pct
parent_adjustment_bounds: $input.parent_adjustment_bounds
account_projection: $steps.read-account.provider_operation.result.projection
artifacts:
named_emits:
revenue_leakage_audit_packet: leakage_audit_packet
- id: append-review
operation: store/events.append
idempotency_key: $steps.judge-leakage.leakage_audit_packet.data_store.append_event.idempotency_key
input:
data_source_ref: $input.data_source_ref
resource: account_reconciliations
aggregate_id: $input.usage_records.account_id
expected_version: $steps.judge-leakage.leakage_audit_packet.data_store.append_event.expected_version
event: $steps.judge-leakage.leakage_audit_packet.data_store.append_event.event
harness:
cases:
- name: revenue-leakage-auditor-underbilling-ceiling
inputs:
data_source_ref: tenant://revenue-leakage/account-ledger
store_id: revenue-leakage-harness-v1
usage_records:
account_id: account:atlas-team
usage_amount: 15000
currency: USD
period: 2026-06
evidence_ref: usage:account:atlas-team:2026-06
billing_history:
account_id: account:atlas-team
billed_amount: 10000
currency: USD
period: 2026-06
evidence_ref: billing:account:atlas-team:2026-06
discount_policy:
excluded_accounts:
- account:internal-sandbox
known_discounts:
- account_id: account:legacy-partner
period: 2026-06
amount:
amount: 5000
currency: USD
reason: contracted launch discount
charge_threshold_pct: 10
parent_adjustment_bounds:
schema: runx.authority_bounds.v1
amount:
max_per_account: 6000
currency: USD
scopes:
- spend.reserve
- spend.settle
- receipt.seal
expires_at: 2026-07-31T00:00:00Z
env:
RUNX_DATA_SOURCES: '{"data_sources":{"tenant://revenue-leakage/account-ledger":{"adapter":"data.local","resources":{"account_reconciliations":{"kind":"event_stream","partition_key":"aggregate_id"}}}}}'
caller:
answers:
judge-leakage:
leakage_audit_packet:
schema: runx.revenue.leakage_audit.v1
decision:
leakage_found: true
reason: account:atlas-team used USD 15000 in 2026-06, was billed USD 10000, and the 50% under-billing gap exceeds the 10% threshold with no exclusion or known discount.
ceilings:
- schema: runx.attenuation_request.v1
form: data
account_id: account:atlas-team
amount:
amount: 5000
currency: USD
currency: USD
scopes:
- spend.reserve
- spend.settle
- receipt.seal
counterparty: account:atlas-team
usage_evidence_ref: usage:account:atlas-team:2026-06
billing_evidence_ref: billing:account:atlas-team:2026-06
idempotency_key: revenue-leakage:account:atlas-team:2026-06:recover
downstream_runner: registry:runx/spend@0.1.1
clamp:
parent_bound_ref: parent_adjustment_bounds
max_amount:
amount: 6000
currency: USD
result: within_parent_bounds
escalation:
required: true
lane: human_approval
reason: Finance approval is required before a downstream C3 runner consumes the adjustment ceiling.
data_store:
package_ref: registry:runx/data-store@0.1.2
data_source_ref: tenant://revenue-leakage/account-ledger
store_id: revenue-leakage-harness-v1
read_projection:
runner: read_projection
resource: account_reconciliations
aggregate_id: account:atlas-team
append_event:
runner: append_event
resource: account_reconciliations
aggregate_id: account:atlas-team
expected_version: 0
idempotency_key: revenue-leakage:account:atlas-team:2026-06:detected
event:
type: revenue_leakage.detected
payload:
account_id: account:atlas-team
period: 2026-06
usage_amount:
amount: 15000
currency: USD
billed_amount:
amount: 10000
currency: USD
under_billed_amount:
amount: 5000
currency: USD
threshold_pct: 10
ceiling_idempotency_key: revenue-leakage:account:atlas-team:2026-06:recover
observations:
verdict: leakage_found
account_id: account:atlas-team
period: 2026-06
usage_evidence_ref: usage:account:atlas-team:2026-06
billing_evidence_ref: billing:account:atlas-team:2026-06
usage_amount:
amount: 15000
currency: USD
billed_amount:
amount: 10000
currency: USD
under_billed_amount:
amount: 5000
currency: USD
under_billed_pct: 50
threshold_pct: 10
bounded_ceiling_count: 1
aggregate_id: account:atlas-team
appended_version: 1
refused_or_stop_reason: null
harness_cases:
- revenue-leakage-auditor-underbilling-ceiling
- revenue-leakage-auditor-stop-needs-agent
expect:
status: sealed
receipt:
schema: runx.receipt.v1
operator_journeys:
- mode: standalone
confusors:
- settle-invoice
- refund
request: Audit this account period for revenue leakage.
expected_outcome: Return usage-versus-billing findings and bounded adjustment ceilings for under-billed accounts.
- mode: composed
request: Continue this revenue-leakage-auditor work from evidence already gathered upstream.
expected_outcome: Return usage-versus-billing findings and bounded adjustment ceilings for under-billed accounts.
prior_evidence:
- The usage and billing records already read.
must_not_repeat:
- Do not bill or credit the account.
- name: revenue-leakage-auditor-stop-needs-agent
inputs:
data_source_ref: tenant://revenue-leakage/account-ledger
store_id: revenue-leakage-harness-v1
usage_records:
account_id: account:bravo-team
usage_amount: 10500
currency: USD
period: 2026-06
evidence_ref: usage:account:bravo-team:2026-06
billing_history:
account_id: account:bravo-team
billed_amount: 10000
currency: USD
period: 2026-06
evidence_ref: billing:account:bravo-team:2026-06
discount_policy:
excluded_accounts:
- account:internal-sandbox
known_discounts:
- account_id: account:legacy-partner
period: 2026-06
amount:
amount: 5000
currency: USD
reason: contracted launch discount
charge_threshold_pct: 10
parent_adjustment_bounds:
schema: runx.authority_bounds.v1
amount:
max_per_account: 6000
currency: USD
scopes:
- spend.reserve
- spend.settle
- receipt.seal
expires_at: 2026-07-31T00:00:00Z
env:
RUNX_DATA_SOURCES: '{"data_sources":{"tenant://revenue-leakage/account-ledger":{"adapter":"data.local","resources":{"account_reconciliations":{"kind":"event_stream","partition_key":"aggregate_id"}}}}}'
expect:
status: needs_agent
Published package and test evidence.
This exact version passed its recorded harness run: 2 checks passed · 0 failed.
Test result
| Harness result | Passed |
|---|---|
| Tested version | sha-52347e9672db |
| Recorded result | 2 checks passed · 0 failed |
| Result source | Reported by the publisher (runx_registry_publish) |
| Suite | runx-harness |
| Test recorded | |
| Declared cases | 2 |
| Test record | Open the recorded run |
Inspect receipt references
sha256:d9eaa78b4bd227afa12fef8fd6bb608d4108b9a4c3bb54900f297ca24cefd198sha256:5d4154764829495b0701653405087adae68fcba3ed014957979407184413c24fPackage identity
| Published revision | sha-52347e9672db |
|---|---|
| Content digest | sha256:52347e9672db2474fba5ef7fde8c836e34fc29d6edb5661917659c26e4b40f6c |
| SKILL.md digest | sha256:757e40d7a10a9da2a37abd676c4e82cf958188dc77149ad2117ff78c4446b4c5 |
| Execution profile digest | sha256:22a48714446e607e6dda0279001ac61a85c374bc76aa7c36e9b3b1bbda138932 |
| Publisher identity | Unverified publisher · dh0h |
| Trust tier | CommunityPublished through the registry without publisher verification. This tier is not a code assessment. |
| Attestations |
|
| Source provenance | Not published with this version |
Version history
0.1.2Content digest sha256:81fd22d7f8152d7f045f73d1f32f5d1bae17fa1cc332eee948d28962a35dba0csha-52347e9672dbViewingContent digest sha256:52347e9672db2474fba5ef7fde8c836e34fc29d6edb5661917659c26e4b40f6csha-2a51116ea85aContent digest sha256:2a51116ea85af3ebc27104ce4d15edcffc84e94130f21ab330e17d0a90caace8sha-d6fc4f0bcf9fContent digest sha256:d6fc4f0bcf9f464fdfd2dc641ce5338e4b4aa062802f6674f39fbfabc59f20b9sha-de4f0a428658Content digest sha256:de4f0a4286582b202cde2b02b25b169c9a27b6ef8d577e6cb290355e263785a4