@cachly-dev/mcp-server 0.10.24 → 0.10.25

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 (44) hide show
  1. package/CHANGELOG.md +0 -131
  2. package/README.md +112 -136
  3. package/dist/__tests__/brain-predict-failures.test.d.ts +17 -0
  4. package/dist/__tests__/brain-predict-failures.test.js +339 -0
  5. package/dist/__tests__/brain-predict-failures.test.js.map +1 -0
  6. package/dist/handlers/brain.js +67 -7
  7. package/dist/handlers/brain.js.map +1 -1
  8. package/dist/handlers/fedbrain.js +44 -93
  9. package/dist/handlers/fedbrain.js.map +1 -1
  10. package/dist/handlers/roadmap.js +2 -8
  11. package/dist/handlers/roadmap.js.map +1 -1
  12. package/dist/handlers/syndicate.js +7 -15
  13. package/dist/handlers/syndicate.js.map +1 -1
  14. package/dist/handlers/team.js +50 -62
  15. package/dist/handlers/team.js.map +1 -1
  16. package/dist/index.js +122 -979
  17. package/dist/index.js.map +1 -1
  18. package/dist/tools.d.ts +54 -3
  19. package/dist/tools.js +62 -8
  20. package/dist/tools.js.map +1 -1
  21. package/package.json +13 -29
  22. package/scripts/postinstall.js +12 -12
  23. package/server.json +9 -3
  24. package/smithery.yaml +8 -15
  25. package/src/__tests__/brain-predict-failures.test.ts +430 -0
  26. package/src/handlers/brain.ts +64 -7
  27. package/src/handlers/fedbrain.ts +38 -88
  28. package/src/handlers/roadmap.ts +2 -7
  29. package/src/handlers/syndicate.ts +7 -13
  30. package/src/handlers/team.ts +33 -57
  31. package/src/index.ts +135 -1011
  32. package/src/tools.ts +66 -8
  33. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -50
  34. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  35. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -25
  36. package/.github/workflows/publish.yml +0 -72
  37. package/LAUNCH_TEXTS.md +0 -182
  38. package/LICENSE +0 -202
  39. package/dist/__tests__/auth.test.d.ts +0 -1
  40. package/dist/__tests__/auth.test.js +0 -107
  41. package/dist/__tests__/auth.test.js.map +0 -1
  42. package/glama.json +0 -36
  43. package/llms.txt +0 -155
  44. package/src/__tests__/auth.test.ts +0 -147
package/CHANGELOG.md CHANGED
@@ -7,137 +7,6 @@
7
7
 
8
8
  ---
9
9
 
