@nxuss/lemma 0.8.2 โ 0.9.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/README.md +164 -234
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +911 -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 +911 -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.1
|
|
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,239 @@
|
|
|
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.**
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## โก Killer Features
|
|
25
|
-
|
|
26
|
-
### ๐ฅ๏ธ Real-Time Telemetry & Time-Travel Dashboard
|
|
27
|
-
**Full Observability & Interactive Debugging.** Spin up a gorgeous React-based dashboard at `http://localhost:8081/dashboard/` to monitor your entire AI workflow. View real-time charts of cost savings, token compactions, and cache hits. Walk through complex multi-agent conversations step-by-step using a time-travel slider, select and inspect active agent states, and export detailed telemetry audits instantly.
|
|
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.
|
|
28
20
|
|
|
29
|
-
|
|
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".
|
|
21
|
+
---
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
## ๐ Free vs Pro
|
|
24
|
+
|
|
25
|
+
| Feature | ๐ Free | ๐ Pro |
|
|
26
|
+
| :--- | :---: | :---: |
|
|
27
|
+
| **AI Proxy (OpenAI/Anthropic/Gemini)** | โ
| โ
|
|
|
28
|
+
| **Exact-match cache** | โ
| โ
|
|
|
29
|
+
| **Context Squeezer (auto-compression)** | โ
| โ
|
|
|
30
|
+
| **Privacy Firewall (proxy layer)** | โ
| โ
|
|
|
31
|
+
| **Complexity Router** | โ
| โ
|
|
|
32
|
+
| **Dashboard** | Basic stats | โ
Full time-travel |
|
|
33
|
+
| **Proxy requests/month** | 300 | โ
Unlimited |
|
|
34
|
+
| **MCP Server (all 32 tools)** | โ | โ
|
|
|
35
|
+
| **The Brain โ Semantic Memory** | โ | โ
|
|
|
36
|
+
| **Zero-Token Static Analysis** | โ | โ
|
|
|
37
|
+
| **Cross-Project Telepathy** | โ | โ
|
|
|
38
|
+
| **AutoPilot & Auto-Heal** | โ | โ
|
|
|
39
|
+
|
|
40
|
+
> **The MCP is Pro.** All 32 tools โ The Brain, PreCrime predictor, AST Hologram, Entropy Score, Coupling Radar, workspace control, and every optimization tool โ require a Pro license. Activate with `lemma activate <key>` โ [Get Pro](https://lemma.nxus.studio/upgrade)
|
|
37
41
|
|
|
38
|
-
|
|
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.
|
|
42
|
+
---
|
|
40
43
|
|
|
41
|
-
|
|
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.
|
|
44
|
+
## โก What's in the Pro MCP
|
|
43
45
|
|
|
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
46
|
|
|
47
|
-
###
|
|
48
|
-
|
|
47
|
+
### ๐ง Shared Semantic Memory โ The Brain
|
|
48
|
+
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
49
|
|
|
50
50
|
### ๐ก๏ธ Privacy Firewall (Semantic Scrubber)
|
|
51
|
-
**Enterprise-Grade Privacy.**
|
|
51
|
+
**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.
|
|
52
52
|
|
|
53
|
-
###
|
|
54
|
-
**
|
|
53
|
+
### ๐ฎ PreCrime Static Analyzer โ Zero Tokens
|
|
54
|
+
**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.
|
|
55
55
|
|
|
56
|
-
###
|
|
57
|
-
|
|
56
|
+
### ๐ธ๏ธ Coupling Radar โ Zero Tokens
|
|
57
|
+
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.
|
|
58
58
|
|
|
59
|
-
###
|
|
60
|
-
|
|
59
|
+
### ๐งฎ Entropy Score โ Zero Tokens
|
|
60
|
+
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.
|
|
61
61
|
|
|
62
|
-
###
|
|
63
|
-
|
|
62
|
+
### ๐บ๏ธ AST Hologram โ Zero Tokens
|
|
63
|
+
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.
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## ๐ Native SDKs: LangChain & CrewAI Integration
|
|
68
|
-
|
|
69
|
-
Lemma isn't just for IDE chats. Bring enterprise privacy and cost-savings to your codebases and agentic frameworks.
|
|
70
|
-
|
|
71
|
-
### ๐ฆ LangChain Integration
|
|
72
|
-
Run secure, ultra-efficient chains with a single line of code. Lemma integrates natively as a first-class provider in LangChain, tree-shaking outgoing tool calls and caching complex semantic queries.
|
|
73
|
-
```typescript
|
|
74
|
-
import { LemmaLangChainProvider } from '@nxuss/lemma/langchain';
|
|
65
|
+
### ๐ฆ Complexity Router
|
|
66
|
+
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
67
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
```
|
|
68
|
+
### โ๏ธ Context Squeezer & TurboMode
|
|
69
|
+
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
70
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
import { LemmaCrewAIProvider } from '@nxuss/lemma/crewai';
|
|
71
|
+
### ๐ธ Autonomous Workspace Control
|
|
72
|
+
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
73
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
```
|
|
74
|
+
### ๐ฉบ AutoPilot & Auto-Heal
|
|
75
|
+
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
76
|
|
|
91
77
|
---
|
|
92
78
|
|
|
93
|
-
## ๐
|
|
94
|
-
|
|
95
|
-
Lemma introduces a powerful, unified command-line tool. Get started, monitor, and manage your local AI gateway effortlessly:
|
|
79
|
+
## ๐ Quick Start (Zero Config)
|
|
96
80
|
|
|
97
81
|
```bash
|
|
98
|
-
#
|
|
82
|
+
# Install globally
|
|
99
83
|
npm install -g @nxuss/lemma
|
|
100
84
|
|
|
101
|
-
#
|
|
85
|
+
# Initialize (auto-configures local DB and MCP for your IDEs)
|
|
102
86
|
lemma init
|
|
103
87
|
|
|
104
|
-
#
|
|
88
|
+
# Start the gateway + dashboard
|
|
105
89
|
lemma start
|
|
106
90
|
```
|
|
107
91
|
|
|
108
|
-
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## ๐ ๏ธ CLI Reference
|
|
109
95
|
|
|
110
96
|
| Command | Action |
|
|
111
97
|
| :--- | :--- |
|
|
112
|
-
| `lemma init` | Bootstraps
|
|
113
|
-
| `lemma start` | Launches
|
|
98
|
+
| `lemma init` | Bootstraps config and auto-configures MCP for Claude Desktop, Cursor, Windsurf, Kiro, VS Code. |
|
|
99
|
+
| `lemma start` | Launches proxy, cache engine, and dashboard at `http://localhost:8081`. |
|
|
114
100
|
| `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
|
|
101
|
+
| `lemma status` | Health of all modules and active connections. |
|
|
102
|
+
| `lemma stats` | Real-time token and cost savings metrics. |
|
|
103
|
+
| `lemma mcp` | Starts the stdin/stdout MCP server for IDE integration. |
|
|
118
104
|
| `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. |
|
|
105
|
+
| `lemma autopilot` | Toggle autonomous background watcher mode. |
|
|
123
106
|
|
|
124
|
-
###
|
|
107
|
+
### Customizing via `lemma.config.json`
|
|
125
108
|
|
|
126
|
-
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"system": {
|
|
112
|
+
"clipboardWatcher": { "disabled": false }
|
|
113
|
+
},
|
|
114
|
+
"mcp": {
|
|
115
|
+
"allowedCommandPrefixes": ["npm", "git", "tsc", "your-custom-tool"]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
127
119
|
|
|
128
|
-
|
|
120
|
+
---
|
|
129
121
|
|
|
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.
|
|
122
|
+
## ๐ MCP Integration
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
Add Lemma to any MCP-compatible IDE in seconds:
|
|
136
125
|
|
|
137
|
-
|
|
126
|
+
### Cursor / Windsurf / Kiro / Antigravity
|
|
127
|
+
1. Go to **Settings โ MCP**
|
|
128
|
+
2. Add new server: **Command** = `lemma mcp`
|
|
138
129
|
|
|
130
|
+
### Claude Desktop
|
|
139
131
|
```json
|
|
140
132
|
{
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"shell": true,
|
|
146
|
-
"claude": true
|
|
147
|
-
},
|
|
148
|
-
"clipboardWatcher": {
|
|
149
|
-
"disabled": false
|
|
133
|
+
"mcpServers": {
|
|
134
|
+
"lemma": {
|
|
135
|
+
"command": "npx",
|
|
136
|
+
"args": ["-y", "@nxuss/lemma", "mcp"]
|
|
150
137
|
}
|
|
151
138
|
}
|
|
152
139
|
}
|
|
153
140
|
```
|
|
154
141
|
|
|
155
|
-
|
|
142
|
+
Once connected, your IDE gains access to all **32 MCP tools** and Lemma auto-injects the TurboMode system prompt on handshake.
|
|
156
143
|
|
|
157
|
-
|
|
144
|
+
---
|
|
158
145
|
|
|
159
|
-
|
|
146
|
+
## ๐ ๏ธ MCP Tools Reference (v0.9.0 โ 32 Tools)
|
|
160
147
|
|
|
161
148
|
### ๐๏ธ Workspace Tools
|
|
162
149
|
|
|
163
150
|
| Tool | Description |
|
|
164
151
|
| :--- | :--- |
|
|
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. |
|
|
152
|
+
| `read_workspace_file` | Read a file with automatic token compression and privacy scrubbing. |
|
|
153
|
+
| `write_workspace_file` | Write content to a file, creating parent directories as needed. |
|
|
154
|
+
| `apply_workspace_patch` | Smart search-and-replace patch โ safe against duplicate matches. Returns clear errors if search block is ambiguous. |
|
|
168
155
|
| `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
|
|
156
|
+
| `search_workspace` | Fast text search (grep) across all project files with optional extension filter. Results are privacy-scrubbed. |
|
|
157
|
+
| `run_workspace_command` | Execute bash commands in the workspace root. Secured by an allowlist. 15s timeout. |
|
|
171
158
|
|
|
172
|
-
### ๐ฌ Code Intelligence Tools
|
|
159
|
+
### ๐ฌ Code Intelligence Tools
|
|
173
160
|
|
|
174
161
|
| Tool | Description |
|
|
175
162
|
| :--- | :--- |
|
|
176
|
-
| `get_ast_hologram` | **Holographic AST Map.** Scans the workspace and returns a dense JSON index of all exported symbols
|
|
177
|
-
| `validate_patch_sandbox` | **
|
|
163
|
+
| `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. |
|
|
164
|
+
| `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. |
|
|
165
|
+
| `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
166
|
|
|
179
167
|
### ๐ง Brain & Memory Tools
|
|
180
168
|
|
|
181
169
|
| Tool | Description |
|
|
182
170
|
| :--- | :--- |
|
|
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
|
|
171
|
+
| `search_memory` | Semantic search across The Brain โ retrieves past solutions and context from all your projects globally. |
|
|
172
|
+
| `store_memory` | Persist a technical solution, bug fix, or architecture decision into The Brain for future sessions. |
|
|
173
|
+
| `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. |
|
|
174
|
+
| `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
175
|
|
|
188
176
|
### โ๏ธ Optimization & Privacy Tools
|
|
189
177
|
|
|
190
178
|
| Tool | Description |
|
|
191
179
|
| :--- | :--- |
|
|
192
180
|
| `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
|
-
|
|
181
|
+
| `squeeze_prompt` | Compress code blocks and boilerplate in any prompt. Up to 80% token reduction. |
|
|
182
|
+
| `turbosqueeze` | **Extreme compression.** Strips comments, imports, whitespace, and compacts JSON. Returns reduction stats. |
|
|
183
|
+
| `compress_context` | Summarizes old conversation turns, keeps last N turns intact. Falls back to truncation if no Ollama. |
|
|
184
|
+
| `prune_conversation_history` | Intelligently decimate conversation history while preserving critical recent context. |
|
|
185
|
+
| `summarize_long_text` | Summarize lengthy content via Ollama to save context window space. Falls back gracefully. |
|
|
186
|
+
| `smarter_cache` | **Predictive cache.** Queries The Brain at 75% threshold before any reasoning. Auto-suggests `store_memory` on MISS. |
|
|
187
|
+
| `token_budget` | Optimization dashboard: multiplier, total tokens saved, active strategies, and recommendations. |
|
|
188
|
+
| `get_routing_advice` | Analyze a prompt and get optimal model recommendation from the Complexity Router. |
|
|
189
|
+
| `get_project_onboarding` | Download a one-shot architectural mental model of the current codebase. |
|
|
190
|
+
| `auto_heal` | Diagnose and auto-heal the latest crash from Lemma's live context logs. |
|
|
191
|
+
| `batch_tool_calls` | Execute multiple tool calls in parallel via `Promise.all`. High-throughput operations in a single MCP round-trip. |
|
|
192
|
+
|
|
193
|
+
### ๐ฎ Zero-Token Static Intelligence Tools (NEW in v0.9.0)
|
|
194
|
+
|
|
195
|
+
> All tools in this section use **zero LLM tokens, zero Ollama, zero cloud**. Pure local computation via TypeScript Compiler API, git, and math.
|
|
207
196
|
|
|
208
197
|
| Tool | Description |
|
|
209
198
|
| :--- | :--- |
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
199
|
+
| `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. |
|
|
200
|
+
| `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. |
|
|
201
|
+
| `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. |
|
|
202
|
+
| `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. |
|
|
203
|
+
| `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. |
|
|
204
|
+
| `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. |
|
|
205
|
+
| `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
206
|
|
|
215
207
|
### โก TurboMode Auto-Injection
|
|
216
|
-
|
|
217
|
-
|
|
208
|
+
|
|
209
|
+
When connected via `lemma mcp`, Lemma auto-injects 7 rules into the agent's system prompt on handshake:
|
|
210
|
+
|
|
211
|
+
1. `turbosqueeze` before writing large code blocks
|
|
218
212
|
2. `smarter_cache` before any reasoning
|
|
219
|
-
3. `
|
|
220
|
-
4. `
|
|
221
|
-
5. `
|
|
222
|
-
6. `
|
|
223
|
-
7. No fluff
|
|
213
|
+
3. `store_memory` after every resolved solution
|
|
214
|
+
4. `get_ast_hologram` before reading files
|
|
215
|
+
5. `batch_tool_calls` for parallel operations
|
|
216
|
+
6. `semantic_dedup_guard` before every `store_memory`
|
|
217
|
+
7. No fluff, no chit-chat โ maximum density
|
|
224
218
|
|
|
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.
|
|
219
|
+
---
|
|
227
220
|
|
|
228
|
-
|
|
221
|
+
## ๐ก MCP Resources
|
|
229
222
|
|
|
230
223
|
| Resource URI | Description |
|
|
231
224
|
| :--- | :--- |
|
|
232
|
-
| `lemma://runtime/context` | Live application errors, stack traces, and runtime state. Subscribable โ
|
|
225
|
+
| `lemma://runtime/context` | Live application errors, stack traces, and runtime state. Subscribable โ IDE notified instantly on crash. |
|
|
233
226
|
| `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
|
|
227
|
+
| `lemma://project/context` | Active project metadata, tech stack, memory count, and token savings. |
|
|
235
228
|
| `lemma://project/onboarding` | Dynamic project architecture guide compiled on demand. |
|
|
236
|
-
| `lemma://multiverse/timeline` | Chronological AST diff timeline of
|
|
229
|
+
| `lemma://multiverse/timeline` | Chronological AST diff timeline of recent code snapshots. |
|
|
237
230
|
|
|
238
231
|
---
|
|
239
232
|
|
|
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
|
|
233
|
+
## ๐ Security
|
|
306
234
|
|
|
307
235
|
### Network Binding
|
|
308
|
-
By default, Lemma binds only to `127.0.0.1` (localhost).
|
|
236
|
+
By default, Lemma binds only to `127.0.0.1` (localhost). Not network-accessible unless explicitly configured:
|
|
309
237
|
```env
|
|
310
238
|
LEMMA_BIND_HOST=0.0.0.0
|
|
239
|
+
AUTH_ENABLED=true
|
|
240
|
+
AUTH_REQUIRE_API_KEY=true
|
|
241
|
+
AUTH_ALLOWED_ORIGINS=https://yourdomain.com
|
|
311
242
|
```
|
|
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
243
|
|
|
327
244
|
### MCP Command Allowlist
|
|
328
|
-
|
|
245
|
+
`run_workspace_command` only executes commands from an allowlist. Default safe prefixes: `npm`, `npx`, `git`, `tsc`, `node`, `jest`, `eslint`, `ls`, `grep`, and more.
|
|
329
246
|
|
|
330
|
-
|
|
247
|
+
Extend for your project in `lemma.config.json`:
|
|
331
248
|
```json
|
|
332
249
|
{
|
|
333
250
|
"mcp": {
|
|
@@ -336,24 +253,37 @@ To extend the allowlist for your project, add to `lemma.config.json`:
|
|
|
336
253
|
}
|
|
337
254
|
```
|
|
338
255
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
256
|
+
See [`.env.security.example`](.env.security.example) for all security-related environment variables.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## ๐ฆ SDK Integrations
|
|
261
|
+
|
|
262
|
+
### LangChain
|
|
263
|
+
```typescript
|
|
264
|
+
import { LemmaLangChainProvider } from '@nxuss/lemma/langchain';
|
|
265
|
+
|
|
266
|
+
const model = new LemmaLangChainProvider({
|
|
267
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
268
|
+
});
|
|
344
269
|
```
|
|
345
270
|
|
|
346
|
-
###
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
271
|
+
### CrewAI
|
|
272
|
+
```typescript
|
|
273
|
+
import { LemmaCrewAIProvider } from '@nxuss/lemma/crewai';
|
|
274
|
+
|
|
275
|
+
const crew = new LemmaCrewAIProvider({ agents: [...] });
|
|
350
276
|
```
|
|
351
|
-
Get this from **Stripe Dashboard โ Developers โ Webhooks โ Signing Secret**. Without it, the endpoint is disabled in `NODE_ENV=production`.
|
|
352
277
|
|
|
353
|
-
|
|
278
|
+
---
|
|
354
279
|
|
|
355
|
-
|
|
356
|
-
|
|
280
|
+
## ๐ Using as a Proxy
|
|
281
|
+
|
|
282
|
+
Point any OpenAI-compatible tool to Lemma's local proxy for transparent caching and privacy:
|
|
283
|
+
|
|
284
|
+
- **Cursor:** `Settings > Models > OpenAI API > Override Base URL` โ `http://localhost:8081/v1`
|
|
285
|
+
- **VS Code (Continue):** Set `apiBase` to `http://localhost:8081/v1`
|
|
286
|
+
- **Custom apps:** Replace `https://api.openai.com/v1` with `http://localhost:8081/v1`
|
|
357
287
|
|
|
358
288
|
---
|
|
359
289
|
|
|
@@ -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;AA0enE,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,CA2DN"}
|