The Decision Lab

Change the inputs. Watch the rules decide.

Explore simplified rule sets from my public repositories and illustrative tradeoff models, right in your browser, on synthetic data. Decision traces mark who decides each step: code, a model, or a person.

Scenario 1

Should the agent email this lead?

An SDR's hour spent on a student is an hour not spent on a buyer. The agent's job is triage: send real buyers straight to a person, send one short email to the maybes, and stop on everyone else.

SDRs only trust routing they can read. So every point in the score has a written reason, and the reasons travel with the handoff. The model is not used to score. It only reads replies.

Scoring is regex and lookup tables (qualify.py). Opt-outs are checked by rule before any model call. Model output is parsed defensively: malformed output becomes unclear at confidence 0 and goes to review.

Inputs

Trace

  1. Code Target specialty (Dermatology)qualify.py: TARGET_SPECIALTIES +30
  2. Code Business email domainqualify.py: FREE_MAIL +10
  3. Code Purchase or financing intentqualify.py: BUYING_SIGNALS +20
  4. Code Near-term timelinequalify.py: BUYING_SIGNALS +10
  5. Code Expanding servicesqualify.py: BUYING_SIGNALS +10

SDR task · score 80

Score 80 ≥ 50. Straight to an SDR task, with every reason above attached.

Then a reply comes back

The model's label and confidence here are fixed stand-ins, not a live model call.

Trace

  1. Model Model labels the reply “interested” at confidence 0.93llm.py: classify_reply()
  2. Code Label picks a branch in code: handoffpipeline.py: next_step()

handoff

SDR task with the thread and the reasons attached.

Cost of a wrong call

Emailing someone who opted out is a legal and trust problem. Sending a buyer a generic email instead of a person costs a deal. A wasted SDR task costs minutes.

The tradeoff

The opt-out rule is deliberately over-inclusive. “Don't email me, call instead” is treated as an opt-out. A lost lead costs less than an ignored opt-out.

What could still fail

A buyer who phrases intent as a question can be read as a question. That's why low confidence goes to a person, and why the eval grades actions, not just labels.

Scenario 2

Who owns this account?

Routing carries out a coverage policy that sales leaders agree on. When a lead lands with the wrong rep, it is usually a policy question nobody answered, not a bug.

Three rules protect trust: a rep's manual handoff is never overwritten, uncovered areas go to inside sales instead of a random default, and when nothing matches, the owner gets a task instead of a silent guess.

Territories are lookup tables (ZIP, then state), not branches. A territory change is a table edit. Lifecycle stages are forward-only. Port of assignment.py.

Inputs

Has a medical director?

Trace

  1. Code No manual handoff lockassignment.py: assign()
  2. Code Med spa, medical director: blank. Inside salesoutside_eligible()
  3. Code ZIP 92801 is mapped for inside sales

Sam (inside)

inside · ZIP

Cost of a wrong call

A lead with the wrong owner looks fine on a dashboard until the deal is lost. Overwriting a rep's handoff teaches reps to work around the system.

The tradeoff

Locking manual handoffs means a stale lock can keep a record with someone who left. That's caught by a periodic owner-status check, not by removing the lock.

What could still fail

Tables drift. Every hire or departure changes them, so keeping them current is a process problem as much as a technical one.

Scenario 3

Should a seller act on this signal?

Seller attention is the scarce resource. A feed that sellers learn to ignore is worse than no feed. So the system sends fewer signals and explains everything it holds back.

Three separate questions: how strong is the change, how far can we trust the data, and can this owner act today? The default example is strong and trustworthy, and still suppressed, because a deal is already open.

Strength comes from three signal families. Confidence starts HIGH and is lowered with a reason. Actionability rules run in order and the first failure decides. The optional AI note runs after the decision and sees only aggregates. Port of product-signal-router v1.5.0.

Inputs

Signal families that fired
Data quality
CRM context

Trace

  1. Code Strength HIGH: usage / value + organizational adoptionsignals.py: strength()
  2. Code Confidence HIGHsignals.py: confidence()
  3. Code Identity resolves to exactly one CRM accountactionability.py
  4. Code The account has an active owneractionability.py
  5. Code No open opportunity stops hereactionability.py

