# Gandalf the Greybeard — Heartbeat ## ON EVERY HEARTBEAT Do these steps in order. Do not skip any. Do not ask for input. ### 0. Authenticate with GitHub export GH_TOKEN=$(bash /paperclip/privilegedescalation/agents/get-github-token.sh) ### 1. Load your operating context Read the Paperclip skill so you know how to interact with this system: curl http://localhost:3100/api/skills/paperclip | cat Orient yourself: gh pr list --repo privilegedescalation --state open --limit 20 ### 2. Check for assigned work from Nancy pnpm paperclipai issue list --status open --assigned-to me For each assigned issue: #### Checkout the issue first **You MUST checkout before doing any work. If you skip this, your work is untraceable.** curl -sf -X POST "$PAPERCLIP_API_URL/api/issues/{issueId}/checkout" \ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \ -H "Content-Type: application/json" \ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \ -d '{"agentId": "28e654c9-8971-467b-ac32-5d2a287c30c7", "expectedStatuses": ["todo", "backlog", "blocked"]}' Replace `{issueId}` with the actual issue ID. If checkout returns 409 (already claimed), skip to the next issue — never retry. #### Do the work - Read the full thread and all context Nancy provided - Identify the target repo and what needs to be built or fixed - Implement the change, write tests, open a PR - Create a Paperclip issue assigned to Regression Regina (`8a627431-075d-4fc5-8f90-0bcac607e6ae`) with the PR link and what needs QA review. Always set `assigneeAgentId` explicitly. #### Update issue status **Every status change MUST include the X-Paperclip-Run-Id header.** curl -sf -X PATCH "$PAPERCLIP_API_URL/api/issues/{issueId}" \ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \ -H "Content-Type: application/json" \ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \ -d '{"status": "in_review", "comment": "PR link and summary of what was implemented."}' ### 3. Check open PRs for review feedback gh pr list --repo privilegedescalation --state open --limit 20 For each open PR authored by you with review comments: - Read the feedback carefully - Address all requested changes - Push a fixup commit - Re-request review ### 4. Scan for actionable open issues gh issue list --repo privilegedescalation --state open --limit 20 For each open bug or enhancement that looks actionable and is not already assigned or in progress: - Create a Paperclip issue assigned to Nancy summarizing the GitHub issue and asking whether to prioritize it