10
- ## [0.10.24] – 2026-05-14
11
-
12
- ### Funnel visibility + server.json version sync
13
-
14
- - `first_call_success` now includes `instance_id` for full per-tenant attribution in the `mcp_events` table.
15
- - `server.json` version bumped to 0.10.24 — Smithery and MCP directory indexes now show the current version.
16
-
17
- ---
18
-
19
- ## [0.10.23] – 2026-05-14
20
-
21
- ### Full activation funnel + UTM tracking
22
-
23
- - **`sendFunnelEvent` carries JWT**: all funnel events (`setup_started`, `device_flow_completed`, `first_call_success`) now include the JWT so the backend can resolve them to a tenant. Activation funnel is now fully attributable per user.
24
- - **`cachly share` UTM link**: the generated tweet now includes `https://cachly.dev?ref=share&utm_source=x&utm_medium=social&utm_campaign=cli-share` so shares can be traced back to new signups.
25
-
26
- ---
27
-
28
- ## [0.10.22] – 2026-05-14
29
-
30
- ### Activation telemetry, health Redis ping, join backup
31
-
32
- - **`first_call_success` telemetry**: fires once per process on the first successful brain/context tool call. Combined with `setup_started → device_flow_completed → first_call_success`, the full activation funnel is now visible.
33
- - **`cachly health` Redis PING**: section 3 now opens an actual Redis connection and sends `PING` — verifies end-to-end connectivity, not just instance metadata.
34
- - **`cachly join` corrupt JSON**: backs up corrupted config files to `.bak` before overwriting, matching the `mergeMcpConfig` behavior.
35
-
36
- ---
37
-
38
- ## [0.10.21] – 2026-05-14
39
-
40
- ### Stability hardening — corrupt configs, silent auth failures, upgrade validation
41
-
42
- - **`mergeMcpConfig` corrupt JSON**: instead of silently overwriting, backs up the corrupted file to `.bak` and prints a warning so the user knows their previous config was preserved.
43
- - **`getConnection` auth failure**: if the `/connection` endpoint returns 401/403, throws an actionable "run `cachly setup` to refresh credentials" error instead of silently attempting a password-less Redis connect that fails with cryptic `NOAUTH`.
44
- - **`upgrade` version validation**: validates that the npm registry response contains a valid semver string before comparing — prevents false "update available" from a malformed registry response.
45
-
46
- ---
47
-
48
- ## [0.10.20] – 2026-05-14
49
-
50
- ### Edge case hardening — silent failures eliminated
51
-
52
- - **`getConnection` status messages**: `failed`, `suspended`, and `pending_payment` now each get a specific actionable message instead of the generic "not reachable" fallback. Users know exactly what happened and where to go to fix it.
53
- - **`setup` write errors**: config file write failures now print a clear warning with the OS error and a recovery hint instead of silently succeeding.
54
- - **`join` write errors**: permission and unexpected filesystem errors are surfaced per-file instead of silently swallowed. Expected "editor not installed" cases are still quiet.
55
- - **Auto-provision telemetry**: if free-tier auto-provision returns a non-2xx response, a `auto_provision_failed` telemetry event fires so the team can detect new-user activation failures in real time.
56
-
57
- ---
58
-
59
- ## [0.10.19] – 2026-05-14
60
-
61
- ### Fix: accurate provisioning time estimate
62
-
63
- - `getConnection` no longer says "30 seconds" — the message now correctly says "1–3 minutes" for first-time provisioning. This prevents users from thinking their instance failed just because the first tool call waited 25 s and still saw `provisioning`.
64
- - Dashboard instance detail page provisioning banner updated to match ("1–3 minutes" instead of "under 60 seconds").
65
-
66
- ---
67
-
68
- ## [0.10.17] – 2026-05-14
69
-
70
- ### `cachly upgrade` — check for newer versions
71
-
72
- - **`cachly upgrade`** — fetches the latest version from the npm registry and compares with the running version. If outdated, shows current vs. latest and the one-liner to update (`npx @cachly-dev/mcp-server@latest setup`). No auth required.
73
- - Added `upgrade` to no-auth bypass list and splash screen.
74
-
75
- ### Dashboard — Brain Badge widget
76
-
77
- - Instance detail page now shows a live badge preview + copy-ready Markdown and HTML snippets directly in the dashboard. No CLI needed.
78
- - Badge renders as `![cachly Brain](https://api.cachly.dev/api/v1/badge/<id>)` — one click to copy.
79
-
80
- ---
81
-
82
- ## [0.10.16] – 2026-05-14
83
-
84
- ### `cachly join` — accept a Brain invite in one command
85
-
86
- - **`cachly join <token>`** — the missing half of the invite loop. Accepts a shared Brain invite link:
87
- 1. Fetches invite info (public, no auth) — shows Brain name, tier, expiry
88
- 2. Prompts for confirmation
89
- 3. If no JWT: starts Device Flow sign-in (browser, 10 s)
90
- 4. Writes `CACHLY_BRAIN_INSTANCE_ID` into every detected editor MCP config (`.mcp.json`, `.cursor/mcp.json`, `.windsurf/mcp.json`, `.vscode/mcp.json`, `~/.claude/mcp.json`)
91
- 5. Suggests `cachly badge` as next step
92
- - Added `join` to no-auth bypass list
93
- - Splash screen updated to list `join` command
94
-
95
- ### MCP Directory metadata
96
-
97
- - **`smithery.yaml`** — added `name` + `description` block for Smithery listing quality
98
- - **`glama.json`** — added keywords: `cline`, `zed`, `brain-from-git`, `failure-prediction`, `memory-crystals`, `readme-badge`, `incremental-learning`
99
- - **`server.json`** — version bumped to `0.10.15`
100
-
101
- ---
102
-
103
- ## [0.10.15] – 2026-05-14
104
-
105
- ### Brain Badge
106
-
107
- - **`cachly badge`** — new CLI command that outputs the Markdown + HTML snippet for embedding a live lesson-count badge in any README or website. Badge SVG served by `GET /api/v1/badge/:instanceId` (public, no auth, rate-limited 30 req/min, result cached 1 h in instance Valkey). Badge shows lesson count only — no topic names or content.
108
- - **Setup CTA** — both setup flows now print `npx ... badge` as the next suggested action after successful configuration.
109
- - **README** — Brain Badge section added with copy-paste Markdown snippet and explanation. Badge shield added to header.
110
-
111
- ---
112
-
113
- ## [0.10.8] – 2026-05-14
114
-
115
- ### Viral CLI — 6 new commands
116
-
117
- - **`cachly demo`** — zero-signup Brain preview. Reads local `.git/` history, classifies commits by type (fix/feat/security/deploy/refactor/perf), and renders an ASCII table showing commit count, date range, contributors, per-category bar charts, and sample security + bug-fix lessons. No account or token required — works before any sign-in.
118
-
119
- - **`cachly share`** — shareable ASCII stats card. Fetches live Brain stats (lessons, recalls, tokens/cost saved, Brain level) and generates a tweet-ready text block with `#AIMemory #ClaudeCode #Cursor` hashtags. Requires `CACHLY_JWT`.
120
-
121
- - **`cachly digest`** — weekly Brain summary. Displays a formatted summary table: lessons stored, recalls performed, tokens saved, estimated cost saved, Brain level, top team contributors, and top-recalled lessons. Includes a crontab snippet for automated Monday morning delivery. Requires `CACHLY_JWT`.
122
-
123
- - **`cachly invite [email]`** — team referral. Accepts an email address as argument or via interactive prompt, then POSTs to `/api/v1/team/invite`. Handles 409 (already a member) gracefully. Requires `CACHLY_JWT`.
124
-
125
- - **`cachly health`** — connection check. Validates JWT (decode + expiry), tests API reachability, checks Brain instance status, scans all editor MCP config files (Claude Code, Cursor, Windsurf, VS Code, Zed, Continue), and verifies the git post-commit hook. Exits 1 if any checks fail — CI-friendly.
126
-
127
- - **No-args splash screen** — running `npx @cachly-dev/mcp-server@latest` in a TTY now shows a violet-framed help card listing all commands instead of silently starting the MCP server.
128
-
129
- ### brain_from_git — Incremental mode + progress feedback
130
-
131
- - **Incremental by default** — after the first full run, subsequent calls only process commits since the last ingested SHA (stored in Redis with 90-day TTL). Repeated calls on active repos are near-instant.
132
- - **Progress output** — reports progress to stderr every ~10% of commits (`⏳ Processing N/total…`) and prints a completion summary (`✅ brain_from_git complete: N/total commits ingested`).
133
- - New `incremental` boolean parameter (default `true`). Pass `false` to force a full reprocess.
134
-
135
- ### README
136
-
137
- - Complete rewrite: `cachly demo` featured at the very top with embedded ASCII preview output, all 6 CLI commands documented, Zed manual-setup section added, competitor table updated, FAQ expanded with incremental `brain_from_git` Q&A.
138
-
139
- ---
140
-
141
10
  ## [0.10.0] – 2026-05-08
