ocerebro 0.4.21 → 0.4.23
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/cerebro/cerebro_setup.py +18 -15
- package/package.json +2 -2
- package/pyproject.toml +1 -1
- package/src/mcp/server.py +25 -18
package/cerebro/cerebro_setup.py
CHANGED
|
@@ -444,17 +444,13 @@ def setup_claude(auto: bool = True) -> bool:
|
|
|
444
444
|
python_cmd = find_python_with_ocerebro()
|
|
445
445
|
print(f"[1/5] Python detectado: {python_cmd}")
|
|
446
446
|
|
|
447
|
-
# Encontra caminho do OCerebro
|
|
448
|
-
ocerebro_path = get_ocerebro_path()
|
|
449
|
-
|
|
450
447
|
# Gera configuração MCP
|
|
451
448
|
mcp_config = {
|
|
449
|
+
"transport": "stdio",
|
|
452
450
|
"command": python_cmd,
|
|
453
|
-
"args": ["-m", "
|
|
454
|
-
"cwd": str(ocerebro_path),
|
|
455
|
-
"env": {}
|
|
451
|
+
"args": ["-m", "ocerebro.mcp.server"]
|
|
456
452
|
}
|
|
457
|
-
print(f"[2/5]
|
|
453
|
+
print(f"[2/5] MCP command: {python_cmd} -m ocerebro.mcp.server")
|
|
458
454
|
|
|
459
455
|
configured = []
|
|
460
456
|
errors = []
|
|
@@ -499,13 +495,20 @@ def setup_claude(auto: bool = True) -> bool:
|
|
|
499
495
|
except json.JSONDecodeError:
|
|
500
496
|
print(f" Aviso: Config existente inválida, criando nova")
|
|
501
497
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
498
|
+
# MCP config para Claude Code usa mcp.servers
|
|
499
|
+
if target_type == "code":
|
|
500
|
+
if "mcp" not in existing_config:
|
|
501
|
+
existing_config["mcp"] = {}
|
|
502
|
+
if "servers" not in existing_config["mcp"]:
|
|
503
|
+
existing_config["mcp"]["servers"] = {}
|
|
504
|
+
existing_config["mcp"]["enabled"] = True
|
|
505
|
+
existing_config["mcp"]["servers"]["ocerebro"] = mcp_config
|
|
506
|
+
|
|
507
|
+
# MCP config para Claude Desktop usa mcpServers
|
|
508
|
+
elif target_type == "desktop":
|
|
509
|
+
if "mcpServers" not in existing_config:
|
|
510
|
+
existing_config["mcpServers"] = {}
|
|
511
|
+
existing_config["mcpServers"]["ocerebro"] = mcp_config
|
|
509
512
|
|
|
510
513
|
# Adiciona hook para dream automatico ao final da sessao
|
|
511
514
|
if "hooks" not in existing_config:
|
|
@@ -518,7 +521,7 @@ def setup_claude(auto: bool = True) -> bool:
|
|
|
518
521
|
"hooks": [
|
|
519
522
|
{
|
|
520
523
|
"type": "command",
|
|
521
|
-
"command":
|
|
524
|
+
"command": "ocerebro dream --since 1 --apply --silent"
|
|
522
525
|
}
|
|
523
526
|
]
|
|
524
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ocerebro",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.23",
|
|
4
4
|
"description": "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)",
|
|
5
5
|
"main": "bin/ocerebro.js",
|
|
6
6
|
"bin": {
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"ocerebro": "^0.4.
|
|
50
|
+
"ocerebro": "^0.4.23"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/pyproject.toml
CHANGED
package/src/mcp/server.py
CHANGED
|
@@ -556,9 +556,12 @@ class CerebroMCP:
|
|
|
556
556
|
"""Gera memória ativa e escreve no diretório nativo do Claude Code para auto-load."""
|
|
557
557
|
project = args.get("project") or self._detect_project()
|
|
558
558
|
|
|
559
|
-
#
|
|
560
|
-
|
|
561
|
-
has_memories =
|
|
559
|
+
# Auto-sync: se official/<project>/ vazio, sincroniza
|
|
560
|
+
project_official = self.cerebro_path / "official" / project
|
|
561
|
+
has_memories = (
|
|
562
|
+
project_official.exists()
|
|
563
|
+
and any(project_official.rglob("*.md"))
|
|
564
|
+
)
|
|
562
565
|
if not has_memories:
|
|
563
566
|
self._sync({"project": project})
|
|
564
567
|
|
|
@@ -661,42 +664,46 @@ class CerebroMCP:
|
|
|
661
664
|
session_id = self.session_manager.get_session_id()
|
|
662
665
|
|
|
663
666
|
lines = [
|
|
664
|
-
"
|
|
665
|
-
"
|
|
666
|
-
"
|
|
667
|
+
"=" * 60,
|
|
668
|
+
"OCEREBRO STATUS",
|
|
669
|
+
"=" * 60,
|
|
667
670
|
"",
|
|
668
671
|
f"Session ID: {session_id}",
|
|
669
672
|
f"Path: {self.cerebro_path.absolute()}",
|
|
670
673
|
"",
|
|
671
674
|
]
|
|
672
675
|
|
|
673
|
-
# Contagem de memórias por tipo (
|
|
676
|
+
# Contagem de memórias por tipo (metadata DB)
|
|
674
677
|
try:
|
|
675
678
|
import sqlite3
|
|
676
|
-
conn = sqlite3.connect(
|
|
679
|
+
conn = sqlite3.connect(
|
|
680
|
+
str(self.cerebro_path / "index" / "metadata.db")
|
|
681
|
+
)
|
|
677
682
|
cursor = conn.cursor()
|
|
678
|
-
cursor.execute(
|
|
683
|
+
cursor.execute(
|
|
684
|
+
"SELECT type, COUNT(*) FROM memories "
|
|
685
|
+
"GROUP BY type ORDER BY COUNT(*) DESC"
|
|
686
|
+
)
|
|
679
687
|
type_counts = cursor.fetchall()
|
|
680
688
|
conn.close()
|
|
681
689
|
|
|
682
690
|
if type_counts:
|
|
683
691
|
total = sum(c for _, c in type_counts)
|
|
684
|
-
lines.append(f"
|
|
692
|
+
lines.append(f"Memorias: {total} total")
|
|
685
693
|
lines.append("")
|
|
686
694
|
lines.append("Por tipo:")
|
|
687
|
-
for
|
|
688
|
-
|
|
689
|
-
lines.append(f" {icon} {entity_type}: {count}")
|
|
695
|
+
for mem_type, count in type_counts:
|
|
696
|
+
lines.append(f" - {mem_type}: {count}")
|
|
690
697
|
else:
|
|
691
|
-
lines.append("
|
|
698
|
+
lines.append("Memorias: 0")
|
|
692
699
|
except Exception:
|
|
693
|
-
lines.append("
|
|
700
|
+
lines.append("Memorias: (banco nao acessivel)")
|
|
694
701
|
|
|
695
702
|
lines.append("")
|
|
696
703
|
lines.append("Storages:")
|
|
697
|
-
lines.append(f"
|
|
698
|
-
lines.append(f"
|
|
699
|
-
lines.append(f"
|
|
704
|
+
lines.append(f" Raw: {self.cerebro_path / 'raw'}")
|
|
705
|
+
lines.append(f" Working: {self.cerebro_path / 'working'}")
|
|
706
|
+
lines.append(f" Official: {self.cerebro_path / 'official'}")
|
|
700
707
|
|
|
701
708
|
return "\n".join(lines)
|
|
702
709
|
|