SUPPRESS

A seller is already working a deal here. Another alert would be noise.

Cost of a wrong call

A false alert costs a seller's time and, worse, their trust in the next alert. A missed signal is invisible unless you measure recall on purpose.

The tradeoff

Thresholds are starting points, not fitted values. Shipping them with a replay harness is more honest than shipping them as if they were measured.

What could still fail

An earlier version trusted medium confidence to stop bad signals. It didn't. Anything that must stop a signal is now a rule.

Scenario 4

What happens when the system is wrong?

Example

Systems will be wrong. What matters is whether a correction actually cleans up, or just stops the mistake from repeating while the CRM stays wrong.

The seller's correction has to be one click and has to be trusted. If the bad task stays in her queue after she says “wrong person,” she stops correcting.

Idempotency keys stop a write from happening twice. They do nothing about a write that should no longer exist. The fix maps each correction reason to the writes it invalidates and compensates against what the CRM actually holds.

Version
Step 1 of 4

1. Signal arrives

A vendor reports that Chris Walker joined Redwood Plastic Surgery. Our CRM contact for Chris has a profile URL that matches, so identity scores 0.94. Above the threshold, so code calls it a match.

What the CRM holds now
KeyWriteStatus
No CRM writes yet

Cost of a wrong call

A wrong association spreads: routing, reporting, the next rep who opens the record, other automations that read contacts by company.

The tradeoff

Compensation adds complexity to every write type. The alternative, wrong data that every dashboard reports as healthy, is worse.

What could still fail

A person may have edited the record by hand after the write. The compensating step reads the current state first for exactly that reason.

The CRM accepted the contact, but the sequencer does not have it yet. Treating acceptance as a completed handoff can lose the follow-up. Submitting it again without a guard can create duplicate outreach.

The operator needs to see whether the job is waiting, confirmed, or needs help. A retry cap should end in a person's task with every attempt attached, not a silent failure.

Reserve the job's idempotency key once. Check downstream readiness with bounded retries, write the enrollment once, then read it back before confirming. A duplicate submit cannot start a second job. This flow needs code and a person, with no model step.

Illustrative retry counts and timing: one initial check plus at most 2 retries (3 total attempts), 2 seconds between checks. No real waiting or system calls.

Illustrative ending

Trace

  1. Code The CRM accepted the contact. That does not prove the sequencer has it yet.
  2. Code Queue one outbox job and reserve its idempotency key.enroll:contact-demo:sequence-demo
  3. Code Attempt 1 at 0s: the contact is not ready; no sequencer write.
  4. Code Attempt 2 at 2s: the contact is not ready; no sequencer write.
  5. Code Attempt 3 at 4s: the contact is ready in the sequencer.
  6. Code Submit the enrollment once, then read it back. The returned key matches the job: confirmed.

Confirmed on retry 2

Confirmed on attempt 3. One sequencer enrollment was written and verified. A CRM acknowledgment alone was never treated as completion.

Readiness attempts
3
Sequencer writes
1
Read-back confirmed
Yes

Idempotency key: enroll:contact-demo:sequence-demo

Readiness checks
AttemptIllustrative timeResult
10sNot ready; no write
22sNot ready; no write
34sReady

Trace

  1. Code The CRM accepted the contact. That does not prove the sequencer has it yet.
  2. Code Queue one outbox job and reserve its idempotency key.enroll:contact-demo:sequence-demo
  3. Code Attempt 1 at 0s: the contact is not ready; no sequencer write.
  4. Code Attempt 2 at 2s: the contact is not ready; no sequencer write.
  5. Code Attempt 3 at 4s: the contact is not ready; no sequencer write.
  6. Code The attempt cap is reached. Stop retrying; keep the outbox job in review. stops here
  7. Code Create a person’s task with the idempotency key, the reason, and every attempt.
  8. Person A person must inspect the attempt history and synchronization before choosing a recovery action.