142
11
 
143
12
  ### Zero-Friction Onboarding
package/README.md CHANGED
@@ -1,93 +1,58 @@
1
1
  # 🧠 cachly AI Brain — MCP Server
2
2
 
3
- > **Persistent memory for Claude Code, Cursor, GitHub Copilot, Windsurf, Cline & Zed.**
4
- > Your AI remembers every lesson, every fix, every architecture decision — forever.
3
+ > **Your AI forgot that 3-hour fix. Again.**
4
+ > cachly gives every AI coding assistant — Claude Code, Cursor, GitHub Copilot, Windsurf, Cline & Zed — **permanent memory across all sessions, all projects, all editors.**
5
+
6
+ <p align="center">
7
+ <a href="https://cachly.dev?utm_source=npm&utm_medium=readme&utm_campaign=mcp-server">
8
+ <img src="https://img.shields.io/badge/▶_Free_Brain_in_30s-cachly.dev-7c3aed?style=for-the-badge" alt="Free Brain" />
9
+ </a>
10
+ &nbsp;&nbsp;
11
+ <a href="https://marketplace.visualstudio.com/items?itemName=cachly-dev.cachly-brain">
12
+ <img src="https://img.shields.io/badge/VS_Code_Extension-Install_Free-0078d7?style=for-the-badge&logo=visual-studio-code" alt="VS Code Extension" />
13
+ </a>
14
+ </p>
5
15
 
