knowmind 0.2.0 → 0.3.1

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,15 @@
1
1
  # Knowmind CLI — Änderungen
2
2
 
3
+ ## 0.3.0 (2026-07-16)
4
+
5
+ **`knowmind status`: Sitzungs-Zähler + sichtbares Flackern**
6
+ - Die Statusline zeigt jetzt, wie viele Erinnerungen in der laufenden Sitzung
7
+ abgerufen wurden — als eigenes, farblich hervorgehobenes Lebenszeichen.
8
+ - Die grüne LED flackert bei Aktivität jetzt sichtbar: `knowmind init --client
9
+ claude-code` richtet die Statusleiste mit periodischem Neuzeichnen ein
10
+ (Claude Code ab v2.1.97). Ohne das rendert Claude Code die Statusleiste nur
11
+ bei Ereignissen, sodass eine Animation nicht sichtbar würde.
12
+
3
13
  ## 0.2.0 (2026-07-16)
4
14
 
5
15
  **Neu: `knowmind status` — sichtbares Lebenszeichen des Gedächtnisses**
package/bin/knowmind.js CHANGED
@@ -248,7 +248,23 @@ async function runStatus() {
248
248
  return;
249
249
  }
250
250
  if (args.includes("--line")) {
251
- process.stdout.write(renderLine());
251
+ // Claude Code reicht der Statusline ein JSON per stdin (u. a. session_id).
252
+ // Non-blocking mit kurzem Timeout lesen — bei manuellem Aufruf ohne stdin
253
+ // darf nichts hängen. session_id ergibt den Sitzungs-Recall-Zähler.
254
+ let sessionId = "";
255
+ try {
256
+ const raw = await Promise.race([
257
+ readStdin(),
258
+ new Promise((r) => setTimeout(() => r(""), 80)),
259
+ ]);
260
+ if (raw && raw.trim().startsWith("{")) {
261
+ const d = JSON.parse(raw);
262
+ sessionId = d.session_id || d.sessionId || "";
263
+ }
264
+ } catch {
265
+ /* kein/kaputtes stdin — ohne Session weiter */
266
+ }
267
+ process.stdout.write(renderLine(sessionId));
252
268
  return;
253
269
  }
