All jobs

Persist User Settings in a Tauri App

Yes. An agent adds the Tauri store plugin to your app, saves your Pinia settings to a JSON file in the app data directory, restores them on launch, and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads what state exists and where it would go. In an app built from Uninen/tauri-vue-template, src/store.ts is a Pinia store named main with debug, version, isInitialized and name, and src/components/GreetComponent.vue writes store.name after calling the Rust greet command through invoke from @tauri-apps/api/core; every launch starts with an empty name. src-tauri/src/lib.rs builds the app with tauri_plugin_shell::init() and tauri_plugin_prevent_default::init() and a single greet handler, src-tauri/Cargo.toml depends on tauri 2 and serde_json, and src-tauri/tauri.conf.json sets the identifier com.tauri-app.my, one window named by default main, and a CSP whose connect-src allows ipc:. There is no src-tauri/capabilities/ directory, and src-tauri/.gitignore hides the generated gen/ schemas.

It also reads the tooling that will judge the change. package.json pins @tauri-apps/api and @tauri-apps/cli at ^2.10.1, pnpm-workspace.yaml sets minimumReleaseAge: 1440, so pnpm refuses a package version published less than a day ago, vite.config.ts auto-imports useStore from @/store and the Pinia and Vue APIs, vitest.config.ts runs tests/unit/**/*.test.ts with tests/setup/install-pinia.ts, and .github/workflows/test.yml runs pnpm test on Node 24 while release.yml lists the libwebkit2gtk-4.1-dev, libappindicator3-dev, librsvg2-dev and patchelf packages a Linux build needs.

The change is three files plus the store. In src-tauri, cargo add tauri-plugin-store and .plugin(tauri_plugin_store::Builder::new().build()) in lib.rs; a new src-tauri/capabilities/default.json for the main window with core:default and store:default, since plugin commands are blocked until a capability allows them; and pnpm add @tauri-apps/plugin-store on the frontend, at a version old enough for minimumReleaseAge. A src/plugins/persist.ts Pinia plugin loads settings.json with load from @tauri-apps/plugin-store, which places the file in the app's data directory under the identifier, restores name into the store before the first render, and subscribes to the store with $subscribe to write the keys it owns; autoSave is left at its default debounce so a burst of keystrokes is one write. main.ts registers the plugin on the Pinia instance, and store.ts gains a settingsLoaded flag so App.vue can wait for it.

In its sandbox the agent installs the Linux packages release.yml names, runs pnpm install, pnpm check for cargo check, pnpm build for vue-tsc and Vite, and pnpm test with a new unit test that mocks @tauri-apps/plugin-store and checks the plugin restores and writes. It then builds a debug binary with pnpm tauri build --debug, starts it under xvfb-run, drives the window with the sandbox's accessibility tools to type a name and greet, quits, prints settings.json from the data directory, relaunches and screenshots the restored name.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Persist user settings in this Tauri app. Read package.json, pnpm-workspace.yaml, vite.config.ts, vitest.config.ts, src/main.ts, src/store.ts, src/App.vue, src/components/GreetComponent.vue, src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/tauri.conf.json, src-tauri/.gitignore and .github/workflows/release.yml first. Add tauri-plugin-store to the Rust side and @tauri-apps/plugin-store to the frontend, register the plugin in lib.rs, and create src-tauri/capabilities/default.json for the main window with the core and store default permissions. Write a Pinia plugin that loads settings.json from the plugin's store, restores the name field before first render and writes the keys it owns on change, keeping the plugin's default autosave debounce, and register it in main.ts. Add a unit test that mocks the store module. Install the Linux packages the release workflow lists, run cargo check, the frontend build and the tests, build a debug binary, run it under a virtual display, enter a name, quit, show the written settings.json, relaunch and screenshot the restored name. Open a pull request that pastes the file and the screenshots. Do not change the greet command or the window configuration.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

The pull request changes src-tauri/Cargo.toml, src-tauri/Cargo.lock, src-tauri/src/lib.rs, package.json, pnpm-lock.yaml, src/main.ts and src/store.ts, and adds src-tauri/capabilities/default.json, src/plugins/persist.ts and a test under tests/unit/. Its description pastes settings.json as the plugin wrote it, two screenshots of the window before quitting and after relaunch, and the output of cargo check, pnpm build and pnpm test.

A paragraph explains why a capabilities file appears in a repository that had none: Tauri 2 blocks plugin commands until a capability grants them, so store:default is what lets the WebView call load, get, set and save, and core:default keeps the window's existing calls working. The path the store writes to is named for each platform under the com.tauri-app.my identifier.

Before merging, a reviewer decides which store fields are settings and which are session state, whether settings.json should carry a schema version for future migrations, and whether the capability file should list shell:allow-open for the shell plugin the app already registers.

Run it on every Tauri app that forgets its state between launches

A team with several Tauri apps sends this body once per repository from its own server, each a POST /o/{org}/sessions with that repository in resources and a request_id that is a UUID v5 of the repository's full name, so a retried call returns the run it already started. Each run reads its own frontend: an app on Svelte or plain TypeScript instead of Pinia gets the same store plugin with a module-level subscription in place of the Pinia plugin, and an app that already has capabilities/default.json gets one line added to it.

A webhook_url on the key reports each run.completed with the pull request in result, and a run.failed names an app whose cargo check broke, for instance one still on Tauri 1, where the store plugin's v1 branch and a different registration apply and the agent says so instead of guessing.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

Persistence across launches can only be proved by launching twice, and a desktop app needs a display, the WebKit libraries and a Rust toolchain to do that. The agent's sandbox installs the packages the repository's own release workflow lists, builds the debug binary and drives it under a virtual display, so the pull request shows the file on disk and the restored window rather than a description of both.

The permission file, the plugin version that clears minimumReleaseAge, the auto-imported useStore and the window name all come from reading this repository, and a mistake in any of them is a silent empty store. The build output, the JSON and the screenshots stay with the run, and several apps can get the change at once.

Frequently asked questions

Where is settings.json written?

In the app's data directory under the identifier from tauri.conf.json, com.tauri-app.my, which the store plugin resolves per platform. The description names the path for macOS, Linux and Windows and pastes the file's content from the sandbox run.

Why does the pull request add a capabilities file?

The repository has none, and Tauri 2 blocks a plugin's commands until a capability for the window grants them. src-tauri/capabilities/default.json names the main window with core:default and store:default; the agent confirms the existing greet command still answers after the file is added.

Will pnpm refuse the new package?

pnpm-workspace.yaml sets minimumReleaseAge to 1440 minutes, so a version of @tauri-apps/plugin-store published less than a day before the run is skipped and the newest older one is chosen. The description shows the resolved version and its publish date.

How do the unit tests run without a Tauri window?

The new test mocks @tauri-apps/plugin-store with an in-memory map, installs Pinia with the persistence plugin the way tests/setup/install-pinia.ts does, and checks that a stored name is restored and that a change is written. Vitest runs it in pnpm test, the same command .github/workflows/test.yml runs.

More Tauri jobs

The same job on other stacks

More jobs like this: Hand off a long task

Keep reading