@cachly-dev/mcp-server 0.10.65 → 0.10.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/src/handlers/brain.js +1 -1
  2. package/dist/src/index.js +1 -1
  3. package/package.json +7 -1
  4. package/server.json +2 -2
  5. package/.env.test.example +0 -23
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -50
  7. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  8. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -25
  9. package/.github/workflows/eas-build-android.yml +0 -58
  10. package/.github/workflows/eas-update.yml +0 -55
  11. package/.github/workflows/publish.yml +0 -72
  12. package/BENCH.md +0 -113
  13. package/CHANGELOG.md +0 -653
  14. package/Dockerfile +0 -16
  15. package/LAUNCH_TEXTS.md +0 -182
  16. package/PROGRESS.md +0 -141
  17. package/STRATEGY.md +0 -228
  18. package/VISION_10X.md +0 -133
  19. package/apps/travel-chaos-organizer/.env.example +0 -49
  20. package/apps/travel-chaos-organizer/DEPLOY.md +0 -328
  21. package/apps/travel-chaos-organizer/Makefile +0 -57
  22. package/apps/travel-chaos-organizer/README.md +0 -159
  23. package/apps/travel-chaos-organizer/backend/.env.example +0 -10
  24. package/apps/travel-chaos-organizer/backend/Dockerfile +0 -25
  25. package/apps/travel-chaos-organizer/backend/alembic/env.py +0 -56
  26. package/apps/travel-chaos-organizer/backend/alembic/script.py.mako +0 -24
  27. package/apps/travel-chaos-organizer/backend/alembic/versions/.gitkeep +0 -0
  28. package/apps/travel-chaos-organizer/backend/alembic/versions/0001_stripe_customer_id.py +0 -24
  29. package/apps/travel-chaos-organizer/backend/alembic/versions/0002_telegram_chat_id.py +0 -24
  30. package/apps/travel-chaos-organizer/backend/alembic.ini +0 -39
  31. package/apps/travel-chaos-organizer/backend/app/__init__.py +0 -0
  32. package/apps/travel-chaos-organizer/backend/app/auth/__init__.py +0 -0
  33. package/apps/travel-chaos-organizer/backend/app/auth/keycloak.py +0 -81
  34. package/apps/travel-chaos-organizer/backend/app/config.py +0 -66
  35. package/apps/travel-chaos-organizer/backend/app/db/__init__.py +0 -0
  36. package/apps/travel-chaos-organizer/backend/app/db/database.py +0 -20
  37. package/apps/travel-chaos-organizer/backend/app/db/migrations/001_init.sql +0 -71
  38. package/apps/travel-chaos-organizer/backend/app/db/migrations/002_telemetry_freemium.sql +0 -31
  39. package/apps/travel-chaos-organizer/backend/app/db/migrations/003_telegram_chat_id.sql +0 -4
  40. package/apps/travel-chaos-organizer/backend/app/db/migrations/004_stripe_and_email.sql +0 -5
  41. package/apps/travel-chaos-organizer/backend/app/limiter.py +0 -4
  42. package/apps/travel-chaos-organizer/backend/app/logging_config.py +0 -25
  43. package/apps/travel-chaos-organizer/backend/app/main.py +0 -77
  44. package/apps/travel-chaos-organizer/backend/app/models/__init__.py +0 -0
  45. package/apps/travel-chaos-organizer/backend/app/models/schemas.py +0 -142
  46. package/apps/travel-chaos-organizer/backend/app/routers/__init__.py +0 -0
  47. package/apps/travel-chaos-organizer/backend/app/routers/admin.py +0 -237
  48. package/apps/travel-chaos-organizer/backend/app/routers/cache.py +0 -13
  49. package/apps/travel-chaos-organizer/backend/app/routers/events.py +0 -29
  50. package/apps/travel-chaos-organizer/backend/app/routers/export.py +0 -122
  51. package/apps/travel-chaos-organizer/backend/app/routers/inbox.py +0 -122
  52. package/apps/travel-chaos-organizer/backend/app/routers/items.py +0 -130
  53. package/apps/travel-chaos-organizer/backend/app/routers/mail.py +0 -108
  54. package/apps/travel-chaos-organizer/backend/app/routers/parse.py +0 -303
  55. package/apps/travel-chaos-organizer/backend/app/routers/payments.py +0 -179
  56. package/apps/travel-chaos-organizer/backend/app/routers/trips.py +0 -134
  57. package/apps/travel-chaos-organizer/backend/app/routers/users.py +0 -169
  58. package/apps/travel-chaos-organizer/backend/app/routers/waitlist.py +0 -37
  59. package/apps/travel-chaos-organizer/backend/app/services/__init__.py +0 -0
  60. package/apps/travel-chaos-organizer/backend/app/services/cache.py +0 -131
  61. package/apps/travel-chaos-organizer/backend/app/services/drip.py +0 -128
  62. package/apps/travel-chaos-organizer/backend/app/services/email.py +0 -61
  63. package/apps/travel-chaos-organizer/backend/app/services/errors.py +0 -44
  64. package/apps/travel-chaos-organizer/backend/app/services/notifier.py +0 -10
  65. package/apps/travel-chaos-organizer/backend/app/services/ollama.py +0 -101
  66. package/apps/travel-chaos-organizer/backend/app/services/parser.py +0 -22
  67. package/apps/travel-chaos-organizer/backend/app/services/quota.py +0 -85
  68. package/apps/travel-chaos-organizer/backend/app/services/sentry.py +0 -11
  69. package/apps/travel-chaos-organizer/backend/app/services/telemetry.py +0 -35
  70. package/apps/travel-chaos-organizer/backend/pytest.ini +0 -4
  71. package/apps/travel-chaos-organizer/backend/requirements-dev.txt +0 -6
  72. package/apps/travel-chaos-organizer/backend/requirements.txt +0 -25
  73. package/apps/travel-chaos-organizer/backend/tests/__init__.py +0 -0
  74. package/apps/travel-chaos-organizer/backend/tests/conftest.py +0 -223
  75. package/apps/travel-chaos-organizer/backend/tests/test_admin.py +0 -99
  76. package/apps/travel-chaos-organizer/backend/tests/test_cache.py +0 -142
  77. package/apps/travel-chaos-organizer/backend/tests/test_drip.py +0 -32
  78. package/apps/travel-chaos-organizer/backend/tests/test_e2e_chain.py +0 -121
  79. package/apps/travel-chaos-organizer/backend/tests/test_export.py +0 -48
  80. package/apps/travel-chaos-organizer/backend/tests/test_inbox.py +0 -107
  81. package/apps/travel-chaos-organizer/backend/tests/test_items.py +0 -138
  82. package/apps/travel-chaos-organizer/backend/tests/test_mail.py +0 -113
  83. package/apps/travel-chaos-organizer/backend/tests/test_ollama.py +0 -145
  84. package/apps/travel-chaos-organizer/backend/tests/test_parse_url.py +0 -98
  85. package/apps/travel-chaos-organizer/backend/tests/test_parser.py +0 -72
  86. package/apps/travel-chaos-organizer/backend/tests/test_payments.py +0 -163
  87. package/apps/travel-chaos-organizer/backend/tests/test_quota.py +0 -46
  88. package/apps/travel-chaos-organizer/backend/tests/test_search.py +0 -67
  89. package/apps/travel-chaos-organizer/backend/tests/test_trips.py +0 -123
  90. package/apps/travel-chaos-organizer/backend/tests/test_users.py +0 -52
  91. package/apps/travel-chaos-organizer/backups/.gitkeep +0 -0
  92. package/apps/travel-chaos-organizer/caddy/Caddyfile +0 -27
  93. package/apps/travel-chaos-organizer/docker-compose.node1.yml +0 -31
  94. package/apps/travel-chaos-organizer/docker-compose.override.yml +0 -14
  95. package/apps/travel-chaos-organizer/docker-compose.yml +0 -128
  96. package/apps/travel-chaos-organizer/frontend/.env.example +0 -13
  97. package/apps/travel-chaos-organizer/frontend/app/(app)/_layout.tsx +0 -80
  98. package/apps/travel-chaos-organizer/frontend/app/(app)/inbox.tsx +0 -166
  99. package/apps/travel-chaos-organizer/frontend/app/(app)/search.tsx +0 -130
  100. package/apps/travel-chaos-organizer/frontend/app/(app)/settings.tsx +0 -381
  101. package/apps/travel-chaos-organizer/frontend/app/(app)/trips/[id].tsx +0 -346
  102. package/apps/travel-chaos-organizer/frontend/app/(app)/trips.tsx +0 -363
  103. package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/cancel.tsx +0 -34
  104. package/apps/travel-chaos-organizer/frontend/app/(app)/upgrade/success.tsx +0 -35
  105. package/apps/travel-chaos-organizer/frontend/app/(auth)/login.tsx +0 -91
  106. package/apps/travel-chaos-organizer/frontend/app/_layout.tsx +0 -71
  107. package/apps/travel-chaos-organizer/frontend/app/auth.tsx +0 -29
  108. package/apps/travel-chaos-organizer/frontend/app/index.tsx +0 -16
  109. package/apps/travel-chaos-organizer/frontend/app/onboarding.tsx +0 -119
  110. package/apps/travel-chaos-organizer/frontend/app.config.ts +0 -54
  111. package/apps/travel-chaos-organizer/frontend/assets/adaptive-icon.svg +0 -66
  112. package/apps/travel-chaos-organizer/frontend/assets/icon.svg +0 -79
  113. package/apps/travel-chaos-organizer/frontend/assets/splash.svg +0 -15
  114. package/apps/travel-chaos-organizer/frontend/components/BottomSheet.tsx +0 -102
  115. package/apps/travel-chaos-organizer/frontend/components/ConfettiCannon.tsx +0 -107
  116. package/apps/travel-chaos-organizer/frontend/components/ConfirmDialog.tsx +0 -109
  117. package/apps/travel-chaos-organizer/frontend/components/ErrorBoundary.tsx +0 -45
  118. package/apps/travel-chaos-organizer/frontend/components/FileUploadButton.tsx +0 -19
  119. package/apps/travel-chaos-organizer/frontend/components/ImportSheet.tsx +0 -155
  120. package/apps/travel-chaos-organizer/frontend/components/OfflineBadge.tsx +0 -55
  121. package/apps/travel-chaos-organizer/frontend/components/QRCodeViewer.tsx +0 -80
  122. package/apps/travel-chaos-organizer/frontend/components/ScoreRing.tsx +0 -39
  123. package/apps/travel-chaos-organizer/frontend/components/Screen.tsx +0 -39
  124. package/apps/travel-chaos-organizer/frontend/components/Skeleton.tsx +0 -70
  125. package/apps/travel-chaos-organizer/frontend/components/SwipeableInboxItem.tsx +0 -121
  126. package/apps/travel-chaos-organizer/frontend/components/SwipeableTimelineItem.tsx +0 -70
  127. package/apps/travel-chaos-organizer/frontend/components/TimelineItem.tsx +0 -73
  128. package/apps/travel-chaos-organizer/frontend/components/TimelineItemDetail.tsx +0 -130
  129. package/apps/travel-chaos-organizer/frontend/components/Toast.tsx +0 -60
  130. package/apps/travel-chaos-organizer/frontend/components/ToastContext.tsx +0 -42
  131. package/apps/travel-chaos-organizer/frontend/components/TripCard.tsx +0 -146
  132. package/apps/travel-chaos-organizer/frontend/components/TripQRModal.tsx +0 -70
  133. package/apps/travel-chaos-organizer/frontend/components/UpgradeBanner.tsx +0 -44
  134. package/apps/travel-chaos-organizer/frontend/eas.json +0 -22
  135. package/apps/travel-chaos-organizer/frontend/hooks/useInbox.ts +0 -24
  136. package/apps/travel-chaos-organizer/frontend/hooks/useNetworkSync.ts +0 -60
  137. package/apps/travel-chaos-organizer/frontend/hooks/useTrips.ts +0 -112
  138. package/apps/travel-chaos-organizer/frontend/lib/api.ts +0 -223
  139. package/apps/travel-chaos-organizer/frontend/lib/auth.ts +0 -93
  140. package/apps/travel-chaos-organizer/frontend/lib/db.ts +0 -86
  141. package/apps/travel-chaos-organizer/frontend/lib/fileCache.ts +0 -54
  142. package/apps/travel-chaos-organizer/frontend/lib/haptics.ts +0 -13
  143. package/apps/travel-chaos-organizer/frontend/lib/notifications.ts +0 -112
  144. package/apps/travel-chaos-organizer/frontend/lib/offlineQueue.ts +0 -145
  145. package/apps/travel-chaos-organizer/frontend/lib/quota.tsx +0 -43
  146. package/apps/travel-chaos-organizer/frontend/lib/sentry.ts +0 -28
  147. package/apps/travel-chaos-organizer/frontend/lib/shareIntent.ts +0 -44
  148. package/apps/travel-chaos-organizer/frontend/package-lock.json +0 -13221
  149. package/apps/travel-chaos-organizer/frontend/package.json +0 -44
  150. package/apps/travel-chaos-organizer/frontend/tsconfig.json +0 -23
  151. package/apps/travel-chaos-organizer/keycloak/realm-export.json +0 -59
  152. package/apps/travel-chaos-organizer/landing/index.html +0 -773
  153. package/apps/travel-chaos-organizer/scripts/backup.sh +0 -14
  154. package/apps/travel-chaos-organizer/scripts/configure-env.sh +0 -82
  155. package/apps/travel-chaos-organizer/scripts/deploy.sh +0 -54
  156. package/apps/travel-chaos-organizer/scripts/health-check.sh +0 -36
  157. package/apps/travel-chaos-organizer/scripts/migrate.sh +0 -7
  158. package/apps/travel-chaos-organizer/scripts/server-setup.sh +0 -85
  159. package/apps/travel-chaos-organizer/scripts/smoke-test.sh +0 -29
  160. package/apps/travel-chaos-organizer/scripts/verify-tracking.sh +0 -71
  161. package/apps/travel-chaos-organizer/telegram-bot/.env.example +0 -3
  162. package/apps/travel-chaos-organizer/telegram-bot/Dockerfile +0 -6
  163. package/apps/travel-chaos-organizer/telegram-bot/bot.py +0 -504
  164. package/apps/travel-chaos-organizer/telegram-bot/requirements.txt +0 -3
  165. package/dist/src/__tests__/auth.test.d.ts +0 -1
  166. package/dist/src/__tests__/auth.test.js +0 -107
  167. package/dist/src/__tests__/auth.test.js.map +0 -1
  168. package/dist/src/__tests__/brain-flow.test.d.ts +0 -12
  169. package/dist/src/__tests__/brain-flow.test.js +0 -1241
  170. package/dist/src/__tests__/brain-flow.test.js.map +0 -1
  171. package/dist/src/__tests__/confidence.test.d.ts +0 -13
  172. package/dist/src/__tests__/confidence.test.js +0 -233
  173. package/dist/src/__tests__/confidence.test.js.map +0 -1
  174. package/dist/src/__tests__/e2e/api-auth.test.d.ts +0 -7
  175. package/dist/src/__tests__/e2e/api-auth.test.js +0 -162
  176. package/dist/src/__tests__/e2e/api-auth.test.js.map +0 -1
  177. package/dist/src/__tests__/e2e/api-health.test.d.ts +0 -7
  178. package/dist/src/__tests__/e2e/api-health.test.js +0 -95
  179. package/dist/src/__tests__/e2e/api-health.test.js.map +0 -1
  180. package/dist/src/__tests__/e2e/cli.test.d.ts +0 -10
  181. package/dist/src/__tests__/e2e/cli.test.js +0 -204
  182. package/dist/src/__tests__/e2e/cli.test.js.map +0 -1
  183. package/dist/src/__tests__/e2e/config.d.ts +0 -35
  184. package/dist/src/__tests__/e2e/config.js +0 -53
  185. package/dist/src/__tests__/e2e/config.js.map +0 -1
  186. package/dist/src/__tests__/e2e/funnel.test.d.ts +0 -13
  187. package/dist/src/__tests__/e2e/funnel.test.js +0 -90
  188. package/dist/src/__tests__/e2e/funnel.test.js.map +0 -1
  189. package/dist/src/__tests__/e2e/mcp-tools.test.d.ts +0 -7
  190. package/dist/src/__tests__/e2e/mcp-tools.test.js +0 -129
  191. package/dist/src/__tests__/e2e/mcp-tools.test.js.map +0 -1
  192. package/dist/src/__tests__/e2e/provisioning.test.d.ts +0 -15
  193. package/dist/src/__tests__/e2e/provisioning.test.js +0 -123
  194. package/dist/src/__tests__/e2e/provisioning.test.js.map +0 -1
  195. package/dist/src/__tests__/handlers-unit.test.d.ts +0 -12
  196. package/dist/src/__tests__/handlers-unit.test.js +0 -505
  197. package/dist/src/__tests__/handlers-unit.test.js.map +0 -1
  198. package/dist/src/__tests__/namespace.test.d.ts +0 -1
  199. package/dist/src/__tests__/namespace.test.js +0 -114
  200. package/dist/src/__tests__/namespace.test.js.map +0 -1
  201. package/dist/src/__tests__/rerank.test.d.ts +0 -1
  202. package/dist/src/__tests__/rerank.test.js +0 -125
  203. package/dist/src/__tests__/rerank.test.js.map +0 -1
  204. package/dist/src/__tests__/utils.test.d.ts +0 -1
  205. package/dist/src/__tests__/utils.test.js +0 -83
  206. package/dist/src/__tests__/utils.test.js.map +0 -1
  207. package/dist/src/bench/cachly-bench.d.ts +0 -39
  208. package/dist/src/bench/cachly-bench.js +0 -223
  209. package/dist/src/bench/cachly-bench.js.map +0 -1
  210. package/dist/src/bench/fixtures.d.ts +0 -37
  211. package/dist/src/bench/fixtures.js +0 -225
  212. package/dist/src/bench/fixtures.js.map +0 -1
  213. package/dist/src/search.test.d.ts +0 -1
  214. package/dist/src/search.test.js +0 -713
  215. package/dist/src/search.test.js.map +0 -1
  216. package/eslint.config.js +0 -16
  217. package/glama.json +0 -36
  218. package/llms.txt +0 -155
  219. package/packages/telegram-notify/SPLIT_PLAN.md +0 -106
  220. package/packages/telegram-notify/client.ts +0 -88
  221. package/packages/telegram-notify/emojis.json +0 -22
  222. package/packages/telegram-notify/pyproject.toml +0 -17
  223. package/packages/telegram-notify/telegram_notify/__init__.py +0 -3
  224. package/packages/telegram-notify/telegram_notify/client.py +0 -87
  225. package/packages/telegram-notify/telegram_notify/emojis.json +0 -22
  226. package/scripts/e2e-run.sh +0 -160
  227. package/scripts/generate-icons.js +0 -28
  228. package/smithery.yaml +0 -45
  229. package/src/__tests__/auth.test.ts +0 -147
  230. package/src/__tests__/brain-flow.test.ts +0 -1472
  231. package/src/__tests__/confidence.test.ts +0 -285
  232. package/src/__tests__/e2e/api-auth.test.ts +0 -182
  233. package/src/__tests__/e2e/api-health.test.ts +0 -103
  234. package/src/__tests__/e2e/cli.test.ts +0 -228
  235. package/src/__tests__/e2e/config.ts +0 -53
  236. package/src/__tests__/e2e/funnel.test.ts +0 -99
  237. package/src/__tests__/e2e/mcp-tools.test.ts +0 -191
  238. package/src/__tests__/e2e/provisioning.test.ts +0 -128
  239. package/src/__tests__/handlers-unit.test.ts +0 -677
  240. package/src/__tests__/namespace.test.ts +0 -126
  241. package/src/__tests__/rerank.test.ts +0 -141
  242. package/src/__tests__/utils.test.ts +0 -81
  243. package/src/auth.ts +0 -46
  244. package/src/bench/cachly-bench.ts +0 -263
  245. package/src/bench/fixtures.ts +0 -256
  246. package/src/ckg.ts +0 -103
  247. package/src/confidence.ts +0 -38
  248. package/src/embeddings.ts +0 -217
  249. package/src/handlers/advanced.ts +0 -647
  250. package/src/handlers/brain.ts +0 -2622
  251. package/src/handlers/cache.ts +0 -633
  252. package/src/handlers/context.ts +0 -222
  253. package/src/handlers/fedbrain.ts +0 -1232
  254. package/src/handlers/instances.ts +0 -180
  255. package/src/handlers/roadmap.ts +0 -201
  256. package/src/handlers/syndicate.ts +0 -460
  257. package/src/handlers/tco.ts +0 -345
  258. package/src/handlers/team.ts +0 -1249
  259. package/src/index.ts +0 -2815
  260. package/src/namespace.ts +0 -128
  261. package/src/notifier.ts +0 -5
  262. package/src/rerank.ts +0 -148
  263. package/src/search.test.ts +0 -848
  264. package/src/search.ts +0 -1781
  265. package/src/tools.ts +0 -2056
  266. package/src/utils.ts +0 -90
  267. package/test-features.cjs +0 -23
  268. package/tsconfig.json +0 -16
  269. package/vitest.config.ts +0 -14
