BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.
Python ai-agentsai-memoryknowledge-graphknowledge-managementknowledge-representationreccomendation-system
Initialize Neo4j before loading the dump so the graph is registered.
Christian68ef25435c1a
diff --git a/deploy/backup_restore.py b/deploy/backup_restore.pyindex d1cc2f4..00266e3 100755--- a/deploy/backup_restore.py+++ b/deploy/backup_restore.py@@ -243,6 +243,24 @@ def _restore_postgres_brain_databases()+def _chown_neo4j_data(stack: Stack) -> None:+ stack.docker(+ [+ "run",+ "--rm",+ "--user",+ "0",+ "-v",+ f"{stack.volume_name('neo4j-data')}:/data",+ ARCHIVER_IMAGE,+ "chown",+ "-R",+ "7474:7474",+ "/data",+ ]+ )++def _neo4j_admin(stack: Stack, volume: str, args: list[str]) -> None:result = stack.run([@@ -476,6 +494,8 @@ def restore(stack: Stack, backup_dir: Path) -> None:stack, backup_dir / "postgres-brains.tar.gz", pg_user)else:+ stack.run(["up", "-d", "--wait", "neo4j"])+ stack.run(["stop", "neo4j"])with tempfile.TemporaryDirectory(prefix="brainapi-neo4j-restore-") as tmp:tmp_path = Path(tmp)if not stack.dry_run:@@ -492,6 +512,7 @@ def restore(stack: Stack, backup_dir: Path) -> None:"--overwrite-destination=true",],)+ _chown_neo4j_data(stack)stack.run(["up", "-d", "--wait", "mongo"])mongo_user = stack.env.get("MONGO_USERNAME", "brainapi")if stack.dry_run:diff --git a/tests/test_deploy_production_contract.py b/tests/test_deploy_production_contract.pyindex f6fc437..5d2c294 100644--- a/tests/test_deploy_production_contract.py+++ b/tests/test_deploy_production_contract.py@@ -137,6 +137,8 @@ def test_heavy_neo4j_dump_runs_as_root_with_admin_entrypoint():assert '"neo4j-admin"' in sourceassert source.count('("neo4j",)') == 2assert '("system", "neo4j")' not in source+ assert '["up", "-d", "--wait", "neo4j"]' in source+ assert '["stop", "neo4j"]' in sourcedef test_recommendation_openapi_surface_is_preview():