@polycode-projects/the-mechanical-code-talker 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/chat.mjs +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polycode-projects/the-mechanical-code-talker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The Mechanical Code Talker (tmct) — a tolerant, offline, $0 chat surface that guides you toward precision queries about a software repository. ELIZA/PARRY-style but domain-obsessed with code. No model calls; no codebase index of its own.",
|
package/src/chat.mjs
CHANGED
|
@@ -1426,6 +1426,31 @@ function teachSuggestion(payload) {
|
|
|
1426
1426
|
return `every ${subject} is ${article} ${object}`;
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
|
+
/** PRONOUN-SUBJECT GUARD (2026-07-08, operator repro): "remember you are a
|
|
1430
|
+
* womble" and the literal "every you is a womble" both used to reach
|
|
1431
|
+
* teachSuggestion/unknownSubjectFallback treating "you" like an ordinary
|
|
1432
|
+
* unknown common noun — producing the nonsensical "did you mean: every you
|
|
1433
|
+
* is a womble" hint (teachSuggestion), or, worse, a SILENT direct-write via
|
|
1434
|
+
* unknownSubjectFallback whenever the object happened to resolve as a known
|
|
1435
|
+
* noun/adjective (e.g. "he is a doctor" would have stored the bogus fact
|
|
1436
|
+
* "he rdfs:subClassOf doctor"). A personal pronoun is never a valid class-
|
|
1437
|
+
* membership subject for ANY object — "every <pronoun> is a Y" isn't
|
|
1438
|
+
* coherent English no matter what Y is, so this is a grammatical category
|
|
1439
|
+
* error, not "new vocabulary" the unknown-subject free pass exists for.
|
|
1440
|
+
* Checked FIRST in teachLane, before any other recognizer gets a look at
|
|
1441
|
+
* the payload (bare OR remember-wrapped surface, so it fires uniformly
|
|
1442
|
+
* across entry points), and short-circuits with its own honest, distinct
|
|
1443
|
+
* decline — never the generic "every X is a Y" miss text, and never a "did
|
|
1444
|
+
* you mean" guess.
|
|
1445
|
+
*
|
|
1446
|
+
* Deliberately limited to the seven UNAMBIGUOUS personal pronouns (you/i/
|
|
1447
|
+
* it/they/he/she/we) — this/that/these/those are excluded on purpose: they
|
|
1448
|
+
* double as legitimate demonstrative entity references elsewhere in this
|
|
1449
|
+
* file (DESCRIBE_PRONOUN_RE, NEGATION_PRONOUN_RE et al.), and a claim about
|
|
1450
|
+
* a demonstrated entity ("that is a bug", pointing at something real) is a
|
|
1451
|
+
* much closer call than "every you is a womble" — not this bug's territory. */
|
|
1452
|
+
const TEACH_PRONOUN_RE = /^(?:every\s+|each\s+|all\s+|some\s+|a few\s+|a\s+|an\s+)?(you|i|it|they|he|she|we)\s+(?:is|are|am)\b/i;
|
|
1453
|
+
|
|
1429
1454
|
async function teachLane(query, { memoryDir, sessionId = "", lexicon = null }) {
|
|
1430
1455
|
const rawInput = String(query).trim();
|
|
1431
1456
|
const m = rawInput.match(TEACH_RE);
|
|
@@ -1441,6 +1466,24 @@ async function teachLane(query, { memoryDir, sessionId = "", lexicon = null }) {
|
|
|
1441
1466
|
const raw = stripYour(rawInput);
|
|
1442
1467
|
const wrapped = stripYour(wrappedInput);
|
|
1443
1468
|
|
|
1469
|
+
// PRONOUN-SUBJECT GUARD — tried against BOTH surfaces (bare and remember-
|
|
1470
|
+
// wrapped; trailing punctuation stripped the same way the OWNS/SOME_A_FEW
|
|
1471
|
+
// lanes below do) before anything else in this function, so a pronoun
|
|
1472
|
+
// subject NEVER reaches teachSuggestion's "did you mean" hint or
|
|
1473
|
+
// unknownSubjectFallback's direct-write path — see TEACH_PRONOUN_RE's own
|
|
1474
|
+
// docblock above for why.
|
|
1475
|
+
const pronounSrc = (wrapped ?? raw).replace(/[.!?]+\s*$/, "");
|
|
1476
|
+
const pronounMatch = pronounSrc.match(TEACH_PRONOUN_RE);
|
|
1477
|
+
if (pronounMatch) {
|
|
1478
|
+
const pronoun = pronounMatch[1];
|
|
1479
|
+
return {
|
|
1480
|
+
text: `I can't store a fact about "${pronoun}" as a class — pronouns aren't things I can classify. `
|
|
1481
|
+
+ `I remember facts in the shape "every X is a Y", where X is a specific noun, not a pronoun. `
|
|
1482
|
+
+ "Type /memory to see what I already remember.",
|
|
1483
|
+
via: "teach-miss", miss: true,
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1444
1487
|
// OWNERSHIP — "<Name> owns/maintains <X>", bare or remember-wrapped. The bare
|
|
1445
1488
|
// form is double-gated: a Capitalized name AND no interrogative lead, so the
|
|
1446
1489
|
// "who owns <X>" READ question and ordinary prose never land a fact here.
|