@polycode-projects/the-mechanical-code-talker 5.0.15 → 5.0.16

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 (96) hide show
  1. package/README.md +11 -3
  2. package/bin/tmct.mjs +16 -0
  3. package/corpus/LICENSES.json +3 -3
  4. package/corpus/domains/code/LICENSE-NOTICE +43 -0
  5. package/corpus/{seon → domains/code}/README.md +22 -24
  6. package/corpus/domains/code/vocab.json +43 -0
  7. package/corpus/reference/manifest.json +126 -126
  8. package/corpus/reference/shards/ref-00.jsonl.gz +0 -0
  9. package/corpus/reference/shards/ref-01.jsonl.gz +0 -0
  10. package/corpus/reference/shards/ref-02.jsonl.gz +0 -0
  11. package/corpus/reference/shards/ref-03.jsonl.gz +0 -0
  12. package/corpus/reference/shards/ref-04.jsonl.gz +0 -0
  13. package/corpus/reference/shards/ref-05.jsonl.gz +0 -0
  14. package/corpus/reference/shards/ref-06.jsonl.gz +0 -0
  15. package/corpus/reference/shards/ref-07.jsonl.gz +0 -0
  16. package/corpus/reference/shards/ref-08.jsonl.gz +0 -0
  17. package/corpus/reference/shards/ref-09.jsonl.gz +0 -0
  18. package/corpus/reference/shards/ref-0a.jsonl.gz +0 -0
  19. package/corpus/reference/shards/ref-0b.jsonl.gz +0 -0
  20. package/corpus/reference/shards/ref-0c.jsonl.gz +0 -0
  21. package/corpus/reference/shards/ref-0d.jsonl.gz +0 -0
  22. package/corpus/reference/shards/ref-0e.jsonl.gz +0 -0
  23. package/corpus/reference/shards/ref-0f.jsonl.gz +0 -0
  24. package/corpus/reference/shards/ref-10.jsonl.gz +0 -0
  25. package/corpus/reference/shards/ref-11.jsonl.gz +0 -0
  26. package/corpus/reference/shards/ref-12.jsonl.gz +0 -0
  27. package/corpus/reference/shards/ref-13.jsonl.gz +0 -0
  28. package/corpus/reference/shards/ref-14.jsonl.gz +0 -0
  29. package/corpus/reference/shards/ref-15.jsonl.gz +0 -0
  30. package/corpus/reference/shards/ref-16.jsonl.gz +0 -0
  31. package/corpus/reference/shards/ref-17.jsonl.gz +0 -0
  32. package/corpus/reference/shards/ref-18.jsonl.gz +0 -0
  33. package/corpus/reference/shards/ref-19.jsonl.gz +0 -0
  34. package/corpus/reference/shards/ref-1a.jsonl.gz +0 -0
  35. package/corpus/reference/shards/ref-1b.jsonl.gz +0 -0
  36. package/corpus/reference/shards/ref-1c.jsonl.gz +0 -0
  37. package/corpus/reference/shards/ref-1d.jsonl.gz +0 -0
  38. package/corpus/reference/shards/ref-1e.jsonl.gz +0 -0
  39. package/corpus/reference/shards/ref-1f.jsonl.gz +0 -0
  40. package/corpus/reference/shards/ref-20.jsonl.gz +0 -0
  41. package/corpus/reference/shards/ref-21.jsonl.gz +0 -0
  42. package/corpus/reference/shards/ref-22.jsonl.gz +0 -0
  43. package/corpus/reference/shards/ref-23.jsonl.gz +0 -0
  44. package/corpus/reference/shards/ref-24.jsonl.gz +0 -0
  45. package/corpus/reference/shards/ref-25.jsonl.gz +0 -0
  46. package/corpus/reference/shards/ref-26.jsonl.gz +0 -0
  47. package/corpus/reference/shards/ref-27.jsonl.gz +0 -0
  48. package/corpus/reference/shards/ref-28.jsonl.gz +0 -0
  49. package/corpus/reference/shards/ref-29.jsonl.gz +0 -0
  50. package/corpus/reference/shards/ref-2a.jsonl.gz +0 -0
  51. package/corpus/reference/shards/ref-2b.jsonl.gz +0 -0
  52. package/corpus/reference/shards/ref-2c.jsonl.gz +0 -0
  53. package/corpus/reference/shards/ref-2d.jsonl.gz +0 -0
  54. package/corpus/reference/shards/ref-2e.jsonl.gz +0 -0
  55. package/corpus/reference/shards/ref-2f.jsonl.gz +0 -0
  56. package/corpus/reference/shards/ref-30.jsonl.gz +0 -0
  57. package/corpus/reference/shards/ref-31.jsonl.gz +0 -0
  58. package/corpus/reference/shards/ref-32.jsonl.gz +0 -0
  59. package/corpus/reference/shards/ref-33.jsonl.gz +0 -0
  60. package/corpus/reference/shards/ref-34.jsonl.gz +0 -0
  61. package/corpus/reference/shards/ref-35.jsonl.gz +0 -0
  62. package/corpus/reference/shards/ref-36.jsonl.gz +0 -0
  63. package/corpus/reference/shards/ref-37.jsonl.gz +0 -0
  64. package/corpus/reference/shards/ref-38.jsonl.gz +0 -0
  65. package/corpus/reference/shards/ref-39.jsonl.gz +0 -0
  66. package/corpus/reference/shards/ref-3a.jsonl.gz +0 -0
  67. package/corpus/reference/shards/ref-3b.jsonl.gz +0 -0
  68. package/corpus/reference/shards/ref-3c.jsonl.gz +0 -0
  69. package/corpus/reference/shards/ref-3d.jsonl.gz +0 -0
  70. package/corpus/reference/shards/ref-3e.jsonl.gz +0 -0
  71. package/corpus/reference/shards/ref-3f.jsonl.gz +0 -0
  72. package/corpus/tier2/vocab-empty.json +6 -0
  73. package/data/templates/responses.jsonl +3 -0
  74. package/package.json +17 -1
  75. package/src/adapters/corpus/conceptnet.mjs +7 -3
  76. package/src/adapters/corpus/courtesy.mjs +129 -0
  77. package/src/adapters/corpus/research-source.mjs +120 -0
  78. package/src/adapters/corpus/wikidata-live.mjs +262 -0
  79. package/src/adapters/corpus/wikipedia-live.mjs +52 -108
  80. package/src/domain/codegraph.mjs +10 -2
  81. package/src/domain/grammar/lexicon-core.json +1 -0
  82. package/src/domain/reference-pack.mjs +61 -9
  83. package/src/services/chat-session.mjs +48 -7
  84. package/src/services/chat.mjs +359 -115
  85. package/src/services/extensions.mjs +203 -3
  86. package/src/services/init.mjs +6 -5
  87. package/src/services/lane-vocab-data.mjs +56 -0
  88. package/src/surfaces/web/claims-browser-entry.mjs +26 -0
  89. package/src/surfaces/web/memory-ask-browser.bundle.js +130 -128
  90. package/src/surfaces/web/planner-instances.mjs +152 -0
  91. package/src/tools/handlers/tmct-untested.mjs +2 -2
  92. package/src/tools/server.mjs +9 -4
  93. package/corpus/seon/LICENSE-NOTICE +0 -37
  94. /package/corpus/{seon → domains/code}/concepts.jsonl +0 -0
  95. /package/corpus/{seon → domains/code}/definitions.jsonl +0 -0
  96. /package/corpus/{seon → domains/code}/relations.jsonl +0 -0
