@polycode-projects/the-mechanical-code-talker 1.5.4 → 1.8.3

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.
Files changed (46) hide show
  1. package/README.md +123 -14
  2. package/ROADMAP.md +233 -1392
  3. package/bin/tmct.mjs +479 -98
  4. package/corpus/README.md +3 -0
  5. package/corpus/generated/README.md +43 -0
  6. package/corpus/generated/ace-surface-variants.jsonl +17 -0
  7. package/corpus/generated/manifest.json +9 -0
  8. package/corpus/tier2/generate.mjs +14668 -0
  9. package/corpus/tier2/human-examples-large.jsonl +1928 -0
  10. package/corpus/tier2/human-examples-medium.jsonl +356 -0
  11. package/corpus/tier2/human-examples.jsonl +120 -0
  12. package/corpus/tier2/human-large.jsonl +12001 -0
  13. package/corpus/tier2/human-medium.jsonl +944 -0
  14. package/corpus/tier2/human.jsonl +664 -0
  15. package/corpus/tier2/manifest.json +42 -0
  16. package/package.json +14 -8
  17. package/src/answer-variants.json +47 -0
  18. package/src/answer-variants.mjs +67 -0
  19. package/src/ask-browser-entry.mjs +34 -0
  20. package/src/ask-browser.bundle.js +5095 -0
  21. package/src/ask-vocab.mjs +93 -8
  22. package/src/ask.mjs +451 -49
  23. package/src/chat.mjs +1391 -141
  24. package/src/cli-args.mjs +164 -0
  25. package/src/codegraph.mjs +170 -32
  26. package/src/completions/graph-adapter.mjs +118 -0
  27. package/src/extensions.mjs +100 -19
  28. package/src/grammar/ace.mjs +85 -3
  29. package/src/grammar/lexicon-core.json +9531 -63
  30. package/src/grammar/lexicon.mjs +58 -8
  31. package/src/graph-merge.mjs +114 -0
  32. package/src/index.mjs +14 -0
  33. package/src/init.mjs +40 -14
  34. package/src/interpret/normalize.mjs +88 -3
  35. package/src/interpret/strategies/grammar.mjs +10 -0
  36. package/src/interpret/strategies/keywords.mjs +20 -0
  37. package/src/interpret/strategies/noise-strip.mjs +73 -4
  38. package/src/memory/core.mjs +466 -8
  39. package/src/router/goal-reasoner.mjs +41 -7
  40. package/src/router/guardrail.mjs +37 -7
  41. package/src/router/resolver.mjs +50 -4
  42. package/src/sessions.mjs +5 -1
  43. package/src/source.mjs +54 -1
  44. package/src/syllogise.mjs +398 -27
  45. package/src/toml-config.mjs +13 -4
  46. package/src/viz.mjs +541 -0
package/corpus/README.md CHANGED
@@ -39,6 +39,9 @@ loudly instead of seeding garbage.
39
39
  | `tier2/manifest.json` | tier-2: index of specialised corpuses (id, kind, description, source, sha256, size) | — | MPL-2.0 |
40
40
  | `tier2/generate.mjs` | tier-2: the curated-corpus generator + manifest writer (+ opt-in network-fetch path) | — | MPL-2.0 |
41
41
  | `tier2/{aws,python,java,general}.jsonl` | tier-2 SAMPLE corpuses — same fact shape as the tier-1 slice, loadable via the same path (`general` is the one deliberately non-code-domain bundle) | ~4-6 KB each | MPL-2.0 |
