Skip to content
Back to skills

Setup

BSecurity

Configure the Claude agent dispatch system for a new project. Use when setting up for the first time or reconfiguring.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 20, 2026
ai-agentsrustgoshellbashnodegitapibackendsecuritydocumentation

Works with

  • claude code
  • cli
  • api

Security analysis

B75/100
  • criticalModifies startup scripts or system services for persistence

Pro scans all 17 files and shows the line behind each finding

Scanned November 20, 2026

npx -y skills add jnurre64/sandbox-pal-action --skill setup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Setup?

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

Security grade badge for Setup
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/jnurre64-setup/badge)](https://www.skillsdirectory.com/skills/jnurre64-setup)

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: setup
description: Configure the Claude agent dispatch system for a new project. Use when setting up for the first time or reconfiguring.
user-invocable: true
argument-hint: "[owner/repo]"
---

# Setup: Configure Agent Dispatch for a Project

Walk the user through configuring the agent dispatch system for their GitHub repository.

## Prerequisites

Before starting, run the prerequisites check:

```bash
bash ${CLAUDE_SKILL_DIR}/../../scripts/check-prereqs.sh
```

If any required tools are missing, help the user install them before continuing. If `config.env` doesn't exist yet, that's expected — we'll create it in this flow.

## Step 1: Choose Setup Mode

Use the `AskUserQuestion` tool to ask the user which mode they prefer:

**Standalone mode** (recommended):
- All scripts, prompts, config, and workflows are copied directly into the user's repo under `.sandbox-pal-dispatch/`
- No upstream dependency — the user owns every file and can modify freely
- No automatic updates — the user manages their own copy
- Best for: most users, full control, easy to customize, no external dependencies

**Reference mode**:
- Thin workflow files in the user's repo call back to this upstream repo via `uses: jnurre64/sandbox-pal-action/...@v1`
- Scripts run from a clone of this repo on the runner (`~/agent-infra/`)
- Updates come automatically via version tags and `git pull`
- Best for: users who want automatic updates and minimal files in their repo

## Step 2: Gather Project Information

Use the `AskUserQuestion` tool to collect the following. If the user provided an `owner/repo` argument, use that instead of asking.

1. **Target repository** (owner/repo format) — the repo where the agent will work on issues
2. **Bot account username** — the GitHub account that will comment, push, and create PRs (recommend a dedicated bot account, not their personal account)
3. **Default branch** — usually `main`, but confirm
4. **Test command** (optional) — command to run before creating PRs (e.g., `npm test`, `pytest`, `cargo test`). If not set, the pre-PR test gate is skipped.
5. **Extra tools** (optional) — project-specific tools the agent needs (e.g., `Bash(npm:*)` for Node.js, `Bash(cargo:*)` for Rust, `Bash(Godot:*)` for Godot)
6. **Local clone path** (standalone mode only) — where the target repo is cloned on this machine

## Step 3: Generate Configuration

### Reference mode
Read the template at `config.defaults.env.example` (in the repo root). Fill in the user's answers and write to `config.env` in the repo root (reference mode uses a single file since it's not committed to a repo). Show the user the generated config and ask if they want to adjust anything.

### Standalone mode
Create the `.sandbox-pal-dispatch/` directory in the user's target repo. Copy:
- `scripts/sandbox-pal-dispatch.sh` and `scripts/cleanup.sh` → `.sandbox-pal-dispatch/scripts/`
- `scripts/lib/*.sh` → `.sandbox-pal-dispatch/scripts/lib/`
- `scripts/check-prereqs.sh` and `scripts/create-labels.sh` → `.sandbox-pal-dispatch/scripts/`
- `prompts/*.md` → `.sandbox-pal-dispatch/prompts/`
- `labels.txt` → `.sandbox-pal-dispatch/`
- Generated `config.defaults.env` → `.sandbox-pal-dispatch/config.defaults.env` (non-sensitive project config, committed)

