agent-improve
Review this conversation and generate a structured improvement report.
Launch a bot command in an isolated autobot session with its own worktree, backend, and frontend.
$ npx -y skills add metabase/metabase --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/autobotContext preview
What this command does when you run it.
Launch a bot command in an isolated autobot session with its own worktree, backend, and frontend.
Launch a bot command in an isolated autobot session with its own worktree, backend, and frontend.
The user provided: `$ARGUMENTS`
Parse as: `<branch-name-or-pr-env-url> [from <base-branch>] <inner-command> [inner-args...]`
**Arg-order sanity check:** If the first token starts with `/` (e.g. the user wrote `/autobot /qabot my-branch`), stop immediately and tell the user the correct order is `/autobot <branch> [from <base>] /<command> [args]`. Do not try to guess.
The first token can be either a branch name OR a PR preview environment URL:
If the first token matches the PR-env URL pattern: 1. Extract the PR number from the anchored regex above (the digits after `pr`). 2. Resolve the branch name by running `gh pr view <PR_NUMBER> --json headRefName` and reading `headRefName`. 3. Use that branch for the worktree (so the bot has access to the PR's source code). 4. Set `PR_ENV_URL` to the matched URL. 5. Pass `--pr-env-url <URL>` to `-autobot-go` in step 4.
**Note:** PR preview environments are reachable only from the Metabase Tailscale network. If `gh pr view` or the preview URL itself hangs or times out, tell the user to check their Tailscale connection.
If the next two words after the branch/URL are `from <base>`: use `<base>` as the base branch. The `from <base>` clause is the signal that autobot should **create the branch** from `<base>` if it doesn't exist. If the branch already exists, passing `from <base>` is an error (the base would be silently ignored otherwise). Pass `--base <base>` to `-autobot-go` in step 4.
Without `from`, the branch must already exist locally or on origin.
Next word starting with `/`: inner command (e.g., `/qabot`, `/fixbot`). Remaining words: arguments to pass to the inner command.
Examples:
Extract the bot name from the inner command by stripping the leading `/` (e.g., `/qabot` → `qabot`).
**Where inner-bot files live:** Inner-bot slash commands are at `.claude/commands/<bot-name>*.md` (e.g. `.claude/commands/qabot.md`, `.claude/commands/qabot-discover.md`). They are NOT under `.claude/skills/`. Read them directly with `Read`; do not `find`/`grep` `.claude/skills/` looking for them.
Verify these are available (stop if any fail):
If a `/<bot-name>-precheck` skill exists (e.g., `/qabot-precheck` for `/qabot`), run it before launching. If the precheck reports failures, stop and show the results — do not launch the session.
If no precheck skill exists for the inner bot, skip this step.
Generate a timestamp in `YYYYMMDD-HHMMSS` format (use the current wall-clock time if known; otherwise run `./bin/mage -bot-timestamp` — do NOT use `date` directly). Set:
Run `mkdir -p <OUTPUT_DIR>` before invoking discover so subsequent file copies / writes never fail on a missing parent directory. The discover skill must be the only producer of artifacts inside `<OUTPUT_DIR>` — do not pre-copy `linear-context.txt` from a previous run; let discover regenerate it.
Run the `/<bot-name>-discover` skill, passing the inner-args plus `--output-dir <OUTPUT_DIR>`. For example, if the command is `/fixbot MB-12345`, run `/fixbot-discover MB-12345 --output-dir <OUTPUT_DIR>`.
This will:
After the discover skill completes, read `<OUTPUT_DIR>/config.env` and extract the `APP_DB` value. If the file doesn't exist or APP_DB is missing, default to `postgres`.
Run (append `--pr-env-url <URL>` if in PR-env mode, `--base <base>` only if the user supplied `from <base>`):
./bin/mage -autobot-go <BRANCH_NAME> --bot <BOT_NAME> --app-db <APP_DB> --command "<INNER_COMMAND> <INNER_ARGS>" [--base <BASE_BRANCH>] [--pr-env-url <PR_ENV_URL>]
Only pass `--base` when the user explicitly wrote `from <base>`. Omitting it means "branch must already exist."
This will:
If a session already exists for this bot+branch, it will tell you to stop it first.
Tell the user:
Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.
Repo: metabase/metabase
Review this conversation and generate a structured improvement report.
Tear down and remove an autobot session (worktree, Docker containers, and tmux).
List all autobot sessions with status information.
Print the most recent `result.md` for an autobot session, so the user can see how a bot is doing without attaching to its tmux session.
Stop an autobot session (kill tmux and dev environment, but keep the worktree).
Generate a CI failure report for PR $PR_NUM_OR_URL (or current branch if no argument given).