diff --git a/agents/runner.py b/agents/runner.py index 0db3819..471b683 100644 --- a/agents/runner.py +++ b/agents/runner.py @@ -45,6 +45,12 @@ def _build_claude_env() -> dict: Also resolves ~/.nvm/versions/node/*/bin globs that launchctl may not expand. """ env = os.environ.copy() + + # Propagate canonical DB path to agent subprocesses so they don't fall back + # to module-relative path (which breaks in worktrees — KIN-129). + if "KIN_DB_PATH" not in env: + env["KIN_DB_PATH"] = str(Path.home() / ".kin" / "kin.db") + existing = env.get("PATH", "").split(":") extra = list(_EXTRA_PATH_DIRS) diff --git a/core/db.py b/core/db.py index 7b27293..5d8e47b 100644 --- a/core/db.py +++ b/core/db.py @@ -3,10 +3,11 @@ Kin — SQLite database schema and connection management. All tables from DESIGN.md section 3.5 State Management. """ +import os import sqlite3 from pathlib import Path -DB_PATH = Path(__file__).parent.parent / "kin.db" +DB_PATH = Path(os.environ.get("KIN_DB_PATH") or (Path.home() / ".kin" / "kin.db")) SCHEMA = """ -- Проекты (центральный реестр)