"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(memory): honor VIBE_TRADING_HOME for persistent memory and search index
Rudy Celekliec00f32b57ee
diff --git a/agent/src/memory/persistent.py b/agent/src/memory/persistent.pyindex 9b6c30da0..37f5a5250 100644--- a/agent/src/memory/persistent.py+++ b/agent/src/memory/persistent.py@@ -15,10 +15,11 @@ from pathlib import Pathfrom typing import Generator, List, Optionalfrom src.agent.frontmatter import parse_frontmatter as _parse_frontmatter+from src.config.paths import get_runtime_rootlogger = logging.getLogger(__name__)-MEMORY_BASE = Path.home() / ".vibe-trading" / "memory"+MEMORY_BASE = get_runtime_root() / "memory"MAX_INDEX_LINES = 200MAX_ENTRY_CHARS = 8000MAX_RESULTS = 5diff --git a/agent/src/memory/search_index.py b/agent/src/memory/search_index.pyindex f85a783b2..b9516ffbd 100644--- a/agent/src/memory/search_index.py+++ b/agent/src/memory/search_index.py@@ -18,9 +18,11 @@ from dataclasses import dataclassfrom pathlib import Pathfrom typing import List, Optional+from src.config.paths import get_runtime_root+logger = logging.getLogger(__name__)-_DEFAULT_DB_PATH = Path.home() / ".vibe-trading" / "memory_index.db"+_DEFAULT_DB_PATH = get_runtime_root() / "memory_index.db"# Body text truncation limit (chars)_MAX_BODY_LEN = 50_000diff --git a/agent/tests/test_memory_runtime_root.py b/agent/tests/test_memory_runtime_root.pynew file mode 100644index 000000000..764321660--- /dev/null+++ b/agent/tests/test_memory_runtime_root.py@@ -0,0 +1,25 @@+"""Memory state must follow VIBE_TRADING_HOME like every other runtime path."""++from __future__ import annotations++import subprocess+import sys+from pathlib import Path++AGENT_DIR = Path(__file__).resolve().parents[1]+++def test_memory_defaults_honor_vibe_trading_home(tmp_path):+ home = tmp_path / "vt-home"+ code = (+ "from src.memory.persistent import MEMORY_BASE;"+ "from src.memory.search_index import _DEFAULT_DB_PATH;"+ "print(MEMORY_BASE);print(_DEFAULT_DB_PATH)"+ )+ env = {"PATH": "", "VIBE_TRADING_HOME": str(home), "HOME": str(tmp_path / "h")}+ out = subprocess.run(+ [sys.executable, "-c", code], cwd=AGENT_DIR, env=env,+ capture_output=True, text=True, check=True,+ ).stdout.split("\n")+ assert Path(out[0]) == home / "memory"+ assert Path(out[1]) == home / "memory_index.db"