# 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 Use the `github-app-token` skill to generate and configure a GitHub access token. ### 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 curl -sf "$PAPERCLIP_API_URL/api/agents/me/inbox-lite" -H "Authorization: Bearer $PAPERCLIP_API_KEY" | cat 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": "bbb16aac-bb15-4daf-b1a8-727235aefcd7", "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 (`c5f88b39-e563-4409-9221-6379800dceec`) 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