@polycode-projects/the-mechanical-code-talker 2.5.0 → 2.5.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.
- package/README.md +15 -11
- package/bin/tmct.mjs +8 -5
- package/corpus/LICENSES.json +7 -0
- package/corpus/README.md +3 -3
- package/corpus/reference/LICENSE-NOTICE +36 -0
- package/corpus/reference/README.md +19 -0
- package/corpus/reference/index.json.gz +0 -0
- package/corpus/reference/manifest.json +367 -0
- package/corpus/reference/shards/ref-00.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-01.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-02.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-03.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-04.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-05.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-06.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-07.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-08.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-09.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0a.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0b.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0c.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0d.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0e.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-0f.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-10.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-11.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-12.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-13.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-14.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-15.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-16.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-17.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-18.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-19.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1a.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1b.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1c.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1d.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1e.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-1f.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-20.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-21.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-22.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-23.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-24.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-25.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-26.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-27.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-28.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-29.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2a.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2b.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2c.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2d.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2e.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-2f.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-30.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-31.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-32.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-33.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-34.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-35.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-36.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-37.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-38.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-39.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3a.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3b.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3c.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3d.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3e.jsonl.gz +0 -0
- package/corpus/reference/shards/ref-3f.jsonl.gz +0 -0
- package/package.json +8 -4
- package/src/adapters/corpus/reference-pack.mjs +107 -0
- package/src/adapters/memory/core.mjs +104 -10
- package/src/domain/ask.mjs +66 -9
- package/src/domain/cli-verbs.mjs +3 -3
- package/src/domain/codegraph.mjs +6 -0
- package/src/domain/dialogue-acts.mjs +155 -0
- package/src/domain/grammar/lexicon-core.json +1 -1
- package/src/domain/interpret/normalize.mjs +14 -2
- package/src/domain/interpret/strategies/keywords.mjs +10 -1
- package/src/domain/memory/trust.mjs +12 -0
- package/src/domain/reference-pack.mjs +72 -0
- package/src/domain/skos-view.mjs +111 -0
- package/src/domain/syllogise.mjs +647 -56
- package/src/services/chat.mjs +499 -123
- package/src/services/init.mjs +2 -2
- package/src/surfaces/web/chat-browser-entry.mjs +87 -0
- package/src/surfaces/web/memory-ask-browser.bundle.js +865 -74
- package/src/tools/definitions.mjs +13 -0
- package/src/tools/handlers/index.mjs +2 -0
- package/src/tools/handlers/tmct-related.mjs +30 -0
- package/ROADMAP.md +0 -130
|
@@ -180,6 +180,19 @@ export const TOOL_DEFINITIONS = Object.freeze([
|
|
|
180
180
|
inputSchema: classArg("The class to walk the inheritance edges of."),
|
|
181
181
|
example: { class: "Field" },
|
|
182
182
|
},
|
|
183
|
+
{
|
|
184
|
+
name: "tmct_related",
|
|
185
|
+
tier: "cold",
|
|
186
|
+
summary: "A term's synonyms (skos:altLabel) and related concepts (skos:related), from the memory graph's relation facts.",
|
|
187
|
+
inputSchema: {
|
|
188
|
+
type: "object",
|
|
189
|
+
required: ["term"],
|
|
190
|
+
properties: {
|
|
191
|
+
term: { type: "string", description: "The term whose synonyms / related concepts you want." },
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
example: { term: "sofa" },
|
|
195
|
+
},
|
|
183
196
|
{
|
|
184
197
|
name: "tmct_architecture",
|
|
185
198
|
tier: "cold",
|
|
@@ -14,6 +14,7 @@ import { tmct_impact } from "./tmct-impact.mjs";
|
|
|
14
14
|
import { tmct_search } from "./tmct-search.mjs";
|
|
15
15
|
import { tmct_members } from "./tmct-members.mjs";
|
|
16
16
|
import { tmct_subclasses } from "./tmct-subclasses.mjs";
|
|
17
|
+
import { tmct_related } from "./tmct-related.mjs";
|
|
17
18
|
import { tmct_architecture } from "./tmct-architecture.mjs";
|
|
18
19
|
import { tmct_exports } from "./tmct-exports.mjs";
|
|
19
20
|
import { tmct_untested } from "./tmct-untested.mjs";
|
|
@@ -38,6 +39,7 @@ export const HANDLERS = Object.freeze({
|
|
|
38
39
|
tmct_search,
|
|
39
40
|
tmct_members,
|
|
40
41
|
tmct_subclasses,
|
|
42
|
+
tmct_related,
|
|
41
43
|
tmct_architecture,
|
|
42
44
|
tmct_exports,
|
|
43
45
|
tmct_untested,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// tmct_related — a term's synonyms (skos:altLabel) and related concepts (skos:related),
|
|
2
|
+
// served from the conversational-memory graph's mgx:synonym / mgx:relatedTo / mgx:similarTo
|
|
3
|
+
// facts through the derived SKOS concept view (src/domain/skos-view.mjs). A term the store
|
|
4
|
+
// holds no relation facts for misses honestly — never a guessed neighbour.
|
|
5
|
+
|
|
6
|
+
import { ToolError } from "../../adapters/config.mjs";
|
|
7
|
+
import { relatedForTerm } from "../../domain/skos-view.mjs";
|
|
8
|
+
import { memoryFactRows } from "../memory-fallthrough.mjs";
|
|
9
|
+
import { requiredArg } from "./kit.mjs";
|
|
10
|
+
|
|
11
|
+
export async function tmct_related(args, { config }) {
|
|
12
|
+
const term = requiredArg(args, "term");
|
|
13
|
+
const hit = relatedForTerm(await memoryFactRows(config), term);
|
|
14
|
+
if (!hit) {
|
|
15
|
+
throw new ToolError(
|
|
16
|
+
`no synonym or related facts for "${term}" in the memory graph. ` +
|
|
17
|
+
"This view answers where the store holds mgx:synonym / mgx:relatedTo facts (a corpus import seeds them).",
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const lines = [`${hit.prefLabel} [${hit.conceptId}]`];
|
|
21
|
+
if (hit.synonyms.length) lines.push(`synonyms (skos:altLabel): ${hit.synonyms.join(", ")}`);
|
|
22
|
+
if (hit.related.length) lines.push(`related (skos:related): ${hit.related.map((c) => c.prefLabel).join(", ")}`);
|
|
23
|
+
lines.push("(from the memory graph's mgx:synonym / mgx:relatedTo / mgx:similarTo facts)");
|
|
24
|
+
return lines.join("\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// The memory graph is this tool's only source — it answers with or without a
|
|
28
|
+
// code-map graph, so the shared code-graph load (which refuses an empty graph)
|
|
29
|
+
// must not gate it.
|
|
30
|
+
tmct_related.ownsGraphLoad = true;
|
package/ROADMAP.md
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# ROADMAP — tmct's current shape and what's next
|
|
2
|
-
|
|
3
|
-
Forward-looking at a **feature level**: what tmct is capable of right now, and what's planned next.
|
|
4
|
-
No session narrative, no dated diary, no "shipped/DONE" history — that's what git log and the
|
|
5
|
-
`archive/`/`BENCHMARK_*.md`/`CAPABILITIES_*.md` records are for. For **task-level** pickup (specific
|
|
6
|
-
open items, session-scoped), see `HANDOVER.md` instead — this file doesn't duplicate that list.
|
|
7
|
-
|
|
8
|
-
## What tmct is
|
|
9
|
-
|
|
10
|
-
A tolerant, ELIZA/PARRY-style chat surface over a codebase, obsessed with software the way PARRY was
|
|
11
|
-
obsessed with the mafia — deterministic, zero-cost, **no LLM anywhere in the product path**. Guides a
|
|
12
|
-
user toward precision queries rather than guessing; every answer is grounded, restates every genuine
|
|
13
|
-
reading it finds in full, or is an honest miss when nothing grounds it at all. Its visual surfaces —
|
|
14
|
-
the ledger explorer with its in-browser chat (`tmct viz`), the animated plan page
|
|
15
|
-
(`chat --prompt … --render blocks`), and the Pages homepage hero — are the same graph read out loud:
|
|
16
|
-
same engine, same provenance, no LLM.
|
|
17
|
-
|
|
18
|
-
## Ambition
|
|
19
|
-
|
|
20
|
-
Declared, forward-looking goals — not yet achieved, stated here so they steer future work instead of
|
|
21
|
-
getting silently traded away by inherited caution:
|
|
22
|
-
|
|
23
|
-
- **Reach for Llama-3-level natural language fluency.** by growing rich
|
|
24
|
-
template/surface-realization variety, so an answer shape has many valid phrasings instead of one
|
|
25
|
-
fixed slot-fill.
|
|
26
|
-
- **Resolve ambiguity breadth-first, always.** Every genuinely valid reading gets its own real answer
|
|
27
|
-
restated in full, never a bare "could mean X or Y — try rephrasing" punt, bounded only by existing
|
|
28
|
-
clipping/pagination limits. L
|
|
29
|
-
- **Paraphrase alongside the original, verified, never instead of it.** A surface-realization variant
|
|
30
|
-
sits next to the literal grounded answer, never replacing it, and its accuracy is checked, not
|
|
31
|
-
assumed — by running tmct's own deterministic inference/consistency machinery (`src/domain/syllogise.mjs`)
|
|
32
|
-
against both the original and the paraphrase: they must entail the same conclusions, and neither may
|
|
33
|
-
contradict the other sentence-by-sentence..
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## What's next (feature-shaped — see `HANDOVER.md` for the current task-level list)
|
|
37
|
-
|
|
38
|
-
- **`PLAN_ADVENTURE.md`** — a text-adventure architectural stretch. Its world-state and
|
|
39
|
-
actions-as-data substrate shipped generically with the planning lane (action rule kinds,
|
|
40
|
-
per-step board snapshots, legal-move enumeration); what remains its own is the imperative
|
|
41
|
-
command grammar ("go north", "take the key"), the NPC turn scheduler, the Ashcombe Hall
|
|
42
|
-
corpus, and the room-look digest.
|
|
43
|
-
- **`PLAN_SYLLOGIST.md`** — the reasoning engine's research horizon. The single-justification
|
|
44
|
-
retraction slice shipped (`retractSubClassOf`, justification persistence and cascade across all
|
|
45
|
-
five rules); still open there: the ATMS generalization (alternate justification sets per fact),
|
|
46
|
-
incremental matching (§2), and relevance under budget (§4).
|
|
47
|
-
- **`PLAN_GUESS_NUMBER.md`** — closed-loop planning over hidden state (belief-interval bisection,
|
|
48
|
-
thinker-mode secret commitment, observation folding) on top of the shipped planner substrate.
|
|
49
|
-
Design-only.
|
|
50
|
-
- **`PLAN_CODE.md`** — small JS-function and HTML/CSS-fragment synthesis, plus goal-directed
|
|
51
|
-
program repair (tests as the goal state, mutation templates as planning actions), via a sandboxed
|
|
52
|
-
headless browser (Track 1, rule/frame synthesis, already shipped). Blocked on a sandbox
|
|
53
|
-
dependency decision.
|
|
54
|
-
- **`PLAN_AGENTS.md`** — the governing plan for tmct's broader multi-repo arc (marginalia, seonix,
|
|
55
|
-
a pluggable LLM rung for Claude Code/Bedrock/Copilot). Check its own sequencing table for current
|
|
56
|
-
phase status, not this file.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Research horizon
|
|
60
|
-
|
|
61
|
-
*(2026-07-08 research pass — a direction recorded so it isn't re-discovered from scratch, not a
|
|
62
|
-
committed build plan. Nothing below is scheduled.)*
|
|
63
|
-
|
|
64
|
-
**Before the horizon — known-how, no research risk**, just scheduling: `PLAN_CODE.md` Tracks 2-4
|
|
65
|
-
(mutation search/repair, JS/HTML/CSS synthesis — APR and CEGIS are established techniques);
|
|
66
|
-
RETE/incremental forward-chaining (`PLAN_SYLLOGIST.md` §2 — Forgy 1982, a citable algorithm not yet
|
|
67
|
-
ported); contingent/conformant planning under initial-state uncertainty (Bonet & Geffner 2000,
|
|
68
|
-
Hoffmann & Brafman 2006, Petrick & Bacchus 2002 all have working algorithms, none yet applied here).
|
|
69
|
-
|
|
70
|
-
**After the horizon — genuinely unsolved in the field**, named as real research targets with
|
|
71
|
-
citations, not stop signs:
|
|
72
|
-
- **The frame problem / relevance realization** (open-world planning boundary). McCarthy & Hayes
|
|
73
|
-
1969 named it; Jaeger, Riedl, Djedovic, Vervaeke & Walsh (2024) argue it may not be algorithmically
|
|
74
|
-
solvable in the general case. Speculative angle: bounded (N+1) goal recognition — recognize
|
|
75
|
-
declared goal 1..N, or reject to an explicit "escalate" class, via parse-shape membership.
|
|
76
|
-
- **Bounded, incremental, trust-tiered, retraction-safe justification tracking** — `PLAN_SYLLOGIST.md`
|
|
77
|
-
§3. Doyle's JTMS (1979) and de Kleer's ATMS (1986) solve retraction; DRed/RDFox's Backward-Forward
|
|
78
|
-
solve incremental Datalog maintenance; nobody's published the combination with tmct's
|
|
79
|
-
multi-trust-tier, hard-budget requirement. The JTMS-lite slice shipped (one persisted
|
|
80
|
-
justification per entailed fact, VERIFY-backed retraction, all five rules); the open piece is the
|
|
81
|
-
ATMS generalization — alternate justification SETS per fact (see that doc's 2026-07-15 addendum).
|
|
82
|
-
- **A shared ~2M-word cross-domain ontology** (general-English + technical/scientific/programming).
|
|
83
|
-
Merging collides senses of lexically-shared words (`class`, `cache`, `thread`, `field`, `state`)
|
|
84
|
-
across registers; knowledge-based WSD is real but weaker than supervised/neural WSD (Lesk 1986;
|
|
85
|
-
Raganato, Camacho-Collados & Navigli, EACL 2017). BabelNet proves cross-resource sense merging is
|
|
86
|
-
achievable at scale but solves the cross-*lingual*, not cross-*domain*, axis, and carries a
|
|
87
|
-
non-commercial licence. Speculative angle: mutual disambiguation from already-resolved neighbouring
|
|
88
|
-
terms in tmct's own closed graph (a bounded reading of Gale/Church/Yarowsky's "one sense per
|
|
89
|
-
discourse" regularity) — not published anywhere found for this application. Fresh live instance
|
|
90
|
-
(2026-07-11): `"tail"` (Unix process vs. animal body part) collides under `normFactTerm`'s
|
|
91
|
-
cross-corpus flattening, `src/adapters/memory/core.mjs:1109-1134`.
|
|
92
|
-
|
|
93
|
-
**Tier-4: learn-on-miss acquisition**. The strongest
|
|
94
|
-
miss signal tmct can emit: lexicon term recognized, query built cleanly, zero matches anywhere — the
|
|
95
|
-
question was well-formed and the knowledge is simply absent. Web search on the resolved term → clean
|
|
96
|
-
the fetched text into the ACE-OWL controlled grammar → store with source provenance → answer the
|
|
97
|
-
original question, citing what was just learned. Strictly opt-in, offline default inviolable.
|
|
98
|
-
Prerequisites: the provenance-trust policy must extend to `via:"learned:web"`, never silently
|
|
99
|
-
blending web-sourced facts with graph/operator facts.
|
|
100
|
-
|
|
101
|
-
## Design docs
|
|
102
|
-
|
|
103
|
-
Every substantial design lives in its own `PLAN_*.md` at the repo root; `archive/` holds the shipped
|
|
104
|
-
and closed ones. This file points to them, it doesn't repeat their content. Each plan states its own
|
|
105
|
-
status in its opening lines — read it there, because a status quoted here would rot.
|
|
106
|
-
|
|
107
|
-
| Plan | What it's for |
|
|
108
|
-
| --- | --- |
|
|
109
|
-
| [PLAN_ADVENTURE.md](PLAN_ADVENTURE.md) | a text adventure as an architectural stretch: imperative command grammar, NPC turn scheduler, room-look digest |
|
|
110
|
-
| [PLAN_AGENTS.md](PLAN_AGENTS.md) | the governing plan for the multi-repo arc (marginalia, seonix, a pluggable LLM rung), with its own phase sequencing |
|
|
111
|
-
| [PLAN_CHILD_CORPUS.md](PLAN_CHILD_CORPUS.md) | a wider default seed corpus, chosen by age of acquisition |
|
|
112
|
-
| [PLAN_CLASS_QUERY.md](PLAN_CLASS_QUERY.md) | "list/count all X of class Y", reconciled against what already shipped |
|
|
113
|
-
| [PLAN_CODE.md](PLAN_CODE.md) | program synthesis over tmct's closed DSLs, plus JS/HTML/CSS fragments and goal-directed program repair |
|
|
114
|
-
| [PLAN_CONSISTENCY_CHECK.md](PLAN_CONSISTENCY_CHECK.md) | tmct as a consistency service for an LLM tool loop |
|
|
115
|
-
| [PLAN_DIALOGUE_ACTS.md](PLAN_DIALOGUE_ACTS.md) | naming tmct's turn types to ISO 24617-2 dialogue acts, deterministically |
|
|
116
|
-
| [PLAN_EMBEDDINGS.md](PLAN_EMBEDDINGS.md) | the semantic-similarity axis, and the way back to it |
|
|
117
|
-
| [PLAN_GRAPH_SCAN.md](PLAN_GRAPH_SCAN.md) | seed and query cost at `init:xl`/`init:xxl` corpus scale |
|
|
118
|
-
| [PLAN_GUESS_NUMBER.md](PLAN_GUESS_NUMBER.md) | closed-loop planning over hidden state, via belief-interval bisection |
|
|
119
|
-
| [PLAN_MUD.md](PLAN_MUD.md) | persistent, shared tmct worlds over a `server:` memory backend |
|
|
120
|
-
| [PLAN_NLU_BENCHMARKS.md](PLAN_NLU_BENCHMARKS.md) | scoring tmct on the CLINC150 and HWU64 intent sets |
|
|
121
|
-
| [PLAN_OPEN_ITEMS.md](archive/PLAN_OPEN_ITEMS.md) | delivered — the 2.0.3-cycle build order, archived |
|
|
122
|
-
| [PLAN_PARAPHRASE_VERIFICATION.md](PLAN_PARAPHRASE_VERIFICATION.md) | checking a paraphrase against the graph before it prints |
|
|
123
|
-
| [PLAN_PURGE.md](archive/PLAN_PURGE.md) | delivered — promoted the load-bearing code, deleted the dead weight, archived |
|
|
124
|
-
| [PLAN_REPO_INDEX.md](PLAN_REPO_INDEX.md) | tmct grows its own code parsers, ported from seonix |
|
|
125
|
-
| [PLAN_SYLLOGIST.md](PLAN_SYLLOGIST.md) | the reasoning engine's incrementality and retraction horizon |
|
|
126
|
-
| [PLAN_SYLLOGIST_EL_DL.md](PLAN_SYLLOGIST_EL_DL.md) | beyond OWL 2 RL: an EL classifier, then a DL tableau prover |
|
|
127
|
-
|
|
128
|
-
`SKILL_*.md` docs specify the repeatable measurement and build cycles (the benchmarks, the capability
|
|
129
|
-
audit, the background strategy advisor, plain-prose writing). `HANDOVER.md` is the single
|
|
130
|
-
current-open-items list.
|