
課題
AIエージェントの待機時間に生じる細切れの時間が、スマートフォンを見るだけで浪費されがち。
アプローチ
プロンプト上部に学習カードを1枚ずつ表示するTypeScript/TSX製Claude Code Modを開発。8つのイベントフックがツール名や拡張子からトピックを判定し、5段階Leitnerシステムで復習をスケジューリング。既存パック外のトピックはHaikuがバックグラウンドでカードを生成。
成果
目の前の作業に関連する短い知識とYes/Noクイズを提供し、Claudeが許可を求めると即座に非表示化。JavaScript・Python・Gitの108枚の手書きカードに加え14トピックを自動生成し、プラグインディレクトリに公開済み。
Holdtime の構成
技術アーキテクチャの説明は英語です。
A Claude Code mod that runs inside Claude’s own window. Event hooks read only enough to pick a topic, pure planner functions choose and schedule cards, and a background request to Haiku tops up a shared library for topics the shipped packs do not cover.
- hand-written cards in three packs
- 108
- more topics with generated cards
- 14
- Leitner boxes, 1 to 16 days
- 5
- tests, no model called
- 68
01 · Claude Code
client
Claude Code session
client
Band above the prompt
ui.render
02 · Mod hooks
gateway
Event hooks
TypeScript · TSX
8 events
03 · Logic
service
Planner
topic, next card, Leitner boxes
service
Library pool
refill policy
04 · Cards & storage
database
Shipped packs
108 cards
database
Plugin store
progress, daily count, library
third-party
Claude Haiku
writes new cards
8 connections
- Claude Code session→Event hookstool name, extension
- Event hooks→Planner
- Planner→Shipped packs
- Planner→Plugin storeprogress
- Event hooks→Library poolbelow 6 ready
- Library pool→Claude Haikutopic name only · optional
- Library pool→Plugin storelibrary, max 240
- Event hooks→Band above the promptrender card
Request flow · Claude runs cargo test
- 1The tool.call hook reads the first word, cargo, bumps the Rust weight and passes the call through untouched.
- 2No pack covers Rust, so when fewer than six Rust cards are ready the pool asks Haiku for a batch in the background.
- 3Replies go through the same validator as shipped cards; anything malformed is dropped unread and the rest join the shared library.
- 4The planner picks the next due card and the band draws it above the prompt until Claude needs you.
Design decisions
- Claude always comes first
- The permission and notification hooks only hide the card and return next(e): they never allow, deny or alter anything.
- One bar for every card
- Shipped and generated cards pass the same isValidCard check, so the tests and the runtime filter agree on what a card is.
- Never blank
- The shipped packs fill in whenever the library is empty, the request fails or the machine is offline.
- Pure logic, tested directly
- Topic choice, scheduling and refill policy are plain functions; the band test answers the model call with a canned reply.
Trade-offs & known limits
- Card writing uses the user’s own Claude plan; turning it off limits cards to the three shipped topics.
- The store has no atomic increment, so two sessions answering at the same moment can lose one from the daily count; the daily goal is a soft cap, so that is accepted.