package/README.md CHANGED
@@ -801,11 +801,19 @@ committed vocabulary so it knows what it's talking about from turn one: an
801
801
  everyday **human-world** persona covering people, places, objects, nature,
802
802
  time and events, body and food, and mind vocabulary. It's hand-curated from
803
803
  Open English WordNet and bridged to Schema.org's top-level classes, so "what
804
- is a dog?" answers offline, from disk, on turn one. A code-domain persona (a curated **SEON**
805
- software ontology plus the whole filtered **ConceptNet slice**, CC-BY-SA 4.0)
806
- is available opt-in: `tmct init --with-persona code`. `--ephemeral` (used by
804
+ is a dog?" answers offline, from disk, on turn one. `--ephemeral` (used by
807
805
  the shipped `npm run example:*` demos) reads a graph but writes nothing back.
808
806
 
807
+ A bare install stays domain-neutral. No code vocabulary reaches any banner,
808
+ greeting, count, miss, help, or orientation text.
809
+
810
+ A **domain pack** bundles a corpus of facts, a lane vocabulary for that domain,
811
+ optional templates, and a declared grounding channel. The **code pack** is the
812
+ first shipped pack: a curated software ontology (SEON), the full filtered
813
+ ConceptNet slice (CC-BY-SA 4.0), and code-domain lane vocabulary. Activate it
814
+ with `tmct init --with-persona code` or automatically by running `tmct index`
815
+ inside a real codebase.
816
+
809
817
  The default persona also comes in three sizes: Small (~664 facts, the
810
818
  default), Medium (~1,608, `tmct init --persona-size medium`) and Large
