@cachly-dev/mcp-server 0.10.122 → 0.10.124

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 (55) hide show
  1. package/README.md +31 -15
  2. package/dist/src/ambient-hooks.d.ts +11 -2
  3. package/dist/src/ambient-hooks.js +11 -2
  4. package/dist/src/ambient-hooks.js.map +1 -1
  5. package/dist/src/ambient-ledger.js +2 -2
  6. package/dist/src/ambient-ledger.js.map +1 -1
  7. package/dist/src/ambient-memory.js +2 -2
  8. package/dist/src/ambient-memory.js.map +1 -1
  9. package/dist/src/auth.js +2 -1
  10. package/dist/src/auth.js.map +1 -1
  11. package/dist/src/brain-export.d.ts +40 -0
  12. package/dist/src/brain-export.js +89 -0
  13. package/dist/src/brain-export.js.map +1 -0
  14. package/dist/src/cachly-url.d.ts +68 -0
  15. package/dist/src/cachly-url.js +21 -0
  16. package/dist/src/cachly-url.js.map +1 -0
  17. package/dist/src/credentials.d.ts +37 -0
  18. package/dist/src/credentials.js +85 -0
  19. package/dist/src/credentials.js.map +1 -0
  20. package/dist/src/doctor.js +2 -1
  21. package/dist/src/doctor.js.map +1 -1
  22. package/dist/src/first-recall-proof.d.ts +19 -0
  23. package/dist/src/first-recall-proof.js +41 -0
  24. package/dist/src/first-recall-proof.js.map +1 -0
  25. package/dist/src/handlers/advanced.js +13 -29
  26. package/dist/src/handlers/advanced.js.map +1 -1
  27. package/dist/src/handlers/brain.js +132 -41
  28. package/dist/src/handlers/brain.js.map +1 -1
  29. package/dist/src/handlers/cache.js +3 -2
  30. package/dist/src/handlers/cache.js.map +1 -1
  31. package/dist/src/handlers/fedbrain.js +15 -4
  32. package/dist/src/handlers/fedbrain.js.map +1 -1
  33. package/dist/src/handlers/share.js +4 -3
  34. package/dist/src/handlers/share.js.map +1 -1
  35. package/dist/src/handlers/team.js +2 -1
  36. package/dist/src/handlers/team.js.map +1 -1
  37. package/dist/src/index.d.ts +32 -2
  38. package/dist/src/index.js +306 -80
  39. package/dist/src/index.js.map +1 -1
  40. package/dist/src/kostprobe.d.ts +25 -0
  41. package/dist/src/kostprobe.js +125 -0
  42. package/dist/src/kostprobe.js.map +1 -0
  43. package/dist/src/telemetry-types.d.ts +1 -1
  44. package/dist/src/tools.d.ts +0 -99
  45. package/dist/src/tools.js +0 -110
  46. package/dist/src/tools.js.map +1 -1
  47. package/dist/src/toolspecs.d.ts +1 -1
  48. package/dist/src/toolspecs.js +1 -1
  49. package/dist/src/upgrade-nudge.d.ts +15 -0
  50. package/dist/src/upgrade-nudge.js +29 -0
  51. package/dist/src/upgrade-nudge.js.map +1 -0
  52. package/glama.json +1 -1
  53. package/package.json +2 -2
  54. package/scripts/postinstall.js +1 -1
  55. package/server.json +3 -3
@@ -0,0 +1,25 @@
1
+ /** So oft darf jedes gesperrte Werkzeug auf der Gratis-Stufe echt laufen. */
2
+ export declare const KOSTPROBEN_JE_WERKZEUG = 3;
3
+ export declare function defaultKostprobePath(): string;
4
+ /** Wie oft wurde dieses Werkzeug auf diesem Rechner schon gekostet? */
5
+ export declare function kostprobenVerbraucht(werkzeug: string, path?: string): number;
6
+ /** Sind noch Kostproben übrig? */
7
+ export declare function kostprobeUebrig(werkzeug: string, path?: string): boolean;
8
+ /**
9
+ * Verbraucht eine Kostprobe und liefert die neue Anzahl.
10
+ * Schlägt das Schreiben fehl, wird trotzdem hochgezählt zurückgegeben — der
11
+ * Aufruf darf nie an einem Dateisystemproblem scheitern. Im schlimmsten Fall
12
+ * bekommt jemand eine Kostprobe mehr; das ist der harmlosere Fehler.
13
+ */
14
+ export declare function kostprobeVerbrauchen(werkzeug: string, path?: string): number;
15
+ /**
16
+ * Der Hinweis NACH einer Kostprobe. Bewusst kurz und ohne Druck — das Ergebnis
17
+ * steht darüber und soll wirken, nicht der Text.
18
+ */
19
+ export declare function kostprobeHinweis(werkzeug: string, verbraucht: number, upgradeUrl: string): string;
20
+ /**
21
+ * Die Schranke, wenn die Kostproben aufgebraucht sind. Sie nennt eine ZAHL
22
+ * statt eines Versprechens — "so oft hat es dir schon geholfen" ist ein
23
+ * Argument, "eine Premium-Funktion" ist keines.
24
+ */
25
+ export declare function schrankeNachKostproben(werkzeug: string, pitch: string, upgradeUrl: string): string;
@@ -0,0 +1,125 @@
1
+ // Kostprobe — gesperrte Werkzeuge dürfen ein paar Mal echt laufen.
2
+ //
3
+ // ─── DER ANLASS ──────────────────────────────────────────────────────────────
4
+ //
5
+ // Gemessen am 11.08.2026 in mcp_events: `premium_gate_hit` ist 36-mal gefeuert,
6
+ // von genau EINER Person — dem Entwickler des Produkts selbst, zwischen dem
7
+ // 30.06. und dem 08.08. Er hat nicht aufgerüstet. Bei seinem eigenen Produkt,
8
+ // wo Geld nicht das Hindernis ist.
9
+ //
10
+ // Das ist die härteste Zahl, die es zur Preisfrage gibt: Der intensivste
11
+ // Nutzer, den cachly je hatte, stand 36-mal vor der Schranke und ging jedes
12
+ // Mal weiter. Nicht weil die Funktionen schlecht wären — sondern weil er nie
13
+ // gesehen hat, was sie an SEINEN Daten tun.
14
+ //
15
+ // Die Schranke gab eine Verkaufsansage. Nie eine Kostprobe.
16
+ // Man vermisst nicht, was man nie hatte.
17
+ //
18
+ // ─── DIE REGEL ───────────────────────────────────────────────────────────────
19
+ //
20
+ // Jedes gesperrte Werkzeug darf auf der Gratis-Stufe KOSTPROBEN_JE_WERKZEUG-mal
21
+ // vollständig laufen. Echtes Ergebnis, keine gekürzte Fassung. Erst danach
22
+ // kommt die Schranke — und dann mit einer Zahl statt einem Versprechen:
23
+ // "Das hat dir schon 3-mal geholfen."
24
+ //
25
+ // Je Werkzeug einzeln gezählt, nicht als Gesamtbudget. Wer causal_trace
26
+ // dreimal nutzt, soll trotzdem brain_predict noch kennenlernen dürfen; ein
27
+ // gemeinsamer Topf würde beim ersten Werkzeug aufgebraucht.
28
+ //
29
+ // ─── WAS DIESE ZÄHLUNG NICHT KANN ────────────────────────────────────────────
30
+ //
31
+ // Sie liegt lokal in ~/.cachly/ und gilt damit je Rechner. Wer neu installiert
32
+ // oder auf einem zweiten Rechner arbeitet, bekommt neue Kostproben. Das ist
33
+ // bewusst in Kauf genommen: Eine serverseitige Zählung wäre genauer, bräuchte
34
+ // aber eine Migration und einen neuen Endpunkt — und für eine Kostprobe ist
35
+ // großzügig der richtige Fehler. Wer sie mehrfach aufbraucht, hat das Werkzeug
36
+ // mehrfach erlebt; das ist kein Verlust, das ist der Zweck.
37
+ //
38
+ // Zu messen ist der Erfolg an einer Zahl: heute 36 Ansagen, 0 Aufrüstungen.
39
+ // Danach müsste das Verhältnis von `premium_taste_used` zu `premium_gate_hit`
40
+ // zeigen, ob aus Erleben Interesse wird.
41
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
42
+ import { homedir } from 'node:os';
43
+ import { dirname, join } from 'node:path';
44
+ /** So oft darf jedes gesperrte Werkzeug auf der Gratis-Stufe echt laufen. */
45
+ export const KOSTPROBEN_JE_WERKZEUG = 3;
46
+ export function defaultKostprobePath() {
47
+ return join(homedir(), '.cachly', 'kostproben.json');
48
+ }
49
+ function lesen(path) {
50
+ try {
51
+ if (!existsSync(path))
52
+ return {};
53
+ const parsed = JSON.parse(readFileSync(path, 'utf-8'));
54
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
55
+ // Nur Zahlen übernehmen — eine beschädigte Datei darf nicht dazu führen,
56
+ // dass jemand dauerhaft freien Zugang bekommt oder dauerhaft keinen.
57
+ const out = {};
58
+ for (const [k, v] of Object.entries(parsed)) {
59
+ if (typeof v === 'number' && Number.isFinite(v) && v >= 0)
60
+ out[k] = v;
61
+ }
62
+ return out;
63
+ }
64
+ return {};
65
+ }
66
+ catch {
67
+ return {}; // beschädigt → wie leer behandeln
68
+ }
69
+ }
70
+ /** Wie oft wurde dieses Werkzeug auf diesem Rechner schon gekostet? */
71
+ export function kostprobenVerbraucht(werkzeug, path = defaultKostprobePath()) {
72
+ return lesen(path)[werkzeug] ?? 0;
73
+ }
74
+ /** Sind noch Kostproben übrig? */
75
+ export function kostprobeUebrig(werkzeug, path = defaultKostprobePath()) {
76
+ return kostprobenVerbraucht(werkzeug, path) < KOSTPROBEN_JE_WERKZEUG;
77
+ }
78
+ /**
79
+ * Verbraucht eine Kostprobe und liefert die neue Anzahl.
80
+ * Schlägt das Schreiben fehl, wird trotzdem hochgezählt zurückgegeben — der
81
+ * Aufruf darf nie an einem Dateisystemproblem scheitern. Im schlimmsten Fall
82
+ * bekommt jemand eine Kostprobe mehr; das ist der harmlosere Fehler.
83
+ */
84
+ export function kostprobeVerbrauchen(werkzeug, path = defaultKostprobePath()) {
85
+ const alle = lesen(path);
86
+ const neu = (alle[werkzeug] ?? 0) + 1;
87
+ try {
88
+ alle[werkzeug] = neu;
89
+ mkdirSync(dirname(path), { recursive: true });
90
+ writeFileSync(path, JSON.stringify(alle, null, 2) + '\n', 'utf-8');
91
+ }
92
+ catch {
93
+ /* nie werfen */
94
+ }
95
+ return neu;
96
+ }
97
+ /**
98
+ * Der Hinweis NACH einer Kostprobe. Bewusst kurz und ohne Druck — das Ergebnis
99
+ * steht darüber und soll wirken, nicht der Text.
100
+ */
101
+ export function kostprobeHinweis(werkzeug, verbraucht, upgradeUrl) {
102
+ const uebrig = Math.max(0, KOSTPROBEN_JE_WERKZEUG - verbraucht);
103
+ if (uebrig > 0) {
104
+ return `\n\n_Kostprobe: \`${werkzeug}\` ist eine Premium-Funktion. ` +
105
+ `Noch ${uebrig} ${uebrig === 1 ? 'freier Lauf' : 'freie Läufe'} auf diesem Rechner._`;
106
+ }
107
+ return `\n\n_Das war deine letzte Kostprobe von \`${werkzeug}\`. ` +
108
+ `Weiter geht es hier: ${upgradeUrl}_`;
109
+ }
110
+ /**
111
+ * Die Schranke, wenn die Kostproben aufgebraucht sind. Sie nennt eine ZAHL
112
+ * statt eines Versprechens — "so oft hat es dir schon geholfen" ist ein
113
+ * Argument, "eine Premium-Funktion" ist keines.
114
+ */
115
+ export function schrankeNachKostproben(werkzeug, pitch, upgradeUrl) {
116
+ return [
117
+ `🔒 **\`${werkzeug}\`** — deine ${KOSTPROBEN_JE_WERKZEUG} Kostproben sind aufgebraucht.`,
118
+ ``,
119
+ `Es hat dir hier schon ${KOSTPROBEN_JE_WERKZEUG}-mal geantwortet: ${pitch}`,
120
+ ``,
121
+ `Dein Gratis-Gedächtnis behält alles andere — Abruf, Lernen, Sitzungen, Kausalgraph. Für immer.`,
122
+ `Weiter mit der tieferen Schicht → ${upgradeUrl}`,
123
+ ].join('\n');
124
+ }
125
+ //# sourceMappingURL=kostprobe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kostprobe.js","sourceRoot":"","sources":["../../src/kostprobe.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,8EAA8E;AAC9E,mCAAmC;AACnC,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,6EAA6E;AAC7E,4CAA4C;AAC5C,EAAE;AACF,4DAA4D;AAC5D,yCAAyC;AACzC,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,wEAAwE;AACxE,sCAAsC;AACtC,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,4DAA4D;AAC5D,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,4DAA4D;AAC5D,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,yCAAyC;AAEzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,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BAAyB,sBAAsB,qBAAqB,KAAK,EAAE;QAC3E,EAAE;QACF,gGAAgG;QAChG,qCAAqC,UAAU,EAAE;KAClD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -9,7 +9,7 @@
9
9
  * The ingest worker MUST NOT see raw JWTs or api_keys. Resolution happens
