Phase 1: human to-do¶
Things only a person can do. The developer agent never ticks these. Each item names who does it.
Step 1: modes¶
- Leave
GRAFT_MODE_CEILINGunset (report) on every deployment until the Phase 1 rollout runbook says otherwise. Who: operator. - Decide which manifest each deployment uses. Evaluation-only deployments register
github/app-manifest.report.json. Who: product owner. - Run
pnpm graft mode refresh-permissions --installation <id>once per existing installation after deploying step 1, thenpnpm graft mode show --installation <id>and check the permissions line. Who: operator. - On a sandbox PR, check that the
graft/policycheck details start with the "Graft mode: report" line and the check is stillneutral; thenmode set --policy enforcewith the ceiling atreportand confirmshowreportseffective report ceiling. Who: repo owner.
Step 2: approvals¶
- Accept the new
members: readpermission and themembershipandteamevents on every installation, then runpnpm graft mode refresh-permissions --installation <id>and check the permissions line. Who: org owner, then operator. - Before any repository enforces: make
graft/policyrequired with the Graft App as the expected source (branch protection "required status checks", source app set). With "any source", a commit status or check namedgraft/policyfrom another app or a workflow could satisfy it. Who: repo admin. - Do not enforce on a repository that uses a merge queue.
merge_groupis not handled in Phase 1. Who: operator. - On a sandbox repository with the ceiling at
enforce: set--policy enforceand check, on one PR, afailurewith no approval, asuccessafter a team member approves, afailureafter a push (stale), and aneutralwithin about a minute ofmode set --policy report. Who: repo owner. - Until every server and worker runs the step 7 build, lower
GRAFT_MODE_CEILINGwith a full stop. After that, a rolling restart is safe (step 7, D2). Who: operator. - ~~Think twice before enforcing on a public repository.~~ Decided by step 7 D10:
mode set --policy enforceon a public repository needs--public, the doctor warns (public_enforce), and the runbook keeps public repositories in report mode in Phase 1. Who: operator. - Run the step 2 manual smoke test (spec §15: report-mode would-be line, enforce with the ceiling, rollback) against a real or tunnelled App and record it in the PR description; the developer agent ran only the offline suite. Who: operator.
Step 3: break-glass¶
- Create the
graft:break-glasslabel in each pilot repository, with a description saying it bypasses the Graft policy for one commit and is audited. Who: repo admin. - Tell the team who can use it (maintain or admin) and that every use appears in the PR comment and in
pnpm graft audit list. Who: product owner. - On a sandbox PR in enforce mode: label as a maintainer →
success; push → back to the normal conclusion; label as a triage user → ignored. Then runpnpm graft audit list --repo …and check all three rows. Who: repo owner. - Check the issue events API on a real PR (T1 could not, offline): the
labeledevent'sactoris the person who added the label, events are listed oldest first, and the installation token can read them withissues: read/pull_requests: read. Who: operator. - Run the step 3 manual smoke test against a real or tunnelled App (not run by the developer agent). Who: operator.
- Measure how late the issue events API lists a label change (step 3 review 1, finding 1): add and remove the label a few times and note how long after each webhook the
labeled/unlabeledevent appears inGET /issues/{n}/events. Graft retries a label run for about 15 minutes (5 retries, backoff from 30 s); if the lag is longer, the label is ignored asactor_unknown. Also check whether the response carriesLink: rel="last"(review 1, nit 8: reading the newest page first). Who: operator. - On the sandbox PR, check the review 1 cases: a maintainer labels (success), a triage user removes and re-adds the label (normal conclusion, a
removedrow for the removal and anignoredrow for the triage user); push and push the labelled commit back (normal conclusion). Who: repo owner.
Step 4: guard detection¶
- Accept
statuses: readand thecheck_suiteandstatusevents on every installation, thenpnpm graft mode refresh-permissions --installation <id>. Who: org owner, then operator. - On a sandbox repository, merge a PR that breaks a check on
main, then push one more commit. Check that a guard comment appears on the culprit PR and thatpnpm graft guard list --repo …showsculprit_found. Then re-run a failing check until it passes on a fresh break, and check that the event isflakywith no comment. This also checks the T1 (a) answer: the guard must see other apps'check_run.completeddeliveries. Who: repo owner. - Tell pilot teams that the guard comments on merged PRs that broke
main, and that nothing is reverted until they opt in toguard_mode: enforce(step 5). Who: product owner. - Run the step 4 manual smoke test (spec §15:
push.default.json, thencheck_run.completed.json, throughpnpm webhook:sendwith a dev server and worker) and record it in the PR description; the developer agent ran only the offline suite. Who: operator.
Step 5: revert PRs¶
- Decide which deployments get the full manifest with
contents: write. Evaluation-only deployments keep the report manifest and can never open a revert. Who: product owner. - Accept
contents: writeon every installation that will enforce the guard, thenpnpm graft mode refresh-permissions --installation <id>. Who: org owner, then operator. - Create the
graft:revertlabel in each pilot repository, with a description saying Graft's guard opened the PR. Who: repo admin. - If a team wants auto-merged reverts: turn on "Allow auto-merge" and "Automatically delete head branches" in the repository settings, make sure the default branch has required checks, and add
guard.auto_merge_revertsin a reviewed PR. Who: repo admin. - On a sandbox repository with the ceiling at
enforceand--guard enforce: merge a PR that breaks a check, push one more commit, and check that one revert PR opens with the label, the fixed title and body and the author mention; thatpnpm graft guard listshowsrevert_opened; that merging it givesreverted. Then breakmainwith a PR whose file is changed again by the next merge and checkneeds_humanwith the path listed. Thenmode set --guard reportand repeat the first case: a "would open" comment only. Who: repo owner. - Check the T1 answers on real GitHub that the offline build could not:
sha: nullon a directory entry (type: tree) inPOST …/git/treeswithbase_tree, theworkflowspermission rule for a commit touching.github/workflows/, whetherPOST …/issues/{n}/labelscreates a missing label, theenablePullRequestAutoMergeerrors (auto-merge not allowed, clean status, already enabled) and theclientMutationIdecho, that a PR opened with an installation token triggerspull_requestworkflows, and thatGET …/pulls?head=<owner>:<branch>&state=allfinds a closed PR. See decisions.md (T1). Who: operator. - Step 4 review 2, finding B (still open): on the sandbox, two workflows with the same job name, one red then one green later, must still give a red result; and a "Re-run failed jobs" that ends green must give
flaky. Who: repo owner. - Run the step 5 manual smoke test (spec §18) and record it in the PR description; the developer agent ran only the offline suite. Who: operator.
Step 6: MCP server¶
- Decide who gets tokens. Only agents that already have read access to the repository (spec §4, features/mcp.md). Write it in the pilot runbook. Who: product owner.
- Expose
/mcpthrough the proxy in front of the Graft server (same host as the webhook receiver), over HTTPS only. Check that the proxy does not log theAuthorizationheader. The failed-auth limit is per client IP, so behind a proxy every client shares the proxy's address unlessGRAFT_TRUST_PROXYis set; see the step 7 item below (step 7 D6). Who: operator. - Set
GITHUB_APP_SLUGon the server before any pilot repository turnsmcp_writeon.open_changere-records a PR Graft opened, after a crash lost its record, only when it can recognise Graft's own bot (<slug>[bot]); without the slug such a PR keeps no D19 exclusion of its commit authors (review 1, finding 5). Who: operator. - Create one token per pilot repository with
pnpm graft mcp-token create, store it in the agent's secret store, and never paste it into a PR, issue or chat. Who: operator. - On a sandbox repository: configure an MCP client (for example Claude Code with an HTTP server entry and a bearer header) and call
get_statuson an open PR andget_policy; thenreport_provenancewith a different agent name and check the comment line and the verdict; thenopen_changewithmcp_writeoff (refused); then, with the ceiling atenforceandmode set --mcp-write on, open a PR from a pushed branch and check its body trailers and that your own approval does not count. Thenmcp-token revokeand check the next call fails. Who: repo owner. - Check the T1 answers on real clients that the offline build could not: a 2025-era client (protocol
2025-11-25) and a 2026-07-28 client both work against the stateless endpoint; and, on real GitHub, thePOST …/pulls422 bodies ("A pull request already exists", "No commits between") andGET …/pulls?head=<owner>:<branch>&base=<b>&state=open(decisions.md, T1). Who: operator. - Run the step 6 manual smoke test (spec §16:
pnpm dev:serverandpnpm dev:worker, a token frompnpm graft mcp-token create,tools/listandget_statuswithcurl, a wrong token, a revoked token,open_changerefused, themcp calllog line without the token) and record it in the PR description; the developer agent ran only the offline suite. Who: operator.
Step 7: security review, pilots and gate¶
- Read the security review (step-7-security-review.md) and sign off its verdict before any repository leaves stage 2. Who: product owner.
- Recruit three more pilot teams, so five installations take part (development plan, "Where the 5 pilot teams come from"), and onboard each with Phase 0 onboarding and runbook stage 1. Who: product owner.
- Set
GRAFT_TRUST_PROXYto the proxy's addresses on every server process, and check with two clients that one's bad tokens do not lock the other out. Who: operator. - Check on real GitHub that
GET …/pulls/{n}/commitsreturnscommit.verification.verifiedfor signed commits from an agent's SSH or GPG key, andfalsefor unsigned ones (D8). Who: operator. - Before the
web-flowrule is relaxed (recommended before runbook stage 6), checkweb-flowon real GitHub (step 7 review 1, finding 2): with a user token, create a commit through the contents API (PUT /repos/{o}/{r}/contents/{path}) with a customauthor(another user's name and email), and record itscommit.verification.verifiedand its committer login; do the same with noauthor, and through the web UI. Graft treats everyweb-flowcommit on an MCP-opened PR as unverified. If GitHub never signs aweb-flowcommit whose author differs from the requester, record it in decisions.md: the rule can then be relaxed in a reviewed change. Who: operator. - Have every agent that uses
open_changesign its commits (SSH signing key on the agent's GitHub account). Who: product owner, with each pilot. - Run the runbook per pilot repository (phase-1-runbook.md) and keep its stage record outside git. Who: operator, repo admin, tech lead.
- Weekly gate review:
baseline --period phase1per repository,gate report --phase 1for the five installations, the runbook's stage checks, a short note. Who: product owner and operator. - Calling the Phase 1 gate. Call it at the first weekly review where the gate verdict (measured, not the preview) is PASS or FAIL and at least 4 weeks after the third pilot entered stage 3. If it is still INSUFFICIENT DATA 8 weeks after that, decide with the pilots whether to extend 2 weeks or record a FAIL for lack of enforcement. Judge pilot retention (reported, target 3 of 5) at the same time. Record the verdict, window, the four measured values, retention and the report's SHA-256 in
docs/plan/development-plan.md. Who: product owner. - Run the enforce sandbox once: add the sandbox entry with
"mode": "enforce", set the ceiling and--policy enforcefor it, runpnpm graft e2e run(e01), then roll the sandbox back to report (e2e runbook). Who: repo owner. - Check guard and MCP enforcement by hand on the sandbox (no live e2e scenario covers them, D21): the step 5 and step 6 sandbox checks above, with the step 7 build. Who: repo owner.
- Run the step 7 manual smoke test (spec §15: the Phase 1 gate report on seeded data with
--checkexiting 4, then a worker withGRAFT_MODE_CEILING=reportand a server withenforce, andopen_changethroughcurlansweringmcp_write_offwith reasonceiling) and record it in the PR description; the developer agent ran only the offline suite. Who: operator.
Pending product decisions (step 7)¶
The spec raised five questions; D8 is decided (below), and four remain that a person has not answered yet. The build uses the spec's current values; each one is a one-line change where it lives in code.
- ~~D8, verified commits on MCP-opened PRs.~~ Not a pending decision: decided by the spec (D8), and a
web-flowcommit counts as unverified too (step 7 review 1, finding 2).REQUIRE_VERIFIED_COMMITSinsrc/modules/policy/facts.tsis kept for tests and reading only; turning it off reopens step 6 residual risk 2 and needs a new security review. Who: product owner. - The gate thresholds (targets 30%, −50%, 80%, no rise; the minimums; the 14-day defect lag; p < 0.05; the point estimate from 400; the 0.05 slack). All in the
PHASE1object ofsrc/pilot/gate-phase1.ts. Who: product owner. - The runbook numbers (stage 2: 30 merged PRs, 14 days, at most 10% would-fail at merge). In
RUNBOOK_STAGE2(src/pilot/gate-phase1.ts); the runbook quotes them and U-DOC-3 checks that it does, so a change is that constant plus the matching runbook line. The other stage criteria (14 days per stage, 3 reverts before stage 5, 7 days of MCP reads) are runbook text only. Who: product owner. - Pilot retention (reported, not decided: target 3 of 5; an installation counts when it is at least 30 days old and had a delivery in the last 7 days).
PHASE1.retentioninsrc/pilot/gate-phase1.ts. Who: product owner. - The D21 e2e scenario.
e01's steps and expectations are theE01_STEPStable insrc/e2e/scenarios/e01.ts; dropping the scenario is removinge01fromSCENARIOSinsrc/e2e/scenarios/index.ts. Who: product owner.