811
819
  (~13,600, `--persona-size large`, deep enough to chain real multi-hop
package/bin/tmct.mjs CHANGED
@@ -1119,6 +1119,22 @@ async function main() {
1119
1119
  `indexed ${stats.modules} modules (${stats.symbols} symbols) — code questions now work in \`tmct chat\`: `
1120
1120
  + `try "which modules import <path>" or "what does <module> do".\n`,
1121
1121
  );
1122
+ // Indexing is an explicit code-domain act: activate the `code` pack in
1123
+ // this repo's tmct.toml (creating one if none exists yet) so the next
1124
+ // session's count/help/miss-recovery vocabulary is there without a
1125
+ // separate --with-persona code step. Activation only — it doesn't seed
1126
+ // the seon corpus into memory; that stays `tmct init --with-persona
1127
+ // code`'s job (or a later `tmct import --corpus seon`). Best-effort: a
1128
+ // config write failure degrades to an indexed-but-unactivated repo,
1129
+ // never a failed index.
1130
+ try {
1131
+ const { cfg } = await readConfigForRewrite(repoRoot);
1132
+ const existingCode = cfg.extensions?.code || {};
1133
+ cfg.extensions = { ...(cfg.extensions || {}), code: { ...existingCode, active: true } };
1134
+ await writeConfig(repoRoot, cfg);
1135
+ } catch (e) {
1136
+ process.stderr.write(`tmct index: WARNING could not activate the code pack in tmct.toml — ${e?.message || e}\n`);
1137
+ }
1122
1138
  }
1123
1139
  if (stats.failures?.length) {
1124
1140
  process.stderr.write(`tmct index: ${stats.failures.length} file(s) failed to parse (skipped): ${stats.failures.slice(0, 5).join(", ")}${stats.failures.length > 5 ? ", …" : ""}\n`);
@@ -10,11 +10,11 @@
10
10
  "notice": "corpus/conceptnet/LICENSE-NOTICE"
11
11
  },
12
12
  {
13
- "path": "corpus/seon/",
14
- "upstream": "first-party (hand-authored for tmct; named in homage to SEON, no SEON content copied)",
13
+ "path": "corpus/domains/code/",
14
+ "upstream": "first-party (hand-authored for tmct; named in homage to SEON, no SEON content copied — the seon bundle's own concepts/definitions/relations, plus the code domain pack's lane vocabulary, src/services/extensions.mjs)",
15
15
  "license": "MPL-2.0",
16
16
  "shareAlike": false,
17
- "notice": "corpus/seon/LICENSE-NOTICE"
17
+ "notice": "corpus/domains/code/LICENSE-NOTICE"
18
18
  },
