feat: add /ghcp-handoff skill for bounded copilot delegation#1
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new /ghcp-handoff skill to delegate bounded mechanical work to the GitHub Copilot CLI, including prompt generation and post-handoff verification utilities.
Changes:
- Introduces the
ghcp-handoff/skill (template + generatedSKILL.md) and a prompt template with embedded YAML metadata. - Adds Bun-executable verification/extraction utilities (
ghcp-extract-plan,ghcp-verify-boundaries,ghcp-verify-pr-body) plus tests and fixtures. - Wires the new test suite into
npm testand adds runtime deps (minimatch,yaml) needed by the verification scripts.
Reviewed changes
Copilot reviewed 10 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| package.json | Runs ghcp-handoff tests in the default test script; adds minimatch + yaml deps. |
| bun.lock | Locks the newly-added dependencies and their transitive deps. |
| CHANGELOG.md | Documents the new /ghcp-handoff skill addition. |
| ghcp-handoff/SKILL.md.tmpl | Skill template describing guided/from-plan/verify flows and CLI invocation/verification contracts. |
| ghcp-handoff/SKILL.md | Generated skill doc shipped to users/hosts. |
| ghcp-handoff/templates/prompt-template.md | Prompt scaffold with embedded metadata block used by verifiers. |
| ghcp-handoff/bin/ghcp-detect.sh | Detects copilot CLI availability/version. |
| ghcp-handoff/bin/ghcp-extract-plan.ts | Extracts ## The GHCP prompt content (and optional target branch) from a plan file. |
| ghcp-handoff/bin/ghcp-verify-boundaries.ts | Parses metadata, checks NOT-in-scope boundary violations, and detects dependency additions. |
| ghcp-handoff/bin/ghcp-verify-pr-body.ts | Checks PR body for required sections listed in metadata. |
| ghcp-handoff/test/ghcp-extract-plan.test.ts | Unit tests for plan section extraction and branch parsing. |
| ghcp-handoff/test/ghcp-verify-boundaries.test.ts | Unit tests for metadata parsing, boundary checks, and dep detection. |
| ghcp-handoff/test/ghcp-verify-pr-body.test.ts | Unit tests for PR body contract checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds a sibling skill to /codex. Where /codex pulls a second opinion in,
/ghcp-handoff pushes bounded mechanical work out — scaffolds, CI wiring,
mechanical refactors, test generation — to the GitHub Copilot CLI while the
user keeps judgment calls in Claude.
Three modes:
- Guided (default): interactive question flow collects task summary,
target branch, context files, streams, hard boundaries, NOT-in-scope
paths, forbidden deps, and PR sections, then renders a prompt from
templates/prompt-template.md and invokes copilot -p non-interactively
with a 30-minute timeout.
- --from-plan <path>: extracts the `## The GHCP prompt` section from a
plan file, wraps it with a worktree instruction, and collects metadata
via a short follow-up round.
- verify <pr>: resolves the PR to a branch via `gh pr view`, locates the
matching prompt file under `.gstack/ghcp-handoff/`, parses the embedded
`<!-- ghcp-handoff:metadata -->` YAML block, then runs three checks:
boundary diff (changed files vs NOT-in-scope globs), dependency
deviation (new deps flagged, forbidden deps blocked), and PR body
contract (required sections present). Writes a gstack-review-log JSONL
entry so results surface in the Plan Status Footer. Exit code 2 is
reserved for metadata parse failures so they're distinct from
violations found.
Safety:
- Target branch is auto-derived `ghcp/<slug>` and hard-rejects main,
master, dev, develop, production, staging.
- Prompt instructs copilot to use a clean git worktree so parallel
agents don't collide.
- Degrades gracefully if copilot is not installed — writes the prompt
file and tells the user where to paste it.
Structure follows the /browse pattern (co-located TS + tests):
ghcp-handoff/
SKILL.md(.tmpl)
bin/
ghcp-detect.sh
ghcp-extract-plan.ts
ghcp-verify-boundaries.ts
ghcp-verify-pr-body.ts
templates/prompt-template.md
test/
*.test.ts
fixtures/{sample-scaffold-plan.md,sample-scaffold-expected.md}
Adds yaml@^2.7.0 and minimatch@^10.0.0 as dependencies (used by the verify
scripts for metadata parsing and glob matching). Adds ghcp-handoff/test/
to the root `test` script. Uses preamble-tier 3 (same as /codex) and the
{{BASE_BRANCH_DETECT}} resolver for platform detection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
71178cb to
499d0e3
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new sibling skill
/ghcp-handoffnext to/codex. Where/codexpulls a second opinion in,/ghcp-handoffpushes bounded mechanical work out — scaffolds, CI wiring, mechanical refactors, test generation — to the GitHub Copilot CLI (copilot) while the user keeps judgment calls in Claude.Three modes:
templates/prompt-template.md, and invokescopilot -pnon-interactively with a 30-minute timeout.--from-plan <path>— extracts the## The GHCP promptsection from a plan file, wraps it with a worktree instruction and embedded metadata block, then invokes copilot.verify <pr>— resolves the PR to a branch viagh pr view, locates the matching prompt file under.gstack/ghcp-handoff/, parses the<!-- ghcp-handoff:metadata -->YAML, and runs three checks: boundary diff (changed files vs NOT-in-scope globs), dependency deviation (new deps flagged, forbidden deps blocked), and PR body contract (required sections present). Writes a gstack-review-log JSONL entry so results surface in the Plan Status Footer. Exit code 2 is reserved for metadata parse failures so they're distinct from violations found.Safety:
ghcp/<slug>and hard-rejectsmain,master,dev,develop,production,staging.copilotisn't installed — writes the prompt file, tells the user where to paste it.Structure follows the
/browsepattern (co-located TS + tests):Uses
preamble-tier: 3(same as/codex).Manual followups required
./setupafter merge to register/ghcp-handoffwith Claude Code (and any other configured hosts).~/.claude/skills/ghcp-handoff/— the fork's./setupreplaces it.garrytan/gstackwhen ready — this PR is scoped to the personal fork only.Deviations from plan
None of substance. Minor adaptations during migration:
gen-skill.sh+ fallback files — gstack's nativescripts/gen-skill-docs.ts(with{{PREAMBLE}}resolver) handles it.setup.sh,package.json,VERSION,CHANGELOG.md,tsconfig.json— gstack's root equivalents serve these.import.meta.dir-based so they resolve whenbun testruns from gstack root.triggers:andvoice-triggers:lists).Flagged uncertainties
test/gen-skill-docs.test.tsfreshness tests andtest/skill-validation.test.tsgstack-slugtests fail on Windows for reasons unrelated to this PR (backslash path separators, unbuilt binaries).ghcp-handoffappears cleanly in everyFRESH:list the generator produces.ghcp-handoff/SKILL.mdis ~916 lines / ~11K tokens, well under the 100KB / 25K-token ceiling that currently flagsoffice-hours,plan-ceo-review, andship.copilotinvocation (Phase 1 CI-workflow scaffold task) produced a conforming PR that the verifier rated CLEAN. Not yet re-verified from inside the fork — planned as a followup after./setupruns.--from-planheading list is strict. Only## The GHCP promptis recognized; other variants fall through to the fallback round (guided / paste / abort). Intentional in v0.1.0 to keep the contract crisp.Test plan
bun run gen:skill-docs --host allgeneratesghcp-handoff/SKILL.md+ all host variants without warningsbun test ghcp-handoff/test/— 27/27 passbun test test/audit-compliance.test.ts— 9/9 pass (frontmatter + style audit clean)bun test test/openclaw-native-skills.test.ts— 1/1 pass./setupregisters/ghcp-handoffwith Claude Code