HE GitHub
Drive the PR lifecycle end-to-end with gh, while keeping harness artifacts (spec/plan/evidence) as the system of record.
When to Use
- After
he-implementwhen code is ready for a PR - When CI fails and needs triage
- When PR feedback arrives and needs a response
- When
he-verify-releasedecision is GO and merge is approved
Key Principles
- Tiered consent for remote ops — push and PR on feature branches are autonomous; merge and force-push require explicit user approval.
- One PR per initiative slug — the PR title/body should reference the same slug used in
docs/specs/anddocs/plans/. - Plan is canonical — the PR description links to the active plan and key evidence; it does not replace it.
- CI is evidence — treat failing checks as signal; follow
docs/runbooks/ci-failures.md. - Feedback loop — respond to review comments by updating code + plan + evidence, then push and re-check.
- Runbooks are additive only — apply any runbook whose frontmatter
called_frommatches this skill (bash scripts/runbooks/select-runbooks.sh --skill he-github).
Consent Model
| Operation | On feature branch | On main/protected branch |
|---|---|---|
git push | Autonomous | Consent required |
gh pr create | Autonomous | N/A |
gh pr edit / respond to feedback | Autonomous | N/A |
| Request agent review | Autonomous | N/A |
| Request human review | Consent required | Consent required |
gh pr merge | Consent required | Consent required |
git push --force | Consent required | Consent required |
Safety invariants (non-negotiable):
- Never push directly to main/default branch without explicit consent
- Never force-push without explicit consent
- Never merge without explicit consent
- Merge still requires
he-verify-releaseGO decision
Workflow
Phase 0: Preflight
- Read
docs/plans/active/<slug>-plan.mdor accept initiative slug/PR reference. - Verify current git workspace context (branch/worktree) from
he-worktree. - Run and record results in plan
Artifacts and NotesorDecision Log:git status --short --branchgit remote -vgh auth status
- Run
bash scripts/runbooks/select-runbooks.sh --skill he-githuband read any returned runbooks. Apply their additions throughout — they must not waive or override gates codified here.
Phase 1: Open or Update PR (autonomous on feature branches)
Creating a new PR:
- Push the branch:
git push -u origin HEAD - Create a PR:
gh pr create --fill - Ensure the PR body links:
- spec:
docs/specs/<slug>-spec.md - plan:
docs/plans/active/<slug>-plan.md - evidence: raw paths under
tmp/artifacts/<slug>/and promoted minimal set underdocs/artifacts/<slug>/(if any)
- spec:
- Update the active plan
## Pull Requestsection with pr URL, branch name, current commit SHA, CI link/status.
Updating an existing PR:
- Update body/checklist links:
gh pr edit --body-file <file> - Re-check CI:
gh pr checks - Ensure
## Pull Requestin the plan stays current.
Phase 2: Respond to Feedback
- Fetch comments and requested changes:
gh pr view --commentsgh pr view --json reviews
- Make the smallest root-cause fix.
- Update plan
Review Findings,Progress, and any evidence references. - Push and re-run checks (autonomous on feature branches):
git pushgh pr checks
Phase 3: Detect and Remediate Build Failures
- Use
gh pr checksto identify failing jobs quickly. - Use
gh run view --log-failed(or the repo's equivalent) to pull actionable logs. - Follow
docs/runbooks/ci-failures.mdfor triage order and escalation.
Phase 4: Merge (Consent + GO Required)
Merge preconditions (canonical — runbooks may add repo-specific items but must not remove these):
he-verify-releasedecision isGOin the active plan.- All required checks are green (local and/or CI).
- Evidence is linked in the plan (and PR body if present).
- No unresolved
criticalorhighreview findings.
When approved, merge using the repo policy in docs/runbooks/merge-change.md (often via gh pr merge).
Output
- PR opened/updated on GitHub.
## Pull Requestsection in the active plan kept current.
Exit Gate
- PR state matches the current phase (opened, updated, merged, or feedback addressed)
- Plan
## Pull Requestsection reflects current PR metadata - CI status is recorded
When Things Go Wrong
gh auth statusfails — auth must be resolved before any remote ops; do not proceed unauthenticated.- CI fails after push — triage using
docs/runbooks/ci-failures.md; do not merge with failing checks. - PR feedback contradicts the plan — update the plan first, then the code; plan is canonical.
- Merge conflicts — resolve before merge; never force-push without explicit consent.
Anti-Patterns to Avoid
| Anti-Pattern | Better Approach |
|---|---|
| Pushing to main without consent | Tiered consent: autonomous on feature branches, consent for main/merge/force-push |
| PR description replaces the plan | PR links to the plan; plan is the system of record |
| Merging with failing CI | CI is evidence; failures must be resolved |
| Force-pushing without explicit approval | Always get consent for destructive remote ops |
| Ignoring PR feedback | Respond by updating code + plan + evidence |
Transition Points
This skill is typically invoked from within the workflow rather than transitioning to a next phase. After merge, the workflow continues to he-learn.