**Important:** Configuration uses a layered approach:
- `config.defaults.env` — **committed** to the repo. Contains non-sensitive project config (bot username, timeouts, tool permissions, test commands). This file MUST NOT contain secrets, tokens, or credentials.
- `config.env` — **gitignored**, optional. Contains sensitive overrides (Discord tokens, webhook URLs, GitHub tokens). Values here override `config.defaults.env`.
- Environment variables — win over a file only where the file uses the `${VAR:-default}` form. A plain assignment in either file overwrites the environment, and the dispatcher logs a `WARN` naming each exported `AGENT_*` variable that was overwritten.

**Critical: emit every assignment using the `${VAR:-default}` form.** The dispatch
script sources `config.defaults.env` after the workflow's `env:` block has already
set variables, so plain assignments (`AGENT_NOTIFY_BACKEND="bot"`) silently
overwrite workflow overrides. The conditional-assign pattern preserves them:

```bash
# ✗ wrong — overwrites workflow env: and config.env
AGENT_NOTIFY_BACKEND="bot"

# ✓ right — defers to any pre-set value
AGENT_NOTIFY_BACKEND="${AGENT_NOTIFY_BACKEND:-bot}"
```

Copy values from the `config.defaults.env.example` template (which already uses
this pattern) and substitute the user's answers into the default slot only.

**Migration note for existing consumers:** a consumer repo that was generated by
an older version of `/setup` may still have plain assignments. It's safe to
rewrite each assignment into the `${VAR:-…}` form — there is no behavior change
when no workflow override is set. Offer this rewrite only if the user is running
`/setup` against a pre-existing `.sandbox-pal-dispatch/config.defaults.env`; leave
other customizations untouched.

Make all scripts executable after copying.

**Gitignore check:** Many `.gitignore` templates (e.g., VisualStudio, Node) include `*.env` which will block `config.defaults.env` from being committed. After copying files, check if the target repo's `.gitignore` excludes `*.env`. If so, add an exception:
```
!.sandbox-pal-dispatch/config.defaults.env
```
Warn the user about this and make the change for them.

## Step 4: Review Default Prompts

Show the user the default prompts in `prompts/` (repo root). Explain what each one does:

- **`triage.md`** — How the agent investigates issues and writes plans
- **`implement.md`** — How the agent implements approved plans with TDD
- **`reply.md`** — How the agent evaluates human replies to its questions
- **`review.md`** — How the agent addresses PR review feedback

Ask the user:
- What test framework does their project use? The implement and review prompts reference `$AGENT_TEST_COMMAND` which they set in Step 2.
- Does their project have a CLAUDE.md? The prompts instruct the agent to read it. If not, recommend creating one with coding conventions and architecture overview.
- Do they want to customize any prompts now, or start with defaults and customize later?

For standalone mode: customizations are made directly in `.sandbox-pal-dispatch/prompts/`.
For reference mode: customizations go in separate files pointed to by `AGENT_PROMPT_*` in `config.env`.

## Step 5: Create Labels

Run the label creation script against their target repo:

```bash
bash ${CLAUDE_SKILL_DIR}/../../scripts/create-labels.sh OWNER/REPO
```

Replace `OWNER/REPO` with the actual value from Step 2. Confirm the labels were created successfully.

## Step 6: Generate Workflows

### Reference mode
Read each template in this skill's `templates/` directory (the `caller-*.yml` files, NOT the `standalone/` subdirectory):
- `caller-triage.yml`, `caller-implement.yml`, `caller-reply.yml`, `caller-review.yml`, `caller-cleanup.yml`

### Standalone mode
Read each template in `templates/standalone/`:
- `sandbox-pal-triage.yml`, `sandbox-pal-implement.yml`, `sandbox-pal-reply.yml`, `sandbox-pal-review.yml`, `sandbox-pal-cleanup.yml`

For each template:
1. Replace `{{BOT_USER}}` with the bot username from Step 2
2. Show the user the generated workflow
3. Write it to the user's target repo at `.github/workflows/`

Ask the user where their target repo is cloned locally so you can write the files there. For standalone mode, this was already collected in Step 2.

### Programmatic dispatch (optional)

If any automation will trigger the agent while authenticated as the bot account -- the Discord bot (see `docs/notifications.md`), an orchestrator session, or scripts using the bot PAT -- also deploy the dispatch template:

- **Reference mode:** `caller-dispatch.yml`
- **Standalone mode:** `sandbox-pal-dispatch.yml` (from `templates/standalone/`)

