Skip to content

Commit 7f8cebf

Browse files
committed
Add commands
Document claude-thermos and hanky from Hacker News discovery.
1 parent fcd7040 commit 7f8cebf

3 files changed

Lines changed: 204 additions & 0 deletions

File tree

assets/commands/claude-thermos.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# TAGLINE
2+
3+
Keep Claude Code prompt cache warm during long subagent waits
4+
5+
# TLDR
6+
7+
**Run Claude Code** through the warmer (interactive)
8+
9+
```uvx claude-thermos```
10+
11+
**Pass a one-off prompt** through to Claude
12+
13+
```uvx claude-thermos -p "[fix the bug]"```
14+
15+
**Tune idle threshold** before warming starts (seconds)
16+
17+
```uvx claude-thermos --idle [270]```
18+
19+
**Change interval** between warm cycles (seconds)
20+
21+
```uvx claude-thermos --interval [270]```
22+
23+
**Cap warm cycles** per idle episode (or use auto for unlimited)
24+
25+
```uvx claude-thermos --max-cycles [4]```
26+
27+
**Disable warming** for one run via environment
28+
29+
```CLAUDE_WARMER_DISABLE=1 uvx claude-thermos```
30+
31+
# SYNOPSIS
32+
33+
**claude-thermos** [**--idle** _SECONDS_] [**--interval** _SECONDS_] [**-n** | **--max-cycles** _N_|**auto**] [**--subagent-window** _SECONDS_] [_claude_args_ ...]
34+
35+
# PARAMETERS
36+
37+
**--idle** _SECONDS_
38+
> Seconds the main agent must be idle before a warming cycle runs. Default: **270**. Environment: **CLAUDE_WARMER_IDLE_THRESHOLD_SEC**.
39+
40+
**--interval** _SECONDS_
41+
> Seconds between warming cycles. Default: **270**. Environment: **CLAUDE_WARMER_WARM_INTERVAL_SEC**.
42+
43+
**-n** _N_|**auto**, **--max-cycles** _N_|**auto**
44+
> Maximum number of warm requests per idle episode, or **auto** for unlimited. Default: **4**. Environment: **CLAUDE_WARMER_WARM_MAX_CYCLES**.
45+
46+
**--subagent-window** _SECONDS_
47+
> How long a subagent still counts as active after its last traffic. Default: **540**. Environment: **CLAUDE_WARMER_SUBAGENT_ACTIVE_WINDOW_SEC**.
48+
49+
**-V**, **--version**
50+
> Print version and exit.
51+
52+
**-h**, **--help**
53+
> Show help.
54+
55+
_claude_args_ ...
56+
> Remaining arguments are passed through unchanged to the **claude** CLI.
57+
58+
# DESCRIPTION
59+
60+
**claude-thermos** launches Anthropic's **Claude Code** CLI behind a small local reverse proxy that keeps the main agent's prompt cache alive while subagents run. Claude Code's prompt cache has a roughly **5-minute TTL**. When the main agent waits on a subagent longer than that, the main conversation prefix expires and the next turn re-encodes the full history at the more expensive cache-write rate. Warming sends cheap refresh requests (identical cacheable prefix, **max_tokens: 1**) so resume pays a cache read instead of a full rewrite.
61+
62+
The wrapper points **ANTHROPIC_BASE_URL** at a loopback proxy that observes **/v1/messages** traffic. Lineages (cache prefixes) are keyed by model, tool set, and system text: the first tool-bearing lineage is treated as the main agent; others as subagents. When the main lineage is idle and a subagent is still active, the warmer fires on an interval under the TTL. Warm requests go **directly** to the Anthropic API (not through the proxy) so they do not interfere with real session traffic.
63+
64+
Session telemetry is written under **~/.claude-thermos/logs/**_session_id_**/`events.jsonl`** and **summary.json**, including warm counts and estimated rewrite tokens avoided. Requires **Python 3.11+** and the **claude** binary on **PATH**. Typical invocation is via **uvx** so the package need not be installed permanently.
65+
66+
# CONFIGURATION
67+
68+
**CLAUDE_WARMER_DISABLE**
69+
> Set to **1** to run Claude without warming for that process.
70+
71+
**CLAUDE_WARMER_IDLE_THRESHOLD_SEC**, **CLAUDE_WARMER_WARM_INTERVAL_SEC**, **CLAUDE_WARMER_WARM_MAX_CYCLES**, **CLAUDE_WARMER_SUBAGENT_ACTIVE_WINDOW_SEC**
72+
> Environment overrides for the matching CLI flags.
73+
74+
**~/.claude-thermos/logs/**_session_id_**/
75+
> Per-session **events.jsonl** (request usage and warm decisions) and **summary.json** (rollup savings estimates).
76+
77+
# CAVEATS
78+
79+
Does not replace **claude**; it wraps it. Warming still incurs small cache-read cost and network traffic to Anthropic. Savings estimates in **summary.json** are in base-input-token units, not dollars—multiply by your model's input price. Behavior depends on Claude Code's request shape and Anthropic's cache TTL remaining about five minutes. Requires a working Claude Code install and valid Anthropic authentication.
80+
81+
# HISTORY
82+
83+
Created by **Iaroslav Zeigerman** as a Python package (**claude-thermos** on PyPI) that uses a local reverse proxy (via **mitmproxy**) to refresh Claude Code prompt-cache prefixes during long subagent waits. Released under the MIT license.
84+
85+
# SEE ALSO
86+
87+
[claude](/man/claude)(1), [uvx](/man/uvx)(1), [uv](/man/uv)(1)
88+
89+
# RESOURCES
90+
91+
```[Source code](https://github.com/izeigerman/claude-thermos)```
92+
93+
<!-- verified: 2026-07-23 -->

