@cachly-dev/mcp-server 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +170 -221
- package/dist/__tests__/brain-predict-failures.test.d.ts +17 -0
- package/dist/__tests__/brain-predict-failures.test.js +339 -0
- package/dist/__tests__/brain-predict-failures.test.js.map +1 -0
- package/dist/handlers/brain.js +33 -93
- package/dist/handlers/brain.js.map +1 -1
- package/dist/handlers/fedbrain.js +38 -55
- package/dist/handlers/fedbrain.js.map +1 -1
- package/dist/handlers/team.js +50 -62
- package/dist/handlers/team.js.map +1 -1
- package/dist/index.js +92 -148
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +8 -0
- package/dist/tools.js +15 -5
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
- package/server.json +9 -3
- package/src/__tests__/brain-predict-failures.test.ts +430 -0
- package/src/handlers/brain.ts +27 -89
- package/src/handlers/fedbrain.ts +31 -43
- package/src/handlers/team.ts +33 -57
- package/src/index.ts +95 -151
- package/src/tools.ts +16 -5
- package/.github/workflows/publish.yml +0 -42
- package/LICENSE +0 -202
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -13
- package/dist/utils.js.map +0 -1
- package/glama.json +0 -6
- package/src/utils.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,48 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.10.0] – 2026-05-08
|
|
11
|
+
|
|
12
|
+
### Zero-Friction Onboarding
|
|
13
|
+
|
|
14
|
+
- **Global Claude Code config** — `setup` now writes `~/.claude/mcp.json` (global) in addition to project-level `.mcp.json`. cachly is available in every Claude Code project after running setup once — no per-project re-configuration needed. Existing MCP servers in the global config are preserved (merge, not overwrite).
|
|
15
|
+
|
|
16
|
+
- **Device Flow authentication** — No credentials required in MCP config. On the first tool call without a `CACHLY_JWT`, the server starts an OAuth Device Flow: the AI shows a one-click sign-in URL in chat, polls for completion, exchanges the token for a long-lived API key, and auto-provisions a Brain instance. Fully transparent to the user.
|
|
17
|
+
|
|
18
|
+
- **Fully automatic sessions** — `session_start` and `session_end` are called automatically (on first tool call and on SIGTERM). Users never need to call them manually.
|
|
19
|
+
|
|
20
|
+
- **Auto project indexing** — On session start, the project is indexed in the background if the last index is older than 24 hours. Zero extra calls.
|
|
21
|
+
|
|
22
|
+
### CLAUDE.md Rules — Mandatory Brain Behavior
|
|
23
|
+
|
|
24
|
+
The CLAUDE.md block written by `setup` now instructs the AI with binding rules (not suggestions):
|
|
25
|
+
|
|
26
|
+
- `smart_recall` before every task
|
|
27
|
+
- `causal_trace` before grepping/reading files when debugging
|
|
28
|
+
- `brain_predict` before deploys, migrations, and dependency upgrades
|
|
29
|
+
- `remember_context` before editing any file (WIP registry)
|
|
30
|
+
- `learn_from_attempts` after every fix, deploy, or discovery
|
|
31
|
+
|
|
32
|
+
### SEO & Search AI Optimization
|
|
33
|
+
|
|
34
|
+
- **`llms.txt`** added — AI crawler standard file with complete tool catalog (89 tools + descriptions), competitor comparison, architecture overview. Indexed by Perplexity, ChatGPT Search, Claude web search.
|
|
35
|
+
- **README** — FAQ section, competitor table (cachly vs mem0 vs MemGPT vs CLAUDE.md), `autopilot` tool documented prominently.
|
|
36
|
+
- **GitHub topics** set: `mcp`, `mcp-server`, `ai-memory`, `persistent-memory`, `claude-code`, `cursor`, `github-copilot`, `causal-trace`, `developer-tools`, `typescript`.
|
|
37
|
+
- **package.json** — description and keywords updated: `causal-trace`, `root-cause-analysis`, `failure-prediction`, `long-term-memory`, `llm-memory`, `claude-code-memory`.
|
|
38
|
+
|
|
39
|
+
### Auth Module
|
|
40
|
+
|
|
41
|
+
- `jwtExpiryMs`, `checkJwt`, `handleApiError` extracted from `index.ts` into `src/auth.ts`
|
|
42
|
+
- 23 unit tests added for auth module (Vitest)
|
|
43
|
+
- Publish workflow now runs tests before building
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
- `safeJsonParse` applied to all `JSON.parse` calls in `advanced.ts` and `syndicate.ts`
|
|
48
|
+
- Removed dead warm-up code
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
10
52
|
## [0.9.3] – 2026-05-06
|
|
11
53
|
|
|
12
54
|
### 🧠 10x Vision Phase 2 — Layers 3, 5 & 6
|
package/README.md
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🧠 cachly AI Brain — MCP Server
|
|
2
2
|
|
|
3
3
|
> **Persistent memory for Claude Code, Cursor, GitHub Copilot, Windsurf, Cline & Zed.**
|
|
4
|
-
> Your AI remembers every lesson, every fix, every architecture decision — forever.
|
|
5
|
-
> **Now with Live 3D Brain Visualizer — watch your knowledge galaxy grow in real time.**
|
|
4
|
+
> Your AI remembers every lesson, every fix, every architecture decision — forever.
|
|
6
5
|
|
|
7
6
|
<p align="center">
|
|
8
|
-
<a href="https://github.com/cachly-dev/mcp-server/stargazers">
|
|
9
|
-
<img src="https://img.shields.io/github/stars/cachly-dev/mcp-server?style=social" alt="GitHub Stars" />
|
|
10
|
-
</a>
|
|
11
|
-
|
|
12
7
|
<a href="https://www.npmjs.com/package/@cachly-dev/mcp-server">
|
|
13
8
|
<img src="https://img.shields.io/npm/v/@cachly-dev/mcp-server?color=red&logo=npm" alt="npm version" />
|
|
14
9
|
</a>
|
|
@@ -30,19 +25,72 @@
|
|
|
30
25
|
|
|
31
26
|
---
|
|
32
27
|
|
|
33
|
-
##
|
|
28
|
+
## The Problem
|
|
29
|
+
|
|
30
|
+
Every morning, you open your AI coding assistant. It doesn't remember yesterday.
|
|
31
|
+
You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
|
|
32
|
+
|
|
33
|
+
**The average developer wastes 45 minutes/day re-establishing context.**
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## One Command. Fully Automatic.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx @cachly-dev/mcp-server@latest setup
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Run it once. It handles everything:
|
|
44
|
+
|
|
45
|
+
1. **Signs you in** — one click in your browser, no password, no credit card
|
|
46
|
+
2. **Detects your editors** — Claude Code, Cursor, Windsurf, VS Code, Copilot, Cline & Zed
|
|
47
|
+
3. **Writes the MCP config** for every detected editor automatically
|
|
48
|
+
4. **Creates `CLAUDE.md`** with Brain rules so your AI acts autonomously
|
|
49
|
+
5. **Installs a git hook** that learns from every commit automatically
|
|
50
|
+
|
|
51
|
+
**Restart your editor.** From now on your AI arrives pre-briefed — every session.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## What happens after setup — everything is automatic
|
|
56
|
+
|
|
57
|
+
You never type another command. The Brain runs entirely in the background:
|
|
58
|
+
|
|
59
|
+
| Trigger | What the Brain does automatically |
|
|
60
|
+
|---------|----------------------------------|
|
|
61
|
+
| First tool call | Session starts, project gets indexed in background |
|
|
62
|
+
| Before every task | AI recalls relevant past lessons |
|
|
63
|
+
| During debugging | AI traces root causes through causal memory |
|
|
64
|
+
| Before deploys | AI predicts failure risks from past patterns |
|
|
65
|
+
| After every fix | AI stores the lesson with commands and file paths |
|
|
66
|
+
| Every git commit | Hook extracts lessons from commit message |
|
|
67
|
+
| Editor closes | Session summary saved for next time |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## With vs. Without cachly
|
|
72
|
+
|
|
73
|
+
| Situation | Without cachly | With cachly |
|
|
74
|
+
|-----------|----------------|-------------|
|
|
75
|
+
| Session start | "What's your architecture?" | "Ready. 23 lessons, last session: deployed API." |
|
|
76
|
+
| Known bug hits again | Re-researches from scratch | "You fixed this March 12, here's the exact command" |
|
|
77
|
+
| After holiday / handoff | Context dead | Fully briefed in < 10 seconds |
|
|
78
|
+
| New team member | Weeks to onboard | `setup` gives full context instantly |
|
|
79
|
+
| Pre-deploy check | Hope nothing breaks | Brain predicts failures before they happen |
|
|
34
80
|
|
|
35
|
-
|
|
81
|
+
---
|
|
36
82
|
|
|
37
|
-
|
|
83
|
+
## What makes cachly different
|
|
38
84
|
|
|
39
|
-
|
|
|
40
|
-
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
85
|
+
| Feature | What it does |
|
|
86
|
+
|---------|-------------|
|
|
87
|
+
| **`causal_trace`** | Root Cause Analysis through memory: problem → chain → solution. **No other system does this.** |
|
|
88
|
+
| **`memory_consolidate`** | Weekly garbage collector — detects contradictions, merges duplicates, expires stale lessons |
|
|
89
|
+
| **`brain_predict`** | Predicts failures before they happen based on past patterns |
|
|
90
|
+
| **Team Brain** | Shared lessons across your whole team with author attribution |
|
|
91
|
+
| **Ambient Git** | git hook auto-extracts lessons from every commit. Zero extra calls. |
|
|
92
|
+
| **Memory Crystals** | Distills all lessons into a compact snapshot for instant session briefing |
|
|
93
|
+
| **11 languages** | BM25+ search in EN, DE, FR, ES, IT, PT, ZH, JA, KO, AR, HE — no config |
|
|
46
94
|
|
|
47
95
|
**The `causal_trace` moment:**
|
|
48
96
|
```
|
|
@@ -52,93 +100,121 @@ causal_trace(problem="auth breaks after restart")
|
|
|
52
100
|
→ Via: keycloak:jwks-race
|
|
53
101
|
→ Fix: PollUntilContextTimeout 3min ← used this March 12, worked
|
|
54
102
|
```
|
|
55
|
-
*30 minutes of git blame
|
|
103
|
+
*30 minutes of git blame in one call.*
|
|
104
|
+
|
|
105
|
+
**The `autopilot` command:**
|
|
106
|
+
Run `autopilot` once and it generates a fully self-managing `CLAUDE.md` or `copilot-instructions.md` — tailored to your actual Brain content. Every AI (Claude, Cursor, Copilot, Windsurf, Gemini) gets the full ruleset for your project. No copy-paste, no manual writing. As the Brain learns more, re-run `autopilot` to upgrade the file.
|
|
56
107
|
|
|
57
108
|
---
|
|
58
109
|
|
|
59
|
-
##
|
|
110
|
+
## cachly vs. alternatives
|
|
111
|
+
|
|
112
|
+
| | cachly | mem0 | MemGPT / Letta | Plain CLAUDE.md |
|
|
113
|
+
|--|--------|------|----------------|-----------------|
|
|
114
|
+
| Persistent memory | ✅ | ✅ | ✅ | Manual |
|
|
115
|
+
| MCP server (no code changes) | ✅ | ✅ | ❌ | ✅ |
|
|
116
|
+
| Causal root cause analysis | ✅ | ❌ | ❌ | ❌ |
|
|
117
|
+
| Fully automatic (no explicit calls) | ✅ | ❌ | ❌ | ❌ |
|
|
118
|
+
| Failure prediction | ✅ | ❌ | ❌ | ❌ |
|
|
119
|
+
| Team knowledge sharing | ✅ | Paid | ❌ | ❌ |
|
|
120
|
+
| Git-ambient learning | ✅ | ❌ | ❌ | ❌ |
|
|
121
|
+
| 11-language search | ✅ | ❌ | ❌ | ❌ |
|
|
122
|
+
| GDPR / EU servers | ✅ | ❌ | ❌ | ✅ |
|
|
123
|
+
| Free tier forever | ✅ | Limited | ❌ | ✅ |
|
|
60
124
|
|
|
61
|
-
|
|
62
|
-
You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
|
|
125
|
+
---
|
|
63
126
|
|
|
64
|
-
|
|
127
|
+
## MCP Tools (89 total)
|
|
65
128
|
|
|
66
|
-
|
|
129
|
+
### 🧠 Session & Memory (most used)
|
|
67
130
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
131
|
+
| Tool | What it does |
|
|
132
|
+
|------|-------------|
|
|
133
|
+
| **`session_start`** | Full briefing: last session summary, open failures, recent lessons, brain health |
|
|
134
|
+
| **`session_end`** | Save what you built, auto-extract lessons from summary + git log |
|
|
135
|
+
| **`learn_from_attempts`** | Store structured lessons after any fix, deploy, or discovery |
|
|
136
|
+
| **`recall_best_solution`** | Best known solution for a topic — with success/failure history |
|
|
137
|
+
| **`remember_context`** | Cache architecture findings, decisions, file summaries |
|
|
138
|
+
| **`recall_context`** | Get exact context by key (supports glob) |
|
|
139
|
+
| **`smart_recall`** | BM25+ full-text search across all brain data — 11 languages |
|
|
140
|
+
| **`causal_trace`** | Root cause analysis through memory |
|
|
141
|
+
| **`brain_predict`** | Predict likely failures before they happen |
|
|
142
|
+
| **`memory_consolidate`** | Deduplicate and expire stale lessons |
|
|
143
|
+
| **`compact_recover`** | Full context recovery after hitting context window limit |
|
|
71
144
|
|
|
72
|
-
|
|
73
|
-
1. Signs you in (free, no credit card required)
|
|
74
|
-
2. Picks or creates your AI Brain instance
|
|
75
|
-
3. **Auto-detects** Cursor, Windsurf, VS Code, Claude Code, Continue.dev, **Cline & Zed**
|
|
76
|
-
4. Writes the correct MCP config for every detected editor
|
|
77
|
-
5. Creates `CLAUDE.md` with memory rules pre-filled
|
|
78
|
-
6. Shows your Brain Health snapshot right in the terminal
|
|
145
|
+
### 👥 Team Brain
|
|
79
146
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
147
|
+
| Tool | What it does |
|
|
148
|
+
|------|-------------|
|
|
149
|
+
| `team_learn` / `team_recall` | Share lessons across the team with author attribution |
|
|
150
|
+
| `team_synthesize` | Merge conflicting lessons into one canonical version |
|
|
151
|
+
| `madc_deliberate` | 6 specialist AI agents vote to resolve contradictory lessons |
|
|
152
|
+
| `memory_crystalize` | Distill all lessons into a Crystal for instant team context |
|
|
153
|
+
| `brain_doctor` | Health check: lesson count, IQ boost %, open failures |
|
|
154
|
+
| `autopilot` | Generate a self-managing `CLAUDE.md` / `copilot-instructions.md` from Brain content |
|
|
155
|
+
| `global_learn` / `global_recall` | Cross-project universal lessons |
|
|
156
|
+
| `publish_lesson` / `import_public_brain` | Share/import community knowledge |
|
|
84
157
|
|
|
85
|
-
|
|
158
|
+
### 🌍 Knowledge Commons (Global)
|
|
86
159
|
|
|
87
|
-
|
|
160
|
+
| Tool | What it does |
|
|
161
|
+
|------|-------------|
|
|
162
|
+
| `syndicate` | Contribute verified lesson to global Knowledge Commons |
|
|
163
|
+
| `syndicate_search` | Search community solutions by tech stack |
|
|
164
|
+
| `fedbrain_contribute` | Contribute with cryptographic provenance certificate |
|
|
165
|
+
| `fedbrain_search` | Context-weighted global search |
|
|
88
166
|
|
|
89
|
-
|
|
167
|
+
### ⚙️ Cache & Infrastructure
|
|
90
168
|
|
|
91
|
-
|
|
169
|
+
| Tool | What it does |
|
|
170
|
+
|------|-------------|
|
|
171
|
+
| `list_instances` / `create_instance` / `delete_instance` | Manage Brain instances |
|
|
172
|
+
| `cache_get` / `cache_set` / `cache_delete` | Standard cache operations |
|
|
173
|
+
| `cache_mget` / `cache_mset` | Bulk pipeline (single round-trip) |
|
|
174
|
+
| `semantic_search` | Find cached entries by meaning |
|
|
175
|
+
| `index_project` | Index source files for semantic retrieval |
|
|
92
176
|
|
|
93
|
-
|
|
177
|
+
### 📋 Roadmap & Planning
|
|
94
178
|
|
|
95
|
-
|
|
96
|
-
|
|
179
|
+
| Tool | What it does |
|
|
180
|
+
|------|-------------|
|
|
181
|
+
| `roadmap_add` / `roadmap_update` | Persistent project roadmap stored in Brain |
|
|
182
|
+
| `roadmap_list` / `roadmap_next` | List items or get the single most important next action |
|
|
97
183
|
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
"mcpServers": {
|
|
101
|
-
"cachly": {
|
|
102
|
-
"type": "stdio",
|
|
103
|
-
"command": "npx",
|
|
104
|
-
"args": ["-y", "@cachly-dev/mcp-server@latest"],
|
|
105
|
-
"env": {
|
|
106
|
-
"CACHLY_JWT": "your-jwt-token",
|
|
107
|
-
"CACHLY_INSTANCE_ID": "your-instance-id"
|
|
184
|
+
---
|
|
108
185
|
|
|
109
|
-
|
|
110
|
-
You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
|
|
186
|
+
## FAQ
|
|
111
187
|
|
|
112
|
-
**
|
|
188
|
+
**Does my AI need to call `session_start` manually?**
|
|
189
|
+
No. Sessions start and end automatically on the first tool call and when the editor closes.
|
|
113
190
|
|
|
114
|
-
|
|
191
|
+
**What happens to memory if I switch projects?**
|
|
192
|
+
Memory is scoped per Brain instance. You can have one instance per project, or one shared instance across projects.
|
|
115
193
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```
|
|
194
|
+
**Can my whole team share the same Brain?**
|
|
195
|
+
Yes. `team_learn` / `team_recall` share lessons with author attribution. `memory_crystalize` gives any new team member instant full context.
|
|
119
196
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
2. Picks or creates your AI Brain instance
|
|
123
|
-
3. **Auto-detects** Cursor, Windsurf, VS Code, Claude Code, Continue.dev, **Cline & Zed**
|
|
124
|
-
4. Writes the correct MCP config for every detected editor
|
|
125
|
-
5. Creates `CLAUDE.md` with memory rules pre-filled
|
|
126
|
-
6. Shows your Brain Health snapshot right in the terminal
|
|
197
|
+
**What is a Memory Crystal?**
|
|
198
|
+
A compressed snapshot of all lessons distilled into a compact briefing. Injected at every session start so the AI arrives pre-briefed even with a cold context window.
|
|
127
199
|
|
|
128
|
-
**
|
|
129
|
-
|
|
130
|
-
npx @cachly-dev/mcp-server@latest index .
|
|
131
|
-
```
|
|
200
|
+
**What is causal_trace and why is it unique?**
|
|
201
|
+
Given any error or problem, `causal_trace` walks the Causal Knowledge Graph (CKG) to find: the root cause, intermediate causes, and the exact fix that worked — including the date and commands used. No other memory system builds or queries a causal graph.
|
|
132
202
|
|
|
133
|
-
**
|
|
203
|
+
**How does cachly learn from git commits?**
|
|
204
|
+
The `setup` wizard installs a git post-commit hook. After each commit, the hook calls `cls_ingest` with the commit message and changed files. The Brain extracts lessons automatically — no `session_end` required.
|
|
134
205
|
|
|
135
|
-
|
|
206
|
+
**What happens if I hit the context window limit mid-session?**
|
|
207
|
+
Call `compact_recover`. It reconstructs full context from the Memory Crystal + recent sessions + WIP registry entries — typically restoring full context in one tool call.
|
|
136
208
|
|
|
137
|
-
|
|
209
|
+
**Is my code sent to cachly servers?**
|
|
210
|
+
No code content is stored. cachly stores: lesson text, commit messages, session summaries, and key-value context entries. All data is on German servers, GDPR-compliant.
|
|
138
211
|
|
|
139
|
-
**
|
|
212
|
+
**Does cachly work without an internet connection?**
|
|
213
|
+
No — cachly is a managed cloud service. The MCP server is a thin client; the Brain runs on cachly's infrastructure.
|
|
140
214
|
|
|
141
|
-
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Manual Setup (alternative to the wizard)
|
|
142
218
|
|
|
143
219
|
<details>
|
|
144
220
|
<summary><b>Claude Code</b> (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
|
|
@@ -147,156 +223,31 @@ npx @cachly-dev/mcp-server@latest index .
|
|
|
147
223
|
{
|
|
148
224
|
"mcpServers": {
|
|
149
225
|
"cachly": {
|
|
150
|
-
"type": "stdio",
|
|
151
226
|
"command": "npx",
|
|
152
|
-
"args": ["-y", "@cachly-dev/mcp-server@latest"]
|
|
153
|
-
"env": {
|
|
154
|
-
"CACHLY_JWT": "your-jwt-token",
|
|
155
|
-
"CACHLY_INSTANCE_ID": "your-instance-id"
|
|
156
|
-
}
|
|
227
|
+
"args": ["-y", "@cachly-dev/mcp-server@latest"]
|
|
157
228
|
}
|
|
158
229
|
}
|
|
159
230
|
}
|
|
160
231
|
```
|
|
232
|
+
On the first tool call your AI will prompt you to sign in — takes 10 seconds.
|
|
161
233
|
</details>
|
|
162
234
|
|
|
163
235
|
<details>
|
|
164
|
-
<summary><b>Cursor / Windsurf / VS Code</b> (<code>.cursor/mcp.json</code> / <code>.mcp.json</code>)</summary>
|
|
236
|
+
<summary><b>Cursor / Windsurf / VS Code / Copilot / Cline</b> (<code>.cursor/mcp.json</code> / <code>.mcp.json</code>)</summary>
|
|
165
237
|
|
|
166
238
|
```json
|
|
167
239
|
{
|
|
168
|
-
"
|
|
240
|
+
"mcpServers": {
|
|
169
241
|
"cachly": {
|
|
170
242
|
"type": "stdio",
|
|
171
243
|
"command": "npx",
|
|
172
|
-
"args": ["-y", "@cachly-dev/mcp-server@latest"]
|
|
173
|
-
"env": {
|
|
174
|
-
"CACHLY_JWT": "your-jwt-token",
|
|
175
|
-
"CACHLY_INSTANCE_ID": "your-instance-id"
|
|
176
|
-
}
|
|
244
|
+
"args": ["-y", "@cachly-dev/mcp-server@latest"]
|
|
177
245
|
}
|
|
178
246
|
}
|
|
179
247
|
}
|
|
180
248
|
```
|
|
181
249
|
</details>
|
|
182
250
|
|
|
183
|
-
**Step 3 — Add to `CLAUDE.md` / `.github/copilot-instructions.md`:**
|
|
184
|
-
|
|
185
|
-
```markdown
|
|
186
|
-
## AI Brain Rules (cachly)
|
|
187
|
-
- Call session_start BEFORE reading any files or making changes
|
|
188
|
-
- Call learn_from_attempts AFTER every fix, deploy, or discovery
|
|
189
|
-
- Call session_end when closing the window
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## With vs. Without cachly
|
|
195
|
-
|
|
196
|
-
| Situation | Without cachly | With cachly |
|
|
197
|
-
|-----------|----------------|-------------|
|
|
198
|
-
| Session start | "What's your architecture?" | "Ready. 23 lessons, last session: deployed API." |
|
|
199
|
-
| Known bug hits again | Re-researches from scratch | "You fixed this on March 12, here's the exact command" |
|
|
200
|
-
| After holiday / team handoff | Context dead | Fully briefed in < 10 seconds |
|
|
201
|
-
| Repeated LLM patterns | Pays for each re-discovery | Cached by meaning, ~1,200 tokens saved per hit |
|
|
202
|
-
| New team member | Weeks to onboard | `session_start` gives full context instantly |
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## 51 MCP Tools
|
|
207
|
-
|
|
208
|
-
### 🧠 Session & Memory (most used)
|
|
209
|
-
|
|
210
|
-
| Tool | What it does |
|
|
211
|
-
|------|-------------|
|
|
212
|
-
| **`session_start`** | Full briefing: last session summary, open failures, recent lessons, brain health |
|
|
213
|
-
| **`session_end`** | Save what you built, auto-extract lessons from summary + ambient git log |
|
|
214
|
-
| **`session_handoff`** | Hand off remaining tasks to next window, with context |
|
|
215
|
-
| **`auto_learn_session`** | Batch-learn from a list of observations |
|
|
216
|
-
| **`sync_file_changes`** | Sync changed files into brain index |
|
|
217
|
-
| **`learn_from_attempts`** | Store structured lessons after any fix, deploy, or discovery |
|
|
218
|
-
| **`recall_best_solution`** | Best known solution for a topic — with success/failure history |
|
|
219
|
-
| **`recall_at`** | Recall a lesson at a specific point in time |
|
|
220
|
-
| **`remember_context`** | Cache architecture findings, decisions, file summaries |
|
|
221
|
-
| **`recall_context`** | Get exact context by key (supports glob) |
|
|
222
|
-
| **`list_remembered`** | See all cached context entries |
|
|
223
|
-
| **`forget_context`** | Remove stale context |
|
|
224
|
-
| **`smart_recall`** | BM25+ full-text search across all brain data — multilingual: EN, DE, FR, ES, IT, PT, ZH, JA, KO, **AR, HE** |
|
|
225
|
-
| **`setup_ai_memory`** | Interactive wizard to configure AI memory |
|
|
226
|
-
|
|
227
|
-
### 🌍 Multilingual Brain — Search in Any Language
|
|
228
|
-
|
|
229
|
-
The Brain's search engine understands **11 languages natively** — no configuration required.
|
|
230
|
-
|
|
231
|
-
| Script | Languages | Tokenization |
|
|
232
|
-
|--------|-----------|-------------|
|
|
233
|
-
| Latin | EN, DE, FR, ES, IT, PT | Whitespace + stopwords |
|
|
234
|
-
| CJK | Chinese (ZH), Japanese (JA), Korean (KO) | Character bigrams |
|
|
235
|
-
| RTL | Arabic (AR), Hebrew (HE) | Word tokenization + light stemming |
|
|
236
|
-
|
|
237
|
-
**Romanization matching** — store lessons in Japanese, search in romaji:
|
|
238
|
-
```
|
|
239
|
-
smart_recall("kontena") → finds コンテナ docs
|
|
240
|
-
smart_recall("depuroi") → finds デプロイ docs
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
**Cross-language retrieval** — 130+ tech term synonyms EN↔JA↔ZH↔KO↔AR↔HE:
|
|
244
|
-
```
|
|
245
|
-
smart_recall("deploy") → finds デプロイ, 部署, 배포, نشر, פריסה
|
|
246
|
-
smart_recall("デプロイ") → finds "deploy", "deployment"
|
|
247
|
-
smart_recall("خطأ") → finds "error", エラー, 错误
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### 💡 Legendary Brain Features
|
|
251
|
-
|
|
252
|
-
| Feature | How it works |
|
|
253
|
-
|---------|-------------|
|
|
254
|
-
| **Team Telepathy** | Multi-dev Brain: the `author` param on `learn_from_attempts` shares fixes across the whole team. Every `session_start` shows colleagues' lessons. |
|
|
255
|
-
| **Ambient Git Learning** | Pass `workspace_path` to `session_end` — it auto-reads `git log`, stores recent commits as Brain lessons. Zero extra calls. |
|
|
256
|
-
| **Memory Crystals** | `memory_crystalize` distills all lessons into a compact Crystal injected at every `session_start`. AI arrives pre-loaded with team knowledge. |
|
|
257
|
-
| **IQ Boost** | `brain_doctor` reports `iq_boost_pct` — how much smarter your AI gets vs. baseline from cached lessons. |
|
|
258
|
-
|
|
259
|
-
### ⚙️ Instance Management
|
|
260
|
-
|
|
261
|
-
| Tool | What it does |
|
|
262
|
-
|------|-------------|
|
|
263
|
-
| `list_instances` | List all your cache instances |
|
|
264
|
-
| `create_instance` | Spin up a new instance (free or paid) |
|
|
265
|
-
| `get_connection_string` | Get the `redis://` URL for your app |
|
|
266
|
-
| `delete_instance` | Remove an instance |
|
|
267
|
-
| `get_real_time_stats` | Memory, hit rate, ops/sec |
|
|
268
|
-
|
|
269
|
-
### 🗄️ Cache Operations
|
|
270
|
-
|
|
271
|
-
| Tool | What it does |
|
|
272
|
-
|------|-------------|
|
|
273
|
-
| `cache_get` / `cache_set` / `cache_delete` | Standard cache operations |
|
|
274
|
-
| `cache_mget` / `cache_mset` | Bulk pipeline (single round-trip) |
|
|
275
|
-
| `cache_lock_acquire` / `cache_lock_release` | Distributed Redlock-lite |
|
|
276
|
-
| `cache_stream_set` / `cache_stream_get` | LLM token stream caching |
|
|
277
|
-
|
|
278
|
-
### 🔍 Semantic Cache
|
|
279
|
-
|
|
280
|
-
| Tool | What it does |
|
|
281
|
-
|------|-------------|
|
|
282
|
-
| `semantic_search` | Find cached entries by meaning (pgvector HNSW, EU-hosted) |
|
|
283
|
-
| `semantic_warmup` | Pre-warm cache with prompt/response pairs |
|
|
284
|
-
| `detect_namespace` | Auto-classify prompt into code/qa/summary/translation/creative |
|
|
285
|
-
|
|
286
|
-
### 👥 Team Brain
|
|
287
|
-
|
|
288
|
-
| Tool | What it does |
|
|
289
|
-
|------|-------------|
|
|
290
|
-
| `team_learn` / `team_recall` | Share lessons across the team |
|
|
291
|
-
| `team_synthesize` | Consolidate multiple lessons into one authoritative version |
|
|
292
|
-
| `memory_crystalize` | Distill all lessons into a Crystal snapshot for instant team context |
|
|
293
|
-
| `brain_doctor` | Health check: lesson count, IQ boost %, open failures, quality score |
|
|
294
|
-
| `global_learn` / `global_recall` | Cross-project universal lessons |
|
|
295
|
-
| `publish_lesson` / `import_public_brain` | Share/import community knowledge |
|
|
296
|
-
| `trace_dependency` | Causal chain — find lessons affected by a dependency change |
|
|
297
|
-
| `list_orgs` / `create_org` | Manage team organizations |
|
|
298
|
-
| `invite_member` / `get_org_plan` | Invite a developer to your org by email |
|
|
299
|
-
|
|
300
251
|
---
|
|
301
252
|
|
|
302
253
|
## Pricing
|
|
@@ -306,22 +257,23 @@ smart_recall("خطأ") → finds "error", エラー, 错误
|
|
|
306
257
|
| **Free** | 25 MB | **€0/mo forever** | Dev & side projects |
|
|
307
258
|
| **Dev** | 200 MB | €19/mo | Individual developers |
|
|
308
259
|
| **Pro** | 900 MB | €49/mo | Teams |
|
|
309
|
-
| **Speed** | 900 MB + Dragonfly
|
|
260
|
+
| **Speed** | 900 MB + Dragonfly | €79/mo | AI-heavy workloads |
|
|
310
261
|
| **Business** | 7 GB | €199/mo | Scale-ups |
|
|
311
262
|
|
|
312
|
-
✅ All plans: **German servers · GDPR-compliant · 99.9% SLA · No credit card for Free
|
|
263
|
+
✅ All plans: **German servers · GDPR-compliant · 99.9% SLA · No credit card for Free**
|
|
313
264
|
|
|
314
265
|
---
|
|
315
266
|
|
|
316
267
|
## Environment Variables
|
|
317
268
|
|
|
269
|
+
Set automatically by the setup wizard — only needed for manual configuration.
|
|
270
|
+
|
|
318
271
|
| Variable | Default | Description |
|
|
319
272
|
|----------|---------|-------------|
|
|
320
|
-
| `CACHLY_JWT` | — |
|
|
321
|
-
| `
|
|
273
|
+
| `CACHLY_JWT` | — | API token (set by wizard, or get from cachly.dev) |
|
|
274
|
+
| `CACHLY_BRAIN_INSTANCE_ID` | — | Default instance UUID (optional if passed per-call) |
|
|
322
275
|
| `CACHLY_API_URL` | `https://api.cachly.dev` | Override for self-hosted |
|
|
323
276
|
| `CACHLY_NO_TELEMETRY` | unset | Set to `1` to disable anonymous usage pings |
|
|
324
|
-
| `CACHLY_NO_UPDATE_CHECK` | unset | Set to `1` to disable the version-check on startup |
|
|
325
277
|
|
|
326
278
|
---
|
|
327
279
|
|
|
@@ -329,18 +281,15 @@ smart_recall("خطأ") → finds "error", エラー, 错误
|
|
|
329
281
|
|
|
330
282
|
| Package | What it does |
|
|
331
283
|
|---------|-------------|
|
|
332
|
-
| **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here
|
|
333
|
-
| **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** |
|
|
334
|
-
| **[`@cachly-dev/
|
|
335
|
-
| **[`@cachly-dev/cli`](https://www.npmjs.com/package/@cachly-dev/cli)** | Terminal CLI — manage instances, cache data, brain lessons: `npm i -g @cachly-dev/cli` |
|
|
336
|
-
| **[`@cachly-dev/sdk`](https://www.npmjs.com/package/@cachly-dev/sdk)** | Node.js/TypeScript SDK — use managed Redis, semantic cache & AI memory directly in your app |
|
|
284
|
+
| **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here |
|
|
285
|
+
| **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** | Cut LLM costs 60–90% in JS/TS apps |
|
|
286
|
+
| **[`@cachly-dev/cli`](https://www.npmjs.com/package/@cachly-dev/cli)** | Terminal CLI — manage instances and brain |
|
|
337
287
|
|
|
338
288
|
---
|
|
339
289
|
|
|
340
290
|
## Links
|
|
341
291
|
|
|
342
292
|
- 🌐 [cachly.dev](https://cachly.dev) — Dashboard & free signup
|
|
343
|
-
- 📖 [
|
|
344
|
-
- 💬 [GitHub Issues](https://github.com/cachly-dev/mcp
|
|
345
|
-
- ⭐ [Star on GitHub](https://github.com/cachly-dev/mcp
|
|
346
|
-
- 📦 [npm](https://www.npmjs.com/package/@cachly-dev/mcp-server)
|
|
293
|
+
- 📖 [Docs](https://cachly.dev/docs/ai-memory) — Full documentation
|
|
294
|
+
- 💬 [GitHub Issues](https://github.com/cachly-dev/cachly-mcp/issues) — Bug reports & feature requests
|
|
295
|
+
- ⭐ [Star on GitHub](https://github.com/cachly-dev/cachly-mcp) — If cachly saves you time, a star means a lot!
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the brain_predict_failures handler.
|
|
3
|
+
*
|
|
4
|
+
* Tests the pure scoring and ranking logic without real Redis:
|
|
5
|
+
* - empty brain → "no known failure patterns" message
|
|
6
|
+
* - lesson-based predictions: failure-outcome lessons matching context are surfaced
|
|
7
|
+
* - deduplication: same failure text appears only once
|
|
8
|
+
* - ranking: higher-probability failures come first
|
|
9
|
+
* - format=brief: no fix line; format=detailed: fix + lesson lines included
|
|
10
|
+
* - high-risk badge: ≥60% probability triggers the ⚠️ warning line
|
|
11
|
+
* - no false positives: unrelated lessons are not returned
|
|
12
|
+
* - severity boost: critical lessons rank above major ones with equal base score
|
|
13
|
+
* - top_k limit: at most top_k results returned
|
|
14
|
+
*
|
|
15
|
+
* Run: npx vitest run src/__tests__/brain-predict-failures.test.ts
|
|
16
|
+
*/
|
|
17
|
+
export {};
|