How asawaricode/settleloop works
SettleLoop is a payment-recovery research and evaluation platform, not live payment infrastructure. Its main workflow generates synthetic mandates, simulates paired recovery policies, and evaluates their outcomes; an API and dashboard expose experiment operations. A separate, isolated Razorpay Test Mode branch handles signed webhooks and manual test-order creation. The graph reflects the supplied README and source index; unsampled subsystems are included where documented, but their internal call paths are not inferred.
Main entry points: smartPolicy.js Smart Policy · benchmarkRunner.js Paired Benchmark · recoveryEngine.js Recovery Engine · routes.js Experiment API
Components 27
Synthetic Experiments
- Paired Benchmark
src/recovery/benchmarkRunner.js - Payment Simulator
src/simulators/paymentSimulator.js - Observation Boundary
src/simulators/observation.js - Virtual Clock
src/simulation/simulatedClock.js
Recovery Policies
- Control Policy
src/recovery/controlPolicy.js - Fixed Schedule
src/recovery/baselinePolicy.js - Salary-Aware Policy
src/recovery/salaryAwarePolicy.js - Smart Policy
src/recovery/smartPolicy.js - Failure Classifier
src/recovery/failureClassifier.js - Smart Agent
src/recovery/smartAgent.js - Safety Guardrails
src/recovery/guardrails.js - Proposal Validator
src/recovery/proposalValidator.js - Human Approval
src/recovery/humanApproval.js - Recovery Engine
src/recovery/recoveryEngine.js - Recovery Runner
src/recovery/recoveryRunner.js - Mandate State Machine
src/stateMachine/mandateStateMachine.js
Evaluation
- Benchmark Evaluator
src/evaluation/benchmarkEvaluator.js - Experiment Metrics
src/evaluation/metrics.js
API And Dashboard
- Experiment API
src/api/routes.js - Synthetic Data Generator
src/generators/syntheticDataGenerator.js - Express Server
server.js - Operator Dashboard
public/dashboard/app.js
Razorpay Test Mode
- Signed Webhooks
src/api/razorpayWebhook.js - Manual Test Orders
src/api/razorpayOrder.js
Other components
- Researcher / Operator
- Supabase
- Razorpay Test Mode
Connections 37
- Researcher / Operator → Paired Benchmark: runs experiment
- Paired Benchmark → Payment Simulator: simulates outcomes
src/recovery/benchmarkRunner.js - Paired Benchmark → Control Policy: evaluates arm
src/recovery/benchmarkRunner.js - Paired Benchmark → Fixed Schedule: evaluates arm
src/recovery/benchmarkRunner.js - Paired Benchmark → Salary-Aware Policy: evaluates arm
src/recovery/benchmarkRunner.js - Paired Benchmark → Smart Policy: evaluates arm
src/recovery/benchmarkRunner.js - Payment Simulator → Observation Boundary: builds observation
src/simulators/paymentSimulator.js - Payment Simulator → Virtual Clock: uses virtual time
- Smart Policy → Failure Classifier: classifies failure
src/recovery/smartPolicy.js - Smart Policy → Smart Agent: requests proposal
src/recovery/smartPolicy.js - Smart Agent → Proposal Validator: validates proposal
src/recovery/smartAgent.js - Smart Policy → Safety Guardrails: checks proposal
src/recovery/smartPolicy.js - Smart Policy → Human Approval: requests review
src/recovery/smartPolicy.js - Smart Policy → Payment Simulator: simulates attempt
src/recovery/smartPolicy.js - Smart Policy → Mandate State Machine: checks transition
src/recovery/smartPolicy.js - Recovery Engine → Control Policy: dispatches policy
src/recovery/recoveryEngine.js - Recovery Engine → Fixed Schedule: dispatches policy
src/recovery/recoveryEngine.js - Recovery Engine → Salary-Aware Policy: dispatches policy
src/recovery/recoveryEngine.js - Recovery Engine → Smart Policy: dispatches policy
src/recovery/recoveryEngine.js - Recovery Runner → Recovery Engine: processes mandates
src/recovery/recoveryRunner.js - Recovery Runner → Virtual Clock: advances simulation
src/recovery/recoveryRunner.js - Benchmark Evaluator → Paired Benchmark: runs paired trials
src/evaluation/benchmarkEvaluator.js - Benchmark Evaluator → Experiment Metrics: computes results
- Researcher / Operator → Experiment API: requests operations
- Experiment API → Synthetic Data Generator: creates cohort
src/api/routes.js - Experiment API → Recovery Runner: runs recovery
src/api/routes.js - Experiment API → Human Approval: resolves review
src/api/routes.js - Express Server → Experiment API: mounts routes
server.js - Express Server → Signed Webhooks: mounts endpoint
server.js - Express Server → Manual Test Orders: routes requests
server.js - Express Server → Operator Dashboard: serves files
server.js - Signed Webhooks → Supabase: stores events
src/api/razorpayWebhook.js - Manual Test Orders → Supabase: reads configuration
src/api/razorpayOrder.js - Manual Test Orders → Razorpay Test Mode: creates test order
- Razorpay Test Mode → Signed Webhooks: sends signed events
- Synthetic Data Generator → Supabase: persists cohort
- Experiment Metrics → Supabase: uses database