pi-hot 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +168 -2
- package/README.vi.md +169 -0
- package/bin/hot-send.mjs +49 -0
- package/package.json +60 -4
- package/skills/hot/SKILL.md +16 -0
- package/src/adapters/pi/extension.ts +841 -0
- package/src/adapters/pi/render.ts +350 -0
- package/src/core/actions.ts +366 -0
- package/src/core/annotate.ts +282 -0
- package/src/core/code.ts +192 -0
- package/src/core/memory.ts +89 -0
- package/src/core/skills.ts +20 -0
- package/src/core/steps.ts +195 -0
- package/src/core/transcripts.ts +214 -0
- package/src/core/types.ts +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tin Nguyen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,169 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center"><img src="assets/logo.svg" alt="HoT: highlight, tag, explain" width="520"></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<b>Make your coding agent's answers easy to read, and explain jargon right where it appears.</b>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center"><img src="assets/flow.svg" alt="Your agent writes its session file; HoT reads it in a Pi pane beside it" width="900"></p>
|
|
8
|
+
|
|
9
|
+
HoT is a [Pi](https://pi.dev) extension. It reads the chat of **Claude Code, Codex or Pi** (read-only) and shows a colored, plain-language view of it in a pane next to your agent.
|
|
10
|
+
|
|
11
|
+
<p align="center"><sub><a href="assets/demo.mp4">Full video (mp4)</a> · sample data, scripted model calls</sub></p>
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Needs Node.js 22.19+, [Pi](https://pi.dev) 1.7+ and a model signed in inside Pi (no extra API key).
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi install git:github.com/tinxai/hot_terminal # now every `pi` has /hot
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use it
|
|
22
|
+
|
|
23
|
+
Put your agent on the left and `pi` on the right.
|
|
24
|
+
|
|
25
|
+
<p align="center"><img src="assets/steps.svg" alt="1 /hot pick your chat, 2 highlight hard words, 3 click a phrase or select text, get plain words" width="900"></p>
|
|
26
|
+
|
|
27
|
+
## What you get
|
|
28
|
+
|
|
29
|
+
### You ask a question about your agent's chat
|
|
30
|
+
|
|
31
|
+
Type it in your own words in the HoT pane. HoT reads the chat and answers shortly.
|
|
32
|
+
|
|
33
|
+
<p align="center"><img src="assets/ask.gif" alt="Claude Code finishes a long job; you ask HoT what changed and get a short plain answer" width="820"></p>
|
|
34
|
+
|
|
35
|
+
### HoT explains the code your agent wrote
|
|
36
|
+
|
|
37
|
+
AI wrote code you cannot follow? Ask for the part you care about, for example `/hot explain the code that makes the Sign in button`. HoT finds it in what the agent edited (or in the project folder), colors the lines by what they are for, and explains a line when you click it.
|
|
38
|
+
|
|
39
|
+
<p align="center"><img src="assets/code.gif" alt="Ask for the code behind a button; lines are colored by purpose and explained on click" width="820"></p>
|
|
40
|
+
|
|
41
|
+
- The code shown is copied from your file. The model only picks the lines and writes the explanations, so check that it picked the right part.
|
|
42
|
+
- The files listed under the card are sent to your model. `.env`, key and credential files are never read.
|
|
43
|
+
- It explains code. It does not judge it or look for bugs.
|
|
44
|
+
|
|
45
|
+
### HoT rewrites a sentence without its jargon
|
|
46
|
+
|
|
47
|
+
You hit a word you do not know. Instead of a definition to read somewhere else, HoT **rewrites the sentence itself without that word**, keeping its meaning, and shows it in the same place.
|
|
48
|
+
|
|
49
|
+
<p align="center"><img src="assets/plain.svg" alt="Before: a sentence with TTL. After clicking: the same sentence in plain words" width="840"></p>
|
|
50
|
+
|
|
51
|
+
**Way 1: click** a highlighted phrase.
|
|
52
|
+
|
|
53
|
+
<p align="center"><img src="assets/plain-click.gif" alt="Click a highlighted phrase; its sentence is rewritten in place" width="820"></p>
|
|
54
|
+
|
|
55
|
+
**Way 2: select** any text, then press **Option+A** (Mac) or **Alt+A**. Use it for words the highlight did not pick.
|
|
56
|
+
|
|
57
|
+
<p align="center"><img src="assets/plain-select.gif" alt="Select any text and press Option+A" width="820"></p>
|
|
58
|
+
|
|
59
|
+
- `✓` = a second model call agrees the meaning is kept. `⚠` = it may not be.
|
|
60
|
+
- Click the new sentence to get the original back.
|
|
61
|
+
- HoT can only redraw its own highlight card. For text elsewhere on screen, the plain version appears as a new card below.
|
|
62
|
+
|
|
63
|
+
### HoT labels each paragraph of an answer
|
|
64
|
+
|
|
65
|
+
<p align="center"><img src="assets/tag.gif" alt="Type /hot, pick a session, each paragraph gets a label" width="820"></p>
|
|
66
|
+
|
|
67
|
+
### HoT colors the phrases that share one idea
|
|
68
|
+
|
|
69
|
+
Different words for one idea get one color, and keep it the next time you ask.
|
|
70
|
+
|
|
71
|
+
<p align="center"><img src="assets/highlight.gif" alt="Highlight the hard terms; one color per idea" width="820"></p>
|
|
72
|
+
|
|
73
|
+
### HoT shows the tool calls behind a claim
|
|
74
|
+
|
|
75
|
+
Under a claim, the agent's real tool calls. `⚠` is the model's guess at what no step shows.
|
|
76
|
+
|
|
77
|
+
<p align="center"><img src="assets/evidence.gif" alt="Tool calls shown under a tag" width="820"></p>
|
|
78
|
+
|
|
79
|
+
### HoT boxes your agent's screenshot in matching colors
|
|
80
|
+
|
|
81
|
+
If the agent saw a screenshot, HoT boxes where each idea shows up. Needs a model that accepts images. The boxes are the model's guess, so check them.
|
|
82
|
+
|
|
83
|
+
<p align="center"><img src="assets/screenshot.gif" alt="Boxes on a screenshot in the colors of the highlighted ideas" width="820"></p>
|
|
84
|
+
|
|
85
|
+
### You ask several agents one question
|
|
86
|
+
|
|
87
|
+
You add sessions once with `/hot add`, then every question goes to all of them.
|
|
88
|
+
|
|
89
|
+
<p align="center"><img src="assets/sessions.gif" alt="Add several sessions and ask once" width="820"></p>
|
|
90
|
+
|
|
91
|
+
### Claude Code and Codex send requests to HoT
|
|
92
|
+
|
|
93
|
+
You stay in your agent and say *"use HoT to highlight your last answer"*. The result appears in the Pi pane.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
/hot skills # type this in Pi: installs the skill into Claude Code and Codex
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Then open `pi` in another pane, type `/hot` once and start a new agent session. Codex may ask you to approve the command, because it writes outside your project. Asked this way, HoT reads the chat as it was before your request, and tags show no tool evidence.
|
|
100
|
+
|
|
101
|
+
## Commands
|
|
102
|
+
|
|
103
|
+
| Command | Does |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `/hot` | pick a session and tag its latest answer |
|
|
106
|
+
| `/hot explain the code that ...` | find that code, color it, explain it |
|
|
107
|
+
| `/hot <wish>` | do it on the remembered session (highlight, explain, translate, ...) |
|
|
108
|
+
| `/hot pick` · `/hot here <wish>` | switch session · use this Pi chat |
|
|
109
|
+
| `/hot add` · `/hot drop` · `/hot solo` | read up to 5 sessions at once (Space ticks) |
|
|
110
|
+
| `/hot all <wish>` | ask all of them |
|
|
111
|
+
| `/hot plain [phrase]` | plain version without using the mouse |
|
|
112
|
+
| `/hot terms` · `/hot know <term>` · `/hot forget <term>` | words already explained to you |
|
|
113
|
+
| `/hot off` · `/hot on` | stop / start sending plain typing to HoT |
|
|
114
|
+
| `/hot auto` | automatic tags on Pi's own answers, on/off |
|
|
115
|
+
|
|
116
|
+
## Good to know
|
|
117
|
+
|
|
118
|
+
- Plain typing goes to HoT only after you use `/hot` in that Pi, and requests from agents go to the Pi where you used `/hot` last.
|
|
119
|
+
- Each action calls the model Pi is using, so it counts against your account. A rewrite is two calls. Pi's own answers are tagged automatically (`/hot auto` turns that off).
|
|
120
|
+
- Click and select need Pi's default fullscreen mode.
|
|
121
|
+
- HoT sees the last 10 messages of a session (4 each with several sessions), long ones cut.
|
|
122
|
+
- Nothing is sent back into your agent.
|
|
123
|
+
- A rewrite or a `✓` can be wrong.
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary><b>Options, troubleshooting</b></summary>
|
|
127
|
+
|
|
128
|
+
**Options** (environment variables)
|
|
129
|
+
|
|
130
|
+
| Variable | Does |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `HOT_MODEL="provider/id"` | use another (cheaper) model |
|
|
133
|
+
| `HOT_IMAGES=0` | draw screenshots as text |
|
|
134
|
+
| `PI_IMAGE_PROTOCOL=kitty` or `iterm2` | force real images |
|
|
135
|
+
| `HOT_DEBUG=1` | log to `/tmp/hot.log` |
|
|
136
|
+
|
|
137
|
+
**Troubleshooting**
|
|
138
|
+
|
|
139
|
+
- No `/hot` in Pi: run `pi list`; it should show the HoT folder.
|
|
140
|
+
- Option+A does nothing: select text first, and keep the input box empty.
|
|
141
|
+
- No screenshot shown: the model must accept images; only the 3 newest PNG/JPEG of the latest turn are used.
|
|
142
|
+
- Update: `pi update --extensions`, then `/reload` in Pi.
|
|
143
|
+
|
|
144
|
+
**Files:** memory in `~/.hot/memory.json`, annotated pictures in `~/.hot/img/` (never deleted by HoT).
|
|
145
|
+
|
|
146
|
+
**Tested on** macOS, Pi 1.7.0, Herdr inside WezTerm. Clicks and selection were tested with simulated mouse input. The skill was triggered by one sentence in Claude Code and in Codex (non-interactive runs). Not tested: images in other terminals.
|
|
147
|
+
|
|
148
|
+
**Develop:** clone the repo, `npm install`, `pi install "$PWD"`, then `npm test` · `npm run typecheck` · `npm run demo` (needs `rsvg-convert` and `ffmpeg`).
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
## Cite and credits
|
|
153
|
+
|
|
154
|
+
```bibtex
|
|
155
|
+
@software{nguyen2026hot,
|
|
156
|
+
author = {Nguyen, Tin},
|
|
157
|
+
title = {HoT: tag, highlight and explain your coding agent's chat},
|
|
158
|
+
year = {2026},
|
|
159
|
+
version = {0.4.0},
|
|
160
|
+
url = {https://github.com/tinxai/hot_terminal}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Coloring phrases of one meaning: [Highlighted Chain of Thought (HoT)](https://highlightedchainofthought.github.io/).
|
|
165
|
+
- Click a term to rewrite its sentence: suggested by a professor.
|
|
166
|
+
- Built on [Pi](https://pi.dev); runs well in [Herdr](https://herdr.dev).
|
|
167
|
+
- Related: [tmux-llm](https://github.com/hynek-urban/tmux-llm) (popup answers in tmux), [Watcher](https://watcher.apolloresearch.ai/blog/monitor-coding-agents/) (safety monitoring), [auditable](https://github.com/yzhao062/auditable) (auditing agent runs).
|
|
168
|
+
|
|
169
|
+
**Author:** Tin Nguyen · [tinxai.github.io](https://tinxai.github.io/) · [@tinxai](https://github.com/tinxai) · [MIT license](LICENSE)
|
package/README.vi.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<p align="center"><img src="assets/logo.svg" alt="HoT: highlight, tag, explain" width="520"></p>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<b>Giúp câu trả lời của coding agent dễ đọc, và giải thích thuật ngữ ngay tại chỗ nó xuất hiện.</b>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center"><img src="assets/flow.vi.svg" alt="Agent ghi file session; HoT đọc nó trong một pane Pi bên cạnh" width="900"></p>
|
|
8
|
+
|
|
9
|
+
HoT là extension của [Pi](https://pi.dev). Nó đọc chat của **Claude Code, Codex hoặc Pi** (chỉ đọc) rồi hiện bản có màu, lời dễ hiểu trong một pane cạnh agent của bạn.
|
|
10
|
+
|
|
11
|
+
<p align="center"><sub><a href="assets/demo.mp4">Video đầy đủ (mp4)</a> · dữ liệu mẫu, lời gọi model được dựng sẵn</sub></p>
|
|
12
|
+
|
|
13
|
+
## Cài đặt
|
|
14
|
+
|
|
15
|
+
Cần Node.js 22.19+, [Pi](https://pi.dev) 1.7+ và một model đã đăng nhập trong Pi (không cần API key riêng).
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi install git:github.com/tinxai/hot_terminal # now every `pi` has /hot
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Cách dùng
|
|
22
|
+
|
|
23
|
+
Đặt agent bên trái, `pi` bên phải.
|
|
24
|
+
|
|
25
|
+
<p align="center"><img src="assets/steps.vi.svg" alt="1 /hot chọn chat, 2 đánh dấu từ khó, 3 bấm cụm hoặc bôi đen, nhận lời dễ hiểu" width="900"></p>
|
|
26
|
+
|
|
27
|
+
## Có gì
|
|
28
|
+
|
|
29
|
+
### Bạn hỏi về cuộc chat của agent
|
|
30
|
+
|
|
31
|
+
Gõ bằng lời của bạn trong pane HoT. HoT đọc cuộc chat và trả lời ngắn gọn.
|
|
32
|
+
|
|
33
|
+
<p align="center"><img src="assets/ask.gif" alt="Claude Code làm xong một việc dài; bạn hỏi HoT đã đổi gì và nhận câu trả lời ngắn, dễ hiểu" width="820"></p>
|
|
34
|
+
|
|
35
|
+
### HoT giải thích code mà agent đã viết
|
|
36
|
+
|
|
37
|
+
AI viết code bạn không theo kịp? Hỏi đúng phần bạn cần, ví dụ `/hot giải thích đoạn code tạo ra nút Sign in`. HoT tìm nó trong những gì agent đã sửa (hoặc trong thư mục dự án), tô màu các dòng theo công dụng, và giải thích dòng nào bạn bấm vào.
|
|
38
|
+
|
|
39
|
+
<p align="center"><img src="assets/code.gif" alt="Hỏi code đằng sau một nút; các dòng được tô theo công dụng và giải thích khi bấm" width="820"></p>
|
|
40
|
+
|
|
41
|
+
- Code hiển thị được copy từ file của bạn. Model chỉ chọn dòng và viết giải thích, nên hãy kiểm tra nó chọn đúng phần chưa.
|
|
42
|
+
- Các file ghi dưới thẻ được gửi cho model của bạn. File `.env`, khoá và credential không bao giờ được đọc.
|
|
43
|
+
- Nó giải thích code, không chấm code và không tìm bug.
|
|
44
|
+
|
|
45
|
+
### HoT viết lại câu, bỏ thuật ngữ
|
|
46
|
+
|
|
47
|
+
Bạn gặp một từ không biết. Thay vì đưa định nghĩa để bạn đọc ở chỗ khác, HoT **viết lại chính câu đó, không còn từ ấy**, giữ nguyên nghĩa, và hiện ngay đúng vị trí cũ.
|
|
48
|
+
|
|
49
|
+
<p align="center"><img src="assets/plain.vi.svg" alt="Trước: câu có TTL. Sau khi bấm: câu đó bằng lời dễ hiểu" width="840"></p>
|
|
50
|
+
|
|
51
|
+
**Cách 1: bấm** vào một cụm đã tô màu.
|
|
52
|
+
|
|
53
|
+
<p align="center"><img src="assets/plain-click.gif" alt="Bấm vào cụm đã tô; câu được viết lại tại chỗ" width="820"></p>
|
|
54
|
+
|
|
55
|
+
**Cách 2: bôi đen** chữ bất kỳ, rồi bấm **Option+A** (Mac) hoặc **Alt+A**. Dùng cho từ mà highlight không chọn.
|
|
56
|
+
|
|
57
|
+
<p align="center"><img src="assets/plain-select.gif" alt="Bôi đen chữ bất kỳ và bấm Option+A" width="820"></p>
|
|
58
|
+
|
|
59
|
+
- `✓` = lượt gọi model thứ hai đồng ý là giữ nghĩa. `⚠` = có thể không.
|
|
60
|
+
- Bấm vào câu mới để lấy lại câu gốc.
|
|
61
|
+
- HoT chỉ vẽ lại được trong thẻ highlight của nó. Với chữ ở chỗ khác trên màn hình, bản dễ hiểu hiện thành thẻ mới bên dưới.
|
|
62
|
+
|
|
63
|
+
### HoT gắn nhãn cho từng đoạn của câu trả lời
|
|
64
|
+
|
|
65
|
+
<p align="center"><img src="assets/tag.gif" alt="Gõ /hot, chọn session, mỗi đoạn có nhãn" width="820"></p>
|
|
66
|
+
|
|
67
|
+
### HoT tô cùng màu các cụm cùng một ý
|
|
68
|
+
|
|
69
|
+
Nhiều cách gọi của một ý dùng chung một màu, và lần hỏi sau vẫn giữ màu đó.
|
|
70
|
+
|
|
71
|
+
<p align="center"><img src="assets/highlight.gif" alt="Đánh dấu từ khó; mỗi ý một màu" width="820"></p>
|
|
72
|
+
|
|
73
|
+
### HoT cho bạn xem tool call đằng sau một khẳng định
|
|
74
|
+
|
|
75
|
+
Dưới mỗi khẳng định là các tool call thật của agent. `⚠` là model đoán điều chưa bước nào chứng minh.
|
|
76
|
+
|
|
77
|
+
<p align="center"><img src="assets/evidence.gif" alt="Tool call hiện dưới tag" width="820"></p>
|
|
78
|
+
|
|
79
|
+
### HoT khoanh ảnh chụp của agent bằng màu tương ứng
|
|
80
|
+
|
|
81
|
+
Nếu agent đã xem ảnh chụp, HoT khoanh chỗ mỗi ý xuất hiện. Cần model nhận ảnh. Khung là model đoán, hãy kiểm tra lại.
|
|
82
|
+
|
|
83
|
+
<p align="center"><img src="assets/screenshot.gif" alt="Khung trên ảnh cùng màu với ý đã tô" width="820"></p>
|
|
84
|
+
|
|
85
|
+
### Bạn hỏi nhiều agent cùng một câu
|
|
86
|
+
|
|
87
|
+
Bạn thêm session một lần bằng `/hot add`, rồi mỗi câu hỏi đi tới tất cả.
|
|
88
|
+
|
|
89
|
+
<p align="center"><img src="assets/sessions.gif" alt="Thêm nhiều session và hỏi một lần" width="820"></p>
|
|
90
|
+
|
|
91
|
+
### Claude Code và Codex gửi yêu cầu cho HoT
|
|
92
|
+
|
|
93
|
+
Bạn vẫn ở trong agent và nói *"dùng HoT để highlight câu trả lời vừa rồi"*. Kết quả hiện trong pane Pi.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
/hot skills # gõ trong Pi: cài skill vào Claude Code và Codex
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Sau đó mở `pi` ở pane khác, gõ `/hot` một lần và mở phiên agent mới. Codex có thể hỏi bạn cho phép lệnh, vì nó ghi ra ngoài dự án. Gọi theo cách này, HoT đọc cuộc chat như trước lúc bạn yêu cầu, và tag không kèm bằng chứng tool.
|
|
100
|
+
|
|
101
|
+
## Lệnh
|
|
102
|
+
|
|
103
|
+
| Lệnh | Làm gì |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `/hot` | chọn session và tag câu trả lời mới nhất |
|
|
106
|
+
| `/hot giải thích đoạn code ...` | tìm đoạn code đó, tô màu, giải thích |
|
|
107
|
+
| `/hot <yêu cầu>` | chạy trên session đã nhớ (highlight, giải thích, dịch, ...) |
|
|
108
|
+
| `/hot pick` · `/hot here <yêu cầu>` | đổi session · dùng chat Pi này |
|
|
109
|
+
| `/hot add` · `/hot drop` · `/hot solo` | đọc tối đa 5 session cùng lúc (Space để tick) |
|
|
110
|
+
| `/hot all <yêu cầu>` | hỏi tất cả |
|
|
111
|
+
| `/hot plain [cụm]` | viết lại dễ hiểu, không cần chuột |
|
|
112
|
+
| `/hot terms` · `/hot know <từ>` · `/hot forget <từ>` | những từ đã được giải thích |
|
|
113
|
+
| `/hot off` · `/hot on` | tắt / bật việc gõ thường đi vào HoT |
|
|
114
|
+
| `/hot auto` | bật/tắt tag tự động cho câu trả lời của Pi |
|
|
115
|
+
|
|
116
|
+
## Cần biết
|
|
117
|
+
|
|
118
|
+
- Chữ gõ thường chỉ đi vào HoT sau khi bạn dùng `/hot` trong Pi đó, và yêu cầu từ agent đi tới Pi bạn dùng `/hot` gần nhất.
|
|
119
|
+
- Mỗi thao tác gọi model Pi đang dùng nên tính vào tài khoản của bạn. Một lần viết lại là hai lượt gọi. Câu trả lời của Pi được tag tự động (`/hot auto` để tắt).
|
|
120
|
+
- Bấm và bôi đen cần chế độ fullscreen mặc định của Pi.
|
|
121
|
+
- HoT thấy 10 tin nhắn cuối của một session (nhiều session thì mỗi cái 4), tin dài bị cắt.
|
|
122
|
+
- Không gửi gì ngược lại agent của bạn.
|
|
123
|
+
- Bản viết lại hoặc dấu `✓` có thể sai.
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary><b>Tuỳ chọn, xử lý lỗi</b></summary>
|
|
127
|
+
|
|
128
|
+
**Tuỳ chọn** (biến môi trường)
|
|
129
|
+
|
|
130
|
+
| Biến | Làm gì |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `HOT_MODEL="provider/id"` | dùng model khác (rẻ hơn) |
|
|
133
|
+
| `HOT_IMAGES=0` | vẽ ảnh chụp bằng chữ |
|
|
134
|
+
| `PI_IMAGE_PROTOCOL=kitty` hoặc `iterm2` | ép hiện ảnh thật |
|
|
135
|
+
| `HOT_DEBUG=1` | ghi log vào `/tmp/hot.log` |
|
|
136
|
+
|
|
137
|
+
**Xử lý lỗi**
|
|
138
|
+
|
|
139
|
+
- Pi không có `/hot`: chạy `pi list`, phải thấy thư mục HoT.
|
|
140
|
+
- Option+A không làm gì: bôi đen trước, và để ô nhập trống.
|
|
141
|
+
- Không thấy ảnh: model phải nhận ảnh; chỉ lấy 3 ảnh PNG/JPEG mới nhất của lượt cuối.
|
|
142
|
+
- Cập nhật: `pi update --extensions`, rồi `/reload` trong Pi.
|
|
143
|
+
|
|
144
|
+
**File:** bộ nhớ ở `~/.hot/memory.json`, ảnh đã khoanh ở `~/.hot/img/` (HoT không tự xoá).
|
|
145
|
+
|
|
146
|
+
**Đã thử trên** macOS, Pi 1.7.0, Herdr trong WezTerm. Bấm và bôi đen được thử bằng chuột giả lập. Skill đã được kích hoạt bằng một câu nói trong Claude Code và Codex (chạy không tương tác). Chưa thử: ảnh trên terminal khác.
|
|
147
|
+
|
|
148
|
+
**Phát triển:** clone repo, `npm install`, `pi install "$PWD"`, rồi `npm test` · `npm run typecheck` · `npm run demo` (cần `rsvg-convert` và `ffmpeg`).
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
## Trích dẫn và ghi công
|
|
153
|
+
|
|
154
|
+
```bibtex
|
|
155
|
+
@software{nguyen2026hot,
|
|
156
|
+
author = {Nguyen, Tin},
|
|
157
|
+
title = {HoT: tag, highlight and explain your coding agent's chat},
|
|
158
|
+
year = {2026},
|
|
159
|
+
version = {0.4.0},
|
|
160
|
+
url = {https://github.com/tinxai/hot_terminal}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Tô cùng màu cho cụm cùng nghĩa: [Highlighted Chain of Thought (HoT)](https://highlightedchainofthought.github.io/).
|
|
165
|
+
- Bấm vào thuật ngữ để viết lại câu: ý tưởng do một giáo sư gợi ý.
|
|
166
|
+
- Xây trên [Pi](https://pi.dev); chạy tốt trong [Herdr](https://herdr.dev).
|
|
167
|
+
- Liên quan: [tmux-llm](https://github.com/hynek-urban/tmux-llm) (popup trong tmux), [Watcher](https://watcher.apolloresearch.ai/blog/monitor-coding-agents/) (giám sát an toàn), [auditable](https://github.com/yzhao062/auditable) (kiểm định lượt chạy của agent).
|
|
168
|
+
|
|
169
|
+
**Tác giả:** Tin Nguyen · [tinxai.github.io](https://tinxai.github.io/) · [@tinxai](https://github.com/tinxai) · [giấy phép MIT](LICENSE)
|
package/bin/hot-send.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Send a request to the Pi pane that runs HoT. Used by the Claude Code skill (and anything else that can run a command).
|
|
4
|
+
* Usage: hot-send.mjs [--agent claude|codex] "what to do with the recent chat"
|
|
5
|
+
* The session is the calling agent's own, found by the id the agent puts in the environment;
|
|
6
|
+
* without it, the newest-modified transcript of that agent.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import * as os from "node:os";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
import { stripTypeScriptTypes } from "node:module";
|
|
12
|
+
|
|
13
|
+
// Node refuses to run .ts files inside node_modules (an npm install), so strip the types here. That file imports only Node built-ins.
|
|
14
|
+
const source = fs.readFileSync(new URL("../src/core/transcripts.ts", import.meta.url), "utf8");
|
|
15
|
+
const { listSessions } = await import(`data:text/javascript,${encodeURIComponent(stripTypeScriptTypes(source))}`);
|
|
16
|
+
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
let agent = "claude";
|
|
19
|
+
const words = [];
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
if (args[i] === "--agent") agent = args[++i];
|
|
22
|
+
else words.push(args[i]);
|
|
23
|
+
}
|
|
24
|
+
const instruction = words.join(" ").trim();
|
|
25
|
+
|
|
26
|
+
const ownId = agent === "codex" ? process.env.CODEX_THREAD_ID : process.env.CLAUDE_CODE_SESSION_ID;
|
|
27
|
+
const sessions = listSessions({ limit: ownId ? 200 : 1, agents: [agent] });
|
|
28
|
+
const session = sessions.find((x) => x.id === ownId) ?? sessions[0];
|
|
29
|
+
if (!session) {
|
|
30
|
+
console.error(`HoT: no ${agent} session found`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const dir = path.join(os.homedir(), ".hot");
|
|
35
|
+
const inbox = path.join(dir, "inbox");
|
|
36
|
+
fs.mkdirSync(inbox, { recursive: true });
|
|
37
|
+
const name = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`;
|
|
38
|
+
const tmp = path.join(dir, `.${name}.tmp`);
|
|
39
|
+
fs.writeFileSync(tmp, JSON.stringify({ instruction, session, createdAt: Date.now() }));
|
|
40
|
+
fs.renameSync(tmp, path.join(inbox, name)); // atomic: Pi never sees a half-written file
|
|
41
|
+
|
|
42
|
+
let alive = false;
|
|
43
|
+
try {
|
|
44
|
+
const pi = JSON.parse(fs.readFileSync(path.join(dir, "pi.json"), "utf8"));
|
|
45
|
+
process.kill(pi.pid, 0);
|
|
46
|
+
alive = true;
|
|
47
|
+
} catch {}
|
|
48
|
+
|
|
49
|
+
console.log(alive ? `Sent to Pi: "${instruction || "tag"}" (${session.agent} · ${path.basename(session.cwd)}). The result appears in the Pi pane.` : `Request saved, but no Pi pane running HoT was found. Install HoT (pi install git:github.com/tinxai/hot_terminal), start pi, and it will pick this up.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-hot",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Read your coding agent's chat in plain words: click jargon to rewrite it, highlight ideas, explain code. Pi extension for Claude Code, Codex and Pi sessions.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"typecheck": "tsc -p .",
|
|
7
|
+
"test": "tsx tests/core.test.ts",
|
|
8
|
+
"demo": "tsx scripts/make-demo.ts"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"claude-code",
|
|
12
|
+
"codex",
|
|
13
|
+
"coding-agent",
|
|
14
|
+
"explain-code",
|
|
15
|
+
"highlight",
|
|
16
|
+
"pi-extension",
|
|
17
|
+
"pi-package",
|
|
18
|
+
"tui"
|
|
19
|
+
],
|
|
20
|
+
"author": "Tin Nguyen (https://tinxai.github.io/)",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"jpeg-js": "^0.4.4",
|
|
25
|
+
"pngjs": "^7.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@earendil-works/pi-coding-agent": "^1.7.0",
|
|
29
|
+
"@types/node": "^26.6.11",
|
|
30
|
+
"@types/pngjs": "^6.0.5",
|
|
31
|
+
"tsx": "^4.23.15",
|
|
32
|
+
"typescript": "^7.0.2"
|
|
33
|
+
},
|
|
34
|
+
"pi": {
|
|
35
|
+
"extensions": [
|
|
36
|
+
"./src/adapters/pi/extension.ts"
|
|
37
|
+
],
|
|
38
|
+
"image": "https://raw.githubusercontent.com/tinxai/hot_terminal/main/assets/plain-click.gif",
|
|
39
|
+
"video": "https://raw.githubusercontent.com/tinxai/hot_terminal/main/assets/demo.mp4"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/tinxai/hot_terminal.git"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/tinxai/hot_terminal",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/tinxai/hot_terminal/issues"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22.19.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"src",
|
|
57
|
+
"bin",
|
|
58
|
+
"skills",
|
|
59
|
+
"README.md",
|
|
60
|
+
"LICENSE"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hot
|
|
3
|
+
description: Use only when the user asks to hand the recent chat to "HoT" (the reading tool that runs in a Pi pane) or to "Pi" for highlighting, tagging, explaining, rewriting or translating, e.g. "use HoT to highlight your last answer", "dùng pi để giải thích câu trả lời cuối". Never for other meanings of "hot" (hot reload, popular, temperature). Sends the request; does not do the work itself.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# HoT: hand the recent chat to Pi
|
|
7
|
+
|
|
8
|
+
Pi shows colored highlights and tags that this terminal cannot, so do NOT do the highlighting yourself.
|
|
9
|
+
|
|
10
|
+
1. Run this one command, passing the user's request verbatim and in their own language:
|
|
11
|
+
|
|
12
|
+
node --no-warnings "{{HOT_DIR}}/bin/hot-send.mjs" --agent {{AGENT}} "<what the user wants done with the recent chat>"
|
|
13
|
+
|
|
14
|
+
It writes a small request file under `~/.hot/inbox`. If a sandbox blocks that write, ask for approval to run it.
|
|
15
|
+
2. Reply with one short sentence: it was sent, and the result will appear in the Pi pane. Do not paste or summarize any result.
|
|
16
|
+
3. If the command says no Pi pane is running HoT, tell the user to start `pi` in another pane; do not retry in a loop.
|