This "Agent Dispatch (programmatic)" workflow is the official programmatic on-ramp: `repository_dispatch` with event types `agent-triage`, `agent-implement`, and `agent-reply`. Label events applied by the bot account are filtered by the anti-self-trigger guard, so bot-driven automation must use this path. The Discord bot's Approve, Retry, Comment, and Request Changes actions are one caller of it. See `docs/architecture.md`, "Programmatic Triggering (repository_dispatch)".

## Step 7: Guide Secret Setup

The target repo needs these GitHub Actions secrets:
- **`AGENT_PAT`** — Fine-grained PAT for the bot account (required)
- **`AGENT_GIST_PAT`** — Classic PAT with `gist` scope for the cleanup workflow (optional)

Walk the user through setting them:

```bash
# Set the bot's PAT (this will prompt securely)
gh secret set AGENT_PAT --repo OWNER/REPO

# Optional: set gist PAT for cleanup
gh secret set AGENT_GIST_PAT --repo OWNER/REPO
```

If the user hasn't created a bot account or PAT yet, walk them through:
1. Create a new GitHub account for the bot
2. Create a fine-grained PAT with scopes: Contents (rw), Issues (rw), Pull requests (rw), Metadata (r)
3. Add the bot as a collaborator on their target repo

## Step 8: Validate

Summarize everything that was set up:
- Setup mode chosen (reference vs standalone)
- Config file location
- Labels created
- Workflow files generated and where they were written
- Secrets that need to be set (if not done in Step 7)
- For standalone: list of files copied to `.sandbox-pal-dispatch/`

## Step 9: Self-Hosted Runner Setup

Ask the user if they already have a self-hosted runner configured for this repo. If yes, skip to Step 9e (verify prerequisites). If no, walk them through the full setup.

### Step 9a: Determine runner scope

Ask: Is the target repo under a personal account or an organization?

- **Organization repo:** Recommend org-level runner registration. One runner serves all org repos. Token source: `https://github.com/organizations/<org>/settings/actions/runners/new`
- **Personal account repo:** Only repo-level registration is available (GitHub does not support user-level runners). Token source: `https://github.com/<owner>/<repo>/settings/actions/runners/new`

**If the repo is public**, display this warning:

> ⚠️ **Security risk:** GitHub warns against using self-hosted runners on public repositories. Anyone who forks the repo and opens a PR can potentially execute code on your runner, accessing environment variables, API keys, and the filesystem. Consider making the repo private, or review the hardening steps in [docs/security.md](docs/security.md).

### Step 9b: Download and extract the runner

Direct the user to the GitHub UI page for their scope (org or repo). The page shows the correct download URL and checksum for their platform. Tell them to follow the download and extraction steps shown there.

Suggest a directory naming convention:
- `~/actions-runner-<repo-name>/` for single-repo setups
- `~/actions-runner-<org>-agent/` for org-level setups

Check if the user already has runner directories on the machine:
```bash
ls -d ~/actions-runner-* 2>/dev/null
```
If found, offer to reuse the binary — they only need a new directory and registration.

### Step 9c: Register the runner

The user must get a registration token from the GitHub UI (it expires in 1 hour). Tell them to navigate to the URL from Step 9a, copy the token, and then run:

```bash
./config.sh \
  --url https://github.com/<owner-or-org> \
  --token <TOKEN_FROM_GITHUB_UI> \
  --name <descriptive-name> \
  --labels self-hosted,agent \
  --work _work
```

The `--labels self-hosted,agent` is required — the dispatch workflows use `runs-on: [self-hosted, agent]`.

Since this requires a token the user must paste, tell them to run the command themselves. In Claude Code, they can use `! ./config.sh ...` to run it in the session.

### Step 9d: Configure credentials

The Claude Code CLI needs to be authenticated on the runner. The dispatch scripts do not prescribe a method — point the user to Anthropic's [Claude Code authentication docs](https://code.claude.com/docs/en/authentication) for the available options, or [authentication.md](../../../docs/authentication.md) for the project's summary and Terms-of-Service pointers.

If the user chose a method that uses environment variables, the runner's `.env` file (in the runner installation directory, not `~/.bashrc` — systemd services do not source shell profiles) is the right place to set them. Any `.env` holding credentials must be `chmod 600`.

