@cachly-dev/mcp-server 0.9.16 → 0.9.18
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/.github/workflows/publish.yml +42 -0
- package/LICENSE +202 -0
- package/dist/__tests__/brain-flow.test.d.ts +12 -0
- package/dist/__tests__/brain-flow.test.js +504 -0
- package/dist/__tests__/brain-flow.test.js.map +1 -0
- package/dist/ckg.d.ts +22 -0
- package/dist/ckg.js +40 -0
- package/dist/ckg.js.map +1 -0
- package/dist/confidence.d.ts +19 -0
- package/dist/confidence.js +38 -0
- package/dist/confidence.js.map +1 -0
- package/dist/embeddings.d.ts +48 -0
- package/dist/embeddings.js +213 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/handlers/brain.d.ts +21 -0
- package/dist/handlers/brain.js +1322 -0
- package/dist/handlers/brain.js.map +1 -0
- package/dist/index.d.ts +1 -62
- package/dist/index.js +61 -5070
- package/dist/index.js.map +1 -1
- package/dist/search.d.ts +101 -0
- package/dist/search.js +1818 -0
- package/dist/search.js.map +1 -0
- package/dist/tools.d.ts +1955 -0
- package/dist/tools.js +1632 -0
- package/dist/tools.js.map +1 -0
- package/glama.json +6 -0
- package/package.json +1 -1
- package/src/__tests__/brain-flow.test.ts +608 -0
- package/src/ckg.ts +53 -0
- package/src/confidence.ts +38 -0
- package/src/embeddings.ts +217 -0
- package/src/handlers/brain.ts +1506 -0
- package/src/index.ts +41 -5262
- package/src/search.ts +1781 -0
- package/src/tools.ts +1723 -0
package/dist/tools.js
ADDED
|
@@ -0,0 +1,1632 @@
|
|
|
1
|
+
// ── Tool definitions (schema only, no handler logic) ─────────────────────────
|
|
2
|
+
// ── Tools ─────────────────────────────────────────────────────────────────────
|
|
3
|
+
const TOOLS = [
|
|
4
|
+
// ── Instance Management ──────────────────────────────────────────────────
|
|
5
|
+
{
|
|
6
|
+
name: 'list_instances',
|
|
7
|
+
description: 'List all your cachly cache instances with their status and connection details. ' +
|
|
8
|
+
'Read-only. Returns an array of instance objects — each with id, name, tier, status, region, RAM, ' +
|
|
9
|
+
'and redis:// connection string. Returns an empty array if no instances exist. ' +
|
|
10
|
+
'No pagination: all instances are returned in one call (typical accounts have < 20). ' +
|
|
11
|
+
'Use this first to discover instance UUIDs required by get_instance, cache_get, cache_set, ' +
|
|
12
|
+
'and all other cache tools. Use get_instance to retrieve full metadata for a single instance.',
|
|
13
|
+
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'create_instance',
|
|
17
|
+
description: 'Create a new managed Valkey/Redis cache instance on cachly.dev. ' +
|
|
18
|
+
'Free tier provisions in ~30 seconds. Paid tiers return a Stripe checkout URL. ' +
|
|
19
|
+
'Available tiers: free (25 MB), dev (200 MB, €19/mo), pro (900 MB, €49/mo), ' +
|
|
20
|
+
'speed (900 MB Dragonfly + Semantic Cache, €79/mo), business (7 GB, €199/mo).',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
name: { type: 'string', description: 'Unique name for the instance (min 3 chars)' },
|
|
25
|
+
tier: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
enum: ['free', 'dev', 'pro', 'speed', 'business'],
|
|
28
|
+
description: 'Pricing tier. Start with "free" for testing.',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
required: ['name', 'tier'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'get_instance',
|
|
36
|
+
description: 'Get full metadata for a specific cache instance: name, tier, status (provisioning / running / paused), ' +
|
|
37
|
+
'region, RAM limit, Redis connection string, created_at, and expiry. Read-only. ' +
|
|
38
|
+
'Returns an error if the instance_id is not found or belongs to another account. ' +
|
|
39
|
+
'Call list_instances first to discover valid UUIDs. ' +
|
|
40
|
+
'Use get_connection_string instead if you only need the redis:// URL for your app config.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
instance_id: { type: 'string', description: 'UUID of the instance (from list_instances)' },
|
|
45
|
+
},
|
|
46
|
+
required: ['instance_id'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'get_connection_string',
|
|
51
|
+
description: 'Get the Redis/Valkey connection string (redis:// URL) for a running instance. ' +
|
|
52
|
+
'Use this to configure your application or set environment variables.',
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
instance_id: { type: 'string', description: 'UUID of the instance' },
|
|
57
|
+
},
|
|
58
|
+
required: ['instance_id'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'delete_instance',
|
|
63
|
+
description: 'Permanently delete a cache instance. Deprovisions the Kubernetes workload and removes all data. ' +
|
|
64
|
+
'This action is irreversible.',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
instance_id: { type: 'string', description: 'UUID of the instance to delete' },
|
|
69
|
+
confirm: { type: 'boolean', description: 'Must be true to confirm deletion' },
|
|
70
|
+
},
|
|
71
|
+
required: ['instance_id', 'confirm'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// ── Live Cache Operations ────────────────────────────────────────────────
|
|
75
|
+
{
|
|
76
|
+
name: 'cache_get',
|
|
77
|
+
description: 'Get a value from a running cache instance by key. ' +
|
|
78
|
+
'Returns the stored value (string or deserialized JSON object) or null if the key does not exist or has expired. ' +
|
|
79
|
+
'Read-only — no side effects. ' +
|
|
80
|
+
'Use cache_mget when you need multiple keys in one round-trip. ' +
|
|
81
|
+
'Use cache_exists to check existence without retrieving the value. ' +
|
|
82
|
+
'Use semantic_search when you need fuzzy/vector search across stored values.',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: {
|
|
86
|
+
instance_id: { type: 'string', description: 'UUID of the instance' },
|
|
87
|
+
key: { type: 'string', description: 'Cache key to retrieve' },
|
|
88
|
+
},
|
|
89
|
+
required: ['instance_id', 'key'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'cache_set',
|
|
94
|
+
description: 'Set a key-value pair in a running cache instance. ' +
|
|
95
|
+
'Overwrites any existing value at the key — not idempotent for new data. ' +
|
|
96
|
+
'Returns "OK" on success; returns an error if the instance_id is invalid or the instance is paused. ' +
|
|
97
|
+
'Value can be a string or a JSON-serialized object. Optionally set a TTL in seconds (omit for no expiry). ' +
|
|
98
|
+
'Use cache_mset instead for setting multiple keys in a single pipeline round-trip. ' +
|
|
99
|
+
'Use cache_stream_set instead for caching LLM token streams (ordered string chunks).',
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
|
|
104
|
+
key: { type: 'string', description: 'Cache key' },
|
|
105
|
+
value: { type: 'string', description: 'Value to store (string or JSON)' },
|
|
106
|
+
ttl: { type: 'number', description: 'Time-to-live in seconds (optional, omit for no expiry)' },
|
|
107
|
+
},
|
|
108
|
+
required: ['instance_id', 'key', 'value'],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'cache_delete',
|
|
113
|
+
description: 'Permanently delete one or more keys from a running cache instance (uses Redis DEL). ' +
|
|
114
|
+
'This operation is destructive and irreversible — deleted keys cannot be recovered. ' +
|
|
115
|
+
'Deleting a non-existent key is safe and returns 0 for that key (no error). ' +
|
|
116
|
+
'Returns the count of keys that were actually deleted (existing keys only). ' +
|
|
117
|
+
'Use this to explicitly remove stale entries; prefer cache_set with a short TTL for auto-expiring data. ' +
|
|
118
|
+
'Do NOT use this to clear an entire instance — use the dashboard or delete_instance for that.',
|
|
119
|
+
inputSchema: {
|
|
120
|
+
type: 'object',
|
|
121
|
+
properties: {
|
|
122
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance to delete keys from (get from list_instances)' },
|
|
123
|
+
keys: {
|
|
124
|
+
type: 'array',
|
|
125
|
+
items: { type: 'string' },
|
|
126
|
+
description: 'One or more cache keys to delete. Accepts exact keys only (no glob patterns — use cache_keys to list first).',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
required: ['instance_id', 'keys'],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'cache_exists',
|
|
134
|
+
description: 'Check whether one or more keys exist in a running cache instance (uses Redis EXISTS). ' +
|
|
135
|
+
'Read-only — no side effects. Returns the count of keys that currently exist (integer 0 to N). ' +
|
|
136
|
+
'If none of the keys exist, returns 0. If all exist, returns the total key count passed in. ' +
|
|
137
|
+
'Duplicate keys in the input array are each counted separately (Redis behavior). ' +
|
|
138
|
+
'Use this to check presence before a cache_get to avoid null handling, or to verify a cache warm-up completed. ' +
|
|
139
|
+
'Use cache_get instead if you also need the value; use cache_ttl if you need expiry info.',
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance to check (get from list_instances)' },
|
|
144
|
+
keys: { type: 'array', items: { type: 'string' }, description: 'Keys to check for existence. Accepts exact keys only (no glob patterns).' },
|
|
145
|
+
},
|
|
146
|
+
required: ['instance_id', 'keys'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'cache_ttl',
|
|
151
|
+
description: 'Get the remaining time-to-live (TTL) of a key in seconds. ' +
|
|
152
|
+
'Returns -1 if the key exists but has no expiry, -2 if the key does not exist. ' +
|
|
153
|
+
'Read-only — no side effects. ' +
|
|
154
|
+
'Use cache_set with a ttl parameter to set or update the expiry.',
|
|
155
|
+
inputSchema: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
|
|
159
|
+
key: { type: 'string', description: 'Cache key to inspect' },
|
|
160
|
+
},
|
|
161
|
+
required: ['instance_id', 'key'],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'cache_keys',
|
|
166
|
+
description: 'List keys in a cache instance matching an optional glob pattern (e.g. "user:*", "session:*"). ' +
|
|
167
|
+
'Uses SCAN to avoid blocking the server. Returns at most `count` keys.',
|
|
168
|
+
inputSchema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
instance_id: { type: 'string' },
|
|
172
|
+
pattern: { type: 'string', description: 'Glob pattern (default: *)' },
|
|
173
|
+
count: { type: 'number', description: 'Max keys to return (default: 50, max: 500)' },
|
|
174
|
+
},
|
|
175
|
+
required: ['instance_id'],
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'cache_stats',
|
|
180
|
+
description: 'Get real-time stats for a cache instance: memory usage, hit/miss rate, commands/sec, ' +
|
|
181
|
+
'connected clients, keyspace info, and uptime. Read-only — no side effects. ' +
|
|
182
|
+
'The instance_id identifies the target instance (obtain from list_instances). ' +
|
|
183
|
+
'Use this for monitoring, capacity planning, or debugging performance issues — ' +
|
|
184
|
+
'not for reading cached values (use cache_get for that). ' +
|
|
185
|
+
'Use cache_exists or cache_ttl if you only need key-level information.',
|
|
186
|
+
inputSchema: {
|
|
187
|
+
type: 'object',
|
|
188
|
+
properties: {
|
|
189
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
|
|
190
|
+
},
|
|
191
|
+
required: ['instance_id'],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'semantic_search',
|
|
196
|
+
description: 'Find cached entries that are semantically similar to a natural-language query. ' +
|
|
197
|
+
'Read-only — no side effects. ' +
|
|
198
|
+
'Returns an array of objects, each with: key, value, similarity_score (0–1), and namespace. ' +
|
|
199
|
+
'Returns an empty array if no entries meet the similarity threshold. ' +
|
|
200
|
+
'Requires OPENAI_API_KEY (or compatible provider) and the Speed/Business tier with CACHLY_VECTOR_URL. ' +
|
|
201
|
+
'Embeddings are computed server-side and never leave Germany (pgvector HNSW index). ' +
|
|
202
|
+
'Example: "find all cached responses about password reset" or "what did we answer about pricing?". ' +
|
|
203
|
+
'Use cache_get for exact key lookup; use smart_recall for brain lessons.',
|
|
204
|
+
inputSchema: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
|
|
208
|
+
query: { type: 'string', description: 'Natural-language query to find similar cached content' },
|
|
209
|
+
threshold: {
|
|
210
|
+
type: 'number',
|
|
211
|
+
description: 'Minimum cosine similarity 0–1 (default: 0.82). Lower = broader matches.',
|
|
212
|
+
},
|
|
213
|
+
namespace: {
|
|
214
|
+
type: 'string',
|
|
215
|
+
description: 'Semantic namespace to search in (default: cachly:sem)',
|
|
216
|
+
},
|
|
217
|
+
top_k: {
|
|
218
|
+
type: 'number',
|
|
219
|
+
description: 'Maximum number of results to return (default: 5)',
|
|
220
|
+
},
|
|
221
|
+
use_hybrid: {
|
|
222
|
+
type: 'boolean',
|
|
223
|
+
description: 'Enable Hybrid BM25+Vector RRF fusion search. ' +
|
|
224
|
+
'Passes `hybrid: true` and the query text to the pgvector API for higher precision on named entities. ' +
|
|
225
|
+
'Default: false.',
|
|
226
|
+
},
|
|
227
|
+
auto_namespace: {
|
|
228
|
+
type: 'boolean',
|
|
229
|
+
description: 'Auto-detect the namespace from the query text using text heuristics ' +
|
|
230
|
+
'instead of using the `namespace` parameter. ' +
|
|
231
|
+
'Returns results only from the matching domain (code/translation/summary/qa/creative).',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
required: ['instance_id', 'query'],
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: 'detect_namespace',
|
|
239
|
+
description: 'Classify a prompt into one of 5 semantic namespaces using text heuristics. ' +
|
|
240
|
+
'Overhead: <0.1 ms, no embedding required. ' +
|
|
241
|
+
'Useful to understand which namespace cachly will use for a given prompt. ' +
|
|
242
|
+
'Returns one of: cachly:sem:code, cachly:sem:translation, cachly:sem:summary, ' +
|
|
243
|
+
'cachly:sem:qa, cachly:sem:creative.',
|
|
244
|
+
inputSchema: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
properties: {
|
|
247
|
+
prompt: { type: 'string', description: 'The text prompt to classify into a semantic namespace' },
|
|
248
|
+
},
|
|
249
|
+
required: ['prompt'],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'cache_warmup',
|
|
254
|
+
description: 'Pre-warm the semantic cache with a list of prompt/value pairs. ' +
|
|
255
|
+
'For each entry: computes an embedding, checks if a similar entry already exists ' +
|
|
256
|
+
'(similarity ≥ 0.98), and writes new entries to Valkey + pgvector index. ' +
|
|
257
|
+
'Use this to seed FAQ responses, product descriptions, or known-good LLM answers ' +
|
|
258
|
+
'before the first real user traffic. Requires OPENAI_API_KEY.',
|
|
259
|
+
inputSchema: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
263
|
+
entries: {
|
|
264
|
+
type: 'array',
|
|
265
|
+
description: 'List of prompt/value pairs to pre-warm into the cache',
|
|
266
|
+
items: {
|
|
267
|
+
type: 'object',
|
|
268
|
+
properties: {
|
|
269
|
+
prompt: { type: 'string', description: 'The query or question to cache' },
|
|
270
|
+
value: { type: 'string', description: 'The answer or response to store for this prompt' },
|
|
271
|
+
namespace: { type: 'string', description: 'Optional per-entry namespace override' },
|
|
272
|
+
},
|
|
273
|
+
required: ['prompt', 'value'],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
namespace: {
|
|
277
|
+
type: 'string',
|
|
278
|
+
description: 'Default namespace for all entries (default: cachly:sem)',
|
|
279
|
+
},
|
|
280
|
+
ttl: {
|
|
281
|
+
type: 'number',
|
|
282
|
+
description: 'Time-to-live in seconds for warmed entries (omit for no expiry)',
|
|
283
|
+
},
|
|
284
|
+
auto_namespace: {
|
|
285
|
+
type: 'boolean',
|
|
286
|
+
description: 'Auto-detect the namespace per prompt using text heuristics. ' +
|
|
287
|
+
'Overrides `namespace` when no per-entry namespace is set.',
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
required: ['instance_id', 'entries'],
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'index_project',
|
|
295
|
+
description: 'Index local source files into the cachly semantic cache so AI assistants can use ' +
|
|
296
|
+
'semantic_search to find relevant files instead of re-reading the whole codebase every time. ' +
|
|
297
|
+
'Walks a directory recursively, reads each matching file, and stores a summary + path ' +
|
|
298
|
+
'as a semantic cache entry (prompt = file path + content excerpt, value = relative path). ' +
|
|
299
|
+
'Requires an embedding provider (OPENAI_API_KEY or CACHLY_EMBED_PROVIDER + key). ' +
|
|
300
|
+
'Run once, then re-run after major refactors. TTL=86400 (24h) keeps entries fresh.',
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: 'object',
|
|
303
|
+
properties: {
|
|
304
|
+
instance_id: { type: 'string', description: 'UUID of the cachly instance' },
|
|
305
|
+
dir: {
|
|
306
|
+
type: 'string',
|
|
307
|
+
description: 'Absolute path to the directory to index (e.g. /Users/you/myproject/src)',
|
|
308
|
+
},
|
|
309
|
+
extensions: {
|
|
310
|
+
type: 'array',
|
|
311
|
+
items: { type: 'string' },
|
|
312
|
+
description: 'File extensions to include (default: ["ts","js","go","py","java","rs","md","kt","swift"])',
|
|
313
|
+
},
|
|
314
|
+
max_files: {
|
|
315
|
+
type: 'number',
|
|
316
|
+
description: 'Maximum number of files to index (default: 100)',
|
|
317
|
+
},
|
|
318
|
+
ttl: {
|
|
319
|
+
type: 'number',
|
|
320
|
+
description: 'TTL in seconds for indexed entries (default: 86400 = 24 h)',
|
|
321
|
+
},
|
|
322
|
+
summary_chars: {
|
|
323
|
+
type: 'number',
|
|
324
|
+
description: 'Characters to use as summary per file (default: 1200)',
|
|
325
|
+
},
|
|
326
|
+
namespace: {
|
|
327
|
+
type: 'string',
|
|
328
|
+
description: 'Semantic namespace to store under (default: cachly:sem:code)',
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
required: ['instance_id', 'dir'],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
// ── Bulk operations ──────────────────────────────────────────────────────
|
|
335
|
+
{
|
|
336
|
+
name: 'cache_mset',
|
|
337
|
+
description: 'Set multiple key-value pairs in a single pipeline round-trip. ' +
|
|
338
|
+
'Supports per-key TTL – unlike native MSET. ' +
|
|
339
|
+
'Uses one TCP round-trip for N keys via Redis pipeline. ' +
|
|
340
|
+
'Each item overwrites any existing value for that key. ' +
|
|
341
|
+
'On partial failure the successfully pipelined keys are committed; a per-key error list is returned for any that failed. ' +
|
|
342
|
+
'Returns a summary: { set: N, errors: [...] }. ' +
|
|
343
|
+
'Use cache_set for a single key; use cache_stream_set for large streaming payloads.',
|
|
344
|
+
inputSchema: {
|
|
345
|
+
type: 'object',
|
|
346
|
+
properties: {
|
|
347
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
348
|
+
items: {
|
|
349
|
+
type: 'array',
|
|
350
|
+
description: 'Key-value pairs to set',
|
|
351
|
+
items: {
|
|
352
|
+
type: 'object',
|
|
353
|
+
properties: {
|
|
354
|
+
key: { type: 'string', description: 'Cache key' },
|
|
355
|
+
value: { description: 'Value to store (JSON-serialised)' },
|
|
356
|
+
ttl: { type: 'number', description: 'Per-key TTL in seconds (optional)' },
|
|
357
|
+
},
|
|
358
|
+
required: ['key', 'value'],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
required: ['instance_id', 'items'],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
name: 'cache_mget',
|
|
367
|
+
description: 'Retrieve multiple keys in one round-trip using native Redis MGET. ' +
|
|
368
|
+
'Returns values in the same order as the keys array; missing keys are null.',
|
|
369
|
+
inputSchema: {
|
|
370
|
+
type: 'object',
|
|
371
|
+
properties: {
|
|
372
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
373
|
+
keys: { type: 'array', items: { type: 'string' }, description: 'List of keys to fetch' },
|
|
374
|
+
},
|
|
375
|
+
required: ['instance_id', 'keys'],
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
// ── Distributed lock ──────────────────────────────────────────────────────
|
|
379
|
+
{
|
|
380
|
+
name: 'cache_lock_acquire',
|
|
381
|
+
description: 'Acquire a distributed lock using Redis SET NX PX (Redlock-lite). ' +
|
|
382
|
+
'Returns a fencing token on success. The lock auto-expires after ttl_ms to prevent deadlocks. ' +
|
|
383
|
+
'Use cache_lock_release to free the lock early.',
|
|
384
|
+
inputSchema: {
|
|
385
|
+
type: 'object',
|
|
386
|
+
properties: {
|
|
387
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
388
|
+
key: { type: 'string', description: 'Lock resource identifier' },
|
|
389
|
+
ttl_ms: { type: 'number', description: 'Safety TTL in milliseconds (e.g. 5000)' },
|
|
390
|
+
retries: { type: 'number', description: 'Max acquire attempts (default: 3)' },
|
|
391
|
+
retry_delay_ms: { type: 'number', description: 'Milliseconds between retries (default: 50)' },
|
|
392
|
+
},
|
|
393
|
+
required: ['instance_id', 'key', 'ttl_ms'],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: 'cache_lock_release',
|
|
398
|
+
description: 'Release a previously acquired distributed lock. ' +
|
|
399
|
+
'Uses a Lua script for atomic release – only deletes the key if the fencing token matches.',
|
|
400
|
+
inputSchema: {
|
|
401
|
+
type: 'object',
|
|
402
|
+
properties: {
|
|
403
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
404
|
+
key: { type: 'string', description: 'Lock resource identifier (same as in cache_lock_acquire)' },
|
|
405
|
+
token: { type: 'string', description: 'Fencing token returned by cache_lock_acquire' },
|
|
406
|
+
},
|
|
407
|
+
required: ['instance_id', 'key', 'token'],
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
// ── Auth & API-Status ─────────────────────────────────────────────────────
|
|
411
|
+
{
|
|
412
|
+
name: 'get_api_status',
|
|
413
|
+
description: 'Check the cachly API health and your authentication status. ' +
|
|
414
|
+
'Returns whether the JWT is valid, your user ID (sub claim), ' +
|
|
415
|
+
'token expiry, and the auth provider (keycloak). ' +
|
|
416
|
+
'Use this to debug connection issues or verify your CACHLY_JWT is correct.',
|
|
417
|
+
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
418
|
+
},
|
|
419
|
+
// ── Thinking/Context Cache (for AI assistants) ────────────────────────────
|
|
420
|
+
{
|
|
421
|
+
name: 'remember_context',
|
|
422
|
+
description: 'Save context information to the cache so you can recall it later without re-computing. ' +
|
|
423
|
+
'Perfect for caching: codebase overviews, file summaries, project structure, ' +
|
|
424
|
+
'frequently-accessed data, or "thinking" results like dependency analysis. ' +
|
|
425
|
+
'The AI assistant can use this to avoid re-reading the entire codebase every time. ' +
|
|
426
|
+
'Overwrites any existing value stored under the same key. ' +
|
|
427
|
+
'Returns { key, stored_at, ttl } confirming the saved context. ' +
|
|
428
|
+
'Example: remember_context("project overview", "This is a Next.js app with...") ' +
|
|
429
|
+
'then later: recall_context("project overview"). ' +
|
|
430
|
+
'Use recall_context to retrieve; use list_remembered to see all stored keys.',
|
|
431
|
+
inputSchema: {
|
|
432
|
+
type: 'object',
|
|
433
|
+
properties: {
|
|
434
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
435
|
+
key: { type: 'string', description: 'Descriptive key like "project_overview", "auth_architecture", "file:src/index.ts"' },
|
|
436
|
+
content: { type: 'string', description: 'The context/summary/analysis to remember' },
|
|
437
|
+
category: {
|
|
438
|
+
type: 'string',
|
|
439
|
+
enum: ['overview', 'architecture', 'file_summary', 'dependency', 'thinking', 'custom'],
|
|
440
|
+
description: 'Category for organization (default: custom)',
|
|
441
|
+
},
|
|
442
|
+
ttl: { type: 'number', description: 'Time-to-live in seconds (default: 86400 = 24h, use 0 for no expiry)' },
|
|
443
|
+
},
|
|
444
|
+
required: ['instance_id', 'key', 'content'],
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: 'recall_context',
|
|
449
|
+
description: 'Retrieve previously saved context from the cache. ' +
|
|
450
|
+
'Returns the saved content or null if not found. ' +
|
|
451
|
+
'Use this at the START of any task to check if you already have relevant context cached, ' +
|
|
452
|
+
'before doing expensive operations like reading many files. ' +
|
|
453
|
+
'Supports glob patterns: "file:*" matches all file summaries, "arch*" matches architecture-related keys.',
|
|
454
|
+
inputSchema: {
|
|
455
|
+
type: 'object',
|
|
456
|
+
properties: {
|
|
457
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
458
|
+
key: { type: 'string', description: 'The key to look up (supports glob pattern like "file:*")' },
|
|
459
|
+
},
|
|
460
|
+
required: ['instance_id', 'key'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'list_remembered',
|
|
465
|
+
description: 'List all cached context entries for this project. ' +
|
|
466
|
+
'Shows what knowledge the AI assistant has already cached, so you can decide ' +
|
|
467
|
+
'whether to recall existing context or refresh it. ' +
|
|
468
|
+
'Returns: key, category, size, TTL remaining, and a content preview.',
|
|
469
|
+
inputSchema: {
|
|
470
|
+
type: 'object',
|
|
471
|
+
properties: {
|
|
472
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
473
|
+
category: {
|
|
474
|
+
type: 'string',
|
|
475
|
+
enum: ['overview', 'architecture', 'file_summary', 'dependency', 'thinking', 'custom', 'all'],
|
|
476
|
+
description: 'Filter by category (default: all)',
|
|
477
|
+
},
|
|
478
|
+
limit: { type: 'number', description: 'Max entries to return (default: 50)' },
|
|
479
|
+
},
|
|
480
|
+
required: ['instance_id'],
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: 'forget_context',
|
|
485
|
+
description: 'Delete one or more cached context entries. ' +
|
|
486
|
+
'Use when context is stale or you want to force a fresh analysis. ' +
|
|
487
|
+
'Supports glob patterns: "file:*" deletes all file summaries.',
|
|
488
|
+
inputSchema: {
|
|
489
|
+
type: 'object',
|
|
490
|
+
properties: {
|
|
491
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
492
|
+
keys: { type: 'array', items: { type: 'string' }, description: 'Keys to delete (supports glob)' },
|
|
493
|
+
},
|
|
494
|
+
required: ['instance_id', 'keys'],
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'learn_from_attempts',
|
|
499
|
+
description: 'Store a lesson learned from a failed or successful attempt. ' +
|
|
500
|
+
'Call this AFTER completing any non-trivial task (deploy, debug, fix, architecture decision). ' +
|
|
501
|
+
'The lesson will be recalled automatically in future sessions via recall_best_solution. ' +
|
|
502
|
+
'Fields: topic (short slug like "deploy:web"), outcome ("success"|"failure"), ' +
|
|
503
|
+
'what_worked (what solved it), what_failed (what did NOT work), context (extra details). ' +
|
|
504
|
+
'Supports structured metadata: severity, file_paths (files involved), commands (working commands), tags. ' +
|
|
505
|
+
'Deduplication: if a lesson for this topic already exists, it is updated with full audit trail. ' +
|
|
506
|
+
'Contradiction detection: warns if new outcome conflicts with existing lesson outcome. ' +
|
|
507
|
+
'Confidence: lesson starts at 1.0, decays after 5d (→0.7) and 10d (→0.5) without recall. ' +
|
|
508
|
+
'Example: learn_from_attempts(topic="deploy:api", outcome="success", what_worked="nohup docker compose up -d --build", what_failed="docker compose up hangs on SSH timeout", severity="critical", commands=["nohup docker compose up -d --build"])',
|
|
509
|
+
inputSchema: {
|
|
510
|
+
type: 'object',
|
|
511
|
+
properties: {
|
|
512
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
513
|
+
topic: { type: 'string', description: 'Short slug, e.g. "deploy:web", "debug:redis-tls", "fix:generate-series"' },
|
|
514
|
+
outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Did it work?' },
|
|
515
|
+
what_worked: { type: 'string', description: 'What solved the problem or what approach succeeded' },
|
|
516
|
+
what_failed: { type: 'string', description: 'What did NOT work (optional but valuable)' },
|
|
517
|
+
context: { type: 'string', description: 'Additional context, error messages, root cause (optional)' },
|
|
518
|
+
severity: {
|
|
519
|
+
type: 'string',
|
|
520
|
+
enum: ['critical', 'major', 'minor'],
|
|
521
|
+
description: 'Impact severity: critical (blocks work/deploy), major (significant slowdown), minor (nice to know). Default: major.',
|
|
522
|
+
},
|
|
523
|
+
file_paths: {
|
|
524
|
+
type: 'array',
|
|
525
|
+
items: { type: 'string' },
|
|
526
|
+
description: 'Files involved in this lesson (e.g. ["infra/deploy.sh", ".env"])',
|
|
527
|
+
},
|
|
528
|
+
commands: {
|
|
529
|
+
type: 'array',
|
|
530
|
+
items: { type: 'string' },
|
|
531
|
+
description: 'Commands that worked or failed (e.g. ["rsync -avz ...", "docker compose up -d"])',
|
|
532
|
+
},
|
|
533
|
+
tags: {
|
|
534
|
+
type: 'array',
|
|
535
|
+
items: { type: 'string' },
|
|
536
|
+
description: 'Topic tags for filtering (e.g. ["bash", "deploy", "env"])',
|
|
537
|
+
},
|
|
538
|
+
depends_on: {
|
|
539
|
+
type: 'array',
|
|
540
|
+
items: { type: 'string' },
|
|
541
|
+
description: 'Prerequisites this lesson depends on (e.g. ["node:>=20", "docker:running", "wireguard:active"]). When a dependency is marked stale, all dependent lessons get needs_review.',
|
|
542
|
+
},
|
|
543
|
+
author: {
|
|
544
|
+
type: 'string',
|
|
545
|
+
description: 'Name or handle of the person storing this lesson (e.g. "alice", "bob"). Used for Team Telepathy — teammates see each other\'s lessons in session_start.',
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
required: ['instance_id', 'topic', 'outcome', 'what_worked'],
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: 'recall_best_solution',
|
|
553
|
+
description: 'Recall the best known solution for a topic from past lessons. ' +
|
|
554
|
+
'Call this BEFORE attempting any task that might have been done before. ' +
|
|
555
|
+
'Returns the most recent successful lesson for the topic, with confidence indicator. ' +
|
|
556
|
+
'⚠️ badge = lesson is >5d old (verify before applying). 🔴 = >10d old (likely stale!). ' +
|
|
557
|
+
'Recalling a lesson resets its confidence clock to 1.0 (marks as recently verified). ' +
|
|
558
|
+
'Example: recall_best_solution(topic="deploy:web") → returns the working deploy command.',
|
|
559
|
+
inputSchema: {
|
|
560
|
+
type: 'object',
|
|
561
|
+
properties: {
|
|
562
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
563
|
+
topic: { type: 'string', description: 'Topic slug to look up, e.g. "deploy:web". Supports partial match.' },
|
|
564
|
+
},
|
|
565
|
+
required: ['instance_id', 'topic'],
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: 'smart_recall',
|
|
570
|
+
description: 'Semantically search cached context using natural language. ' +
|
|
571
|
+
'Instead of exact key matching, finds context by meaning. ' +
|
|
572
|
+
'Example: smart_recall("how does authentication work") → returns cached auth architecture summary. ' +
|
|
573
|
+
'Falls back to remember_context keys if no semantic match is found.',
|
|
574
|
+
inputSchema: {
|
|
575
|
+
type: 'object',
|
|
576
|
+
properties: {
|
|
577
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
578
|
+
query: { type: 'string', description: 'Natural language query to find relevant cached context' },
|
|
579
|
+
threshold: { type: 'number', description: 'Similarity threshold 0-1 (default: 0.78)' },
|
|
580
|
+
},
|
|
581
|
+
required: ['instance_id', 'query'],
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'session_start',
|
|
586
|
+
description: 'Single-call session briefing. Call this at the START of every session INSTEAD of multiple separate smart_recall/recall_best_solution calls. ' +
|
|
587
|
+
'Returns: last session summary, recent lessons sorted by recency, relevant lessons for your focus area, ' +
|
|
588
|
+
'open failures (topics with only failure outcomes), brain health stats, team telepathy (what teammates learned this week), ' +
|
|
589
|
+
'predictive pre-warnings (if your focus area has known failure patterns), and memory crystals (compressed wisdom from old sessions). ' +
|
|
590
|
+
'Also saves a session start marker so session_end can compute duration.',
|
|
591
|
+
inputSchema: {
|
|
592
|
+
type: 'object',
|
|
593
|
+
properties: {
|
|
594
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
595
|
+
focus: {
|
|
596
|
+
type: 'string',
|
|
597
|
+
description: 'Keywords for what you plan to work on today (e.g. "deploy infra api"). Used to surface relevant lessons at the top.',
|
|
598
|
+
},
|
|
599
|
+
author: {
|
|
600
|
+
type: 'string',
|
|
601
|
+
description: 'Your name or handle (e.g. "alice"). Enables Team Telepathy — filters YOUR lessons vs TEAM lessons from past 7 days.',
|
|
602
|
+
},
|
|
603
|
+
provider: {
|
|
604
|
+
type: 'string',
|
|
605
|
+
description: 'Current AI provider (e.g. "claude-code", "copilot", "cursor", "windsurf"). Shown in the briefing header and saved so the next provider can see who was last active.',
|
|
606
|
+
},
|
|
607
|
+
workspace_path: {
|
|
608
|
+
type: 'string',
|
|
609
|
+
description: 'Absolute path to the project root. If no session_end was found (e.g. context limit hit), reads git log to reconstruct what happened since last session.',
|
|
610
|
+
},
|
|
611
|
+
},
|
|
612
|
+
required: ['instance_id'],
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: 'session_end',
|
|
617
|
+
description: 'Save a session summary when you finish working. ' +
|
|
618
|
+
'Records what was accomplished, files changed, and lesson count. ' +
|
|
619
|
+
'The next session_start will show this summary as "Last session". ' +
|
|
620
|
+
'Call this when ending a work session, before going idle, or before summarizing. ' +
|
|
621
|
+
'Ambient Learning: if workspace_path is provided, reads git log since session start and auto-learns from commits.',
|
|
622
|
+
inputSchema: {
|
|
623
|
+
type: 'object',
|
|
624
|
+
properties: {
|
|
625
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
626
|
+
summary: {
|
|
627
|
+
type: 'string',
|
|
628
|
+
description: 'Brief summary of what was accomplished this session (2-3 sentences)',
|
|
629
|
+
},
|
|
630
|
+
files_changed: {
|
|
631
|
+
type: 'array',
|
|
632
|
+
items: { type: 'string' },
|
|
633
|
+
description: 'Key files changed this session (optional)',
|
|
634
|
+
},
|
|
635
|
+
lessons_learned: {
|
|
636
|
+
type: 'number',
|
|
637
|
+
description: 'Number of new lessons stored this session (optional)',
|
|
638
|
+
},
|
|
639
|
+
workspace_path: {
|
|
640
|
+
type: 'string',
|
|
641
|
+
description: 'Absolute path to the project root (e.g. "/Users/you/myproject"). Enables Ambient Learning — reads git log since session start and auto-learns from commit messages.',
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
required: ['instance_id', 'summary'],
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
// ── Session Handoff — cross-window continuity ─────────────────────────────
|
|
648
|
+
{
|
|
649
|
+
name: 'session_handoff',
|
|
650
|
+
description: 'Save a detailed handoff for the NEXT chat window / session. ' +
|
|
651
|
+
'Stores: current progress, TODO list (done + remaining), changed files with descriptions, ' +
|
|
652
|
+
'instructions for the next assistant, and any incomplete work. ' +
|
|
653
|
+
'The next session_start automatically includes this handoff so the new window knows EXACTLY what happened and what remains. ' +
|
|
654
|
+
'Call this BEFORE closing a chat window, especially if work is incomplete. ' +
|
|
655
|
+
'This prevents the "continue" problem where new windows lose context, skip tasks, or produce broken code.',
|
|
656
|
+
inputSchema: {
|
|
657
|
+
type: 'object',
|
|
658
|
+
properties: {
|
|
659
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
660
|
+
completed_tasks: {
|
|
661
|
+
type: 'array',
|
|
662
|
+
items: { type: 'string' },
|
|
663
|
+
description: 'Tasks that were fully completed (e.g. "Implemented brainSearch() in JS SDK")',
|
|
664
|
+
},
|
|
665
|
+
remaining_tasks: {
|
|
666
|
+
type: 'array',
|
|
667
|
+
items: { type: 'string' },
|
|
668
|
+
description: 'Tasks NOT yet done — the next window MUST pick these up',
|
|
669
|
+
},
|
|
670
|
+
files_changed: {
|
|
671
|
+
type: 'array',
|
|
672
|
+
items: {
|
|
673
|
+
type: 'object',
|
|
674
|
+
properties: {
|
|
675
|
+
path: { type: 'string', description: 'File path relative to project root' },
|
|
676
|
+
status: { type: 'string', enum: ['complete', 'partial', 'broken'], description: 'State of this file' },
|
|
677
|
+
description: { type: 'string', description: 'What was changed and what still needs work' },
|
|
678
|
+
},
|
|
679
|
+
required: ['path', 'status'],
|
|
680
|
+
},
|
|
681
|
+
description: 'Changed files with their current state — marks partial/broken files so next window knows to fix them',
|
|
682
|
+
},
|
|
683
|
+
instructions: {
|
|
684
|
+
type: 'string',
|
|
685
|
+
description: 'Free-form instructions for the next assistant. Be specific: what to do next, what to avoid, what broke.',
|
|
686
|
+
},
|
|
687
|
+
context_summary: {
|
|
688
|
+
type: 'string',
|
|
689
|
+
description: 'Brief summary of what happened this session (architecture decisions, key findings, blockers)',
|
|
690
|
+
},
|
|
691
|
+
blocked_on: {
|
|
692
|
+
type: 'string',
|
|
693
|
+
description: 'If work is blocked, describe what is needed to unblock (e.g. "waiting for API deploy", "needs user input on design")',
|
|
694
|
+
},
|
|
695
|
+
},
|
|
696
|
+
required: ['instance_id', 'completed_tasks', 'remaining_tasks'],
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
// ── session_ping — lightweight in-session checkpoint ─────────────────────
|
|
700
|
+
{
|
|
701
|
+
name: 'session_ping',
|
|
702
|
+
description: 'Lightweight checkpoint — call this every ~5 tool calls or whenever you complete a significant step. ' +
|
|
703
|
+
'Stores the current task + files touched so session_start on the NEXT provider can reconstruct what happened ' +
|
|
704
|
+
'even if session_end was never called (e.g. Claude context limit hit, window crashed). ' +
|
|
705
|
+
'This solves the provider-switching problem: Claude → Copilot → Cursor all see the same last checkpoint. ' +
|
|
706
|
+
'Extremely fast — one Redis SET, no blocking operations.',
|
|
707
|
+
inputSchema: {
|
|
708
|
+
type: 'object',
|
|
709
|
+
properties: {
|
|
710
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
711
|
+
task: {
|
|
712
|
+
type: 'string',
|
|
713
|
+
description: 'What you are currently working on (e.g. "Implementing invite handler in handler/invite.go")',
|
|
714
|
+
},
|
|
715
|
+
files_touched: {
|
|
716
|
+
type: 'array',
|
|
717
|
+
items: { type: 'string' },
|
|
718
|
+
description: 'Files modified so far this session',
|
|
719
|
+
},
|
|
720
|
+
next_step: {
|
|
721
|
+
type: 'string',
|
|
722
|
+
description: 'What the NEXT step is after this checkpoint (helps next provider resume immediately)',
|
|
723
|
+
},
|
|
724
|
+
provider: {
|
|
725
|
+
type: 'string',
|
|
726
|
+
description: 'Current AI provider (e.g. "claude-code", "copilot", "cursor", "windsurf")',
|
|
727
|
+
},
|
|
728
|
+
},
|
|
729
|
+
required: ['instance_id', 'task'],
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
// ── AI Brain — Extended features ─────────────────────────────────────────
|
|
733
|
+
{
|
|
734
|
+
name: 'auto_learn_session',
|
|
735
|
+
description: 'Auto-learn from a list of session observations WITHOUT explicit learn_from_attempts calls. ' +
|
|
736
|
+
'Pass what happened (commands run, errors seen, solutions found) and the brain classifies and stores lessons automatically. ' +
|
|
737
|
+
'Use at session_end to capture everything you did, even if you forgot to call learn_from_attempts. ' +
|
|
738
|
+
'Returns a summary of what was auto-stored.',
|
|
739
|
+
inputSchema: {
|
|
740
|
+
type: 'object',
|
|
741
|
+
properties: {
|
|
742
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
743
|
+
observations: {
|
|
744
|
+
type: 'array',
|
|
745
|
+
description: 'List of observations from this session',
|
|
746
|
+
items: {
|
|
747
|
+
type: 'object',
|
|
748
|
+
properties: {
|
|
749
|
+
action: { type: 'string', description: 'What was tried (command, approach, code change)' },
|
|
750
|
+
outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Result' },
|
|
751
|
+
details: { type: 'string', description: 'Error message, output, or explanation' },
|
|
752
|
+
topic: { type: 'string', description: 'Optional topic key (auto-generated if omitted)' },
|
|
753
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity (default: minor)' },
|
|
754
|
+
},
|
|
755
|
+
required: ['action', 'outcome'],
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
required: ['instance_id', 'observations'],
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: 'sync_file_changes',
|
|
764
|
+
description: 'Associate recent file changes with brain knowledge. ' +
|
|
765
|
+
'Pass a list of changed file paths (from `git diff --stat`). ' +
|
|
766
|
+
'Returns lessons relevant to those files, and records the file changes in session history. ' +
|
|
767
|
+
'Call this after commits so the brain tracks what changed and why.',
|
|
768
|
+
inputSchema: {
|
|
769
|
+
type: 'object',
|
|
770
|
+
properties: {
|
|
771
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
772
|
+
changed_files: { type: 'array', items: { type: 'string' }, description: 'List of changed file paths' },
|
|
773
|
+
git_diff_stat: { type: 'string', description: 'Output of `git diff --stat` (optional)' },
|
|
774
|
+
commit_msg: { type: 'string', description: 'Commit message (optional)' },
|
|
775
|
+
},
|
|
776
|
+
required: ['instance_id', 'changed_files'],
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
name: 'team_learn',
|
|
781
|
+
description: 'Store a lesson in a shared team brain so all team members benefit. ' +
|
|
782
|
+
'Like learn_from_attempts, but REQUIRES an author name for attribution. ' +
|
|
783
|
+
'Shows up in team_recall with "by <author>" so the team knows who learned it.',
|
|
784
|
+
inputSchema: {
|
|
785
|
+
type: 'object',
|
|
786
|
+
properties: {
|
|
787
|
+
instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
|
|
788
|
+
author: { type: 'string', description: 'Your name or handle (required for team attribution)' },
|
|
789
|
+
topic: { type: 'string', description: 'Topic in category:keyword format (e.g. "deploy:api")' },
|
|
790
|
+
outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'What happened' },
|
|
791
|
+
what_worked: { type: 'string', description: 'What worked (the solution)' },
|
|
792
|
+
what_failed: { type: 'string', description: 'What did NOT work (avoid this)' },
|
|
793
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Impact level' },
|
|
794
|
+
file_paths: { type: 'array', items: { type: 'string' }, description: 'Relevant file paths' },
|
|
795
|
+
commands: { type: 'array', items: { type: 'string' }, description: 'Commands that worked' },
|
|
796
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Tags for categorization' },
|
|
797
|
+
},
|
|
798
|
+
required: ['instance_id', 'author', 'topic', 'outcome', 'what_worked'],
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: 'team_recall',
|
|
803
|
+
description: 'Recall lessons from a shared team brain, showing who learned what. ' +
|
|
804
|
+
'Works on any shared instance (all team members using the same instance_id). ' +
|
|
805
|
+
'Shows author, recency, and severity for each lesson. ' +
|
|
806
|
+
'Use this to onboard new team members or find who knows about a topic.',
|
|
807
|
+
inputSchema: {
|
|
808
|
+
type: 'object',
|
|
809
|
+
properties: {
|
|
810
|
+
instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
|
|
811
|
+
topic: { type: 'string', description: 'Topic or keyword to filter lessons (optional)' },
|
|
812
|
+
author: { type: 'string', description: 'Filter by author name (optional)' },
|
|
813
|
+
limit: { type: 'number', description: 'Max lessons to return (default: 10)' },
|
|
814
|
+
},
|
|
815
|
+
required: ['instance_id'],
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: 'team_synthesize',
|
|
820
|
+
description: 'Team Brain Synthesis — merge multiple contributors\' lessons on the same topic into one canonical version. ' +
|
|
821
|
+
'When 2+ developers store lessons for the same topic with different details, this proposes the best merged version. ' +
|
|
822
|
+
'Shows: all contributions by author, what worked (consensus), what failed (union), canonical lesson to store. ' +
|
|
823
|
+
'Use this when onboarding new team members or before documenting a process.',
|
|
824
|
+
inputSchema: {
|
|
825
|
+
type: 'object',
|
|
826
|
+
properties: {
|
|
827
|
+
instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
|
|
828
|
+
topic: { type: 'string', description: 'Topic slug to synthesize (e.g. "deploy:api")' },
|
|
829
|
+
},
|
|
830
|
+
required: ['instance_id', 'topic'],
|
|
831
|
+
},
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
name: 'memory_crystalize',
|
|
835
|
+
description: 'Compress the last 30-50 sessions and auto-learned lessons into a dense Memory Crystal. ' +
|
|
836
|
+
'A crystal is a compact, structured summary of everything the brain learned — grouped by category (deploy, fix, debug, …). ' +
|
|
837
|
+
'Crystals survive session cleanup and appear in session_start once enough sessions have accumulated. ' +
|
|
838
|
+
'Run this monthly or after a big milestone to preserve institutional knowledge. ' +
|
|
839
|
+
'Returns a digest of what was crystallized.',
|
|
840
|
+
inputSchema: {
|
|
841
|
+
type: 'object',
|
|
842
|
+
properties: {
|
|
843
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
844
|
+
label: {
|
|
845
|
+
type: 'string',
|
|
846
|
+
description: 'Optional label for this crystal (e.g. "Q1 2026", "v2 launch"). Auto-generated from date if omitted.',
|
|
847
|
+
},
|
|
848
|
+
},
|
|
849
|
+
required: ['instance_id'],
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
// ── Roadmap — Persistent project plan tracker ───────────────────────────
|
|
853
|
+
{
|
|
854
|
+
name: 'roadmap_add',
|
|
855
|
+
description: 'Add a new item to the persistent project roadmap stored in the Brain. ' +
|
|
856
|
+
'Items survive across sessions and editors — the roadmap is always up to date. ' +
|
|
857
|
+
'Use for features, bugs, refactors, or any planned work. ' +
|
|
858
|
+
'Call roadmap_list to see all open items, roadmap_next to get the next actionable item.',
|
|
859
|
+
inputSchema: {
|
|
860
|
+
type: 'object',
|
|
861
|
+
properties: {
|
|
862
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
863
|
+
title: { type: 'string', description: 'Short title of the task/feature (3–10 words)' },
|
|
864
|
+
description: { type: 'string', description: 'What needs to be done, acceptance criteria, context' },
|
|
865
|
+
priority: {
|
|
866
|
+
type: 'string',
|
|
867
|
+
enum: ['critical', 'high', 'medium', 'low'],
|
|
868
|
+
description: 'Priority level (default: medium)',
|
|
869
|
+
},
|
|
870
|
+
tags: {
|
|
871
|
+
type: 'array',
|
|
872
|
+
items: { type: 'string' },
|
|
873
|
+
description: 'Tags for filtering (e.g. ["api", "web", "sdk", "infra"])',
|
|
874
|
+
},
|
|
875
|
+
milestone: { type: 'string', description: 'Milestone/epic this belongs to (optional)' },
|
|
876
|
+
},
|
|
877
|
+
required: ['instance_id', 'title'],
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
name: 'roadmap_update',
|
|
882
|
+
description: 'Update the status, priority, or details of a roadmap item. ' +
|
|
883
|
+
'Use to move items through the lifecycle: planned → in-progress → done (or blocked/cancelled). ' +
|
|
884
|
+
'Also use to add notes/findings while working on an item.',
|
|
885
|
+
inputSchema: {
|
|
886
|
+
type: 'object',
|
|
887
|
+
properties: {
|
|
888
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
889
|
+
id: { type: 'string', description: 'Item ID returned by roadmap_add or roadmap_list' },
|
|
890
|
+
status: {
|
|
891
|
+
type: 'string',
|
|
892
|
+
enum: ['planned', 'in-progress', 'done', 'blocked', 'cancelled'],
|
|
893
|
+
description: 'New status for the item',
|
|
894
|
+
},
|
|
895
|
+
priority: {
|
|
896
|
+
type: 'string',
|
|
897
|
+
enum: ['critical', 'high', 'medium', 'low'],
|
|
898
|
+
description: 'Updated priority (optional)',
|
|
899
|
+
},
|
|
900
|
+
notes: { type: 'string', description: 'Progress notes, findings, or blockers (appended to existing notes)' },
|
|
901
|
+
title: { type: 'string', description: 'Updated title (optional)' },
|
|
902
|
+
description: { type: 'string', description: 'Updated description (optional)' },
|
|
903
|
+
},
|
|
904
|
+
required: ['instance_id', 'id'],
|
|
905
|
+
},
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
name: 'roadmap_list',
|
|
909
|
+
description: 'List all roadmap items, optionally filtered by status, priority, tag, or milestone. ' +
|
|
910
|
+
'Returns items sorted by priority then creation date. ' +
|
|
911
|
+
'Called automatically by session_start to show open work.',
|
|
912
|
+
inputSchema: {
|
|
913
|
+
type: 'object',
|
|
914
|
+
properties: {
|
|
915
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
916
|
+
status: {
|
|
917
|
+
type: 'string',
|
|
918
|
+
enum: ['planned', 'in-progress', 'done', 'blocked', 'cancelled', 'open'],
|
|
919
|
+
description: 'Filter by status. Use \'open\' to see planned+in-progress+blocked (default: open)',
|
|
920
|
+
},
|
|
921
|
+
tag: { type: 'string', description: 'Filter by tag (optional)' },
|
|
922
|
+
milestone: { type: 'string', description: 'Filter by milestone (optional)' },
|
|
923
|
+
priority: {
|
|
924
|
+
type: 'string',
|
|
925
|
+
enum: ['critical', 'high', 'medium', 'low'],
|
|
926
|
+
description: 'Filter by minimum priority (optional)',
|
|
927
|
+
},
|
|
928
|
+
},
|
|
929
|
+
required: ['instance_id'],
|
|
930
|
+
},
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: 'roadmap_next',
|
|
934
|
+
description: 'Get the single most important next actionable roadmap item. ' +
|
|
935
|
+
'Returns the highest-priority in-progress item first, then planned items, sorted by priority. ' +
|
|
936
|
+
'Call at session start to immediately know what to work on next.',
|
|
937
|
+
inputSchema: {
|
|
938
|
+
type: 'object',
|
|
939
|
+
properties: {
|
|
940
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
941
|
+
tag: { type: 'string', description: 'Filter by tag (optional)' },
|
|
942
|
+
},
|
|
943
|
+
required: ['instance_id'],
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: 'brain_doctor',
|
|
948
|
+
description: 'Check the health of your AI Brain and get actionable recommendations. ' +
|
|
949
|
+
'Reports: lesson count, context entries, last session age, open failures, quality score, effective IQ boost, stale index. ' +
|
|
950
|
+
'Returns a prioritized list of issues with fix instructions.',
|
|
951
|
+
inputSchema: {
|
|
952
|
+
type: 'object',
|
|
953
|
+
properties: {
|
|
954
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
955
|
+
workspace_path: {
|
|
956
|
+
type: 'string',
|
|
957
|
+
description: 'Absolute path to workspace root — enables package.json analysis for openclaw cross-promo (optional)',
|
|
958
|
+
},
|
|
959
|
+
},
|
|
960
|
+
required: ['instance_id'],
|
|
961
|
+
},
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
name: 'global_learn',
|
|
965
|
+
description: 'Store a lesson that applies across ALL your projects (cross-project knowledge). ' +
|
|
966
|
+
'Idempotent: if a lesson with the same topic already exists, it is updated in place — no duplicates are created. ' +
|
|
967
|
+
'Returns a confirmation with the stored lesson key. No rate limits. ' +
|
|
968
|
+
'Global lessons are stored with the prefix cachly:global:lesson: and recalled from any instance via global_recall. ' +
|
|
969
|
+
'Use for tool preferences, personal workflows, platform quirks, and universal gotchas. ' +
|
|
970
|
+
'Example: global_learn(topic="bash:macos-arrays", lesson="Arrays work differently on macOS bash 3.2"). ' +
|
|
971
|
+
'Use learn_from_attempts for project-specific session lessons; use team_learn to share lessons with your team.',
|
|
972
|
+
inputSchema: {
|
|
973
|
+
type: 'object',
|
|
974
|
+
properties: {
|
|
975
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (used for connection)' },
|
|
976
|
+
topic: { type: 'string', description: 'Topic key in format "category:keyword"' },
|
|
977
|
+
lesson: { type: 'string', description: 'The lesson content' },
|
|
978
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity (default: minor)' },
|
|
979
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags' },
|
|
980
|
+
},
|
|
981
|
+
required: ['instance_id', 'topic', 'lesson'],
|
|
982
|
+
},
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
name: 'global_recall',
|
|
986
|
+
description: 'Read-only retrieval of cross-project lessons stored via global_learn. No side effects. ' +
|
|
987
|
+
'Returns a list of matching global lesson objects, each with topic, lesson text, severity, and tags. ' +
|
|
988
|
+
'If no topic is provided, returns all global lessons (up to 50). ' +
|
|
989
|
+
'If topic is provided, returns all lessons whose topic key contains that string (partial match). ' +
|
|
990
|
+
'Use this for lessons that apply universally across all projects (tool quirks, shell gotchas, platform behavior). ' +
|
|
991
|
+
'Use recall_best_solution instead for project-specific lessons; use team_recall for org-scoped lessons.',
|
|
992
|
+
inputSchema: {
|
|
993
|
+
type: 'object',
|
|
994
|
+
properties: {
|
|
995
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance (used for connection)' },
|
|
996
|
+
topic: { type: 'string', description: 'Topic or keyword filter (optional)' },
|
|
997
|
+
},
|
|
998
|
+
required: ['instance_id'],
|
|
999
|
+
},
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
name: 'publish_lesson',
|
|
1003
|
+
description: 'Publish a lesson to the Cachly Public Brain (anonymized community knowledge base). ' +
|
|
1004
|
+
'Published lessons can be imported by other developers via import_public_brain. ' +
|
|
1005
|
+
'PII is stripped automatically. Visible under the framework/category tag. ' +
|
|
1006
|
+
'Returns { lesson_id, topic, framework, published_at } confirming the publish. ' +
|
|
1007
|
+
'Irreversible — once published to the public brain, lessons cannot be deleted via the MCP interface. ' +
|
|
1008
|
+
'Use learn_from_attempts or global_learn for private lessons; ' +
|
|
1009
|
+
'use syndicate for anonymized global sharing without framework tagging.',
|
|
1010
|
+
inputSchema: {
|
|
1011
|
+
type: 'object',
|
|
1012
|
+
properties: {
|
|
1013
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1014
|
+
topic: { type: 'string', description: 'Topic key (used as public category)' },
|
|
1015
|
+
lesson: { type: 'string', description: 'Lesson to publish (PII will be stripped)' },
|
|
1016
|
+
framework: { type: 'string', description: 'Framework/platform tag (nextjs, fastapi, go, docker, etc.)' },
|
|
1017
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity' },
|
|
1018
|
+
},
|
|
1019
|
+
required: ['instance_id', 'topic', 'lesson'],
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: 'import_public_brain',
|
|
1024
|
+
description: 'Import community lessons from the Cachly Public Brain for a framework. ' +
|
|
1025
|
+
'Non-destructive: existing lessons with the same topic key are not overwritten. ' +
|
|
1026
|
+
'Returns the count of lessons imported and their topic slugs. ' +
|
|
1027
|
+
'Available frameworks: nextjs, fastapi, go, docker, kubernetes, react, typescript, python, rust, laravel, rails, spring. ' +
|
|
1028
|
+
'Use this to bootstrap a new brain with battle-tested community knowledge before your first session_start. ' +
|
|
1029
|
+
'Use publish_lesson to contribute your own lessons to the Public Brain; ' +
|
|
1030
|
+
'use learn_from_attempts for storing lessons from your own sessions.',
|
|
1031
|
+
inputSchema: {
|
|
1032
|
+
type: 'object',
|
|
1033
|
+
properties: {
|
|
1034
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance to import into' },
|
|
1035
|
+
framework: { type: 'string', description: 'Framework/platform to import lessons for' },
|
|
1036
|
+
limit: { type: 'number', description: 'Max lessons to import (default: 20)' },
|
|
1037
|
+
},
|
|
1038
|
+
required: ['instance_id', 'framework'],
|
|
1039
|
+
},
|
|
1040
|
+
},
|
|
1041
|
+
// ── Brain Archaeology + Causal Chain ────────────────────────────────────
|
|
1042
|
+
{
|
|
1043
|
+
name: 'recall_at',
|
|
1044
|
+
description: 'Brain Archaeology — see what a lesson looked like at a specific point in time. ' +
|
|
1045
|
+
'"What did we know about deployments 3 months ago?" ' +
|
|
1046
|
+
'Returns the history of a topic filtered to entries before the given date. ' +
|
|
1047
|
+
'Shows how the lesson evolved: failure → partial → success. ' +
|
|
1048
|
+
'Also useful to understand WHY old code decisions were made.',
|
|
1049
|
+
inputSchema: {
|
|
1050
|
+
type: 'object',
|
|
1051
|
+
properties: {
|
|
1052
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1053
|
+
topic: { type: 'string', description: 'Topic slug to look up, e.g. "deploy:api"' },
|
|
1054
|
+
date: { type: 'string', description: 'ISO date string (e.g. "2026-01-15") — returns entries stored BEFORE this date' },
|
|
1055
|
+
},
|
|
1056
|
+
required: ['instance_id', 'topic', 'date'],
|
|
1057
|
+
},
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
name: 'trace_dependency',
|
|
1061
|
+
description: 'Causal Chain — find all lessons that depend on a given prerequisite. ' +
|
|
1062
|
+
'"What lessons are affected if node version changes?" ' +
|
|
1063
|
+
'When a dependency changes (new version, different provider, new OS), call this to see which lessons need review. ' +
|
|
1064
|
+
'Lessons store dependencies via the depends_on field in learn_from_attempts.',
|
|
1065
|
+
inputSchema: {
|
|
1066
|
+
type: 'object',
|
|
1067
|
+
properties: {
|
|
1068
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1069
|
+
dependency: { type: 'string', description: 'Dependency to trace (e.g. "node:>=20", "docker:running", "wireguard:active")' },
|
|
1070
|
+
mark_review: { type: 'boolean', description: 'If true, marks all dependent lessons as needs_review (default: false)' },
|
|
1071
|
+
},
|
|
1072
|
+
required: ['instance_id', 'dependency'],
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1075
|
+
// ── Team / Org Management ────────────────────────────────────────────────
|
|
1076
|
+
{
|
|
1077
|
+
name: 'list_orgs',
|
|
1078
|
+
description: 'List your Cachly organizations (team/org plans). ' +
|
|
1079
|
+
'Returns each org with plan, seat count, and member info. ' +
|
|
1080
|
+
'Org plans (Team €99, Business €299, Enterprise custom) are billed separately from cache tiers.',
|
|
1081
|
+
inputSchema: {
|
|
1082
|
+
type: 'object',
|
|
1083
|
+
properties: {},
|
|
1084
|
+
required: [],
|
|
1085
|
+
},
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
name: 'create_org',
|
|
1089
|
+
description: 'Create a new Cachly organization for team collaboration. ' +
|
|
1090
|
+
'After creation, invite team members with invite_member and upgrade the plan via the billing portal. ' +
|
|
1091
|
+
'Org plans: Team (€99/mo, 10 seats), Business (€299/mo, 50 seats), Enterprise (custom).',
|
|
1092
|
+
inputSchema: {
|
|
1093
|
+
type: 'object',
|
|
1094
|
+
properties: {
|
|
1095
|
+
name: { type: 'string', description: 'Organization display name (e.g. "Acme Engineering")' },
|
|
1096
|
+
slug: { type: 'string', description: 'URL-safe slug (e.g. "acme-eng"). Auto-generated from name if omitted.' },
|
|
1097
|
+
},
|
|
1098
|
+
required: ['name'],
|
|
1099
|
+
},
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
name: 'invite_member',
|
|
1103
|
+
description: 'Invite a team member to a Cachly organization by email. ' +
|
|
1104
|
+
'They will receive an invite email and can join via the dashboard. ' +
|
|
1105
|
+
'Roles: owner (full access), admin (manage members + instances), member (read + cache ops).',
|
|
1106
|
+
inputSchema: {
|
|
1107
|
+
type: 'object',
|
|
1108
|
+
properties: {
|
|
1109
|
+
org_id: { type: 'string', description: 'UUID of the organization' },
|
|
1110
|
+
email: { type: 'string', description: 'Email address to invite' },
|
|
1111
|
+
role: { type: 'string', enum: ['admin', 'member'], description: 'Role for the invited member (default: member)' },
|
|
1112
|
+
},
|
|
1113
|
+
required: ['org_id', 'email'],
|
|
1114
|
+
},
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
name: 'get_org_plan',
|
|
1118
|
+
description: 'Get the current org plan, seat usage, and billing info for an organization. ' +
|
|
1119
|
+
'Shows: plan name, price, seats used/max, next billing date. ' +
|
|
1120
|
+
'To upgrade: use the billing portal URL returned by this tool.',
|
|
1121
|
+
inputSchema: {
|
|
1122
|
+
type: 'object',
|
|
1123
|
+
properties: {
|
|
1124
|
+
org_id: { type: 'string', description: 'UUID of the organization' },
|
|
1125
|
+
},
|
|
1126
|
+
required: ['org_id'],
|
|
1127
|
+
},
|
|
1128
|
+
},
|
|
1129
|
+
// ── Legacy / Setup ────────────────────────────────────────────────────────
|
|
1130
|
+
{
|
|
1131
|
+
name: 'setup_ai_memory',
|
|
1132
|
+
description: 'One-shot setup of the cachly 3-layer AI Memory system for a project.\n\n' +
|
|
1133
|
+
'Layer 1 — Storage: your cachly instance (Valkey, persistent across sessions)\n' +
|
|
1134
|
+
'Layer 2 — Tools: learn_from_attempts + recall_best_solution + smart_recall (the memory API)\n' +
|
|
1135
|
+
'Layer 3 — Autopilot: generates a copilot-instructions.md / .github/copilot-instructions.md\n' +
|
|
1136
|
+
' that instructs any MCP-compatible AI to recall known solutions BEFORE each task\n' +
|
|
1137
|
+
' and save lessons AFTER — fully automatic, zero manual effort.\n\n' +
|
|
1138
|
+
'Returns the copilot-instructions.md content + provider-specific .mcp.json snippet.\n' +
|
|
1139
|
+
'Optionally writes copilot-instructions.md directly to the project directory.',
|
|
1140
|
+
inputSchema: {
|
|
1141
|
+
type: 'object',
|
|
1142
|
+
properties: {
|
|
1143
|
+
instance_id: {
|
|
1144
|
+
type: 'string',
|
|
1145
|
+
description: 'UUID of the cachly instance to use as the AI brain',
|
|
1146
|
+
},
|
|
1147
|
+
project_dir: {
|
|
1148
|
+
type: 'string',
|
|
1149
|
+
description: 'Absolute path to the project root. If provided, writes copilot-instructions.md ' +
|
|
1150
|
+
'to .github/copilot-instructions.md in that directory.',
|
|
1151
|
+
},
|
|
1152
|
+
embed_provider: {
|
|
1153
|
+
type: 'string',
|
|
1154
|
+
enum: ['openai', 'mistral', 'cohere', 'ollama', 'gemini'],
|
|
1155
|
+
description: 'Embedding provider to use for smart_recall / semantic search. ' +
|
|
1156
|
+
'Default: openai. Use ollama for fully local/free setup.',
|
|
1157
|
+
},
|
|
1158
|
+
project_description: {
|
|
1159
|
+
type: 'string',
|
|
1160
|
+
description: 'Short description of the project (used in the generated instructions)',
|
|
1161
|
+
},
|
|
1162
|
+
},
|
|
1163
|
+
required: ['instance_id'],
|
|
1164
|
+
},
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
name: 'cache_stream_set',
|
|
1168
|
+
description: 'Cache a list of string chunks (e.g. LLM token stream) via Redis RPUSH. ' +
|
|
1169
|
+
'Each chunk is stored as a separate list element under cachly:stream:{key}. ' +
|
|
1170
|
+
'Replay with cache_stream_get.',
|
|
1171
|
+
inputSchema: {
|
|
1172
|
+
type: 'object',
|
|
1173
|
+
properties: {
|
|
1174
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1175
|
+
key: { type: 'string', description: 'Cache key' },
|
|
1176
|
+
chunks: { type: 'array', items: { type: 'string' }, description: 'Ordered list of string chunks' },
|
|
1177
|
+
ttl: { type: 'number', description: 'TTL in seconds for the stored list (optional)' },
|
|
1178
|
+
},
|
|
1179
|
+
required: ['instance_id', 'key', 'chunks'],
|
|
1180
|
+
},
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
name: 'cache_stream_get',
|
|
1184
|
+
description: 'Retrieve a previously cached stream as an ordered list of string chunks. ' +
|
|
1185
|
+
'Returns null on cache miss (key absent or empty list). ' +
|
|
1186
|
+
'Stored under cachly:stream:{key}.',
|
|
1187
|
+
inputSchema: {
|
|
1188
|
+
type: 'object',
|
|
1189
|
+
properties: {
|
|
1190
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1191
|
+
key: { type: 'string', description: 'Cache key' },
|
|
1192
|
+
},
|
|
1193
|
+
required: ['instance_id', 'key'],
|
|
1194
|
+
},
|
|
1195
|
+
},
|
|
1196
|
+
// ── v0.6 Cognitive Cache Tools ────────────────────────────────────────────
|
|
1197
|
+
{
|
|
1198
|
+
name: 'memory_consolidate',
|
|
1199
|
+
description: 'Cognitive memory consolidation — the weekly garbage collector for your AI Brain. ' +
|
|
1200
|
+
'Scans all lessons, detects contradictions (same topic with conflicting outcomes), ' +
|
|
1201
|
+
'merges duplicates, flags stale entries (not recalled in 90+ days), and computes a ' +
|
|
1202
|
+
'health score. Returns a full consolidation report with conflicts resolved, ' +
|
|
1203
|
+
'duplicates merged, and a before/after count. ' +
|
|
1204
|
+
'Run weekly or when brain_doctor reports > 20 lessons. ' +
|
|
1205
|
+
'Like git gc for knowledge.',
|
|
1206
|
+
inputSchema: {
|
|
1207
|
+
type: 'object',
|
|
1208
|
+
properties: {
|
|
1209
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1210
|
+
dry_run: { type: 'boolean', description: 'If true, report what would change without writing (default: false)' },
|
|
1211
|
+
stale_days: { type: 'number', description: 'Lessons not recalled in this many days are flagged stale (default: 90)' },
|
|
1212
|
+
},
|
|
1213
|
+
required: ['instance_id'],
|
|
1214
|
+
},
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
name: 'brain_diff',
|
|
1218
|
+
description: 'git log for your AI Brain — see exactly what changed since a point in time. ' +
|
|
1219
|
+
'Returns a structured changelog: new lessons added, lessons updated (outcome changed), ' +
|
|
1220
|
+
'lessons recalled (hit count increased), and lessons that decayed. ' +
|
|
1221
|
+
'Perfect for weekly reviews: "What did my AI learn this week?" ' +
|
|
1222
|
+
'Example: brain_diff(instance_id="...", since="7d") → "12 new · 4 updated · 2 stale"',
|
|
1223
|
+
inputSchema: {
|
|
1224
|
+
type: 'object',
|
|
1225
|
+
properties: {
|
|
1226
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1227
|
+
since: { type: 'string', description: 'Time window: "1d", "7d", "30d", or ISO-8601 date (default: "7d")' },
|
|
1228
|
+
format: { type: 'string', enum: ['summary', 'detailed'], description: 'Output format (default: summary)' },
|
|
1229
|
+
},
|
|
1230
|
+
required: ['instance_id'],
|
|
1231
|
+
},
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
name: 'causal_trace',
|
|
1235
|
+
description: 'Root Cause Analysis through memory: given a problem description, traces the causal chain ' +
|
|
1236
|
+
'from root cause through intermediate failures to the current symptom, then surfaces the ' +
|
|
1237
|
+
'exact solution that worked before. Read-only — does not modify any stored data. ' +
|
|
1238
|
+
'Requires prior learning: brain must have lessons stored via learn_from_attempts or brain_from_git. ' +
|
|
1239
|
+
'Returns an ordered chain of concepts with confidence scores plus the matching solution; ' +
|
|
1240
|
+
'returns an empty chain with a message if no causal path is found. ' +
|
|
1241
|
+
'Example: causal_trace(problem="auth breaks after restart") → ' +
|
|
1242
|
+
'"Root: k8s:namespace-terminating → keycloak:jwks-race → Solution: PollUntilContextTimeout 3min". ' +
|
|
1243
|
+
'Use recall_best_solution for direct topic lookup, syndicate_search for community patterns, ' +
|
|
1244
|
+
'and causal_trace when you have a symptom and need the full root-cause chain.',
|
|
1245
|
+
inputSchema: {
|
|
1246
|
+
type: 'object',
|
|
1247
|
+
properties: {
|
|
1248
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1249
|
+
problem: { type: 'string', description: 'Describe the problem or error you are seeing right now' },
|
|
1250
|
+
max_depth: { type: 'number', description: 'Max causal chain depth to trace (default: 5)' },
|
|
1251
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Optional: narrow search to these tags' },
|
|
1252
|
+
},
|
|
1253
|
+
required: ['instance_id', 'problem'],
|
|
1254
|
+
},
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
name: 'knowledge_decay',
|
|
1258
|
+
description: 'Confidence scoring for every lesson in your Brain — because old knowledge rots. ' +
|
|
1259
|
+
'Computes a decay score (0–100%) per lesson based on age, recall frequency, and outcome. ' +
|
|
1260
|
+
'Lessons recalled recently score high. Lessons from 90 days ago never recalled score low. ' +
|
|
1261
|
+
'Returns a ranked list with visual confidence bars: "████░░░░ 40%". ' +
|
|
1262
|
+
'Use this before a big refactor to know which lessons to trust and which to re-validate.',
|
|
1263
|
+
inputSchema: {
|
|
1264
|
+
type: 'object',
|
|
1265
|
+
properties: {
|
|
1266
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1267
|
+
min_age_days: { type: 'number', description: 'Only include lessons older than N days (default: 0 = all)' },
|
|
1268
|
+
show_top: { type: 'number', description: 'Number of entries to return, sorted by lowest confidence first (default: 20)' },
|
|
1269
|
+
},
|
|
1270
|
+
required: ['instance_id'],
|
|
1271
|
+
},
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
name: 'autopilot',
|
|
1275
|
+
description: 'Generate a CLAUDE.md / copilot-instructions.md that makes any AI self-managing forever. ' +
|
|
1276
|
+
'Writes a configuration file to disk — will overwrite an existing file at the target path. ' +
|
|
1277
|
+
'No auth required beyond a valid instance_id. ' +
|
|
1278
|
+
'The generated file instructs Claude, Cursor, Copilot, Windsurf, or Gemini to automatically ' +
|
|
1279
|
+
'call session_start at window open, learn_from_attempts after every fix, and session_end ' +
|
|
1280
|
+
'before closing — without being asked. ' +
|
|
1281
|
+
'Returns the generated file content as a string and the path where it was written. ' +
|
|
1282
|
+
'Use style="minimal" for just the three hooks; style="full" for the complete ruleset with examples. ' +
|
|
1283
|
+
'One command. Every AI. Always on. ' +
|
|
1284
|
+
'Use setup_ai_memory instead if you want an interactive one-shot setup that also creates an instance.',
|
|
1285
|
+
inputSchema: {
|
|
1286
|
+
type: 'object',
|
|
1287
|
+
properties: {
|
|
1288
|
+
instance_id: { type: 'string', description: 'UUID of the cache instance' },
|
|
1289
|
+
editor: { type: 'string', enum: ['claude', 'cursor', 'copilot', 'windsurf', 'gemini', 'continue', 'all'], description: 'Target editor (default: claude)' },
|
|
1290
|
+
project_name: { type: 'string', description: 'Your project name (used in generated instructions)' },
|
|
1291
|
+
style: { type: 'string', enum: ['minimal', 'full'], description: 'minimal = just the hooks, full = full ruleset with examples (default: full)' },
|
|
1292
|
+
},
|
|
1293
|
+
required: ['instance_id'],
|
|
1294
|
+
},
|
|
1295
|
+
},
|
|
1296
|
+
// ── v0.7 Knowledge Syndication ────────────────────────────────────────────
|
|
1297
|
+
{
|
|
1298
|
+
name: 'syndicate',
|
|
1299
|
+
description: 'Contribute a verified lesson to the GLOBAL Cachly Knowledge Commons — ' +
|
|
1300
|
+
'a privacy-preserving shared brain where every AI instance can learn from the discoveries ' +
|
|
1301
|
+
'of every other. Your contributor identity is a one-way HMAC hash: completely anonymous. ' +
|
|
1302
|
+
'The lesson is immediately searchable by any other AI using syndicate_search. ' +
|
|
1303
|
+
'This is how individual knowledge becomes collective intelligence. ' +
|
|
1304
|
+
'Call this AFTER every learn_from_attempts that is worth sharing universally ' +
|
|
1305
|
+
'(critical bugs, deployment gotchas, architecture discoveries). ' +
|
|
1306
|
+
'If a lesson with the same topic already exists in the commons, it is updated in place (idempotent). ' +
|
|
1307
|
+
'Returns { key, confirm_count, scope } confirming the stored lesson. ' +
|
|
1308
|
+
'Use scope="org" to keep the lesson private to your organisation. ' +
|
|
1309
|
+
'Do NOT use for secrets or PII — content is stored in a shared knowledge base.',
|
|
1310
|
+
inputSchema: {
|
|
1311
|
+
type: 'object',
|
|
1312
|
+
properties: {
|
|
1313
|
+
topic: { type: 'string', description: 'Topic key in category:keyword format (e.g. "fix:clickhouse-ipv6", "deploy:docker-compose")' },
|
|
1314
|
+
outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Result of the attempt (default: success)' },
|
|
1315
|
+
what_worked: { type: 'string', description: 'Exact approach, command, or fix that worked. File paths are stripped automatically.' },
|
|
1316
|
+
what_failed: { type: 'string', description: 'What failed or was wrong — helps others avoid the same trap.' },
|
|
1317
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'How severe the issue was (default: minor)' },
|
|
1318
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Up to 10 keywords for better discoverability' },
|
|
1319
|
+
scope: { type: 'string', enum: ['public', 'org'], description: 'Visibility: "public" = global commons (default), "org" = private to your org only' },
|
|
1320
|
+
},
|
|
1321
|
+
required: ['topic', 'what_worked'],
|
|
1322
|
+
},
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
name: 'syndicate_search',
|
|
1326
|
+
description: 'Search the GLOBAL Cachly Knowledge Commons for solutions contributed by the entire community. ' +
|
|
1327
|
+
'Returns lessons ranked by confirm_count (trust score) then recency. ' +
|
|
1328
|
+
'Use this BEFORE debugging any unknown issue — someone in the global brain likely solved it already. ' +
|
|
1329
|
+
'Example: syndicate_search(q="clickhouse localhost connection refused") → ' +
|
|
1330
|
+
'"fix: use 127.0.0.1 not localhost when IPv6 is disabled · confirmed by 47 instances"',
|
|
1331
|
+
inputSchema: {
|
|
1332
|
+
type: 'object',
|
|
1333
|
+
properties: {
|
|
1334
|
+
q: { type: 'string', description: 'Free-text search query (leave empty for most recent lessons)' },
|
|
1335
|
+
category: { type: 'string', description: 'Filter by category prefix: "fix", "deploy", "debug", "infra", "api", "web"' },
|
|
1336
|
+
scope: { type: 'string', enum: ['public', 'org'], description: '"public" = global commons (default), "org" = public + your org-private lessons' },
|
|
1337
|
+
limit: { type: 'number', description: 'Max results to return (default: 20, max: 50)' },
|
|
1338
|
+
},
|
|
1339
|
+
required: [],
|
|
1340
|
+
},
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
name: 'syndicate_stats',
|
|
1344
|
+
description: 'Show the health of the global Knowledge Commons: total lessons, total confirms, ' +
|
|
1345
|
+
'top categories, most-trusted lessons, growth in the last 7 days, and top contributors (anonymous scores). ' +
|
|
1346
|
+
'Use for weekly reviews or to explore what the community knows.',
|
|
1347
|
+
inputSchema: {
|
|
1348
|
+
type: 'object',
|
|
1349
|
+
properties: {},
|
|
1350
|
+
required: [],
|
|
1351
|
+
},
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
name: 'syndicate_trending',
|
|
1355
|
+
description: 'Show the TRENDING lessons in the global Knowledge Commons — those with the fastest confirmation velocity ' +
|
|
1356
|
+
'in the last 7 days (confirm_count / age_in_days). ' +
|
|
1357
|
+
'Use this at the start of a session or weekly review to see what the community is actively validating. ' +
|
|
1358
|
+
'Lessons need at least 2 independent confirms to appear here.',
|
|
1359
|
+
inputSchema: {
|
|
1360
|
+
type: 'object',
|
|
1361
|
+
properties: {
|
|
1362
|
+
limit: { type: 'number', description: 'Max results (default: 10, max: 50)' },
|
|
1363
|
+
},
|
|
1364
|
+
required: [],
|
|
1365
|
+
},
|
|
1366
|
+
},
|
|
1367
|
+
// ── Layer 1: Causal Knowledge Graph ────────────────────────────────────────
|
|
1368
|
+
{
|
|
1369
|
+
name: 'brain_search',
|
|
1370
|
+
description: 'BM25+ full-text search over ALL brain data: lessons, context entries, session history, CKG nodes, roadmap items. ' +
|
|
1371
|
+
'Unlike smart_recall (which focuses on lessons + context), brain_search casts a wider net. ' +
|
|
1372
|
+
'Use when smart_recall returns nothing or when you want to find anything the brain knows about a topic.',
|
|
1373
|
+
inputSchema: {
|
|
1374
|
+
type: 'object',
|
|
1375
|
+
properties: {
|
|
1376
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1377
|
+
query: { type: 'string', description: 'What to search for' },
|
|
1378
|
+
limit: { type: 'number', description: 'Max results (default: 15)' },
|
|
1379
|
+
},
|
|
1380
|
+
required: ['instance_id', 'query'],
|
|
1381
|
+
},
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
name: 'ckg_inspect',
|
|
1385
|
+
description: 'Inspect the Causal Knowledge Graph (CKG) for a concept. Shows all typed edges (fixes, requires, co-occurs, causes) ' +
|
|
1386
|
+
'with Bayesian confidence scores. Use to understand what the brain knows about a topic and which fixes have the ' +
|
|
1387
|
+
'highest confidence. Also shows related concepts via graph traversal.',
|
|
1388
|
+
inputSchema: {
|
|
1389
|
+
type: 'object',
|
|
1390
|
+
properties: {
|
|
1391
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1392
|
+
concept: { type: 'string', description: 'Concept to inspect, e.g. "fix:clickhouse-ipv6" or "docker"' },
|
|
1393
|
+
max_hops: { type: 'number', description: 'Traversal depth (default: 2)' },
|
|
1394
|
+
},
|
|
1395
|
+
required: ['instance_id', 'concept'],
|
|
1396
|
+
},
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: 'brain_predict',
|
|
1400
|
+
description: 'Predictive Pre-fetch Engine (PPE): given your current context (what you\'re working on), traverses the CKG ' +
|
|
1401
|
+
'to predict likely failures and pre-load relevant fixes. Returns top predicted pitfalls + highest-confidence fixes. ' +
|
|
1402
|
+
'Call at session_start when working on a specific feature or debugging area.',
|
|
1403
|
+
inputSchema: {
|
|
1404
|
+
type: 'object',
|
|
1405
|
+
properties: {
|
|
1406
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1407
|
+
context: { type: 'string', description: 'What you\'re working on, e.g. "upgrading Keycloak from 21 to 24"' },
|
|
1408
|
+
top_k: { type: 'number', description: 'Max predictions to return (default: 5)' },
|
|
1409
|
+
},
|
|
1410
|
+
required: ['instance_id', 'context'],
|
|
1411
|
+
},
|
|
1412
|
+
},
|
|
1413
|
+
// ── Layer 3: MADC ────────────────────────────────────────────────────────
|
|
1414
|
+
{
|
|
1415
|
+
name: 'madc_deliberate',
|
|
1416
|
+
description: 'Multi-Agent Deliberation Chamber (MADC — Layer 3): When conflicting lessons exist for a topic, ' +
|
|
1417
|
+
'run deliberation between 6 specialist expert agents (InfraAgent, AuthAgent, DeployAgent, DatabaseAgent, DebugAgent, APIAgent). ' +
|
|
1418
|
+
'Each agent votes based on its domain CKG coverage. Unanimous vote → loser superseded. ' +
|
|
1419
|
+
'Split vote → contested flag, causal_trace required before acting. ' +
|
|
1420
|
+
'Resolution stored as permanent CKG node. Called automatically when learn_from_attempts detects a contradiction.',
|
|
1421
|
+
inputSchema: {
|
|
1422
|
+
type: 'object',
|
|
1423
|
+
properties: {
|
|
1424
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1425
|
+
topic: { type: 'string', description: 'Topic to deliberate, e.g. "fix:jwks-rotation"' },
|
|
1426
|
+
context: { type: 'string', description: 'Optional context for the deliberation' },
|
|
1427
|
+
},
|
|
1428
|
+
required: ['instance_id', 'topic'],
|
|
1429
|
+
},
|
|
1430
|
+
},
|
|
1431
|
+
// ── Layer 5: CLS ─────────────────────────────────────────────────────────
|
|
1432
|
+
{
|
|
1433
|
+
name: 'cls_ingest',
|
|
1434
|
+
description: 'Continuous Learning Stream (CLS — Layer 5): Ingest learning signals WITHOUT explicit session_end calls. ' +
|
|
1435
|
+
'Sources: git_commit (commit message + files → CKG edges), ci_outcome (green/red build → confirms fix), ' +
|
|
1436
|
+
'ide_diagnostic (compiler error + fix pair → instant lesson). ' +
|
|
1437
|
+
'Install automatic ingestion with cls_install_hooks — brain learns from every commit and CI run.',
|
|
1438
|
+
inputSchema: {
|
|
1439
|
+
type: 'object',
|
|
1440
|
+
properties: {
|
|
1441
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1442
|
+
source: {
|
|
1443
|
+
type: 'string',
|
|
1444
|
+
enum: ['git_commit', 'ci_outcome', 'ide_diagnostic'],
|
|
1445
|
+
description: 'Event source type',
|
|
1446
|
+
},
|
|
1447
|
+
payload: {
|
|
1448
|
+
type: 'object',
|
|
1449
|
+
description: 'Event data. git_commit: {message, sha?, files?, diff?}. ' +
|
|
1450
|
+
'ci_outcome: {status, prev_status, job, context?}. ' +
|
|
1451
|
+
'ide_diagnostic: {error, fix, file?}',
|
|
1452
|
+
},
|
|
1453
|
+
},
|
|
1454
|
+
required: ['instance_id', 'source', 'payload'],
|
|
1455
|
+
},
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
name: 'cls_install_hooks',
|
|
1459
|
+
description: 'Output a ready-to-install git post-commit hook + GitHub Actions step for Continuous Learning. ' +
|
|
1460
|
+
'Once installed, every git commit and CI build automatically feeds the brain — no session_end needed. ' +
|
|
1461
|
+
'Run once per repository.',
|
|
1462
|
+
inputSchema: {
|
|
1463
|
+
type: 'object',
|
|
1464
|
+
properties: {
|
|
1465
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1466
|
+
repo_path: { type: 'string', description: 'Path to repo root (default: current dir)' },
|
|
1467
|
+
hooks: {
|
|
1468
|
+
type: 'array',
|
|
1469
|
+
items: { type: 'string', enum: ['git', 'ci'] },
|
|
1470
|
+
description: 'Which hooks to output (default: ["git", "ci"])',
|
|
1471
|
+
},
|
|
1472
|
+
},
|
|
1473
|
+
required: ['instance_id'],
|
|
1474
|
+
},
|
|
1475
|
+
},
|
|
1476
|
+
// ── Layer 6: FedBrain ────────────────────────────────────────────────────
|
|
1477
|
+
{
|
|
1478
|
+
name: 'fedbrain_contribute',
|
|
1479
|
+
description: 'FedBrain (Layer 6): Contribute a lesson to the global Knowledge Commons with a cryptographic ' +
|
|
1480
|
+
'knowledge certificate. Certificate includes: domain fingerprint, confidence, outcome chain hash. ' +
|
|
1481
|
+
'Lessons with 10+ independent confirmations become Gold Standard. Context-weighted: ' +
|
|
1482
|
+
'other brains with similar tech stacks see your lesson ranked higher in fedbrain_search.',
|
|
1483
|
+
inputSchema: {
|
|
1484
|
+
type: 'object',
|
|
1485
|
+
properties: {
|
|
1486
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1487
|
+
lesson_key: { type: 'string', description: 'Topic key to contribute, e.g. "fix:clickhouse-ipv6"' },
|
|
1488
|
+
visibility: {
|
|
1489
|
+
type: 'string',
|
|
1490
|
+
enum: ['public', 'org_private'],
|
|
1491
|
+
description: 'Visibility (default: public)',
|
|
1492
|
+
},
|
|
1493
|
+
},
|
|
1494
|
+
required: ['instance_id', 'lesson_key'],
|
|
1495
|
+
},
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
name: 'fedbrain_search',
|
|
1499
|
+
description: 'FedBrain context-weighted search: Search the global commons, weighting results by tech-stack similarity. ' +
|
|
1500
|
+
'Brains with matching domain context (Go/Kubernetes/Postgres) rank higher than unrelated stacks. ' +
|
|
1501
|
+
'Shows certificate provenance, confirm_count, and Gold Standard badges.',
|
|
1502
|
+
inputSchema: {
|
|
1503
|
+
type: 'object',
|
|
1504
|
+
properties: {
|
|
1505
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1506
|
+
query: { type: 'string', description: 'What to search for' },
|
|
1507
|
+
context_hints: {
|
|
1508
|
+
type: 'array',
|
|
1509
|
+
items: { type: 'string' },
|
|
1510
|
+
description: 'Your tech stack, e.g. ["go", "kubernetes", "postgres"]',
|
|
1511
|
+
},
|
|
1512
|
+
limit: { type: 'number', description: 'Max results (default: 10)' },
|
|
1513
|
+
},
|
|
1514
|
+
required: ['instance_id', 'query'],
|
|
1515
|
+
},
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
name: 'fedbrain_confirm',
|
|
1519
|
+
description: 'Confirm that a syndicated lesson from the global commons worked for you. ' +
|
|
1520
|
+
'Propagates confirmation back — increments confirm_count on the knowledge certificate. ' +
|
|
1521
|
+
'Also updates your local CKG confidence. At 10 independent confirmations → Gold Standard.',
|
|
1522
|
+
inputSchema: {
|
|
1523
|
+
type: 'object',
|
|
1524
|
+
properties: {
|
|
1525
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1526
|
+
topic: { type: 'string', description: 'Topic of the lesson to confirm' },
|
|
1527
|
+
outcome: {
|
|
1528
|
+
type: 'string',
|
|
1529
|
+
enum: ['worked', 'partially_worked', 'did_not_work'],
|
|
1530
|
+
description: 'Did the lesson work for you?',
|
|
1531
|
+
},
|
|
1532
|
+
},
|
|
1533
|
+
required: ['instance_id', 'topic', 'outcome'],
|
|
1534
|
+
},
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
name: 'fedbrain_status',
|
|
1538
|
+
description: 'Show your FedBrain federation status: lessons contributed to global commons, recent confirmations, ' +
|
|
1539
|
+
'Gold Standard lessons, pending propagations. Use to track your brain\'s global knowledge contribution.',
|
|
1540
|
+
inputSchema: {
|
|
1541
|
+
type: 'object',
|
|
1542
|
+
properties: {
|
|
1543
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1544
|
+
},
|
|
1545
|
+
required: ['instance_id'],
|
|
1546
|
+
},
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
name: 'brain_federate',
|
|
1550
|
+
description: 'FedBrain Layer 6 — Private org knowledge transfer: copy CKG edges + lessons from a source brain ' +
|
|
1551
|
+
'into your brain for a specific domain (e.g. "billing", "auth", "deploy"). ' +
|
|
1552
|
+
'The new hire use case: one command gives you the senior engineer\'s 5 years of typed, confidence-weighted ' +
|
|
1553
|
+
'knowledge in your domain. Unlike syndicate_search (global, anonymous), brain_federate is org-private — ' +
|
|
1554
|
+
'both brains must be in the same Cachly org, or the source instance_id must be explicitly shared. ' +
|
|
1555
|
+
'Example: brain_federate(source="prod-brain-id", domain="billing", min_confidence=0.6)',
|
|
1556
|
+
inputSchema: {
|
|
1557
|
+
type: 'object',
|
|
1558
|
+
properties: {
|
|
1559
|
+
instance_id: { type: 'string', description: 'Your brain instance ID (destination)' },
|
|
1560
|
+
source: { type: 'string', description: 'Source brain instance ID to federate from' },
|
|
1561
|
+
domain: { type: 'string', description: 'Domain to transfer, e.g. "billing", "auth", "deploy", "infra". Use "*" for all domains.' },
|
|
1562
|
+
min_confidence: { type: 'number', description: 'Minimum edge confidence to transfer (default: 0.6)' },
|
|
1563
|
+
dry_run: { type: 'boolean', description: 'Preview what would be transferred without writing (default: false)' },
|
|
1564
|
+
},
|
|
1565
|
+
required: ['instance_id', 'source', 'domain'],
|
|
1566
|
+
},
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
name: 'crystal_view',
|
|
1570
|
+
description: 'Inspect the current Memory Crystal — the compressed wisdom distilled from all past sessions. ' +
|
|
1571
|
+
'Shows top patterns per category, lesson count, and when the crystal was last refreshed. ' +
|
|
1572
|
+
'Call after session_start when you want to quickly see accumulated wisdom across all past work.',
|
|
1573
|
+
inputSchema: {
|
|
1574
|
+
type: 'object',
|
|
1575
|
+
properties: {
|
|
1576
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1577
|
+
show_raw: { type: 'boolean', description: 'Include raw JSON crystal data (default: false)' },
|
|
1578
|
+
},
|
|
1579
|
+
required: ['instance_id'],
|
|
1580
|
+
},
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
name: 'compact_recover',
|
|
1584
|
+
description: 'Call FIRST after any context limit hit / compaction. Reconstructs full context from Memory Crystal + ' +
|
|
1585
|
+
'recent sessions + WIP registry + open failures. Returns a condensed briefing so the new context ' +
|
|
1586
|
+
'window starts exactly where the previous one left off — no lost progress.',
|
|
1587
|
+
inputSchema: {
|
|
1588
|
+
type: 'object',
|
|
1589
|
+
properties: {
|
|
1590
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1591
|
+
focus: { type: 'string', description: 'What you were working on (helps filter relevant context)' },
|
|
1592
|
+
},
|
|
1593
|
+
required: ['instance_id'],
|
|
1594
|
+
},
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
name: 'brain_from_git',
|
|
1598
|
+
description: 'Bootstrap brain lessons from git history. Parses commit messages and infers fix/feature/refactor ' +
|
|
1599
|
+
'lessons automatically. Great for onboarding an existing codebase — run once and the brain instantly ' +
|
|
1600
|
+
'knows your team\'s accumulated patterns. Supports limit and branch options.',
|
|
1601
|
+
inputSchema: {
|
|
1602
|
+
type: 'object',
|
|
1603
|
+
properties: {
|
|
1604
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1605
|
+
repo_path: { type: 'string', description: 'Path to git repository (default: current directory)' },
|
|
1606
|
+
limit: { type: 'number', description: 'Max commits to process (default: 100, max: 500)' },
|
|
1607
|
+
branch: { type: 'string', description: 'Git branch to parse (default: current branch / HEAD)' },
|
|
1608
|
+
since: { type: 'string', description: 'Only commits after this date, e.g. "2024-01-01" (optional)' },
|
|
1609
|
+
},
|
|
1610
|
+
required: ['instance_id'],
|
|
1611
|
+
},
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
name: 'brain_predict_failures',
|
|
1615
|
+
description: 'Pre-deploy failure prediction with probability percentages. Given a change context (e.g. ' +
|
|
1616
|
+
'"upgrading Keycloak 21→24" or "deploying Redis 7 to prod"), returns the top likely failure modes ' +
|
|
1617
|
+
'ranked by probability, with pre-loaded fixes. Uses CKG causal edges + lesson history. ' +
|
|
1618
|
+
'Call before any significant deploy, migration, or infrastructure change.',
|
|
1619
|
+
inputSchema: {
|
|
1620
|
+
type: 'object',
|
|
1621
|
+
properties: {
|
|
1622
|
+
instance_id: { type: 'string', description: 'Brain instance ID' },
|
|
1623
|
+
context: { type: 'string', description: 'What you are about to do, e.g. "upgrading Keycloak 21 to 24"' },
|
|
1624
|
+
top_k: { type: 'number', description: 'Number of failure predictions to return (default: 5)' },
|
|
1625
|
+
format: { type: 'string', enum: ['brief', 'detailed'], description: 'Output format (default: detailed)' },
|
|
1626
|
+
},
|
|
1627
|
+
required: ['instance_id', 'context'],
|
|
1628
|
+
},
|
|
1629
|
+
},
|
|
1630
|
+
];
|
|
1631
|
+
export { TOOLS };
|
|
1632
|
+
//# sourceMappingURL=tools.js.map
|