Skip to content
Back to skills

Bridge Worktree

BSecurity

Use when starting a feature, experiment or risky refactor in this repo — anything bigger than a one-file fix. Also when the user says "worktree", "new branch", "work on this in parallel", or when a change adds a table, a column or any new persisted data. Covers where the worktree goes, what is missing inside it, and keeping new data off the live bridge DB.

  • 8 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
ai-agentspythongoshellsqlnodegit

Works with

  • cli

Security analysis

B85/100
  • highPerforms destructive filesystem operations

Pro shows the line behind each finding and how to fix it

Scanned December 3, 2026

npx -y skills add ainurdev/mystical-assistant --skill bridge-worktree --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bridge Worktree?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bridge Worktree
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/ainurdev-bridge-worktree/badge)](https://www.skillsdirectory.com/skills/ainurdev-bridge-worktree)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: bridge-worktree
description: Use when starting a feature, experiment or risky refactor in this repo — anything bigger than a one-file fix. Also when the user says "worktree", "new branch", "work on this in parallel", or when a change adds a table, a column or any new persisted data. Covers where the worktree goes, what is missing inside it, and keeping new data off the live bridge DB.
user-invocable: true
---

# Feature work happens in a worktree

`master` is the checkout the live bridge runs from. Work there and a half-built
feature is one `mystical restart` away from being the thing the user is talking
to. One-file fix or doc tweak: master is fine. Anything else: worktree.

## Create it where the dashboard can see it

```sh
git worktree add -b feat/x ~/projects/.worktrees/mystical-assistant/feat-x
```

**Inside `BASE_PATH` is the load-bearing part** — `_abs_within()` drops any tree
outside `~/projects`, so a worktree in `/tmp` is invisible to every surface and no
session can start in it. Git resolves branch→tree, so a hand-made `git worktree
add` elsewhere under `~/projects` still attaches; `.worktrees/<repo>/<branch>`
(slashes to dashes, `_worktree_path()` in `bridge/dashboard/server.py`) is the
convention that keeps it out of the project browser.

## What isn't in there

`git worktree add` checks out tracked files only, so everything git-ignored is
missing:

- **`.env`** — `cp ~/projects/mystical-assistant/.env <wt>/.env`. Without it
  `bin/mystical` dies on any command except `build`/`doctor`.
- **`node_modules`** — `npm run check` and `vite build` need it. Link the main
  checkout's instead of `npm ci`:
  `ln -s ~/projects/mystical-assistant/bridge/dashboard/web/node_modules <wt>/bridge/dashboard/web/`
  (the same for `bridge/miniapp/web`). The root `.gitignore` already covers the
  link. To drop it, `rm` the link itself, with no trailing slash:
  on macOS `rm -rf …/node_modules/` deletes the main checkout's `node_modules`.

## New data goes in a scratch DB

`config.BRIDGE_DB` defaults to `~/.bridge_state/bridge.db` — the live bridge's
sessions, turns and events. A worktree that migrates it or writes new-shape rows
damages the thing the user is working in *right now*.

- **Tests need nothing.** `tests/conftest.py` already pins `BRIDGE_DB` to a temp
  file before config is imported.
- **Any manual script or REPL:** `BRIDGE_DB=/tmp/wt-x.db python3 …`. In the
  environment, before the process starts — `bridge/config.py` freezes the value
  at import, so setting it afterwards does nothing. To probe on live data, copy it
  with `bin/bridge-snapshot DIR` and use the `BRIDGE_DB=` line it prints: it takes
  the settings JSONs beside the DB too (a DB alone runs on default settings), and
  Apple's `sqlite3` CLI can't open the live DB from a session's shell.
- **Schema changes** stay in `bridge/store.py`: a line in `_SCHEMA` plus an
  idempotent `ALTER TABLE` in `init()`, like every column already there. Additive
  only — master's code keeps reading that DB.

## Two traps

- **`mystical` on PATH is the *main* checkout.** It's a symlink to
  `mystical-assistant/bin/mystical`, and that script resolves `REPO` from its own
  location. `mystical restart` inside a worktree restarts the live bridge running
  master's code. Say `<wt>/bin/mystical` when you mean the worktree.
- **Worktree code is never live.** It can't be, until it's merged and the bridge
  restarts — see **bridge-ship**. Don't restart anything to "test" it.

## Fold back

```sh
git -C ~/projects/mystical-assistant merge feat/x
git worktree remove ~/projects/.worktrees/mystical-assistant/feat-x
```

Then **bridge-ship**. Abandoned worktrees aren't free: each one is a dirty tree
NEXT UP keeps suggesting and a row in the WORKTREES tab, and each can hold one of
the 8 dev-server slots (`devserver.MAX_SERVERS`).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.