**Verification:** After the runner service is restarted in Step 9f, have the user run `claude /status` on the runner (as the runner user). It should report that the runner is authenticated with the expected account.

**Node/Claude path** — If using nvm, the `claude` binary won't be in PATH for systemd services. Add the path to `.env`:

```bash
echo "PATH=$HOME/.nvm/versions/node/$(node -v)/bin:$PATH" >> .env
```

**Git identity** — Configure git for the bot account:

```bash
git config --global user.name "<bot-username>"
git config --global user.email "<bot-username>@users.noreply.github.com"
```

### Step 9e: Verify prerequisites

Check that the required tools are available:

```bash
claude --version && gh --version && git --version && jq --version && echo "All tools found"
```

If any are missing, help the user install them. See [docs/runners.md](docs/runners.md#prerequisites) for the full list.

### Step 9f: Install systemd service

```bash
sudo ./svc.sh install $(whoami)
sudo ./svc.sh start
sudo ./svc.sh status
```

The service name follows the pattern `actions.runner.<org-or-owner>.<runner-name>.service`.

### Step 9g: Verify in GitHub UI

Direct the user to check that the runner appears in the GitHub UI:
- **Org:** `https://github.com/organizations/<org>/settings/actions/runners`
- **Repo:** `https://github.com/<owner>/<repo>/settings/actions/runners`

It should show as **Idle** with the labels `self-hosted` and `agent`.

### Step 9h: Reference mode only — clone upstream and copy config

For reference mode, the dispatch scripts run from a clone of this repo on the runner:

```bash
git clone https://github.com/jnurre64/sandbox-pal-action.git ~/agent-infra
cp <path-to-config.env> ~/agent-infra/config.env
```

## Step 10: Test and Finish

### Commit and push

- **Reference mode:** Commit and push the workflow files to the target repo
- **Standalone mode:** Commit and push `.sandbox-pal-dispatch/` and `.github/workflows/` to the target repo

### Dry run

Create a test issue on the target repo and add the `agent` label. Watch the agent triage it, write a plan, and wait for approval.

### Summary

Summarize everything that was set up:
- Setup mode (reference or standalone)
- Config file locations
- Labels created
- Workflows generated
- Secrets configured
- Runner registered and running
- For standalone: list of files in `.sandbox-pal-dispatch/`

If any step was skipped, list it with instructions for completing it later. Reference [docs/runners.md](docs/runners.md) for the full runner documentation.

## Named dispatch profile assets

The shared installation inventory delivers and checksums
`agent-profiles.example.json`, `scripts/agent-profile.sh` and its library modules.
Do not copy the example over an active `agent-profiles.json`, replace saved
`.agent-profile` selection, or enable `AGENT_ENGINE_PROFILES` during setup/update.
Preserve existing project configuration on repeated setup. Add `.agent-profile`
(or the configured selection path) and the catalog capture lock directory to
the consuming project's ignore rules. For explicit adoption, follow
`docs/configuration.md` → “Named dispatch profiles”: migrate legacy Codex
settings, capture actual legacy routing, preview, then select a profile.

Files in this skill

  • SKILL.md15.4 KB
  • templates/caller-cleanup.yml337 B
  • templates/caller-direct-implement.yml2.4 KB
  • templates/caller-dispatch.yml1.1 KB
  • templates/caller-implement.yml2.4 KB
  • templates/caller-post-merge.yml472 B
  • templates/caller-reply.yml537 B
  • templates/caller-review.yml402 B
  • templates/caller-triage.yml2.3 KB
  • templates/standalone/sandbox-pal-cleanup.yml760 B
  • templates/standalone/sandbox-pal-direct-implement.yml3 KB
  • templates/standalone/sandbox-pal-dispatch.yml2.6 KB
  • templates/standalone/sandbox-pal-implement.yml3 KB
  • templates/standalone/sandbox-pal-post-merge.yml1 KB
  • templates/standalone/sandbox-pal-reply.yml1.1 KB
  • templates/standalone/sandbox-pal-review.yml1 KB
  • templates/standalone/sandbox-pal-triage.yml2.9 KB

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.