package/src/tools.ts DELETED
@@ -1,2056 +0,0 @@
1
- // ── Tool definitions (schema only, no handler logic) ─────────────────────────
2
-
3
- // ── Tools ─────────────────────────────────────────────────────────────────────
4
-
5
- const TOOLS = [
6
- // ── Instance Management ──────────────────────────────────────────────────
7
- {
8
- name: 'list_instances',
9
- description:
10
- 'List all your cachly cache instances with their status and connection details. ' +
11
- 'Read-only. Returns an array of instance objects — each with id, name, tier, status, region, RAM, ' +
12
- 'and redis:// connection string. Returns an empty array if no instances exist. ' +
13
- 'No pagination: all instances are returned in one call (typical accounts have < 20). ' +
14
- 'Use this first to discover instance UUIDs required by get_instance, cache_get, cache_set, ' +
15
- 'and all other cache tools. Use get_instance to retrieve full metadata for a single instance.',
16
- inputSchema: { type: 'object', properties: {}, required: [] },
17
- },
18
- {
19
- name: 'create_instance',
20
- description:
21
- 'Create a new managed Valkey/Redis cache instance on cachly.dev. ' +
22
- 'Free tier provisions in ~30 seconds. Paid tiers return a Stripe checkout URL. ' +
23
- 'Available tiers: free (25 MB), dev (200 MB, €19/mo), pro (900 MB, €49/mo), ' +
24
- 'speed (900 MB Dragonfly + Semantic Cache, €79/mo), business (7 GB, €199/mo).',
25
- inputSchema: {
26
- type: 'object',
27
- properties: {
28
- name: { type: 'string', description: 'Unique name for the instance (min 3 chars)' },
29
- tier: {
30
- type: 'string',
31
- enum: ['free', 'dev', 'pro', 'speed', 'business'],
32
- description: 'Pricing tier. Start with "free" for testing.',
33
- },
34
- },
35
- required: ['name', 'tier'],
36
- },
37
- },
38
- {
39
- name: 'get_instance',
40
- description:
41
- 'Get full metadata for a specific cache instance: name, tier, status (provisioning / running / paused), ' +
42
- 'region, RAM limit, Redis connection string, created_at, and expiry. Read-only. ' +
43
- 'Returns an error if the instance_id is not found or belongs to another account. ' +
44
- 'Call list_instances first to discover valid UUIDs. ' +
45
- 'Use get_connection_string instead if you only need the redis:// URL for your app config.',
46
- inputSchema: {
47
- type: 'object',
48
- properties: {
49
- instance_id: { type: 'string', description: 'UUID of the instance (from list_instances)' },
50
- },
51
- required: ['instance_id'],
52
- },
53
- },
54
- {
55
- name: 'get_connection_string',
56
- description:
57
- 'Get the Redis/Valkey connection string (redis:// URL) for a running instance. ' +
58
- 'Use this to configure your application or set environment variables.',
59
- inputSchema: {
60
- type: 'object',
61
- properties: {
62
- instance_id: { type: 'string', description: 'UUID of the instance' },
63
- },
64
- required: ['instance_id'],
65
- },
66
- },
67
- {
68
- name: 'delete_instance',
69
- description:
70
- 'Permanently delete a cache instance. Deprovisions the Kubernetes workload and removes all data. ' +
71
- 'This action is irreversible.',
72
- inputSchema: {
73
- type: 'object',
74
- properties: {
75
- instance_id: { type: 'string', description: 'UUID of the instance to delete' },
76
- confirm: { type: 'boolean', description: 'Must be true to confirm deletion' },
77
- },
78
- required: ['instance_id', 'confirm'],
79
- },
80
- },
81
-
82
- // ── Live Cache Operations ────────────────────────────────────────────────
83
- {
84
- name: 'cache_get',
85
- description:
86
- 'Get a value from a running cache instance by key. ' +
87
- 'Returns the stored value (string or deserialized JSON object) or null if the key does not exist or has expired. ' +
88
- 'Read-only — no side effects. ' +
89
- 'Use cache_mget when you need multiple keys in one round-trip. ' +
90
- 'Use cache_exists to check existence without retrieving the value. ' +
91
- 'Use semantic_search when you need fuzzy/vector search across stored values.',
92
- inputSchema: {
93
- type: 'object',
94
- properties: {
95
- instance_id: { type: 'string', description: 'UUID of the instance' },
96
- key: { type: 'string', description: 'Cache key to retrieve' },
97
- },
98
- required: ['instance_id', 'key'],
99
- },
100
- },
101
- {
102
- name: 'cache_set',
103
- description:
104
- 'Set a key-value pair in a running cache instance. ' +
105
- 'Overwrites any existing value at the key — not idempotent for new data. ' +
106
- 'Returns "OK" on success; returns an error if the instance_id is invalid or the instance is paused. ' +
107
- 'Value can be a string or a JSON-serialized object. Optionally set a TTL in seconds (omit for no expiry). ' +
108
- 'Use cache_mset instead for setting multiple keys in a single pipeline round-trip. ' +
109
- 'Use cache_stream_set instead for caching LLM token streams (ordered string chunks).',
110
- inputSchema: {
111
- type: 'object',
112
- properties: {
113
- instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
114
- key: { type: 'string', description: 'Cache key' },
115
- value: { type: 'string', description: 'Value to store (string or JSON)' },
116
- ttl: { type: 'number', description: 'Time-to-live in seconds (optional, omit for no expiry)' },
117
- },
118
- required: ['instance_id', 'key', 'value'],
119
- },
120
- },
121
- {
122
- name: 'cache_delete',
123
- description:
124
- 'Permanently delete one or more keys from a running cache instance (uses Redis DEL). ' +
125
- 'This operation is destructive and irreversible — deleted keys cannot be recovered. ' +
126
- 'Deleting a non-existent key is safe and returns 0 for that key (no error). ' +
127
- 'Returns the count of keys that were actually deleted (existing keys only). ' +
128
- 'Use this to explicitly remove stale entries; prefer cache_set with a short TTL for auto-expiring data. ' +
129
- 'Do NOT use this to clear an entire instance — use the dashboard or delete_instance for that.',
130
- inputSchema: {
131
- type: 'object',
132
- properties: {
133
- instance_id: { type: 'string', description: 'UUID of the cache instance to delete keys from (get from list_instances)' },
134
- keys: {
135
- type: 'array',
136
- items: { type: 'string' },
137
- description: 'One or more cache keys to delete. Accepts exact keys only (no glob patterns — use cache_keys to list first).',
138
- },
139
- },
140
- required: ['instance_id', 'keys'],
141
- },
142
- },
143
- {
144
- name: 'cache_exists',
145
- description:
146
- 'Check whether one or more keys exist in a running cache instance (uses Redis EXISTS). ' +
147
- 'Read-only — no side effects. Returns the count of keys that currently exist (integer 0 to N). ' +
148
- 'If none of the keys exist, returns 0. If all exist, returns the total key count passed in. ' +
149
- 'Duplicate keys in the input array are each counted separately (Redis behavior). ' +
150
- 'Use this to check presence before a cache_get to avoid null handling, or to verify a cache warm-up completed. ' +
151
- 'Use cache_get instead if you also need the value; use cache_ttl if you need expiry info.',
152
- inputSchema: {
153
- type: 'object',
154
- properties: {
155
- instance_id: { type: 'string', description: 'UUID of the cache instance to check (get from list_instances)' },
156
- keys: { type: 'array', items: { type: 'string' }, description: 'Keys to check for existence. Accepts exact keys only (no glob patterns).' },
157
- },
158
- required: ['instance_id', 'keys'],
159
- },
160
- },
161
- {
162
- name: 'cache_ttl',
163
- description:
164
- 'Get the remaining time-to-live (TTL) of a key in seconds. ' +
165
- 'Returns -1 if the key exists but has no expiry, -2 if the key does not exist. ' +
166
- 'Read-only — no side effects. ' +
167
- 'Use cache_set with a ttl parameter to set or update the expiry.',
168
- inputSchema: {
169
- type: 'object',
170
- properties: {
171
- instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
172
- key: { type: 'string', description: 'Cache key to inspect' },
173
- },
174
- required: ['instance_id', 'key'],
175
- },
176
- },
177
- {
178
- name: 'cache_keys',
179
- description:
180
- 'List keys in a cache instance matching an optional glob pattern (e.g. "user:*", "session:*"). ' +
181
- 'Uses SCAN to avoid blocking the server. Returns at most `count` keys.',
182
- inputSchema: {
183
- type: 'object',
184
- properties: {
185
- instance_id: { type: 'string' },
186
- pattern: { type: 'string', description: 'Glob pattern (default: *)' },
187
- count: { type: 'number', description: 'Max keys to return (default: 50, max: 500)' },
188
- },
189
- required: ['instance_id'],
190
- },
191
- },
192
- {
193
- name: 'cache_stats',
194
- description:
195
- 'Get real-time stats for a cache instance: memory usage, hit/miss rate, commands/sec, ' +
196
- 'connected clients, keyspace info, and uptime. Read-only — no side effects. ' +
197
- 'The instance_id identifies the target instance (obtain from list_instances). ' +
198
- 'Use this for monitoring, capacity planning, or debugging performance issues — ' +
199
- 'not for reading cached values (use cache_get for that). ' +
200
- 'Use cache_exists or cache_ttl if you only need key-level information.',
201
- inputSchema: {
202
- type: 'object',
203
- properties: {
204
- instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
205
- },
206
- required: ['instance_id'],
207
- },
208
- },
209
- {
210
- name: 'semantic_search',
211
- description:
212
- 'Find cached entries that are semantically similar to a natural-language query. ' +
213
- 'Read-only — no side effects. ' +
214
- 'Returns an array of objects, each with: key, value, similarity_score (0–1), and namespace. ' +
215
- 'Returns an empty array if no entries meet the similarity threshold. ' +
216
- 'Requires OPENAI_API_KEY (or compatible provider) and the Speed/Business tier with CACHLY_VECTOR_URL. ' +
217
- 'Embeddings are computed server-side and never leave Germany (pgvector HNSW index). ' +
218
- 'Example: "find all cached responses about password reset" or "what did we answer about pricing?". ' +
219
- 'Use cache_get for exact key lookup; use smart_recall for brain lessons.',
220
- inputSchema: {
221
- type: 'object',
222
- properties: {
223
- instance_id: { type: 'string', description: 'UUID of the cache instance (from list_instances)' },
224
- query: { type: 'string', description: 'Natural-language query to find similar cached content' },
225
- threshold: {
226
- type: 'number',
227
- description: 'Minimum cosine similarity 0–1 (default: 0.82). Lower = broader matches.',
228
- },
229
- namespace: {
230
- type: 'string',
231
- description: 'Semantic namespace to search in (default: cachly:sem)',
232
- },
233
- top_k: {
234
- type: 'number',
235
- description: 'Maximum number of results to return (default: 5)',
236
- },
237
- use_hybrid: {
238
- type: 'boolean',
239
- description:
240
- 'Enable Hybrid BM25+Vector RRF fusion search. ' +
241
- 'Passes `hybrid: true` and the query text to the pgvector API for higher precision on named entities. ' +
242
- 'Default: false.',
243
- },
244
- auto_namespace: {
245
- type: 'boolean',
246
- description:
247
- 'Auto-detect the namespace from the query text using text heuristics ' +
248
- 'instead of using the `namespace` parameter. ' +
249
- 'Returns results only from the matching domain (code/translation/summary/qa/creative).',
250
- },
251
- },
252
- required: ['instance_id', 'query'],
253
- },
254
- },
255
- {
256
- name: 'detect_namespace',
257
- description:
258
- 'Classify a prompt into one of 5 semantic namespaces using text heuristics. ' +
259
- 'Overhead: <0.1 ms, no embedding required. ' +
260
- 'Useful to understand which namespace cachly will use for a given prompt. ' +
261
- 'Returns one of: cachly:sem:code, cachly:sem:translation, cachly:sem:summary, ' +
262
- 'cachly:sem:qa, cachly:sem:creative.',
263
- inputSchema: {
264
- type: 'object',
265
- properties: {
266
- prompt: { type: 'string', description: 'The text prompt to classify into a semantic namespace' },
267
- },
268
- required: ['prompt'],
269
- },
270
- },
271
- {
272
- name: 'cache_warmup',
273
- description:
274
- 'Pre-warm the semantic cache with a list of prompt/value pairs. ' +
275
- 'For each entry: computes an embedding, checks if a similar entry already exists ' +
276
- '(similarity ≥ 0.98), and writes new entries to Valkey + pgvector index. ' +
277
- 'Use this to seed FAQ responses, product descriptions, or known-good LLM answers ' +
278
- 'before the first real user traffic. Requires OPENAI_API_KEY.',
279
- inputSchema: {
280
- type: 'object',
281
- properties: {
282
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
283
- entries: {
284
- type: 'array',
285
- description: 'List of prompt/value pairs to pre-warm into the cache',
286
- items: {
287
- type: 'object',
288
- properties: {
289
- prompt: { type: 'string', description: 'The query or question to cache' },
290
- value: { type: 'string', description: 'The answer or response to store for this prompt' },
291
- namespace: { type: 'string', description: 'Optional per-entry namespace override' },
292
- },
293
- required: ['prompt', 'value'],
294
- },
295
- },
296
- namespace: {
297
- type: 'string',
298
- description: 'Default namespace for all entries (default: cachly:sem)',
299
- },
300
- ttl: {
301
- type: 'number',
302
- description: 'Time-to-live in seconds for warmed entries (omit for no expiry)',
303
- },
304
- auto_namespace: {
305
- type: 'boolean',
306
- description:
307
- 'Auto-detect the namespace per prompt using text heuristics. ' +
308
- 'Overrides `namespace` when no per-entry namespace is set.',
309
- },
310
- },
311
- required: ['instance_id', 'entries'],
312
- },
313
- },
314
- {
315
- name: 'index_project',
316
- description:
317
- 'Index local source files into the cachly semantic cache so AI assistants can use ' +
318
- 'semantic_search to find relevant files instead of re-reading the whole codebase every time. ' +
319
- 'Walks a directory recursively, reads each matching file, and stores a summary + path ' +
320
- 'as a semantic cache entry (prompt = file path + content excerpt, value = relative path). ' +
321
- 'Requires an embedding provider (OPENAI_API_KEY or CACHLY_EMBED_PROVIDER + key). ' +
322
- 'Run once, then re-run after major refactors. TTL=86400 (24h) keeps entries fresh.',
323
- inputSchema: {
324
- type: 'object',
325
- properties: {
326
- instance_id: { type: 'string', description: 'UUID of the cachly instance' },
327
- dir: {
328
- type: 'string',
329
- description: 'Absolute path to the directory to index (e.g. /Users/you/myproject/src)',
330
- },
331
- extensions: {
332
- type: 'array',
333
- items: { type: 'string' },
334
- description: 'File extensions to include (default: ["ts","js","go","py","java","rs","md","kt","swift"])',
335
- },
336
- max_files: {
337
- type: 'number',
338
- description: 'Maximum number of files to index (default: 100)',
339
- },
340
- ttl: {
341
- type: 'number',
342
- description: 'TTL in seconds for indexed entries (default: 86400 = 24 h)',
343
- },
344
- summary_chars: {
345
- type: 'number',
346
- description: 'Characters to use as summary per file (default: 1200)',
347
- },
348
- namespace: {
349
- type: 'string',
350
- description: 'Semantic namespace to store under (default: cachly:sem:code)',
351
- },
352
- },
353
- required: ['instance_id', 'dir'],
354
- },
355
- },
356
- // ── Bulk operations ──────────────────────────────────────────────────────
357
- {
358
- name: 'cache_mset',
359
- description:
360
- 'Set multiple key-value pairs in a single pipeline round-trip. ' +
361
- 'Supports per-key TTL – unlike native MSET. ' +
362
- 'Uses one TCP round-trip for N keys via Redis pipeline. ' +
363
- 'Each item overwrites any existing value for that key. ' +
364
- 'On partial failure the successfully pipelined keys are committed; a per-key error list is returned for any that failed. ' +
365
- 'Returns a summary: { set: N, errors: [...] }. ' +
366
- 'Use cache_set for a single key; use cache_stream_set for large streaming payloads.',
367
- inputSchema: {
368
- type: 'object',
369
- properties: {
370
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
371
- items: {
372
- type: 'array',
373
- description: 'Key-value pairs to set',
374
- items: {
375
- type: 'object',
376
- properties: {
377
- key: { type: 'string', description: 'Cache key' },
378
- value: { description: 'Value to store (JSON-serialised)' },
379
- ttl: { type: 'number', description: 'Per-key TTL in seconds (optional)' },
380
- },
381
- required: ['key', 'value'],
382
- },
383
- },
384
- },
385
- required: ['instance_id', 'items'],
386
- },
387
- },
388
- {
389
- name: 'cache_mget',
390
- description:
391
- 'Retrieve multiple keys in one round-trip using native Redis MGET. ' +
392
- 'Returns values in the same order as the keys array; missing keys are null.',
393
- inputSchema: {
394
- type: 'object',
395
- properties: {
396
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
397
- keys: { type: 'array', items: { type: 'string' }, description: 'List of keys to fetch' },
398
- },
399
- required: ['instance_id', 'keys'],
400
- },
401
- },
402
- // ── Distributed lock ──────────────────────────────────────────────────────
403
- {
404
- name: 'cache_lock_acquire',
405
- description:
406
- 'Acquire a distributed lock using Redis SET NX PX (Redlock-lite). ' +
407
- 'Returns a fencing token on success. The lock auto-expires after ttl_ms to prevent deadlocks. ' +
408
- 'Use cache_lock_release to free the lock early.',
409
- inputSchema: {
410
- type: 'object',
411
- properties: {
412
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
413
- key: { type: 'string', description: 'Lock resource identifier' },
414
- ttl_ms: { type: 'number', description: 'Safety TTL in milliseconds (e.g. 5000)' },
415
- retries: { type: 'number', description: 'Max acquire attempts (default: 3)' },
416
- retry_delay_ms: { type: 'number', description: 'Milliseconds between retries (default: 50)' },
417
- },
418
- required: ['instance_id', 'key', 'ttl_ms'],
419
- },
420
- },
421
- {
422
- name: 'cache_lock_release',
423
- description:
424
- 'Release a previously acquired distributed lock. ' +
425
- 'Uses a Lua script for atomic release – only deletes the key if the fencing token matches.',
426
- inputSchema: {
427
- type: 'object',
428
- properties: {
429
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
430
- key: { type: 'string', description: 'Lock resource identifier (same as in cache_lock_acquire)' },
431
- token: { type: 'string', description: 'Fencing token returned by cache_lock_acquire' },
432
- },
433
- required: ['instance_id', 'key', 'token'],
434
- },
435
- },
436
- // ── Auth & API-Status ─────────────────────────────────────────────────────
437
- {
438
- name: 'get_api_status',
439
- description:
440
- 'Full diagnostic for your cachly Brain — call this FIRST whenever anything is not working. ' +
441
- 'Returns: API reachability, JWT validity + expiry, your user ID, ' +
442
- 'all Brain instances with live status (🟢 running / 🟡 provisioning / 🔴 stopped), ' +
443
- 'Redis ping on the active connection, and actionable fix steps for every issue found. ' +
444
- 'Workflow: run get_api_status → read the issue it flags → fix it → retry your tool.',
445
- inputSchema: { type: 'object', properties: {}, required: [] },
446
- },
447
- // ── Thinking/Context Cache (for AI assistants) ────────────────────────────
448
- {
449
- name: 'remember_context',
450
- description:
451
- 'Save context information to the cache so you can recall it later without re-computing. ' +
452
- 'Perfect for caching: codebase overviews, file summaries, project structure, ' +
453
- 'frequently-accessed data, or "thinking" results like dependency analysis. ' +
454
- 'The AI assistant can use this to avoid re-reading the entire codebase every time. ' +
455
- 'Overwrites any existing value stored under the same key. ' +
456
- 'Returns { key, stored_at, ttl } confirming the saved context. ' +
457
- 'Example: remember_context("project overview", "This is a Next.js app with...") ' +
458
- 'then later: recall_context("project overview"). ' +
459
- 'Use recall_context to retrieve; use list_remembered to see all stored keys.',
460
- inputSchema: {
461
- type: 'object',
462
- properties: {
463
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
464
- key: { type: 'string', description: 'Descriptive key like "project_overview", "auth_architecture", "file:src/index.ts"' },
465
- content: { type: 'string', description: 'The context/summary/analysis to remember' },
466
- category: {
467
- type: 'string',
468
- enum: ['overview', 'architecture', 'file_summary', 'dependency', 'thinking', 'custom'],
469
- description: 'Category for organization (default: custom)',
470
- },
471
- ttl: { type: 'number', description: 'Time-to-live in seconds (default: 86400 = 24h, use 0 for no expiry)' },
472
- },
473
- required: ['instance_id', 'key', 'content'],
474
- },
475
- },
476
- {
477
- name: 'recall_context',
478
- description:
479
- 'Retrieve previously saved context from the cache. ' +
480
- 'Returns the saved content or null if not found. ' +
481
- 'Use this at the START of any task to check if you already have relevant context cached, ' +
482
- 'before doing expensive operations like reading many files. ' +
483
- 'Supports glob patterns: "file:*" matches all file summaries, "arch*" matches architecture-related keys.',
484
- inputSchema: {
485
- type: 'object',
486
- properties: {
487
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
488
- key: { type: 'string', description: 'The key to look up (supports glob pattern like "file:*")' },
489
- },
490
- required: ['instance_id', 'key'],
491
- },
492
- },
493
- {
494
- name: 'list_remembered',
495
- description:
496
- 'List all cached context entries for this project. ' +
497
- 'Shows what knowledge the AI assistant has already cached, so you can decide ' +
498
- 'whether to recall existing context or refresh it. ' +
499
- 'Returns: key, category, size, TTL remaining, and a content preview.',
500
- inputSchema: {
501
- type: 'object',
502
- properties: {
503
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
504
- category: {
505
- type: 'string',
506
- enum: ['overview', 'architecture', 'file_summary', 'dependency', 'thinking', 'custom', 'all'],
507
- description: 'Filter by category (default: all)',
508
- },
509
- limit: { type: 'number', description: 'Max entries to return (default: 50)' },
510
- },
511
- required: ['instance_id'],
512
- },
513
- },
514
- {
515
- name: 'forget_context',
516
- description:
517
- 'Delete one or more cached context entries. ' +
518
- 'Use when context is stale or you want to force a fresh analysis. ' +
519
- 'Supports glob patterns: "file:*" deletes all file summaries.',
520
- inputSchema: {
521
- type: 'object',
522
- properties: {
523
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
524
- keys: { type: 'array', items: { type: 'string' }, description: 'Keys to delete (supports glob)' },
525
- },
526
- required: ['instance_id', 'keys'],
527
- },
528
- },
529
- {
530
- name: 'learn_from_attempts',
531
- description:
532
- 'Store a lesson learned from a failed or successful attempt. ' +
533
- 'Call this AFTER completing any non-trivial task (deploy, debug, fix, architecture decision). ' +
534
- 'The lesson will be recalled automatically in future sessions via recall_best_solution. ' +
535
- 'Fields: topic (short slug like "deploy:web"), outcome ("success"|"failure"), ' +
536
- 'what_worked (what solved it), what_failed (what did NOT work), context (extra details). ' +
537
- 'Supports structured metadata: severity, file_paths (files involved), commands (working commands), tags. ' +
538
- 'Deduplication: if a lesson for this topic already exists, it is updated with full audit trail. ' +
539
- 'Contradiction detection: warns if new outcome conflicts with existing lesson outcome. ' +
540
- 'Confidence: lesson starts at 1.0, decays after 5d (→0.7) and 10d (→0.5) without recall. ' +
541
- '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"])',
542
- inputSchema: {
543
- type: 'object',
544
- properties: {
545
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
546
- topic: { type: 'string', description: 'Short slug, e.g. "deploy:web", "debug:redis-tls", "fix:generate-series"' },
547
- outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Did it work?' },
548
- what_worked: { type: 'string', description: 'What solved the problem or what approach succeeded' },
549
- what_failed: { type: 'string', description: 'What did NOT work (optional but valuable)' },
550
- context: { type: 'string', description: 'Additional context, error messages, root cause (optional)' },
551
- severity: {
552
- type: 'string',
553
- enum: ['critical', 'major', 'minor'],
554
- description: 'Impact severity: critical (blocks work/deploy), major (significant slowdown), minor (nice to know). Default: major.',
555
- },
556
- file_paths: {
557
- type: 'array',
558
- items: { type: 'string' },
559
- description: 'Files involved in this lesson (e.g. ["infra/deploy.sh", ".env"])',
560
- },
561
- commands: {
562
- type: 'array',
563
- items: { type: 'string' },
564
- description: 'Commands that worked or failed (e.g. ["rsync -avz ...", "docker compose up -d"])',
565
- },
566
- tags: {
567
- type: 'array',
568
- items: { type: 'string' },
569
- description: 'Topic tags for filtering (e.g. ["bash", "deploy", "env"])',
570
- },
571
- depends_on: {
572
- type: 'array',
573
- items: { type: 'string' },
574
- 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.',
575
- },
576
- author: {
577
- type: 'string',
578
- 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. Also powers brain_who_knows and team_expertise_map.',
579
- },
580
- visibility: {
581
- type: 'string',
582
- enum: ['team', 'private', 'public'],
583
- description: 'Who can see this lesson. "team" (default) = all team members. "private" = only accessible via exact recall_best_solution, never surfaced in smart_recall or team_recall. "public" = same as team (public syndication planned).',
584
- },
585
- },
586
- required: ['instance_id', 'topic', 'outcome', 'what_worked'],
587
- },
588
- },
589
- {
590
- name: 'recall_best_solution',
591
- description:
592
- 'Recall the best known solution for a topic from past lessons. ' +
593
- 'Call this BEFORE attempting any task that might have been done before. ' +
594
- 'Returns the most recent successful lesson for the topic, with confidence indicator. ' +
595
- '⚠️ badge = lesson is >5d old (verify before applying). 🔴 = >10d old (likely stale!). ' +
596
- 'Recalling a lesson resets its confidence clock to 1.0 (marks as recently verified). ' +
597
- 'Example: recall_best_solution(topic="deploy:web") → returns the working deploy command.',
598
- inputSchema: {
599
- type: 'object',
600
- properties: {
601
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
602
- topic: { type: 'string', description: 'Topic slug to look up, e.g. "deploy:web". Supports partial match.' },
603
- },
604
- required: ['instance_id', 'topic'],
605
- },
606
- },
607
- {
608
- name: 'smart_recall',
609
- description:
610
- 'Semantically search cached context using natural language. ' +
611
- 'Instead of exact key matching, finds context by meaning. ' +
612
- 'Example: smart_recall("how does authentication work") → returns cached auth architecture summary. ' +
613
- 'Falls back to remember_context keys if no semantic match is found.',
614
- inputSchema: {
615
- type: 'object',
616
- properties: {
617
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
618
- query: { type: 'string', description: 'Natural language query to find relevant cached context' },
619
- threshold: { type: 'number', description: 'Similarity threshold 0-1 (default: 0.78)' },
620
- author: { type: 'string', description: 'Handle of the person doing the recall (optional). Enables team-knowledge-reuse tracking: when you recall a lesson written by a teammate, cachly counts it as cross-author reuse — the value only a shared brain delivers.' },
621
- },
622
- required: ['instance_id', 'query'],
623
- },
624
- },
625
- {
626
- name: 'session_start',
627
- description:
628
- 'Single-call session briefing. Call this at the START of every session INSTEAD of multiple separate smart_recall/recall_best_solution calls. ' +
629
- 'Returns: last session summary, recent lessons sorted by recency, relevant lessons for your focus area, ' +
630
- 'open failures (topics with only failure outcomes), brain health stats, team telepathy (what teammates learned this week), ' +
631
- 'predictive pre-warnings (if your focus area has known failure patterns), and memory crystals (compressed wisdom from old sessions). ' +
632
- 'Also saves a session start marker so session_end can compute duration.',
633
- inputSchema: {
634
- type: 'object',
635
- properties: {
636
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
637
- focus: {
638
- type: 'string',
639
- description: 'Keywords for what you plan to work on today (e.g. "deploy infra api"). Used to surface relevant lessons at the top.',
640
- },
641
- author: {
642
- type: 'string',
643
- description: 'Your name or handle (e.g. "alice"). Enables Team Telepathy — filters YOUR lessons vs TEAM lessons from past 7 days.',
644
- },
645
- provider: {
646
- type: 'string',
647
- 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.',
648
- },
649
- workspace_path: {
650
- type: 'string',
651
- 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.',
652
- },
653
- },
654
- required: ['instance_id'],
655
- },
656
- },
657
- {
658
- name: 'session_end',
659
- description:
660
- 'Save a session summary when you finish working. ' +
661
- 'Records what was accomplished, files changed, and lesson count. ' +
662
- 'The next session_start will show this summary as "Last session". ' +
663
- 'Call this when ending a work session, before going idle, or before summarizing. ' +
664
- 'Ambient Learning: if workspace_path is provided, reads git log since session start and auto-learns from commits.',
665
- inputSchema: {
666
- type: 'object',
667
- properties: {
668
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
669
- summary: {
670
- type: 'string',
671
- description: 'Brief summary of what was accomplished this session (2-3 sentences)',
672
- },
673
- files_changed: {
674
- type: 'array',
675
- items: { type: 'string' },
676
- description: 'Key files changed this session (optional)',
677
- },
678
- lessons_learned: {
679
- type: 'number',
680
- description: 'Number of new lessons stored this session (optional)',
681
- },
682
- workspace_path: {
683
- type: 'string',
684
- 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.',
685
- },
686
- },
687
- required: ['instance_id', 'summary'],
688
- },
689
- },
690
- // ── Session Handoff — cross-window continuity ─────────────────────────────
691
- {
692
- name: 'session_handoff',
693
- description:
694
- 'Save a detailed handoff for the NEXT chat window / session. ' +
695
- 'Stores: current progress, TODO list (done + remaining), changed files with descriptions, ' +
696
- 'instructions for the next assistant, and any incomplete work. ' +
697
- 'The next session_start automatically includes this handoff so the new window knows EXACTLY what happened and what remains. ' +
698
- 'Call this BEFORE closing a chat window, especially if work is incomplete. ' +
699
- 'This prevents the "continue" problem where new windows lose context, skip tasks, or produce broken code.',
700
- inputSchema: {
701
- type: 'object',
702
- properties: {
703
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
704
- completed_tasks: {
705
- type: 'array',
706
- items: { type: 'string' },
707
- description: 'Tasks that were fully completed (e.g. "Implemented brainSearch() in JS SDK")',
708
- },
709
- remaining_tasks: {
710
- type: 'array',
711
- items: { type: 'string' },
712
- description: 'Tasks NOT yet done — the next window MUST pick these up',
713
- },
714
- files_changed: {
715
- type: 'array',
716
- items: {
717
- type: 'object',
718
- properties: {
719
- path: { type: 'string', description: 'File path relative to project root' },
720
- status: { type: 'string', enum: ['complete', 'partial', 'broken'], description: 'State of this file' },
721
- description: { type: 'string', description: 'What was changed and what still needs work' },
722
- },
723
- required: ['path', 'status'],
724
- },
725
- description: 'Changed files with their current state — marks partial/broken files so next window knows to fix them',
726
- },
727
- instructions: {
728
- type: 'string',
729
- description: 'Free-form instructions for the next assistant. Be specific: what to do next, what to avoid, what broke.',
730
- },
731
- context_summary: {
732
- type: 'string',
733
- description: 'Brief summary of what happened this session (architecture decisions, key findings, blockers)',
734
- },
735
- blocked_on: {
736
- type: 'string',
737
- description: 'If work is blocked, describe what is needed to unblock (e.g. "waiting for API deploy", "needs user input on design")',
738
- },
739
- },
740
- required: ['instance_id', 'completed_tasks', 'remaining_tasks'],
741
- },
742
- },
743
- // ── session_ping — lightweight in-session checkpoint ─────────────────────
744
- {
745
- name: 'session_ping',
746
- description:
747
- 'Lightweight checkpoint — call this every ~5 tool calls or whenever you complete a significant step. ' +
748
- 'Stores the current task + files touched so session_start on the NEXT provider can reconstruct what happened ' +
749
- 'even if session_end was never called (e.g. Claude context limit hit, window crashed). ' +
750
- 'This solves the provider-switching problem: Claude → Copilot → Cursor all see the same last checkpoint. ' +
751
- 'Extremely fast — one Redis SET, no blocking operations.',
752
- inputSchema: {
753
- type: 'object',
754
- properties: {
755
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
756
- task: {
757
- type: 'string',
758
- description: 'What you are currently working on (e.g. "Implementing invite handler in handler/invite.go")',
759
- },
760
- files_touched: {
761
- type: 'array',
762
- items: { type: 'string' },
763
- description: 'Files modified so far this session',
764
- },
765
- next_step: {
766
- type: 'string',
767
- description: 'What the NEXT step is after this checkpoint (helps next provider resume immediately)',
768
- },
769
- provider: {
770
- type: 'string',
771
- description: 'Current AI provider (e.g. "claude-code", "copilot", "cursor", "windsurf")',
772
- },
773
- },
774
- required: ['instance_id', 'task'],
775
- },
776
- },
777
- // ── AI Brain — Extended features ─────────────────────────────────────────
778
- {
779
- name: 'auto_learn_session',
780
- description:
781
- 'Auto-learn from a list of session observations WITHOUT explicit learn_from_attempts calls. ' +
782
- 'Pass what happened (commands run, errors seen, solutions found) and the brain classifies and stores lessons automatically. ' +
783
- 'Use at session_end to capture everything you did, even if you forgot to call learn_from_attempts. ' +
784
- 'Returns a summary of what was auto-stored.',
785
- inputSchema: {
786
- type: 'object',
787
- properties: {
788
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
789
- observations: {
790
- type: 'array',
791
- description: 'List of observations from this session',
792
- items: {
793
- type: 'object',
794
- properties: {
795
- action: { type: 'string', description: 'What was tried (command, approach, code change)' },
796
- outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Result' },
797
- details: { type: 'string', description: 'Error message, output, or explanation' },
798
- topic: { type: 'string', description: 'Optional topic key (auto-generated if omitted)' },
799
- severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity (default: minor)' },
800
- },
801
- required: ['action', 'outcome'],
802
- },
803
- },
804
- },
805
- required: ['instance_id', 'observations'],
806
- },
807
- },
808
- {
809
- name: 'brain_who_knows',
810
- description:
811
- 'Find who in your team has the most expertise on a given topic. ' +
812
- 'Queries the org-wide knowledge graph (built automatically from learn_from_attempts author fields) ' +
813
- 'and returns a ranked list of contributors whose lessons match the query, ordered by lesson count and confidence. ' +
814
- 'Use to find the right person to ask before starting a task, or to understand knowledge distribution. ' +
815
- 'Example: brain_who_knows(topic="kubernetes deployment") → "🥇 alice — 5 lessons, 94% confidence".',
816
- inputSchema: {
817
- type: 'object',
818
- properties: {
819
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
820
- topic: { type: 'string', description: 'Topic or question to find experts for' },
821
- limit: { type: 'number', description: 'Max number of experts to return (default: 10)' },
822
- },
823
- required: ['instance_id', 'topic'],
824
- },
825
- },
826
- {
827
- name: 'brain_file_map',
828
- description:
829
- 'Show what cachly knows about a list of files — experts + related lessons per file. ' +
830
- 'Call this before starting work on unfamiliar files, or in sync_file_changes to see what knowledge exists. ' +
831
- 'For each file path: shows who has previously touched it (from learn_from_attempts author+file_paths) ' +
832
- 'and which lessons reference it. ' +
833
- 'Example: brain_file_map(file_paths=["src/auth/jwt.ts"]) → "🥇 alice (3× · today) — related: fix:jwt-expiry".',
834
- inputSchema: {
835
- type: 'object',
836
- properties: {
837
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
838
- file_paths: {
839
- type: 'array',
840
- items: { type: 'string' },
841
- description: 'File paths to look up (max 10)',
842
- },
843
- },
844
- required: ['instance_id', 'file_paths'],
845
- },
846
- },
847
- {
848
- name: 'team_expertise_map',
849
- description:
850
- 'Full team expertise overview — who knows what, at a glance. ' +
851
- 'Returns a ranked table of all contributors with their lesson count, top domains, and last-active date. ' +
852
- 'Use for onboarding (who to ask about X?), retrospectives, or to find knowledge gaps. ' +
853
- 'Built automatically from learn_from_attempts(author=...) calls — no setup needed.',
854
- inputSchema: {
855
- type: 'object',
856
- properties: {
857
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
858
- top_n: { type: 'number', description: 'Max contributors to show (default: 20)' },
859
- },
860
- required: ['instance_id'],
861
- },
862
- },
863
- {
864
- name: 'skill_gaps',
865
- description:
866
- 'Show knowledge blind spots in your Brain — domains with unresolved failures, ' +
867
- 'lessons with missing attribution, and areas where brain_who_knows cannot help. ' +
868
- 'Run periodically to find where to focus knowledge capture effort. ' +
869
- 'Returns a prioritized list: 🔴 critical (failures with no solutions) → 🟡 warn → 🔵 info. ' +
870
- 'Pairs with brain_coverage for a full knowledge-health picture.',
871
- inputSchema: {
872
- type: 'object',
873
- properties: {
874
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
875
- min_failures: { type: 'number', description: 'Min failure count to flag a domain as a gap (default: 1)' },
876
- },
877
- required: ['instance_id'],
878
- },
879
- },
880
- {
881
- name: 'brain_coverage',
882
- description:
883
- 'Knowledge-coverage health score for your codebase — scored 0-100. ' +
884
- 'Reports: total lessons, success ratio, attribution completeness, team engagement, and file coverage vs git ls-files. ' +
885
- 'Run after brain_from_git or periodically to track knowledge-capture progress. ' +
886
- 'Use skill_gaps to find what to fix. ' +
887
- 'Example: brain_coverage() → "🟢 Overall score: 78/100 · 42 lessons · 6 contributors · 31% files covered".',
888
- inputSchema: {
889
- type: 'object',
890
- properties: {
891
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
892
- repo_path: { type: 'string', description: 'Path to the git repository (default: current directory)' },
893
- },
894
- required: ['instance_id'],
895
- },
896
- },
897
- {
898
- name: 'brain_metrics',
899
- description:
900
- 'Report the three decisive Brain metrics: (1) time-to-first-recall (onboarding friction), ' +
901
- '(2) recall-lift vs. raw BM25 (the moat proof, from Cachly-Bench), and ' +
902
- '(3) team-knowledge-reuse — what % of proven recalls used a teammate\'s lesson. ' +
903
- 'Use to track whether the Brain is delivering its core value. ' +
904
- 'Pass author="handle" to smart_recall so cross-author reuse can be measured.',
905
- inputSchema: {
906
- type: 'object',
907
- properties: {
908
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
909
- },
910
- required: ['instance_id'],
911
- },
912
- },
913
- {
914
- name: 'sync_file_changes',
915
- description:
916
- 'Associate recent file changes with brain knowledge. ' +
917
- 'Pass a list of changed file paths (from `git diff --stat`). ' +
918
- 'Returns lessons relevant to those files, and records the file changes in session history. ' +
919
- 'Call this after commits so the brain tracks what changed and why.',
920
- inputSchema: {
921
- type: 'object',
922
- properties: {
923
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
924
- changed_files: { type: 'array', items: { type: 'string' }, description: 'List of changed file paths' },
925
- git_diff_stat: { type: 'string', description: 'Output of `git diff --stat` (optional)' },
926
- commit_msg: { type: 'string', description: 'Commit message (optional)' },
927
- },
928
- required: ['instance_id', 'changed_files'],
929
- },
930
- },
931
- {
932
- name: 'team_learn',
933
- description:
934
- 'Store a lesson in a shared team brain so all team members benefit. ' +
935
- 'Like learn_from_attempts, but REQUIRES an author name for attribution. ' +
936
- 'Shows up in team_recall with "by <author>" so the team knows who learned it.',
937
- inputSchema: {
938
- type: 'object',
939
- properties: {
940
- instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
941
- author: { type: 'string', description: 'Your name or handle (required for team attribution)' },
942
- topic: { type: 'string', description: 'Topic in category:keyword format (e.g. "deploy:api")' },
943
- outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'What happened' },
944
- what_worked: { type: 'string', description: 'What worked (the solution)' },
945
- what_failed: { type: 'string', description: 'What did NOT work (avoid this)' },
946
- severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Impact level' },
947
- file_paths: { type: 'array', items: { type: 'string' }, description: 'Relevant file paths' },
948
- commands: { type: 'array', items: { type: 'string' }, description: 'Commands that worked' },
949
- tags: { type: 'array', items: { type: 'string' }, description: 'Tags for categorization' },
950
- },
951
- required: ['instance_id', 'author', 'topic', 'outcome', 'what_worked'],
952
- },
953
- },
954
- {
955
- name: 'team_confirm',
956
- description:
957
- 'Endorse (review-confirm) a team lesson so trusted, human-reviewed knowledge ranks above unreviewed auto-learned entries. ' +
958
- 'A senior review weighs more than a peer review; distinct endorsements add a small boost. ' +
959
- 'Confirmed lessons surface higher in smart_recall and team_recall and carry a 🛡️/✔️ badge. ' +
960
- 'Use this in code review or knowledge reviews to bless the canonical solution for a topic.',
961
- inputSchema: {
962
- type: 'object',
963
- properties: {
964
- instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
965
- topic: { type: 'string', description: 'Topic slug of the lesson to confirm (e.g. "deploy:api")' },
966
- reviewer: { type: 'string', description: 'Your name or handle (the reviewer endorsing this lesson)' },
967
- level: { type: 'string', enum: ['senior', 'peer'], description: 'Review weight — "senior" ranks higher than "peer" (default: peer)' },
968
- note: { type: 'string', description: 'Optional review note (kept in the lesson audit trail)' },
969
- },
970
- required: ['instance_id', 'topic', 'reviewer'],
971
- },
972
- },
973
- {
974
- name: 'team_recall',
975
- description:
976
- 'Recall lessons from a shared team brain, showing who learned what. ' +
977
- 'Works on any shared instance (all team members using the same instance_id). ' +
978
- 'Shows author, recency, and severity for each lesson. ' +
979
- 'Use this to onboard new team members or find who knows about a topic.',
980
- inputSchema: {
981
- type: 'object',
982
- properties: {
983
- instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
984
- topic: { type: 'string', description: 'Topic or keyword to filter lessons (optional)' },
985
- author: { type: 'string', description: 'Filter by author name (optional)' },
986
- limit: { type: 'number', description: 'Max lessons to return (default: 10)' },
987
- },
988
- required: ['instance_id'],
989
- },
990
- },
991
- {
992
- name: 'team_synthesize',
993
- description:
994
- 'Team Brain Synthesis — merge multiple contributors\' lessons on the same topic into one canonical version. ' +
995
- 'When 2+ developers store lessons for the same topic with different details, this proposes the best merged version. ' +
996
- 'Shows: all contributions by author, what worked (consensus), what failed (union), canonical lesson to store. ' +
997
- 'Use this when onboarding new team members or before documenting a process.',
998
- inputSchema: {
999
- type: 'object',
1000
- properties: {
1001
- instance_id: { type: 'string', description: 'UUID of the shared team brain instance' },
1002
- topic: { type: 'string', description: 'Topic slug to synthesize (e.g. "deploy:api")' },
1003
- },
1004
- required: ['instance_id', 'topic'],
1005
- },
1006
- },
1007
- {
1008
- name: 'memory_crystalize',
1009
- description:
1010
- 'Compress the last 30-50 sessions and auto-learned lessons into a dense Memory Crystal. ' +
1011
- 'A crystal is a compact, structured summary of everything the brain learned — grouped by category (deploy, fix, debug, …). ' +
1012
- 'Crystals survive session cleanup and appear in session_start once enough sessions have accumulated. ' +
1013
- 'Run this monthly or after a big milestone to preserve institutional knowledge. ' +
1014
- 'Returns a digest of what was crystallized.',
1015
- inputSchema: {
1016
- type: 'object',
1017
- properties: {
1018
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1019
- label: {
1020
- type: 'string',
1021
- description: 'Optional label for this crystal (e.g. "Q1 2026", "v2 launch"). Auto-generated from date if omitted.',
1022
- },
1023
- },
1024
- required: ['instance_id'],
1025
- },
1026
- },
1027
- // ── Roadmap — Persistent project plan tracker ───────────────────────────
1028
- {
1029
- name: 'roadmap_add',
1030
- description:
1031
- 'Add a new item to the persistent project roadmap stored in the Brain. ' +
1032
- 'Items survive across sessions and editors — the roadmap is always up to date. ' +
1033
- 'Use for features, bugs, refactors, or any planned work. ' +
1034
- 'Call roadmap_list to see all open items, roadmap_next to get the next actionable item.',
1035
- inputSchema: {
1036
- type: 'object',
1037
- properties: {
1038
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1039
- title: { type: 'string', description: 'Short title of the task/feature (3–10 words)' },
1040
- description: { type: 'string', description: 'What needs to be done, acceptance criteria, context' },
1041
- priority: {
1042
- type: 'string',
1043
- enum: ['critical', 'high', 'medium', 'low'],
1044
- description: 'Priority level (default: medium)',
1045
- },
1046
- tags: {
1047
- type: 'array',
1048
- items: { type: 'string' },
1049
- description: 'Tags for filtering (e.g. ["api", "web", "sdk", "infra"])',
1050
- },
1051
- milestone: { type: 'string', description: 'Milestone/epic this belongs to (optional)' },
1052
- },
1053
- required: ['instance_id', 'title'],
1054
- },
1055
- },
1056
- {
1057
- name: 'roadmap_update',
1058
- description:
1059
- 'Update the status, priority, or details of a roadmap item. ' +
1060
- 'Use to move items through the lifecycle: planned → in-progress → done (or blocked/cancelled). ' +
1061
- 'Also use to add notes/findings while working on an item.',
1062
- inputSchema: {
1063
- type: 'object',
1064
- properties: {
1065
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1066
- id: { type: 'string', description: 'Item ID returned by roadmap_add or roadmap_list' },
1067
- status: {
1068
- type: 'string',
1069
- enum: ['planned', 'in-progress', 'done', 'blocked', 'cancelled'],
1070
- description: 'New status for the item',
1071
- },
1072
- priority: {
1073
- type: 'string',
1074
- enum: ['critical', 'high', 'medium', 'low'],
1075
- description: 'Updated priority (optional)',
1076
- },
1077
- notes: { type: 'string', description: 'Progress notes, findings, or blockers (appended to existing notes)' },
1078
- title: { type: 'string', description: 'Updated title (optional)' },
1079
- description: { type: 'string', description: 'Updated description (optional)' },
1080
- },
1081
- required: ['instance_id', 'id'],
1082
- },
1083
- },
1084
- {
1085
- name: 'roadmap_list',
1086
- description:
1087
- 'List all roadmap items, optionally filtered by status, priority, tag, or milestone. ' +
1088
- 'Returns items sorted by priority then creation date. ' +
1089
- 'Called automatically by session_start to show open work.',
1090
- inputSchema: {
1091
- type: 'object',
1092
- properties: {
1093
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1094
- status: {
1095
- type: 'string',
1096
- enum: ['planned', 'in-progress', 'done', 'blocked', 'cancelled', 'open'],
1097
- description: 'Filter by status. Use \'open\' to see planned+in-progress+blocked (default: open)',
1098
- },
1099
- tag: { type: 'string', description: 'Filter by tag (optional)' },
1100
- milestone: { type: 'string', description: 'Filter by milestone (optional)' },
1101
- priority: {
1102
- type: 'string',
1103
- enum: ['critical', 'high', 'medium', 'low'],
1104
- description: 'Filter by minimum priority (optional)',
1105
- },
1106
- },
1107
- required: ['instance_id'],
1108
- },
1109
- },
1110
- {
1111
- name: 'roadmap_next',
1112
- description:
1113
- 'Get the single most important next actionable roadmap item. ' +
1114
- 'Returns the highest-priority in-progress item first, then planned items, sorted by priority. ' +
1115
- 'Call at session start to immediately know what to work on next.',
1116
- inputSchema: {
1117
- type: 'object',
1118
- properties: {
1119
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1120
- tag: { type: 'string', description: 'Filter by tag (optional)' },
1121
- },
1122
- required: ['instance_id'],
1123
- },
1124
- },
1125
- {
1126
- name: 'brain_doctor',
1127
- description:
1128
- 'Check the health of your AI Brain and get actionable recommendations. ' +
1129
- 'Reports: lesson count, context entries, last session age, open failures, quality score, effective IQ boost, stale index. ' +
1130
- 'Returns a prioritized list of issues with fix instructions.',
1131
- inputSchema: {
1132
- type: 'object',
1133
- properties: {
1134
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1135
- workspace_path: {
1136
- type: 'string',
1137
- description: 'Absolute path to workspace root — enables package.json analysis for openclaw cross-promo (optional)',
1138
- },
1139
- },
1140
- required: ['instance_id'],
1141
- },
1142
- },
1143
- {
1144
- name: 'global_learn',
1145
- description:
1146
- 'Store a lesson that applies across ALL your projects (cross-project knowledge). ' +
1147
- 'Idempotent: if a lesson with the same topic already exists, it is updated in place — no duplicates are created. ' +
1148
- 'Returns a confirmation with the stored lesson key. No rate limits. ' +
1149
- 'Global lessons are stored with the prefix cachly:global:lesson: and recalled from any instance via global_recall. ' +
1150
- 'Use for tool preferences, personal workflows, platform quirks, and universal gotchas. ' +
1151
- 'Example: global_learn(topic="bash:macos-arrays", lesson="Arrays work differently on macOS bash 3.2"). ' +
1152
- 'Use learn_from_attempts for project-specific session lessons; use team_learn to share lessons with your team.',
1153
- inputSchema: {
1154
- type: 'object',
1155
- properties: {
1156
- instance_id: { type: 'string', description: 'UUID of the cache instance (used for connection)' },
1157
- topic: { type: 'string', description: 'Topic key in format "category:keyword"' },
1158
- lesson: { type: 'string', description: 'The lesson content' },
1159
- severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity (default: minor)' },
1160
- tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags' },
1161
- },
1162
- required: ['instance_id', 'topic', 'lesson'],
1163
- },
1164
- },
1165
- {
1166
- name: 'global_recall',
1167
- description:
1168
- 'Read-only retrieval of cross-project lessons stored via global_learn. No side effects. ' +
1169
- 'Returns a list of matching global lesson objects, each with topic, lesson text, severity, and tags. ' +
1170
- 'If no topic is provided, returns all global lessons (up to 50). ' +
1171
- 'If topic is provided, returns all lessons whose topic key contains that string (partial match). ' +
1172
- 'Use this for lessons that apply universally across all projects (tool quirks, shell gotchas, platform behavior). ' +
1173
- 'Use recall_best_solution instead for project-specific lessons; use team_recall for org-scoped lessons.',
1174
- inputSchema: {
1175
- type: 'object',
1176
- properties: {
1177
- instance_id: { type: 'string', description: 'UUID of the cache instance (used for connection)' },
1178
- topic: { type: 'string', description: 'Topic or keyword filter (optional)' },
1179
- },
1180
- required: ['instance_id'],
1181
- },
1182
- },
1183
- {
1184
- name: 'publish_lesson',
1185
- description:
1186
- 'Publish a lesson to the Cachly Public Brain (anonymized community knowledge base). ' +
1187
- 'Published lessons can be imported by other developers via import_public_brain. ' +
1188
- 'PII is stripped automatically. Visible under the framework/category tag. ' +
1189
- 'Returns { lesson_id, topic, framework, published_at } confirming the publish. ' +
1190
- 'Irreversible — once published to the public brain, lessons cannot be deleted via the MCP interface. ' +
1191
- 'Use learn_from_attempts or global_learn for private lessons; ' +
1192
- 'use syndicate for anonymized global sharing without framework tagging.',
1193
- inputSchema: {
1194
- type: 'object',
1195
- properties: {
1196
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1197
- topic: { type: 'string', description: 'Topic key (used as public category)' },
1198
- lesson: { type: 'string', description: 'Lesson to publish (PII will be stripped)' },
1199
- framework: { type: 'string', description: 'Framework/platform tag (nextjs, fastapi, go, docker, etc.)' },
1200
- severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'Severity' },
1201
- },
1202
- required: ['instance_id', 'topic', 'lesson'],
1203
- },
1204
- },
1205
- {
1206
- name: 'import_public_brain',
1207
- description:
1208
- 'Import community lessons from the Cachly Public Brain for a framework. ' +
1209
- 'Non-destructive: existing lessons with the same topic key are not overwritten. ' +
1210
- 'Returns the count of lessons imported and their topic slugs. ' +
1211
- 'Available frameworks: nextjs, fastapi, go, docker, kubernetes, react, typescript, python, rust, laravel, rails, spring. ' +
1212
- 'Use this to bootstrap a new brain with battle-tested community knowledge before your first session_start. ' +
1213
- 'Use publish_lesson to contribute your own lessons to the Public Brain; ' +
1214
- 'use learn_from_attempts for storing lessons from your own sessions.',
1215
- inputSchema: {
1216
- type: 'object',
1217
- properties: {
1218
- instance_id: { type: 'string', description: 'UUID of the cache instance to import into' },
1219
- framework: { type: 'string', description: 'Framework/platform to import lessons for' },
1220
- limit: { type: 'number', description: 'Max lessons to import (default: 20)' },
1221
- },
1222
- required: ['instance_id', 'framework'],
1223
- },
1224
- },
1225
- // ── Brain Archaeology + Causal Chain ────────────────────────────────────
1226
- {
1227
- name: 'recall_at',
1228
- description:
1229
- 'Brain Archaeology — see what a lesson looked like at a specific point in time. ' +
1230
- '"What did we know about deployments 3 months ago?" ' +
1231
- 'Returns the history of a topic filtered to entries before the given date. ' +
1232
- 'Shows how the lesson evolved: failure → partial → success. ' +
1233
- 'Also useful to understand WHY old code decisions were made.',
1234
- inputSchema: {
1235
- type: 'object',
1236
- properties: {
1237
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1238
- topic: { type: 'string', description: 'Topic slug to look up, e.g. "deploy:api"' },
1239
- date: { type: 'string', description: 'ISO date string (e.g. "2026-01-15") — returns entries stored BEFORE this date' },
1240
- },
1241
- required: ['instance_id', 'topic', 'date'],
1242
- },
1243
- },
1244
- {
1245
- name: 'trace_dependency',
1246
- description:
1247
- 'Causal Chain — find all lessons that depend on a given prerequisite. ' +
1248
- '"What lessons are affected if node version changes?" ' +
1249
- 'When a dependency changes (new version, different provider, new OS), call this to see which lessons need review. ' +
1250
- 'Lessons store dependencies via the depends_on field in learn_from_attempts.',
1251
- inputSchema: {
1252
- type: 'object',
1253
- properties: {
1254
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1255
- dependency: { type: 'string', description: 'Dependency to trace (e.g. "node:>=20", "docker:running", "wireguard:active")' },
1256
- mark_review: { type: 'boolean', description: 'If true, marks all dependent lessons as needs_review (default: false)' },
1257
- },
1258
- required: ['instance_id', 'dependency'],
1259
- },
1260
- },
1261
- // ── Team / Org Management ────────────────────────────────────────────────
1262
- {
1263
- name: 'list_orgs',
1264
- description:
1265
- 'List your Cachly organizations (team/org plans). ' +
1266
- 'Returns each org with plan, seat count, and member info. ' +
1267
- 'Org plans (Team €99, Business €299, Enterprise custom) are billed separately from cache tiers.',
1268
- inputSchema: {
1269
- type: 'object',
1270
- properties: {},
1271
- required: [],
1272
- },
1273
- },
1274
- {
1275
- name: 'create_org',
1276
- description:
1277
- 'Create a new Cachly organization for team collaboration. ' +
1278
- 'After creation, invite team members with invite_member and upgrade the plan via the billing portal. ' +
1279
- 'Org plans: Team (€99/mo, 10 seats), Business (€299/mo, 50 seats), Enterprise (custom).',
1280
- inputSchema: {
1281
- type: 'object',
1282
- properties: {
1283
- name: { type: 'string', description: 'Organization display name (e.g. "Acme Engineering")' },
1284
- slug: { type: 'string', description: 'URL-safe slug (e.g. "acme-eng"). Auto-generated from name if omitted.' },
1285
- },
1286
- required: ['name'],
1287
- },
1288
- },
1289
- {
1290
- name: 'invite_member',
1291
- description:
1292
- 'MUTATION — sends an invite email immediately and cannot be undone via MCP. ' +
1293
- 'Invite a team member to a Cachly organization by email. ' +
1294
- 'Requires the caller to be an admin or owner of the organization. ' +
1295
- 'Valid roles: admin (manage members + instances), member (read + cache ops). Default role: member. ' +
1296
- 'Returns an error if the email is already a member or has a pending invite.',
1297
- // NOTE: schema intentionally omits 'owner' — owners can only be set via the billing portal.
1298
- inputSchema: {
1299
- type: 'object',
1300
- properties: {
1301
- org_id: { type: 'string', description: 'UUID of the organization' },
1302
- email: { type: 'string', description: 'Email address to invite' },
1303
- role: { type: 'string', enum: ['admin', 'member'], description: 'Role for the invited member (default: member)' },
1304
- },
1305
- required: ['org_id', 'email'],
1306
- },
1307
- },
1308
- {
1309
- name: 'get_org_plan',
1310
- description:
1311
- 'Get the current org plan, seat usage, and billing info for an organization. ' +
1312
- 'Shows: plan name, price, seats used/max, next billing date. ' +
1313
- 'To upgrade: use the billing portal URL returned by this tool.',
1314
- inputSchema: {
1315
- type: 'object',
1316
- properties: {
1317
- org_id: { type: 'string', description: 'UUID of the organization' },
1318
- },
1319
- required: ['org_id'],
1320
- },
1321
- },
1322
- // ── Legacy / Setup ────────────────────────────────────────────────────────
1323
- {
1324
- name: 'setup_ai_memory',
1325
- description:
1326
- 'One-shot setup of the cachly 3-layer AI Memory system for a project.\n\n' +
1327
- 'Layer 1 — Storage: your cachly instance (Valkey, persistent across sessions)\n' +
1328
- 'Layer 2 — Tools: learn_from_attempts + recall_best_solution + smart_recall (the memory API)\n' +
1329
- 'Layer 3 — Autopilot: generates a copilot-instructions.md / .github/copilot-instructions.md\n' +
1330
- ' that instructs any MCP-compatible AI to recall known solutions BEFORE each task\n' +
1331
- ' and save lessons AFTER — fully automatic, zero manual effort.\n\n' +
1332
- 'Returns the copilot-instructions.md content + provider-specific .mcp.json snippet.\n' +
1333
- 'Optionally writes copilot-instructions.md directly to the project directory.',
1334
- inputSchema: {
1335
- type: 'object',
1336
- properties: {
1337
- instance_id: {
1338
- type: 'string',
1339
- description: 'UUID of the cachly instance to use as the AI brain',
1340
- },
1341
- project_dir: {
1342
- type: 'string',
1343
- description:
1344
- 'Absolute path to the project root. If provided, writes copilot-instructions.md ' +
1345
- 'to .github/copilot-instructions.md in that directory.',
1346
- },
1347
- embed_provider: {
1348
- type: 'string',
1349
- enum: ['openai', 'mistral', 'cohere', 'ollama', 'gemini'],
1350
- description:
1351
- 'Embedding provider to use for smart_recall / semantic search. ' +
1352
- 'Default: openai. Use ollama for fully local/free setup.',
1353
- },
1354
- project_description: {
1355
- type: 'string',
1356
- description: 'Short description of the project (used in the generated instructions)',
1357
- },
1358
- },
1359
- required: ['instance_id'],
1360
- },
1361
- },
1362
- {
1363
- name: 'cache_stream_set',
1364
- description:
1365
- 'Cache a list of string chunks (e.g. LLM token stream) via Redis RPUSH. ' +
1366
- 'Each chunk is stored as a separate list element under cachly:stream:{key}. ' +
1367
- 'Replay with cache_stream_get.',
1368
- inputSchema: {
1369
- type: 'object',
1370
- properties: {
1371
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1372
- key: { type: 'string', description: 'Cache key' },
1373
- chunks: { type: 'array', items: { type: 'string' }, description: 'Ordered list of string chunks' },
1374
- ttl: { type: 'number', description: 'TTL in seconds for the stored list (optional)' },
1375
- },
1376
- required: ['instance_id', 'key', 'chunks'],
1377
- },
1378
- },
1379
- {
1380
- name: 'cache_stream_get',
1381
- description:
1382
- 'Retrieve a previously cached stream as an ordered list of string chunks. ' +
1383
- 'Returns null on cache miss (key absent or empty list). ' +
1384
- 'Stored under cachly:stream:{key}.',
1385
- inputSchema: {
1386
- type: 'object',
1387
- properties: {
1388
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1389
- key: { type: 'string', description: 'Cache key' },
1390
- },
1391
- required: ['instance_id', 'key'],
1392
- },
1393
- },
1394
-
1395
- // ── v0.6 Cognitive Cache Tools ────────────────────────────────────────────
1396
- {
1397
- name: 'memory_consolidate',
1398
- description:
1399
- 'Cognitive memory consolidation — the weekly garbage collector for your AI Brain. ' +
1400
- 'Scans all lessons, detects contradictions (same topic with conflicting outcomes), ' +
1401
- 'merges duplicates, flags stale entries (not recalled in 90+ days), and computes a ' +
1402
- 'health score. Returns a full consolidation report with conflicts resolved, ' +
1403
- 'duplicates merged, and a before/after count. ' +
1404
- 'Run weekly or when brain_doctor reports > 20 lessons. ' +
1405
- 'Like git gc for knowledge.',
1406
- inputSchema: {
1407
- type: 'object',
1408
- properties: {
1409
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1410
- dry_run: { type: 'boolean', description: 'If true, report what would change without writing (default: false)' },
1411
- stale_days: { type: 'number', description: 'Lessons not recalled in this many days are flagged stale (default: 90)' },
1412
- },
1413
- required: ['instance_id'],
1414
- },
1415
- },
1416
- {
1417
- name: 'brain_diff',
1418
- description:
1419
- 'git log for your AI Brain — see exactly what changed since a point in time. ' +
1420
- 'Returns a structured changelog: new lessons added, lessons updated (outcome changed), ' +
1421
- 'lessons recalled (hit count increased), and lessons that decayed. ' +
1422
- 'Perfect for weekly reviews: "What did my AI learn this week?" ' +
1423
- 'Example: brain_diff(instance_id="...", since="7d") → "12 new · 4 updated · 2 stale"',
1424
- inputSchema: {
1425
- type: 'object',
1426
- properties: {
1427
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1428
- since: { type: 'string', description: 'Time window: "1d", "7d", "30d", or ISO-8601 date (default: "7d")' },
1429
- format: { type: 'string', enum: ['summary', 'detailed'], description: 'Output format (default: summary)' },
1430
- },
1431
- required: ['instance_id'],
1432
- },
1433
- },
1434
- {
1435
- name: 'causal_trace',
1436
- description:
1437
- 'Root Cause Analysis through memory: given a problem description, traces the causal chain ' +
1438
- 'from root cause through intermediate failures to the current symptom, then surfaces the ' +
1439
- 'exact solution that worked before. Read-only — does not modify any stored data. ' +
1440
- 'Requires prior learning: brain must have lessons stored via learn_from_attempts or brain_from_git. ' +
1441
- 'Returns an ordered chain of concepts with confidence scores plus the matching solution; ' +
1442
- 'returns an empty chain with a message if no causal path is found. ' +
1443
- 'Example: causal_trace(problem="auth breaks after restart") → ' +
1444
- '"Root: k8s:namespace-terminating → keycloak:jwks-race → Solution: PollUntilContextTimeout 3min". ' +
1445
- 'Use recall_best_solution for direct topic lookup, syndicate_search for community patterns, ' +
1446
- 'and causal_trace when you have a symptom and need the full root-cause chain.',
1447
- inputSchema: {
1448
- type: 'object',
1449
- properties: {
1450
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1451
- problem: { type: 'string', description: 'Describe the problem or error you are seeing right now' },
1452
- max_depth: { type: 'number', description: 'Max causal chain depth to trace (default: 5)' },
1453
- tags: { type: 'array', items: { type: 'string' }, description: 'Optional: narrow search to these tags' },
1454
- },
1455
- required: ['instance_id', 'problem'],
1456
- },
1457
- },
1458
- {
1459
- name: 'knowledge_decay',
1460
- description:
1461
- 'Confidence scoring for every lesson in your Brain — because old knowledge rots. ' +
1462
- 'Computes a decay score (0–100%) per lesson based on age, recall frequency, and outcome. ' +
1463
- 'Lessons recalled recently score high. Lessons from 90 days ago never recalled score low. ' +
1464
- 'Returns a ranked list with visual confidence bars: "████░░░░ 40%". ' +
1465
- 'Use this before a big refactor to know which lessons to trust and which to re-validate.',
1466
- inputSchema: {
1467
- type: 'object',
1468
- properties: {
1469
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1470
- min_age_days: { type: 'number', description: 'Only include lessons older than N days (default: 0 = all)' },
1471
- show_top: { type: 'number', description: 'Number of entries to return, sorted by lowest confidence first (default: 20)' },
1472
- },
1473
- required: ['instance_id'],
1474
- },
1475
- },
1476
- {
1477
- name: 'autopilot',
1478
- description:
1479
- 'Generate a CLAUDE.md / copilot-instructions.md that makes any AI self-managing forever. ' +
1480
- 'Writes a configuration file to disk — will overwrite an existing file at the target path. ' +
1481
- 'No auth required beyond a valid instance_id. ' +
1482
- 'The generated file instructs Claude, Cursor, Copilot, Windsurf, or Gemini to automatically ' +
1483
- 'call session_start at window open, learn_from_attempts after every fix, and session_end ' +
1484
- 'before closing — without being asked. ' +
1485
- 'Returns the generated file content as a string and the path where it was written. ' +
1486
- 'Use style="minimal" for just the three hooks; style="full" for the complete ruleset with examples. ' +
1487
- 'One command. Every AI. Always on. ' +
1488
- 'Use setup_ai_memory instead if you want an interactive one-shot setup that also creates an instance.',
1489
- inputSchema: {
1490
- type: 'object',
1491
- properties: {
1492
- instance_id: { type: 'string', description: 'UUID of the cache instance' },
1493
- editor: { type: 'string', enum: ['claude', 'cursor', 'copilot', 'windsurf', 'gemini', 'continue', 'all'], description: 'Target editor (default: claude)' },
1494
- project_name: { type: 'string', description: 'Your project name (used in generated instructions)' },
1495
- style: { type: 'string', enum: ['minimal', 'full'], description: 'minimal = just the hooks, full = full ruleset with examples (default: full)' },
1496
- },
1497
- required: ['instance_id'],
1498
- },
1499
- },
1500
- // ── v0.7 Knowledge Syndication ────────────────────────────────────────────
1501
- {
1502
- name: 'syndicate',
1503
- description:
1504
- 'Contribute a verified lesson to the GLOBAL Cachly Knowledge Commons — ' +
1505
- 'a privacy-preserving shared brain where every AI instance can learn from the discoveries ' +
1506
- 'of every other. Your contributor identity is a one-way HMAC hash: completely anonymous. ' +
1507
- 'The lesson is immediately searchable by any other AI using syndicate_search. ' +
1508
- 'This is how individual knowledge becomes collective intelligence. ' +
1509
- 'Call this AFTER every learn_from_attempts that is worth sharing universally ' +
1510
- '(critical bugs, deployment gotchas, architecture discoveries). ' +
1511
- 'If a lesson with the same topic already exists in the commons, it is updated in place (idempotent). ' +
1512
- 'Returns { key, confirm_count, scope } confirming the stored lesson. ' +
1513
- 'Use scope="org" to keep the lesson private to your organisation. ' +
1514
- 'Do NOT use for secrets or PII — content is stored in a shared knowledge base.',
1515
- inputSchema: {
1516
- type: 'object',
1517
- properties: {
1518
- topic: { type: 'string', description: 'Topic key in category:keyword format (e.g. "fix:clickhouse-ipv6", "deploy:docker-compose")' },
1519
- outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Result of the attempt (default: success)' },
1520
- what_worked: { type: 'string', description: 'Exact approach, command, or fix that worked. File paths are stripped automatically.' },
1521
- what_failed: { type: 'string', description: 'What failed or was wrong — helps others avoid the same trap.' },
1522
- severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'How severe the issue was (default: minor)' },
1523
- tags: { type: 'array', items: { type: 'string' }, description: 'Up to 10 keywords for better discoverability' },
1524
- scope: { type: 'string', enum: ['public', 'org'], description: 'Visibility: "public" = global commons (default), "org" = private to your org only' },
1525
- },
1526
- required: ['topic', 'what_worked'],
1527
- },
1528
- },
1529
- {
1530
- name: 'syndicate_search',
1531
- description:
1532
- 'Search the GLOBAL Cachly Knowledge Commons for solutions contributed by the entire community. ' +
1533
- 'Returns lessons ranked by confirm_count (trust score) then recency. ' +
1534
- 'Use this BEFORE debugging any unknown issue — someone in the global brain likely solved it already. ' +
1535
- 'Example: syndicate_search(q="clickhouse localhost connection refused") → ' +
1536
- '"fix: use 127.0.0.1 not localhost when IPv6 is disabled · confirmed by 47 instances"',
1537
- inputSchema: {
1538
- type: 'object',
1539
- properties: {
1540
- q: { type: 'string', description: 'Free-text search query (leave empty for most recent lessons)' },
1541
- category: { type: 'string', description: 'Filter by category prefix: "fix", "deploy", "debug", "infra", "api", "web"' },
1542
- scope: { type: 'string', enum: ['public', 'org'], description: '"public" = global commons (default), "org" = public + your org-private lessons' },
1543
- limit: { type: 'number', description: 'Max results to return (default: 20, max: 50)' },
1544
- },
1545
- required: [],
1546
- },
1547
- },
1548
- {
1549
- name: 'syndicate_stats',
1550
- description:
1551
- 'Show the health of the global Knowledge Commons: total lessons, total confirms, ' +
1552
- 'top categories, most-trusted lessons, growth in the last 7 days, and top contributors (anonymous scores). ' +
1553
- 'Use for weekly reviews or to explore what the community knows.',
1554
- inputSchema: {
1555
- type: 'object',
1556
- properties: {},
1557
- required: [],
1558
- },
1559
- },
1560
- {
1561
- name: 'syndicate_trending',
1562
- description:
1563
- 'Show the TRENDING lessons in the global Knowledge Commons — those with the fastest confirmation velocity ' +
1564
- 'in the last 7 days (confirm_count / age_in_days). ' +
1565
- 'Use this at the start of a session or weekly review to see what the community is actively validating. ' +
1566
- 'Lessons need at least 2 independent confirms to appear here.',
1567
- inputSchema: {
1568
- type: 'object',
1569
- properties: {
1570
- limit: { type: 'number', description: 'Max results (default: 10, max: 50)' },
1571
- },
1572
- required: [],
1573
- },
1574
- },
1575
- // ── Layer 1: Causal Knowledge Graph ────────────────────────────────────────
1576
- {
1577
- name: 'brain_search',
1578
- description:
1579
- 'BM25+ full-text search over ALL brain data: lessons, context entries, session history, CKG nodes, roadmap items. ' +
1580
- 'Unlike smart_recall (which focuses on lessons + context), brain_search casts a wider net. ' +
1581
- 'Use when smart_recall returns nothing or when you want to find anything the brain knows about a topic.',
1582
- inputSchema: {
1583
- type: 'object',
1584
- properties: {
1585
- instance_id: { type: 'string', description: 'Brain instance ID' },
1586
- query: { type: 'string', description: 'What to search for' },
1587
- limit: { type: 'number', description: 'Max results (default: 15)' },
1588
- },
1589
- required: ['instance_id', 'query'],
1590
- },
1591
- },
1592
- {
1593
- name: 'ckg_inspect',
1594
- description:
1595
- 'Inspect the Causal Knowledge Graph (CKG) for a concept. Shows all typed edges (fixes, requires, co-occurs, causes) ' +
1596
- 'with Bayesian confidence scores. Use to understand what the brain knows about a topic and which fixes have the ' +
1597
- 'highest confidence. Also shows related concepts via graph traversal.',
1598
- inputSchema: {
1599
- type: 'object',
1600
- properties: {
1601
- instance_id: { type: 'string', description: 'Brain instance ID' },
1602
- concept: { type: 'string', description: 'Concept to inspect, e.g. "fix:clickhouse-ipv6" or "docker"' },
1603
- max_hops: { type: 'number', description: 'Traversal depth (default: 2)' },
1604
- },
1605
- required: ['instance_id', 'concept'],
1606
- },
1607
- },
1608
- {
1609
- name: 'brain_predict',
1610
- description:
1611
- 'READ-ONLY — no side effects, no writes, no external network calls. ' +
1612
- 'Predictive Pre-fetch Engine (PPE): given your current context, reads the CKG in your Redis instance ' +
1613
- 'to predict likely failures and return the highest-confidence fixes. ' +
1614
- '"Pre-load" means results are returned inline — nothing is cached or persisted. ' +
1615
- 'Requires a valid instance_id (your Redis brain). No rate limits. ' +
1616
- 'Call at session start when working on a specific feature or debugging area.',
1617
- inputSchema: {
1618
- type: 'object',
1619
- properties: {
1620
- instance_id: { type: 'string', description: 'Brain instance ID' },
1621
- context: { type: 'string', description: 'What you\'re working on, e.g. "upgrading Keycloak from 21 to 24"' },
1622
- top_k: { type: 'number', description: 'Max predictions to return (default: 5)' },
1623
- },
1624
- required: ['instance_id', 'context'],
1625
- },
1626
- },
1627
- // ── Layer 3: MADC ────────────────────────────────────────────────────────
1628
- {
1629
- name: 'madc_deliberate',
1630
- description:
1631
- 'Multi-Agent Deliberation Chamber (MADC — Layer 3): When conflicting lessons exist for a topic, ' +
1632
- 'run deliberation between 6 specialist expert agents (InfraAgent, AuthAgent, DeployAgent, DatabaseAgent, DebugAgent, APIAgent). ' +
1633
- 'Each agent votes based on its domain CKG coverage. Unanimous vote → loser superseded. ' +
1634
- 'Split vote → contested flag, causal_trace required before acting. ' +
1635
- 'Resolution stored as permanent CKG node. Called automatically when learn_from_attempts detects a contradiction.',
1636
- inputSchema: {
1637
- type: 'object',
1638
- properties: {
1639
- instance_id: { type: 'string', description: 'Brain instance ID' },
1640
- topic: { type: 'string', description: 'Topic to deliberate, e.g. "fix:jwks-rotation"' },
1641
- context: { type: 'string', description: 'Optional context for the deliberation' },
1642
- },
1643
- required: ['instance_id', 'topic'],
1644
- },
1645
- },
1646
- // ── Layer 5: CLS ─────────────────────────────────────────────────────────
1647
- {
1648
- name: 'cls_ingest',
1649
- description:
1650
- 'Continuous Learning Stream (CLS — Layer 5): Ingest learning signals WITHOUT explicit session_end calls. ' +
1651
- 'Sources: git_commit (commit message + files → CKG edges), ci_outcome (green/red build → confirms fix), ' +
1652
- 'ide_diagnostic (compiler error + fix pair → instant lesson). ' +
1653
- 'Install automatic ingestion with cls_install_hooks — brain learns from every commit and CI run.',
1654
- inputSchema: {
1655
- type: 'object',
1656
- properties: {
1657
- instance_id: { type: 'string', description: 'Brain instance ID' },
1658
- source: {
1659
- type: 'string',
1660
- enum: ['git_commit', 'ci_outcome', 'ide_diagnostic'],
1661
- description: 'Event source type',
1662
- },
1663
- payload: {
1664
- type: 'object',
1665
- description:
1666
- 'Event data. git_commit: {message, sha?, files?, diff?}. ' +
1667
- 'ci_outcome: {status, prev_status, job, context?}. ' +
1668
- 'ide_diagnostic: {error, fix, file?}',
1669
- },
1670
- },
1671
- required: ['instance_id', 'source', 'payload'],
1672
- },
1673
- },
1674
- {
1675
- name: 'cls_install_hooks',
1676
- description:
1677
- 'READ-ONLY — outputs text only, writes no files, makes no network calls, has no side effects. ' +
1678
- 'Generates ready-to-paste shell scripts: a git post-commit hook and/or a GitHub Actions step. ' +
1679
- 'You must manually copy and install the output. ' +
1680
- 'Once the generated scripts are installed, each git commit or CI run will make outbound HTTPS calls ' +
1681
- 'to api.cachly.dev to feed learning signals to your brain. ' +
1682
- 'No auth required to call this tool — only an instance_id. Run once per repository.',
1683
- inputSchema: {
1684
- type: 'object',
1685
- properties: {
1686
- instance_id: { type: 'string', description: 'Brain instance ID' },
1687
- repo_path: { type: 'string', description: 'Path to repo root (default: current dir)' },
1688
- hooks: {
1689
- type: 'array',
1690
- items: { type: 'string', enum: ['git', 'ci'] },
1691
- description: 'Which hooks to output (default: ["git", "ci"])',
1692
- },
1693
- },
1694
- required: ['instance_id'],
1695
- },
1696
- },
1697
- // ── Layer 6: FedBrain ────────────────────────────────────────────────────
1698
- {
1699
- name: 'fedbrain_contribute',
1700
- description:
1701
- 'FedBrain (Layer 6): Contribute a lesson to the global Knowledge Commons with a cryptographic ' +
1702
- 'knowledge certificate. Certificate includes: domain fingerprint, confidence, outcome chain hash. ' +
1703
- 'Lessons with 10+ independent confirmations become Gold Standard. Context-weighted: ' +
1704
- 'other brains with similar tech stacks see your lesson ranked higher in fedbrain_search.',
1705
- inputSchema: {
1706
- type: 'object',
1707
- properties: {
1708
- instance_id: { type: 'string', description: 'Brain instance ID' },
1709
- lesson_key: { type: 'string', description: 'Topic key to contribute, e.g. "fix:clickhouse-ipv6"' },
1710
- visibility: {
1711
- type: 'string',
1712
- enum: ['public', 'org_private'],
1713
- description: 'Visibility (default: public)',
1714
- },
1715
- },
1716
- required: ['instance_id', 'lesson_key'],
1717
- },
1718
- },
1719
- {
1720
- name: 'fedbrain_search',
1721
- description:
1722
- 'FedBrain context-weighted search: Search the global commons, weighting results by tech-stack similarity. ' +
1723
- 'Brains with matching domain context (Go/Kubernetes/Postgres) rank higher than unrelated stacks. ' +
1724
- 'Shows certificate provenance, confirm_count, and Gold Standard badges.',
1725
- inputSchema: {
1726
- type: 'object',
1727
- properties: {
1728
- instance_id: { type: 'string', description: 'Brain instance ID' },
1729
- query: { type: 'string', description: 'What to search for' },
1730
- context_hints: {
1731
- type: 'array',
1732
- items: { type: 'string' },
1733
- description: 'Your tech stack, e.g. ["go", "kubernetes", "postgres"]',
1734
- },
1735
- limit: { type: 'number', description: 'Max results (default: 10)' },
1736
- },
1737
- required: ['instance_id', 'query'],
1738
- },
1739
- },
1740
- {
1741
- name: 'fedbrain_confirm',
1742
- description:
1743
- 'Confirm that a syndicated lesson from the global commons worked for you. ' +
1744
- 'Propagates confirmation back — increments confirm_count on the knowledge certificate. ' +
1745
- 'Also updates your local CKG confidence. At 10 independent confirmations → Gold Standard.',
1746
- inputSchema: {
1747
- type: 'object',
1748
- properties: {
1749
- instance_id: { type: 'string', description: 'Brain instance ID' },
1750
- topic: { type: 'string', description: 'Topic of the lesson to confirm' },
1751
- outcome: {
1752
- type: 'string',
1753
- enum: ['worked', 'partially_worked', 'did_not_work'],
1754
- description: 'Did the lesson work for you?',
1755
- },
1756
- },
1757
- required: ['instance_id', 'topic', 'outcome'],
1758
- },
1759
- },
1760
- {
1761
- name: 'fedbrain_status',
1762
- description:
1763
- 'Show your FedBrain federation status: lessons contributed to global commons, recent confirmations, ' +
1764
- 'Gold Standard lessons, pending propagations. Use to track your brain\'s global knowledge contribution.',
1765
- inputSchema: {
1766
- type: 'object',
1767
- properties: {
1768
- instance_id: { type: 'string', description: 'Brain instance ID' },
1769
- },
1770
- required: ['instance_id'],
1771
- },
1772
- },
1773
- {
1774
- name: 'brain_federate',
1775
- description:
1776
- 'FedBrain Layer 6 — Private org knowledge transfer: copy CKG edges + lessons from a source brain ' +
1777
- 'into your brain for a specific domain (e.g. "billing", "auth", "deploy"). ' +
1778
- 'The new hire use case: one command gives you the senior engineer\'s 5 years of typed, confidence-weighted ' +
1779
- 'knowledge in your domain. Unlike syndicate_search (global, anonymous), brain_federate is org-private — ' +
1780
- 'both brains must be in the same Cachly org, or the source instance_id must be explicitly shared. ' +
1781
- 'Example: brain_federate(source="prod-brain-id", domain="billing", min_confidence=0.6)',
1782
- inputSchema: {
1783
- type: 'object',
1784
- properties: {
1785
- instance_id: { type: 'string', description: 'Your brain instance ID (destination)' },
1786
- source: { type: 'string', description: 'Source brain instance ID to federate from' },
1787
- domain: { type: 'string', description: 'Domain to transfer, e.g. "billing", "auth", "deploy", "infra". Use "*" for all domains.' },
1788
- min_confidence: { type: 'number', description: 'Minimum edge confidence to transfer (default: 0.6)' },
1789
- dry_run: { type: 'boolean', description: 'Preview what would be transferred without writing (default: false)' },
1790
- },
1791
- required: ['instance_id', 'source', 'domain'],
1792
- },
1793
- },
1794
- {
1795
- name: 'crystal_view',
1796
- description:
1797
- 'Inspect the current Memory Crystal — the compressed wisdom distilled from all past sessions. ' +
1798
- 'Shows top patterns per category, lesson count, and when the crystal was last refreshed. ' +
1799
- 'Call after session_start when you want to quickly see accumulated wisdom across all past work.',
1800
- inputSchema: {
1801
- type: 'object',
1802
- properties: {
1803
- instance_id: { type: 'string', description: 'Brain instance ID' },
1804
- show_raw: { type: 'boolean', description: 'Include raw JSON crystal data (default: false)' },
1805
- },
1806
- required: ['instance_id'],
1807
- },
1808
- },
1809
- {
1810
- name: 'compact_recover',
1811
- description:
1812
- 'Call FIRST after any context limit hit / compaction. Reconstructs full context from Memory Crystal + ' +
1813
- 'recent sessions + WIP registry + open failures. Returns a condensed briefing so the new context ' +
1814
- 'window starts exactly where the previous one left off — no lost progress.',
1815
- inputSchema: {
1816
- type: 'object',
1817
- properties: {
1818
- instance_id: { type: 'string', description: 'Brain instance ID' },
1819
- focus: { type: 'string', description: 'What you were working on (helps filter relevant context)' },
1820
- },
1821
- required: ['instance_id'],
1822
- },
1823
- },
1824
- {
1825
- name: 'brain_from_git',
1826
- description:
1827
- 'Bootstrap brain lessons from git history. Parses commit messages and infers fix/feature/refactor ' +
1828
- 'lessons automatically. Great for onboarding an existing codebase — run once and the brain instantly ' +
1829
- 'knows your team\'s accumulated patterns. Incremental by default: only processes new commits since the ' +
1830
- 'last run, so repeated calls are fast. Emits progress updates to stderr during long scans.',
1831
- inputSchema: {
1832
- type: 'object',
1833
- properties: {
1834
- instance_id: { type: 'string', description: 'Brain instance ID' },
1835
- repo_path: { type: 'string', description: 'Path to git repository (default: current directory)' },
1836
- limit: { type: 'number', description: 'Max commits to process (default: 100, max: 500)' },
1837
- branch: { type: 'string', description: 'Git branch to parse (default: current branch / HEAD)' },
1838
- since: { type: 'string', description: 'Only commits after this date, e.g. "2024-01-01" (optional)' },
1839
- incremental: { type: 'boolean', description: 'Only process commits since last run (default: true). Set false to reprocess all.' },
1840
- },
1841
- required: ['instance_id'],
1842
- },
1843
- },
1844
- {
1845
- name: 'brain_predict_failures',
1846
- description:
1847
- 'Pre-deploy failure prediction with probability percentages. Given a change context (e.g. ' +
1848
- '"upgrading Keycloak 21→24" or "deploying Redis 7 to prod"), returns the top likely failure modes ' +
1849
- 'ranked by probability, with pre-loaded fixes. Uses CKG causal edges + lesson history. ' +
1850
- 'Call before any significant deploy, migration, or infrastructure change.',
1851
- inputSchema: {
1852
- type: 'object',
1853
- properties: {
1854
- instance_id: { type: 'string', description: 'Brain instance ID' },
1855
- context: { type: 'string', description: 'What you are about to do, e.g. "upgrading Keycloak 21 to 24"' },
1856
- top_k: { type: 'number', description: 'Number of failure predictions to return (default: 5)' },
1857
- format: { type: 'string', enum: ['brief', 'detailed'], description: 'Output format (default: detailed)' },
1858
- },
1859
- required: ['instance_id', 'context'],
1860
- },
1861
- },
1862
-
1863
- // ── Travel Chaos Organizer (TCO) ─────────────────────────────────────────
1864
- // Requires TCO_API_URL env var pointing to the TCO FastAPI backend.
1865
- // Auth is shared with Cachly via the same Keycloak realm (CACHLY_JWT forwarded).
1866
- {
1867
- name: 'tco_list_trips',
1868
- description:
1869
- 'List all travel trips in Travel Chaos Organizer. ' +
1870
- 'Returns trip name, id, and date range. Use tco_get_timeline to see items for a specific trip. ' +
1871
- 'Requires TCO_API_URL to be configured.',
1872
- inputSchema: { type: 'object', properties: {}, required: [] },
1873
- },
1874
- {
1875
- name: 'tco_create_trip',
1876
- description:
1877
- 'Create a new trip in Travel Chaos Organizer. ' +
1878
- 'Dates are optional ISO strings (YYYY-MM-DD). ' +
1879
- 'Returns the new trip id.',
1880
- inputSchema: {
1881
- type: 'object',
1882
- properties: {
1883
- name: { type: 'string', description: 'Trip name, e.g. "Barcelona Sommer 2025"' },
1884
- description: { type: 'string', description: 'Optional trip description' },
1885
- start_date: { type: 'string', description: 'Start date (YYYY-MM-DD), optional' },
1886
- end_date: { type: 'string', description: 'End date (YYYY-MM-DD), optional' },
1887
- },
1888
- required: ['name'],
1889
- },
1890
- },
1891
- {
1892
- name: 'tco_get_timeline',
1893
- description:
1894
- 'Get the full timeline (flights, hotels, trains, activities …) for a trip. ' +
1895
- 'Use tco_list_trips first to get the trip_id. ' +
1896
- 'Returns items sorted by event_at with type icon, time, provider, and booking reference.',
1897
- inputSchema: {
1898
- type: 'object',
1899
- properties: {
1900
- trip_id: { type: 'string', description: 'UUID of the trip (from tco_list_trips)' },
1901
- },
1902
- required: ['trip_id'],
1903
- },
1904
- },
1905
- {
1906
- name: 'tco_delete_trip',
1907
- description: 'Permanently delete a trip and all its timeline items. This is irreversible.',
1908
- inputSchema: {
1909
- type: 'object',
1910
- properties: {
1911
- trip_id: { type: 'string', description: 'UUID of the trip to delete' },
1912
- },
1913
- required: ['trip_id'],
1914
- },
1915
- },
1916
- {
1917
- name: 'tco_inbox_list',
1918
- description:
1919
- 'List items in the Travel Chaos Organizer Chaos Inbox — unassigned documents, ' +
1920
- 'emails, and PDFs that Ollama has parsed but not yet assigned to a trip. ' +
1921
- 'Use tco_inbox_assign to move them to a trip or tco_inbox_reject to discard.',
1922
- inputSchema: {
1923
- type: 'object',
1924
- properties: {
1925
- status: {
1926
- type: 'string',
1927
- enum: ['pending', 'assigned', 'rejected'],
1928
- description: 'Filter by status (default: pending)',
1929
- },
1930
- },
1931
- required: [],
1932
- },
1933
- },
1934
- {
1935
- name: 'tco_inbox_assign',
1936
- description:
1937
- 'Assign a Chaos Inbox item to an existing trip, creating a timeline entry. ' +
1938
- 'Use tco_inbox_list to discover inbox_id values and tco_list_trips for trip_ids.',
1939
- inputSchema: {
1940
- type: 'object',
1941
- properties: {
1942
- inbox_id: { type: 'string', description: 'UUID of the inbox item' },
1943
- trip_id: { type: 'string', description: 'UUID of the target trip' },
1944
- type: {
1945
- type: 'string',
1946
- enum: ['flight', 'train', 'bus', 'hotel', 'rental_car', 'activity', 'transfer', 'document', 'other'],
1947
- description: 'Item type (default: other)',
1948
- },
1949
- },
1950
- required: ['inbox_id', 'trip_id'],
1951
- },
1952
- },
1953
- {
1954
- name: 'tco_inbox_reject',
1955
- description: 'Remove an item from the Chaos Inbox without assigning it to any trip.',
1956
- inputSchema: {
1957
- type: 'object',
1958
- properties: {
1959
- inbox_id: { type: 'string', description: 'UUID of the inbox item to reject' },
1960
- },
1961
- required: ['inbox_id'],
1962
- },
1963
- },
1964
- {
1965
- name: 'tco_parse_url',
1966
- description:
1967
- 'Fetch a public URL (booking confirmation page, airline URL) and parse it with Ollama AI, ' +
1968
- 'saving the result directly to a trip timeline or the Chaos Inbox. ' +
1969
- 'Useful for quickly importing online booking confirmations without uploading a file.',
1970
- inputSchema: {
1971
- type: 'object',
1972
- properties: {
1973
- url: { type: 'string', description: 'Public URL to fetch and parse' },
1974
- trip_id: { type: 'string', description: 'Trip UUID to assign to directly (omit to send to Chaos Inbox)' },
1975
- },
1976
- required: ['url'],
1977
- },
1978
- },
1979
- {
1980
- name: 'tco_import_email',
1981
- description:
1982
- 'Import a raw email (paste the full email text including headers) into Travel Chaos Organizer. ' +
1983
- 'Ollama strips headers, parses travel data (flights, hotels, bookings), and saves to inbox or trip. ' +
1984
- 'Ideal for forwarding booking confirmation emails directly through Claude.',
1985
- inputSchema: {
1986
- type: 'object',
1987
- properties: {
1988
- raw_email: { type: 'string', description: 'Full email text including headers' },
1989
- trip_id: { type: 'string', description: 'Trip UUID to assign directly (omit to send to Chaos Inbox)' },
1990
- },
1991
- required: ['raw_email'],
1992
- },
1993
- },
1994
- {
1995
- name: 'tco_parse_text',
1996
- description:
1997
- 'Parse raw text (booking confirmation, itinerary, travel note) with Ollama AI in Travel Chaos Organizer. ' +
1998
- 'Extracts flight, hotel, train, activity and other travel data. ' +
1999
- 'Results are cached in Cachly Redis — identical text returns instantly without a second AI call. ' +
2000
- 'Saves to a specific trip timeline or to the Chaos Inbox if no trip_id is given.',
2001
- inputSchema: {
2002
- type: 'object',
2003
- properties: {
2004
- text: { type: 'string', description: 'Raw text to parse (booking confirmation, itinerary, etc.)' },
2005
- trip_id: { type: 'string', description: 'Trip UUID to assign directly (omit to send to Chaos Inbox)' },
2006
- },
2007
- required: ['text'],
2008
- },
2009
- },
2010
- {
2011
- name: 'tco_cache_stats',
2012
- description:
2013
- 'Get Cachly Redis cache statistics for the TCO backend. ' +
2014
- 'Shows how many AI parse results are cached, the cache hit rate, and whether Cachly is connected. ' +
2015
- 'Use this to verify the TCO ↔ Cachly integration is working or to report savings to the user.',
2016
- inputSchema: { type: 'object', properties: {}, required: [] },
2017
- },
2018
- {
2019
- name: 'tco_provision_cache',
2020
- description:
2021
- 'Provision a free Cachly Redis instance for Travel Chaos Organizer and return the connection string. ' +
2022
- 'Creates a "tco-cache" instance on cachly.dev (free tier, 25 MB — enough for thousands of parse results). ' +
2023
- 'After provisioning, instruct the user to set CACHLY_REDIS_URL=<returned URL> in their TCO .env and redeploy. ' +
2024
- 'This wires TCO to Cachly so every Ollama parse result is deduplicated automatically.',
2025
- inputSchema: { type: 'object', properties: {}, required: [] },
2026
- },
2027
- {
2028
- name: 'tco_telegram_status',
2029
- description:
2030
- 'Check if the current user has linked their Telegram account in Travel Chaos Organizer. ' +
2031
- 'Returns linked status, plan, and guidance to link if not yet connected. ' +
2032
- 'Use before tco_telegram_send to confirm the user will actually receive the message.',
2033
- inputSchema: { type: 'object', properties: {}, required: [] },
2034
- },
2035
- {
2036
- name: 'tco_telegram_send',
2037
- description:
2038
- 'Send a Telegram message directly to the current TCO user\'s linked Telegram chat. ' +
2039
- 'Supports Markdown formatting. Use for: summaries, reminders, trip updates, parse results. ' +
2040
- 'Requires the user to have linked Telegram (check with tco_telegram_status first). ' +
2041
- 'Ideal for pushing trip information to the user outside the app.',
2042
- inputSchema: {
2043
- type: 'object',
2044
- properties: {
2045
- message: {
2046
- type: 'string',
2047
- description: 'Message text to send. Markdown supported (bold **text**, code `value`).',
2048
- },
2049
- },
2050
- required: ['message'],
2051
- },
2052
- },
2053
- ] as const;
2054
-
2055
-
2056
- export { TOOLS };