42
+ | `tier2/human.jsonl` | the DEFAULT active bundle (archive/PLAN_SEED.md): the everyday "human-world" persona, Small tier (664 facts) — hand-curated from Open English WordNet, bridged to Schema.org's top-level classes (archive/PLAN_SEED.md §3, §8) | ~80 KB | MPL-2.0 (hand-authored fact set; not a verbatim WordNet/Schema.org excerpt — see `tier2/generate.mjs`'s own header comment) |
43
+ | `tier2/human-medium.jsonl` / `tier2/human-large.jsonl` | SIZE tiers of the SAME `human` bundle (archive/PLAN_SEED.md §3) — each holds ONLY the facts that size adds beyond the previous one; both shipped INACTIVE by default, activated via `tmct init --persona-size medium\|large`. Built by `scripts/build-persona-tiers.mjs` from the same WordNet source, automatically curated (sense-ranked, blocklist/denylist-filtered) rather than hand-typed one at a time, given the scale (944 / ~12,000 facts) | ~111 KB / ~1.4 MB | MPL-2.0 (same "hand-authored in homage to the source's shape" basis as `human.jsonl`) |
44
+ | `tier2/human-examples.jsonl` / `tier2/human-examples-medium.jsonl` / `tier2/human-examples-large.jsonl` | the example-sentence corpus (archive/PLAN_SEED.md §9) — real natural-language sentences mapped to the same curated vocabulary, NOT fact triples. Small/Medium tiers are 100% WordNet's own inline `example:` field (same CC-BY-4.0 basis as the fact bundles). Large tier ALSO includes a SemCor-filtered supplement (real Brown Corpus text, re-tagged to modern OEWN senses) for categories where WordNet's own inline coverage is thin (`human-nature` especially — `noun.animal.yaml`'s inline rate is under 1%, archive/PLAN_SEED.md §9's own measurement) | ~11 KB / ~43 KB / ~257 KB | **The WordNet-inline entries**: CC-BY-4.0 (Princeton WordNet + Open English WordNet team), reproduced verbatim (these ARE the source's own example sentences, not a paraphrase). **The `source: "semcor:…"` entries**: CC-BY-4.0 per this SemCor fork's own `LICENSE.md` (`~/projects/globalwordnet/semcor/`, real Brown Corpus text re-tagged to modern senses — the original 1960s Brown Corpus permissions aren't independently re-verified beyond that fork's own license statement; proceeding with attribution was an explicit operator decision, archive/PLAN_SEED.md §9) — each entry's own `source` field names its origin file (`semcor:<genre>/<file>.yaml`) for exactly this reason |
42
45
 
43
46
  And alongside (same phase, different directory because it is tmct-original
44
47
  data, not a derived corpus):
@@ -0,0 +1,43 @@
1
+ # corpus/generated/ — mechanically-generated ACE surface variants
2
+
3
+ `ace-surface-variants.jsonl` — PLAN_BREADTH_FIRST_NLU.md §6a's raw material for
4
+ tmct's "richer template/surface-realization variety" goal. Never an LLM, never
5
+ invented text: every row is a real seed sentence with one word swapped for a
6
+ real WordNet synset sibling, or a real sentence's alternate ACE-grammar-
7
+ declared surface form. Every row is self-verified — it re-parses against
8
+ tmct's own `parseAce` (`src/grammar/ace.mjs`) before being written; a swap
9
+ that doesn't re-parse is dropped, never committed.
10
+
11
+ Regenerate: `node scripts/generate-template-variants.mjs`. Coverage
12
+ measurement: `node scripts/template-coverage.mjs` (baseline) and
13
+ `node scripts/template-coverage.mjs --rescue corpus/generated/ace-surface-variants.jsonl`
14
+ (after). See `archive/PLAN_TEMPLATE_COVERAGE.md` for the design and the real
15
+ before/after numbers.
16
+
17
+ ## Row shapes
18
+
19
+ | `kind` | What | Fields |
20
+ |---|---|---|
21
+ | `rescue` | A real docs-corpus sentence that almost fit the ACE grammar (exactly one undeclared word), rescued by substituting a WordNet synonym of that word that's ALSO already declared in `src/grammar/lexicon-core.json` | `sentence`, `rescued`, `from`, `to`, `pos`, `synsetId`, `sourceFile` |
22
+ | `variant` | A real WordNet/SemCor example sentence (`corpus/tier2/human-examples*.jsonl`) that already hits `parseAce`, with one content word swapped for a same-synset sibling (both ends independently declared in tmct's own lexicon) | `seed`, `generated`, `from`, `to`, `pos`, `synsetId`, `sourceCorpus` |
23
+ | `alt-phrasing` | A possessive-pattern (#7) hit rewritten in the ACE grammar's OTHER declared surface form for the same triple (`"X's Y is Z"` <-> `"the Y of X is Z"`, both routed through `buildPossessive` in `src/grammar/ace.mjs`) | `seed`, `generated`, `pattern`, `form` |
24
+
25
+ Every row also carries `provenance` (`wordnet:<synsetId>` or
26
+ `grammar:ace.mjs pattern 7 (possessive) — …`).
27
+
28
+ ## Not wired into the product path
29
+
30
+ This corpus is not loaded by `src/chat.mjs`/`src/ask.mjs` or any other
31
+ product code — it is committed raw material, verified by
32
+ `scripts/template-coverage.mjs`, per PLAN_BREADTH_FIRST_NLU.md §6's explicit
33
+ non-goal. Wiring it into live answer rendering is a separate, future phase.
34
+
35
+ ## Licence
36
+
37
+ Open English WordNet content (synset `members`/`example` fields) is
38
+ CC-BY-4.0; SemCor-derived sentences (`corpus/tier2/human-examples-large.jsonl`)
39
+ are CC-BY-4.0 per that fork's own `LICENSE.md` (same basis `corpus/README.md`
40
+ already documents for that file). A `variant`/`rescue` row is a one-word
41
+ derivative of that material — CC-BY-4.0. An `alt-phrasing` row is a pure
42
+ grammar-level rephrasing of the same source sentence — CC-BY-4.0 also, no new
43
+ creative content introduced either way.
@@ -0,0 +1,17 @@
1
+ {"kind":"variant","seed":"the ace of trumps is a sure winner","generated":"the one of trumps is a sure winner","from":"ace","to":"one","pos":"noun","synsetId":"13764713-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:13764713-n"}
2
+ {"kind":"variant","seed":"the ace of trumps is a sure winner","generated":"the single of trumps is a sure winner","from":"ace","to":"single","pos":"noun","synsetId":"13764713-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:13764713-n"}
3
+ {"kind":"variant","seed":"the ace of trumps is a sure winner","generated":"the unity of trumps is a sure winner","from":"ace","to":"unity","pos":"noun","synsetId":"13764713-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:13764713-n"}
4
+ {"kind":"variant","seed":"the ace of trumps is a sure winner","generated":"the ace of trumps is a sure victor","from":"winner","to":"victor","pos":"noun","synsetId":"10802616-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:10802616-n"}
5
+ {"kind":"variant","seed":"the piece has a fast rhythm","generated":"the piece has a fast beat","from":"rhythm","to":"beat","pos":"noun","synsetId":"07100710-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:07100710-n"}
6
+ {"kind":"variant","seed":"the quality of mercy is not strained","generated":"the quality of mercifulness is not strained","from":"mercy","to":"mercifulness","pos":"noun","synsetId":"01073335-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:01073335-n"}
7
+ {"kind":"variant","seed":"the purpose of art is the arousal of emotions","generated":"the intent of art is the arousal of emotions","from":"purpose","to":"intent","pos":"noun","synsetId":"05991037-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:05991037-n"}
8
+ {"kind":"variant","seed":"the purpose of art is the arousal of emotions","generated":"the intention of art is the arousal of emotions","from":"purpose","to":"intention","pos":"noun","synsetId":"05991037-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:05991037-n"}
9
+ {"kind":"variant","seed":"the purpose of art is the arousal of emotions","generated":"the aim of art is the arousal of emotions","from":"purpose","to":"aim","pos":"noun","synsetId":"05991037-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:05991037-n"}
10
+ {"kind":"variant","seed":"the purpose of art is the arousal of emotions","generated":"the design of art is the arousal of emotions","from":"purpose","to":"design","pos":"noun","synsetId":"05991037-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:05991037-n"}
11
+ {"kind":"variant","seed":"the moral of the story is to love thy neighbor","generated":"the lesson of the story is to love thy neighbor","from":"moral","to":"lesson","pos":"noun","synsetId":"06618397-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:06618397-n"}
12
+ {"kind":"variant","seed":"the moral of the story is to love thy neighbor","generated":"the moral of the narration is to love thy neighbor","from":"story","to":"narration","pos":"noun","synsetId":"07235754-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:07235754-n"}
13
+ {"kind":"variant","seed":"the moral of the story is to love thy neighbor","generated":"the moral of the tale is to love thy neighbor","from":"story","to":"tale","pos":"noun","synsetId":"07235754-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:07235754-n"}
14
+ {"kind":"variant","seed":"the moral of the story is to love thy neighbor","generated":"the moral of the story is to love thy neighbour","from":"neighbor","to":"neighbour","pos":"noun","synsetId":"10372030-n","sourceCorpus":"corpus/tier2/human-examples-large.jsonl","provenance":"wordnet:10372030-n"}
15
+ {"kind":"alt-phrasing","seed":"the ace of trumps is a sure winner","generated":"trumps's ace is a sure winner","pattern":"possessive","form":"apostrophe","provenance":"grammar:ace.mjs pattern 7 (possessive) — both surface forms route through buildPossessive"}
16
+ {"kind":"alt-phrasing","seed":"the quality of mercy is not strained","generated":"mercy's quality is not strained","pattern":"possessive","form":"apostrophe","provenance":"grammar:ace.mjs pattern 7 (possessive) — both surface forms route through buildPossessive"}
17
+ {"kind":"alt-phrasing","seed":"the purpose of art is the arousal of emotions","generated":"art's purpose is the arousal of emotions","pattern":"possessive","form":"apostrophe","provenance":"grammar:ace.mjs pattern 7 (possessive) — both surface forms route through buildPossessive"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 1,
3
+ "generated": "by scripts/generate-template-variants.mjs",
4
+ "file": "ace-surface-variants.jsonl",
5
+ "rows": 17,
6
+ "bytes": 4774,
7
+ "sha256": "5364415f73f7a366371f1fdcc072b5059f81871ef48b106088f05b1441def569",
8
+ "license": "CC-BY-4.0 (WordNet-derived synonym substitutions of Open English WordNet / SemCor example sentences and this repo's own MPL-2.0 docs prose — see corpus/generated/README.md)"
9
+ }