HEX Personal Commands
Use HEX's managed command workspace rather than creating an independent package.
- Check for
~/.config/hex/hex.config.ts. If it is missing, ask the user to open HEX's Commands pane and choose Create Config. If thehexCLI is available,hex commands initperforms the same provisioning. Bun must be installed separately. - Read
~/.config/hex/AGENTS.mdand~/.config/hex/.agents/skills/personal-commands/SKILL.md. Check.hex-sdk/package.jsonand its exported declarations for the installed API and exact Effect requirement; scaffolded instructions are not overwritten on upgrades and may be older than the SDK. - Edit only user-owned workspace files, normally
hex.config.ts. Never edit.hex-sdk; HEX refreshes that managed SDK from the app bundle. - Use
defineHexConfigfrom@hex/commandsfor Promise handlers, dictation controls, and transformations. For Effect handlers, importdefineHexConfigandHexfrom@hex/commands/effect, and Effect APIs fromeffect. - Keep command phrases unambiguous and use only the capabilities required by
the request. Treat config and dependencies as trusted executable code with
the user's filesystem, network, environment, and subprocess authority.
Use
digit()for zero through nine,digit({ min, max })for a restricted range,choice(["left", "right"] as const)for exact choices, an object-formchoice()to normalize one-word aliases to canonical keys,union(letter(), digit(), choice(["home", "end"] as const))for disjoint bounded one-token alternatives, and trailingtext()for explicit text captures.letter()accepts literal, common spoken, and one-word NATO letter names and returns lowercase"a" | ... | "z". With acapturesschema, every phrase alias must bind every declared name exactly once. - Spoken commands and dictation controls need the Commands opt-in, which defaults off; creating a config does not enable it. Transformations must be selected in the mode's Transformations section and can run with Commands off. They run after mode corrections and optional AI rewriting, not for Voice Action or meetings. Do not enable voice commands merely to run a transformation.
- Run
bun run checkin~/.config/hex. Do not finish until it passes. This checks TypeScript; runtime validation can still reject phrase overlaps. A running host watches workspace.tsand.jsonfiles and reports reload failures in the Commands pane. If startup stopped because the config, Bun, or dependencies were unavailable, restart HEX after repairing them. Confirm runtime activation when the host is enabled, or report that it was not tested.
Completion criterion: the requested behavior is represented in
hex.config.ts, the managed SDK was not modified, bun run check passes, and
runtime activation is confirmed or its verification gap is reported.