Work / 01
King of Funding
King of Funding's intake form was sending qualified leads to credit repair. I replaced the routing logic with an agent that reads the whole applicant profile, explains its decision in plain English, and flags the cases a human should look at. It got 20 of 20 routes right against a blind answer key.
The problem
King of Funding, a business funding broker, qualified inbound leads with a 25-question intake form. The form’s branching logic treated every negative credit mark the same way, so one late payment routed the same as a bankruptcy.
Those are different risks. An applicant with a single late payment, a 700–750 FICO, 16–30% utilization and $40k in liquid funds is fundable. The form sent them to credit repair, and the broker never spoke to them.
This is the structural limit of rules-based routing. Rules fire on a single field. They cannot weigh one weak signal against five strong ones, and they cannot tell you why they did what they did.
The constraint
The qualification logic lives in the agent, not in HubSpot Workflows.
This was deliberate. Rebuilding the same if/then tree inside HubSpot’s workflow builder would have reproduced the original bug in a more expensive tool. The agent reads the contact record through the API, evaluates it, and writes its decision back. HubSpot stays the system of record, not the decision engine.
What I built
- Schema. 3 property groups and 19 custom contact properties, derived from the client’s live GoHighLevel export and created through the CRM API rather than by hand.
- Pipelines. SALES (6 stages) and CLIENTS (8 stages), with entry and exit criteria mapped from the client’s actual sales motion.
- Seed data. 20 contacts spanning clean passes, hard fails, and seven deliberately ambiguous records.
- The agent. Python, calling the Claude API with structured outputs. It reads the contact and evaluates it against a rubric that carries both the original rules and the six places those rules contradict each other. It writes route, score, reasoning, confidence and a conflict flag back to the record.
- The grader. It scores agent output against a blind answer key on three axes, so quality is measured rather than asserted.
Every script is idempotent and verifies its own work. After a six-week gap, the build was reconstructed from scratch with no manual repair.
Results
| Measure | Result |
|---|---|
| Route accuracy | 20/20 |
| Conflict detection | 18/20 |
| Confidence calibration | 15/20 |
| Deterministic cases | 13/13 routes, 12/13 conflict |
The case that proves it
Hannah Reyes (seed record) has Late Payments on her profile. A rules engine reads that field and sends her to credit repair, the same bucket as the applicant with a bankruptcy.
The agent kept her:
Both gates pass, and the only thing pointing toward credit repair is the late-payment flag. Late payments alone, with a 700–750 FICO, 16–30% utilization, $50k–$75k in personal limits and $40k–$69.9k in liquidity, is a much smaller risk than a collection or bankruptcy. I routed to a call instead of credit repair. On the call, ask how recent and how many the late payments are, and confirm the lenders will accept them. Also flag that the $130k request is large against $10k–$50k revenue, so the rep should size the ask realistically.
It caught the conflict, resolved it, and told the rep what to ask on the call. No rule does that last part.
What the second pass showed
The first run hit 20/20 on routes but flagged conflicts on four records where the rules agreed with each other. A flag that fires everywhere carries no information.
I tightened the rubric to separate rules firing from rules disagreeing about the outcome, then re-ran it. Conflict detection went from 16/20 to 18/20, and the deterministic cases came back clean.
I stopped there. Chasing the remaining confidence misses would have meant tuning the agent to agree with my own answer key, which measures agreement, not judgment.
Artifacts
create_properties.py: schema build, idempotent, verifies against the live schemacreate_pipelines.py/fix_sales_stages.py: pipeline buildimport_contacts.py: seed import with pre-flight validation against live dropdown optionsqualify_agent.py: the agent and its rubricgrade_agent.py: scoring against the answer keyverify_build.py: read-only health check across all four stages