Skip to content

Externalize desktop user data directory - #717

Open
yiqi-017 wants to merge 5 commits into
lsdefine:mainfrom
dd3xp:desktop-data-dir-external
Open

Externalize desktop user data directory#717
yiqi-017 wants to merge 5 commits into
lsdefine:mainfrom
dd3xp:desktop-data-dir-external

Conversation

@yiqi-017

Copy link
Copy Markdown
Contributor

Summary

  • Split packaged desktop runtime assets from user-writable data via paths.py, routing temp outputs, memory documents, sessions, mykey, prompt overrides, and user plugin drop-ins through DATA_DIR.
  • Add desktop settings controls to view, choose, move, and clear the active data directory while preserving external source selection through GA_ROOT.
  • Make data directory migration copy the current GenericAgent_Data folder under the selected parent, switch the bridge, and remove the old source directory after a successful switch.

Test plan

  • Ran cargo check in frontends/desktop/src-tauri.
  • Ran python -m py_compile paths.py agentmain.py ga.py llmcore.py frontends/desktop_bridge.py plugins/hooks.py.
  • Built and verified the Windows portable package from the data-directory permission fix before preparing this clean PR branch.

Made with Cursor

yiqi-017 added 5 commits July 31, 2026 19:56
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant