@nxuss/lemma 0.8.2 โ 0.9.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 +144 -236
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +868 -0
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +868 -0
- package/dist/esm/mcp/tools.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# ๐ง Lemma v0.
|
|
1
|
+
# ๐ง Lemma v0.9.0
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@nxuss/lemma)
|
|
4
4
|
[](https://github.com/Nxusbets/lemma/blob/main/LICENSE)
|
|
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
8
|
|
|
10
9
|
```text
|
|
11
10
|
__
|
|
@@ -13,321 +12,217 @@
|
|
|
13
12
|
/ / / _ \/ __ `__ \/ __ `__ \/ __ `/
|
|
14
13
|
/ /___/ __/ / / / / / / / / / / /_/ /
|
|
15
14
|
/_____/\___/_/ /_/ /_/_/ /_/ /_/\__,_/
|
|
16
|
-
|
|
17
15
|
```
|
|
18
|
-
> **The Intelligent local-first AI Gateway โ Privacy, Performance, and Precision for the Agentic Era.**
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
> **The Intelligent local-first AI Gateway โ Privacy, Performance, and Static Code Intelligence for the Agentic Era.**
|
|
18
|
+
|
|
19
|
+
Lemma is a high-performance orchestration layer that sits between your development environment and LLM providers. It transforms the way you build with AI by providing **Shared Semantic Memory**, **Autonomous Cost Optimization**, **Privacy Guardrails**, and a suite of **32 MCP tools** โ including zero-token static code intelligence that runs entirely on your machine with no LLM calls required.
|
|
21
20
|
|
|
22
21
|
---
|
|
23
22
|
|
|
24
23
|
## โก Killer Features
|
|
25
24
|
|
|
26
|
-
###
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### ๐ธ Kiro/Cursor Composer Bypass (Pro Option) ๐
|
|
30
|
-
**Autonomous Multi-File Editing For Free.** Exposes `write_workspace_file`, smart `apply_workspace_patch` (smart search-and-replace patching), and sandbox terminal tool `run_workspace_command` (compile/lint check) to Cursor's standard chat or Claude Desktop via MCP. Any standard free chat instantly acts as a fully-featured, unlimited autonomous multi-file Composer without needing a premium Kiro/Cursor Pro subscription.
|
|
31
|
-
|
|
32
|
-
### ๐ AST Time-Travel Telemetry: El Multiverso de Cรณdigo (Pro Option) ๐
|
|
33
|
-
**Regressive Error Debugging & Time-Travel.** Spawns a background recursive file watcher that debounces filesystem edits and calculates incremental AST diffs on every save. Merges active compiler crash logs to package a chronologically ordered time-traveling timeline resource (`lemma://multiverse/timeline`) so your LLM agents can inspect past codebase states and regressions instantly when you say "It broke".
|
|
34
|
-
|
|
35
|
-
### ๐บ๏ธ Zero-Shot Project Onboarding (Pro Option) ๐
|
|
36
|
-
**One-Shot Architecture Map.** Exposes a dynamic onboard resource (`lemma://project/onboarding`) that scans package files, folders, and key directory markers to compile a beautiful, structured markdown guide of your codebase's stack, directory layouts, and design principles so the LLM gets fully onboarded in a single shot.
|
|
37
|
-
|
|
38
|
-
### ๐ง Cross-Project Bug Telepathy (Pro Option) ๐
|
|
39
|
-
**Global Developer Hive Mind.** Lemma dynamically scans and queries vector memory indexes of all other local projects on your computer. If you solved a compiler issue or technical blocker in a different workspace last week, Lemma will telepathically inject that high-confidence solution to the current project's chat without you typing a single word.
|
|
40
|
-
|
|
41
|
-
### โ๏ธ Codebase Context Squeezer & Log Collapsing
|
|
42
|
-
**Massive Speedups & Zero Token Waste.** Get instant model responses and make your context windows go up to 10x further. Lemma dynamically squeezes outgoing codebase payloads, strips comments/whitespaces, and collapses repetitive console logs or redundant compiler stack traces, saving up to 95% on token consumption automatically.
|
|
43
|
-
|
|
44
|
-
### ๐ธ Local Cache-Augmented Response Synthesis (CARS)
|
|
45
|
-
**Zero-Cost Answer Synthesis.** Experience instantaneous responses for questions similar to what you've asked beforeโwithout hitting the cloud or spending a single penny on API tokens. Lemma automatically refines past knowledge to answer your current questions in under a second, keeping your work completely private and free of charge.
|
|
46
|
-
|
|
47
|
-
### ๐ Clipboard Telepathic Watcher (Universal Squeezer)
|
|
48
|
-
**Universal Token Optimization Anywhere.** Enjoy Lemma's massive token-saving compression even in locked enterprise IDEs, web browsers, or closed developer chats. It works silently in the background, making sure that any code you paste into any chat is already fully optimized and compressed. You get ultra-compact, high-speed prompts everywhere instantly.
|
|
25
|
+
### ๐ง Shared Semantic Memory โ The Brain
|
|
26
|
+
Lemma maintains a persistent vector database (ChromaDB) that accumulates knowledge across all your projects. Every solution, bug fix, and architecture decision you work through gets stored and semantically indexed. Future sessions can retrieve this knowledge in milliseconds โ no cloud, no tokens, no re-explaining.
|
|
49
27
|
|
|
50
28
|
### ๐ก๏ธ Privacy Firewall (Semantic Scrubber)
|
|
51
|
-
**Enterprise-Grade Privacy.**
|
|
52
|
-
|
|
53
|
-
### ๐ฆ Complexity Router (Cost-Optimizer)
|
|
54
|
-
**Smart Budget Management.** Slash your AI bills by up to 90% without sacrificing quality. Lemma intelligently evaluates your tasks, automatically using the most cost-effective resources for simple queries while reserving premium models for complex reasoning problems, ensuring optimal efficiency.
|
|
55
|
-
|
|
56
|
-
### ๐ง Telepathic Context Injector & Real-Time MCP Sync
|
|
57
|
-
**Live App Consciousness.** Say goodbye to manual debugging and copy-pasting runtime errors. Your AI assistant stays perfectly synchronized with your application's active state, automatically alerting you to errors and bugs the instant they happen so you can fix them immediately.
|
|
58
|
-
|
|
59
|
-
### โก Zero-Cost Local Streaming Fallback
|
|
60
|
-
**Uninterrupted Offline Coding.** Never get blocked by cloud outages, network drops, or missing API keys. Lemma provides a seamless fallback that keeps your AI chat streaming instantly and completely for free, even when you're fully offline.
|
|
29
|
+
**Enterprise-Grade Privacy.** Prevents API keys, credentials, and PII from ever leaving your machine. Applied automatically to every file read and workspace search via MCP.
|
|
61
30
|
|
|
62
|
-
###
|
|
63
|
-
**
|
|
31
|
+
### ๐ฎ PreCrime Static Analyzer โ Zero Tokens
|
|
32
|
+
**Minority Report for your code.** Combines cyclomatic complexity, git churn history, and module coupling into a composite risk score per file. Predicts which files are most likely to produce a bug before you touch them โ using only the TypeScript Compiler API and git log. No LLM. No Ollama. No tokens.
|
|
64
33
|
|
|
65
|
-
|
|
34
|
+
### ๐ธ๏ธ Coupling Radar โ Zero Tokens
|
|
35
|
+
Builds a full import/export dependency graph of your codebase using the TypeScript Compiler. Detects circular dependencies, god modules (imported by everything), dead islands (no importers), and fan-in/fan-out per module. Essential before any large refactor.
|
|
66
36
|
|
|
67
|
-
|
|
37
|
+
### ๐งฎ Entropy Score โ Zero Tokens
|
|
38
|
+
Mathematical chaos score (0-100) per file using the TS Compiler API. Measures cyclomatic complexity, nesting depth, `any` ratio, and average function size. Tells you exactly where refactor debt is accumulating.
|
|
68
39
|
|
|
69
|
-
|
|
40
|
+
### ๐บ๏ธ AST Hologram โ Zero Tokens
|
|
41
|
+
Scans the entire workspace and returns a dense JSON index of all exported symbols (classes, functions, interfaces, types, consts) with file paths and line numbers. Use this instead of reading individual files โ saves up to 90% tokens when navigating large codebases.
|
|
70
42
|
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
import { LemmaLangChainProvider } from '@nxuss/lemma/langchain';
|
|
43
|
+
### ๐ฆ Complexity Router
|
|
44
|
+
Intelligently evaluates each prompt and routes it to the most cost-effective model. Reserves premium models for complex reasoning, uses smaller models for simple tasks. Slashes your AI bill without sacrificing quality.
|
|
75
45
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
```
|
|
46
|
+
### โ๏ธ Context Squeezer & TurboMode
|
|
47
|
+
Dynamically squeezes outgoing code payloads, strips comments, collapses whitespace, and compacts JSON. Saves up to 90% on token consumption. Automatically injected via the `lemma-turbomode` system prompt on MCP handshake.
|
|
80
48
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
import { LemmaCrewAIProvider } from '@nxuss/lemma/crewai';
|
|
49
|
+
### ๐ธ Autonomous Workspace Control
|
|
50
|
+
Exposes `write_workspace_file`, smart `apply_workspace_patch` (collision-safe search-and-replace), and `run_workspace_command` (with allowlist security) to any IDE via MCP. Any standard chat instantly becomes a fully-featured autonomous multi-file editor.
|
|
85
51
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
```
|
|
52
|
+
### ๐ฉบ AutoPilot & Auto-Heal
|
|
53
|
+
Lemma's background file watcher detects TypeScript compilation errors on every save, parses the error, and calls the auto-heal agent to apply a fix โ automatically. When Autopilot succeeds, the fix is stored in The Brain for future sessions.
|
|
90
54
|
|
|
91
55
|
---
|
|
92
56
|
|
|
93
|
-
## ๐
|
|
94
|
-
|
|
95
|
-
Lemma introduces a powerful, unified command-line tool. Get started, monitor, and manage your local AI gateway effortlessly:
|
|
57
|
+
## ๐ Quick Start (Zero Config)
|
|
96
58
|
|
|
97
59
|
```bash
|
|
98
|
-
#
|
|
60
|
+
# Install globally
|
|
99
61
|
npm install -g @nxuss/lemma
|
|
100
62
|
|
|
101
|
-
#
|
|
63
|
+
# Initialize (auto-configures local DB and MCP for your IDEs)
|
|
102
64
|
lemma init
|
|
103
65
|
|
|
104
|
-
#
|
|
66
|
+
# Start the gateway + dashboard
|
|
105
67
|
lemma start
|
|
106
68
|
```
|
|
107
69
|
|
|
108
|
-
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ๐ ๏ธ CLI Reference
|
|
109
73
|
|
|
110
74
|
| Command | Action |
|
|
111
75
|
| :--- | :--- |
|
|
112
|
-
| `lemma init` | Bootstraps
|
|
113
|
-
| `lemma start` | Launches
|
|
76
|
+
| `lemma init` | Bootstraps config and auto-configures MCP for Claude Desktop, Cursor, Windsurf, Kiro, VS Code. |
|
|
77
|
+
| `lemma start` | Launches proxy, cache engine, and dashboard at `http://localhost:8081`. |
|
|
114
78
|
| `lemma stop` | Gracefully shuts down the background proxy. |
|
|
115
|
-
| `lemma status` |
|
|
116
|
-
| `lemma stats` |
|
|
117
|
-
| `lemma mcp` | Starts stdin/stdout MCP server for IDE integration
|
|
79
|
+
| `lemma status` | Health of all modules and active connections. |
|
|
80
|
+
| `lemma stats` | Real-time token and cost savings metrics. |
|
|
81
|
+
| `lemma mcp` | Starts the stdin/stdout MCP server for IDE integration. |
|
|
118
82
|
| `lemma heal` | Auto-diagnose and repair the latest server crash from live context logs. |
|
|
119
|
-
| `lemma
|
|
120
|
-
| `lemma activate <key>` | Activate a Pro license key. |
|
|
121
|
-
| `lemma autopilot` | Toggle autonomous mode for unattended cost optimization. |
|
|
122
|
-
| `lemma clipboard` | Toggle the Clipboard Telepathic Watcher daemon. |
|
|
83
|
+
| `lemma autopilot` | Toggle autonomous background watcher mode. |
|
|
123
84
|
|
|
124
|
-
###
|
|
85
|
+
### Customizing via `lemma.config.json`
|
|
125
86
|
|
|
126
|
-
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"system": {
|
|
90
|
+
"clipboardWatcher": { "disabled": false }
|
|
91
|
+
},
|
|
92
|
+
"mcp": {
|
|
93
|
+
"allowedCommandPrefixes": ["npm", "git", "tsc", "your-custom-tool"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
127
97
|
|
|
128
|
-
|
|
98
|
+
---
|
|
129
99
|
|
|
130
|
-
|
|
131
|
-
* **`lemma init --no-configure`**: Initialize without MCP server configuration for any IDE.
|
|
132
|
-
* **`lemma init --yes`**: Skip all prompts and accept defaults (auto-configures all IDEs).
|
|
133
|
-
* **`lemma start --no-clipboard`**: Start the proxy without spawning the background Clipboard watcher daemon.
|
|
100
|
+
## ๐ MCP Integration
|
|
134
101
|
|
|
135
|
-
|
|
102
|
+
Add Lemma to any MCP-compatible IDE in seconds:
|
|
136
103
|
|
|
137
|
-
|
|
104
|
+
### Cursor / Windsurf / Kiro / Antigravity
|
|
105
|
+
1. Go to **Settings โ MCP**
|
|
106
|
+
2. Add new server: **Command** = `lemma mcp`
|
|
138
107
|
|
|
108
|
+
### Claude Desktop
|
|
139
109
|
```json
|
|
140
110
|
{
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"shell": true,
|
|
146
|
-
"claude": true
|
|
147
|
-
},
|
|
148
|
-
"clipboardWatcher": {
|
|
149
|
-
"disabled": false
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"lemma": {
|
|
113
|
+
"command": "npx",
|
|
114
|
+
"args": ["-y", "@nxuss/lemma", "mcp"]
|
|
150
115
|
}
|
|
151
116
|
}
|
|
152
117
|
}
|
|
153
118
|
```
|
|
154
119
|
|
|
155
|
-
|
|
120
|
+
Once connected, your IDE gains access to all **32 MCP tools** and Lemma auto-injects the TurboMode system prompt on handshake.
|
|
156
121
|
|
|
157
|
-
|
|
122
|
+
---
|
|
158
123
|
|
|
159
|
-
|
|
124
|
+
## ๐ ๏ธ MCP Tools Reference (v0.9.0 โ 32 Tools)
|
|
160
125
|
|
|
161
126
|
### ๐๏ธ Workspace Tools
|
|
162
127
|
|
|
163
128
|
| Tool | Description |
|
|
164
129
|
| :--- | :--- |
|
|
165
|
-
| `read_workspace_file` | Read a file with automatic token compression
|
|
166
|
-
| `write_workspace_file` | Write content to a file, creating directories as needed. |
|
|
167
|
-
| `apply_workspace_patch` | Smart search-and-replace patch โ safe against duplicate matches. |
|
|
130
|
+
| `read_workspace_file` | Read a file with automatic token compression and privacy scrubbing. |
|
|
131
|
+
| `write_workspace_file` | Write content to a file, creating parent directories as needed. |
|
|
132
|
+
| `apply_workspace_patch` | Smart search-and-replace patch โ safe against duplicate matches. Returns clear errors if search block is ambiguous. |
|
|
168
133
|
| `list_workspace_dir` | Recursively list the project structure up to a configurable depth. |
|
|
169
|
-
| `search_workspace` | Fast text search (grep) across all project files with optional extension filter. |
|
|
170
|
-
| `run_workspace_command` | Execute bash commands
|
|
134
|
+
| `search_workspace` | Fast text search (grep) across all project files with optional extension filter. Results are privacy-scrubbed. |
|
|
135
|
+
| `run_workspace_command` | Execute bash commands in the workspace root. Secured by an allowlist. 15s timeout. |
|
|
171
136
|
|
|
172
|
-
### ๐ฌ Code Intelligence Tools
|
|
137
|
+
### ๐ฌ Code Intelligence Tools
|
|
173
138
|
|
|
174
139
|
| Tool | Description |
|
|
175
140
|
| :--- | :--- |
|
|
176
|
-
| `get_ast_hologram` | **Holographic AST Map.** Scans the workspace and returns a dense JSON index of all exported symbols
|
|
177
|
-
| `validate_patch_sandbox` | **
|
|
141
|
+
| `get_ast_hologram` | **Holographic AST Map.** Scans the workspace via TS Compiler API and returns a dense JSON index of all exported symbols with file paths and line numbers. Use instead of reading individual files โ 90% token savings. Zero LLM calls. |
|
|
142
|
+
| `validate_patch_sandbox` | **Pre-flight Validator.** Validates a proposed patch in an isolated sandbox before applying it. Runs `tsc --noEmit` and bracket-balance checks. Returns `SAFE TO APPLY` or `DO NOT APPLY` verdict. |
|
|
143
|
+
| `diff_only` | Compute a compact line-by-line diff between the last known state of a file and its current content. Session-scoped state tracking. |
|
|
178
144
|
|
|
179
145
|
### ๐ง Brain & Memory Tools
|
|
180
146
|
|
|
181
147
|
| Tool | Description |
|
|
182
148
|
| :--- | :--- |
|
|
183
|
-
| `search_memory` | Semantic search across The Brain โ retrieves past solutions and context from all your projects. |
|
|
184
|
-
| `store_memory` |
|
|
185
|
-
| `query_hybrid_consensus` | **Hybrid Consensus Engine.** Checks The Brain
|
|
186
|
-
| `get_telepathic_hints` | **Proactive Telepathy.** Given the
|
|
149
|
+
| `search_memory` | Semantic search across The Brain โ retrieves past solutions and context from all your projects globally. |
|
|
150
|
+
| `store_memory` | Persist a technical solution, bug fix, or architecture decision into The Brain for future sessions. |
|
|
151
|
+
| `query_hybrid_consensus` | **Hybrid Consensus Engine.** Checks The Brain at configurable threshold (default 80%). HIT โ instant answer, zero cloud tokens. MISS โ proceed with cloud and cache afterward. |
|
|
152
|
+
| `get_telepathic_hints` | **Proactive Telepathy.** Given the active file path, surfaces the top N most relevant past solutions from The Brain โ no query needed. |
|
|
187
153
|
|
|
188
154
|
### โ๏ธ Optimization & Privacy Tools
|
|
189
155
|
|
|
190
156
|
| Tool | Description |
|
|
191
157
|
| :--- | :--- |
|
|
192
158
|
| `scrub_privacy` | Mask PII, API keys, and secrets from any text block using the Privacy Firewall. |
|
|
193
|
-
| `squeeze_prompt` | Compress code blocks and boilerplate in any prompt
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
159
|
+
| `squeeze_prompt` | Compress code blocks and boilerplate in any prompt. Up to 80% token reduction. |
|
|
160
|
+
| `turbosqueeze` | **Extreme compression.** Strips comments, imports, whitespace, and compacts JSON. Returns reduction stats. |
|
|
161
|
+
| `compress_context` | Summarizes old conversation turns, keeps last N turns intact. Falls back to truncation if no Ollama. |
|
|
162
|
+
| `prune_conversation_history` | Intelligently decimate conversation history while preserving critical recent context. |
|
|
163
|
+
| `summarize_long_text` | Summarize lengthy content via Ollama to save context window space. Falls back gracefully. |
|
|
164
|
+
| `smarter_cache` | **Predictive cache.** Queries The Brain at 75% threshold before any reasoning. Auto-suggests `store_memory` on MISS. |
|
|
165
|
+
| `token_budget` | Optimization dashboard: multiplier, total tokens saved, active strategies, and recommendations. |
|
|
166
|
+
| `get_routing_advice` | Analyze a prompt and get optimal model recommendation from the Complexity Router. |
|
|
167
|
+
| `get_project_onboarding` | Download a one-shot architectural mental model of the current codebase. |
|
|
168
|
+
| `auto_heal` | Diagnose and auto-heal the latest crash from Lemma's live context logs. |
|
|
169
|
+
| `batch_tool_calls` | Execute multiple tool calls in parallel via `Promise.all`. High-throughput operations in a single MCP round-trip. |
|
|
170
|
+
|
|
171
|
+
### ๐ฎ Zero-Token Static Intelligence Tools (NEW in v0.9.0)
|
|
172
|
+
|
|
173
|
+
> All tools in this section use **zero LLM tokens, zero Ollama, zero cloud**. Pure local computation via TypeScript Compiler API, git, and math.
|
|
207
174
|
|
|
208
175
|
| Tool | Description |
|
|
209
176
|
| :--- | :--- |
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
177
|
+
| `entropy_score` | **Mathematical chaos score** (0-100) per file. Measures cyclomatic complexity, max nesting depth, `any` type ratio, and average function size. Identifies which files need refactoring before you touch them. |
|
|
178
|
+
| `coupling_radar` | **Dependency graph analysis.** Detects circular imports, god modules (high fan-in), dead islands (no importers), and fan-in/fan-out per module. Essential before large refactors. |
|
|
179
|
+
| `pattern_fossil` | **Zombie code detector.** Finds patterns that were replaced in most of the codebase but survive in old files: `var` vs `const/let`, callbacks vs `async/await`, `require()` vs `import`, `: any` vs generics. Reports adoption percentage. |
|
|
180
|
+
| `git_heatmap_risk` | **Git churn analysis.** Calculates change frequency per file and co-edit pairs (files that always change together = hidden coupling). Returns a risk score for each file based on historical git behavior. |
|
|
181
|
+
| `precrime_static` | **Minority Report predictor.** Combines `entropy_score` (40%) + `git_heatmap_risk` (40%) + `coupling_radar` (20%) into a composite PreCrime Score per file. Ranks files by bug probability with per-factor breakdown and names the riskiest functions. |
|
|
182
|
+
| `semantic_dedup_guard` | **Brain dedup firewall.** Before calling `store_memory`, pass content through here. If similarity โฅ 92% โ rejects as duplicate. If 75โ91% โ warns and shows the similar entry. Keeps The Brain lean and dense. |
|
|
183
|
+
| `dead_export_necromancer` | **Dead code auditor.** Maps every `export` in the workspace against every `import`. Symbols exported but never imported anywhere = zombie code inflating your context. Reports dead exports by file with estimated token waste. |
|
|
214
184
|
|
|
215
185
|
### โก TurboMode Auto-Injection
|
|
216
|
-
|
|
217
|
-
|
|
186
|
+
|
|
187
|
+
When connected via `lemma mcp`, Lemma auto-injects 7 rules into the agent's system prompt on handshake:
|
|
188
|
+
|
|
189
|
+
1. `turbosqueeze` before writing large code blocks
|
|
218
190
|
2. `smarter_cache` before any reasoning
|
|
219
|
-
3. `
|
|
220
|
-
4. `
|
|
221
|
-
5. `
|
|
222
|
-
6. `
|
|
223
|
-
7. No fluff
|
|
191
|
+
3. `store_memory` after every resolved solution
|
|
192
|
+
4. `get_ast_hologram` before reading files
|
|
193
|
+
5. `batch_tool_calls` for parallel operations
|
|
194
|
+
6. `semantic_dedup_guard` before every `store_memory`
|
|
195
|
+
7. No fluff, no chit-chat โ maximum density
|
|
224
196
|
|
|
225
|
-
|
|
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.
|
|
197
|
+
---
|
|
227
198
|
|
|
228
|
-
|
|
199
|
+
## ๐ก MCP Resources
|
|
229
200
|
|
|
230
201
|
| Resource URI | Description |
|
|
231
202
|
| :--- | :--- |
|
|
232
|
-
| `lemma://runtime/context` | Live application errors, stack traces, and runtime state. Subscribable โ
|
|
203
|
+
| `lemma://runtime/context` | Live application errors, stack traces, and runtime state. Subscribable โ IDE notified instantly on crash. |
|
|
233
204
|
| `lemma://stats/usage` | Current token savings, cost report, and cache hit metrics in JSON. |
|
|
234
|
-
| `lemma://project/context` | Active project metadata, tech stack, memory count, and token savings
|
|
205
|
+
| `lemma://project/context` | Active project metadata, tech stack, memory count, and token savings. |
|
|
235
206
|
| `lemma://project/onboarding` | Dynamic project architecture guide compiled on demand. |
|
|
236
|
-
| `lemma://multiverse/timeline` | Chronological AST diff timeline of
|
|
207
|
+
| `lemma://multiverse/timeline` | Chronological AST diff timeline of recent code snapshots. |
|
|
237
208
|
|
|
238
209
|
---
|
|
239
210
|
|
|
240
|
-
##
|
|
241
|
-
|
|
242
|
-
| Feature | ๐ Free (Standard) | ๐ Pro ($12/mo) |
|
|
243
|
-
| :--- | :--- | :--- |
|
|
244
|
-
| **Privacy Firewall** | โ
Included | โ
Advanced Masking |
|
|
245
|
-
| **Complexity Router** | โ
Included | โ
Custom Routing Policies |
|
|
246
|
-
| **Caching** | Exact Match | **Semantic Memory** |
|
|
247
|
-
| **Hive Mind** | Local Only | **Cloud Sync (Team Memory) + Cross-Project Telepathy ๐** |
|
|
248
|
-
| **AST Time-Travel Telemetry** | โ None | **Codebase Multiverse (Cap 10 AST Snapshots) ๐** |
|
|
249
|
-
| **Kiro/Cursor Composer Bypass** | โ None | **Smart Patches & Sandbox Terminal MCP ๐** |
|
|
250
|
-
| **Zero-Shot Onboarding Guide** | โ None | **Codebase Architecture Map MCP ๐** |
|
|
251
|
-
| **AST Hologram** | โ None | **Symbol Map โ 90% token savings ๐** |
|
|
252
|
-
| **Sandbox Patch Validator** | โ None | **Pre-flight code safety checks ๐** |
|
|
253
|
-
| **Hybrid Consensus Engine** | โ None | **Brain-first query routing ๐** |
|
|
254
|
-
| **Proactive Telepathy** | โ None | **Auto-surfaced context hints ๐** |
|
|
255
|
-
| **Telemetry Dashboard** | Basic Stats | **Time-Travel Debugger & 60fps Graph** |
|
|
256
|
-
| **Limits** | 300 requests/mo | **Unlimited Agentic Power** |
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## ๐ ๏ธ Integration: Power Up Your Favorite Tools
|
|
261
|
-
|
|
262
|
-
Lemma is compatible with **any** tool that allows you to configure a custom OpenAI Base URL. This means you can add Lemma's intelligence to your existing workflow in seconds.
|
|
263
|
-
|
|
264
|
-
### ๐ฌ Use it with AI Chats & IDEs
|
|
265
|
-
You don't need to change your habits. Just point your tool's "Base URL" to Lemma:
|
|
266
|
-
* **Cursor:** Go to `Settings > Models > OpenAI API > Override Base URL` and set it to `http://localhost:8081/v1`.
|
|
267
|
-
* **VS Code (Continue):** Update your `config.json` to use `http://localhost:8081/v1` as the `apiBase`.
|
|
268
|
-
* **AutoGPT / BabyAGI:** Set the `OPENAI_API_BASE` environment variable.
|
|
269
|
-
* **Custom Apps:** Replace `https://api.openai.com/v1` with `http://localhost:8081/v1` in your SDK initialization.
|
|
270
|
-
|
|
271
|
-
### ๐ Pro Integration (Model Context Protocol - MCP)
|
|
272
|
-
For **Lemma Pro** users, expose Lemma's entire intelligence layer โ Privacy Firewall, Semantic Brain, AST Hologram, Sandbox Validator, Hybrid Consensus, and Proactive Telepathy โ directly as native tools using the **Model Context Protocol (MCP)**. This lets the LLM read, search, write, patch, validate, and compile files autonomously.
|
|
273
|
-
|
|
274
|
-
#### ๐ข Cursor / Antigravity / Windsurf:
|
|
275
|
-
1. Go to **Settings > Features > MCP**.
|
|
276
|
-
2. Click **+ Add New MCP Server**.
|
|
277
|
-
3. Configure the server:
|
|
278
|
-
* **Name**: `Lemma`
|
|
279
|
-
* **Type**: `command`
|
|
280
|
-
* **Command**: `lemma mcp`
|
|
281
|
-
4. Click **Save**. A green **"Connected"** dot will appear, confirming that the IDE has loaded all 25 of Lemma's tools.
|
|
282
|
-
|
|
283
|
-
#### ๐ข Claude Desktop:
|
|
284
|
-
Add the following to your `claude_desktop_config.json` configuration file:
|
|
285
|
-
```json
|
|
286
|
-
{
|
|
287
|
-
"mcpServers": {
|
|
288
|
-
"lemma": {
|
|
289
|
-
"command": "npx",
|
|
290
|
-
"args": ["-y", "@nxuss/lemma", "mcp"]
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### โก Why use Lemma for Chat?
|
|
297
|
-
1. **Privacy:** Your IDE won't leak your secrets to the cloud.
|
|
298
|
-
2. **Context:** Lemma syncs your runtime crashes directly to your chat window.
|
|
299
|
-
3. **Speed:** Instant responses for similar questions via Semantic Cache.
|
|
300
|
-
4. **Intelligence:** AST Hologram + Hybrid Consensus = dramatically fewer tokens spent per session.
|
|
301
|
-
5. **Observability:** Gorgeous dashboard showing you exactly how much cash and tokens you are saving.
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## ๐ Security & Privacy
|
|
211
|
+
## ๐ Security
|
|
306
212
|
|
|
307
213
|
### Network Binding
|
|
308
|
-
By default, Lemma binds only to `127.0.0.1` (localhost).
|
|
214
|
+
By default, Lemma binds only to `127.0.0.1` (localhost). Not network-accessible unless explicitly configured:
|
|
309
215
|
```env
|
|
310
216
|
LEMMA_BIND_HOST=0.0.0.0
|
|
217
|
+
AUTH_ENABLED=true
|
|
218
|
+
AUTH_REQUIRE_API_KEY=true
|
|
219
|
+
AUTH_ALLOWED_ORIGINS=https://yourdomain.com
|
|
311
220
|
```
|
|
312
|
-
> โ ๏ธ If you do expose Lemma to the network, always enable authentication first:
|
|
313
|
-
> ```env
|
|
314
|
-
> AUTH_ENABLED=true
|
|
315
|
-
> AUTH_REQUIRE_API_KEY=true
|
|
316
|
-
> AUTH_ALLOWED_ORIGINS=https://yourdomain.com
|
|
317
|
-
> ```
|
|
318
|
-
|
|
319
|
-
### ๐ Clipboard Watcher Disclosure
|
|
320
|
-
The **Clipboard Telepathic Watcher** polls your system clipboard every 1 second to automatically compress code you copy. This is disclosed in the startup banner. To disable it:
|
|
321
|
-
```env
|
|
322
|
-
# In your .env
|
|
323
|
-
LEMMA_DISABLE_CLIPBOARD=true
|
|
324
|
-
```
|
|
325
|
-
Or via CLI flag: `lemma start --no-clipboard`
|
|
326
221
|
|
|
327
222
|
### MCP Command Allowlist
|
|
328
|
-
|
|
223
|
+
`run_workspace_command` only executes commands from an allowlist. Default safe prefixes: `npm`, `npx`, `git`, `tsc`, `node`, `jest`, `eslint`, `ls`, `grep`, and more.
|
|
329
224
|
|
|
330
|
-
|
|
225
|
+
Extend for your project in `lemma.config.json`:
|
|
331
226
|
```json
|
|
332
227
|
{
|
|
333
228
|
"mcp": {
|
|
@@ -336,24 +231,37 @@ To extend the allowlist for your project, add to `lemma.config.json`:
|
|
|
336
231
|
}
|
|
337
232
|
```
|
|
338
233
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
234
|
+
See [`.env.security.example`](.env.security.example) for all security-related environment variables.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## ๐ฆ SDK Integrations
|
|
239
|
+
|
|
240
|
+
### LangChain
|
|
241
|
+
```typescript
|
|
242
|
+
import { LemmaLangChainProvider } from '@nxuss/lemma/langchain';
|
|
243
|
+
|
|
244
|
+
const model = new LemmaLangChainProvider({
|
|
245
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
246
|
+
});
|
|
344
247
|
```
|
|
345
248
|
|
|
346
|
-
###
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
249
|
+
### CrewAI
|
|
250
|
+
```typescript
|
|
251
|
+
import { LemmaCrewAIProvider } from '@nxuss/lemma/crewai';
|
|
252
|
+
|
|
253
|
+
const crew = new LemmaCrewAIProvider({ agents: [...] });
|
|
350
254
|
```
|
|
351
|
-
Get this from **Stripe Dashboard โ Developers โ Webhooks โ Signing Secret**. Without it, the endpoint is disabled in `NODE_ENV=production`.
|
|
352
255
|
|
|
353
|
-
|
|
256
|
+
---
|
|
354
257
|
|
|
355
|
-
|
|
356
|
-
|
|
258
|
+
## ๐ Using as a Proxy
|
|
259
|
+
|
|
260
|
+
Point any OpenAI-compatible tool to Lemma's local proxy for transparent caching and privacy:
|
|
261
|
+
|
|
262
|
+
- **Cursor:** `Settings > Models > OpenAI API > Override Base URL` โ `http://localhost:8081/v1`
|
|
263
|
+
- **VS Code (Continue):** Set `apiBase` to `http://localhost:8081/v1`
|
|
264
|
+
- **Custom apps:** Replace `https://api.openai.com/v1` with `http://localhost:8081/v1`
|
|
357
265
|
|
|
358
266
|
---
|
|
359
267
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA0cnE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAC1C,IAAI,CA2CN"}
|