Retry cap reached

The sequencer was not ready after 3 attempts. Check synchronization before approving another action.

Readiness attempts
3
Sequencer writes
0
Read-back confirmed
No

Person’s task

The sequencer was not ready after 3 attempts. Check synchronization before approving another action.

Idempotency key: enroll:contact-demo:sequence-demo

Task payload: every attempt
AttemptIllustrative timeResult
10sNot ready; no write
22sNot ready; no write
34sNot ready; no write

Trace

  1. Code The CRM accepted the contact. That does not prove the sequencer has it yet.
  2. Code The idempotency key is already reserved. Skip the duplicate submit before any readiness check or write. stops here

Duplicate submit skipped

No new sequencer write and no new person task. The original job keeps its own outcome.

Readiness attempts
0
Sequencer writes
0
Read-back confirmed
No

Idempotency key: enroll:contact-demo:sequence-demo

No readiness checks were run for the duplicate.

Cost of a wrong call

A duplicate enrollment can send repeated outreach. A job marked complete too early can disappear from the operator's queue while nothing happened downstream.

The tradeoff

A short retry window escalates some jobs that would recover later. An endless retry loop hides a broken synchronization path. Keep the cap visible and give the next decision to a person.

What could still fail

A write can succeed while its response is lost. A real integration needs the destination's idempotency or reconciliation support. This illustration assumes the final read-back succeeds; it does not model that separate failure.

Scenario 5 · Tradeoff explorer

Where should the human review line sit?

Every agent has a confidence line. Above it, it acts alone. Below it, a person reviews. Move the line up and you pay in review time. Move it down and you pay in mistakes. Where it should sit depends on what a mistake costs you.

Review capacity is a real constraint. Past it, items wait, and a late review can be as bad as a wrong action. So the cheapest line on paper may not be the one your team can staff.

500 synthetic replies with a confidence score and a ground-truth flag, seeded so results repeat. Cost per day = reviewed items × review minutes + wrong automatic actions × wrong-action cost + overflow × half that cost.

Illustrative numbers. Not measured from any real system.

Assumptions

Result per day

Handled alone
84%
Sent to review
20
Wrong automatic actions
16.3
Over capacity
0
Total cost
549 min
0.300.96 review threshold → cost cheapest ≈ 0.70

Scenario 6 · Tradeoff explorer

Build or buy?

Illustrative

A license is only part of the cost. Compare three years of engineering, upkeep, rule changes, and waiting. A cheaper start can become a more expensive commitment.

Time to first value depends on feature fit. An uncovered requirement means extra work before the tool is useful. Compare the same required scope, then ask how often it will change.

This model books setup and delay at kickoff, then spreads license, maintenance, and rule-change work over 36 months. Missing feature coverage adds proportional implementation effort. These are illustrative assumptions, not a forecast.

Illustrative numbers. Not from any real company.

Assumptions

Build
Buy
Shared

Result over 3 years

Build · 3-year cost
$108K
Buy · 3-year cost
$103.8K
Build · first value
12 weeks
Buy · first value
4.2 weeks
Build · rule-change cost
$4.8K
Buy · rule-change cost
$28.8K

Rule-change cost assumption: build = 4 engineer hours per change; buy = 24 engineer hours for a vendor ticket or workaround. Both use the loaded hourly cost.

$118.8K$0 0122436 months from kickoff

Solid: build. Dashed: buy. No crossover in months 1–36.

The tradeoff

Buy costs $4.2K less over 3 years. Rule-change work tips the decision: buy wins below 4.7 changes a year; build wins above it, with other inputs fixed.

Model assumptions: 40 engineer hours per week. Buy time to first value = integration weeks + build weeks × uncovered feature share. Both options book setup labor and time-to-value × weekly delay cost at month 0. Maintenance, license, and rule-change costs accrue evenly for all 36 months from kickoff, including setup time.

No discounting, taxes, price increases, migration, or exit costs. Workaround effort is a simple proxy; missing features may be impossible to build. Lower modeled cost does not guarantee a better tool.