Proposal: Consolidate All Data Paths Under storage_root
Problem
Currently, different data files are scattered across different locations, making containerized deployment complex:
| Component |
Current Default |
Location |
| SQLite DB |
~/.xagent/xagent.db |
✅ Under storage_root |
| LanceDB |
${pwd}/data/lancedb |
❌ Separate path |
| Web uploads |
src/xagent/web/uploads |
❌ In source tree |
| Web static |
src/xagent/web/static |
❌ In source tree |
This inconsistency creates problems:
- Multiple bind-mounts needed for containers
- Data mixed with source code (uploads, static)
- Unpredictable paths depending on working directory
- Complex backup/migration - data scattered everywhere
Current Examples
SQLite (Good):
storage_root = get_storage_root() # ~/.xagent
return storage_root / "xagent.db" # ~/.xagent/xagent.db ✅
LanceDB (Bad - cwd-relative):
# Returns "data/lancedb" - relative to cwd! ❌
return Path("data/lancedb")
Web uploads (Bad - in source tree):
web_dir = get_web_dir() # src/xagent/web by default
return web_dir / "uploads" # default: src/xagent/web/uploads ❌
Proposed Solution
Move all data paths under storage_root (default: ~/.xagent):
| Component |
New Default |
Environment Variable |
| SQLite DB |
~/.xagent/xagent.db |
DATABASE_URL (unchanged) |
| LanceDB |
~/.xagent/lancedb |
LANCEDB_PATH (unchanged) |
| Web uploads |
~/.xagent/uploads |
XAGENT_UPLOADS_DIR (unchanged) |
| Web static |
~/.xagent/static |
XAGENT_WEB_STATIC_DIR (unchanged) |
Benefits:
- ✅ Single bind-mount for containers:
XAGENT_STORAGE_ROOT=/data
- ✅ Data separated from code - clean architecture
- ✅ Consistent - all data in one place
- ✅ Predictable - no cwd-relative paths
Related Issues
Proposal: Consolidate All Data Paths Under
storage_rootProblem
Currently, different data files are scattered across different locations, making containerized deployment complex:
~/.xagent/xagent.db${pwd}/data/lancedbsrc/xagent/web/uploadssrc/xagent/web/staticThis inconsistency creates problems:
Current Examples
SQLite (Good):
LanceDB (Bad - cwd-relative):
Web uploads (Bad - in source tree):
Proposed Solution
Move all data paths under
storage_root(default:~/.xagent):~/.xagent/xagent.dbDATABASE_URL(unchanged)~/.xagent/lancedbLANCEDB_PATH(unchanged)~/.xagent/uploadsXAGENT_UPLOADS_DIR(unchanged)~/.xagent/staticXAGENT_WEB_STATIC_DIR(unchanged)Benefits:
XAGENT_STORAGE_ROOT=/dataRelated Issues