Skip to content

Instantly share code, notes, and snippets.

View kevinswiber's full-sized avatar
🍄
lizard person

Kevin Swiber kevinswiber

🍄
lizard person
View GitHub Profile
@kevinswiber
kevinswiber / Rex Named Sessions - Install.md
Created December 3, 2026 01:56
Rex terminal: Cmd+N asks for a session name or directory (with a zoxide/project picker), unnamed sessions take their first cd's directory name, and an Open Session picker at launch. zsh, bash, fish. Start with "Rex Named Sessions - Install.md".

Rex: Named Sessions and a Launch Session Picker

Add-on for the Rex terminal. It changes two things:

  1. Cmd+N → New Session… opens a list instead of creating an unnamed session. You can:
    • choose a directory (from zoxide and your project folders). The session starts there and is named after it.
    • type a path (~/code/app, /tmp/x, or code/app relative to ~). Same result.
    • type a name. The session gets that name.
    • press Enter on Name It Later. The session is named after the first directory its first pane cds into (other than ~).
@kevinswiber
kevinswiber / ubq-conversion-time-and-tokens.md
Created November 19, 2026 20:14
Converting two repositories to ubq: time and tokens

Converting two repositories to ubq: time and tokens

Claude Code converted the tests of kevinswiber/whosonfirst.ai and a private companion repository from node:test to ubq (ubqtest 0.0.20) on 2026-11-19, in two passes:

  1. Opus 5.5 at low effort did the conversion, with three sub-agents taking groups of test folders side by side.
  2. Opus 5.5 at medium effort did a second pass: it read the diff, checked each claim itself, and corrected what the first pass got wrong.

The result is the tag archive/ubqtest-conversion. Its ubq-feedback.md has the findings for the author of ubq.

Times are from the session transcript and git. Tokens are summed from the usage recorded on each model response.

Questions about MCP Tasks

1. Authorization Context Scope

The Tasks specification (2025-11-25) introduces "authorization context" for task binding and access control. However, other stateful protocol elements—initialization/capability negotiation, progress tokens, sampling requests, roots—also require context binding in multi-tenant deployments.

Was the decision to scope authorization context to Tasks intentional, or would you consider elevating it to a protocol-wide concept?


@kevinswiber
kevinswiber / server.js
Last active December 25, 2025 23:54
Node.js server with best-effort completions on functions
import { AsyncResource } from "node:async_hooks";
import { createServer, request } from "node:http";
// A thin wrapper around AsyncResource to manage best-effort completions.
// Best-effort resources are not guaranteed to complete, but they are
// allowed time to complete before the process exits on SIGINT.
// In a real-world scenario, you would likely include more details
// in the resource context to help trace completed and
// abandoned best-effort executions.
class BestEffort extends AsyncResource {
@kevinswiber
kevinswiber / typescript-hook.js
Last active November 27, 2023 15:15
Run the TypeScript compiler in watch mode while running Node.js in watch mode. Yowza.
// Usage:
// node --import=./typescript-hook.js --watch ./dist/index.js
//
// Make changes to your TypeScript code, have it automatically
// recompiled, and see it reloaded in Node.js.
//
// This file is intended to be used as a Node.js preload module.
// The TypeScript compiler (tsc) will be run in watch mode.
// This is useful while running Node.js itself runs in watch mode.
//
@kevinswiber
kevinswiber / url-pattern.js
Last active October 24, 2023 21:04
Implementation of URL Pattern spec
import assert from "node:assert";
function escapeRegexString(str) {
return str.replace(/[\.\+\*\?\^\$\{\}\(\)\[\]\|\/\\]/g, "\\$&");
}
function isValidNameCodePoint(codePoint, isFirstCodePoint) {
if (isFirstCodePoint) {
return (codePoint >= 65 && codePoint <= 90) ||
(codePoint >= 97 && codePoint <= 122) ||
@kevinswiber
kevinswiber / .spectral.yaml
Created October 13, 2023 05:01
Spectral de-dupe minimal repro
rules:
missing_error_response_content:
given: '$..responses[?(@property && @property.match(/^(4|5)/))]'
then:
field: content
function: defined
formats:
- oas3
severity: warn
message: Error response should contain a response body.
@kevinswiber
kevinswiber / http-server.js
Last active October 19, 2023 21:49
Simple Node.js HTTP server with router and logging.
// Purpose: A simple HTTP server with routing and logging.
// Author: Kevin Swiber <kswiber@gmail.com>
// Exports:
// serve({ routes, host, port, protocol, secure, serverOptions })
// routes: A Map of routes to handlers. Example:
// const routes = new Map();
// routes.set("/greeting", {
// get: ({ response }) => {
// response.setHeader("Content-Type", "application/json");
// response.end(JSON.stringify({ hello: "world" }));
@kevinswiber
kevinswiber / extensions.json
Last active September 26, 2023 19:39
Spectral JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "@stoplight/spectral-core/meta/extensions",
"$defs": {
"Extends": {
"$anchor": "extends",
"oneOf": [
{
"type": "string"
},
@kevinswiber
kevinswiber / spectral-language-server-support-workspace-folders.patch
Created September 23, 2023 15:40
Patches for yaml-language-server and spectral-language-server to work with Neovim's lsp and lsp-config
Changing configuration.workspaceFolder to connection.workspace.getWorkspaceFolders() to support non-VSCode workspace folders.
diff --git a/dist/spectral-language-server/src/server.js b/dist/spectral-language-server/src/server.js
index 8878d95..7ec85d6 100644
--- a/dist/spectral-language-server/src/server.js
+++ b/dist/spectral-language-server/src/server.js
@@ -118,19 +118,21 @@ function resolveSettings(document) {
}
let rulesetFile = null;
connection.console.log(`Using ruleset file: ${configuration.rulesetFile}.`);