{"name":"blocks","title":"Blocks interaction","description":"Low-level primitives for talking to Blocks: resolve a workspace, open or read a session, collect GitHub review evidence, classify status, and wait with a visible bound. Symptoms: ask Blocks, start a Blocks session, what is Blocks doing, await the Blocks response. This is the plumbing other skills call — for the review-until-clean loop on a pull request use request-blocks-review.","compatibility":"Blocks REST Sessions API or Blocks GitHub integration; direct sessions require a workspace-scoped API key, and GitHub status requires authenticated gh.","allowedTools":"Read Grep Glob Bash","license":"MIT","kind":"requestOnly","useWhen":"asked for by name: GitHub-hosted review sessions and bounded status waits","group":"workflow","lifecycle":"release","version":"1.0.0","author":"crissmoldovan","install":["npx skills add crissmoldovan/agent-skills --skill blocks"],"asks":["Resolve the Blocks workspace for this repository. If it is not uniquely known,\nask me for a workspace URL or ID. Start a session and visibly await its final\nmessage for up to ten minutes.","Get Blocks status for PR 42 against this request baseline. Include comments,\nreviews, all inline comments, and distinguish acknowledgement from completion."],"commands":[],"documents":[],"body":"# Blocks interaction\n\nGeneric Blocks interaction primitives for other skills and workflows. This skill\nowns workspace resolution, REST sessions, GitHub evidence collection, status\nclassification, and visible bounded waits. It does not own code-review policy,\nfix findings, decide severity policy, or loop a PR to green; use the public\n`request-blocks-review` skill for that workflow.\n\n## When to Use\n\n- “Ask Blocks,” “start a Blocks session,” “what is Blocks doing?”, or “await the\n  Blocks response.”\n- Another skill needs Blocks workspace/session/status/wait primitives.\n- A caller needs to distinguish acknowledgement from terminal GitHub evidence.\n\n## Workspace Resolution\n\nBlocks REST credentials are workspace-scoped. Before a direct REST call:\n\n1. Prefer a configured repository → workspace mapping.\n2. Otherwise parse the workspace UUID after `/app/` from a Blocks workspace,\n   settings, or session URL such as:\n\n   ```text\n   https://blocks.team/app/<workspace-id>/settings/api-keys\n   ```\n\n3. If neither yields exactly one workspace, ask the user to confirm a workspace\n   URL or ID. Never choose whichever installed key happens to work.\n4. Use a neutral local profile name. Credentials resolve from\n   `BLOCKS_API_KEY_<PROFILE>` or, on macOS, Keychain service\n   `blocks-api-key-<profile>`. Never print keys or pass them as CLI arguments.\n\n## Direct REST Sessions\n\nThe documented base is `https://api.blocks.team/rest/v1`:\n\n| Action | Endpoint/helper |\n|---|---|\n| Create | `POST /sessions` |\n| Inspect | `GET /sessions/{id}` |\n| Follow up | `POST /sessions/{id}/messages` |\n| Wait | Poll returned `_links.final_message.href` |\n\nA final-message page with empty `items` is pending. A non-empty assistant\n`final_message` is terminal for that turn. Blocks documents no session status\nenum, blocking wait endpoint, completion webhook, or GitHub-comment-to-session\nmapping. Treat returned `_links` URLs as opaque and validate their official\norigin/path/filter contract before use.\n\n```bash\nnode skills/blocks/scripts/blocks-session-cli.mjs create \\\n  --profile <workspace-profile> --agent claude --message \"...\" \\\n  --wait --timeout 600\n```\n\n## GitHub Status\n\nGitHub-originated review evidence remains GitHub-authoritative:\n\n- top-level PR comments;\n- formal reviews;\n- all paginated inline review comments;\n- **check runs on the head commit** — a completed `Blocks PR Review` check;\n- PR open/closed state;\n- Blocks dashboard links included in comments.\n\n**Read every channel, not the one you expect.** Which one a finished review arrives\non depends on how the integration is configured: one repository gets a summary\ncomment naming the head, another gets only help text and reports the verdict as a\ncheck. Reading comments alone leaves a completed, clean, zero-finding review looking\nlike `reviewing` until the wait times out. A completed check means the review\n**finished**, never that it was clean — what it found is still decided by the inline\ncomments and by the check's **own summary**, or a false clean would ride in on a green\ncheck. Blocks concludes its check `success` on runs that never happened: a logged-out\nagent's \"Authentication failed … Not logged in\" and a \"Rate limit or quota exceeded\"\nnotice both went green, and both used to read as clean. Only a check inside the\nrequest window counts — re-requesting on an unchanged head creates no new run, and the\nprevious round's check must not answer for this one.\n\nAlways compare against a baseline containing timestamp and stable IDs. Help text,\neyes reactions, queue messages, and “taking a look” are nonterminal. Return one of\n`requested`, `reviewing`, `clean`, `findings`, `failed`, or `pr_closed`.\n\n`failed` means Blocks posted its own failure notice — logged out, or out of quota —\nas a comment or as the check's summary: the review did not run, nothing more is\ncoming, and it is never acceptable. It is terminal so a wait stops and says so instead\nof burning its timeout. Re-requesting does not cure it; the workspace owner reconnects\nthe agent's credential in the Blocks dashboard, or the quota resets.\n\nBlocks states completion in a top-level comment as often as in a formal review. A\npost-baseline comment that names its own completion is terminal even when no review\nwas submitted; its wording then chooses the state — outstanding findings mean\n`findings`, a fixed or empty finding list means `clean`. Acknowledgement wording\nstill wins: a comment that merely quotes the words a finished review would use\nremains nonterminal, and so does a partial pass that makes the claim and then\nwithdraws it (“reviewed up to `packages/guards/` … I need another pass”).\n\n**Completion is a past-tense claim, not a phrase.** Do not match a fixed list of\nopeners. This classifier once demanded the literal “reviewed PR” or “review\ncomplete”, and a real verdict opening “Reviewed \\`67b6d36\\` and its\ndocumentation-only diff” matched nothing — a caller waited forty minutes for a\nverdict that had arrived in four seconds. Recognise the claim, then let two things\nveto it: courtesy wording, and an admission of unfinished work.\n\n**`clean` must be earned; ambiguity means `findings`.** A verdict is clean only when\nit states its own emptiness — no/zero findings, `Findings: none`, a table row\nreporting `0`, LGTM with nothing contrasted against it. A verdict that merely fails\nto mention findings is **not** clean. The three ways to be wrong do not cost the\nsame: a false `findings` costs a reader the seconds it takes to open the comment, a\nfalse nonterminal costs a timeout, and a false `clean` accepts an unreviewed or\nunclean head — the only one of the three that merges. Bias every uncertain case away\nfrom `clean`.\n\n**Never decide from a bare mention.** “No new severity ≥7 findings” contains the\nword `findings`; so does a `/findings` path segment in a dashboard URL, and so does\na quoted verdict from an earlier round that the next sentence retracts. Scope every\nmention — negated, resolved, quoted, or outstanding — instead of testing whether the\nnoun appears. Watch for the inversion too: “zero of these findings have been\naddressed” is the strongest possible findings statement and reads, to a naive\nstripper, like the weakest.\nA corrective negation scopes over its second half only. In “this was an environment\nsetup issue, not a test failure” the `not` clears “a test failure”; “an environment\nsetup issue” is set aside only because it also names the reviewer's own sandbox —\n“this is not a test failure but a real bug” still reports the bug.\n\n```bash\nnode skills/blocks/scripts/blocks-review-cli.mjs status \\\n  --repo <owner/repo> --pr <N> --requested-at <ISO>\n```\n\n**A clean verdict is not acceptance.** `status` also reports whether the verdict can\nactually be acted on, and refuses for a named reason when it cannot. Three things\nmust hold at once: the state is `clean`, the verdict covers the head under\nconsideration, and CI **succeeded on that same commit**.\n\nBoth halves were learned from real failures. A review names the commit it read\n(\"Reviewed PR #29 at `a0eef8b`\"); every push moves the branch, and a verdict for the\nprevious head says nothing about the current one while reading exactly like one that\ndoes. Separately, `gh pr checks` reported pass while the run underneath belonged to\nthe previous head, because the new run had not registered yet — so **key CI on the\nsha, never on the check name**. A run that has not finished is not a pass.\n\nA verdict that names no commit is dated against the head rather than refused: one\nposted after the head was committed cannot have read an earlier one. Refusing it for\nits wording would be the same mistake one layer up.\n\n**The latest verdict decides, and acceptance asks that same verdict.** Within the\n`--requested-at` window the most recent finished verdict chooses the state — an\nolder clean round never outvotes a newer one with findings — and head coverage is\nread from that verdict alone, never from whichever comment happens to name the head.\nWhen they came from different comments, a stale clean was accepted for a head it never\nread (cue-ui#94). A latest verdict naming an older head is refused even if an earlier\none named the current head; re-request the review. Help text and acknowledgements are\nnever a verdict, however recent.\n\n## Visible Bounded Wait\n\nMirror Trigger.dev's active-wait contract, not its transport:\n\n- keep one tracked operation active;\n- surface waiting progress;\n- combine caller cancellation with a hard deadline;\n- stop on terminal evidence;\n- return latest current state on timeout;\n- propagate non-timeout failures.\n\nTrigger.dev can subscribe to a run stream. Blocks REST and GitHub review status\nuse documented polling, so poll conservatively rather than busy-waiting.\n\n## Usage Examples\n\n```text\nResolve the Blocks workspace for this repository. If it is not uniquely known,\nask me for a workspace URL or ID. Start a session and visibly await its final\nmessage for up to ten minutes.\n```\n\n```text\nGet Blocks status for PR 42 against this request baseline. Include comments,\nreviews, all inline comments, and distinguish acknowledgement from completion.\n```\n\n## Pitfalls\n\n- Workspace key success does not prove it is the intended workspace.\n- Dashboard URLs are not REST links; use only returned `_links` for API calls.\n- Never send a follow-up merely to check status; follow-ups can interrupt work.\n- Never silently hide a wait by redirecting all progress to a file.\n- A timeout is nonterminal and must return current state explicitly.\n\n## Verification\n\n- [ ] Workspace resolved uniquely or the user was asked to confirm URL/ID.\n- [ ] Credential profile is neutral and workspace-scoped.\n- [ ] Returned REST links passed strict official URL validation.\n- [ ] GitHub evidence uses timestamp plus stable-ID baseline and pagination.\n- [ ] Wait is visible, cancellation-aware, and deadline-bounded.\n- [ ] Timeout does not claim completion or failure.\n","bodyHtml":"<h2 id=\"blocks-interaction\">Blocks interaction</h2>\n<p>Generic Blocks interaction primitives for other skills and workflows. This skill\nowns workspace resolution, REST sessions, GitHub evidence collection, status\nclassification, and visible bounded waits. It does not own code-review policy,\nfix findings, decide severity policy, or loop a PR to green; use the public\n<code>request-blocks-review</code> skill for that workflow.</p>\n<h3 id=\"when-to-use\">When to Use</h3>\n<ul>\n<li>“Ask Blocks,” “start a Blocks session,” “what is Blocks doing?”, or “await the\nBlocks response.”</li>\n<li>Another skill needs Blocks workspace/session/status/wait primitives.</li>\n<li>A caller needs to distinguish acknowledgement from terminal GitHub evidence.</li>\n</ul>\n<h3 id=\"workspace-resolution\">Workspace Resolution</h3>\n<p>Blocks REST credentials are workspace-scoped. Before a direct REST call:</p>\n<ol>\n<li><p>Prefer a configured repository → workspace mapping.</p>\n</li>\n<li><p>Otherwise parse the workspace UUID after <code>/app/</code> from a Blocks workspace,\nsettings, or session URL such as:</p>\n<pre><code class=\"language-text\">https://blocks.team/app/&lt;workspace-id&gt;/settings/api-keys\n</code></pre>\n</li>\n<li><p>If neither yields exactly one workspace, ask the user to confirm a workspace\nURL or ID. Never choose whichever installed key happens to work.</p>\n</li>\n<li><p>Use a neutral local profile name. Credentials resolve from\n<code>BLOCKS_API_KEY_&lt;PROFILE&gt;</code> or, on macOS, Keychain service\n<code>blocks-api-key-&lt;profile&gt;</code>. Never print keys or pass them as CLI arguments.</p>\n</li>\n</ol>\n<h3 id=\"direct-rest-sessions\">Direct REST Sessions</h3>\n<p>The documented base is <code>https://api.blocks.team/rest/v1</code>:</p>\n<table>\n<thead>\n<tr>\n<th>Action</th>\n<th>Endpoint/helper</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Create</td>\n<td><code>POST /sessions</code></td>\n</tr>\n<tr>\n<td>Inspect</td>\n<td><code>GET /sessions/{id}</code></td>\n</tr>\n<tr>\n<td>Follow up</td>\n<td><code>POST /sessions/{id}/messages</code></td>\n</tr>\n<tr>\n<td>Wait</td>\n<td>Poll returned <code>_links.final_message.href</code></td>\n</tr>\n</tbody></table>\n<p>A final-message page with empty <code>items</code> is pending. A non-empty assistant\n<code>final_message</code> is terminal for that turn. Blocks documents no session status\nenum, blocking wait endpoint, completion webhook, or GitHub-comment-to-session\nmapping. Treat returned <code>_links</code> URLs as opaque and validate their official\norigin/path/filter contract before use.</p>\n<pre><code class=\"language-bash\">node skills/blocks/scripts/blocks-session-cli.mjs create \\\n  --profile &lt;workspace-profile&gt; --agent claude --message &quot;...&quot; \\\n  --wait --timeout 600\n</code></pre>\n<h3 id=\"github-status\">GitHub Status</h3>\n<p>GitHub-originated review evidence remains GitHub-authoritative:</p>\n<ul>\n<li>top-level PR comments;</li>\n<li>formal reviews;</li>\n<li>all paginated inline review comments;</li>\n<li><strong>check runs on the head commit</strong> — a completed <code>Blocks PR Review</code> check;</li>\n<li>PR open/closed state;</li>\n<li>Blocks dashboard links included in comments.</li>\n</ul>\n<p><strong>Read every channel, not the one you expect.</strong> Which one a finished review arrives\non depends on how the integration is configured: one repository gets a summary\ncomment naming the head, another gets only help text and reports the verdict as a\ncheck. Reading comments alone leaves a completed, clean, zero-finding review looking\nlike <code>reviewing</code> until the wait times out. A completed check means the review\n<strong>finished</strong>, never that it was clean — what it found is still decided by the inline\ncomments and by the check&#39;s <strong>own summary</strong>, or a false clean would ride in on a green\ncheck. Blocks concludes its check <code>success</code> on runs that never happened: a logged-out\nagent&#39;s &quot;Authentication failed … Not logged in&quot; and a &quot;Rate limit or quota exceeded&quot;\nnotice both went green, and both used to read as clean. Only a check inside the\nrequest window counts — re-requesting on an unchanged head creates no new run, and the\nprevious round&#39;s check must not answer for this one.</p>\n<p>Always compare against a baseline containing timestamp and stable IDs. Help text,\neyes reactions, queue messages, and “taking a look” are nonterminal. Return one of\n<code>requested</code>, <code>reviewing</code>, <code>clean</code>, <code>findings</code>, <code>failed</code>, or <code>pr_closed</code>.</p>\n<p><code>failed</code> means Blocks posted its own failure notice — logged out, or out of quota —\nas a comment or as the check&#39;s summary: the review did not run, nothing more is\ncoming, and it is never acceptable. It is terminal so a wait stops and says so instead\nof burning its timeout. Re-requesting does not cure it; the workspace owner reconnects\nthe agent&#39;s credential in the Blocks dashboard, or the quota resets.</p>\n<p>Blocks states completion in a top-level comment as often as in a formal review. A\npost-baseline comment that names its own completion is terminal even when no review\nwas submitted; its wording then chooses the state — outstanding findings mean\n<code>findings</code>, a fixed or empty finding list means <code>clean</code>. Acknowledgement wording\nstill wins: a comment that merely quotes the words a finished review would use\nremains nonterminal, and so does a partial pass that makes the claim and then\nwithdraws it (“reviewed up to <code>packages/guards/</code> … I need another pass”).</p>\n<p><strong>Completion is a past-tense claim, not a phrase.</strong> Do not match a fixed list of\nopeners. This classifier once demanded the literal “reviewed PR” or “review\ncomplete”, and a real verdict opening “Reviewed `67b6d36` and its\ndocumentation-only diff” matched nothing — a caller waited forty minutes for a\nverdict that had arrived in four seconds. Recognise the claim, then let two things\nveto it: courtesy wording, and an admission of unfinished work.</p>\n<p><strong><code>clean</code> must be earned; ambiguity means <code>findings</code>.</strong> A verdict is clean only when\nit states its own emptiness — no/zero findings, <code>Findings: none</code>, a table row\nreporting <code>0</code>, LGTM with nothing contrasted against it. A verdict that merely fails\nto mention findings is <strong>not</strong> clean. The three ways to be wrong do not cost the\nsame: a false <code>findings</code> costs a reader the seconds it takes to open the comment, a\nfalse nonterminal costs a timeout, and a false <code>clean</code> accepts an unreviewed or\nunclean head — the only one of the three that merges. Bias every uncertain case away\nfrom <code>clean</code>.</p>\n<p><strong>Never decide from a bare mention.</strong> “No new severity ≥7 findings” contains the\nword <code>findings</code>; so does a <code>/findings</code> path segment in a dashboard URL, and so does\na quoted verdict from an earlier round that the next sentence retracts. Scope every\nmention — negated, resolved, quoted, or outstanding — instead of testing whether the\nnoun appears. Watch for the inversion too: “zero of these findings have been\naddressed” is the strongest possible findings statement and reads, to a naive\nstripper, like the weakest.\nA corrective negation scopes over its second half only. In “this was an environment\nsetup issue, not a test failure” the <code>not</code> clears “a test failure”; “an environment\nsetup issue” is set aside only because it also names the reviewer&#39;s own sandbox —\n“this is not a test failure but a real bug” still reports the bug.</p>\n<pre><code class=\"language-bash\">node skills/blocks/scripts/blocks-review-cli.mjs status \\\n  --repo &lt;owner/repo&gt; --pr &lt;N&gt; --requested-at &lt;ISO&gt;\n</code></pre>\n<p><strong>A clean verdict is not acceptance.</strong> <code>status</code> also reports whether the verdict can\nactually be acted on, and refuses for a named reason when it cannot. Three things\nmust hold at once: the state is <code>clean</code>, the verdict covers the head under\nconsideration, and CI <strong>succeeded on that same commit</strong>.</p>\n<p>Both halves were learned from real failures. A review names the commit it read\n(&quot;Reviewed PR #29 at <code>a0eef8b</code>&quot;); every push moves the branch, and a verdict for the\nprevious head says nothing about the current one while reading exactly like one that\ndoes. Separately, <code>gh pr checks</code> reported pass while the run underneath belonged to\nthe previous head, because the new run had not registered yet — so <strong>key CI on the\nsha, never on the check name</strong>. A run that has not finished is not a pass.</p>\n<p>A verdict that names no commit is dated against the head rather than refused: one\nposted after the head was committed cannot have read an earlier one. Refusing it for\nits wording would be the same mistake one layer up.</p>\n<p><strong>The latest verdict decides, and acceptance asks that same verdict.</strong> Within the\n<code>--requested-at</code> window the most recent finished verdict chooses the state — an\nolder clean round never outvotes a newer one with findings — and head coverage is\nread from that verdict alone, never from whichever comment happens to name the head.\nWhen they came from different comments, a stale clean was accepted for a head it never\nread (cue-ui#94). A latest verdict naming an older head is refused even if an earlier\none named the current head; re-request the review. Help text and acknowledgements are\nnever a verdict, however recent.</p>\n<h3 id=\"visible-bounded-wait\">Visible Bounded Wait</h3>\n<p>Mirror Trigger.dev&#39;s active-wait contract, not its transport:</p>\n<ul>\n<li>keep one tracked operation active;</li>\n<li>surface waiting progress;</li>\n<li>combine caller cancellation with a hard deadline;</li>\n<li>stop on terminal evidence;</li>\n<li>return latest current state on timeout;</li>\n<li>propagate non-timeout failures.</li>\n</ul>\n<p>Trigger.dev can subscribe to a run stream. Blocks REST and GitHub review status\nuse documented polling, so poll conservatively rather than busy-waiting.</p>\n<h3 id=\"usage-examples\">Usage Examples</h3>\n<pre><code class=\"language-text\">Resolve the Blocks workspace for this repository. If it is not uniquely known,\nask me for a workspace URL or ID. Start a session and visibly await its final\nmessage for up to ten minutes.\n</code></pre>\n<pre><code class=\"language-text\">Get Blocks status for PR 42 against this request baseline. Include comments,\nreviews, all inline comments, and distinguish acknowledgement from completion.\n</code></pre>\n<h3 id=\"pitfalls\">Pitfalls</h3>\n<ul>\n<li>Workspace key success does not prove it is the intended workspace.</li>\n<li>Dashboard URLs are not REST links; use only returned <code>_links</code> for API calls.</li>\n<li>Never send a follow-up merely to check status; follow-ups can interrupt work.</li>\n<li>Never silently hide a wait by redirecting all progress to a file.</li>\n<li>A timeout is nonterminal and must return current state explicitly.</li>\n</ul>\n<h3 id=\"verification\">Verification</h3>\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> Workspace resolved uniquely or the user was asked to confirm URL/ID.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Credential profile is neutral and workspace-scoped.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Returned REST links passed strict official URL validation.</li>\n<li><input disabled=\"\" type=\"checkbox\"> GitHub evidence uses timestamp plus stable-ID baseline and pagination.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Wait is visible, cancellation-aware, and deadline-bounded.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Timeout does not claim completion or failure.</li>\n</ul>\n","outline":["When to Use","Workspace Resolution","Direct REST Sessions","GitHub Status","Visible Bounded Wait","Usage Examples","Pitfalls","Verification"],"words":1563}
