@nxuss/lemma 1.18.2 → 1.19.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/bin/init.js +104 -0
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -547,6 +547,106 @@ function configureKiro() {
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
// OpenCode: register MCP server in opencode.json
|
|
550
|
+
const MUSE_SKILL_CONTENT = `---
|
|
551
|
+
name: lemma
|
|
552
|
+
description: Lemma — cache semántico, firewall de privacidad y memoria cross-sesión para Muse.
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
# Lemma para Muse
|
|
556
|
+
|
|
557
|
+
Eres Muse Code (muse-spark). Tienes disponible **Lemma MCP** — gateway de caché semántica, firewall de privacidad y memoria persistente. Este skill te enseña a usarlo sin MCP nativo (Muse no habla MCP aún): todo es vía CLI + proxy local.
|
|
558
|
+
|
|
559
|
+
## Qué es Lemma
|
|
560
|
+
|
|
561
|
+
- **Proxy local** en \`http://localhost:8081\` — cachea respuestas LLM (BM25 + embeddings), ahorra tokens/dinero.
|
|
562
|
+
- **Brain persistente** en \`~/.lemma-cache/lemma_brain.json\` + memoria por proyecto.
|
|
563
|
+
- **MCP server** con 70+ tools — las mismas que usan Claude Code / Cursor / Codex, pero aquí las llamas vía \`npx @nxuss/lemma\` o \`node mcp-server.js\` por \`bash\`.
|
|
564
|
+
|
|
565
|
+
## Cuándo usar Lemma (Muse)
|
|
566
|
+
|
|
567
|
+
| Tarea | Qué hacer con Lemma |
|
|
568
|
+
|---|---|
|
|
569
|
+
| Pregunta que puede estar ya resuelta | \`search_memory\` antes de razonar |
|
|
570
|
+
| Pregunta atada a archivos concretos (mismo prompt + mismos archivos) | \`state_hash_cache\` con \`action=lookup\` antes, \`store\` después |
|
|
571
|
+
| Conocimiento que debe sobrevivir sesiones | \`search_memory\` / \`store_memory\` (con \`derivedFrom\`) |
|
|
572
|
+
| Leer/listar/buscar workspace | Usa tus tools nativos (\`read_file\`, \`bash ls/grep\`) — Lemma añade scrubbing si lo llamas, pero no es obligatorio |
|
|
573
|
+
| Tarea mecánica → decidir modelo barato | \`get_routing_advice\` |
|
|
574
|
+
| Aplicar patch | \`validate_patch_sandbox\` primero |
|
|
575
|
+
| "¿Cuánto ahorramos?" | \`token_receipt\` |
|
|
576
|
+
|
|
577
|
+
Si Lemma no encaja, usa tu tool nativo. No fuerces Lemma donde no aporta.
|
|
578
|
+
|
|
579
|
+
## Cómo llamar a Lemma desde Muse
|
|
580
|
+
|
|
581
|
+
Muse no tiene \`mcp__lemma__*\` tools nativas. Llama al servidor MCP por **stdio** vía bash:
|
|
582
|
+
|
|
583
|
+
\`\`\`bash
|
|
584
|
+
# 1. Lookup en memoria antes de razonar
|
|
585
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_memory","arguments":{"query":"tu pregunta"}}}' | node ./mcp-server.js
|
|
586
|
+
|
|
587
|
+
# 2. Tool genérico - busca en workspace (con scrubbing)
|
|
588
|
+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_workspace","arguments":{"query":"texto"}}}' | node ./mcp-server.js
|
|
589
|
+
|
|
590
|
+
# 3. Guarda solución verificada
|
|
591
|
+
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"store_memory","arguments":{"content":"solución verificada","tags":["bugfix"]}}}' | node ./mcp-server.js
|
|
592
|
+
\`\`\`
|
|
593
|
+
|
|
594
|
+
O usa el wrapper más simple si está instalado:
|
|
595
|
+
|
|
596
|
+
\`\`\`bash
|
|
597
|
+
npx -y @nxuss/lemma mcp # servidor MCP stdio
|
|
598
|
+
lemma search "query" # CLI directa si instalaste lemma global
|
|
599
|
+
\`\`\`
|
|
600
|
+
|
|
601
|
+
Para el proxy de cache (tráfico LLM real), asegúrate que el daemon corre:
|
|
602
|
+
|
|
603
|
+
\`\`\`bash
|
|
604
|
+
node ./lemma-proxy.cjs status
|
|
605
|
+
node ./lemma-proxy.cjs start
|
|
606
|
+
\`\`\`
|
|
607
|
+
|
|
608
|
+
## Flujo obligatorio al iniciar sesión
|
|
609
|
+
|
|
610
|
+
1. Llama \`search_memory\` con el tema de la tarea.
|
|
611
|
+
2. Si hay hit, verifícalo contra el código actual antes de presentarlo.
|
|
612
|
+
3. Al terminar con solución verificada (tests pasaron), llama \`store_memory\`.
|
|
613
|
+
|
|
614
|
+
## Flujo para bugs
|
|
615
|
+
|
|
616
|
+
1. \`get_telepathic_hints\` si necesitas contexto de runtime.
|
|
617
|
+
2. \`search_memory\` con el mensaje de error.
|
|
618
|
+
|
|
619
|
+
## Regla dura
|
|
620
|
+
|
|
621
|
+
Si tu respuesta viene de un cache hit, dilo explícitamente: "esto viene de memoria cacheada". Nunca presentes un hit como razonamiento fresco. Y nunca guardes una solución no verificada.
|
|
622
|
+
|
|
623
|
+
## Instalación / verificación
|
|
624
|
+
|
|
625
|
+
\`\`\`bash
|
|
626
|
+
# Re-configura todo (incluye Muse skill)
|
|
627
|
+
node ./bin/init.js
|
|
628
|
+
|
|
629
|
+
# Verifica que el proxy está arriba
|
|
630
|
+
curl -s http://localhost:8081/health || echo "proxy down"
|
|
631
|
+
|
|
632
|
+
# Verifica MCP responde
|
|
633
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node ./mcp-server.js | head -c 500
|
|
634
|
+
\`\`\`
|
|
635
|
+
|
|
636
|
+
> Generado por \`lemma init\` — @nxuss/lemma para Muse.
|
|
637
|
+
`;
|
|
638
|
+
|
|
639
|
+
function configureMuse() {
|
|
640
|
+
const cwd = process.cwd();
|
|
641
|
+
const skillDir = path.join(cwd, '.agents', 'skills', 'lemma');
|
|
642
|
+
try {
|
|
643
|
+
ensureDir(skillDir);
|
|
644
|
+
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
645
|
+
fs.writeFileSync(skillPath, MUSE_SKILL_CONTENT, 'utf8');
|
|
646
|
+
return true;
|
|
647
|
+
} catch { return false; }
|
|
648
|
+
}
|
|
649
|
+
|
|
550
650
|
function configureOpenCode() {
|
|
551
651
|
const cwd = process.cwd();
|
|
552
652
|
const opencodePath = path.join(cwd, 'opencode.json');
|
|
@@ -771,6 +871,10 @@ async function main() {
|
|
|
771
871
|
configureOpenCode();
|
|
772
872
|
ok('OpenCode configured (opencode.json MCP + instructions)');
|
|
773
873
|
|
|
874
|
+
const museOk = configureMuse();
|
|
875
|
+
if (museOk) ok('Muse configured (.agents/skills/lemma/SKILL.md)');
|
|
876
|
+
else warn('Muse skill could not be configured');
|
|
877
|
+
|
|
774
878
|
const hasContinue = detectTool('Continue.dev', () => configureContinueDotDev());
|
|
775
879
|
if (hasContinue) ok('Continue.dev configured');
|
|
776
880
|
else skip('Continue.dev not detected');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxuss/lemma",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Intelligent AI Gateway for IDEs & Agents — Semantic cache, Privacy Firewall, Infrastructure Command Center, and Autonomous Cost-Optimization.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|