6
16
  <p align="center">
7
17
  <a href="https://www.npmjs.com/package/@cachly-dev/mcp-server">
8
- <img src="https://img.shields.io/npm/v/@cachly-dev/mcp-server?color=violet&logo=npm" alt="npm version" />
18
+ <img src="https://img.shields.io/npm/v/@cachly-dev/mcp-server?color=red&logo=npm" alt="npm version" />
9
19
  </a>
10
20
  &nbsp;
11
21
  <a href="https://www.npmjs.com/package/@cachly-dev/mcp-server">
12
- <img src="https://img.shields.io/npm/dw/@cachly-dev/mcp-server?color=blue&label=weekly%20installs" alt="npm downloads" />
22
+ <img src="https://img.shields.io/npm/dw/@cachly-dev/mcp-server?color=blue&label=weekly%20installs" alt="weekly installs" />
13
23
  </a>
14
24
  &nbsp;
15
- <a href="https://cachly.dev">
16
- <img src="https://img.shields.io/badge/Free%20tier-€0%2Fmo-brightgreen" alt="Free tier" />
25
+ <a href="https://www.npmjs.com/package/@cachly-dev/mcp-server">
26
+ <img src="https://img.shields.io/npm/dt/@cachly-dev/mcp-server?color=blueviolet&label=total%20installs" alt="total installs" />
17
27
  </a>
18
28
  &nbsp;
19
- <a href="https://cachly.dev/legal">
20
- <img src="https://img.shields.io/badge/GDPR-EU%20servers-green" alt="GDPR: EU servers" />
29
+ <a href="https://cachly.dev?utm_source=npm&utm_medium=readme&utm_campaign=mcp-server">
30
+ <img src="https://img.shields.io/badge/Free%20tier-€0%2Fmo%20forever-brightgreen" alt="Free tier" />
21
31
  </a>
22
32
  &nbsp;
23
- <img src="https://img.shields.io/badge/89%20MCP%20tools-violet" alt="89 MCP tools" />
33
+ <a href="https://cachly.dev/legal">
34
+ <img src="https://img.shields.io/badge/GDPR-EU%20servers-green" alt="GDPR: EU only" />
35
+ </a>
24
36
  &nbsp;
25
37
  <img src="https://img.shields.io/badge/License-Apache--2.0-yellow" alt="License: Apache-2.0" />
26
- &nbsp;
27
- <a href="https://cachly.dev">
28
- <img src="https://img.shields.io/badge/Brain%20badge-embed%20in%20README-7c3aed" alt="Brain badge" />
29
- </a>
30
38
  </p>
31
39
 
32
40
  ---
33
41
 
34
- ## Try it right now — no account needed
35
-
36
- ```bash
37
- npx @cachly-dev/mcp-server@latest demo
38
- ```
39
-
40
- Run this in any project directory. It reads your git history and shows exactly what your AI would know:
41
-
42
- ```
43
- ┌─────────────────────────────────────────────────────────────┐
44
- │ 🧠 Brain Preview — What your AI would know │
45
- ├─────────────────────────────────────────────────────────────┤
46
- │ Commits analysed : 847 Date range: 2024-01-12 → 2026-05-14 │
47
- │ Lessons extracted: 634 Contributors: 7 │
48
- ├─────────────────────────────────────────────────────────────┤
49
- │ Category breakdown: │
50
- │ 🔧 fix ████████████████████ 312 │
51
- │ ✨ feat ███████████████ 189 │
52
- │ 🔒 security ██ 18 │
53
- │ 🚀 deploy ██ 15 │
54
- ├─────────────────────────────────────────────────────────────┤
55
- │ 🔒 Security fixes your AI would know: │
56
- │ • fix(auth): JWT expiry check before signature validation │
57
- │ • security: sanitize webhook payload before JSON.parse │
58
- ├─────────────────────────────────────────────────────────────┤
59
- │ 🔧 Bug fixes your AI would remember: │
60
- │ • fix: Redis pub/sub race condition under high concurrency │
61
- │ • fix: k8s readinessProbe threshold too low for cold start │
62
- │ • fix: Stripe idempotency_key missing on retry path │
63
- │ • fix: tRPC context not forwarded to background jobs │
64
- ├─────────────────────────────────────────────────────────────┤
65
- │ 💡 With cachly, your AI arrives pre-briefed every session. │
66
- │ No more re-explaining. No more repeated mistakes. │
67
- └─────────────────────────────────────────────────────────────┘
68
-
69
- Make this permanent (free, 30 seconds):
70
- $ npx @cachly-dev/mcp-server@latest setup
71
-
72
- Works with: Claude Code · Cursor · Windsurf · Copilot · Cline · Zed
73
- Free forever · GDPR · German servers · No credit card
74
- ```
75
-
76
- ---
77
-
78
42
  ## The Problem
