Worktree Pr Monitor
Create an isolated worktree PR, monitor CI and review comments, iterate until Greptile is 5/5, then report completion.
Claude CodeGeneric
---
description: Create an isolated worktree PR, monitor CI and review comments, iterate until Greptile is 5/5, then report completion.
---
# Worktree PR Monitor
Usage: `/worktree-pr-monitor <short branch slug or task summary>`
Arguments:
```text
$ARGUMENTS
Goal
Move an explicitly requested manual git worktree change through the full Matrix OS PR loop:
- create or use an isolated git worktree,
- implement and validate the change,
- open or update a GitHub PR,
- monitor CI plus review comments,
- keep fixing until Greptile reports
5/5, - ping the requester with the PR URL, final Greptile status, and validation summary.
Rules
- Use this command only when the requester explicitly asks for a worktree PR workflow. Otherwise, follow the repo's current-branch agent workflow.
- This command does not authorize Swarm
isolation: "worktree"; that repo-level Swarm ban still applies. - Keep
/home/deploy/matrix-osonmain. Put feature work under/home/deploy/matrix-os.worktrees/<slug>. - Use a semantic branch and PR title. Do not prefix the PR title with agent/tool tags.
- Never stage unrelated changes. Inspect
git status --short --branchbefore staging. - Do not merge unless explicitly asked.
- If Greptile has reviewed the PR, GitHub mergeability alone is not enough. The loop is done only when the latest trusted Greptile result is
5/5. - Treat human review, Codex review comments, and unresolved GitHub review threads as blockers until acknowledged or fixed.
- If feedback conflicts with the task, reply with the rationale and ask before changing behavior.
Workflow
Resolve scope and slug.
- Derive a concise slug from
$ARGUMENTSor the current task. - Worktree path:
/home/deploy/matrix-os.worktrees/<slug>. - Branch:
codex/<slug>unless the task names a specific branch.
- Derive a concise slug from
Create the worktree from current
origin/main.- From
/home/deploy/matrix-os, verifygit status --short --branch. - If there are relevant uncommitted changes in main, stash or patch only those files, create the worktree, then apply them inside the worktree.
- Run
git worktree add -b <branch> /home/deploy/matrix-os.worktrees/<slug> origin/main.
- From
Implement in the worktree.
- Follow TDD where practical: reproduce or add a failing regression first, then fix.
- Keep diffs scoped to the task.
- Re-check
git status --short --branchbefore staging.
Validate.
- Run the narrow tests for the changed area.
- Run repo-required checks when feasible:
bun run typecheckbun run check:patternsbun run test
- If a broad check is not run, state the reason in the PR body and final ping.
Commit and push.
- Commit with a Conventional Commit message.
- Push with
git push -u origin HEAD.
Open or update the PR.
- Use a semantic PR title such as
fix(canvas): keep terminal controls clickable. - PR body must include:
SummaryTestsReview/MonitoringInvariantsfor backend changes
- Use a semantic PR title such as
Monitor until done.
- Watch checks with
gh pr checks --watchor GitHub Actions status APIs. - Inspect unresolved review threads with the GitHub review-thread workflow, not only flat comments.
- Watch Greptile comments/status. Continue only when the latest trusted Greptile result is
5/5. - If Greptile reports findings, implement fixes in the same worktree, rerun relevant checks, commit, push, and keep monitoring.
- Watch checks with
Ping completion.
- Report:
- PR URL
- branch and worktree path
- latest commit SHA
- checks run and result
- latest Greptile status, explicitly
5/5 - any residual risk or skipped check
- If blocked, ping with the exact blocker and next action needed.
- Report:
Maintain Worktree Pr Monitor?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Worktree Pr Monitor on getagentictools](https://getagentictools.com/loops/hamedmp-worktree-pr-monitor?ref=badge)