assets/commands/hanky.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# TAGLINE
2+
3+
CLI and pipeline framework for loading flash cards into Anki
4+
5+
# TLDR
6+
7+
**Import a CSV** of cards into a deck (Basic note type by default)
8+
9+
```hanky pipe [words.csv] --into [english::vocab]```
10+
11+
**Import every matching file** under a directory into nested decks
12+
13+
```hanky pipe-dir [french/] ["*.csv"] -r```
14+
15+
**Override the Anki note type** / model name
16+
17+
```hanky pipe [cards.csv] -m [Basic] --into [deck]```
18+
19+
**Dry-run** processors without writing the collection
20+
21+
```hanky pipe [words.csv] --dry-run```
22+
23+
**Verbose report** of each processed card
24+
25+
```hanky pipe [words.csv] -v --into [deck]```
26+
27+
**Run a custom pipeline script** the same way as the hanky binary
28+
29+
```python3 [my_script.py] pipe [words.csv] --into [english::vocab]```
30+
31+
# SYNOPSIS
32+
33+
**hanky** **pipe** [**-m** _MODEL_] [**--into** _DECK_] [**--fail-fast**] [**--dry-run**] [**-v**] [**--args** _K=V_ ...] _file_
34+
35+
**hanky** **pipe-dir** [**-m** _MODEL_] [**-r**] [**--fail-fast**] [**--dry-run**] [**-v**] [**--args** _K=V_ ...] _dir_ _pattern_
36+
37+
# PARAMETERS
38+
39+
**pipe** _file_
40+
> Load cards from a single file (**.csv**, **.json**, or a registered extension) and add them to Anki.
41+
42+
**pipe-dir** _dir_ _pattern_
43+
> Load many files under _dir_ matching the glob _pattern_. Deck names are derived from relative paths (e.g. **french/animals.csv****french::animals**).
44+
45+
**-m** _MODEL_, **--model** _MODEL_
46+
> Override the Anki model (note type) used for new cards. Standalone **hanky** defaults to **Basic**; pipeline scripts set the model in **HankyPipeline(...)**.
47+
48+
**--into** _DECK_
49+
> Destination deck for **pipe**. Defaults to the input filename without extension.
50+
51+
**-r**, **--recursive**
52+
> For **pipe-dir**, also descend into subdirectories.
53+
54+
**--fail-fast**
55+
> Stop and raise on the first card that cannot be added instead of skipping and reporting at the end.
56+
57+
**--dry-run**
58+
> Run card processors and report results without modifying the Anki collection (no decks, media, cards, or backup).
59+
60+
**-v**, **--verbose**
61+
> Print each card dict after processors run, plus errors in the final report.
62+
63+
**--args** _K=V_
64+
> Key=value pairs forwarded to custom card processors (pipeline scripts only). May be repeated.
65+
66+
# DESCRIPTION
67+
68+
**hanky** is a Python CLI and library that reads flash cards from files (or in-script sources), optionally transforms them through user-defined **card processors**, and writes notes into a local **Anki** collection. It is aimed at ETL-style workflows: scrape or OCR material, enrich fields (translations, examples, TTS audio), then bulk-load into decks.
69+
70+
Built-in **pipe** / **pipe-dir** commands work with CSV and JSON out of the box when column or key names match the target note type fields. For custom logic, install the package, write a small script that registers **@hanky.card_processor** functions on a **HankyPipeline**, and call **hanky.run()** so the same CLI surface is available as **python3 my_script.py pipe ...**. Processors may attach audio media via **CardMedia** (**.mp3**, **.oga**, **.opus**, **.wav**, **.weba**, **.aac**). Custom file loaders can be registered for formats such as Excel.
71+
72+
hanky only **adds** cards, media, and decks. Note types (models) must already exist in the collection; create them in the Anki UI first. Requires Python **3.11+** and a local Anki collection database. Not affiliated with AnkiWeb or the Anki project.
73+
74+
# CONFIGURATION
75+
76+
**~/.config/hanky/hanky.toml**
77+
> Optional TOML config. Needed mainly if you do not use the default Anki profile (**User 1**) or you are on Windows.
78+
79+
**ANKI_DB_PATH**
80+
> Path to the Anki collection SQLite file (**collection.anki2**). Defaults to the **User 1** profile under the platform Anki2 data directory.
81+
82+
**DO_SAFETY_CHECK**
83+
> When true (default), refuse to open the collection if another process (e.g. Anki) appears to hold it.
84+
85+
**ALLOW_DUPLICATES**
86+
> When false (default), skip cards that duplicate existing notes.
87+
88+
**BACKUP_FOLDER**
89+
> Directory for collection backups before writes. Default: **~/.local/share/hanky/backups**.
90+
91+
A **Config** object passed to **HankyPipeline** in a script overrides file settings.
92+
93+
# CAVEATS
94+
95+
Close Anki (or disable the safety check only if you accept corruption risk) before writing the collection. Note types must pre-exist; hanky does not create models. Duplicate detection and field names depend on your note type. Windows and non-default profiles almost always need **ANKI_DB_PATH**. Custom processors that call external APIs (translation, TTS, vision) need their own credentials and dependencies.
96+
97+
# HISTORY
98+
99+
Written by **HBA** as an open-source Python package on PyPI under the MIT license. Provides both a **hanky** console script and a library API for programmable Anki import pipelines.
100+
101+
# SEE ALSO
102+
103+
[anki](/man/anki)(1), [python](/man/python)(1), [pip](/man/pip)(1)
104+
105+
# RESOURCES
106+
107+
```[Source code](https://github.com/Haeata-Ash/hanky)```
108+
109+
<!-- verified: 2026-07-23 -->

assets/commands/index.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ clang.md
12081208
clangd.md
12091209
claude-pee.md
12101210
claude-pulse.md
1211+
claude-thermos.md
12111212
claude.md
12121213
claumon.md
12131214
clawk.md
@@ -3206,6 +3207,7 @@ handler.md
32063207
handlr.md
32073208
hangman.md
32083209
hangups.md
3210+
hanky.md
32093211
hapless.md
32103212
happy.md
32113213
haproxy.md

0 commit comments

Comments
 (0)