knowmind 0.3.8 → 0.4.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # Knowmind CLI — Änderungen
2
2
 
3
+ ## 0.4.0 (2026-10-16)
4
+
5
+ **`knowmind sync` übernimmt Wissen im Open Knowledge Format**
6
+
7
+ - Liegt in einem Ordner Wissen im Open Knowledge Format (OKF 0.1 oder 0.2),
8
+ etwa im Ordner `openwiki/`, den OpenWiki in einem Repository anlegt, liest
9
+ `knowmind sync` den Kopf jeder Seite mit.
10
+ - Jeder Treffer der Suche trägt danach den Status der Seite (`status`, ohne
11
+ Angabe `stable`), die Vertrauensstufe nach OKF (`trust`: `unverified`,
12
+ `machine-confirmed` oder `human-reviewed`, also ungeprüft, maschinell
13
+ bestätigt oder von einem Menschen geprüft) und die Zahl der Quellen. Soweit
14
+ die Seite es angibt, kommen hinzu: wer oder was die Seite erzeugt hat
15
+ (`generated`), die letzten fünf Prüfungen (`verified`), der Zeitpunkt, ab dem
16
+ die Seite als veraltet gilt (`stale_after`), und die ersten zehn Quellen
17
+ (`sources`). Der vollständige Kopf bleibt Teil des Dokuments.
18
+ - Der Zeitpunkt der letzten inhaltlichen Änderung (`generated.at`, bei OKF 0.1
19
+ `timestamp`) gilt als Beginn der Gültigkeit. `knowmind_recall_at_time`
20
+ zeigt die Seite deshalb erst ab diesem Zeitpunkt.
21
+ - Belege unter `.claims/` werden gezählt, und knowmind vermerkt, ob sie zur
22
+ aktuellen Fassung der Seite gehören. Ändern sich nur die Belege, lädt
23
+ `knowmind sync` die Seite erneut hoch.
24
+ - In einem solchen Ordner übernimmt `knowmind sync` die Verzeichnislisten
25
+ `index.md` und die Verläufe `log.md` nicht als Dokumente, ebenso wenig den
26
+ Arbeitsauftrag `INSTRUCTIONS.md` an der Wurzel eines OpenWiki-Ordners.
27
+ - Erkannt wird ein solcher Ordner an `okf_version` in der `index.md` an seiner
28
+ Wurzel oder an den Verwaltungsdateien von OpenWiki. Findet `knowmind sync`
29
+ keine solche Kennung, behandelt es den angegebenen Ordner mit `--okf`
30
+ trotzdem als OKF-Bündel.
31
+ - Die mitgelieferte Werkzeugliste trägt den Stand des Servers vom 16. Oktober.
32
+ Die Beschreibung von `hops` bei `knowmind_recall_memories` sagt jetzt, dass
33
+ der Wert den Abruf derzeit nicht verändert.
34
+
35
+ ## 0.3.9 (2026-10-10)
36
+
37
+ **`knowmind sync` hält umbenannte Dateien zusammen**
38
+
39
+ - Benennen Sie eine Datei um, bleibt sie dasselbe Dokument, statt als zweites
40
+ daneben zu erscheinen. `knowmind sync` erkennt sie, wenn die Datei unter dem
41
+ alten Namen nicht mehr da ist: am `name:` im Kopf der Datei, fehlt dieser, am
42
+ gleichen Inhalt.
43
+ - Jeder Upload über `knowmind sync` nennt seine Quelldatei, als Kennung des
44
+ Ordners und Pfad darin; der vollständige Pfad auf Ihrem Rechner geht nicht
45
+ hinaus. Knowmind ordnet eine neue Fassung damit auch dann der alten zu, wenn
46
+ sich der Titel des Dokuments geändert hat. Zwei Ordner mit gleichnamigen
47
+ Dateien bleiben getrennt.
48
+ - Die mitgelieferte Werkzeugliste trägt den Stand des Servers vom 10. Oktober.
49
+ Neu sind zwei Werkzeuge: `knowmind_list_inferred` listet Beziehungen, die
50
+ auf die Entscheidung eines Menschen warten; mit `knowmind_review_inferred`
51
+ bestätigen Sie eine solche Beziehung, lehnen sie ab oder nehmen eine Ablehnung
52
+ zurück.
53
+ `knowmind_link` und `knowmind_link_entities` verlangen jetzt einen Beleg
54
+ (`evidence`).
55
+ - Verbesserungen der Stabilität.
56
+
3
57
  ## 0.3.8 (2026-10-08)
4
58
 
5
59
  - Die mitgelieferte Werkzeugliste trägt den Stand des Servers vom 8. Oktober:
package/README.md CHANGED
@@ -84,8 +84,27 @@ npx -y knowmind upload notes.md --title "Meeting notes 2026-05-12"
84
84
  npx -y knowmind stats
85
85
  npx -y knowmind health
86
86
  npx -y knowmind status --line # one-line status for your AI tool's statusline
