Chatbot: catch the PIF question when nobody says "PIF", and stop inventing references

Follow-on to the risk rewrite. Two gaps it exposed.

Members ask this without the word PIF: "should I fund their first package", "can I
buy it for them", "can I front someone the $20". Those were falling through to the
AI, which answered reasonably but told the member to "read the full warning on your
training page" - a page section that does not exist and that they would go looking
for. The pattern now also matches a paying verb plus an explicit for-someone-else
phrase, so these get the full canned answer with the risk in it. It deliberately
needs BOTH halves: "which package should I buy" must not be stolen.

The prompt now forbids sending anyone to a warning, guide or page section that is
not in the PAGES list, and requires plain ASCII (the model was emitting non-breaking
hyphens in "Wi-Fi").

Fixed two first-match-wins routing bugs, one of them mine from the previous commit:
"what do I get for buying a package" was returning the commission split, because I
had widened the earnings pattern to "what do I get" when it should only ever have
been "what do I get paid". And "should I buy the $20 package" previously matched
nothing at all and burned an AI call on a question we have a written answer for.

CANNED is an ordered list, so any pattern edit can silently steal a neighbour. The
suite now pins a 19-case routing table across PIF, price, earnings and the tank, so
the next person to widen a regex finds out immediately. qa/chatbot-parse.mjs is 35
assertions. qa/run.sh member: 0 bugs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-17 05:41:54 -05:00
parent 3867b28bd4
commit f27388a322
2 changed files with 253 additions and 219 deletions
+28
View File
@@ -68,6 +68,34 @@ t('it gives the honest arithmetic both ways', /costs you about half/.test(pif) &
t('it says never gift money you need and never borrow', /never gift money you need, never borrow/i.test(pif));
t('it never sells PIF as a tactic', !/you should (definitely |really )?pif/i.test(pif));
// 8. ROUTING. CANNED is first-match-wins, so widening any pattern can silently steal a
// neighbour. Both of these already happened: "how much do I earn" returned the price
// ladder, and "what do I get for buying a package" returned the commission split. Every
// pattern edit must keep this table green.
const WANT = {
PIF: /PIF is a gift/,
PRICE: /Five packages, priced/,
EARN: /Every package splits the same way/,
TANK: /The holding tank is where free members/
};
const ROUTES = [
['PIF', 'should I pif someone from the holding tank'], ['PIF', 'what is pif'],
['PIF', 'should i pay it forward'], ['PIF', 'can I front someone the $20'],
['PIF', 'should I spot them the money'], ['PIF', 'should I pay for their first package'],
['PIF', 'can I just buy the package for someone in my downline who wont respond'],
['PIF', 'is it smart to fund a new members first package for them'],
['PRICE', 'which package should i buy'], ['PRICE', 'how much is the starter package'],
['PRICE', 'should I buy the $20 package'], ['PRICE', 'what do I get for buying a package'],
['PRICE', 'how much does it cost'],
['EARN', 'how much do I earn'], ['EARN', 'how much can i make'],
['EARN', 'what will i get paid'], ['EARN', 'what is the commission'],
['TANK', 'how does the holding tank work'], ['TANK', 'can I adopt someone from the tank']
];
for (const [want, q] of ROUTES) {
const reply = await ask(q);
t('routes to ' + want + ': "' + q + '"', WANT[want].test(reply), String(reply).slice(0, 55));
}
https.request = realRequest;
srv.close();
console.log('PASS ' + ok.length);