Developing VS Code Extensions for Own Workflows
I have published three small VS Code extensions, and each one does a single job in the status bar: Tokenwatch shows my Claude Code quota and context, Jobwatch shows my Hugging Face Jobs and what they cost, and Citewatch checks the citation files that decide whether a Zenodo release gets a DOI.
In short
- Tokenwatch (Claude Code quota and context), Jobwatch (Hugging Face Jobs and spend) and Citewatch (Zenodo citation files) each do one job in the status bar.
- All three share one layering enforced by an ESLint import rule, have zero runtime dependencies, and ship as a
.vsixuploaded to the Marketplace by hand. - All three are unofficial and depend on endpoints the providers can change; Tokenwatch's is undocumented and reuses Claude Code's stored login token, which the provider could block, and the
ui/layer has no automated tests. - If you build your own status-bar extension, the section after the overview lists eight practical rules drawn from these three.
The limits first. All three are unofficial and not affiliated with Anthropic, Hugging Face, Zenodo, CERN or GitHub, and all depend on endpoints the providers can change; Tokenwatch's is undocumented. Jobwatch covers Hugging Face Jobs only, and Citewatch covers only GitHub plus Zenodo's GitHub integration. They are small tools built for my own workflow.
Why single-purpose status-bar tools
The status bar is the one part of the editor I look at without deciding to. A number there costs nothing to read, but it has to be right and has to stay quiet: an item that flickers, polls too often or alerts twice is worse than none.
If you build your own status-bar extension
These points come from the three extensions described below; adjust the numbers to your endpoints.
- One purpose. One question per tool keeps the settings list short and the security document auditable.
- Choose the poll interval from the endpoint's limit. Tokenwatch moved from 60 to 180 seconds after frequent 429s; Jobwatch polls every 60 seconds only while a job is active.
- Back off from your own rule, not only from the header. Tokenwatch's server sends
Retry-After: 0, so it waits the longer of that value and 180 seconds. - Give stale numbers a deadline. Tokenwatch keeps the last numbers for 30 minutes and persists them across a reload.
- Show unknown, not off. Citewatch shows unknown when it cannot read a webhook, and Jobwatch shows a labelled upper bound for a cancelled job.
- Enforce the layering with a lint rule. It keeps the rest testable without an editor.
- Ship no runtime dependencies, and list every request. A security document naming each host, path and credential source lets a reader audit the extension. Send tokens to one host only and never log them.
- Publish the tested file by hand. Build the
.vsixin the release workflow afternpm run check, then upload that same file yourself.
Tokenwatch: Claude Code quota and context
Problem. Claude Code's /usage and /context commands tell you how close you are to a limit, but only when you stop and ask. Tokenwatch puts the answer on one line:
5h ▰▱▱▱▱ 19% ↻2h 35m · wk ▰▰▱▱▱ 43% · ctx: 47%
That reads as: 19% of the 5-hour session quota used, resetting in 2 h 35 min; 43% of the weekly quota used; and 47% of this folder's Claude Code session context filled. The hover shows both quota windows with their reset times, a pace forecast and the context token count and model. Yellow means a window is on pace to run out before it resets, amber means past the threshold (80% by default) or within the hour, and red means 100%.
How it gets the data, and the caveat. The quota comes from an undocumented endpoint, GET https://api.anthropic.com/api/oauth/usage, which is the data behind /usage. Tokenwatch calls it with the OAuth access token that Claude Code already stores: in the macOS Keychain (item Claude Code-credentials), falling back to ~/.claude/.credentials.json, which is the only location on Linux and Windows. The token is re-read on every request, so a refreshed token is picked up. The endpoint can change or disappear without notice. If it does, Tokenwatch falls back to counting today's tokens from local session logs (shown as ~1.5M tok today) and logs the response so the parser can be fixed. Last confirmed working, per the repository's endpoint notes: 2026-10-07, on macOS.
The token risk. Reusing Claude Code's token from another program is not a documented use. The provider can block it at any time, and it may breach the terms of your account, so read them before installing.
Context comes from a different source. Tokenwatch reads the end of the newest transcript under ~/.claude/projects/ for the open folder and sums input_tokens, cache_creation_input_tokens and cache_read_input_tokens from the last main-thread reply, which is what /context reports. Transcripts record the model but not its window size, so there is a setting for it; without one, Tokenwatch assumes 200k tokens, or 1M once a session has passed 200k.
Rate limits. The endpoint's limit appears to be per account and shared with Claude Code itself. In informal testing, a 60-second poll drew a 429 on roughly every other request, so the default is 180 seconds. After a 429 it waits at least 180 seconds, because the server sends Retry-After: 0. The last numbers stay on screen if they are under 30 minutes old, and they survive a window reload. Unfocused windows skip polls.
Privacy. The token goes only to api.anthropic.com over HTTPS and is never logged or stored; a unit test checks the log for every refresh outcome. Only token counts, model ids, timestamps and message ids are extracted from transcripts, and nothing from them leaves the machine. There is no telemetry.
code --install-extension kabartay.tokenwatchclaude
It needs VS Code 1.85 or newer and Claude Code installed and logged in. The poll interval has a minimum of 60 seconds; the other settings are listed on the Marketplace page.
Jobwatch: Hugging Face Jobs and spend
Problem. GPU time is billed by the second, and the costly mistakes are quiet ones. Jobwatch shows 2 running · 1 queued · $1.84 while jobs are active and $12.40 this month when nothing is running, and raises each alert once per job.
The alerts are: out-of-memory kill, other failure, completion (which can be turned off), approaching the job's own timeout, waiting too long for hardware, and monthly spend past a budget you set. Jobs that finished before installation are recorded as a baseline, not announced.
Cost is an estimate. It is running time multiplied by the hardware's per-minute price from Hugging Face's own price list, and your invoice is the authority. How running time is known depends on the job:
| Job state | Running time used |
|---|---|
| Running | Start to now, measured live |
| Finished, time reported | The provider's reported running time |
| Cancelled, seen running | Last sighting minus start: a lower bound, shown with a "≥" mark |
| Cancelled, never seen | Unknown; shown as an upper bound from the job's time limit |
Hugging Face records no end time for a job cancelled before Jobwatch saw it, so I show the most it could have cost, labelled as such, rather than a blank or a guess.
Under the hood. The token comes from HF_TOKEN (or HUGGING_FACE_HUB_TOKEN), else the file the hf CLI writes. It is sent as a bearer token to huggingface.co only, and a next-page link to any other host is never followed. Jobwatch makes three requests: GET /api/whoami-v2 (once per token, unless a namespace is set), GET /api/jobs/{namespace} (page by page) and GET /api/jobs/hardware for prices (at most every six hours). It never reads a job's environment, secrets or command, and it never changes a job. Polling is every 60 seconds while something is queued or running and every 600 seconds otherwise, with at least 300 seconds after a 429. Its endpoints are the ones the hf CLI uses, and the vendor may change them.
code --install-extension kabartay.jobwatch
A monthly budget of 0, the default, turns the spend alert off. The version in package.json is 0.1.3.
Citewatch: check citation files before a release
Problem. Zenodo's GitHub integration archives each release with its own DOI, and when something is wrong it fails quietly: the release appears on GitHub and the DOI never does. The usual causes are: the repository was never switched on in Zenodo, a licence id Zenodo does not know (Apache-2.0 instead of apache-2.0), mismatched versions between package.json and CITATION.cff, or an ORCID with a bad check digit. Citewatch catches these in the editor.
What it checks. As you type, in .zenodo.json and CITATION.cff: valid JSON with the six required fields, licence against Zenodo's live vocabulary, creators written Family, Given, ORCIDs against the ISO 7064 check digit, and agreement between the versions in package.json, pyproject.toml, CITATION.cff and .zenodo.json. Checks rerun 400 ms after an edit and read other files from open editors first, so an unsaved version fix clears the warning in the others. Only the licence check goes online, and when Zenodo cannot answer it reports nothing.
The status bar. It shows the concept DOI and newest archived version, for example zenodo.23270119 · 0.1.2, amber when Zenodo is not switched on. The DOI is found from CITATION.cff, else a README badge, else a Zenodo search that requires the same title and a shared creator family name, so a project with the same name is not mistaken for mine. Summaries are cached for ten minutes because Zenodo limits search requests to 30 a minute.
Is Zenodo switched on? Citewatch reads the repository's webhooks (GET api.github.com/repos/{repo}/hooks) with your VS Code GitHub session. That needs admin access. Any failure, including lack of access, shows as unknown, never as off. It never asks to sign in by itself: you choose Sign in to GitHub from the status bar menu, and it then requests the read:repo_hook scope, the narrowest scope that can read webhooks. Webhook configuration contains Zenodo's own token in its URL, so Citewatch reads only whether the URL is Zenodo's and never logs it.
Writes. Nothing, except when you run Set Version Everywhere, which replaces only the version line in each file. It never creates a release, a record or a webhook.
code --install-extension kabartay.citewatch
The version in package.json is 0.1.2. YAML validation of CITATION.cff needs the Red Hat YAML extension; the bundled Citation File Format 1.2.0 schema is CC-BY-4.0.
What the three share
All three use the same four layers, and I kept them identical on purpose, so a fix or convention in one carries to the others.
The rule is that domain/ imports nothing outside itself, application/ imports only domain/, and the VS Code API appears only in ui/ and the extension.ts entry point. ESLint enforces it with no-restricted-imports in eslint.config.ts, so a crossing import fails the lint. Network and file access sit behind interfaces called ports, which tests replace with in-memory fakes.
Testing. Tests use node:test and node:assert only. Domain and application tests are pure. The infrastructure tests run the real HTTP clients against a local server, covering status codes, Retry-After, timeouts, pagination and a next-page link to another host. The gap is the ui/ layer in all three, which has no automated tests: I keep it thin and check it by hand in the Extension Development Host before a release.
Packaging and release. All three have zero runtime dependencies, a check script (typecheck, lint, test) and a vsce package script. A release is a version bump, changelog move, npm run check, a pushed tag, and a release workflow that builds the .vsix and attaches it to a GitHub Release. Publishing to the Marketplace is a manual upload of that same file on the publisher page. The manual step is deliberate: it publishes exactly the file that was tested.
One Marketplace lesson: another extension already used the name tokenwatch, so version 1.0.1 renamed it to Tokenwatch for Claude Code with the ID kabartay.tokenwatchclaude. The new ID counts as a separate extension, so anyone on the old one had to uninstall it.
Comparison
| Aspect | Tokenwatch | Jobwatch | Citewatch |
|---|---|---|---|
| Version in package.json | 1.0.3 | 0.1.3 | 0.1.2 |
| Shows | Quota windows, pace, context % | Active jobs, spend, alerts | DOI, archived version, diagnostics |
| Activation | onStartupFinished | onStartupFinished | Workspace contains CITATION.cff or .zenodo.json, or JSON or YAML opened |
| Credential | Claude Code login (Keychain or credentials file) | HF_TOKEN or hf CLI token file | VS Code GitHub session, only for webhooks |
| Network host | api.anthropic.com | huggingface.co | zenodo.org, api.github.com |
| Endpoint status | Undocumented | Same as the hf CLI; may change | Public REST APIs; may change |
| Default poll | 180 s (context 15 s) | 60 s active, 600 s idle | Summary cached 10 min |
| Writes anything | Only its own extension storage | Only its own extension storage | Version lines, on command |
If a vendor changes an endpoint and a number goes wrong, say so in the issue tracker; each security document explains how to report a vulnerability privately.
Sources
- Tokenwatch for Claude Code on the Visual Studio Marketplace
- Jobwatch: GPU Jobs and Spend on the Visual Studio Marketplace
- Citewatch on the Visual Studio Marketplace
- kabartay/tokenwatchclaude, including docs/ARCHITECTURE.md, USAGE_ENDPOINT.md and SECURITY.md
- kabartay/jobwatch, including docs/ARCHITECTURE.md and SECURITY.md
- kabartay/citewatch, including docs/ARCHITECTURE.md and SECURITY.md