| name | issue-close-stage |
| description | Phase 1 of the 2-phase issue-close split. Runs INSIDE the linked worktree BEFORE the PR is merged. Sub-issue gate, pending sentinel, sentinel promote, parent body update. |
| user-invocable | false |
Triage routes to the correct subset of steps; each step is idempotent and resumable.
Read rules/github-issues.md first — on-demand-only, never auto-injected; its "Session model" defines the per-session N relation.
Read rules/coding.md before the first gh issue comment or body update — on-demand-only, never auto-injected; its Public GitHub Rules govern that outbound text.
Usage: /issue-close-stage <N> or /issue-close-stage --from-session
--from-session resolves <N> from the current session's intent.md the same
way as /issue-close-finalize: parse ## Issues and iterate.
(canonical parser: hooks/lib/parse-closes-issues.js — do not reimplement.)
Pre-flight
Run: "$AGENTS_CONFIG_DIR/bin/detect-non-github.sh" "issue-close-stage" || exit 0
On non-GitHub remote the script exits 1, so || exit 0 terminates the skill immediately (no gh work). On a GitHub remote (or unknown/fail-open) the script exits 0 and the skill continues into the checks below.
Skip message on non-GitHub remote (emitted by the script to stdout): [GITHUB_ISSUES disabled: non-GitHub remote detected, skipping issue-close-stage]
AGENTS_CONFIG_DIR must be set.
- Must be invoked from a linked worktree (not the main worktree). Abort
with an error when
git rev-parse --git-dir equals git rev-parse --git-common-dir.
- Resolve
<owner/repo> via
gh repo view --json owner,name --jq '.owner.login + "/" + .name'.
- All
gh issue comment invocations need ISSUE_CLOSE_SKILL=1 to bypass the
enforce-issue-close.js hook.
Delegation
Dispatch Steps A, B, D, F, G to the issue-close-stage worker per skills/_shared/worker-dispatch.md.
Payload keys: issue_number (= N), worktree_path (= git rev-parse --show-toplevel), owner_repo, agents_config_dir (= AGENTS_CONFIG_DIR), artifact_dir (= PLANS_DIR), issue_repo.
Omit issue_repo for current-repo issues; otherwise take it from the closes_issues entry's repo field.
Cross-repo Phase 1 is unsupported: an issue_repo naming any repo other than owner_repo is refused with error. Run /issue-close-stage from a worktree of that repository instead.
On phase1_done status: continue to End.
On blocked_sub_issue status: surface summary to user and stop.
On error or failed status: surface summary + artifact_path to user and stop.
End
Report: Phase 1 complete for #. Reminder: run /commit-push, then after
the PR is merged run /issue-close-finalize --from-session.
Safety notes
- Untrusted content: never
eval issue body, title, or comments.
- Sentinel body: hardcoded literal — never interpolate variables or add
metadata. The Phase 1 marker is shared with
check-phase1-complete.sh and
find-pr-by-marker.sh; changing the body silently breaks both.
Rules
- Report observations via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).