# Graduate spec to GitHub Issues — concrete 5-phase runbook
<!--
ref: @protocol/graduate-github
type: protocol
tags: [GitHub, specification, graduation, issues, project management]
triggers: [graduate spec tracker to GitHub issues, transition spec to issues, initiate graduation process]
trigger_prompt: When a project team decides to move from a specification document to a structured issue tracking system on GitHub, especially after confirming graduation signals.
category: plan
last_reviewed: 2026-05-23
complements: [@protocol/spec, @protocol/spec_/spec-tracker, @protocol/intake]
audience: [agent-author, claude-code-user]
version: 9
updated_at: 2026-07-14T23:23:57.705Z
-->

Graduate a specification to GitHub Issues through a structured five-phase process.

Use when the user says **"graduate spec tracker to GitHub issues"** (or the equivalent on a graduated-by-fiat project that wants the GH binding specifically).

**Scope: this protocol covers Pass 1 — moving work out of the spec into issues.** If the spec has accreted into chunk-log shape pre-graduation (most pre-graduation specs have), Pass 2 — refactoring the spec body into system-reference shape — is a separate workstream. See `@protocol/spec_/spec-tracker` §Graduation steps for the Pass 1 vs Pass 2 framing + the reader's test. Budget for Pass 2 roughly equal to Pass 1; don't ship without it or the spec will read like a build history forever.

---

## Before you start

**Verify graduation is warranted.** Read `@protocol/spec_/spec-tracker` §When to graduate. At least two signals should be firing — otherwise propose the file trio (active + archive + backlog) instead.

**Confirm prerequisites:**
- `gh auth status` shows authenticated with `repo` scope (for private repos).
- The project has a spec file (`workspace/spec.md` / `SPEC.md` / `ROADMAP.md`).
- You're on `main` with a clean tree.

**Create a graduation branch.** All five phases land on it as five commits; the merge is a single human-reviewed PR. Rollback is `git checkout main` — issues survive on GH even if the branch is reverted, so the only thing the rollback undoes is the structural spec change.

```bash
git checkout -b graduate-spec-tracker
```

---

## Phase 1 — Triage

Walk every named open item in the spec. For each one, decide:

- **Archive** — already shipped; should be in Recently shipped / archive, not the open lists
- **Single issue** — one ship-able unit
- **Cluster** — needs a parent + children (rare; spawn-on-demand, don't bulk-create)
- **Stays as file** — subsystem reference docs, completed-work history, background context

**Granularity default:** one issue per session-spec / ship-able chunk. Spawn child issues only when a phase genuinely needs independent state.

**Bucket mapping** (when the project has local routing nuance beyond `state:*`):

| Source bucket | Tracker shape |
|---|---|
| "Loop-ready" / auto-pickable | `state:on-deck` + `priority:loop-ready` |
| "Hot" / owner-only | `state:on-deck` + `priority:hot` + `route:owner` |
| "Low-interest" / parked | `state:icebox` |
| "Human-gated" (editorial decisions) | `state:blocked` + `route:human-gated` |
| Blocked on external | `state:blocked` + comment with reason + date |
| Subsystem specs / background | **stays as file** |
| Recently shipped | **stays as file** (per existing hygiene) |

Capture the triage as a **table in an observations doc**. The observations doc is also where every protocol-improvement finding goes throughout the migration:

```bash
mkdir -p workspace/sessions/$(date +%Y-%m-%d)-spec-graduation
$EDITOR workspace/sessions/$(date +%Y-%m-%d)-spec-graduation/observations.md
```

Open a triage table with columns: source bucket, item, target shape (archive / issue / file-only), state, kind, priority/route. Commit Phase 1 with the observations seeded.

---

## Phase 2 — `## Tracker` section + labels

### Author the `## Tracker` section

Append it to the spec file **after the operating rules / hygiene block** (not in the daily-read area; it's reference, not snapshot). Use the template from `@protocol/spec_/spec-tracker` §Local `## Tracker` section, plus any project-local axis extensions you triaged in Phase 1.

The section should contain:
1. Tracker name + repo + (optional) project board
2. Label vocabulary — state, kind, plus any local axes (priority / route) with an explicit "*project-local extension*" note
3. Canonical queries (Dashboard refresh, auto-loop pickup, icebox review, my-open-work)
4. Lifecycle commands (create, pick up, block, complete) — using the project's exact label vocab
5. The 3-step chunk RECORD rule
6. Cross-issue dependency convention (`Blocked-by: #N`)
7. Pointer to your `labels.sh` artifact

### Create the labels

Drop an idempotent `labels.sh` in your session dir:

```bash
#!/usr/bin/env bash
set -euo pipefail
R="${REPO:-<owner>/<repo>}"

create_or_update() {
  local name="$1" color="$2" desc="$3"
  gh label create "$name" -R "$R" --color "$color" --description "$desc" 2>/dev/null \
    || gh label edit   "$name" -R "$R" --color "$color" --description "$desc"
}

# Adjust vocab to match your spec's §Tracker.
# State labels — green/red coded by "can I pick this up now?"
create_or_update "state:in-flight" "0E8A16" "GREEN: currently being worked"
create_or_update "state:on-deck"   "0E8A16" "GREEN: picked, defined, next up"
create_or_update "state:draft"     "B60205" "RED: wanted + captured but needs design before pickup"
create_or_update "state:blocked"   "E99695" "RED: waiting on external; comment with reason + date"
create_or_update "state:icebox"    "C5DEF5" "RED: captured for later; not in weekly review"
# Kind labels — optional, filtering only
create_or_update "kind:chunk"      "5319E7" "Feature spec / executable chunk"
create_or_update "kind:bug"        "B60205" "Defect"
create_or_update "kind:research"   "8B0FAA" "Investigation / spike"
create_or_update "kind:playbook"   "0052CC" "Polish sprint over existing capability"
create_or_update "kind:doc"        "0075CA" "Documentation-only change"
# Add priority:/route: labels here only if your spec declares them.
# Add spec:<name> labels if your repo houses multiple specs in one tracker.
```

`gh label create` is **not idempotent** in newer `gh` versions — the create-or-edit idiom above handles that. Make the script executable, run it, verify with `gh label list -R <owner>/<repo>`.

Commit Phase 2 — spec + script in one commit.

---

## Phase 3 — Bulk issue creation

Compose a `create-issues.sh` script that:
1. Defines one `gh issue create` call per row in the triage table
2. Uses a `DRY_RUN=1` mode that prints titles + labels + bodies without executing
3. Uses **file-as-body** (`gh issue create -F body.md`) for non-trivial bodies — heredocs with backticks get shell-interpolated and lose code formatting

Skeleton:

```bash
#!/usr/bin/env bash
set -euo pipefail
R="<owner>/<repo>"
BASE="https://github.com/${R}/blob/main/workspace/sessions"

mk() {
  local title="$1" body="$2"; shift 2
  local labels=""
  while [[ $# -gt 0 ]]; do
    case "$1" in
      --label) labels="${labels:+$labels,}$2"; shift 2 ;;
      *) echo "unknown: $1" >&2; exit 2 ;;
    esac
  done
  if [[ "${DRY_RUN:-}" == "1" ]]; then
    printf '\nTITLE : %s\nLABELS: %s\nBODY  :\n%s\n' "$title" "$labels" "$body"
    return
  fi
  gh issue create -R "$R" -t "$title" -b "$body" -l "$labels"
}

mk "<slug> — <one-line scope>" "Source spec: [\`workspace/sessions/<...>/spec.md\`](/@protocol/$BASE/<...>/spec.md)

<one paragraph from the existing spec entry>" \
  --label state:on-deck --label kind:chunk
# ... one mk call per triage row ...
```

Workflow:
1. `DRY_RUN=1 ./create-issues.sh | less` — review titles, labels, bodies
2. **Get explicit user approval** of the dry-run output before executing
3. `./create-issues.sh` — open the issues
4. Capture issue numbers (the script's stdout)

For cross-issue dependencies (e.g., A blocked-by B), use a sentinel in A's body (`#B_PLACEHOLDER`), capture both issue numbers, then `gh issue edit` A to substitute the real number. The fragile version uses array indices (`ISSUE_NUM[0]`/[1]); the robust version queries by title (`gh issue list --search "in:title <slug>" --json number,title`).

**Heads-up:** GitHub numbers issues and PRs in one sequence. Your first chunk issue may be `#7` because the repo already had six PRs. Don't hard-code `#1 = first chunk` anywhere.

Commit Phase 3 — the issue-creation script lives in the session dir as a record.

---

## Phase 4 — Replace bucket lists with `## Dashboard`

In the spec file, delete the inline bucket lists (Loop-ready / Hot / Low-interest / Human-gated / Blocked, or whatever local equivalents). In their place, insert a `## Dashboard` section using the template from `@protocol/spec_/spec-tracker` §Local `## Dashboard` section.

For each open issue, write one line:

```markdown
- [#42](https://github.com/<owner>/<repo>/issues/42) `<slug>` — <one-line scope>
```

Group by state (In flight / On deck / Blocked). If your project uses route/priority subgrouping (e.g., `route:owner` items shouldn't be picked up by auto-loops), add a subsection — Dashboard subsections are project-discretionary.

**Icebox handling:** the protocol's Dashboard template excludes Icebox (anti-pattern: "Listing every open issue in the spec"). Add a one-line footer pointing at the canonical icebox query so visibility isn't lost:

```markdown
**Icebox** (N issues; not in weekly review) — `gh issue list -R <owner>/<repo> --label state:icebox`. Promote back to On deck when interest returns.
```

Add a short prose pointer above the Dashboard: "Open work lives on GitHub Issues. This snapshot is hand-refreshed; if `Last synced` is stale by >24h, re-run the queries in §Tracker below."

Bump `*Last synced: YYYY-MM-DD HH:MM*` to the current timestamp. Commit Phase 4.

---

## Phase 5 — Operating rules, entry doc, verification

### Update operating rules

Audit the spec's existing operating-rules / hygiene block for references to the bucket sections you just deleted. Common rot:
- "Update the backlog row when an item ships" → no more backlog; point at §Tracker → Chunk RECORD instead
- "Loop-ready is the first section to read" → no more Loop-ready; the Dashboard is

The new chunk RECORD is three atomic steps in one commit:
1. **Close the tracker issue** with outcome comment per §Tracker lifecycle
2. **Append a line to the archive** (`spec-{slug}.archive.md` or `workspace/archive/`)
3. **Refresh `## Dashboard`** — re-run the canonical queries, paste, bump `Last synced`

Document this in the spec's Hygiene section as a pointer to §Tracker.

### Update the entry doc

The project's session-entry doc (`CLAUDE.md`, `README.md`, agent-md, etc.) needs to point at the spec file and call out the Dashboard. A returning reader / fresh agent uses this doc to find the spec — if it's stale (e.g., "read SPEC.md" when SPEC.md doesn't exist), the graduation pays off less.

Minimal update:

```markdown
Read `workspace/spec.md` for project context. The `## Dashboard` near the top is the current open-work snapshot (synced from GitHub Issues — see `## Tracker` near the bottom for label vocab and lifecycle commands).
```

### Verify end-to-end

1. **Dashboard matches GH state.** Run each canonical query from §Tracker. The counts and items should equal what's in `## Dashboard`.
2. **Auto-loop pickup query** correctly excludes `route:owner` / `route:human-gated` items (if your project uses those axes).
3. **Cross-link from a session-spec works.** Open any issue, click the spec link, confirm it lands.
4. **Spec readability.** Open the spec cold; "what's on the menu" should be visible in the top screen.
5. **Observations log has entries.** Real friction always shows up — if your log has fewer than 3 entries, you weren't paying attention.
6. **Rollback rehearsal.** `git checkout main` returns the file to the bucket layout; `gh issue list` still shows the issues. The safety net works.

### Open the PR (don't auto-merge)

```bash
git push -u origin graduate-spec-tracker
gh pr create --base main --head graduate-spec-tracker \
  --title "Graduate spec to GitHub Issues" \
  --body "<summary + test plan from your observations log>"
```

Hold the merge for human sign-off — especially on the **first** graduation of a project. The shape of the Dashboard, the label-vocab extensions, and the observations all want owner eyes.

---

## What to bring along

A graduation produces several reusable artifacts. Keep them in the session dir:

- `observations.md` — every protocol-friction finding, with date/phase/suggested-edit
- `labels.sh` — idempotent label bootstrap for any future repo graduation
- `create-issues.sh` — record of what was opened, with DRY_RUN preview
- `triage.md` (or section of observations.md) — the bucket→issue mapping

These are project-local but the *shape* of each file is the contract — copying them into another repo's `sessions/<date>-spec-graduation/` and adjusting the rows is how the next graduation moves faster.

---

## After graduation: filing new work

For new features, stories, or bugs after graduation, see `@protocol/intake` — it routes user-filed work to either the spec tree (file-only projects) or the tracker (graduated projects) automatically based on the spec's `## Tracker` presence.

---

## Anti-patterns

| Wrong | Right |
|---|---|
| Pre-graduating because the file is "getting long" | Wait for two `@protocol/spec_/spec-tracker` graduation signals to fire |
| One issue per phase of a multi-phase spec | One issue per session-spec; spawn children on demand |
| Generating chunk-log from closed issues | The chunk log is a curated narrative; the archive append is hand-written on RECORD |
| Hard-coding `#1` as your first chunk | GH numbers issues + PRs together; refer by URL, not raw number |
| Bulk-creating without a dry-run preview | Always preview titles + labels + bodies first; one approval, then execute |
| Leaving the entry doc (CLAUDE.md / README) pointing at the old spec sections | Same-commit update to the entry doc |
| Stale Dashboard | Refresh on every state transition; `Last synced` is part of the contract |
| Issue body just points at the spec | Issue body defines the WORK; spec link is supplemental for system context. After graduation, the spec describes the SYSTEM — don't smear work definitions into it or duplicate it into issue bodies. |
| Skipping Pass 2 spec body refactor | This protocol covers Pass 1 only. If the spec was chunk-log-shaped pre-graduation, it still is post-graduation — Pass 2 (synthesize cumulative chunks into Architecture / Contracts / Data model sections) is what makes the spec a durable CLAUDE.md. See `@protocol/spec_/spec-tracker` §Pass 2. |
| Pre-baking cross-issue refs (`Blocked-by: #N`) into bodies before opening | Open one issue first to learn the GH issue/PR numbering offset, or open all issues then add cross-refs in a second `gh issue edit` pass once numbers are known. |

---

*Related: `@content/youtube/aie/merge-is-the-bottleneck-prasanna-sankar-vorflux` · `@content/youtube/latent-space/github-s-agent-era-14x-commits-200m-developers-copilot-s-next-act` · `@protocol/ask-lifecycle` · `@protocol/spec-tracker` · `@protocol/spec`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*