87
+ npx -y knowmind sync ./openwiki # pages in Open Knowledge Format keep their review data
87
88
  ```
88
89
 
90
+ ### Knowledge in Open Knowledge Format
91
+
92
+ `knowmind sync` reads folders in the Open Knowledge Format (OKF 0.1 and 0.2),
93
+ such as the `openwiki/` folder that OpenWiki creates in a repository.
94
+
95
+ Every search hit then carries the page's `status` (`stable` if the page sets
96
+ none), its trust tier as defined by OKF (`trust`: `unverified`,
97
+ `machine-confirmed` or `human-reviewed`) and how many sources it lists. If the
98
+ page provides them, the hit also carries who or what generated the page
99
+ (`generated`), its last five verifications (`verified`), the time after which
100
+ it counts as stale (`stale_after`) and its first ten sources (`sources`). The
101
+ full header stays part of the document.
102
+
103
+ Inside a bundle, directory listings (`index.md`) and logs (`log.md`) are not
104
+ imported. knowmind recognizes a bundle by `okf_version` in its root `index.md` or by the
105
+ files OpenWiki keeps there. If it finds neither, `--okf` treats the folder you
106
+ sync as a bundle.
107
+
89
108
  ## Available Tools
90
109
 
91
110
  Thirteen tools over MCP. Every one works against your own workspace; the server
package/bin/knowmind.js CHANGED
@@ -61,9 +61,12 @@ Befehle:
61
61
  Hybrid-Recall gegen den Tenant-Korpus
62
62
  knowmind upload <file> [--title "..."]
63
63
  Markdown-/Text-Datei indexieren (stdin: knowmind upload -)
64
- knowmind sync <dir> [--ext .md,.txt] [--verbose] [--title-from-content]
64
+ knowmind sync <dir> [--ext .md,.txt] [--verbose] [--title-from-content] [--okf]
65
65
  Ordner mit dem Korpus abgleichen. Idempotent über
66
66
  Content-Hash, Manifest in <dir>/.knowmind-manifest.json.
67
+ Seiten im Open Knowledge Format (z. B. openwiki/) behalten
68
+ Herkunft, Prüfstand und Verfallsdatum; --okf behandelt
69
+ den Ordner als Bündel, auch ohne okf_version.
67
70
  knowmind stats Memory- und Edge-Counter des Tenants
68
71
  knowmind health Health-Check der Plattform
69
72
  knowmind status [--line]
@@ -218,6 +221,7 @@ async function runSync() {
218
221
  extensions: extFlag ? extFlag.split(",").map((e) => (e.startsWith(".") ? e : `.${e}`)) : undefined,
219
222
  verbose: args.includes("--verbose"),
220
223
  titleFromContent: args.includes("--title-from-content"),
224
+ okf: args.includes("--okf"),
221
225
  };
222
226
  const result = await syncDirectory(dir, options);
223
227
  if (result.failed > 0) process.exitCode = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowmind",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
5
  "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
6
  "type": "module",
@@ -39,7 +39,8 @@
39
39
  "tools:abgleich": "node scripts/tools-abgleich.mjs"
40
40
  },
41
41
  "dependencies": {
42
- "@huggingface/transformers": "^3.5.0"
42
+ "@huggingface/transformers": "^3.5.0",
43
+ "yaml": "^2.9.1"
43
44
  },
44
45
  "overrides": {
45
46
  "global-agent": "^4.1.3"
package/src/client.js CHANGED
@@ -118,6 +118,12 @@ export async function uploadDocument(title, content, opts = {}) {
118
118
  // documentId, geht sie als replaceDocumentId mit — der Server ersetzt damit
119
119
  // genau diese Alt-Version, titelunabhaengig (verhindert Titel-Dubletten).
120
120
  if (opts.replaceDocumentId) body.replaceDocumentId = opts.replaceDocumentId;
121
+ // Quelldatei relativ zum Ordner: Der Server findet darüber die Fassung
122
+ // derselben Datei, auch wenn sich der Titel geändert hat.
123
+ if (opts.sourcePath) body.sourcePath = opts.sourcePath;
124
+ // Herkunft und Prüfstand einer OKF-Seite (okf.js): stehen danach an jedem
125
+ // Abschnitt, auch wenn der Server die Abschnitte selbst bildet.
126
+ if (opts.metadata) body.metadata = opts.metadata;
121
127
 
122
128
  const r = await fetch(`${apiUrl}/api/documents`, {
123
129
  method: "POST",
package/src/okf.js ADDED
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Bündel im Open Knowledge Format (OKF 0.1 und 0.2) für `knowmind sync`.
3
+ *
4
+ * Ein OKF-Bündel ist ein Ordner mit Markdown-Seiten, deren YAML-Kopf sagt,
5
+ * woher eine Seite stammt (`sources`), wer sie geschrieben und wer sie geprüft
6
+ * hat (`generated`, `verified`), ob sie noch gilt (`status`, `stale_after`).
7
+ * So schreibt etwa OpenWiki das Verzeichnis openwiki/ eines Repos, dazu unter
8
+ * `.claims/` je Seite die belegten Aussagen. Spezifikation:
9
+ * https://github.com/GoogleCloudPlatform/open-knowledge-format
10
+ * (SPEC.md, Version 0.2).
11
+ *
12
+ * Dieses Modul erkennt ein Bündel und bildet den Kopf einer Seite auf die
13
+ * Angaben ab, die knowmind an jedem Abschnitt des Dokuments führt:
14
+ *
15
+ * - `metadata.okf`: Typ, Status, Vertrauensstufe (§5.3), Prüfungen,
16
+ * Erzeugung, Verfallsdatum, die ersten Quellen und der Stand der Belege.
17
+ * Kurz gehalten, weil die Angaben an jedem Treffer des Abrufs stehen und
18
+ * damit im Kontext des Agenten landen; den vollständigen Kopf trägt das
19
+ * Dokument selbst.
20
+ * - `metadata.valid_from`: der Zeitpunkt der letzten inhaltlichen Änderung
21
+ * (`generated.at`, bei OKF 0.1 `timestamp`). Der Abruf zu einem Zeitpunkt
22
+ * wertet ihn aus.
23
+ */
24
+ import { existsSync, readFileSync } from "node:fs";
25
+ import { join } from "node:path";
26
+ import { createHash } from "node:crypto";
27
+ import { parse } from "yaml";
28
+
29
+ /** Dateien mit festgelegter Bedeutung (§3.1): Verzeichnisliste und Verlauf, keine Seiten. */
30
+ export const RESERVIERT = new Set(["index.md", "log.md"]);
31
+
32
+ const HOECHSTZAHL_QUELLEN = 10;
33
+ const HOECHSTZAHL_VERIFIZIERT = 5;
34
+
35
+ /** YAML-Kopf einer Markdown-Datei als Objekt, sonst null. */
36
+ export function kopfLesen(inhalt) {
37
+ const m = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(inhalt);
38
+ if (!m) return null;
39
+ try {
40
+ const daten = parse(m[1]);
41
+ return daten && typeof daten === "object" && !Array.isArray(daten) ? daten : null;
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Ist `ordner` die Wurzel eines Bündels? Ein Bündel nennt seine Fassung im
49
+ * Kopf der `index.md` an der Wurzel (`okf_version`, §12). OpenWiki-Verzeichnisse
50
+ * erkennt man zusätzlich an `.last-update.json` und `.page-manifest.json`.
51
+ * Rückgabe `{ version, openwiki }` oder null.
52
+ */
53
+ export function buendelWurzel(ordner) {
54
+ const index = join(ordner, "index.md");
55
+ let version = null;
56
+ if (existsSync(index)) {
57
+ const kopf = kopfLesen(readFileSync(index, "utf-8"));
58
+ if (kopf?.okf_version != null) version = String(kopf.okf_version);
59
+ }
60
+ const openwiki = existsSync(join(ordner, ".last-update.json")) && existsSync(join(ordner, ".page-manifest.json"));
61
+ if (!version && !openwiki) return null;
62
+ return { version: version ?? "unbekannt", openwiki };
63
+ }
64
+
65
+ /** Zeitpunkt als ISO 8601 in UTC, sonst null. */
66
+ export function zeitpunkt(wert) {
67
+ if (wert == null || wert === "") return null;
68
+ const ms = wert instanceof Date ? wert.getTime() : Date.parse(String(wert));
69
+ return Number.isNaN(ms) ? null : new Date(ms).toISOString();
70
+ }
71
+
72
+ /** `verified` als Liste (§5.2: eine einzelne Angabe zählt als Liste mit einem Eintrag). */
73
+ export function verifiziert(verified) {
74
+ if (verified == null) return [];
75
+ const liste = Array.isArray(verified) ? verified : [verified];
76
+ return liste
77
+ .filter((v) => v && typeof v === "object" && typeof v.by === "string" && v.by.trim())
78
+ .map((v) => ({ by: v.by.trim(), at: zeitpunkt(v.at) }));
79
+ }
80
+
81
+ /** Vertrauensstufe nach §5.3: ungeprüft, maschinell bestätigt, von einem Menschen geprüft. */
82
+ export function vertrauensstufe(liste) {
83
+ if (liste.length === 0) return "unverified";
84
+ return liste.some((v) => v.by.startsWith("human:")) ? "human-reviewed" : "machine-confirmed";
85
+ }
86
+
87
+ /** Prüfsumme der Seite in der Schreibweise von OpenWiki (`pageVersion`). */
88
+ export function seitenFassung(inhalt) {
89
+ return "sha256:" + createHash("sha256").update(inhalt, "utf-8").digest("hex");
90
+ }
91
+
92
+ /**
93
+ * Belege einer Seite aus `.claims/<Seite>.json` (OpenWiki). Rückgabe
94
+ * `{ roh, daten }` oder null; `roh` geht in die Änderungserkennung ein, damit
95
+ * neue Belege zu einer unveränderten Seite ankommen.
96
+ */
97
+ export function belegeLesen(wurzel, konzept) {
98
+ const pfad = join(wurzel, ".claims", `${konzept}.json`);
99
+ if (!existsSync(pfad)) return null;
100
+ const roh = readFileSync(pfad, "utf-8");
101
+ try {
102
+ return { roh, daten: JSON.parse(roh) };
103
+ } catch {
104
+ return { roh, daten: null };
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Commit, den OpenWiki für eine Seite dokumentiert hat (`.page-manifest.json`,
110
+ * Schlüssel ist der Pfad ab Repo-Wurzel). Sonst null.
111
+ */
112
+ export function seitenCommit(seiten, rel) {
113
+ if (!seiten || typeof seiten !== "object") return null;
114
+ for (const [pfad, eintrag] of Object.entries(seiten)) {
115
+ if ((pfad === rel || pfad.endsWith("/" + rel)) && typeof eintrag?.gitHead === "string") return eintrag.gitHead;
116
+ }
117
+ return null;
118
+ }
119
+
120
+ /** Die Seitenliste aus `.page-manifest.json` eines OpenWiki-Verzeichnisses, sonst null. */
121
+ export function seitenListeLesen(wurzel) {
122
+ const pfad = join(wurzel, ".page-manifest.json");
123
+ if (!existsSync(pfad)) return null;
124
+ try {
125
+ return JSON.parse(readFileSync(pfad, "utf-8"))?.pages ?? null;
126
+ } catch {
127
+ return null;
128
+ }
129
+ }
130
+
131
+ function belegStand(belege, inhalt) {
132
+ if (!belege) return null;
133
+ const d = belege.daten;
134
+ if (!d || !Array.isArray(d.claims)) return { count: 0, readable: false };
135
+ const erste = verifiziert(d.verification)[0];
136
+ return {
137
+ count: d.claims.length,
138
+ // Gehören die Belege zu genau dieser Fassung der Seite? Wenn nicht, hat
139
+ // jemand die Seite nach der letzten Prüfung geändert.
140
+ page_version_current: typeof d.pageVersion === "string" ? d.pageVersion === seitenFassung(inhalt) : null,
141
+ ...(erste ? { verified_by: erste.by, verified_at: erste.at } : {}),
142
+ };
143
+ }
144
+
145
+ /**
146
+ * Bildet den Kopf einer Seite auf `metadata` für den Upload ab. Ohne `type`
147
+ * im Kopf ist die Datei keine OKF-Seite (§4.1) und bekommt nichts.
148
+ */
149
+ export function okfAngaben({ kopf, inhalt, konzept, version, belege = null, commit = null }) {
150
+ if (!kopf || typeof kopf.type !== "string" || !kopf.type.trim()) return null;
151
+ const liste = verifiziert(kopf.verified);
152
+ const quellen = Array.isArray(kopf.sources)
153
+ ? kopf.sources.filter((q) => q && typeof q === "object" && q.resource != null)
154
+ : [];
155
+ const erzeugt =
156
+ kopf.generated && typeof kopf.generated === "object"
157
+ ? { by: kopf.generated.by != null ? String(kopf.generated.by) : null, at: zeitpunkt(kopf.generated.at) }
158
+ : null;
159
+ const status = ["draft", "stable", "deprecated"].includes(kopf.status) ? kopf.status : "stable";
160
+ const okf = {
161
+ version,
162
+ concept: konzept,
163
+ type: kopf.type.trim(),
164
+ status,
165
+ trust: vertrauensstufe(liste),
166
+ ...(liste.length ? { verified: liste.slice(-HOECHSTZAHL_VERIFIZIERT) } : {}),
167
+ ...(erzeugt ? { generated: erzeugt } : {}),
168
+ ...(zeitpunkt(kopf.stale_after) ? { stale_after: zeitpunkt(kopf.stale_after) } : {}),
169
+ ...(typeof kopf.resource === "string" ? { resource: kopf.resource } : {}),
170
+ ...(commit ? { git_head: commit } : {}),
171
+ sources_total: quellen.length,
172
+ ...(quellen.length
173
+ ? {
174
+ sources: quellen.slice(0, HOECHSTZAHL_QUELLEN).map((q) => ({
175
+ resource: String(q.resource),
176
+ ...(q.author != null ? { author: String(q.author) } : {}),
177
+ ...(zeitpunkt(q.last_modified) ? { last_modified: zeitpunkt(q.last_modified) } : {}),
178
+ })),
179
+ }
180
+ : {}),
181
+ };
182
+ const stand = belegStand(belege, inhalt);
183
+ if (stand) okf.claims = stand;
184
+ const gueltigAb = erzeugt?.at ?? zeitpunkt(kopf.timestamp);
185
+ return { okf, ...(gueltigAb ? { valid_from: gueltigAb } : {}) };
186
+ }
package/src/sync.js CHANGED
@@ -11,9 +11,12 @@
11
11
  * und das Manifest aktualisiert.
12
12
  */
13
13
  import { readFileSync, readdirSync, statSync, writeFileSync, existsSync } from "node:fs";
14
- import { join, relative, basename, extname } from "node:path";
15
- import { createHash } from "node:crypto";
14
+ import { join, relative, basename, extname, dirname } from "node:path";
15
+ import { createHash, randomUUID } from "node:crypto";
16
16
  import { uploadDocument } from "./client.js";
17
+ import {
18
+ RESERVIERT, buendelWurzel, kopfLesen, belegeLesen, okfAngaben, seitenCommit, seitenListeLesen,
19
+ } from "./okf.js";
17
20
 
18
21
  const DEFAULT_EXTENSIONS = [".md", ".markdown", ".txt"];
19
22
  const MANIFEST_NAME = ".knowmind-manifest.json";
@@ -62,6 +65,88 @@ function saveManifest(path, manifest) {
62
65
  writeFileSync(path, JSON.stringify(manifest, null, 2));
63
66
  }
64
67
 
68
+ /** `name:` aus dem Frontmatter — die stabile Kennung einer Memory-Datei, unabhängig vom Dateinamen. */
69
+ export function frontmatterName(content) {
70
+ const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
71
+ if (!m) return null;
72
+ const z = /^name:\s*(.+?)\s*$/m.exec(m[1]);
73
+ return z ? z[1].replace(/^["']|["']$/g, "") : null;
74
+ }
75
+
76
+ /**
77
+ * Vorgänger einer Datei, deren Pfad das Manifest nicht kennt: ein Eintrag,
78
+ * dessen Datei es nicht mehr gibt und der dieselbe Sache ist — gleicher
79
+ * Frontmatter-Name oder, ohne Namen, gleicher Inhalt. So bleibt eine
80
+ * umbenannte Datei dasselbe Dokument (B3, 10.10.2026: fünf Paare aus
81
+ * Bindestrich gegen Unterstrich).
82
+ */
83
+ export function vorgaengerFinden(manifest, rel, name, hash, gibtEs) {
84
+ for (const [alt, eintrag] of Object.entries(manifest.files)) {
85
+ if (alt === rel || !eintrag?.documentId || gibtEs(alt)) continue;
86
+ if (name ? eintrag.name === name : eintrag.sha256 === hash) return alt;
87
+ }
88
+ return null;
89
+ }
90
+
91
+ /** Quellpfad am Server: Ordnerkennung aus dem Manifest plus relativer Pfad. */
92
+ export function quellpfad(manifest, rel) {
93
+ if (!manifest.quelle) manifest.quelle = randomUUID();
94
+ return `${manifest.quelle}/${rel}`;
95
+ }
96
+
97
+ /**
98
+ * Findet zu einer Datei das OKF-Bündel, in dem sie liegt: den nächsten Ordner
99
+ * zwischen Datei und Sync-Wurzel, der ein Bündel ist (`okf.js`). Mit `--okf`
100
+ * gilt die Sync-Wurzel selbst als Bündel, auch ohne `okf_version`.
101
+ */
102
+ export function buendelFinder(wurzel, erzwungen = false) {
103
+ const merker = new Map();
104
+ const ansehen = (ordner) => {
105
+ if (!merker.has(ordner)) {
106
+ const b = buendelWurzel(ordner);
107
+ merker.set(ordner, b ? { wurzel: ordner, ...b } : null);
108
+ }
109
+ return merker.get(ordner);
110
+ };
111
+ return (datei) => {
112
+ let ordner = dirname(datei);
113
+ for (;;) {
114
+ const b = ansehen(ordner);
115
+ if (b) return b;
116
+ const abstand = relative(wurzel, ordner);
117
+ if (abstand === "" || abstand.startsWith("..")) break;
118
+ const oben = dirname(ordner);
119
+ if (oben === ordner) break;
120
+ ordner = oben;
121
+ }
122
+ return erzwungen ? { wurzel, version: "unbekannt", openwiki: false } : null;
123
+ };
124
+ }
125
+
126
+ /**
127
+ * Was `knowmind sync` mit einer Datei in einem OKF-Bündel tut: auslassen
128
+ * (Verzeichnisliste, Verlauf, Arbeitsauftrag von OpenWiki) oder hochladen,
129
+ * dann mit den Angaben aus ihrem Kopf und ihren Belegen.
130
+ */
131
+ export function okfSeite(bundle, datei, inhalt) {
132
+ const rel = relative(bundle.wurzel, datei).replace(/\\/g, "/");
133
+ if (RESERVIERT.has(basename(datei))) return { auslassen: "Verzeichnisliste oder Verlauf" };
134
+ // Der Arbeitsauftrag an den Schreibagenten von OpenWiki ist keine Seite.
135
+ if (bundle.openwiki && rel === "INSTRUCTIONS.md") return { auslassen: "Arbeitsauftrag von OpenWiki" };
136
+ const konzept = rel.replace(/\.md$/i, "");
137
+ const kopf = kopfLesen(inhalt);
138
+ const belege = belegeLesen(bundle.wurzel, konzept);
139
+ if (bundle.openwiki && bundle.seiten === undefined) bundle.seiten = seitenListeLesen(bundle.wurzel);
140
+ const commit = seitenCommit(bundle.seiten, rel);
141
+ const angaben = okfAngaben({ kopf, inhalt, konzept, version: bundle.version, belege, commit });
142
+ return {
143
+ angaben,
144
+ titel: angaben && typeof kopf?.title === "string" && kopf.title.trim() ? kopf.title.trim() : null,
145
+ // Ändern sich nur die Belege, muss die Seite trotzdem neu hinaus.
146
+ belegeRoh: belege?.roh ?? "",
147
+ };
148
+ }
149
+
65
150
  function deriveTitle(content, filePath) {
66
151
  const m = content.match(/^#\s+(.+)$/m);
67
152
  if (m) return m[1].trim();
@@ -77,13 +162,20 @@ export async function syncDirectory(dir, options = {}) {
77
162
  const exts = options.extensions ?? DEFAULT_EXTENSIONS;
78
163
  const manifestPath = join(dir, MANIFEST_NAME);
79
164
  const manifest = loadManifest(manifestPath);
165
+ // Eigene Kennung je Ordner: Der Quellpfad am Server ist `<Kennung>/<Pfad>`,
166
+ // damit zwei Ordner mit je einer README.md im selben Arbeitsbereich
167
+ // getrennt bleiben. Der lokale Pfad selbst geht nicht hinaus.
168
+ if (!manifest.quelle) manifest.quelle = randomUUID();
80
169
 
81
170
  const files = [...walk(dir, exts)].sort();
82
171
  const total = files.length;
172
+ const buendelVon = buendelFinder(dir, Boolean(options.okf));
83
173
  let scanned = 0;
84
174
  let uploaded = 0;
85
175
  let skipped = 0;
86
176
  let failed = 0;
177
+ let okfSeiten = 0;
178
+ let ausgelassen = 0;
87
179
  const failures = [];
88
180
 
89
181
  console.log(`Knowmind sync: ${total} Dateien in ${dir}`);
@@ -93,19 +185,42 @@ export async function syncDirectory(dir, options = {}) {
93
185
  const rel = relative(dir, file).replace(/\\/g, "/");
94
186
  if (basename(file) === MANIFEST_NAME) continue;
95
187
  const content = readFileSync(file, "utf-8");
96
- const hash = sha256(content);
97
- const known = manifest.files[rel];
188
+ const bundle = buendelVon(file);
189
+ const seite = bundle ? okfSeite(bundle, file, content) : null;
190
+ if (seite?.auslassen) {
191
+ ausgelassen += 1;
192
+ if (options.verbose) console.log(` omit ${rel} (${seite.auslassen})`);
193
+ continue;
194
+ }
195
+ if (seite?.angaben) okfSeiten += 1;
196
+ const hash = seite?.angaben ? sha256(content + "\0" + seite.belegeRoh) : sha256(content);
197
+ const name = frontmatterName(content);
198
+ let known = manifest.files[rel];
199
+ let umbenanntVon = null;
200
+ if (!known) {
201
+ umbenanntVon = vorgaengerFinden(manifest, rel, name, hash, (r) => existsSync(join(dir, r)));
202
+ if (umbenanntVon) known = { ...manifest.files[umbenanntVon], sha256: null };
203
+ }
98
204
 
99
205
  if (known && known.sha256 === hash) {
100
206
  skipped += 1;
207
+ // Name nachtragen (das Manifest wird am Ende gespeichert), damit eine
208
+ // spätere Umbenennung erkannt wird.
209
+ if (name && known.name !== name) {
210
+ known.name = name;
211
+ }
101
212
  if (options.verbose) console.log(` skip ${rel}`);
102
213
  continue;
103
214
  }
104
215
 
105
- const title = options.titleFromContent ? deriveTitle(content, file) : basename(file, extname(file));
216
+ const title = options.titleFromContent
217
+ ? deriveTitle(content, file)
218
+ : seite?.titel ?? basename(file, extname(file));
106
219
  try {
107
220
  const result = await uploadDocument(title, content, {
108
221
  replaceDocumentId: known?.documentId ?? undefined,
222
+ sourcePath: quellpfad(manifest, rel),
223
+ ...(seite?.angaben ? { metadata: seite.angaben } : {}),
109
224
  });
110
225
  uploaded += 1;
111
226
  // Server antwortet bei sha-identischem Inhalt mit unchanged:true
@@ -116,13 +231,15 @@ export async function syncDirectory(dir, options = {}) {
116
231
  documentId: result.id ?? null,
117
232
  lastSync: new Date().toISOString(),
118
233
  duplicate: isDuplicate,
234
+ ...(name ? { name } : {}),
119
235
  };
236
+ if (umbenanntVon) delete manifest.files[umbenanntVon];
120
237
  // Manifest nach JEDEM erfolgreichen Upload speichern (2026-06-10):
121
238
  // Der Stop-Hook killt den Sync nach 120 s — mit 10er-Batches gingen
122
239
  // Manifest-Stände verloren und identischer Inhalt wurde endlos
123
240
  // re-POSTet (Ursache der Ingest-500-Schleife 26.–27.05.).
124
241
  saveManifest(manifestPath, manifest);
125
- const flag = isDuplicate ? "dup " : "new ";
242
+ const flag = umbenanntVon ? "ren " : isDuplicate ? "dup " : "new ";
126
243
  process.stdout.write(` [${scanned}/${total}] ${flag} ${rel}\n`);
127
244
  } catch (e) {
128
245
  failed += 1;
@@ -133,10 +250,12 @@ export async function syncDirectory(dir, options = {}) {
133
250
 
134
251
  saveManifest(manifestPath, manifest);
135
252
  console.log(`\nFertig: ${uploaded} hochgeladen, ${skipped} unverändert, ${failed} fehlerhaft.`);
253
+ if (okfSeiten || ausgelassen) {
254
+ console.log(`OKF: ${okfSeiten} Seiten mit Herkunft und Prüfstand, ${ausgelassen} Verzeichnislisten und Verläufe ausgelassen.`);
255
+ }
136
256
  if (failed > 0) {
137
257
  console.log(`Fehler-Übersicht (max 10):`);
138
258
  failures.slice(0, 10).forEach((f) => console.log(` ${f.file}: ${f.error}`));
139
- return { uploaded, skipped, failed, failures };
140
259
  }
141
- return { uploaded, skipped, failed, failures };
260
+ return { uploaded, skipped, failed, failures, okfSeiten, ausgelassen };
142
261
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_hinweis": "Rückfall für tools/list, wenn die Discovery nicht erreichbar ist. Erzeugt aus https://knowmind.de/api/mcp/v1. Abgleich: npm run tools:abgleich",
3
- "stand": "2026-10-08",
3
+ "stand": "2026-10-16",
4
4
  "quelle": "https://knowmind.de/api/mcp/v1",
5
5
  "protocolVersion": "2025-06-18",
6
6
  "tools": [
@@ -13,7 +13,7 @@
13
13
  "idempotentHint": true,
14
14
  "openWorldHint": false
15
15
  },
16
- "description": "Retrieve relevant knowledge before answering anything that benefits from prior context - decisions, preferences, project state, people, deadlines, past conversations. Hybrid recall (BM25 + pgvector + graph hops) over the tenant corpus; returns the top-k memory chunks, each with a relevance score and source reference. Suitable whenever earlier context would improve the answer; use knowmind_recall_at_time when you need what was valid at a past point in time. Read scope suffices.",
16
+ "description": "Retrieve relevant knowledge before answering anything that benefits from prior context - decisions, preferences, project state, people, deadlines, past conversations. Hybrid recall (BM25 + pgvector + knowledge graph) over the tenant corpus; returns the top-k memory chunks, each with a relevance score and source reference. Suitable whenever earlier context would improve the answer; use knowmind_recall_at_time when you need what was valid at a past point in time. Read scope suffices.",
17
17
  "inputSchema": {
18
18
  "type": "object",
19
19
  "properties": {
@@ -33,7 +33,7 @@
33
33
  "minimum": 0,
34
34
  "maximum": 3,
35
35
  "default": 2,
36
- "description": "Graph expansion depth over typed relations (0-3, default 2); 0 = text/vector only, no graph."
36
+ "description": "Accepted for compatibility (0-3, default 2); currently has no effect on recall."
37
37
  }
38
38
  },
39
39
  "required": [
@@ -363,7 +363,7 @@
363
363
  "idempotentHint": true,
364
364
  "openWorldHint": false
365
365
  },
366
- "description": "Create a typed relation between two memory nodes (a knowledge-graph edge). THIS IS HOW THE GRAPH IS BUILT: after storing memories, connect them - a corpus without edges answers only what a single note already says. Subject and object classes must match the predicate; the inverse edge is materialized automatically, and derived edges (RUNS_ON, WORKS_FOR_CLIENT, HOST_SERVES_CLIENT, DEPENDS_ON_SUPPLIER) are computed by the server - never set them by hand. Get both node IDs via knowmind_recall first, and call knowmind_schema for the full catalogue with explanations. Allowed rel_type values: ABOUT (Contract|Document|FileResource → Topic), ASSIGNED_TO (ActionRecord|Task → Agent|Organization|Person|SoftwareAgent), CLIENT_OF (Agent|Organization|Person|SoftwareAgent → Organization), CONTACT_PERSON_FOR (Person → Organization), COVERED_BY (Topic → Contract|Document|FileResource), DELIVERED_AS (Application → Product), DELIVERED_BY (Product → Application), DEPENDS_ON (Application → Application), DEPLOYED_TO (Application → Container), DEVELOPED_BY (Application → Agent|Organization|Person|SoftwareAgent), DEVELOPS (Agent|Organization|Person|SoftwareAgent → Application), ENABLES (Application → Application), FOR_CLIENT (Project → Agent|Organization|Person|SoftwareAgent), HAS_ASSIGNED_TASK (Agent|Organization|Person|SoftwareAgent → ActionRecord|Task), HAS_CHILD (Person → Person), HAS_CLIENT (Organization → Agent|Organization|Person|SoftwareAgent), HAS_CONTACT_PERSON (Organization → Person), HAS_EMPLOYEE (Organization → Person), HAS_OPERATED_APPLICATION (Agent|Organization|Person|SoftwareAgent → Application), HAS_PARENT (Person → Person), HAS_PREDECESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HAS_PROJECT (Agent|Organization|Person|SoftwareAgent → Project), HAS_ROLE (Person → Role), HAS_SIBLING (Person → Person), HAS_SKILL (Agent|Organization|Person|SoftwareAgent → Skill), HAS_SUCCESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HOSTED_ON (Container → Host), HOSTS (Host → Container), HOSTS_APPLICATION (Container → Application), INFRASTRUCTURE_PROVIDED_BY (Host → Organization), INTEGRATES_WITH (Application → Application), IS_LED_BY (Organization → Person), KNOWS (Person → Person), LEADS (Person → Organization), OPERATED_FOR (Application → Agent|Organization|Person|SoftwareAgent), PAID_BY (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PARTNER_OF (Organization → Organization), PAYS (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PRODUCED_BY (Contract|Document|FileResource → Project), PRODUCES (Project → Contract|Document|FileResource), PROVIDES_INFRASTRUCTURE (Organization → Host), ROLE_OF (Role → Person), SERVED_UNDER (Application → Domain), SERVES (Domain → Application), SKILL_OF (Skill → Agent|Organization|Person|SoftwareAgent), SPOUSE_OF (Person → Person), SUPPLIED_BY (Agent|Organization|Person|SoftwareAgent → Organization), SUPPLIES (Organization → Agent|Organization|Person|SoftwareAgent), SUPPLIES_TECHNOLOGY (Organization → Technology), SUPPORTED_BY (Contract|Document|FileResource → Contract|Document|FileResource), SUPPORTS (Contract|Document|FileResource → Contract|Document|FileResource), TECHNOLOGY_SUPPLIED_BY (Technology → Organization), TECHNOLOGY_USED_BY (Technology → Application), USES_TECHNOLOGY (Application → Technology), WORKED_ON_BY (Project → Agent|Organization|Person|SoftwareAgent), WORKS_FOR (Person → Organization), WORKS_ON (Agent|Organization|Person|SoftwareAgent → Project). Requires write scope.",
366
+ "description": "Create a typed relation between two memory nodes (a knowledge-graph edge). THIS IS HOW THE GRAPH IS BUILT: after storing memories, connect them - a corpus without edges answers only what a single note already says. The server checks the edge against the ontology's shapes before writing it: the subject and object must belong to the classes the predicate requires (for entries without a class the check only warns), entity names must carry no role or suffix, and the edge must name its evidence - the id of the entry that states the relation. A rejected edge returns the violated rule. The inverse edge is materialized automatically, and derived edges (RUNS_ON, WORKS_FOR_CLIENT, HOST_SERVES_CLIENT, DEPENDS_ON_SUPPLIER) are computed by the server - never set them by hand. Get both node IDs via knowmind_recall first, and call knowmind_schema for the full catalogue with explanations. Allowed rel_type values: ABOUT (Contract|Document|FileResource → Topic), ASSIGNED_TO (ActionRecord|Task → Agent|Organization|Person|SoftwareAgent), CLIENT_OF (Agent|Organization|Person|SoftwareAgent → Organization), CONTACT_PERSON_FOR (Person → Organization), COVERED_BY (Topic → Contract|Document|FileResource), DELIVERED_AS (Application → Product), DELIVERED_BY (Product → Application), DEPENDS_ON (Application → Application), DEPLOYED_TO (Application → Container), DEVELOPED_BY (Application → Agent|Organization|Person|SoftwareAgent), DEVELOPS (Agent|Organization|Person|SoftwareAgent → Application), ENABLES (Application → Application), FOR_CLIENT (Project → Agent|Organization|Person|SoftwareAgent), HAS_ASSIGNED_TASK (Agent|Organization|Person|SoftwareAgent → ActionRecord|Task), HAS_CHILD (Person → Person), HAS_CLIENT (Organization → Agent|Organization|Person|SoftwareAgent), HAS_CONTACT_PERSON (Organization → Person), HAS_EMPLOYEE (Organization → Person), HAS_OPERATED_APPLICATION (Agent|Organization|Person|SoftwareAgent → Application), HAS_PARENT (Person → Person), HAS_PREDECESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HAS_PROJECT (Agent|Organization|Person|SoftwareAgent → Project), HAS_ROLE (Person → Role), HAS_SIBLING (Person → Person), HAS_SKILL (Agent|Organization|Person|SoftwareAgent → Skill), HAS_SUCCESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HOSTED_ON (Container → Host), HOSTS (Host → Container), HOSTS_APPLICATION (Container → Application), INFRASTRUCTURE_PROVIDED_BY (Host → Organization), INTEGRATES_WITH (Application → Application), IS_LED_BY (Organization → Person), KNOWS (Person → Person), LEADS (Person → Organization), OPERATED_FOR (Application → Agent|Organization|Person|SoftwareAgent), PAID_BY (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PARTNER_OF (Organization → Organization), PAYS (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PRODUCED_BY (Contract|Document|FileResource → Project), PRODUCES (Project → Contract|Document|FileResource), PROVIDES_INFRASTRUCTURE (Organization → Host), ROLE_OF (Role → Person), SERVED_UNDER (Application → Domain), SERVES (Domain → Application), SKILL_OF (Skill → Agent|Organization|Person|SoftwareAgent), SPOUSE_OF (Person → Person), SUPPLIED_BY (Agent|Organization|Person|SoftwareAgent → Organization), SUPPLIES (Organization → Agent|Organization|Person|SoftwareAgent), SUPPLIES_TECHNOLOGY (Organization → Technology), SUPPORTED_BY (Contract|Document|FileResource → Contract|Document|FileResource), SUPPORTS (Contract|Document|FileResource → Contract|Document|FileResource), TECHNOLOGY_SUPPLIED_BY (Technology → Organization), TECHNOLOGY_USED_BY (Technology → Application), USES_TECHNOLOGY (Application → Technology), WORKED_ON_BY (Project → Agent|Organization|Person|SoftwareAgent), WORKS_FOR (Person → Organization), WORKS_ON (Agent|Organization|Person|SoftwareAgent → Project). Requires write scope.",
367
367
  "inputSchema": {
368
368
  "type": "object",
369
369
  "properties": {
@@ -382,12 +382,17 @@
382
382
  "confidence": {
383
383
  "type": "number",
384
384
  "description": "Edge confidence in [0..1]; 1.0 for a fact stated verbatim, 0.7 for a clear paraphrase. Below that, do not create the edge."
385
+ },
386
+ "evidence": {
387
+ "type": "string",
388
+ "description": "Memory ID of the entry that states this relation (often from_id or a note found via knowmind_recall). Required: an edge without evidence is rejected."
385
389
  }
386
390
  },
387
391
  "required": [
388
392
  "from_id",
389
393
  "to_id",
390
- "rel_type"
394
+ "rel_type",
395
+ "evidence"
391
396
  ]
392
397
  }
393
398
  },
@@ -462,6 +467,81 @@
462
467
  ]
463
468
  }
464
469
  },
470
+ {
471
+ "name": "knowmind_list_inferred",
472
+ "annotations": {
473
+ "title": "List inferred relations",
474
+ "readOnlyHint": true,
475
+ "destructiveHint": false,
476
+ "idempotentHint": true,
477
+ "openWorldHint": false
478
+ },
479
+ "description": "List relations that wait for a human decision, each with its review state (open, confirmed, rejected) and its reason: inferred_from_text (knowmind inferred it from a text) or starts_from_document (it starts from a document although its kind needs a person, organisation or similar). Per relation also the two connected entries, where it came from (source), the entry that supports it (evidence), and the counts per state. Open relations do not feed the derivation rules until someone confirms them. Use to review what the graph learned on its own; record a decision with knowmind_review_inferred. Read scope suffices.",
480
+ "inputSchema": {
481
+ "type": "object",
482
+ "properties": {
483
+ "status": {
484
+ "type": "string",
485
+ "enum": [
486
+ "open",
487
+ "confirmed",
488
+ "rejected"
489
+ ],
490
+ "description": "Only relations in this state. Omit for all."
491
+ },
492
+ "limit": {
493
+ "type": "integer",
494
+ "minimum": 1,
495
+ "maximum": 200,
496
+ "default": 50,
497
+ "description": "Number of relations to return (1-200, default 50)."
498
+ },
499
+ "offset": {
500
+ "type": "integer",
501
+ "minimum": 0,
502
+ "default": 0,
503
+ "description": "Relations to skip, for paging."
504
+ }
505
+ }
506
+ }
507
+ },
508
+ {
509
+ "name": "knowmind_review_inferred",
510
+ "annotations": {
511
+ "title": "Review inferred relation",
512
+ "readOnlyHint": false,
513
+ "destructiveHint": false,
514
+ "idempotentHint": false,
515
+ "openWorldHint": false
516
+ },
517
+ "description": "Record a human decision on one inferred relation from knowmind_list_inferred. confirm: the relation counts as checked and feeds the derivation rules from now on. reject: the relation, its reverse relation and every relation derived from it get valid_to=now; nothing is deleted. undo: takes a rejection back and restores the reverse and derived relations. Pass the edge_id from the list and, if there is one, the id of the entry that supports the decision as evidence. Returns the state before and after and the number of reverse and derived relations affected. Requires write scope.",
518
+ "inputSchema": {
519
+ "type": "object",
520
+ "properties": {
521
+ "edge_id": {
522
+ "type": "string",
523
+ "description": "edge_id of the relation, as returned by knowmind_list_inferred."
524
+ },
525
+ "decision": {
526
+ "type": "string",
527
+ "enum": [
528
+ "confirm",
529
+ "reject",
530
+ "undo"
531
+ ],
532
+ "description": "confirm, reject, or undo a rejection."
533
+ },
534
+ "evidence": {
535
+ "type": "string",
536
+ "description": "Id of the entry that supports the decision. Optional."
537
+ }
538
+ },
539
+ "required": [
540
+ "edge_id",
541
+ "decision"
542
+ ]
543
+ }
544
+ },
465
545
  {
466
546
  "name": "knowmind_recall",
467
547
  "annotations": {
@@ -471,7 +551,7 @@
471
551
  "idempotentHint": true,
472
552
  "openWorldHint": false
473
553
  },
474
- "description": "DEPRECATED, removed on 2027-03-31: use knowmind_recall_memories. This name keeps answering unchanged until then. Retrieve relevant knowledge before answering anything that benefits from prior context - decisions, preferences, project state, people, deadlines, past conversations. Hybrid recall (BM25 + pgvector + graph hops) over the tenant corpus; returns the top-k memory chunks, each with a relevance score and source reference. Suitable whenever earlier context would improve the answer; use knowmind_recall_at_time when you need what was valid at a past point in time. Read scope suffices.",
554
+ "description": "DEPRECATED, removed on 2027-03-31: use knowmind_recall_memories. This name keeps answering unchanged until then. Retrieve relevant knowledge before answering anything that benefits from prior context - decisions, preferences, project state, people, deadlines, past conversations. Hybrid recall (BM25 + pgvector + knowledge graph) over the tenant corpus; returns the top-k memory chunks, each with a relevance score and source reference. Suitable whenever earlier context would improve the answer; use knowmind_recall_at_time when you need what was valid at a past point in time. Read scope suffices.",
475
555
  "inputSchema": {
476
556
  "type": "object",
477
557
  "properties": {
@@ -491,7 +571,7 @@
491
571
  "minimum": 0,
492
572
  "maximum": 3,
493
573
  "default": 2,
494
- "description": "Graph expansion depth over typed relations (0-3, default 2); 0 = text/vector only, no graph."
574
+ "description": "Accepted for compatibility (0-3, default 2); currently has no effect on recall."
495
575
  }
496
576
  },
497
577
  "required": [
@@ -577,7 +657,7 @@
577
657
  "idempotentHint": true,
578
658
  "openWorldHint": false
579
659
  },
580
- "description": "DEPRECATED, removed on 2027-03-31: use knowmind_link_entities. This name keeps answering unchanged until then. Create a typed relation between two memory nodes (a knowledge-graph edge). THIS IS HOW THE GRAPH IS BUILT: after storing memories, connect them - a corpus without edges answers only what a single note already says. Subject and object classes must match the predicate; the inverse edge is materialized automatically, and derived edges (RUNS_ON, WORKS_FOR_CLIENT, HOST_SERVES_CLIENT, DEPENDS_ON_SUPPLIER) are computed by the server - never set them by hand. Get both node IDs via knowmind_recall first, and call knowmind_schema for the full catalogue with explanations. Allowed rel_type values: ABOUT (Contract|Document|FileResource → Topic), ASSIGNED_TO (ActionRecord|Task → Agent|Organization|Person|SoftwareAgent), CLIENT_OF (Agent|Organization|Person|SoftwareAgent → Organization), CONTACT_PERSON_FOR (Person → Organization), COVERED_BY (Topic → Contract|Document|FileResource), DELIVERED_AS (Application → Product), DELIVERED_BY (Product → Application), DEPENDS_ON (Application → Application), DEPLOYED_TO (Application → Container), DEVELOPED_BY (Application → Agent|Organization|Person|SoftwareAgent), DEVELOPS (Agent|Organization|Person|SoftwareAgent → Application), ENABLES (Application → Application), FOR_CLIENT (Project → Agent|Organization|Person|SoftwareAgent), HAS_ASSIGNED_TASK (Agent|Organization|Person|SoftwareAgent → ActionRecord|Task), HAS_CHILD (Person → Person), HAS_CLIENT (Organization → Agent|Organization|Person|SoftwareAgent), HAS_CONTACT_PERSON (Organization → Person), HAS_EMPLOYEE (Organization → Person), HAS_OPERATED_APPLICATION (Agent|Organization|Person|SoftwareAgent → Application), HAS_PARENT (Person → Person), HAS_PREDECESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HAS_PROJECT (Agent|Organization|Person|SoftwareAgent → Project), HAS_ROLE (Person → Role), HAS_SIBLING (Person → Person), HAS_SKILL (Agent|Organization|Person|SoftwareAgent → Skill), HAS_SUCCESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HOSTED_ON (Container → Host), HOSTS (Host → Container), HOSTS_APPLICATION (Container → Application), INFRASTRUCTURE_PROVIDED_BY (Host → Organization), INTEGRATES_WITH (Application → Application), IS_LED_BY (Organization → Person), KNOWS (Person → Person), LEADS (Person → Organization), OPERATED_FOR (Application → Agent|Organization|Person|SoftwareAgent), PAID_BY (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PARTNER_OF (Organization → Organization), PAYS (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PRODUCED_BY (Contract|Document|FileResource → Project), PRODUCES (Project → Contract|Document|FileResource), PROVIDES_INFRASTRUCTURE (Organization → Host), ROLE_OF (Role → Person), SERVED_UNDER (Application → Domain), SERVES (Domain → Application), SKILL_OF (Skill → Agent|Organization|Person|SoftwareAgent), SPOUSE_OF (Person → Person), SUPPLIED_BY (Agent|Organization|Person|SoftwareAgent → Organization), SUPPLIES (Organization → Agent|Organization|Person|SoftwareAgent), SUPPLIES_TECHNOLOGY (Organization → Technology), SUPPORTED_BY (Contract|Document|FileResource → Contract|Document|FileResource), SUPPORTS (Contract|Document|FileResource → Contract|Document|FileResource), TECHNOLOGY_SUPPLIED_BY (Technology → Organization), TECHNOLOGY_USED_BY (Technology → Application), USES_TECHNOLOGY (Application → Technology), WORKED_ON_BY (Project → Agent|Organization|Person|SoftwareAgent), WORKS_FOR (Person → Organization), WORKS_ON (Agent|Organization|Person|SoftwareAgent → Project). Requires write scope.",
660
+ "description": "DEPRECATED, removed on 2027-03-31: use knowmind_link_entities. This name keeps answering unchanged until then. Create a typed relation between two memory nodes (a knowledge-graph edge). THIS IS HOW THE GRAPH IS BUILT: after storing memories, connect them - a corpus without edges answers only what a single note already says. The server checks the edge against the ontology's shapes before writing it: the subject and object must belong to the classes the predicate requires (for entries without a class the check only warns), entity names must carry no role or suffix, and the edge must name its evidence - the id of the entry that states the relation. A rejected edge returns the violated rule. The inverse edge is materialized automatically, and derived edges (RUNS_ON, WORKS_FOR_CLIENT, HOST_SERVES_CLIENT, DEPENDS_ON_SUPPLIER) are computed by the server - never set them by hand. Get both node IDs via knowmind_recall first, and call knowmind_schema for the full catalogue with explanations. Allowed rel_type values: ABOUT (Contract|Document|FileResource → Topic), ASSIGNED_TO (ActionRecord|Task → Agent|Organization|Person|SoftwareAgent), CLIENT_OF (Agent|Organization|Person|SoftwareAgent → Organization), CONTACT_PERSON_FOR (Person → Organization), COVERED_BY (Topic → Contract|Document|FileResource), DELIVERED_AS (Application → Product), DELIVERED_BY (Product → Application), DEPENDS_ON (Application → Application), DEPLOYED_TO (Application → Container), DEVELOPED_BY (Application → Agent|Organization|Person|SoftwareAgent), DEVELOPS (Agent|Organization|Person|SoftwareAgent → Application), ENABLES (Application → Application), FOR_CLIENT (Project → Agent|Organization|Person|SoftwareAgent), HAS_ASSIGNED_TASK (Agent|Organization|Person|SoftwareAgent → ActionRecord|Task), HAS_CHILD (Person → Person), HAS_CLIENT (Organization → Agent|Organization|Person|SoftwareAgent), HAS_CONTACT_PERSON (Organization → Person), HAS_EMPLOYEE (Organization → Person), HAS_OPERATED_APPLICATION (Agent|Organization|Person|SoftwareAgent → Application), HAS_PARENT (Person → Person), HAS_PREDECESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HAS_PROJECT (Agent|Organization|Person|SoftwareAgent → Project), HAS_ROLE (Person → Role), HAS_SIBLING (Person → Person), HAS_SKILL (Agent|Organization|Person|SoftwareAgent → Skill), HAS_SUCCESSOR (ActionRecord|Project|Task → ActionRecord|Project|Task), HOSTED_ON (Container → Host), HOSTS (Host → Container), HOSTS_APPLICATION (Container → Application), INFRASTRUCTURE_PROVIDED_BY (Host → Organization), INTEGRATES_WITH (Application → Application), IS_LED_BY (Organization → Person), KNOWS (Person → Person), LEADS (Person → Organization), OPERATED_FOR (Application → Agent|Organization|Person|SoftwareAgent), PAID_BY (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PARTNER_OF (Organization → Organization), PAYS (Agent|Organization|Person|SoftwareAgent → Agent|Organization|Person|SoftwareAgent), PRODUCED_BY (Contract|Document|FileResource → Project), PRODUCES (Project → Contract|Document|FileResource), PROVIDES_INFRASTRUCTURE (Organization → Host), ROLE_OF (Role → Person), SERVED_UNDER (Application → Domain), SERVES (Domain → Application), SKILL_OF (Skill → Agent|Organization|Person|SoftwareAgent), SPOUSE_OF (Person → Person), SUPPLIED_BY (Agent|Organization|Person|SoftwareAgent → Organization), SUPPLIES (Organization → Agent|Organization|Person|SoftwareAgent), SUPPLIES_TECHNOLOGY (Organization → Technology), SUPPORTED_BY (Contract|Document|FileResource → Contract|Document|FileResource), SUPPORTS (Contract|Document|FileResource → Contract|Document|FileResource), TECHNOLOGY_SUPPLIED_BY (Technology → Organization), TECHNOLOGY_USED_BY (Technology → Application), USES_TECHNOLOGY (Application → Technology), WORKED_ON_BY (Project → Agent|Organization|Person|SoftwareAgent), WORKS_FOR (Person → Organization), WORKS_ON (Agent|Organization|Person|SoftwareAgent → Project). Requires write scope.",
581
661
  "inputSchema": {
582
662
  "type": "object",
583
663
  "properties": {
@@ -596,12 +676,17 @@
596
676
  "confidence": {
597
677
  "type": "number",
598
678
  "description": "Edge confidence in [0..1]; 1.0 for a fact stated verbatim, 0.7 for a clear paraphrase. Below that, do not create the edge."
679
+ },
680
+ "evidence": {
681
+ "type": "string",
682
+ "description": "Memory ID of the entry that states this relation (often from_id or a note found via knowmind_recall). Required: an edge without evidence is rejected."
599
683
  }
600
684
  },
601
685
  "required": [
602
686
  "from_id",
603
687
  "to_id",
604
- "rel_type"
688
+ "rel_type",
689
+ "evidence"
605
690
  ]
606
691
  }
607
692
  },