254
270
  console.log(await renderFull());
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "knowmind",
3
- "version": "0.2.0",
4
- "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
- "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
- "type": "module",
7
- "license": "Apache-2.0",
8
- "homepage": "https://knowmind.de",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Schubeler-Consulting/knowmind.git"
12
- },
13
- "bugs": {
14
- "url": "https://knowmind.de/support",
15
- "email": "info@schuebeler-consulting.de"
16
- },
17
- "author": {
18
- "name": "Knowmind",
19
- "email": "info@schuebeler-consulting.de",
20
- "url": "https://knowmind.de"
21
- },
22
- "engines": {
23
- "node": ">=20"
24
- },
25
- "bin": {
26
- "knowmind": "bin/knowmind.js"
27
- },
28
- "files": [
29
- "bin",
30
- "src",
31
- "!src/*.test.js",
32
- "README.md",
33
- "CHANGELOG.md",
34
- "LICENSE"
35
- ],
36
- "scripts": {
37
- "test": "node --test src/*.test.js"
38
- },
39
- "dependencies": {
40
- "@huggingface/transformers": "^3.5.0"
41
- },
42
- "overrides": {
43
- "global-agent": "^4.1.3"
44
- },
45
- "keywords": [
46
- "knowmind",
47
- "mcp",
48
- "model-context-protocol",
49
- "knowledge-graph",
50
- "recall",
51
- "memory",
52
- "rag",
53
- "claude",
54
- "openai",
55
- "anthropic",
56
- "ai"
57
- ],
58
- "publishConfig": {
59
- "access": "public"
60
- }
61
- }
1
+ {
2
+ "name": "knowmind",
3
+ "version": "0.3.1",
4
+ "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
+ "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
+ "type": "module",
7
+ "license": "Apache-2.0",
8
+ "homepage": "https://knowmind.de",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Schubeler-Consulting/knowmind.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://knowmind.de/support",
15
+ "email": "info@schuebeler-consulting.de"
16
+ },
17
+ "author": {
18
+ "name": "Knowmind",
19
+ "email": "info@schuebeler-consulting.de",
20
+ "url": "https://knowmind.de"
21
+ },
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "bin": {
26
+ "knowmind": "bin/knowmind.js"
27
+ },
28
+ "files": [
29
+ "bin",
30
+ "src",
31
+ "!src/*.test.js",
32
+ "README.md",
33
+ "CHANGELOG.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "test": "node --test src/*.test.js"
38
+ },
39
+ "dependencies": {
40
+ "@huggingface/transformers": "^3.5.0"
41
+ },
42
+ "overrides": {
43
+ "global-agent": "^4.1.3"
44
+ },
45
+ "keywords": [
46
+ "knowmind",
47
+ "mcp",
48
+ "model-context-protocol",
49
+ "knowledge-graph",
50
+ "recall",
51
+ "memory",
52
+ "rag",
53
+ "claude",
54
+ "openai",
55
+ "anthropic",
56
+ "ai"
57
+ ],
58
+ "publishConfig": {
59
+ "access": "public"
60
+ }
61
+ }
package/src/config.js CHANGED
@@ -76,15 +76,17 @@ function _lockdown(target) {
76
76
  // `knowmind login` unter Windows machte die CLI unbrauchbar.)
77
77
  const suffix = statSync(target).isDirectory() ? ":(OI)(CI)F" : ":F";
78
78
  // /reset alleine reicht nicht — die geerbten Berechtigungen müssen weg.
79
- spawnSync("icacls", [target, "/inheritance:r"], { stdio: "ignore" });
80
- spawnSync("icacls", [target, "/grant:r", `${user}${suffix}`], { stdio: "ignore" });
81
- spawnSync("icacls", [target, "/grant:r", `SYSTEM${suffix}`], { stdio: "ignore" });
79
+ spawnSync("icacls", [target, "/inheritance:r"], { stdio: "ignore", windowsHide: true });
80
+ spawnSync("icacls", [target, "/grant:r", `${user}${suffix}`], { stdio: "ignore", windowsHide: true });
81
+ spawnSync("icacls", [target, "/grant:r", `SYSTEM${suffix}`], { stdio: "ignore", windowsHide: true });
82
82
  spawnSync("icacls", [target, "/grant:r", `Administratoren${suffix}`], {
83
83
  stdio: "ignore",
84
+ windowsHide: true,
84
85
  });
85
86
  // EN-Variante als Fallback (icacls akzeptiert beide nur in jeweiliger Locale)
86
87
  spawnSync("icacls", [target, "/grant:r", `Administrators${suffix}`], {
87
88
  stdio: "ignore",
89
+ windowsHide: true,
88
90
  });
89
91
  } catch {
90
92
  // best effort — wenn icacls fehlt, fallen wir auf Standard-NTFS zurück
package/src/init.js CHANGED
@@ -154,7 +154,7 @@ function autoRecallHookSource() {
154
154
  // npx-Kaltstart; und es gibt KEINE Command-Injection, weil die Nutzer-Frage als
155
155
  // JSON-Body und nicht als Shell-Argument übergeben wird. Fail-open: jeder
156
156
  // Fehler / fehlendes Token -> exit 0 ohne Ausgabe, blockiert nie.
157
- import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
157
+ import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync, unlinkSync } from "node:fs";
158
158
  import { homedir } from "node:os";
159
159
  import { join } from "node:path";
160
160
 
@@ -167,6 +167,30 @@ function markActivity() {
167
167
  } catch {}
168
168
  }
169
169
 
170
+ // Zählt pro Claude-Code-Session die abgerufenen Erinnerungen. Die Statusline
171
+ // zeigt „N abgerufen" für die laufende Sitzung. Best-effort.
172
+ function bumpSessionRecalls(sessionId, hits) {
173
+ if (!sessionId || !(hits > 0)) return;
174
+ try {
175
+ const d = join(homedir(), ".knowmind", "sessions");
176
+ mkdirSync(d, { recursive: true });
177
+ const now = Date.now();
178
+ for (const fn of readdirSync(d)) {
179
+ try {
180
+ if (now - statSync(join(d, fn)).mtimeMs > 86400000) unlinkSync(join(d, fn));
181
+ } catch {}
182
+ }
183
+ const safe = String(sessionId).replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 80);
184
+ const p = join(d, safe + ".json");
185
+ let cur = {};
186
+ try { cur = JSON.parse(readFileSync(p, "utf-8")); } catch {}
187
+ cur.recalls = (cur.recalls || 0) + 1;
188
+ cur.memories = (cur.memories || 0) + hits;
189
+ cur.updated = now;
190
+ writeFileSync(p, JSON.stringify(cur));
191
+ } catch {}
192
+ }
193
+
170
194
  const TRIVIAL = new Set([
171
195
  "ok","okay","go","ja","nein","weiter","stop","danke","thanks","thx",
172
196
  "yes","no","yep","nope","perfekt","passt","super","gut",
@@ -246,9 +270,11 @@ async function main() {
246
270
  process.stdin.setEncoding("utf-8");
247
271
  for await (const c of process.stdin) raw += c;
248
272
  let prompt = "";
273
+ let sessionId = "";
249
274
  try {
250
275
  const data = raw ? JSON.parse(raw) : {};
251
276
  prompt = data.prompt || data.user_prompt || data.user_message || "";
277
+ sessionId = data.session_id || data.sessionId || "";
252
278
  } catch { return; }
253
279
  if (!shouldRecall(prompt)) return;
254
280
 
@@ -279,6 +305,7 @@ async function main() {
279
305
 
280
306
  const hits = formatHits(rpc);
281
307
  if (!hits) return;
308
+ bumpSessionRecalls(sessionId, (hits.match(/^• /gm) || []).length);
282
309
 
283
310
  process.stdout.write(
284
311
  "═════════ knowmind RECALL (auto) ═════════\\n" +
@@ -505,7 +532,10 @@ function planClaudeCode(cwd) {
505
532
  // Statusline: knowmind-Lebenszeichen (grüne HDD-LED). NUR setzen, wenn
506
533
  // keine existiert oder sie bereits auf knowmind zeigt — eine fremde
507
534
  // Statusline des Nutzers wird NIE gekapert.
508
- const km = { type: "command", command: "knowmind status --line" };
535
+ // refreshInterval: Claude Code rendert die Statusline sonst nur bei
536
+ // Ereignissen — damit die grüne LED bei Aktivität sichtbar flackert, muss
537
+ // sie periodisch neu gezeichnet werden (Claude Code >= 2.1.97, Min. 500 ms).
538
+ const km = { type: "command", command: "knowmind status --line", refreshInterval: 500 };
509
539
  let m3 = false;
510
540
  const existing = settings.statusLine;
511
541
  const isKnowmind =
@@ -513,7 +543,7 @@ function planClaudeCode(cwd) {
513
543
  if (!existing) {
514
544
  settings.statusLine = km;
515
545
  m3 = true;
516
- } else if (isKnowmind && existing.command !== km.command) {
546
+ } else if (isKnowmind && (existing.command !== km.command || existing.refreshInterval !== 500)) {
517
547
  settings.statusLine = km;
518
548
  m3 = true;
519
549
  }
package/src/status.js CHANGED
@@ -40,6 +40,15 @@ const brightGreen = (s) => c("92", s);
40
40
  const dimGreen = (s) => c("2;32", s);
41
41
  const red = (s) => c("31", s);
42
42
  const dim = (s) => c("2", s);
43
+ const kmBlue = (s) => c("38;5;111", s); // ≈ knowmind-Blau #6ea8ff (Session-Akzent)
44
+
45
+ /** Abgerufene Erinnerungen in DIESER Claude-Code-Session (null wenn keine). */
46
+ function sessionRecalls(sessionId) {
47
+ if (!sessionId) return null;
48
+ const safe = String(sessionId).replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 80);
49
+ const data = readJson(join(KM_DIR, "sessions", safe + ".json"));
50
+ return data && data.memories > 0 ? data.memories : null;
51
+ }
43
52
 
44
53
  /**
45
54
  * Grüne Festplatten-LED: bei Aktivität flackert das ●-Zeichen unregelmäßig
@@ -135,6 +144,7 @@ function spawnProbe() {
135
144
  const child = spawn(process.execPath, [self, "status", "--probe"], {
136
145
  detached: true,
137
146
  stdio: "ignore",
147
+ windowsHide: true,
138
148
  });
139
149
  child.unref();
140
150
  } catch {
@@ -168,12 +178,14 @@ function hhmm(ts) {
168
178
  }
169
179
  }
170
180
 
171
- /** Einzeilige Statusline-Ausgabe. Blinkt bei Aktivität, erholt sich selbst. */
172
- export function renderLine() {
181
+ /** Einzeilige Statusline-Ausgabe. Flackert bei Aktivität, erholt sich selbst.
182
+ * sessionId (optional): zeigt „N abgerufen" für die laufende Claude-Code-Sitzung. */
183
+ export function renderLine(sessionId) {
173
184
  if (!loadConfig().token && !process.env.KNOWMIND_TOKEN) {
174
185
  return dim("○ knowmind · nicht angemeldet");
175
186
  }
176
187
  const h = healthState();
188
+ const sep = " " + dim("·") + " ";
177
189
 
178
190
  if (h.ok === false) {
179
191
  const since = h.downSince ? ` (seit ${hhmm(h.downSince)})` : "";
@@ -182,13 +194,20 @@ export function renderLine() {
182
194
  if (h.ok == null) {
183
195
  return `${dimGreen("●")} ${dim("knowmind · prüfe …")}`;
184
196
  }
197
+ // Session-Zähler = Lebenszeichen dieser Sitzung (knowmind-Blau, auffällig).
198
+ const sess = sessionRecalls(sessionId);
199
+ const sessTxt = sess ? kmBlue(`${fmtCount(sess)} abgerufen`) : null;
200
+
185
201
  // erreichbar: bei Aktivität grünes HDD-Flackern, sonst ruhig leuchtend grün
186
202
  if (activityAgeMs() <= ACTIVE_MS) {
187
- return `${flickerLed()} ${dim("knowmind · arbeitet")}`;
203
+ return `${flickerLed()} ${dim("knowmind arbeitet")}` + (sessTxt ? sep + sessTxt : "");
204
+ }
205
+ let tail = sessTxt;
206
+ if (!tail) {
207
+ const cnt = readJson(COUNT_CACHE);
208
+ tail = cnt?.count != null ? dim(`${fmtCount(cnt.count)} gespeichert`) : null;
188
209
  }
189
- const cnt = readJson(COUNT_CACHE);
190
- const tail = cnt?.count != null ? ` · ${fmtCount(cnt.count)} Erinnerungen` : "";
191
- return `${green("●")} ${dim("knowmind" + tail)}`;
210
+ return `${green("●")} ${dim("knowmind")}` + (tail ? sep + tail : "");
192
211
  }
193
212
 
194
213
  /** Mehrzeilige, menschenlesbare Ausgabe (`knowmind status`). */