@nxuss/lemma 0.7.9 → 0.8.0
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/README.md +31 -5
- package/dist/cjs/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/cjs/cli/lemma-proxy.js +53 -7
- package/dist/cjs/cli/lemma-proxy.js.map +1 -1
- package/dist/cjs/mcp/index.js +1 -0
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/mcp/prompts.d.ts +1 -0
- package/dist/cjs/mcp/prompts.d.ts.map +1 -1
- package/dist/cjs/mcp/prompts.js +58 -1
- package/dist/cjs/mcp/prompts.js.map +1 -1
- package/dist/cjs/mcp/resources.d.ts.map +1 -1
- package/dist/cjs/mcp/resources.js +3 -2
- package/dist/cjs/mcp/resources.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +288 -10
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/mcp/utils.d.ts.map +1 -1
- package/dist/cjs/mcp/utils.js +2 -2
- package/dist/cjs/mcp/utils.js.map +1 -1
- package/dist/cjs/utils/reportSavings.d.ts.map +1 -1
- package/dist/cjs/utils/reportSavings.js +2 -2
- package/dist/cjs/utils/reportSavings.js.map +1 -1
- package/dist/esm/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/esm/cli/lemma-proxy.js +53 -7
- package/dist/esm/cli/lemma-proxy.js.map +1 -1
- package/dist/esm/mcp/index.js +2 -1
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/prompts.d.ts +1 -0
- package/dist/esm/mcp/prompts.d.ts.map +1 -1
- package/dist/esm/mcp/prompts.js +57 -0
- package/dist/esm/mcp/prompts.js.map +1 -1
- package/dist/esm/mcp/resources.d.ts.map +1 -1
- package/dist/esm/mcp/resources.js +3 -2
- package/dist/esm/mcp/resources.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +288 -10
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/mcp/utils.d.ts.map +1 -1
- package/dist/esm/mcp/utils.js +2 -2
- package/dist/esm/mcp/utils.js.map +1 -1
- package/dist/esm/utils/reportSavings.d.ts.map +1 -1
- package/dist/esm/utils/reportSavings.js +2 -2
- package/dist/esm/utils/reportSavings.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# 🧠 Lemma v0.
|
|
1
|
+
# 🧠 Lemma v0.8.0
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@nxuss/lemma)
|
|
4
4
|
[](https://github.com/Nxusbets/lemma/blob/main/LICENSE)
|
|
5
5
|
[](https://github.com/Nxusbets/lemma)
|
|
6
6
|
[](https://github.com/Nxusbets/lemma)
|
|
7
7
|
[](https://github.com/Nxusbets/lemma)
|
|
8
|
-
[](https://github.com/Nxusbets/lemma)
|
|
9
9
|
|
|
10
10
|
```text
|
|
11
11
|
__
|
|
@@ -154,9 +154,9 @@ Create or edit `lemma.config.json` in your project root to disable or fine-tune
|
|
|
154
154
|
|
|
155
155
|
---
|
|
156
156
|
|
|
157
|
-
## 🛠️ MCP Tools Reference (v0.
|
|
157
|
+
## 🛠️ MCP Tools Reference (v0.8.0 — 25 Tools)
|
|
158
158
|
|
|
159
|
-
When connected via `lemma mcp`, your Chat IDE gains access to **
|
|
159
|
+
When connected via `lemma mcp`, your Chat IDE gains access to **25 native tools** covering workspace navigation, code safety, semantic memory, AI cost optimization, autonomous project context injection, and TurboMode optimization.
|
|
160
160
|
|
|
161
161
|
### 🗂️ Workspace Tools
|
|
162
162
|
|
|
@@ -198,6 +198,32 @@ When connected via `lemma mcp`, your Chat IDE gains access to **21 native tools*
|
|
|
198
198
|
| `get_routing_advice` | Analyze a prompt and get the optimal model recommendation from the Complexity Router. |
|
|
199
199
|
| `auto_heal` | Diagnose and auto-heal the latest local server crash from Lemma's live context logs. |
|
|
200
200
|
| `get_project_onboarding` | Download a one-shot architectural mental model of the current project codebase. |
|
|
201
|
+
| `turbosqueeze` | Extreme prompt compression — strips comments, imports, whitespace, compacts JSON. |
|
|
202
|
+
| `compress_context` | Summarize old conversation turns via Ollama (fallback: truncation). |
|
|
203
|
+
| `smarter_cache` | Predictive cache — queries The Brain at 75% threshold before reasoning. |
|
|
204
|
+
| `token_budget` | Optimization dashboard with multiplier, savings, and recommendations. |
|
|
205
|
+
|
|
206
|
+
### 🚀 TurboMode Tools (NEW in v0.8.0)
|
|
207
|
+
|
|
208
|
+
| Tool | Description |
|
|
209
|
+
| :--- | :--- |
|
|
210
|
+
| `turbosqueeze` | **Extreme prompt compression.** Strips comments, imports, whitespace, and compacts JSON. Returns reduction stats and reports savings to proxy ledger. |
|
|
211
|
+
| `compress_context` | **Conversation summarization.** Summarizes old turns via Ollama (falls back to truncation), keeps last N turns intact, reports token savings. |
|
|
212
|
+
| `smarter_cache` | **Predictive cache.** Queries The Brain at 75% threshold before any reasoning, auto-suggests `store_memory` on MISS. |
|
|
213
|
+
| `token_budget` | **Optimization dashboard.** Displays current multiplier, tokens saved, tool calls, and optimization recommendations. |
|
|
214
|
+
|
|
215
|
+
### ⚡ TurboMode Auto-Injection
|
|
216
|
+
When connected via `lemma mcp`, Lemma automatically injects 7 TurboMode rules into the agent's system prompt during handshake — no manual prompt loading required:
|
|
217
|
+
1. `turbosqueeze` before writing code
|
|
218
|
+
2. `smarter_cache` before any reasoning
|
|
219
|
+
3. `compress_context` every turn
|
|
220
|
+
4. `store_memory` after every solution
|
|
221
|
+
5. `get_ast_hologram` before reading files
|
|
222
|
+
6. `batch_tool_calls` for parallel operations
|
|
223
|
+
7. No fluff or chit-chat
|
|
224
|
+
|
|
225
|
+
### 📡 Dashboard MCP Toggle
|
|
226
|
+
The Dashboard Header now shows a **clickable MCP status badge** — click to enable/disable MCP integration instantly. The badge cycles through `active` (cyan), `idle` (gray), and `offline` (red) states.
|
|
201
227
|
|
|
202
228
|
### 📡 MCP Resources
|
|
203
229
|
|
|
@@ -252,7 +278,7 @@ For **Lemma Pro** users, expose Lemma's entire intelligence layer — Privacy Fi
|
|
|
252
278
|
* **Name**: `Lemma`
|
|
253
279
|
* **Type**: `command`
|
|
254
280
|
* **Command**: `lemma mcp`
|
|
255
|
-
4. Click **Save**. A green **"Connected"** dot will appear, confirming that the IDE has loaded all
|
|
281
|
+
4. Click **Save**. A green **"Connected"** dot will appear, confirming that the IDE has loaded all 25 of Lemma's tools.
|
|
256
282
|
|
|
257
283
|
#### 🟢 Claude Desktop:
|
|
258
284
|
Add the following to your `claude_desktop_config.json` configuration file:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lemma-proxy.d.ts","sourceRoot":"","sources":["../../../src/cli/lemma-proxy.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"lemma-proxy.d.ts","sourceRoot":"","sources":["../../../src/cli/lemma-proxy.ts"],"names":[],"mappings":";AA0bA,wBAAgB,+BAA+B,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CA4DvF;AA2iED,wBAAsB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6KhL"}
|
|
@@ -14,6 +14,7 @@ const crypto_1 = __importDefault(require("crypto"));
|
|
|
14
14
|
const chromadb_1 = require("chromadb");
|
|
15
15
|
const https_1 = __importDefault(require("https"));
|
|
16
16
|
const http_1 = __importDefault(require("http"));
|
|
17
|
+
const os_1 = __importDefault(require("os"));
|
|
17
18
|
const axios_1 = __importDefault(require("axios"));
|
|
18
19
|
const readline_1 = __importDefault(require("readline"));
|
|
19
20
|
function getVersion() {
|
|
@@ -54,7 +55,7 @@ const semanticScrubber = new SemanticScrubber_1.default();
|
|
|
54
55
|
const cloudSync = new CloudSyncClient_1.default();
|
|
55
56
|
const agentMultiplexer = new AgentMultiplexer_1.AgentMultiplexer();
|
|
56
57
|
// ── Paths ──────────────────────────────────────────────────────────────────────
|
|
57
|
-
const HOME =
|
|
58
|
+
const HOME = os_1.default.homedir();
|
|
58
59
|
const CACHE_DIR = path_1.default.join(HOME, '.lemma-cache');
|
|
59
60
|
const PID_FILE = path_1.default.join(CACHE_DIR, 'proxy.pid');
|
|
60
61
|
const PORT_FILE = path_1.default.join(CACHE_DIR, 'proxy.port');
|
|
@@ -168,7 +169,7 @@ function autoConfigureAll(project, opts) {
|
|
|
168
169
|
fs_1.default.mkdirSync(mcpDir, { recursive: true });
|
|
169
170
|
}
|
|
170
171
|
// Register lemma MCP server in Claude Desktop config
|
|
171
|
-
const claudeConfigDir = path_1.default.join(
|
|
172
|
+
const claudeConfigDir = path_1.default.join(os_1.default.homedir(), 'Library', 'Application Support', 'Claude');
|
|
172
173
|
const claudeConfigFile = path_1.default.join(claudeConfigDir, 'claude_desktop_config.json');
|
|
173
174
|
if (fs_1.default.existsSync(claudeConfigDir)) {
|
|
174
175
|
let claudeConfig = { mcpServers: {} };
|
|
@@ -194,7 +195,7 @@ function autoConfigureAll(project, opts) {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
// Register lemma MCP server in Cursor config
|
|
197
|
-
const cursorConfigDir = path_1.default.join(
|
|
198
|
+
const cursorConfigDir = path_1.default.join(os_1.default.homedir(), '.cursor');
|
|
198
199
|
const cursorConfigFile = path_1.default.join(cursorConfigDir, 'mcp.json');
|
|
199
200
|
if (fs_1.default.existsSync(cursorConfigDir)) {
|
|
200
201
|
let cursorConfig = { mcpServers: {} };
|
|
@@ -219,7 +220,7 @@ function autoConfigureAll(project, opts) {
|
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
// Register lemma MCP server in Windsurf config
|
|
222
|
-
const windsurfConfigDir = path_1.default.join(
|
|
223
|
+
const windsurfConfigDir = path_1.default.join(os_1.default.homedir(), '.codeium', 'windsurf');
|
|
223
224
|
const windsurfConfigFile = path_1.default.join(windsurfConfigDir, 'mcp_config.json');
|
|
224
225
|
if (fs_1.default.existsSync(windsurfConfigDir)) {
|
|
225
226
|
let windsurfConfig = { mcpServers: {} };
|
|
@@ -246,7 +247,7 @@ function autoConfigureAll(project, opts) {
|
|
|
246
247
|
}
|
|
247
248
|
// Register lemma MCP server in Kiro config
|
|
248
249
|
const kiroDirs = [
|
|
249
|
-
path_1.default.join(
|
|
250
|
+
path_1.default.join(os_1.default.homedir(), '.kiro', 'settings'),
|
|
250
251
|
path_1.default.join(process.cwd(), '.kiro', 'settings'),
|
|
251
252
|
];
|
|
252
253
|
for (const kiroDir of kiroDirs) {
|
|
@@ -318,7 +319,7 @@ function autoConfigureAll(project, opts) {
|
|
|
318
319
|
catch { }
|
|
319
320
|
}
|
|
320
321
|
// Register lemma MCP server in Codex CLI config (~/.codex/config.toml)
|
|
321
|
-
const codexConfigFile = path_1.default.join(
|
|
322
|
+
const codexConfigFile = path_1.default.join(os_1.default.homedir(), '.codex', 'config.toml');
|
|
322
323
|
const codexConfigDir = path_1.default.dirname(codexConfigFile);
|
|
323
324
|
if (fs_1.default.existsSync(codexConfigDir)) {
|
|
324
325
|
try {
|
|
@@ -339,6 +340,42 @@ enabled = true
|
|
|
339
340
|
}
|
|
340
341
|
catch { }
|
|
341
342
|
}
|
|
343
|
+
// Register lemma MCP server in Claude Code Extension config (.mcp.json project scope)
|
|
344
|
+
const claudeMcpFile = path_1.default.join(process.cwd(), '.mcp.json');
|
|
345
|
+
if (!fs_1.default.existsSync(claudeMcpFile)) {
|
|
346
|
+
try {
|
|
347
|
+
const claudeConfig = {
|
|
348
|
+
mcpServers: {
|
|
349
|
+
lemma: {
|
|
350
|
+
command: 'npx',
|
|
351
|
+
args: ['-y', '@nxuss/lemma', 'mcp'],
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
fs_1.default.writeFileSync(claudeMcpFile, JSON.stringify(claudeConfig, null, 2));
|
|
356
|
+
console.log('✅ [Claude Code] Registered lemma MCP server in .mcp.json');
|
|
357
|
+
}
|
|
358
|
+
catch { }
|
|
359
|
+
}
|
|
360
|
+
// Register lemma MCP server in Claude Code user config (~/.claude.json user scope)
|
|
361
|
+
const claudeUserMcpFile = path_1.default.join(os_1.default.homedir(), '.claude.json');
|
|
362
|
+
try {
|
|
363
|
+
let claudeUserConfig = {};
|
|
364
|
+
if (fs_1.default.existsSync(claudeUserMcpFile)) {
|
|
365
|
+
claudeUserConfig = JSON.parse(fs_1.default.readFileSync(claudeUserMcpFile, 'utf8'));
|
|
366
|
+
}
|
|
367
|
+
if (!claudeUserConfig.mcpServers)
|
|
368
|
+
claudeUserConfig.mcpServers = {};
|
|
369
|
+
if (!claudeUserConfig.mcpServers.lemma) {
|
|
370
|
+
claudeUserConfig.mcpServers.lemma = {
|
|
371
|
+
command: 'npx',
|
|
372
|
+
args: ['-y', '@nxuss/lemma', 'mcp'],
|
|
373
|
+
};
|
|
374
|
+
fs_1.default.writeFileSync(claudeUserMcpFile, JSON.stringify(claudeUserConfig, null, 2));
|
|
375
|
+
console.log('✅ [Claude Code] Registered lemma MCP server in ~/.claude.json');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch { }
|
|
342
379
|
console.log(`✅ Auto-configured Lemma for [${project}]`);
|
|
343
380
|
}
|
|
344
381
|
const EVENT_LOG = [];
|
|
@@ -347,7 +384,8 @@ const MAX_EVENTS = 100;
|
|
|
347
384
|
const MCP_STATUS = {
|
|
348
385
|
lastActivity: Date.now(),
|
|
349
386
|
toolCallCount: 0,
|
|
350
|
-
status: 'idle'
|
|
387
|
+
status: 'idle',
|
|
388
|
+
mcpEnabled: true,
|
|
351
389
|
};
|
|
352
390
|
function logEvent(event) {
|
|
353
391
|
const ev = { id: Math.random().toString(36).slice(2, 11), timestamp: Date.now(), ...event };
|
|
@@ -980,12 +1018,20 @@ class LemmaServer {
|
|
|
980
1018
|
}
|
|
981
1019
|
res.json({
|
|
982
1020
|
status,
|
|
1021
|
+
enabled: MCP_STATUS.mcpEnabled,
|
|
983
1022
|
lastActivity: new Date(MCP_STATUS.lastActivity).toISOString(),
|
|
984
1023
|
toolCallCount: MCP_STATUS.toolCallCount,
|
|
985
1024
|
secondsSinceActive: Math.floor(secondsSinceActive),
|
|
986
1025
|
uptime: Math.floor(process.uptime())
|
|
987
1026
|
});
|
|
988
1027
|
});
|
|
1028
|
+
// MCP Toggle endpoint
|
|
1029
|
+
this.app.post('/api/mcp/toggle', (req, res) => {
|
|
1030
|
+
MCP_STATUS.mcpEnabled = !MCP_STATUS.mcpEnabled;
|
|
1031
|
+
const state = MCP_STATUS.mcpEnabled ? 'enabled' : 'disabled';
|
|
1032
|
+
console.log(`🔄 [MCP] Toggled ${state}`);
|
|
1033
|
+
res.json({ enabled: MCP_STATUS.mcpEnabled, status: state });
|
|
1034
|
+
});
|
|
989
1035
|
// Project registration from MCP handshake
|
|
990
1036
|
this.app.post('/api/handshake', (req, res) => {
|
|
991
1037
|
const { projectPath, projectName, stack } = req.body;
|