@nxuss/lemma 1.7.1 β 1.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 +69 -8
- package/bin/brain-ingest.js +56 -0
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +247 -48
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/pr-review/bridge/BrainBridge.d.ts +11 -1
- package/dist/cjs/pr-review/bridge/BrainBridge.d.ts.map +1 -1
- package/dist/cjs/pr-review/bridge/BrainBridge.js +18 -23
- package/dist/cjs/pr-review/bridge/BrainBridge.js.map +1 -1
- package/dist/cjs/protocol/utils.d.ts.map +1 -1
- package/dist/cjs/protocol/utils.js +6 -5
- package/dist/cjs/protocol/utils.js.map +1 -1
- package/dist/cjs/proxy/ComplexityRouter.d.ts +7 -0
- package/dist/cjs/proxy/ComplexityRouter.d.ts.map +1 -1
- package/dist/cjs/proxy/ComplexityRouter.js +18 -5
- package/dist/cjs/proxy/ComplexityRouter.js.map +1 -1
- package/dist/cjs/subconscious/GitIngest.d.ts +48 -0
- package/dist/cjs/subconscious/GitIngest.d.ts.map +1 -0
- package/dist/cjs/subconscious/GitIngest.js +175 -0
- package/dist/cjs/subconscious/GitIngest.js.map +1 -0
- package/dist/cjs/subconscious/TheBrainV2.d.ts +23 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +124 -17
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/utils/ConversationCheckpoint.d.ts +2 -0
- package/dist/cjs/utils/ConversationCheckpoint.d.ts.map +1 -1
- package/dist/cjs/utils/ConversationCheckpoint.js +38 -0
- package/dist/cjs/utils/ConversationCheckpoint.js.map +1 -1
- package/dist/cjs/utils/TokenReceipt.d.ts +6 -0
- package/dist/cjs/utils/TokenReceipt.d.ts.map +1 -1
- package/dist/cjs/utils/TokenReceipt.js +9 -0
- package/dist/cjs/utils/TokenReceipt.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +250 -51
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/pr-review/bridge/BrainBridge.d.ts +11 -1
- package/dist/esm/pr-review/bridge/BrainBridge.d.ts.map +1 -1
- package/dist/esm/pr-review/bridge/BrainBridge.js +18 -20
- package/dist/esm/pr-review/bridge/BrainBridge.js.map +1 -1
- package/dist/esm/protocol/utils.d.ts.map +1 -1
- package/dist/esm/protocol/utils.js +6 -5
- package/dist/esm/protocol/utils.js.map +1 -1
- package/dist/esm/proxy/ComplexityRouter.d.ts +7 -0
- package/dist/esm/proxy/ComplexityRouter.d.ts.map +1 -1
- package/dist/esm/proxy/ComplexityRouter.js +18 -5
- package/dist/esm/proxy/ComplexityRouter.js.map +1 -1
- package/dist/esm/subconscious/GitIngest.d.ts +48 -0
- package/dist/esm/subconscious/GitIngest.d.ts.map +1 -0
- package/dist/esm/subconscious/GitIngest.js +166 -0
- package/dist/esm/subconscious/GitIngest.js.map +1 -0
- package/dist/esm/subconscious/TheBrainV2.d.ts +23 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +124 -17
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/utils/ConversationCheckpoint.d.ts +2 -0
- package/dist/esm/utils/ConversationCheckpoint.d.ts.map +1 -1
- package/dist/esm/utils/ConversationCheckpoint.js +37 -0
- package/dist/esm/utils/ConversationCheckpoint.js.map +1 -1
- package/dist/esm/utils/TokenReceipt.d.ts +6 -0
- package/dist/esm/utils/TokenReceipt.d.ts.map +1 -1
- package/dist/esm/utils/TokenReceipt.js +8 -0
- package/dist/esm/utils/TokenReceipt.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# π§ Lemma v1.
|
|
1
|
+
# π§ Lemma v1.8.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
9
|
|
|
10
10
|
```text
|
|
11
11
|
__
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
> **The Intelligent local-first AI Gateway β Privacy, Performance, Static Code Intelligence, and Infrastructure Command Center for the Agentic Era.**
|
|
19
19
|
|
|
20
|
-
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**, **22 Infrastructure Management Tools**, and a suite of **
|
|
20
|
+
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**, **22 Infrastructure Management Tools**, and a suite of **95 MCP tools** β including zero-token static code intelligence that runs entirely on your machine with no LLM calls required.
|
|
21
21
|
|
|
22
|
-
Since v1.7.0 those
|
|
22
|
+
Since v1.7.0 those 95 tools are all registered, but only the ones your project can actually use
|
|
23
23
|
are advertised to the model each turn. The rest stay one `lemma_toolbox` call away. See
|
|
24
24
|
[Tool profiles](#-tool-profiles).
|
|
25
25
|
|
|
@@ -27,7 +27,41 @@ are advertised to the model each turn. The rest stay one `lemma_toolbox` call aw
|
|
|
27
27
|
|
|
28
28
|
## π Changelog
|
|
29
29
|
|
|
30
|
-
### v1.
|
|
30
|
+
### v1.8.0 β The Brain learns from project history, not just what it's told *(NEW)*
|
|
31
|
+
|
|
32
|
+
Every memory in The Brain used to depend on the assistant remembering to call `store_memory`. If
|
|
33
|
+
nobody called it, the Brain knew nothing about work that already happened.
|
|
34
|
+
|
|
35
|
+
| Change | What it does | Why it matters |
|
|
36
|
+
| :--- | :--- | :--- |
|
|
37
|
+
| **`lemma-brain-ingest`** *(new CLI)* | Feeds The Brain from git commits and `CHANGELOG.md` β no assistant call needed. Incremental via a marker file, safe to wire to `post-commit`. | The Brain stops depending on the model remembering to save anything. |
|
|
38
|
+
| **Checkpoints now feed The Brain** | `saveCheckpoint()` indexes any checkpoint with real content into the same Brain `search_memory` reads. | Decisions and bugs recorded in a checkpoint used to be invisible to search. |
|
|
39
|
+
| **`get_project_history`** *(new tool)* | Merges recent commits, checkpoints, and Brain memories for the current project into one call. | Answers "what have we done here" without three separate lookups. |
|
|
40
|
+
| **Outcome tagging** | `store_memory` accepts `outcome: 'failed'`; search surfaces it as a warning, not a suggestion. | A dead end is now as memorable as a fix. |
|
|
41
|
+
| **Symbol-level freshness** | `store_memory` accepts `symbols: [{filePath, symbolName}]` β freshness is judged by that function's own source, not the whole file. | An unrelated edit elsewhere in the file no longer stales the memory out. |
|
|
42
|
+
|
|
43
|
+
**PR review memory was silently going nowhere.** `BrainBridge` talked to the proxy's
|
|
44
|
+
`/api/search`/`/api/memory/store`, both backed by ChromaDB + a local Ollama server on `:11434` β
|
|
45
|
+
the exact stack TheBrainV2 replaced in 1.0.0. Whenever Ollama wasn't running (the common case
|
|
46
|
+
now), every call failed inside a `try/catch` and returned empty. It now reads/writes `TheBrainV2`
|
|
47
|
+
directly, so PR review and interactive coding share one memory instead of two disconnected ones.
|
|
48
|
+
|
|
49
|
+
**Two projects could quietly share β or split β memories.** `deriveProjectId` hashed the
|
|
50
|
+
project path without resolving symlinks; on macOS `process.cwd()` and an `os.tmpdir()`-built path
|
|
51
|
+
can report different strings for the same directory, hashing to two different project scopes. It
|
|
52
|
+
now resolves via `fs.realpathSync` first.
|
|
53
|
+
|
|
54
|
+
**Spanish text was mangled before it reached the index.** `tokenize()` used `\w` to strip
|
|
55
|
+
punctuation, which doesn't match accented letters β "CΓ³mo" became "mo", "diseΓ±o" became "dise",
|
|
56
|
+
and the same word typed without its accent tokenized completely differently. `tokenize()` now
|
|
57
|
+
normalizes diacritics first, and gained an additive English/Spanish stemmer and Spanish stopwords.
|
|
58
|
+
|
|
59
|
+
**`token_budget` reported a multiplier no ledger backed.** It fetched a proxy route that doesn't
|
|
60
|
+
exist, silently fell back to an uncosted estimate, and reported a bigger number than the
|
|
61
|
+
session's own auditable ledger would support. It now reads the real `SavingsLedger` net position
|
|
62
|
+
(`/api/savings-breakdown`) or says plainly there's nothing to report if the proxy isn't running.
|
|
63
|
+
|
|
64
|
+
### v1.7.0 β The cost of being connected
|
|
31
65
|
|
|
32
66
|
Every tool schema Lemma advertises goes into the model's system prompt and is **re-sent on every
|
|
33
67
|
request of the session** β including schemas for tools the project can never use. On this repo that
|
|
@@ -288,7 +322,7 @@ Or use environment variables: `JENKINS_URL`, `JENKINS_USERNAME`, `JENKINS_API_TO
|
|
|
288
322
|
## ποΈ Tool profiles
|
|
289
323
|
|
|
290
324
|
Every tool schema an MCP server advertises is injected into the model's system prompt and re-sent
|
|
291
|
-
on **every request** of the session. Advertising all
|
|
325
|
+
on **every request** of the session. Advertising all 95 tools costs ~11,600 tokens per turn β much
|
|
292
326
|
of it schemas for tools a given project can never use.
|
|
293
327
|
|
|
294
328
|
Lemma advertises a scoped surface instead. Nothing is removed: every tool stays registered and
|
|
@@ -349,9 +383,35 @@ the richer record when one exists.
|
|
|
349
383
|
|
|
350
384
|
---
|
|
351
385
|
|
|
386
|
+
## π§ Feeding The Brain from project history
|
|
387
|
+
|
|
388
|
+
`store_memory` also depends on the assistant remembering to call it. `lemma-brain-ingest` pulls
|
|
389
|
+
memories from sources that already exist and don't need an assistant in the loop:
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
lemma-brain-ingest [projectRoot] [--max N] [--changelog] [--no-commits]
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
- Every git commit (message + files touched) becomes one Brain entry, so `search_memory` and
|
|
396
|
+
`get_telepathic_hints` can recall *why* a change happened, not just what the code looks like now.
|
|
397
|
+
- `--changelog` also ingests `CHANGELOG.md` (falls back to `docs/CHANGELOG.md`) β one entry per release, parsed
|
|
398
|
+
directly, no LLM involved.
|
|
399
|
+
|
|
400
|
+
A marker file under `<project>/.lemma/session/` tracks the last commit and changelog version
|
|
401
|
+
ingested, so this is safe to run after every commit and safe to run by hand for a one-time
|
|
402
|
+
backfill of existing history β both take the same incremental path and never double-store.
|
|
403
|
+
Wire it to a post-commit hook to keep it current automatically:
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
echo 'lemma-brain-ingest "$(git rev-parse --show-toplevel)" &' >> .git/hooks/post-commit
|
|
407
|
+
chmod +x .git/hooks/post-commit
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
352
412
|
## π Free vs Pro
|
|
353
413
|
|
|
354
|
-
### π Free (
|
|
414
|
+
### π Free (34 Tools)
|
|
355
415
|
|
|
356
416
|
These tools work **without a Pro license**. Activate them with just `lemma init`:
|
|
357
417
|
|
|
@@ -366,6 +426,7 @@ These tools work **without a Pro license**. Activate them with just `lemma init`
|
|
|
366
426
|
| `auto_context_bundle` | Full context bundle per file |
|
|
367
427
|
| `repeat_guard` | Duplicate output detector |
|
|
368
428
|
| `conversation_checkpoint` | Session state save/load |
|
|
429
|
+
| `get_project_history` | Git log + checkpoints + Brain memories in one call |
|
|
369
430
|
| `test_autofix_interceptor` | Test failure β Brain auto-fix |
|
|
370
431
|
| `prompt_pattern_cache` | Reusable prompt templates |
|
|
371
432
|
| `infra_discover` | Auto-detect Jenkins, OKD, Terraform |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Feeds The Brain from sources the model never has to remember to store manually.
|
|
6
|
+
*
|
|
7
|
+
* Meant to be wired to a git post-commit hook so every commit becomes a searchable memory
|
|
8
|
+
* without depending on the assistant calling `store_memory`:
|
|
9
|
+
*
|
|
10
|
+
* echo 'lemma-brain-ingest "$(git rev-parse --show-toplevel)" &' >> .git/hooks/post-commit
|
|
11
|
+
*
|
|
12
|
+
* With no flags it's an incremental catch-up: a marker file under .lemma/session/ tracks the
|
|
13
|
+
* last commit ingested, so running this after every commit or by hand both take the same path
|
|
14
|
+
* and never double-store. `--max N` only matters the first time there is no marker yet.
|
|
15
|
+
*
|
|
16
|
+
* Usage: lemma-brain-ingest [projectRoot] [--max N] [--changelog] [--no-commits]
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
function main() {
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const maxIndex = args.indexOf('--max');
|
|
24
|
+
const maxCommits = maxIndex >= 0 ? parseInt(args[maxIndex + 1], 10) : undefined;
|
|
25
|
+
const includeChangelog = args.includes('--changelog');
|
|
26
|
+
const includeCommits = !args.includes('--no-commits');
|
|
27
|
+
const positional = args.filter((a, i) => !a.startsWith('--') && i !== maxIndex + 1);
|
|
28
|
+
const projectRoot = path.resolve(positional[0] || process.cwd());
|
|
29
|
+
|
|
30
|
+
const distPath = path.join(__dirname, '..', 'dist', 'cjs', 'subconscious', 'GitIngest.js');
|
|
31
|
+
let ingestRecentCommits, ingestChangelog;
|
|
32
|
+
try {
|
|
33
|
+
({ ingestRecentCommits, ingestChangelog } = require(distPath));
|
|
34
|
+
} catch {
|
|
35
|
+
console.error('[lemma-brain-ingest] Build not found. Run "npm run build" first.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (includeCommits) {
|
|
40
|
+
const res = ingestRecentCommits(projectRoot, { maxCommits });
|
|
41
|
+
console.error(`[lemma-brain-ingest] commits: ${res.ingested} stored, ${res.skipped} skipped (up to ${res.lastSha ? res.lastSha.substring(0, 12) : 'none'})`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (includeChangelog) {
|
|
45
|
+
const res = ingestChangelog(projectRoot);
|
|
46
|
+
console.error(`[lemma-brain-ingest] changelog: ${res.ingested} stored, ${res.skipped} skipped (${res.versionsSeen} version(s) seen)`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
main();
|
|
52
|
+
} catch (err) {
|
|
53
|
+
// A hook that fails must never be the reason a commit or session goes bad.
|
|
54
|
+
console.error('[lemma-brain-ingest] Skipped:', err && err.message);
|
|
55
|
+
}
|
|
56
|
+
process.exit(0);
|
|
@@ -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;AAwjCnE,oFAAoF;AACpF,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,IAAI,MAAM,EAAE,CAEjD;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAQA;AAqHD,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;AAqCD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAC1C,IAAI,CAwEN"}
|