@cachly-dev/mcp-server 0.6.1 → 0.7.1
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 +44 -1
- package/README.md +74 -0
- package/dist/index.js +133 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +192 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,50 @@
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## [0.
|
|
10
|
+
## [0.7.0] – 2026-05-04
|
|
11
|
+
|
|
12
|
+
### 🌐 Knowledge Syndication — The Global AI Brain
|
|
13
|
+
|
|
14
|
+
The first collective intelligence layer for AI memory.
|
|
15
|
+
Every instance contributes. Every instance learns. Privacy-preserving by design.
|
|
16
|
+
|
|
17
|
+
#### New Tools
|
|
18
|
+
|
|
19
|
+
- **`syndicate`** — Contribute a verified lesson to the **global Knowledge Commons**. Your identity is a one-way HMAC hash — completely anonymous. The lesson is immediately searchable by every other AI brain on the planet. Call this after any `learn_from_attempts` that is worth sharing: critical bugs, deployment gotchas, architecture discoveries. This is how individual knowledge becomes collective intelligence.
|
|
20
|
+
|
|
21
|
+
- **`syndicate_search`** — Search the **global Knowledge Commons** for solutions discovered by the entire community. Results ranked by `confirm_count` (trust score) then recency. Use this *before* debugging any unknown issue — someone in the global brain likely solved it already. Returns: topic, what worked, what failed, trust bar `████████░░ ×47`.
|
|
22
|
+
|
|
23
|
+
#### Privacy Design
|
|
24
|
+
- Contributors identified only by HMAC-SHA256 of user_id — irreversible, not linkable to any identity
|
|
25
|
+
- Absolute file paths stripped from all content before storage
|
|
26
|
+
- Community flagging: lessons with 3+ flags are hidden globally
|
|
27
|
+
- Trust scoring: `confirm_count` rises as independent instances verify a lesson works
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## [0.6.1] – 2026-05-04
|
|
32
|
+
|
|
33
|
+
### 🧠 Cognitive Cache — v0.6 Major Feature
|
|
34
|
+
|
|
35
|
+
The first AI Memory system with **reasoning over its own knowledge**. No other cache has ever done this.
|
|
36
|
+
|
|
37
|
+
#### New Tools
|
|
38
|
+
|
|
39
|
+
- **`memory_consolidate`** — Weekly garbage collector for your AI Brain. Detects contradictions (same topic, different outcomes), merges duplicate lesson clusters, flags stale entries (0 recalls in N days). Like `git gc` for knowledge. Returns a full consolidation report with before/after counts.
|
|
40
|
+
|
|
41
|
+
- **`brain_diff`** — `git log` for your AI Brain. Shows exactly what changed since a given time window (`"7d"`, `"30d"`, ISO-8601). New lessons, updated lessons, recalled lessons. Perfect for weekly reviews: *"What did my AI learn this week?"*
|
|
42
|
+
|
|
43
|
+
- **`causal_trace`** — Root Cause Analysis through memory. Given a problem description, scores all lessons by relevance, reconstructs the failure chain (root → intermediate → symptom), and surfaces the exact solution that worked before. *"auth breaks after restart"* → root: `k8s:namespace-terminating` → via: `keycloak:jwks-race` → fix: `PollUntilContextTimeout 3min`. No other system can do this.
|
|
44
|
+
|
|
45
|
+
- **`knowledge_decay`** — Confidence scoring per lesson. Age × recall-frequency × outcome = decay score (0–100%). Visual bars: `████░░░░░░ 40%`. Lessons recalled recently score high; 90-day-old untouched lessons score low. Run before a big refactor to know which knowledge to trust.
|
|
46
|
+
|
|
47
|
+
- **`autopilot`** — Generates a `CLAUDE.md` / `copilot-instructions.md` that turns any AI (Claude, Cursor, Copilot, Windsurf, Gemini) into a self-managing Brain operator. No manual `session_start`, `learn_from_attempts`, or `session_end` calls ever again. One command. Every AI. Forever.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## [0.5.80] – 2026-05-01
|
|
52
|
+
|
|
53
|
+
|
|
11
54
|
|
|
12
55
|
### Added
|
|
13
56
|
|
package/README.md
CHANGED
|
@@ -29,6 +29,32 @@
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
+
## 🆕 v0.6 — Cognitive Cache: Your AI Brain now *thinks* about what it knows
|
|
33
|
+
|
|
34
|
+
> Redis stores bytes. LangChain stores text. **cachly v0.6 reasons over knowledge.**
|
|
35
|
+
|
|
36
|
+
### The 5 tools no other memory system has:
|
|
37
|
+
|
|
38
|
+
| Tool | What it does | Why it's different |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `memory_consolidate` | Weekly garbage collector — detects contradictions, merges duplicates, expires stale | Like `git gc` for knowledge |
|
|
41
|
+
| `brain_diff` | `git log` for your AI Brain — what changed this week? | See your AI's learning velocity |
|
|
42
|
+
| `causal_trace` | Root Cause Analysis through memory: problem → chain → solution | **No other system can do this** |
|
|
43
|
+
| `knowledge_decay` | Confidence score per lesson: `████░░░░ 40%` | Old knowledge rots. Now you know which |
|
|
44
|
+
| `autopilot` | Generates CLAUDE.md that makes any AI self-managing, forever | Zero manual calls. One command. Done. |
|
|
45
|
+
|
|
46
|
+
**The `causal_trace` moment:**
|
|
47
|
+
```
|
|
48
|
+
causal_trace(problem="auth breaks after restart")
|
|
49
|
+
|
|
50
|
+
→ Root: k8s:namespace-terminating
|
|
51
|
+
→ Via: keycloak:jwks-race
|
|
52
|
+
→ Fix: PollUntilContextTimeout 3min ← used this March 12, worked
|
|
53
|
+
```
|
|
54
|
+
*30 minutes of git blame + log archaeology. In one call.*
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
32
58
|
## The Problem
|
|
33
59
|
|
|
34
60
|
Every morning, you open your AI coding assistant. It doesn't remember yesterday.
|
|
@@ -68,6 +94,54 @@ npx @cachly-dev/mcp-server@latest index .
|
|
|
68
94
|
<details>
|
|
69
95
|
<summary><b>Claude Code</b> (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
|
|
70
96
|
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"cachly": {
|
|
101
|
+
"type": "stdio",
|
|
102
|
+
"command": "npx",
|
|
103
|
+
"args": ["-y", "@cachly-dev/mcp-server@latest"],
|
|
104
|
+
"env": {
|
|
105
|
+
"CACHLY_JWT": "your-jwt-token",
|
|
106
|
+
"CACHLY_INSTANCE_ID": "your-instance-id"
|
|
107
|
+
|
|
108
|
+
Every morning, you open your AI coding assistant. It doesn't remember yesterday.
|
|
109
|
+
You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
|
|
110
|
+
|
|
111
|
+
**The average developer wastes 45 minutes/day re-establishing context.** That's €15,000+ in lost productivity per engineer per year.
|
|
112
|
+
|
|
113
|
+
## The Fix — One Command
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx @cachly-dev/mcp-server@latest setup
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The interactive wizard:
|
|
120
|
+
1. Signs you in (free, no credit card required)
|
|
121
|
+
2. Picks or creates your AI Brain instance
|
|
122
|
+
3. **Auto-detects** Cursor, Windsurf, VS Code, Claude Code, Continue.dev, **Cline & Zed**
|
|
123
|
+
4. Writes the correct MCP config for every detected editor
|
|
124
|
+
5. Creates `CLAUDE.md` with memory rules pre-filled
|
|
125
|
+
6. Shows your Brain Health snapshot right in the terminal
|
|
126
|
+
|
|
127
|
+
**Index your project** into the Brain for instant semantic search:
|
|
128
|
+
```bash
|
|
129
|
+
npx @cachly-dev/mcp-server@latest index .
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Result:** Your AI remembers everything. Always.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Quick Start (Manual)
|
|
137
|
+
|
|
138
|
+
**Step 1 — Get your free credentials** at [cachly.dev](https://cachly.dev) (25 MB free, forever, no credit card).
|
|
139
|
+
|
|
140
|
+
**Step 2 — Add to your editor's MCP config:**
|
|
141
|
+
|
|
142
|
+
<details>
|
|
143
|
+
<summary><b>Claude Code</b> (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
|
|
144
|
+
|
|
71
145
|
```json
|
|
72
146
|
{
|
|
73
147
|
"mcpServers": {
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import { Redis } from 'ioredis';
|
|
|
47
47
|
const API_URL = process.env.CACHLY_API_URL ?? 'https://api.cachly.dev';
|
|
48
48
|
const JWT = process.env.CACHLY_JWT ?? '';
|
|
49
49
|
const EMBED_MODEL = process.env.CACHLY_EMBED_MODEL ?? '';
|
|
50
|
-
const CURRENT_VERSION = '0.
|
|
50
|
+
const CURRENT_VERSION = '0.7.1';
|
|
51
51
|
/**
|
|
52
52
|
* ┌──────────────────────────────────────────────────────────────────────┐
|
|
53
53
|
* │ EMBEDDING PROVIDER — pluggable, client-side first │
|
|
@@ -3397,6 +3397,57 @@ const TOOLS = [
|
|
|
3397
3397
|
required: ['instance_id'],
|
|
3398
3398
|
},
|
|
3399
3399
|
},
|
|
3400
|
+
// ── v0.7 Knowledge Syndication ────────────────────────────────────────────
|
|
3401
|
+
{
|
|
3402
|
+
name: 'syndicate',
|
|
3403
|
+
description: 'Contribute a verified lesson to the GLOBAL Cachly Knowledge Commons — ' +
|
|
3404
|
+
'a privacy-preserving shared brain where every AI instance can learn from the discoveries ' +
|
|
3405
|
+
'of every other. Your contributor identity is a one-way HMAC hash: completely anonymous. ' +
|
|
3406
|
+
'The lesson is immediately searchable by any other AI using syndicate_search. ' +
|
|
3407
|
+
'This is how individual knowledge becomes collective intelligence. ' +
|
|
3408
|
+
'Call this AFTER every learn_from_attempts that is worth sharing universally ' +
|
|
3409
|
+
'(critical bugs, deployment gotchas, architecture discoveries).',
|
|
3410
|
+
inputSchema: {
|
|
3411
|
+
type: 'object',
|
|
3412
|
+
properties: {
|
|
3413
|
+
topic: { type: 'string', description: 'Topic key in category:keyword format (e.g. "fix:clickhouse-ipv6", "deploy:docker-compose")' },
|
|
3414
|
+
outcome: { type: 'string', enum: ['success', 'failure', 'partial'], description: 'Result of the attempt (default: success)' },
|
|
3415
|
+
what_worked: { type: 'string', description: 'Exact approach, command, or fix that worked. File paths are stripped automatically.' },
|
|
3416
|
+
what_failed: { type: 'string', description: 'What failed or was wrong — helps others avoid the same trap.' },
|
|
3417
|
+
severity: { type: 'string', enum: ['critical', 'major', 'minor'], description: 'How severe the issue was (default: minor)' },
|
|
3418
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Up to 10 keywords for better discoverability' },
|
|
3419
|
+
},
|
|
3420
|
+
required: ['topic', 'what_worked'],
|
|
3421
|
+
},
|
|
3422
|
+
},
|
|
3423
|
+
{
|
|
3424
|
+
name: 'syndicate_search',
|
|
3425
|
+
description: 'Search the GLOBAL Cachly Knowledge Commons for solutions contributed by the entire community. ' +
|
|
3426
|
+
'Returns lessons ranked by confirm_count (trust score) then recency. ' +
|
|
3427
|
+
'Use this BEFORE debugging any unknown issue — someone in the global brain likely solved it already. ' +
|
|
3428
|
+
'Example: syndicate_search(q="clickhouse localhost connection refused") → ' +
|
|
3429
|
+
'"fix: use 127.0.0.1 not localhost when IPv6 is disabled · confirmed by 47 instances"',
|
|
3430
|
+
inputSchema: {
|
|
3431
|
+
type: 'object',
|
|
3432
|
+
properties: {
|
|
3433
|
+
q: { type: 'string', description: 'Free-text search query (leave empty for most recent lessons)' },
|
|
3434
|
+
category: { type: 'string', description: 'Filter by category prefix: "fix", "deploy", "debug", "infra", "api", "web"' },
|
|
3435
|
+
limit: { type: 'number', description: 'Max results to return (default: 20, max: 50)' },
|
|
3436
|
+
},
|
|
3437
|
+
required: [],
|
|
3438
|
+
},
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
name: 'syndicate_stats',
|
|
3442
|
+
description: 'Show the health of the global Knowledge Commons: total lessons, total confirms, ' +
|
|
3443
|
+
'top categories, most-trusted lessons, and growth in the last 7 days. ' +
|
|
3444
|
+
'Use for weekly reviews or to explore what the community knows.',
|
|
3445
|
+
inputSchema: {
|
|
3446
|
+
type: 'object',
|
|
3447
|
+
properties: {},
|
|
3448
|
+
required: [],
|
|
3449
|
+
},
|
|
3450
|
+
},
|
|
3400
3451
|
];
|
|
3401
3452
|
// ── Handlers ──────────────────────────────────────────────────────────────────
|
|
3402
3453
|
function formatInstance(inst) {
|
|
@@ -7002,6 +7053,87 @@ smart_recall(
|
|
|
7002
7053
|
`✨ Once this file is in place, **${editor === 'copilot' ? 'GitHub Copilot' : editor === 'continue' ? 'Continue.dev' : 'Claude/Cursor/Windsurf'}** will manage the Brain automatically — no manual calls needed, ever.`,
|
|
7003
7054
|
].join('\n');
|
|
7004
7055
|
}
|
|
7056
|
+
// ── v0.7 Knowledge Syndication: syndicate ────────────────────────────────
|
|
7057
|
+
case 'syndicate': {
|
|
7058
|
+
const { topic, outcome = 'success', what_worked, what_failed = '', severity = 'minor', tags = [] } = args;
|
|
7059
|
+
if (!topic || !what_worked) {
|
|
7060
|
+
throw new McpError(ErrorCode.InvalidParams, 'topic and what_worked are required');
|
|
7061
|
+
}
|
|
7062
|
+
const body = { topic, outcome, what_worked, what_failed, severity, tags };
|
|
7063
|
+
const res = await apiFetch('/api/v1/syndication/contribute', { method: 'POST', body: JSON.stringify(body) });
|
|
7064
|
+
return [
|
|
7065
|
+
`🌐 **Lesson syndicated to the global Knowledge Commons**`,
|
|
7066
|
+
``,
|
|
7067
|
+
`**ID:** \`${res.id}\``,
|
|
7068
|
+
`**Topic:** \`${res.topic}\` · **Outcome:** ${res.outcome}`,
|
|
7069
|
+
``,
|
|
7070
|
+
`Your lesson is now searchable by every AI brain in the network.`,
|
|
7071
|
+
`When another instance confirms it works, its trust score rises automatically.`,
|
|
7072
|
+
``,
|
|
7073
|
+
`**Tip:** Use \`syndicate_search(q="${topic}")\` to see all community lessons on this topic.`,
|
|
7074
|
+
].join('\n');
|
|
7075
|
+
}
|
|
7076
|
+
// ── v0.7 Knowledge Syndication: syndicate_search ─────────────────────────
|
|
7077
|
+
case 'syndicate_search': {
|
|
7078
|
+
const { q = '', limit = 20, category = '' } = args;
|
|
7079
|
+
const params = new URLSearchParams();
|
|
7080
|
+
if (q)
|
|
7081
|
+
params.set('q', q);
|
|
7082
|
+
if (category)
|
|
7083
|
+
params.set('category', category);
|
|
7084
|
+
params.set('limit', String(Math.min(Math.max(1, limit), 50)));
|
|
7085
|
+
const res = await apiFetch(`/api/v1/syndication/search?${params}`);
|
|
7086
|
+
if (!res.results || res.results.length === 0) {
|
|
7087
|
+
return q
|
|
7088
|
+
? `No lessons found for "${q}" in the global Knowledge Commons yet.\n\nBe the first to contribute: \`syndicate(topic="...", what_worked="...")\``
|
|
7089
|
+
: `The global Knowledge Commons is empty. Be the first contributor:\n\`syndicate(topic="deploy:api", what_worked="...")\``;
|
|
7090
|
+
}
|
|
7091
|
+
const outcomeIcon = (o) => o === 'success' ? '✅' : o === 'failure' ? '❌' : '⚠️';
|
|
7092
|
+
const severityLabel = (s) => s === 'critical' ? '🔴' : s === 'major' ? '🟡' : '🟢';
|
|
7093
|
+
const confirmBar = (n) => {
|
|
7094
|
+
const filled = Math.min(10, Math.round(n / 5));
|
|
7095
|
+
return '█'.repeat(filled) + '░'.repeat(10 - filled) + ` ×${n}`;
|
|
7096
|
+
};
|
|
7097
|
+
const header = [q, category].filter(Boolean).join(' · ');
|
|
7098
|
+
const lines = [
|
|
7099
|
+
`## 🌐 Global Knowledge Commons${header ? ` — ${header}` : ' — Recent'}`,
|
|
7100
|
+
`*${res.count} lesson${res.count === 1 ? '' : 's'} found*`,
|
|
7101
|
+
``,
|
|
7102
|
+
];
|
|
7103
|
+
for (const lesson of res.results) {
|
|
7104
|
+
lines.push(`### ${outcomeIcon(lesson.outcome)} \`${lesson.topic}\` ${severityLabel(lesson.severity)}`, `**Trust:** ${confirmBar(lesson.confirm_count)}`, lesson.what_worked ? `**What worked:** ${lesson.what_worked}` : '', lesson.what_failed ? `**What failed:** ${lesson.what_failed}` : '', `*Contributed ${new Date(lesson.created_at).toLocaleDateString('de-DE')} · ID: \`${lesson.id}\`*`, ``);
|
|
7105
|
+
}
|
|
7106
|
+
lines.push(`---`, `**Confirm** (this helped you): \`syndicate(topic="${res.results[0]?.topic ?? '...'}", what_worked="...")\` → auto-deduped, trust +1`, `**Contribute your own:** \`syndicate(topic="fix:...", what_worked="...")\``, `**Filter by category:** \`syndicate_search(category="fix")\``);
|
|
7107
|
+
return lines.filter(l => l !== '').join('\n');
|
|
7108
|
+
}
|
|
7109
|
+
// ── v0.7 Knowledge Syndication: syndicate_stats ──────────────────────────
|
|
7110
|
+
case 'syndicate_stats': {
|
|
7111
|
+
const res = await apiFetch('/api/v1/syndication/stats');
|
|
7112
|
+
const confirmBar = (n) => {
|
|
7113
|
+
const filled = Math.min(10, Math.round(n / 5));
|
|
7114
|
+
return '█'.repeat(filled) + '░'.repeat(10 - filled) + ` ×${n}`;
|
|
7115
|
+
};
|
|
7116
|
+
const lines = [
|
|
7117
|
+
`## 🌐 Global Knowledge Commons — Stats`,
|
|
7118
|
+
``,
|
|
7119
|
+
`| Metric | Value |`,
|
|
7120
|
+
`|---|---|`,
|
|
7121
|
+
`| Total lessons | **${res.total_lessons.toLocaleString()}** |`,
|
|
7122
|
+
`| Total confirms | **${res.total_confirms.toLocaleString()}** |`,
|
|
7123
|
+
`| Added last 7 days | **${res.added_last_7_days}** |`,
|
|
7124
|
+
``,
|
|
7125
|
+
`### Top Categories`,
|
|
7126
|
+
];
|
|
7127
|
+
for (const cat of res.top_categories ?? []) {
|
|
7128
|
+
lines.push(`- \`${cat.category}\` — ${cat.count} lesson${cat.count === 1 ? '' : 's'}`);
|
|
7129
|
+
}
|
|
7130
|
+
lines.push(``, `### Most Trusted Lessons`);
|
|
7131
|
+
for (const lesson of res.most_trusted ?? []) {
|
|
7132
|
+
lines.push(`**\`${lesson.topic}\`** ${confirmBar(lesson.confirm_count)}`, `> ${lesson.what_worked.slice(0, 120)}${lesson.what_worked.length > 120 ? '…' : ''}`, ``);
|
|
7133
|
+
}
|
|
7134
|
+
lines.push(`---`, `**Contribute:** \`syndicate(topic="...", what_worked="...")\` | **Search:** \`syndicate_search(q="your problem")\``);
|
|
7135
|
+
return lines.join('\n');
|
|
7136
|
+
}
|
|
7005
7137
|
default:
|
|
7006
7138
|
return null;
|
|
7007
7139
|
}
|