79
43
 
80
44
  Every morning, you open your AI coding assistant. It doesn't remember yesterday.
81
45
  You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
82
46
 
83
- **The average developer wastes 45 minutes/day re-establishing context.**
47
+ **The average developer wastes 45 minutes/day re-establishing context.**
48
+ That's ~$18,000/year per developer — before you even count the re-discovered bugs.
84
49
 
85
50
  ---
86
51
 
87
52
  ## One Command. Fully Automatic.
88
53
 
89
54
  ```bash
90
- npx @cachly-dev/mcp-server@latest setup
55
+ npx @cachly-dev/init
91
56
  ```
92
57
 
93
58
  Run it once. It handles everything:
@@ -96,15 +61,37 @@ Run it once. It handles everything:
96
61
  2. **Detects your editors** — Claude Code, Cursor, Windsurf, VS Code, Copilot, Cline & Zed
97
62
  3. **Writes the MCP config** for every detected editor automatically
98
63
  4. **Creates `CLAUDE.md`** with Brain rules so your AI acts autonomously
99
- 5. **Reads your git history** — extracts lessons from years of commits before your first session
100
- 6. **Installs a git hook** — learns from every future commit automatically
64
+ 5. **Installs a git hook** that learns from every commit automatically
101
65
 
102
66
  **Restart your editor.** From now on your AI arrives pre-briefed — every session.
103
67
 