19
19
  {
20
20
  "path": "corpus/wordnet/",
@@ -0,0 +1,43 @@
1
+ LICENSE NOTICE — corpus/domains/code/
2
+ ======================================
3
+
4
+ The files in this directory (concepts.jsonl, definitions.jsonl, relations.jsonl,
5
+ vocab.json, README.md) are ORIGINAL WORK authored by hand for
6
+ the-mechanical-code-talker (tmct), and are licensed under this repository's
7
+ license, the Mozilla Public License Version 2.0 (MPL-2.0) — the same terms as
8
+ the rest of the repository.
9
+
10
+ https://www.mozilla.org/MPL/2.0/
11
+
12
+ They are NOT derived from ConceptNet and are NOT under CC-BY-SA. Do not confuse
13
+ this directory with corpus/conceptnet/, whose slice.jsonl is a CC-BY-SA 4.0
14
+ excerpt of ConceptNet 5 (see corpus/conceptnet/LICENSE-NOTICE).
15
+
16
+ What this is
17
+ ------------
18
+
19
+ This is tmct's code domain pack: the curated tier-1 software-engineering
20
+ ontology (concepts.jsonl, definitions.jsonl, relations.jsonl) — a hand-
21
+ authored, language-neutral set of concept definitions and relation facts covering
22
+ the vocabulary declared in src/grammar/lexicon-core.json — plus the pack's own
23
+ lane vocabulary (vocab.json; count nouns, help rows, the miss-recovery pointer,
24
+ src/services/extensions.mjs). Every line was written and checked by the
25
+ project, not compiled from an external dataset.
26
+
27
+ On the name "seon"
28
+ ------------------
29
+
30
+ The ontology is named for SEON (the Software Evolution ONtologies, se-on.org),
31
+ the FAMIX-derived reference vocabulary tmct's code-graph prop tokens borrow term
32
+ IDEAS from (see ontology/tmct-core.ttl). It carries the bundle name "seon" and
33
+ the "corpus:seon" provenance prefix (src/services/extensions.mjs) regardless of
34
+ which directory it lives under. This directory does NOT redistribute SEON's
35
+ published ontology files; it is tmct's own curated ontology, named in homage to
36
+ that reference vocabulary. No SEON content is copied here.
37
+
38
+ Reuse
39
+ -----
40
+
41
+ As MPL-2.0 material, these files may be used, modified, and redistributed under
42
+ the MPL-2.0 terms. Attribution to the-mechanical-code-talker / Polycode is
43
+ appreciated but governed by the license, not by CC-BY-SA share-alike.
@@ -1,8 +1,14 @@
1
- # corpus/seon — tmct's curated tier-1 software-engineering ontology
2
-
3
- A hand-authored, **language-neutral** ontology of the software-engineering concepts
4
- tmct's grammar lexicon knows about. Its purpose, in the operator's words: *"the chat
5
- knows about what it knows about."* Every lexicon concept gets
1
+ # corpus/domains/code — tmct's code domain pack
2
+
3
+ The code domain pack: a hand-authored, **language-neutral** ontology of the
4
+ software-engineering concepts tmct's grammar lexicon knows about, plus the
5
+ pack's own lane vocabulary (count nouns, help rows, the miss-recovery pointer).
6
+ Registered as the `code` pack extension entry (`src/services/extensions.mjs`);
7
+ `--with-persona code` and `tmct index` both activate it. The ontology's own
8
+ bundle name is `seon` and its provenance prefix is `corpus:seon` — unchanged
9
+ by this directory's location (see `LICENSE-NOTICE`). Its purpose, in the
10
+ operator's words: *"the chat knows about what it knows about."* Every lexicon
11
+ concept gets
6
12
 
7
13
  1. an **English definition** — what it IS (`definitions.jsonl`), and
8
14
  2. **relation facts** — how it RELATES to other concepts (`concepts.jsonl`),
@@ -21,6 +27,7 @@ CC-BY-SA like the ConceptNet slice.
21
27
  | `concepts.jsonl` | relation facts, byte-identical shape to `corpus/conceptnet/slice.jsonl` | 399 facts |
22
28
  | `definitions.jsonl` | `{ "term", "definition", "sense": "software" }`, one per line | 288 definitions |
23
29
  | `relations.jsonl` | `{ "relation", "definition", "sense": "software" }`, one per line — what each edge kind means, so "what does imports mean" answers without per-repo seeding | 9 relations |
30
+ | `vocab.json` | the pack's lane vocabulary: `countNouns`, `classLabels`, `helpRows`, `missRecoveryPointer` — merged in by `mergedLaneVocab` (`src/services/extensions.mjs`) | — |
24
31
  | `LICENSE-NOTICE` | MPL-2.0 provenance for this directory | — |
25
32
 
26
33
  ### `concepts.jsonl` — same shape as the ConceptNet slice
@@ -94,25 +101,16 @@ A handful of facts and definitions give meta-questions real ground to stand on:
94
101
  `memory graph usedFor storing facts`; `seon isa ontology` — plus definitions for
95
102
  `tmct`, `code graph`, `memory graph`, and `seon`.
96
103
 
97
- ## How the coordinator should seed this (Wave-2 chat.mjs work — NOT wired here)
98
-
99
- This directory is **data only**; wiring it into seeding is the coordinator's
100
- `chat.mjs` / `init.mjs` change. Recommended:
101
-
102
- 1. **Seed `corpus/seon` FIRST, ahead of the ConceptNet slice**, and **exempt it from
103
- the 500-fact cap** (`SEED_LIMIT`). It is small (399 lines → 380 emitted facts) and
104
- fully curated, so the whole tier belongs in memory before any capped ConceptNet
105
- fill. Concretely: call `seedMemory(repo, { slicePath: SEON_CONCEPTS_FILE })` with
106
- **no `limit`**, then run the existing capped ConceptNet seed after it. The
107
- idempotent, content-hashed `appendFact` ids mean a term appearing in both tiers
108
- converges to one fact.
109
- 2. Keep the existing `SEED_PREFER` order
110
- (`rdfs:subClassOf`, `rdf:type`, `mgx:usedFor`, `mgx:partOf`, `mgx:capableOf`) — it
111
- already front-loads exactly this file's dominant predicates, though with no cap on
112
- the seon tier the ordering only affects the ConceptNet tail.
113
- 3. **Provenance caveat:** `toFacts` currently hard-codes the provenance string
114
- `corpus:conceptnet <rel>`. If the coordinator wants seon facts tagged as their own
115
- source (`corpus:seon`), that is a one-line parametrisation of `toFacts`
104
+ ## How this seeds
105
+
106
+ `seedMemory(repo, { slicePath: SEON_CONCEPTS_FILE, provenancePrefix: "corpus:seon" })`
107
+ seeds this ontology whole, uncapped, ahead of the capped ConceptNet band — the
108
+ `code` (or `seon`) extension entry's own activation drives it
109
+ (`src/services/extensions.mjs`'s `seedActiveCorpusEntries`). The idempotent,
110
+ content-hashed `appendFact` ids mean a term appearing in both tiers converges
111
+ to one fact. `SEED_PREFER`'s order
112
+ (`rdfs:subClassOf`, `rdf:type`, `mgx:usedFor`, `mgx:partOf`, `mgx:capableOf`)
113
+ front-loads this file's dominant predicates.
116
114
 
117
115
  ## Regenerating / extending
118
116
 
@@ -0,0 +1,43 @@
1
+ {
2
+ "countNouns": {
3
+ "class": "Class", "classes": "Class",
4
+ "function": "Function", "functions": "Function", "func": "Function", "funcs": "Function",
5
+ "module": "Module", "modules": "Module", "file": "Module", "files": "Module",
6
+ "package": "Package", "packages": "Package",
7
+ "method": "Method", "methods": "Method",
8
+ "attribute": "Attribute", "attributes": "Attribute",
9
+ "variable": "GlobalVariable", "variables": "GlobalVariable", "global": "GlobalVariable", "globals": "GlobalVariable",
10
+ "commit": "Commit", "commits": "Commit",
11
+ "session": "Session", "sessions": "Session"
12
+ },
13
+ "classLabels": {
14
+ "Class": ["class", "classes"],
15
+ "Function": ["function", "functions"],
16
+ "Module": ["module", "modules"],
17
+ "Package": ["package", "packages"],
18
+ "Method": ["method", "methods"],
19
+ "Attribute": ["attribute", "attributes"],
20
+ "GlobalVariable": ["variable", "variables"],
21
+ "Commit": ["commit", "commits"],
22
+ "Session": ["session", "sessions"]
23
+ },
24
+ "helpRows": [
25
+ ["/find <query>", "lexical search across the graph"],
26
+ ["/search <query>", "alias of /find"],
27
+ ["/context <symbol>", "the sized edit bundle for a symbol (start here to change code)"],
28
+ ["/snippet <symbol>", "exact source of one function/class/method"],
29
+ ["/describe <symbol>", "a symbol's definition, kind and relations"],
30
+ ["/signature <symbol>", "a symbol's signature only"],
31
+ ["/members <class>", "the methods/attributes of a class"],
32
+ ["/subclasses <class>", "the subclasses of a class"],
33
+ ["/impact <module>", "what a change to this module or symbol reaches (impact closure)"],
34
+ ["/callers <symbol>", "functions that call this symbol"],
35
+ ["/callees <symbol>", "functions this symbol calls"],
36
+ ["/tests <symbol>", "the tests covering this symbol"],
37
+ ["/untested", "symbols with no covering test"],
38
+ ["/history <symbol>", "the commit history of this symbol"],
39
+ ["/exports <module>", "a module's public exports"],
40
+ ["/arch [package]", "the architecture overview (optional package filter)"]
41
+ ],
42
+ "missRecoveryPointer": "for code structure, index this repo with `tmct index`, or point me at a .tmct/graph.json with --repo <path> (or try `npm run example:mini`)."
43
+ }