10
10
  * exclusively inside the cachly API trust boundary before events reach the queue.
11
11
  */
12
- export type FunnelEventName = 'device_flow_started' | 'device_flow_completed' | 'device_flow_failed' | 'auth_self_healed' | 'm2m_auth_completed' | 'm2m_auth_failed' | 'setup_started' | 'setup_auth_started' | 'setup_auth_completed' | 'setup_instance_ready' | 'setup_completed' | 'first_call_success' | 'session_start' | 'session_end' | 'recall_best_solution' | 'learn_from_attempts' | 'smart_recall' | 'brain_from_git' | 'brain_predict' | 'brain_predict_failures' | 'brain_seed_starter' | 'premium_gate_hit' | (string & Record<never, never>);
12
+ export type FunnelEventName = 'device_flow_started' | 'device_flow_completed' | 'device_flow_failed' | 'auth_self_healed' | 'm2m_auth_completed' | 'm2m_auth_failed' | 'setup_started' | 'setup_auth_started' | 'setup_auth_completed' | 'setup_instance_ready' | 'setup_completed' | 'first_call_success' | 'session_start' | 'session_end' | 'recall_best_solution' | 'learn_from_attempts' | 'smart_recall' | 'brain_from_git' | 'brain_predict' | 'brain_predict_failures' | 'brain_seed_starter' | 'premium_gate_hit' | 'premium_taste_used' | (string & Record<never, never>);
13
13
  export interface SessionStartMetrics {
14
14
  recalls_total?: number;
15
15
  born_at?: string;
@@ -2891,105 +2891,6 @@ declare const TOOLS: readonly [{
2891
2891
  };
2892
2892
  readonly required: readonly ["instance_id"];
2893
2893
  };
2894
- }, {
2895
- readonly name: "brain_stats";
2896
- readonly description: string;
2897
- readonly inputSchema: {
2898
- readonly type: "object";
2899
- readonly properties: {
2900
- readonly instance_id: {
2901
- readonly type: "string";
2902
- readonly description: "UUID of the Brain instance.";
2903
- };
2904
- readonly period_days: {
2905
- readonly type: "number";
2906
- readonly description: "Look-back window in days for velocity and session stats (default 30).";
2907
- };
2908
- };
2909
- readonly required: readonly ["instance_id"];
2910
- };
2911
- }, {
2912
- readonly name: "brain_export_md";
2913
- readonly description: string;
2914
- readonly inputSchema: {
2915
- readonly type: "object";
2916
- readonly properties: {
2917
- readonly instance_id: {
2918
- readonly type: "string";
2919
- readonly description: "UUID of the Brain instance.";
2920
- };
2921
- readonly min_confidence: {
2922
- readonly type: "number";
2923
- readonly description: "Only include lessons with confidence ≥ this value (0..1, default 0.5).";
2924
- };
2925
- readonly topic_prefix: {
2926
- readonly type: "string";
2927
- readonly description: "Only include lessons whose topic starts with this prefix (e.g. \"auth\", \"deploy\"). Omit for all topics.";
2928
- };
2929
- readonly format: {
2930
- readonly type: "string";
2931
- readonly enum: readonly ["markdown", "json", "claude-md"];
2932
- readonly description: "\"markdown\" (default) — human-readable MD; \"json\" — structured array; \"claude-md\" — a CLAUDE.md-compatible block ready to paste.";
2933
- };
2934
- };
2935
- readonly required: readonly ["instance_id"];
2936
- };
2937
- }, {
2938
- readonly name: "brain_daily_digest";
2939
- readonly description: string;
2940
- readonly inputSchema: {
2941
- readonly type: "object";
2942
- readonly properties: {
2943
- readonly instance_id: {
2944
- readonly type: "string";
2945
- readonly description: "UUID of the Brain instance.";
2946
- };
2947
- readonly period_hours: {
2948
- readonly type: "number";
2949
- readonly description: "Look-back window in hours (default 24 = last day).";
2950
- };
2951
- readonly webhook_url: {
2952
- readonly type: "string";
2953
- readonly description: "POST digest to this URL as JSON (optional). Supports Slack incoming webhooks, Discord webhooks, custom endpoints.";
2954
- };
2955
- readonly telegram_chat_id: {
2956
- readonly type: "string";
2957
- readonly description: "Send digest to this Telegram chat ID via cachly's Telegram integration (optional, requires Telegram configured on the instance).";
2958
- };
2959
- readonly format: {
2960
- readonly type: "string";
2961
- readonly enum: readonly ["text", "markdown", "slack", "discord"];
2962
- readonly description: "Output format. \"slack\" and \"discord\" produce webhook-ready Block Kit / Embed payloads.";
2963
- };
2964
- };
2965
- readonly required: readonly ["instance_id"];
2966
- };
2967
- }, {
2968
- readonly name: "brain_onboard_teammate";
2969
- readonly description: string;
2970
- readonly inputSchema: {
2971
- readonly type: "object";
2972
- readonly properties: {
2973
- readonly instance_id: {
2974
- readonly type: "string";
2975
- readonly description: "UUID of the Brain instance.";
2976
- };
2977
- readonly name: {
2978
- readonly type: "string";
2979
- readonly description: "New teammate's first name (personalises the bundle).";
2980
- };
2981
- readonly editor: {
2982
- readonly type: "string";
2983
- readonly enum: readonly ["claude-code", "cursor", "copilot", "windsurf", "cline", "zed", "all"];
2984
- readonly description: "Their primary AI editor (default \"all\" — includes configs for every editor).";
2985
- };
2986
- readonly top_lessons: {
2987
- readonly type: "number";
2988
- readonly description: "How many top lessons to include in the brief (default 30, max 100).";
2989
- };
2990
- };
2991
- readonly required: readonly ["instance_id"];
2992
- };
2993
2894
  }, {
2994
2895
  readonly name: "brain_set_pref";
2995
2896
  readonly description: string;
package/dist/src/tools.js CHANGED
@@ -2430,116 +2430,6 @@ const TOOLS = [
2430
2430
  },
2431
2431
  },
