Externalize desktop user data directory - #717
Open
yiqi-017 wants to merge 5 commits into
Open
Conversation
Introduce paths.py as the single source of truth splitting APP_DIR (read-only code/bundle) from DATA_DIR (user-writable data). Packaged builds default DATA_DIR to ~/Documents/GenericAgent so reports/outputs are reachable and customizable; source checkouts (.git present) keep data in-place so the dev workflow is unchanged, and GA_DATA_DIR overrides. temp/ and memory/ relocate together because the agent reaches memory via ../memory relative to its temp cwd. memory is seeded from the bundled defaults on first run (never overwriting user edits); the memory Python package still imports from APP_DIR so helper .py keep tracking upgrades. Route ga.py, agentmain.py, desktop_bridge.py, project_mode, workspace_cmd and runtime helpers (reflect/*, ga_ultraplan, compress_session, ui_detect, autonomous helper, cost_tracker, plan_state) through paths. In-process agent core + spawned services are aligned on one root via GA_DATA_DIR.
~/Documents is unreliable on Windows: with OneDrive active the literal ~/Documents path is a ghost placeholder while the real folder is redirected under OneDrive, so os.mkdir raises WinError 2/3 (caused the "Setup Required" crash). Hidden AppData dirs are reliable but not discoverable, defeating the goal of letting users copy their reports out. The home root itself is never Known-Folder redirected and is visible, so use ~/GenericAgent_Data: writable on any machine (no username/locale hardcoding) and easy to find.
P1 builds on the writable DATA_DIR split from P0 so packaged users can customize the app without touching the sealed bundle. Layer a user system prompt override from DATA_DIR, move mykey generation/loading/editing to the writable data side, create a data-side plugins drop-in directory, and add a settings entry to open the data folder directly. This makes prompt tuning, credential edits, memory tweaks, and custom plugins survive app upgrades while keeping bundled defaults intact.
Make the desktop data-dir migration treat the selected folder as the parent, copy the full data tree into a new GenericAgent_Data folder, and remove the old directory after the bridge switch succeeds.
Add the data-directory Tauri commands to the default capability so packaged desktop builds can invoke the move, set, clear, and read operations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
paths.py, routing temp outputs, memory documents, sessions, mykey, prompt overrides, and user plugin drop-ins throughDATA_DIR.GA_ROOT.GenericAgent_Datafolder under the selected parent, switch the bridge, and remove the old source directory after a successful switch.Test plan
cargo checkinfrontends/desktop/src-tauri.python -m py_compile paths.py agentmain.py ga.py llmcore.py frontends/desktop_bridge.py plugins/hooks.py.Made with Cursor