X

whoami

x.com · Cowork
Download for Coworkthe skill folder, zipped
How to use it in Coworkonce per skill
Download the skill (.zip)

One .zip per skill. Inside: SKILL.md with the intent and the frontmatter, and the code that runs in the page.

Open Skills in Cowork

Settings → Personalize → Skills. This is Cowork's own skill library, shared across every chat.

Add → pick the .zip

Click Add and choose the file you just downloaded. Cowork installs it once; no CLAUDE.md, no per-project setup.

Ask in plain language

The skill stays available in every session. Cowork runs it in your own Chrome, riding the session you are already signed into.

Side effectread
Authsession (a logged-in X session is required - every GraphQL call is signed with the ct0 cookie)
Needsnavigate · evaluate
Summary

Return the currently logged-in X/Twitter user (handle + name).

Params
{}  (takes none: the account comes from the session cookies)
Returns
{"userId":"string","screen_name":"string (the handle, no @)","name":"string (display name)"}
SKILL.md63 lines

x-whoami

Answers "who am I logged in as on X", reads the twid cookie for the id, then resolves it. Use it before any write skill to confirm which account is about to post. Resolves in a single bridge call against X's internal GraphQL API, no page is opened.

The extractor lives as text in the site's localStorage (key x-whoami) and is rebuilt on each call with synchronous eval. It is stored once and then persists across navigation and browser restarts, so on every run except the first it is already there.

Default action: just call (step 1). The call itself reports NEEDS_STORE when the extractor is missing or out of date, only then do you store it (step 2) and call again.

Versioning. The stored extractor is gated by VER (must match the version in the frontmatter above). Both snippets carry VER = "1", keep them in sync with the frontmatter. When evaluate.js changes, bump version and VER in both snippets: the next call sees the mismatch, returns NEEDS_STORE, and re-stores automatically. Storage stays at two keys (x-whoami and x-whoami:ver), overwritten each store, versions never accumulate.

1. Call (do this every run, params only, single bridge call)

await (() => {
  const KEY = "x-whoami", VER = "1";
  const s = localStorage.getItem(KEY);
  if (!s || localStorage.getItem(KEY + ":ver") !== VER) return 'NEEDS_STORE';
  const fn = eval('(' + s + ')');
  return fn(document, {});
})()

Returns the logged-in account. If it returns the string 'NEEDS_STORE', the extractor is missing or stale in this browser → do step 2 once, then run this exact call again.

Run this snippet verbatim. Never add an await before the eval, only the outer await is allowed.

Any logged-in x.com page works: the extractor reads the session cookies and the page's own script tags, then calls the API itself. It does not read the page's content, so it does not matter which x.com page is open.

2. Store (only when step 1 returned NEEDS_STORE; persists until localStorage is cleared)

From a logged-in x.com page, evaluate the following with the bridge, replacing <FN> with the contents of evaluate.js (the ( async (root, params) => { ... } ) function). Keep VER equal to the call snippet's:

(() => {
  const KEY = "x-whoami", VER = "1";
  const fn = (<FN>);
  localStorage.setItem(KEY, String(fn));
  localStorage.setItem(KEY + ":ver", VER);
  return 'stored';
})()

Returns "stored". The extractor passes through the model only here, once. Then go back to step 1.

Rate limit

UserByRestId allows 500 requests per 15 minutes (verified: x-rate-limit-limit: 500).

queryId discovery

The queryId is not pinned: the extractor lists the page's abs.twimg.com script bundles, fetches them and greps for queryId:"...",operationName:"UserByRestId". So it self-heals when X rotates its hashes on deploy, unlike a pinned hash, which breaks silently. It costs ~200ms and a few bundle fetches per call.

Errors

  • NEEDS_STORE → extractor missing or version-mismatched in this browser; run step 2 once, then retry step 1.
  • no twid cookie / empty ct0 → not logged in to X in this browser; log in once and retry.
  • HTTP 429 → rate limited; see Rate limit.

Success assertion

{ "type": "json", "jsonPath": "screen_name" }
whoami: the X skill in Cowork · browser-memory