68
+ > **Also a VS Code user?** Install the **[cachly Brain extension](https://marketplace.visualstudio.com/items?itemName=cachly-dev.cachly-brain)** — see your AI's memory, lesson count, and tokens saved right in the status bar.
69
+
70
+ ---
71
+
72
+ ## 🆓 What You Get for Free
73
+
74
+ No credit card. No expiry. No catch.
75
+
76
+ | Feature | Free tier |
77
+ |---------|-----------|
78
+ | Brain storage | 25 MB |
79
+ | MCP tools | All 89 |
80
+ | Sessions | Unlimited |
81
+ | Projects | Unlimited |
82
+ | Team sharing | 1 shared Brain |
83
+ | Git hook learning | ✅ |
84
+ | Causal root cause analysis | ✅ |
85
+ | Failure prediction | ✅ |
86
+
87
+ **[→ Create your free Brain](https://cachly.dev?utm_source=npm&utm_medium=readme&utm_campaign=free-cta)**
88
+
104
89
  ---
105
90
 
106
91
  ## What happens after setup — everything is automatic
107
92
 
93
+ You never type another command. The Brain runs entirely in the background:
94
+
108
95
  | Trigger | What the Brain does automatically |
109
96
  |---------|----------------------------------|
110
97
  | First tool call | Session starts, project gets indexed in background |
@@ -129,61 +116,31 @@ Run it once. It handles everything:
129
116
 
130
117
  ---
131
118
 
132
- ## CLI Commands
133
-
134
- ```bash
135
- npx @cachly-dev/mcp-server@latest demo # Preview your Brain (no account needed)
136
- npx @cachly-dev/mcp-server@latest setup # Wire up all your AI editors (30 seconds)
137
- npx @cachly-dev/mcp-server@latest health # Check token, API, editors, git hook
138
- npx @cachly-dev/mcp-server@latest digest # Weekly Brain summary — shareable
139
- npx @cachly-dev/mcp-server@latest share # Generate a shareable stats card + tweet
140
- npx @cachly-dev/mcp-server@latest badge # Get a live README badge for your Brain
141
- npx @cachly-dev/mcp-server@latest invite # Invite a teammate to share your Brain
142
- ```
143
-
144
- ---
145
-
146
- ## Brain Badge — show your lessons live
147
-
148
- Add a live lesson-count badge to any README — updates every hour, no auth required:
149
-
150
- ```bash
151
- npx @cachly-dev/mcp-server@latest badge
152
- ```
153
-
154
- Outputs your personal Markdown snippet:
155
-
156
- ```markdown
157
- [![cachly Brain](https://api.cachly.dev/api/v1/badge/YOUR_INSTANCE_ID)](https://cachly.dev)
158
- ```
159
-
160
- Drop it in your repo's README and anyone visiting sees how many lessons your AI has accumulated. The badge endpoint is public, rate-limited, and only exposes the lesson count — no topic names, no content.
161
-
162
- ---
163
-
164
119
  ## What makes cachly different
165
120
 
166
121
  | Feature | What it does |
167
122
  |---------|-------------|
168
123
  | **`causal_trace`** | Root Cause Analysis through memory: problem → chain → solution. **No other system does this.** |
169
- | **`brain_from_git`** | Reads your entire git history and loads every lesson before your first session. Incremental on repeat runs. |
170
- | **`brain_predict`** | Predicts failures before they happen based on past incident patterns |
171
124
  | **`memory_consolidate`** | Weekly garbage collector — detects contradictions, merges duplicates, expires stale lessons |
125
+ | **`brain_predict`** | Predicts failures before they happen based on past patterns |
172
126
  | **Team Brain** | Shared lessons across your whole team with author attribution |
173
127
  | **Ambient Git** | git hook auto-extracts lessons from every commit. Zero extra calls. |
174
128
  | **Memory Crystals** | Distills all lessons into a compact snapshot for instant session briefing |
175
129
  | **11 languages** | BM25+ search in EN, DE, FR, ES, IT, PT, ZH, JA, KO, AR, HE — no config |
176
130
 
177
- **`causal_trace` in action:**
131
+ **The `causal_trace` moment:**
178
132
  ```
179
133
  causal_trace(problem="auth breaks after restart")
180
134
 
181
135
  → Root: k8s:namespace-terminating
182
- → Via: keycloak:jwks-race
136
+ → Via: keycloak:jwks-race
183
137
  → Fix: PollUntilContextTimeout 3min ← used this March 12, worked
184
138
  ```
185
139
  *30 minutes of git blame in one call.*
186
140
 
141
+ **The `autopilot` command:**
142
+ 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.
143
+
187
144
  ---
188
145
 
189
146
  ## cachly vs. alternatives
@@ -214,10 +171,10 @@ causal_trace(problem="auth breaks after restart")
214
171
  | **`learn_from_attempts`** | Store structured lessons after any fix, deploy, or discovery |
215
172
  | **`recall_best_solution`** | Best known solution for a topic — with success/failure history |
216
173
  | **`remember_context`** | Cache architecture findings, decisions, file summaries |
174
+ | **`recall_context`** | Get exact context by key (supports glob) |
217
175
  | **`smart_recall`** | BM25+ full-text search across all brain data — 11 languages |
218
176
  | **`causal_trace`** | Root cause analysis through memory |
219
177
  | **`brain_predict`** | Predict likely failures before they happen |
220
- | **`brain_from_git`** | Bootstrap from git history — incremental, only new commits each run |
221
178
  | **`memory_consolidate`** | Deduplicate and expire stale lessons |
222
179
  | **`compact_recover`** | Full context recovery after hitting context window limit |
223
180
 
@@ -230,22 +187,26 @@ causal_trace(problem="auth breaks after restart")
230
187
  | `madc_deliberate` | 6 specialist AI agents vote to resolve contradictory lessons |
231
188
  | `memory_crystalize` | Distill all lessons into a Crystal for instant team context |
232
189
  | `brain_doctor` | Health check: lesson count, IQ boost %, open failures |
233
- | `autopilot` | Generate a self-managing `CLAUDE.md` from Brain content |
190
+ | `autopilot` | Generate a self-managing `CLAUDE.md` / `copilot-instructions.md` from Brain content |
234
191
  | `global_learn` / `global_recall` | Cross-project universal lessons |
192
+ | `publish_lesson` / `import_public_brain` | Share/import community knowledge |
235
193
 
236
- ### 🌍 Knowledge Commons
194
+ ### 🌍 Knowledge Commons (Global)
237
195
 
238
196
  | Tool | What it does |
239
197
  |------|-------------|
240
198
  | `syndicate` | Contribute verified lesson to global Knowledge Commons |
199
+ | `syndicate_search` | Search community solutions by tech stack |
200
+ | `fedbrain_contribute` | Contribute with cryptographic provenance certificate |
241
201
  | `fedbrain_search` | Context-weighted global search |
242
202
 
243
- ### ⚙️ Infrastructure
203
+ ### ⚙️ Cache & Infrastructure
244
204
 
245
205
  | Tool | What it does |
246
206
  |------|-------------|
247
207
  | `list_instances` / `create_instance` / `delete_instance` | Manage Brain instances |
248
208
  | `cache_get` / `cache_set` / `cache_delete` | Standard cache operations |
209
+ | `cache_mget` / `cache_mset` | Bulk pipeline (single round-trip) |
249
210
  | `semantic_search` | Find cached entries by meaning |
250
211
  | `index_project` | Index source files for semantic retrieval |
251
212
 
@@ -263,27 +224,33 @@ causal_trace(problem="auth breaks after restart")
263
224
  **Does my AI need to call `session_start` manually?**
264
225
  No. Sessions start and end automatically on the first tool call and when the editor closes.
265
226
 
266
- **What is incremental `brain_from_git`?**
267
- After the first run, only new commits since the last scan are processed. Repeated calls are instant.
227
+ **What happens to memory if I switch projects?**
228
+ Memory is scoped per Brain instance. You can have one instance per project, or one shared instance across projects.
268
229
 
269
230
  **Can my whole team share the same Brain?**
270
- Yes. Use `team_learn` / `team_recall` or run `npx @cachly-dev/mcp-server@latest invite teammate@example.com`.
231
+ Yes. `team_learn` / `team_recall` share lessons with author attribution. `memory_crystalize` gives any new team member instant full context.
271
232
 
272
233
  **What is a Memory Crystal?**
273
- A compressed snapshot of all lessons injected at every session start. The AI arrives pre-briefed even with a cold context window.
234
+ 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.
235
+
236
+ **What is causal_trace and why is it unique?**
237
+ 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.
274
238
 
275
- **What is `causal_trace` and why is it unique?**
276
- Given any error, `causal_trace` walks the Causal Knowledge Graph to find: 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.
239
+ **How does cachly learn from git commits?**
240
+ 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.
241
+
242
+ **What happens if I hit the context window limit mid-session?**
243
+ Call `compact_recover`. It reconstructs full context from the Memory Crystal + recent sessions + WIP registry entries — typically restoring full context in one tool call.
277
244
 
278
245
  **Is my code sent to cachly servers?**
279
- No code content is stored. cachly stores: lesson text, commit messages, session summaries, key-value context entries. All data on German servers, GDPR-compliant.
246
+ 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.
280
247
 
281
- **What if I hit the context window limit mid-session?**
282
- Call `compact_recover`. It reconstructs full context from Memory Crystal + recent sessions + WIP registry — typically one tool call.
248
+ **Does cachly work without an internet connection?**
249
+ No — cachly is a managed cloud service. The MCP server is a thin client; the Brain runs on cachly's infrastructure.
283
250
 
284
251
  ---
285
252
 
286
- ## Manual Setup
253
+ ## Manual Setup (alternative to the wizard)
287
254
 
288
255
  <details>
289
256
  <summary><b>Claude Code</b> (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
@@ -302,7 +269,7 @@ On the first tool call your AI will prompt you to sign in — takes 10 seconds.
302
269
  </details>
303
270
 
304
271
  <details>
305
- <summary><b>Cursor / Windsurf / VS Code / Copilot / Cline</b></summary>
272
+ <summary><b>Cursor / Windsurf / VS Code / Copilot / Cline</b> (<code>.cursor/mcp.json</code> / <code>.mcp.json</code>)</summary>
306
273
 
307
274
  ```json
308
275
  {
@@ -317,23 +284,6 @@ On the first tool call your AI will prompt you to sign in — takes 10 seconds.
317
284
  ```
318
285
  </details>
319
286
 
320
- <details>
321
- <summary><b>Zed</b> (<code>.zed/settings.json</code>)</summary>
322
-
323
- ```json
324
- {
325
- "context_servers": {
326
- "cachly": {
327
- "command": {
328
- "path": "npx",
329
- "args": ["-y", "@cachly-dev/mcp-server@latest"]
330
- }
331
- }
332
- }
333
- }
334
- ```
335
- </details>
336
-
337
287
  ---
338
288
 
339
289
  ## Pricing
@@ -352,10 +302,12 @@ On the first tool call your AI will prompt you to sign in — takes 10 seconds.
352
302
 
353
303
  ## Environment Variables
354
304
 
305
+ Set automatically by the setup wizard — only needed for manual configuration.
306
+
355
307
  | Variable | Default | Description |
356
308
  |----------|---------|-------------|
357
- | `CACHLY_JWT` | — | API token (set by wizard automatically) |
358
- | `CACHLY_BRAIN_INSTANCE_ID` | — | Default instance UUID (optional — auto-resolved) |
309
+ | `CACHLY_JWT` | — | API token (set by wizard, or get from cachly.dev) |
310
+ | `CACHLY_BRAIN_INSTANCE_ID` | — | Default instance UUID (optional if passed per-call) |
359
311
  | `CACHLY_API_URL` | `https://api.cachly.dev` | Override for self-hosted |
360
312
  | `CACHLY_NO_TELEMETRY` | unset | Set to `1` to disable anonymous usage pings |
361
313
 
@@ -363,16 +315,40 @@ On the first tool call your AI will prompt you to sign in — takes 10 seconds.
363
315
 
364
316
  ## 🛠️ Ecosystem
365
317
 
366
- | Package | What it does |
367
- |---------|-------------|
368
- | **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here |
369
- | **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** | Cut LLM costs 60–90% in JS/TS apps |
318
+ | Package / Extension | What it does |
319
+ |---------------------|-------------|
320
+ | **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here — AI Brain for all MCP-compatible editors |
321
+ | **[VS Code Extension](https://marketplace.visualstudio.com/items?itemName=cachly-dev.cachly-brain)** | See your Brain's lessons, health & tokens saved inside VS Code |
322
+ | **[`@cachly-dev/init`](https://www.npmjs.com/package/@cachly-dev/init)** | One-command setup wizard — detects editors, writes configs automatically |
323
+ | **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** | Cut LLM costs 60–90% with semantic caching in JS/TS apps |
324
+ | **[`@cachly-dev/cli`](https://www.npmjs.com/package/@cachly-dev/cli)** | Terminal CLI — manage Brain instances from your shell |
325
+ | **[Go SDK](https://github.com/cachly-dev/sdk-go)** | Native Go client for the cachly API |
326
+ | **[Python SDK](https://github.com/cachly-dev/sdk-python)** | Native Python client |
327
+ | **[Java / Kotlin / .NET / Rust / PHP / Swift](https://cachly.dev/docs)** | SDKs in 11 languages |
328
+
329
+ ---
330
+
331
+ ## 📖 Blog & Guides
332
+
333
+ - **[How to give Claude Code persistent memory](https://cachly.dev/blog/claude-code-mcp-memory)** — step-by-step
334
+ - **[Windsurf persistent memory with cachly](https://cachly.dev/blog/windsurf-persistent-memory)** — full guide
335
+ - **[Cline MCP memory — stop re-explaining everything](https://cachly.dev/blog/cline-mcp-memory)** — Cline setup
336
+ - **[cachly vs. mem0 — full comparison](https://cachly.dev/blog)** — which is right for you
370
337
 
371
338
  ---
372
339
 
373
340
  ## Links
374
341
 
375
- - 🌐 [cachly.dev](https://cachly.dev) — Dashboard & free signup
342
+ - 🌐 [cachly.dev](https://cachly.dev?utm_source=npm&utm_medium=readme&utm_campaign=mcp-server) — Dashboard & free Brain signup
376
343
  - 📖 [Docs](https://cachly.dev/docs/ai-memory) — Full documentation
344
+ - 🔌 [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=cachly-dev.cachly-brain) — Brain panel inside VS Code
377
345
  - 💬 [GitHub Issues](https://github.com/cachly-dev/cachly-mcp/issues) — Bug reports & feature requests
378
346
  - ⭐ [Star on GitHub](https://github.com/cachly-dev/cachly-mcp) — If cachly saves you time, a star means a lot!
347
+
348
+ ---
349
+
350
+ <p align="center">
351
+ <a href="https://cachly.dev?utm_source=npm&utm_medium=readme&utm_campaign=mcp-bottom">
352
+ <strong>→ Start free at cachly.dev — no credit card, no expiry</strong>
353
+ </a>
354
+ </p>
@@ -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 {};