
Claude Mods
Building Function-Hook Plugins for Claude Code
A field guide to Claude Mods, the function-hook plugin system that lets TypeScript run inside Claude Code, draw live UI above the prompt, register slash commands, watch and wrap tool calls.
You can read the contents and the first 2,000 characters.
Free accounts get the whole book.
- By Trove
- 18 chapters
- Updated Nov 1, 2026
- 30 readers
What’s inside
- What Claude Mods Are
- Anatomy of a Mod
- The Hook Model
- Registering and Serving Slash Commands
- Drawing
- The `$` Toolbox
From the first page
A field guide for CandleKeep engineers and their coding agents, written from one complete build: the /trove value dashboard, made on 2026-09-15 in plugins/trove-mod/ on branch worktree-trove-mod-experiment.
This book separates four kinds of statement.
The Design doc marker deserves care. The paper is a design document, not a reference. It predates the build by a month, its vocabulary is the vocabulary the shipped API uses, and several of its constructs shipped exactly as written. A few did not. Never quote it as the current contract without checking claude-code.d.ts.
The function-hook API is early access. The declaration file states it plainly, verbatim:
Preview · 2,000 of 400,776 characters
Contents
- 01Claude Mods: Building Function-Hook Plugins for Claude Codep.1
- Who this book is forp.1
- What is verified, and what is notp.1
- The sources behind every claimp.1
- How to read itp.1
- 02What Claude Mods Arep.2
- The one-sentence definitionp.2
- Classic hooks compared to function hooksp.2
- The three built-in modsp.2
- Timeline of the releasep.2
- Version floorp.2
- Why this matters for CandleKeepp.2
- 03Anatomy of a Modp.3
- The file layoutp.3
- `.claude-plugin/plugin.json`p.3
- `hooks/hooks.json`: the `modules` keyp.3
- `tsconfig.json`p.3
- The runtime environmentp.3
- Enabling function hooksp.3
- The bundled `plugin-authoring` skillp.3
- The dev loop: `--plugin-dir`p.3
- +1 more section
- 04The Hook Modelp.4
- The vocabularyp.4
- `register(on, options)`p.4
- `on`p.4
- The hook signature: `($, e, next)`p.4
- Ordering: middleware, not listenersp.4
- The algebrap.4
- The five placementsp.4
- Who orders the pluginsp.4
- +8 more sections
- 05Registering and Serving Slash Commandsp.5
- Register at `session.start`p.5
- `CommandSpec`p.5
- `$.command.register`p.5
- Serving it: `command.run`p.5
- The plugin-name prefixp.5
- The argument dispatch patternp.5
- Hooking commands you did not registerp.5
- Calling a command yourselfp.5
- +1 more section
- 06Drawingp.6
- The `ui.render` eventp.6
- `RenderInputOf`p.6
- The fourteen componentsp.6
- `AbovePrompt` propsp.6
- The practitioner's account of `ui.render`p.6
- The hook shapep.6
- `$.ui.resolve`p.6
- The visual extensibility contractp.6
- +11 more sections
- 07The `$` Toolboxp.7
- `$` is the only doorp.7
- The fold: how `$` is builtp.7
- The shape: the blast doorp.7
- Typing `$`: declaration mergingp.7
- Work that outlives a dispatchp.7
- `$.tool.register`: tools the model can callp.7
- Shipping a noun: the contract filep.7
- `$.process.run`p.7
- +11 more sections
- 08Watching the Sessionp.8
- `tool.call`p.8
- `turn.complete`p.8
- `prompt.submit`, and the deadlockp.8
- `session.start` fires again on reloadp.8
- The `Host` indirectionp.8
See all 18 parts
- 09Worked Example — the `/trove` Modp.9
- What it doesp.9
- The `lib.ts` split: the review's biggest changep.9
- Architecturep.9
- The data sourcep.9
- Counting reads: `readIdsOf`p.9
- Parsing untrusted JSONp.9
- Refresh: snapshot the window, single-flight per windowp.9
- The store: one key per conceptp.9
- +10 more sections
- 10Testing and Debuggingp.10
- 1. `claude plugin validate`p.10
- 2. `/plugin-types` plus `tsc`p.10
- 3. `claude plugin test` — does not existp.10
- 4. Live tests in tmuxp.10
- 4a. `claude --debug` and the dim transcript linep.10
- 4b. Plugin options and the config menup.10
- 5. Hot reloadp.10
- 6. Failure symptoms and their causesp.10
- +1 more section
- 11Gotchas and Rulesp.11
- 12Implications and Roadmap for CandleKeepp.12
- What it provedp.12
- What it did not provep.12
- Open decisionsp.12
- Enterprise management, and what it means for a CandleKeep modp.12
- Roadmap, in order of expected valuep.12
- Two transferable lessonsp.12
- 13Sources and Linksp.13
- There is no official documentationp.13
- Read firstp.13
- The announcementp.13
- Our own sourcep.13
- Related CandleKeep knowledgep.13
- Commands, collectedp.13
- Verification recordp.13
- Stated unknownsp.13
- 14Appendix: The bundled plugin-authoring reference (snapshot, 2026-09-15, Claude Code 2.1.272)p.14
- What this isp.14
- Provenance and statusp.14
- Where this book draws on itp.14
- The textp.14
- 15Worked example 2: the `/linear` pane — a side pane with lists, a detail view and buttons that prompt the sessionp.15
- What it isp.15
- Structurep.15
- Sizing the seat: the bug that cost the mostp.15
- The focus ringp.15
- Escape as backp.15
- Prompts, and the deferralp.15
- Small things that cost an hour eachp.15
- Testing recipep.15
- +1 more section
- 16Worked example 3: the `power-line` band — PRs, Linear, Railway, limits, and what brokep.16
- What it isp.16
- What broke, and the rules it gave usp.16
- Source order of the checks that finally closed the loopp.16
- 17Worked example 4: designing a mod that looks good — what `plan-progress` does, and what to copyp.17
- Referencesp.17
- Desktop only, or terminal too?p.17
- Why the bar looks good: a recipep.17
- Motionp.17
- Layoutp.17
- Behaviour that makes it feel built inp.17
- What we took, and what is leftp.17
- 18Worked example 5: the Trove dashboard — a pane mod, built with parallel lanes and tested until it brokep.18
- What we builtp.18
- Architecturep.18
- What the documentation already coversp.18
- The pitfalls, in the order we hit themp.18
- Recipesp.18
- The new rulesp.18
- Not verified in a sessionp.18



