Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/BetterTyped/hype-stackWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/bettertyped/hype-stack/websockets)<a href="https://agentmods.dev/rules/bettertyped/hype-stack/websockets"><img src="https://agentmods.dev/badge/rules/bettertyped/hype-stack/websockets/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/bettertyped/hype-stack/websockets"><img src="https://agentmods.dev/badge/rules/bettertyped/hype-stack/websockets.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01763 |
| Opus 5.5 | $0.00000 | $0.00705 |
| Sonnet 5.5 | $0.00000 | $0.00353 |
| Haiku 4.5 | $0.00000 | $0.00176 |
Grade A, and why
websockets scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
WebSockets
One socket per client app, typed end to end. The backend declares events with SocketRouter, the type bridge in src/types/hono/hono-ws-converter.ts turns those declarations into WsSocketSdk, and the client consumes them through socketSdk. No topic string is written twice and nothing is wired by hand.
How a connection works
src/api/client.tscreates the socket once, at import time, next to the HTTPclient:new Socket({ url: \${wsProtocol}://${wsHost}/ws` }). Admin creates a second one on/ws/admin. HyperFetch connects at startup and reconnects on its own. Never hand-rollnew WebSocket` or a retry loop.- The auth starter binds the socket to the session in
features/auth/modules/session-socket/session-socket.ts. Itssocket.onConnectinterceptor runs before every connection attempt (first connect, automatic and manual reconnect) and callsusers/mefirst: the upgrade authenticates with the session cookie, and only an HTTP request through the auth middleware can rotate an expired access token, so without this a reconnect after an idle hour is refused with 4001 and retried every five seconds for good. A 401 or 403 from that request throws, which abandons the attempt instead of looping for a signed-out visitor. The(private)route guard callsconnectSessionSocketinonEnteranddisconnectSessionSocketinonLeave(the mobile private layout does the same from an effect), so signing in opens the socket and signing out closes it. - Every frame is JSON
{ topic, data }. Topics are<prefix>/<event>(notification/new,board/op): the prefix comes from.socket("/notification", ...), the event from.emitter()or.listener(). - The backend serves the upgrade at
/ws(createWsRoutes) and callsauthenticate(headers)inonOpen.nullcloses the socket with code 4001. The browser sends the session cookie with the upgrade, so socket auth reuses the HTTP session and nothing goes in the URL. The upgrade never refreshes that cookie; that is what the session-socket interceptor above is for. - Connections live in a
ConnectionManagerper namespace (appWsManagerfor/ws,adminWsManagerfor/ws/admin), keyed by user id with the organization id alongside. That registry is whattoUser,toOrganization, andbroadcastwalk. Namespaces never see each other's connections. initWebSocket(app)runs before the routes andserveWebsockets(server)afterserve()inmain.ts. Both are already there. Do not add a secondcreateNodeWebSocket.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago Changed · +1 lines 1f69e2efcabb
- 1mo ago First seen · 101 lines · 0 tokens per session scan A 9a7b8f1a96ff
websockets is a cursor rule published in the GitHub repository BetterTyped/hype-stack (12 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,763 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-11.
Other cursor rules, from other repositories
python_tests
We use the unit tests to cover internal behavior that can work without the web / backend counterpart. We aim for 95%+ unit test coverage of our Python code in lib/streamlit.
upgrade-tests
// ✅ CORRECT: Upgrade package pattern await using ctx = testReactResource(appRouter, { server: { // server configuration }, client(opts) { return { links: [ httpLink({ url: opts.httpUrl, // client configuration }), ], }; }, }).
backend
Backend development rules for TT Studio - AI model management backend.
aom
API Object Model (AOM) standards and patterns.
data-fetching
Data fetching patterns with TanStack Query, Server Components, and Supabase.
api-design
API design guidelines — REST principles, GraphQL patterns, versioning, pagination, error handling, documentation, security, caching, and testing. Applied when designing or reviewing API endpoints.