Summary
_save_to_workspace() in bot.py saves user-uploaded files to workspace/files/ (the inner Claude working directory). Meanwhile, _apply_directories() in install.py creates an empty /var/lib/kai/files/ that nothing uses.
This is the same category of issue PR #144 fixed for history and MEMORY.md: runtime data living inside the install tree instead of DATA_DIR.
Current state
- Where files are saved:
pool.get_workspace(chat_id) / "files/" (resolves to /opt/kai/workspace/files/ in production)
- Where
_apply_directories creates a directory: DATA_DIR / "files" (resolves to /var/lib/kai/files/)
- Result:
/var/lib/kai/files/ exists but is always empty. Uploaded files live in the install tree.
Why it matters
Proposed fix
Follow the PR #144 pattern:
- Move file storage from
workspace/files/ to DATA_DIR / "files" (which already exists)
- Update
_save_to_workspace() to save to DATA_DIR / "files" instead of workspace / "files"
- Inject the absolute files path into context so the inner Claude knows where to find them
- Add a migration in
_apply_migrate for any existing files at the old location
- Add
"files" to .gitignore for the dev layout (if not already covered)
Priority
Low. The merge-based _copy_tree prevents data loss. This is a cleanup for architectural consistency with the history/memory fix.
Summary
_save_to_workspace()inbot.pysaves user-uploaded files toworkspace/files/(the inner Claude working directory). Meanwhile,_apply_directories()ininstall.pycreates an empty/var/lib/kai/files/that nothing uses.This is the same category of issue PR #144 fixed for history and MEMORY.md: runtime data living inside the install tree instead of
DATA_DIR.Current state
pool.get_workspace(chat_id) / "files/"(resolves to/opt/kai/workspace/files/in production)_apply_directoriescreates a directory:DATA_DIR / "files"(resolves to/var/lib/kai/files/)/var/lib/kai/files/exists but is always empty. Uploaded files live in the install tree.Why it matters
_copy_tree(PR Move runtime data (history, memory) out of install tree #144) protects these files from deletion on install, but they are still inside the install tree where they do not belong_apply_directoriescreates an unused directory, which is misleadingProposed fix
Follow the PR #144 pattern:
workspace/files/toDATA_DIR / "files"(which already exists)_save_to_workspace()to save toDATA_DIR / "files"instead ofworkspace / "files"_apply_migratefor any existing files at the old location"files"to.gitignorefor the dev layout (if not already covered)Priority
Low. The merge-based
_copy_treeprevents data loss. This is a cleanup for architectural consistency with the history/memory fix.