# Add Launch at Login to a Tauri App

Yes. An agent adds the Tauri autostart plugin, the capability it needs, a settings toggle in your frontend and a test, then opens a PR that type-checks and builds.

[Run this on Rush](https://cloud.getrush.ai/run/add-autostart/tauri/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads both halves of the app before it adds a plugin. In an app like Uninen/tauri-vue-template, `src-tauri/Cargo.toml` depends on `tauri` 2, `tauri-plugin-shell` 2, `tauri-plugin-prevent-default` 5.0, `serde` and `serde_json`, builds a library named `tauri_app_lib`, and strips and size-optimizes release builds. `src-tauri/src/lib.rs` registers the shell and prevent-default plugins on `tauri::Builder::default()`, opens the devtools of the `main` window in debug builds, and exposes one command, `greet`. `src-tauri/tauri.conf.json` names the product `tauri-app` with identifier `com.tauri-app.my`, one 800 by 600 window, a content security policy, and `bundle.targets: all`. There is no `src-tauri/capabilities` directory, and `src-tauri/.gitignore` excludes the generated `gen/` folder, so the app currently grants no plugin permissions to its window. On the frontend, `package.json` uses pnpm with `@tauri-apps/api` ^2.10.1, `@tauri-apps/plugin-shell` ^2.3.5, Vue 3 and Pinia; `vite.config.ts` auto-imports `vue`, `pinia` and `useStore`; `src/store.ts` keeps `debug`, `version` and `name`; and `src/components/GreetComponent.vue` is the one place the frontend calls `invoke`.

It also reads how the app is checked and shipped. `tests/unit/example.test.ts` is a Vitest placeholder, `tests/setup/testglobals.ts` installs a testing Pinia with real actions, and `vitest.config.ts` merges the Vite config and sets coverage thresholds. `.github/workflows/test.yml` runs `pnpm test` on pull requests; `test-build.yml` installs `libwebkit2gtk-4.1-dev`, `libappindicator3-dev`, `librsvg2-dev` and `patchelf` on `ubuntu-24.04` and runs `pnpm tauri build`; `release.yml` builds on macOS for `aarch64-apple-darwin`, Ubuntu and Windows through `tauri-apps/tauri-action` on a `v*` tag. `.github/renovate.json` groups Cargo and npm bumps, and `bump-version.cjs` keeps `package.json`, `tauri.conf.json` and `Cargo.toml` on the same version. `package.json` already has a `check` script that runs `cargo check --manifest-path src-tauri/Cargo.toml`.

The change touches each layer once. `Cargo.toml` gains `tauri-plugin-autostart = "2"` and `lib.rs` registers it with the macOS `LaunchAgent` launcher and an argument list, `--minimized` by default, so the app can tell a login launch from a click. `src-tauri/capabilities/default.json` is created for the `main` window with `core:default`, `autostart:allow-enable`, `autostart:allow-disable` and `autostart:allow-is-enabled`, which is the step most hand-written attempts miss and the reason the call fails with a permission error at runtime. `@tauri-apps/plugin-autostart` is added to `package.json`, and a `LaunchAtLogin.vue` component with a checkbox calls `isEnabled()` on mount and `enable()` or `disable()` on change, keeping the state in the Pinia store beside `name`. `App.vue` mounts it under the greeting. Under the hood the plugin writes a LaunchAgent plist on macOS, a `.desktop` file under `~/.config/autostart` on Linux and a `Run` registry value on Windows; the pull request says so and notes that the Linux entry depends on the installed binary path.

The proof is the build. The agent runs `pnpm install`, `pnpm check` for the Rust side, `pnpm build` for `vue-tsc` and Vite, and `pnpm test` with a new Vitest case that mocks `@tauri-apps/plugin-autostart` and asserts the component calls `enable` when checked and `disable` when unchecked. When the WebKitGTK packages from `test-build.yml` install in the sandbox, it runs `pnpm tauri build` too and reports the bundle it produced; otherwise the description says the full build is left to the existing workflow. It does not sign or notarize anything.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add launch-at-login to this Tauri 2 app. Read src-tauri/Cargo.toml, src-tauri/src/lib.rs, tauri.conf.json, any capabilities directory, package.json, the store and components, the tests and the CI workflows first. Add the tauri-plugin-autostart crate and register it with the macOS launch agent launcher and a --minimized argument, add the npm plugin package, create the capability file granting the autostart enable, disable and is-enabled permissions to the main window, and add a settings component with a checkbox that reads and sets the state through the plugin, with the state kept in the existing store. Add a unit test that mocks the plugin package. Run cargo check, the frontend type check and build, and the tests; run the full tauri build if the Linux build dependencies install. Do not sign or notarize anything. Open a pull request.",
  "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

What comes back is a pull request that adds one crate to `Cargo.toml` with its `Cargo.lock` entries, one `.plugin(...)` line in `lib.rs`, a new `src-tauri/capabilities/default.json`, one npm dependency with its `pnpm-lock.yaml` change, a `LaunchAtLogin.vue` component, a store field, a line in `App.vue` and a Vitest file. `tauri.conf.json` is unchanged: the capability file is picked up by its location.

The description quotes the `cargo check`, `vue-tsc`, Vite and Vitest output, names the bundle produced if the full build ran, and lists what the plugin writes on each platform. The commands and their output are in the transcript at `GET /o/{org}/sessions/{id}/messages`.

Before merging, a reviewer decides whether the toggle should default on for new installs, whether `--minimized` should actually hide the window on launch (the pull request wires the argument but leaves the window behaviour to a follow-up), and tests the toggle on a real macOS and Windows build from the `release.yml` draft. A follow-up message to the same session can make the app start hidden when that argument is present.

## Run it on every desktop app you ship

A team with several Tauri apps starts one run per repository with one `POST /o/{org}/sessions` each, the repository in `resources` and this prompt as `input`. Each run reads its own window labels and existing capability files, so an app with a `settings` window gets the permission on that window, and each opens its own pull request.

Send a `request_id`, a UUID v5 of the repository's full name, so a retried call returns the run it already started. The key's `webhook_url` reports when each run the key starts finishes, with the run's final answer in `result`.

## Why run it on Rush?

Adding a Tauri plugin is four edits in four languages, and the one that is not code, the capability file, is the one that fails silently at runtime. The agent reads the Rust side, the config, the frontend and the CI, makes all four edits consistently, and proves the Rust and TypeScript halves compile and the component's behaviour is tested, in a sandbox of its own with the output kept.

The pull request carries the build output and the per-platform notes, so the review is a read of one component and one JSON file plus a manual check on a real machine. Several apps can be done at once, each in its own sandbox, each with its own pull request.

## Frequently asked questions

### Why does the app need a capabilities file?

In Tauri 2, plugin commands are denied unless a capability grants them to a window. The call from the frontend then fails with a permission error, which is the most common reason an autostart toggle does nothing. The agent creates `src-tauri/capabilities/default.json` for the `main` window with the three autostart permissions and `core:default`.

### What does the plugin actually write on each platform?

A LaunchAgent plist under the user's `Library/LaunchAgents` on macOS, a `.desktop` file in `~/.config/autostart` on Linux, and a value under the current user's `Run` registry key on Windows. The pull request lists these so support staff know where to look when a user asks why the app starts at login.

### Can the app tell it was started at login?

Yes, through the argument list given when the plugin is registered. The agent passes `--minimized`, and the app can read its arguments at startup to start hidden or in the tray. Wiring that window behaviour is left to a follow-up so this pull request stays about the toggle.

### Does this need code signing?

No. Launch at login works on unsigned development builds on all three platforms. Signing matters for distribution, which this repository's release workflow already handles separately, and the agent leaves it untouched.

## More Tauri jobs

- [Add Crash Reporting to a Tauri App](https://getrush.ai/run/add-crash-reporting/tauri/)
- [Add Dark Mode to a Tauri App](https://getrush.ai/run/add-dark-mode/tauri/)
- [Add Deep Link Handling to a Tauri App](https://getrush.ai/run/add-deep-links/tauri/)

## More jobs like this: Hand off a long task

- [Add Background Jobs with Oban to a Phoenix App](https://getrush.ai/run/add-background-jobs/phoenix/)
- [Add Bandit Security Checks to a Python Project's CI](https://getrush.ai/run/add-bandit-to-ci/python/)
- [Add Blog Categories to a Wagtail Site](https://getrush.ai/run/add-blog-categories/wagtail/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