2432
2432
  // ── New Power Tools ──────────────────────────────────────────────────────────
2433
- {
2434
- name: 'brain_stats',
2435
- description: 'Get deep statistics about a Brain instance: lesson count, confidence distribution, ' +
2436
- 'learning velocity (lessons/day), top topics, top tags, session count, average session length, ' +
2437
- 'recall hit rate, and memory crystal count. Use to understand Brain health, measure growth, ' +
2438
- 'and surface insights for the team. ' +
2439
- 'Example: brain_stats(instance_id="...") · brain_stats(instance_id="...", period_days=30)',
2440
- inputSchema: {
2441
- type: 'object',
2442
- properties: {
2443
- instance_id: { type: 'string', description: 'UUID of the Brain instance.' },
2444
- period_days: {
2445
- type: 'number',
2446
- description: 'Look-back window in days for velocity and session stats (default 30).',
2447
- },
2448
- },
2449
- required: ['instance_id'],
2450
- },
2451
- },
2452
- {
2453
- name: 'brain_export_md',
2454
- description: 'Export all lessons from a Brain instance as a Markdown document. ' +
2455
- 'Groups lessons by topic, sorted by confidence (highest first). ' +
2456
- 'Ideal for onboarding new teammates: share the exported file so their AI ' +
2457
- 'starts pre-loaded with your team\'s accumulated knowledge without needing a Brain connection. ' +
2458
- 'Optionally filter to a minimum confidence threshold or specific topic prefix. ' +
2459
- 'Example: brain_export_md(instance_id="...") · brain_export_md(instance_id="...", min_confidence=0.8, topic_prefix="auth")',
2460
- inputSchema: {
2461
- type: 'object',
2462
- properties: {
2463
- instance_id: { type: 'string', description: 'UUID of the Brain instance.' },
2464
- min_confidence: {
2465
- type: 'number',
2466
- description: 'Only include lessons with confidence ≥ this value (0..1, default 0.5).',
2467
- },
2468
- topic_prefix: {
2469
- type: 'string',
2470
- description: 'Only include lessons whose topic starts with this prefix (e.g. "auth", "deploy"). Omit for all topics.',
2471
- },
2472
- format: {
2473
- type: 'string',
2474
- enum: ['markdown', 'json', 'claude-md'],
2475
- description: '"markdown" (default) — human-readable MD; "json" — structured array; "claude-md" — a CLAUDE.md-compatible block ready to paste.',
2476
- },
2477
- },
2478
- required: ['instance_id'],
2479
- },
2480
- },
2481
- {
2482
- name: 'brain_daily_digest',
2483
- description: 'Generate or send a daily digest of Brain activity: lessons learned today, ' +
2484
- 'confidence changes, sessions run, top patterns emerging, and predictions for tomorrow. ' +
2485
- 'Can be sent to a Telegram chat, a webhook URL, or returned as text. ' +
2486
- 'Schedule this in a cron job or CI pipeline to keep the whole team informed about ' +
2487
- 'what the Brain learned without anyone having to check manually. ' +
2488
- 'Example: brain_daily_digest(instance_id="...") · brain_daily_digest(instance_id="...", webhook_url="https://...", period_hours=24)',
2489
- inputSchema: {
2490
- type: 'object',
2491
- properties: {
2492
- instance_id: { type: 'string', description: 'UUID of the Brain instance.' },
2493
- period_hours: {
2494
- type: 'number',
2495
- description: 'Look-back window in hours (default 24 = last day).',
2496
- },
2497
- webhook_url: {
2498
- type: 'string',
2499
- description: 'POST digest to this URL as JSON (optional). Supports Slack incoming webhooks, Discord webhooks, custom endpoints.',
2500
- },
2501
- telegram_chat_id: {
2502
- type: 'string',
2503
- description: 'Send digest to this Telegram chat ID via cachly\'s Telegram integration (optional, requires Telegram configured on the instance).',
2504
- },
2505
- format: {
2506
- type: 'string',
2507
- enum: ['text', 'markdown', 'slack', 'discord'],
2508
- description: 'Output format. "slack" and "discord" produce webhook-ready Block Kit / Embed payloads.',
2509
- },
2510
- },
2511
- required: ['instance_id'],
2512
- },
2513
- },
2514
- {
2515
- name: 'brain_onboard_teammate',
2516
- description: 'Generate a complete onboarding bundle for a new teammate: a shareable link to the Brain, ' +
2517
- 'a pre-filled CLAUDE.md / .mcp.json snippet, the top-30 lessons as a quick-start brief, ' +
2518
- 'and a setup command they can run in one line. ' +
2519
- 'The bundle is returned as a single Markdown document they can paste into any AI assistant ' +
2520
- 'or share via Slack/email. ' +
2521
- 'Example: brain_onboard_teammate(instance_id="...", name="Sarah")',
2522
- inputSchema: {
2523
- type: 'object',
2524
- properties: {
2525
- instance_id: { type: 'string', description: 'UUID of the Brain instance.' },
2526
- name: {
2527
- type: 'string',
2528
- description: 'New teammate\'s first name (personalises the bundle).',
2529
- },
2530
- editor: {
2531
- type: 'string',
2532
- enum: ['claude-code', 'cursor', 'copilot', 'windsurf', 'cline', 'zed', 'all'],
2533
- description: 'Their primary AI editor (default "all" — includes configs for every editor).',
2534
- },
2535
- top_lessons: {
2536
- type: 'number',
2537
- description: 'How many top lessons to include in the brief (default 30, max 100).',
2538
- },
2539
- },
2540
- required: ['instance_id'],
2541
- },
2542
- },
2543
2433
  {
2544
2434
  name: 'brain_set_pref',
2545
2435
  description: 'Persist a user preference for this Brain instance. ' +