Skip to content
Agentmart
Submit a tool
This entry duplicates pr-worktree, which is the one we list in search.

pr-worktree

Create and tear down the throwaway git worktrees used to test community PRs for waku-agent, without leaking API keys or leaving branches behind.

Skill by gxiaopang

IndexedMIT
Write a review

Chalk Labs

Need help deploying pr-worktree?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/gxiaopang-pr-worktree

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Create and tear down the throwaway git worktrees used to test community PRs for waku-agent, without leaking API keys or leaving branches behind. Use when setting up to test a PR, and ALWAYS after a PR is merged, closed, or parked.

Use cases: backend, testing, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
pr-worktree
Description
Create and tear down the throwaway git worktrees used to test community PRs for waku-agent, without leaking API keys or leaving branches behind. Use when setting up to test a PR, and ALWAYS after a PR is merged, closed, or parked.
License
MIT
Instructions
98 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Throwaway worktrees for PR testing

Testing a contributor's PR must never disturb the live dashboard on 7777, and it
must never leave a second copy of Sean's API keys on disk. Both have happened.

## Setting one up

```bash
REPO=$(git rev-parse --show-toplevel)
N=<pr-number>
git -C $REPO fetch -q origin pull/$N/head:pr-$N
git -C $REPO worktree add -q ~/Developer/waku-prs/pr$N pr-$N
ln -sfn $REPO/.waku ~/Developer/waku-prs/pr$N/.waku   # real memory/traces/calendar
```

Never `gh pr checkout` — it switches the branch of the main working tree, and the
live dashboard runs from there.

### Only link `.env` when the test actually needs keys

Deterministic evals do not. Skip the symlink for a test-only pass, so untrusted
contributor code never runs against real credentials. Link it only after you have
read the diff:

```bash
ln -sfn $REPO/.env ~/Developer/waku-prs/pr$N/.env
```

### The symlink trap (this cost us a full copy of every key)

`python-dotenv`'s `set_key` — which the dashboard's Save & switch calls —
**replaces a symlinked `.env` with a regular file**. The moment anyone saves a
setting from a PR worktree's dashboard, that worktree gains a complete copy of
every key in the real `.env`: Anthropic, OpenAI, Gemini, Moonshot, xAI, Zhipu,
Tavily, Telegram, Discord.

So: after any test that saved settings, assume the `.env` is a real file and
**check before deleting the worktree**, then move anything worth keeping into the
main `.env` rather than losing it.

```bash
[ -L ~/Developer/waku-prs/pr$N/.env ] && echo "symlink (safe)" || echo "REAL FILE — copy of all keys"
```

New env vars a PR introduces belong in the **main** `.env`, not the worktree's.
Copy the values across without printing them, and leave switches that would change
what the live demo shows (e.g. `WAKU_EPISODIC_STORE`) on their old value — Sean
films against the local data.

## Running its dashboard

Always a second port, so 7777 stays untouched:

```bash
cd ~/Developer/waku-prs/pr$N
WAKU_DASHBOARD_PORT=7778 $REPO/.venv/bin/python -m waku.ops.dashboard
```

Optional extras a PR needs (`[notion]`, `[discord]`, …) install with `uv`, since
the venv has no `pip`:

```bash
uv pip install --python $REPO/.venv/bin/python "<package>"
```

## Tearing it down — do this the same turn the PR is decided

A worktree is finished the moment the PR is merged, closed, or parked waiting on
the contributor. Leaving it costs disk, confuses future greps, and may be sitting
on a copy of every key.

```bash
REPO=$(git rev-parse --show-toplevel)
# 1. rescue any new env vars into the MAIN .env first (see above)
# 2. stop anything still running from it
lsof -ti:7778 | xargs kill -9 2>/dev/null
# 3. remove worktrees + their local branches
for d in ~/Developer/waku-prs/*/; do git -C $REPO worktree remove --force "$d"; done
git -C $REPO worktree prune
git -C $REPO branch --list 'pr-*' | tr -d ' ' | xargs -r -n1 git -C $REPO branch -D
# 4. verify nothing is left holding keys
find ~/Developer/waku-prs -name ".env" 2>/dev/null
```

That `find` must print nothing. If it prints a path, the key copy is still there.

## Checklist before you say a PR is done

- [ ] new env vars moved into the main `.env`
- [ ] `find ~/Developer/waku-prs -name ".env"` prints nothing
- [ ] `git worktree list` shows only the main tree
- [ ] no `pr-*` branches left
- [ ] nothing still listening on 7778
- [ ] settings the test changed are back where the live demo expects them

Related: [[review-pr]] for how to review and present the PR itself.

From gxiaopang/ContractGuard-Agent, MIT.

More from gxiaopang/ContractGuard-Agent

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jul 31, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Same skill elsewhere

Copies of this SKILL.md published by others; search shows only one of them.

More from gxiaopang

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get pr-worktree running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying pr-worktree?

CallGet help
Cite this page

pr-worktree skill. Agent Mart. https://agentmart.dev/skills/gxiaopang-pr-worktree (last updated 2026-10-24)