@nxuss/lemma 1.8.0 โ 1.8.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 +81 -175
- package/dist/cjs/mcp/tools.js +13 -4
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/security/SemanticScrubber.d.ts +2 -0
- package/dist/cjs/security/SemanticScrubber.d.ts.map +1 -1
- package/dist/cjs/security/SemanticScrubber.js +53 -13
- package/dist/cjs/security/SemanticScrubber.js.map +1 -1
- package/dist/cjs/utils/PatchMatcher.d.ts +2 -0
- package/dist/cjs/utils/PatchMatcher.d.ts.map +1 -1
- package/dist/cjs/utils/PatchMatcher.js +9 -1
- package/dist/cjs/utils/PatchMatcher.js.map +1 -1
- package/dist/esm/mcp/tools.js +13 -4
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/security/SemanticScrubber.d.ts +2 -0
- package/dist/esm/security/SemanticScrubber.d.ts.map +1 -1
- package/dist/esm/security/SemanticScrubber.js +53 -13
- package/dist/esm/security/SemanticScrubber.js.map +1 -1
- package/dist/esm/utils/PatchMatcher.d.ts +2 -0
- package/dist/esm/utils/PatchMatcher.d.ts.map +1 -1
- package/dist/esm/utils/PatchMatcher.js +9 -1
- package/dist/esm/utils/PatchMatcher.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# ๐ง Lemma v1.8.
|
|
1
|
+
# ๐ง Lemma v1.8.1
|
|
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
|
__
|
|
@@ -27,6 +27,26 @@ are advertised to the model each turn. The rest stay one `lemma_toolbox` call aw
|
|
|
27
27
|
|
|
28
28
|
## ๐ Changelog
|
|
29
29
|
|
|
30
|
+
### v1.8.1 โ Two correctness fixes: secret scrubbing and patch data loss *(NEW)*
|
|
31
|
+
|
|
32
|
+
An audit of the tools with no test coverage turned up two bugs where the tool looked done but
|
|
33
|
+
silently produced wrong output.
|
|
34
|
+
|
|
35
|
+
- **`apply_workspace_patch` could corrupt a line.** The exact-match strategy computed
|
|
36
|
+
`startLine`/`endLine` from a raw substring `indexOf`, but the handler always spliced by whole
|
|
37
|
+
line. A search block that was a *fragment* of a line (not the entire line) collapsed
|
|
38
|
+
`startLine === endLine`, and the splice replaced the entire line with just the replacement โ
|
|
39
|
+
discarding everything else on it. Exact matches now splice by character offset;
|
|
40
|
+
whitespace-normalized/indent-anchored/fuzzy matches (already full-line windows) are unaffected.
|
|
41
|
+
- **The privacy scrubber only recognized 3 generic patterns.** Default patterns covered
|
|
42
|
+
`API_KEY`/`EMAIL`/`Bearer ...` shapes only โ vendor-specific secrets (Stripe, AWS, GitHub,
|
|
43
|
+
Google, Slack, JWTs, PEM private-key blocks) and custom-named secrets (e.g. a project's own
|
|
44
|
+
`_SALT` or `_WEBHOOK_SECRET` env var) passed through unmasked. Also, a project's custom
|
|
45
|
+
`lemma.config.json` patterns silently *replaced* the defaults instead of adding to them, so
|
|
46
|
+
defining one narrow pattern dropped coverage for everything else. Added vendor-specific
|
|
47
|
+
patterns plus a generic `ENV_SECRET` catch-all keyed on variable-name conventions, and custom
|
|
48
|
+
patterns now augment the defaults by default (`replaceDefaults: true` opts into full override).
|
|
49
|
+
|
|
30
50
|
### v1.8.0 โ The Brain learns from project history, not just what it's told *(NEW)*
|
|
31
51
|
|
|
32
52
|
Every memory in The Brain used to depend on the assistant remembering to call `store_memory`. If
|
|
@@ -411,12 +431,29 @@ chmod +x .git/hooks/post-commit
|
|
|
411
431
|
|
|
412
432
|
## ๐ Free vs Pro
|
|
413
433
|
|
|
414
|
-
|
|
434
|
+
Of the 95 registered tools, 46 work with no license and 49 require Pro. This split is enforced by
|
|
435
|
+
one allowlist in code (`FREE_TOOLS` in `src/mcp/tools.ts`), not by narrative โ if a tool isn't in
|
|
436
|
+
that list, it's Pro, regardless of what a description elsewhere implies.
|
|
437
|
+
|
|
438
|
+
### ๐ Free (46 Tools)
|
|
415
439
|
|
|
416
440
|
These tools work **without a Pro license**. Activate them with just `lemma init`:
|
|
417
441
|
|
|
418
442
|
| Tool | What It Does |
|
|
419
443
|
| :--- | :--- |
|
|
444
|
+
| `smarter_cache` | Semantic cache lookup before reasoning from scratch |
|
|
445
|
+
| `state_hash_cache` | Reasoning cache keyed to file content hashes โ exact invalidation |
|
|
446
|
+
| `token_receipt` | Auditable per-session ledger of how each answer was produced |
|
|
447
|
+
| `search_memory` | Semantic search across The Brain, all projects |
|
|
448
|
+
| `store_memory` | Persist verified solutions/fixes/decisions into The Brain |
|
|
449
|
+
| `get_project_history` | Git log + checkpoints + Brain memories in one call |
|
|
450
|
+
| `token_budget` | Session token/cost dashboard, including Lemma's own overhead |
|
|
451
|
+
| `squeeze_prompt` | Compress code blocks before they enter your own context |
|
|
452
|
+
| `turbosqueeze` | Extreme internal-context compression (never shown to the user) |
|
|
453
|
+
| `read_workspace_file` | Read a file with auto-compression and privacy scrubbing |
|
|
454
|
+
| `scrub_privacy` | Mask PII, API keys, and secrets from any text block |
|
|
455
|
+
| `summarize_long_text` | Summarize via local Ollama, falls back to truncation |
|
|
456
|
+
| `lemma_toolbox` | List, inspect, and call tools whose schemas were withheld |
|
|
420
457
|
| `file_fingerprint` | File hash cache โ avoid re-reads |
|
|
421
458
|
| `git_blame_heat` | Git blame + risk scoring |
|
|
422
459
|
| `type_coverage_report` | TypeScript type safety score |
|
|
@@ -426,7 +463,6 @@ These tools work **without a Pro license**. Activate them with just `lemma init`
|
|
|
426
463
|
| `auto_context_bundle` | Full context bundle per file |
|
|
427
464
|
| `repeat_guard` | Duplicate output detector |
|
|
428
465
|
| `conversation_checkpoint` | Session state save/load |
|
|
429
|
-
| `get_project_history` | Git log + checkpoints + Brain memories in one call |
|
|
430
466
|
| `test_autofix_interceptor` | Test failure โ Brain auto-fix |
|
|
431
467
|
| `prompt_pattern_cache` | Reusable prompt templates |
|
|
432
468
|
| `infra_discover` | Auto-detect Jenkins, OKD, Terraform |
|
|
@@ -452,25 +488,27 @@ These tools work **without a Pro license**. Activate them with just `lemma init`
|
|
|
452
488
|
| `terraform_state_list` | List Terraform state resources |
|
|
453
489
|
| `terraform_drift` | Detect Terraform drift |
|
|
454
490
|
|
|
455
|
-
### ๐ Pro (
|
|
491
|
+
### ๐ Pro (49 Tools)
|
|
456
492
|
|
|
457
493
|
All remaining tools require a Pro license. Activate with `lemma activate <key>` โ [Get Pro](https://lemma.nxus.studio/upgrade)
|
|
458
494
|
|
|
459
495
|
| Category | Tools |
|
|
460
496
|
| :--- | :--- |
|
|
461
|
-
| **AI Proxy** | OpenAI/Anthropic/Gemini proxy, exact-match cache,
|
|
462
|
-
| **
|
|
463
|
-
| **
|
|
464
|
-
| **
|
|
465
|
-
| **
|
|
466
|
-
| **
|
|
467
|
-
| **
|
|
468
|
-
| **
|
|
469
|
-
| **
|
|
470
|
-
| **
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
>
|
|
497
|
+
| **AI Proxy** | OpenAI/Anthropic/Gemini proxy, exact-match cache, complexity router |
|
|
498
|
+
| **The Brain (advanced)** | `get_telepathic_hints`, `query_hybrid_consensus`, `semantic_dedup_guard`, `local_semantic_autofix` โ basic search/store/smarter_cache are Free |
|
|
499
|
+
| **Zero-Token Static** | `entropy_score`, `coupling_radar`, `pattern_fossil`, `git_heatmap_risk`, `precrime_static`, `dead_export_necromancer` |
|
|
500
|
+
| **Architecture** | `depgraph`, `refactor`, `ast_flow_visualizer`, `imports_skeleton_resolver`, `cognitive_map`, `file_intent_index` |
|
|
501
|
+
| **Code Intelligence** | `get_ast_hologram`, `validate_patch_sandbox`, `surgical_ast_insert`, `get_symbol_surgical_context`, `smart_file_slice`, `diff_only` |
|
|
502
|
+
| **Workspace writes** | `write_workspace_file`, `create_workspace_file`, `apply_workspace_patch`, `multi_file_patch`, `search_workspace`, `list_workspace_dir`, `run_workspace_command`, `output_region` |
|
|
503
|
+
| **Optimization (advanced)** | `wormhole_squeeze`, `compress_context`, `prune_conversation_history` โ `turbosqueeze`, `squeeze_prompt`, `token_budget` are Free |
|
|
504
|
+
| **PR Review** | `review_diff`, `review_pr`, `pr_status`, `generate_pr_workflow` |
|
|
505
|
+
| **Session & Automation** | `test_oracle`, `schema_extract`, `changelog_auto`, `env_snapshot`, `migration_tracer`, `spec_to_stub`, `batch_tool_calls`, `get_routing_advice`, `get_project_onboarding`, `auto_heal`, `semantic_grep` |
|
|
506
|
+
| **Automation (background)** | AutoPilot, Auto-Heal, Silent Patch Watcher |
|
|
507
|
+
|
|
508
|
+
> **The MCP server itself is Pro.** All 49 Pro tools โ the advanced Brain layer, PreCrime, AST
|
|
509
|
+
> Hologram, `depgraph`, `refactor`, every workspace-write tool, and every PR review tool โ require a
|
|
510
|
+
> Pro license. The 46 Free tools above (including all 22 Infrastructure tools and `read_workspace_file`
|
|
511
|
+
> with its automatic privacy scrubbing) are accessible without activation.
|
|
474
512
|
|
|
475
513
|
---
|
|
476
514
|
|
|
@@ -687,6 +725,8 @@ lemma start
|
|
|
687
725
|
| `lemma apply <id>` | Apply a pending fix patch. |
|
|
688
726
|
| `lemma discard <id>` | Discard a pending fix patch. |
|
|
689
727
|
| `lemma activate <key>` | Activate Pro license for full MCP access. |
|
|
728
|
+
| `lemma-checkpoint [projectRoot]` | Standalone bin: derive a session checkpoint from repo state (branch, changed files, recent commits) without an assistant call. See [Session checkpoints](#-session-checkpoints). |
|
|
729
|
+
| `lemma-brain-ingest [projectRoot]` | Standalone bin: feed The Brain from git commits and `CHANGELOG.md`, incrementally. See [Feeding The Brain from project history](#-feeding-the-brain-from-project-history). |
|
|
690
730
|
|
|
691
731
|
### Customizing via `lemma.config.json`
|
|
692
732
|
|
|
@@ -726,157 +766,32 @@ Just run `lemma init`. Lemma automatically registers its MCP server in your `~/.
|
|
|
726
766
|
}
|
|
727
767
|
```
|
|
728
768
|
|
|
729
|
-
Once connected, your IDE gains access to **
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
### ๐ Free Tools (11)
|
|
736
|
-
|
|
737
|
-
> These tools work without a Pro license. All are zero-dependency and run locally.
|
|
738
|
-
|
|
739
|
-
| Tool | Category | Description |
|
|
740
|
-
| :--- | :--- | :--- |
|
|
741
|
-
| `file_fingerprint` | Smart Read | SHA256 hash cache. Returns 'unchanged' when hash matches, avoiding re-reads. |
|
|
742
|
-
| `git_blame_heat` | Analysis | Git blame + risk scoring per line. Identifies hotspots and high-risk authors. |
|
|
743
|
-
| `type_coverage_report` | Analysis | TypeScript type safety score via AST. Reports typed vs untyped, `any` count. |
|
|
744
|
-
| `import_tree_context` | Architecture | Bidirectional import graph with reverse dependencies. |
|
|
745
|
-
| `read_token_budgeted` | Smart Read | Read file with hard token limit. Returns only relevant sections. |
|
|
746
|
-
| `bulk_file_digest` | Smart Read | Read N files in one call. Returns compressed digest. |
|
|
747
|
-
| `auto_context_bundle` | Smart Read | One-call bundle: content + imports + types + Brain hints. |
|
|
748
|
-
| `repeat_guard` | Optimization | Detects duplicate outputs using Jaccard similarity. |
|
|
749
|
-
| `conversation_checkpoint` | Session | Save/load session state to prevent re-explaining context. |
|
|
750
|
-
| `test_autofix_interceptor` | Automation | Run tests + Brain search for matching fixes. |
|
|
751
|
-
| `prompt_pattern_cache` | Optimization | Find/store optimized prompt templates. |
|
|
752
|
-
|
|
753
|
-
### ๐๏ธ Workspace Tools
|
|
754
|
-
|
|
755
|
-
| Tool | Description |
|
|
756
|
-
| :--- | :--- |
|
|
757
|
-
| `read_workspace_file` | Read a file with automatic token compression and privacy scrubbing. |
|
|
758
|
-
| `write_workspace_file` | Write content to a file, creating parent directories as needed. |
|
|
759
|
-
| `create_workspace_file` | Create a new file (fails if exists). Returns minimal ACK. |
|
|
760
|
-
| `apply_workspace_patch` | Smart search-and-replace patch โ safe against duplicate matches. |
|
|
761
|
-
| `multi_file_patch` | Apply patches to multiple files in a single call. |
|
|
762
|
-
| `list_workspace_dir` | Recursively list the project structure up to a configurable depth. |
|
|
763
|
-
| `search_workspace` | Fast text search (grep) across all project files. |
|
|
764
|
-
| `semantic_grep` | Natural language concept search using BM25. |
|
|
765
|
-
| `run_workspace_command` | Execute bash commands in the workspace root. Secured by allowlist. Distills long jest/vitest/tsc/eslint output down to the failures and their locations; full output kept retrievable. |
|
|
766
|
-
| `output_region` | Retrieve any part of a stored command output verbatim (whole thing, one failing test, or a line range). |
|
|
767
|
-
| `file_intent_index` | Group files by domain intent (auth, routing, config). |
|
|
768
|
-
|
|
769
|
-
### ๐ฌ Code Intelligence Tools
|
|
770
|
-
|
|
771
|
-
| Tool | Description |
|
|
772
|
-
| :--- | :--- |
|
|
773
|
-
| `get_ast_hologram` | Holographic AST Map of all exported symbols. 90% token savings. |
|
|
774
|
-
| `validate_patch_sandbox` | Pre-flight validator: runs tsc + syntax check before applying. |
|
|
775
|
-
| `diff_only` | Compact line-by-line diff between known states. Session-scoped. |
|
|
776
|
-
| `surgical_ast_insert` | Insert code at AST anchor point. 95% output token savings. |
|
|
777
|
-
| `get_symbol_surgical_context` | Extract symbol + dependency signatures only. 90% savings. |
|
|
778
|
-
| `smart_file_slice` | Read only relevant lines around a query. 85% savings. |
|
|
779
|
-
| `schema_extract` | Extract interfaces/types/schemas via AST. 80% savings. |
|
|
780
|
-
| `spec_to_stub` | Generate mock stubs from TypeScript interfaces. |
|
|
781
|
-
| `ast_flow_visualizer` | Mermaid flowchart from function control flow. |
|
|
782
|
-
| `imports_skeleton_resolver` | Import signature mapper for quick reference. |
|
|
783
|
-
|
|
784
|
-
### ๐ง Brain & Memory Tools
|
|
785
|
-
|
|
786
|
-
| Tool | Description |
|
|
787
|
-
| :--- | :--- |
|
|
788
|
-
| `search_memory` | Semantic search across The Brain from all projects globally. |
|
|
789
|
-
| `store_memory` | Persist solutions, fixes, decisions into The Brain. |
|
|
790
|
-
| `query_hybrid_consensus` | Hybrid cache: 80% threshold โ instant answer, 0 cloud tokens. |
|
|
791
|
-
| `get_telepathic_hints` | Proactive hints from The Brain based on active file. |
|
|
792
|
-
| `smarter_cache` | Predictive cache at 75% threshold before any reasoning. |
|
|
793
|
-
| `semantic_dedup_guard` | Brain dedup firewall. Rejects โฅ92% similar entries. |
|
|
794
|
-
| `local_semantic_autofix` | Offline self-healing from Brain error index. |
|
|
795
|
-
|
|
796
|
-
### โ๏ธ Optimization & Privacy Tools
|
|
797
|
-
|
|
798
|
-
| Tool | Description |
|
|
799
|
-
| :--- | :--- |
|
|
800
|
-
| `scrub_privacy` | Mask PII, API keys, secrets from any text block. |
|
|
801
|
-
| `squeeze_prompt` | Compress code blocks. Up to 80% token reduction. |
|
|
802
|
-
| `turbosqueeze` | Extreme compression: strips comments, imports, whitespace. |
|
|
803
|
-
| `wormhole_squeeze` | Reversible unicode compression. 60-70% reduction. |
|
|
804
|
-
| `compress_context` | Summarize old conversation turns. Keeps last N intact. |
|
|
805
|
-
| `prune_conversation_history` | Intelligently decimate history preserving critical context. |
|
|
806
|
-
| `summarize_long_text` | Summarize via Ollama. Falls back to truncation. |
|
|
807
|
-
| `token_budget` | Dashboard: multiplier, savings, strategies, recommendations. |
|
|
808
|
-
| `get_routing_advice` | Optimal model recommendation from Complexity Router. |
|
|
809
|
-
| `get_project_onboarding` | One-shot architectural mental model. |
|
|
810
|
-
| `auto_heal` | Auto-diagnose and repair crashes from live context. |
|
|
811
|
-
| `batch_tool_calls` | Execute multiple tools in parallel via Promise.all. |
|
|
812
|
-
|
|
813
|
-
### ๐ฎ Zero-Token Static Intelligence Tools
|
|
814
|
-
|
|
815
|
-
> All tools in this section use **zero LLM tokens**. Pure local computation.
|
|
816
|
-
|
|
817
|
-
| Tool | Description |
|
|
818
|
-
| :--- | :--- |
|
|
819
|
-
| `entropy_score` | Mathematical chaos score (0-100) per file. |
|
|
820
|
-
| `coupling_radar` | Dependency graph: circular imports, god modules, dead islands. |
|
|
821
|
-
| `pattern_fossil` | Zombie code detector: var vs const, callbacks vs async/await. |
|
|
822
|
-
| `git_heatmap_risk` | Git churn analysis + co-edit pairs. |
|
|
823
|
-
| `precrime_static` | Composite risk predictor combining entropy + coupling + git. |
|
|
824
|
-
| `dead_export_necromancer` | Dead code auditor: exported but never imported. |
|
|
825
|
-
| `git_blame_heat` | Git blame + per-line risk scoring. |
|
|
826
|
-
| `type_coverage_report` | TypeScript type safety score. |
|
|
827
|
-
| `import_tree_context` | Bidirectional import graph. |
|
|
828
|
-
|
|
829
|
-
### ๐๏ธ Architecture & Refactoring Tools
|
|
830
|
-
|
|
831
|
-
| Tool | Description |
|
|
832
|
-
| :--- | :--- |
|
|
833
|
-
| `depgraph` | Real-time dependency graph with depth, format, circular detection. |
|
|
834
|
-
| `refactor` | Declarative codemod: rename symbols or move files. |
|
|
835
|
-
| `cognitive_map` | Auto-updating knowledge graph of domains and patterns. |
|
|
836
|
-
|
|
837
|
-
### ๐ PR Review Agent Tools
|
|
838
|
-
|
|
839
|
-
| Tool | Description |
|
|
840
|
-
| :--- | :--- |
|
|
841
|
-
| `review_diff` | Analyze raw diff for bugs, security, best practices. |
|
|
842
|
-
| `review_pr` | Full PR review against GitHub, Azure DevOps, GitLab. |
|
|
843
|
-
| `pr_status` | Query last review status for a PR. |
|
|
844
|
-
| `generate_pr_workflow` | Generate CI/CD workflow YAML for PR reviews. |
|
|
845
|
-
|
|
846
|
-
### ๐งช Testing & Quality Tools
|
|
847
|
-
|
|
848
|
-
| Tool | Description |
|
|
849
|
-
| :--- | :--- |
|
|
850
|
-
| `test_oracle` | Run tests, return only failures with compressed traces. |
|
|
851
|
-
| `test_autofix_interceptor` | Run tests + Brain search for matching fixes. |
|
|
852
|
-
| `changelog_auto` | Conventional commit changelog from git history. |
|
|
853
|
-
| `env_snapshot` | Node/npm versions, deps, .env keys (values hidden). |
|
|
854
|
-
| `migration_tracer` | Prisma migration schema diff analysis. |
|
|
855
|
-
|
|
856
|
-
### ๐ Session & Automation Tools
|
|
857
|
-
|
|
858
|
-
| Tool | Description |
|
|
859
|
-
| :--- | :--- |
|
|
860
|
-
| `conversation_checkpoint` | Save/load session state to `.lemma/session/`. |
|
|
861
|
-
| `prompt_pattern_cache` | Find/store optimized prompt templates. |
|
|
862
|
-
| `review_pr` | Full PR review with auto-approve option. |
|
|
769
|
+
Once connected, your IDE gains access to all **95 MCP tools** (46 Free + 49 Pro โ see
|
|
770
|
+
[Free vs Pro](#-free-vs-pro) for the full, current split) and Lemma auto-injects the TurboMode
|
|
771
|
+
system prompt on handshake. By default only the tools your project shows evidence of needing are
|
|
772
|
+
*advertised* each turn โ see [Tool profiles](#-tool-profiles) โ but every tool is registered and
|
|
773
|
+
reachable via `lemma_toolbox` regardless of profile.
|
|
863
774
|
|
|
864
775
|
### โก TurboMode Auto-Injection
|
|
865
776
|
|
|
866
|
-
When connected via `lemma mcp`, Lemma auto-injects
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
777
|
+
When connected via `lemma mcp`, Lemma auto-injects its system prompt on handshake. The real,
|
|
778
|
+
current prompt (`LEMMA_TURBOMODE_PROMPT` in `src/mcp/prompts.ts`) states the goal โ reduce what
|
|
779
|
+
enters context without ever costing a correct answer โ and enforces it with rules including:
|
|
780
|
+
|
|
781
|
+
- A tool call costs tokens too: expect a call to save more than its own round-trip, or skip it.
|
|
782
|
+
- `lemma_toolbox` reaches every tool whose schema was withheld from this session โ check it
|
|
783
|
+
before saying a capability is missing.
|
|
784
|
+
- Compression (`turbosqueeze`, `wormhole_squeeze`, `squeeze_prompt`) is for the model's own
|
|
785
|
+
context only; the user always gets the real, uncompressed file.
|
|
786
|
+
- `smarter_cache` hits must be disclosed as cached, never presented as freshly reasoned, and
|
|
787
|
+
re-verified before acting on them.
|
|
788
|
+
- `state_hash_cache` (exact file-hash invalidation) is preferred over `smarter_cache` (semantic
|
|
789
|
+
similarity) whenever the answer depends on specific files.
|
|
790
|
+
- `store_memory` only after a solution is actually verified โ an unverified fix stored here
|
|
791
|
+
becomes a false cache hit later.
|
|
792
|
+
- `get_routing_advice` before assuming a mechanical task needs the biggest available model.
|
|
793
|
+
- `surgical_ast_insert` by default for adding to an existing file, instead of rewriting it whole.
|
|
794
|
+
- `token_receipt` for "how much did we save," never an invented estimate.
|
|
880
795
|
|
|
881
796
|
---
|
|
882
797
|
|
|
@@ -921,15 +836,6 @@ See [`.env.security.example`](.env.security.example) for all security-related en
|
|
|
921
836
|
|
|
922
837
|
## ๐ฆ SDK Integrations
|
|
923
838
|
|
|
924
|
-
### LangChain
|
|
925
|
-
```typescript
|
|
926
|
-
import { LemmaLangChainProvider } from '@nxuss/lemma/langchain';
|
|
927
|
-
|
|
928
|
-
const model = new LemmaLangChainProvider({
|
|
929
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
930
|
-
});
|
|
931
|
-
```
|
|
932
|
-
|
|
933
839
|
### CrewAI
|
|
934
840
|
```typescript
|
|
935
841
|
import { LemmaCrewAIProvider } from '@nxuss/lemma/crewai';
|
package/dist/cjs/mcp/tools.js
CHANGED
|
@@ -1624,10 +1624,19 @@ async function handleApplyWorkspacePatch(args) {
|
|
|
1624
1624
|
};
|
|
1625
1625
|
}
|
|
1626
1626
|
const match = matchResult[0];
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1627
|
+
let updatedContent;
|
|
1628
|
+
if (match.strategy === "exact" && match.charStart !== undefined && match.charEnd !== undefined) {
|
|
1629
|
+
// Splice by character offset โ the search block may be a mid-line fragment, and
|
|
1630
|
+
// a whole-line splice would discard everything else sharing that line.
|
|
1631
|
+
updatedContent = originalContent.slice(0, match.charStart) + replaceContent + originalContent.slice(match.charEnd);
|
|
1632
|
+
}
|
|
1633
|
+
else {
|
|
1634
|
+
const contentLines = originalContent.split("\n");
|
|
1635
|
+
const finalReplace = (0, PatchMatcher_1.reindentReplacement)(replaceContent, searchContent, contentLines[match.startLine]);
|
|
1636
|
+
const updatedLines = [...contentLines.slice(0, match.startLine), ...finalReplace.split("\n"), ...contentLines.slice(match.endLine + 1)];
|
|
1637
|
+
updatedContent = updatedLines.join("\n");
|
|
1638
|
+
}
|
|
1639
|
+
fs_1.default.writeFileSync(resolved, updatedContent, "utf8");
|
|
1631
1640
|
const note = match.strategy === "exact" ? "" : ` (matched via ${match.strategy}, score ${match.score.toFixed(2)})`;
|
|
1632
1641
|
return { content: [{ type: "text", text: `Success: Patch successfully applied to ${filePath}${note}` }] };
|
|
1633
1642
|
}
|