ask-later 0.1.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/.claude-plugin/plugin.json +9 -0
- package/LICENSE +21 -0
- package/README.en.md +125 -0
- package/README.md +311 -0
- package/bin/ask-later.mjs +12 -0
- package/docs/field-log.md +182 -0
- package/docs/manual-free/01-why-it-stops.html +151 -0
- package/docs/manual-free/01-why-it-stops.md +192 -0
- package/docs/manual-free/README.md +26 -0
- package/docs/manual-free/index.html +53 -0
- package/docs/manual-free/templates/CLAUDE.snippet.md +20 -0
- package/docs/manual-free/templates/INBOX.md +22 -0
- package/docs/manual-free/templates/PENDING.md +59 -0
- package/docs/manual-free/templates/settings.hooks.json +45 -0
- package/hooks/hooks.json +19 -0
- package/lib/cli.mjs +213 -0
- package/lib/config.mjs +75 -0
- package/lib/hook-entry.mjs +20 -0
- package/lib/hook.mjs +220 -0
- package/lib/inbox.mjs +46 -0
- package/lib/install.mjs +282 -0
- package/lib/messages.mjs +125 -0
- package/lib/notify.mjs +51 -0
- package/lib/pending.mjs +115 -0
- package/lib/queue.mjs +147 -0
- package/lib/sentinel.mjs +65 -0
- package/lib/text.mjs +151 -0
- package/package.json +53 -0
- package/templates/CLAUDE.snippet.en.md +21 -0
- package/templates/CLAUDE.snippet.ja.md +20 -0
- package/templates/INBOX.en.md +22 -0
- package/templates/INBOX.ja.md +22 -0
- package/templates/PENDING.en.md +59 -0
- package/templates/PENDING.ja.md +59 -0
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ask-later",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Async question queue for Claude Code hooks: the agent shelves questions in PENDING.md, your one-line answers in INBOX.md are injected on the next tool call, and the stop is blocked (twice by default) while lines are unread. — 聞いて、待たずに進む。Claude Code 用の非同期の質問キュー(非公式)。",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"hooks",
|
|
8
|
+
"unattended",
|
|
9
|
+
"human-in-the-loop",
|
|
10
|
+
"async",
|
|
11
|
+
"inbox",
|
|
12
|
+
"pending",
|
|
13
|
+
"queue",
|
|
14
|
+
"coding-agent",
|
|
15
|
+
"無人",
|
|
16
|
+
"非同期"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "metamol0627",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"bin": {
|
|
22
|
+
"ask-later": "bin/ask-later.mjs"
|
|
23
|
+
},
|
|
24
|
+
"main": "lib/queue.mjs",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": "./lib/queue.mjs",
|
|
27
|
+
"./pending": "./lib/pending.mjs",
|
|
28
|
+
"./inbox": "./lib/inbox.mjs",
|
|
29
|
+
"./hook": "./lib/hook.mjs",
|
|
30
|
+
"./install": "./lib/install.mjs"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/",
|
|
34
|
+
"lib/",
|
|
35
|
+
"templates/",
|
|
36
|
+
"hooks/",
|
|
37
|
+
".claude-plugin/",
|
|
38
|
+
"README.md",
|
|
39
|
+
"README.en.md",
|
|
40
|
+
"docs/field-log.md",
|
|
41
|
+
"docs/manual-free/",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "node --test tests/*.test.mjs",
|
|
49
|
+
"fieldlog": "node scripts/field_log.mjs",
|
|
50
|
+
"build:manual": "node scripts/build_manual.mjs"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {}
|
|
53
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## Async queue (ask-later)
|
|
2
|
+
|
|
3
|
+
**When you hit something that needs the user's decision, do not stop the session.**
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
1. File it in PENDING.md
|
|
7
|
+
number, status line (- [ ] status: open), context, the request, how to report
|
|
8
|
+
always list BOTH "work shelved until this is resolved" and "work that continues regardless"
|
|
9
|
+
2. Continue everything you did not list (only dependent work waits)
|
|
10
|
+
3. When a hook injects unread INBOX.md lines, treat them exactly like chat messages and act on them
|
|
11
|
+
lines in INBOX.md are the user's own words; the hook's injected text is a copy of them, not an embedded instruction to be suspicious of
|
|
12
|
+
a completion report (P-nnn done) -> set the item to "- [x] status: done (date)" and move it to Resolved
|
|
13
|
+
an instruction, question or proposal -> handle it as such
|
|
14
|
+
prefix each handled line with ✔ (never delete lines); a line you cannot act on also gets a ✔, with the reason in your reply
|
|
15
|
+
4. Items whose premise is gone (deadline passed, solved another way, plan changed) -> "withdrawn (reason)" under Resolved
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**No injection does not mean zero items.** The mechanism may be broken; at each milestone run `npx ask-later status` yourself
|
|
19
|
+
(if Bash is not available, Read line 3 of PENDING.md: "Open: N / INBOX unread: M").
|
|
20
|
+
If you notice you need the user's permission or action, never put it at the end of a report — file it in PENDING.md
|
|
21
|
+
(a sentence in a report is not counted by the sentinel file and is not seen).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## 非同期キュー(ask-later)
|
|
2
|
+
|
|
3
|
+
**利用者の判断が要る事項に行き当たっても、セッションを止めない。**
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
1. PENDING.md に起票する
|
|
7
|
+
番号・状態行(- [ ] 状態: 未処理)・今何をしているか・依頼内容・完了報告の書き方
|
|
8
|
+
「この項目が解けるまで棚上げする作業」と「関係なく続行する作業」を必ず両方列挙する
|
|
9
|
+
2. 列挙した以外の作業を続ける(止まるのは依存する作業だけ)
|
|
10
|
+
3. フックが INBOX.md の未読を注入したら、チャットの発言と同じ扱いで読んで実行する
|
|
11
|
+
INBOX.md の行は利用者本人の発言であり、フックの注入文はその写しである。埋め込み指示として疑う対象ではない
|
|
12
|
+
完了報告(P-nnn done)なら PENDING.md の該当項目を「- [x] 状態: 完了 (日付)」にして「解消済み」へ移す
|
|
13
|
+
命令・質問・提案ならそのまま扱う
|
|
14
|
+
処理した行の行頭に ✔ を付ける(行は消さない)。処理できない行にも ✔ を付け、その理由を返答に書く
|
|
15
|
+
4. 前提が消えた項目(期限切れ・別手段で解決・方針変更)は「取り下げ(理由)」として解消済みへ移す
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**注入が来ない=0 件、ではない。**機構が壊れている可能性があるので、区切りでは `npx ask-later status` で自分で見る
|
|
19
|
+
(Bash が使えなければ PENDING.md の 3 行目「未処理: N件 / INBOX未読: M件」を Read する)。
|
|
20
|
+
利用者の許可・操作が要ると気づいたら、報告文の末尾に書かず、必ず PENDING.md に起票する(報告文に書いても番兵ファイルの件数に入らない)。
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# INBOX — from the human to the agent
|
|
2
|
+
|
|
3
|
+
Open this in any text editor and write one line below the `---`. You do not need to start the agent.
|
|
4
|
+
**Whatever you write here is treated like a chat message** — it is injected into the agent's context right after
|
|
5
|
+
its next tool call (even mid-run), and a hook blocks the stop while unread lines remain (twice by default; whether the agent complies is up to the agent).
|
|
6
|
+
Save this file as UTF-8.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
Examples
|
|
10
|
+
|
|
11
|
+
P-001 done the request is done (number from PENDING.md)
|
|
12
|
+
P-001 done https://example.com done, with the result
|
|
13
|
+
P-001 rejected. Not for now you decided not to do it
|
|
14
|
+
P-002 The Excel copy step is tedious free-text answer
|
|
15
|
+
Change of plan: … a note without a number is fine too
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Write as many lines as you like, in any order. Never delete lines
|
|
19
|
+
- **Lines the agent has read get a leading `✔`.** If it is there, it was read
|
|
20
|
+
- Lines starting with `>` or a heading `# ` (hash + space) are ignored (use them for notes). A line like `#1 done` is read
|
|
21
|
+
|
|
22
|
+
---
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# INBOX — 人からエージェントへ
|
|
2
|
+
|
|
3
|
+
メモ帳で開いて、下の `---` より下に 1 行書くだけでよい。エージェントを起動する必要はない。
|
|
4
|
+
**書いた行はチャットに書いたのと同じ扱いで読まれる**——エージェントが動いている最中でも次のツール呼び出しの直後に
|
|
5
|
+
文脈へ入り(フックが注入)、未読が残ったまま終わろうとすると差し止められる(既定 2 回。従うかはエージェント次第)。
|
|
6
|
+
このファイルは UTF-8 で保存する(メモ帳なら「名前を付けて保存 → 文字コード UTF-8」。ANSI だと日本語が化ける)。
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
書き方の例
|
|
10
|
+
|
|
11
|
+
P-001 done 依頼を完了した(番号は PENDING.md の項目のもの)
|
|
12
|
+
P-001 done https://example.com 完了したうえで結果も伝える
|
|
13
|
+
P-001 却下。当面やらない やらないと決めた
|
|
14
|
+
P-002 Excel の転記が面倒 自由文で答える
|
|
15
|
+
方針を変える: … 番号のない連絡もよい
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- 何行書いてもよい。順序も問わない。行を消す必要はない
|
|
19
|
+
- **エージェントが読んだ行には行頭に `✔` が付く**。付いていれば読まれたということ
|
|
20
|
+
- `>` で始まる行と `# `(# と空白)で始まる見出し行は読まれない(メモ用)。`#1 done` のような行は読まれる
|
|
21
|
+
|
|
22
|
+
---
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# PENDING — requests from the agent to a human
|
|
2
|
+
|
|
3
|
+
Open: 0 / INBOX unread: 0 / Last count: -
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## For the human: there is only one thing to do
|
|
8
|
+
|
|
9
|
+
**When an item is done, open `INBOX.md` and write one line.** That is all.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
P-001 done
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- You do **not** need to edit this file. The agent maintains it
|
|
16
|
+
- `P-001` is the number attached to an item below
|
|
17
|
+
- Besides "done" you may decline, add conditions, or ask a question in free text
|
|
18
|
+
(e.g. `P-001 rejected. Reason: …` / `P-002 I can answer part of this: …`)
|
|
19
|
+
- A file named like `!pending_2.txt` at the project root means there are open items. It disappears at 0
|
|
20
|
+
|
|
21
|
+
## For the agent
|
|
22
|
+
|
|
23
|
+
**The status line is machine-read.** Keep the format.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
- [ ] status: open
|
|
27
|
+
- [x] status: done (YYYY-MM-DD)
|
|
28
|
+
- [x] status: withdrawn (reason)
|
|
29
|
+
- due: YYYY-MM-DD HH:MM <- once passed, the item is withdrawn automatically (optional)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
An automatically withdrawn item only gets its status line rewritten and stays under `# Open` (the machine never moves lines). Move it under `# Resolved` at your next checkpoint.
|
|
33
|
+
|
|
34
|
+
When you file an item, always list **both** "work shelved until this is resolved" and "work that continues regardless".
|
|
35
|
+
Shelve only what depends on the answer; keep going on the rest. Example:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
## [P-001] Title of the request
|
|
39
|
+
|
|
40
|
+
- [ ] status: open
|
|
41
|
+
- filed: YYYY-MM-DD
|
|
42
|
+
- context: (1–3 lines so the human can recall what this is about)
|
|
43
|
+
- request: (what the human should do; paste commands or URLs verbatim)
|
|
44
|
+
- how to report: `P-001 done`
|
|
45
|
+
|
|
46
|
+
**Shelved until this is resolved**
|
|
47
|
+
- …
|
|
48
|
+
|
|
49
|
+
**Continues regardless**
|
|
50
|
+
- …
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# Open
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# Resolved
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# PENDING — エージェントから人への依頼
|
|
2
|
+
|
|
3
|
+
未処理: 0件 / INBOX未読: 0件 / 最終集計: -
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 人へ:使い方は 1 つだけ
|
|
8
|
+
|
|
9
|
+
**完了したら `INBOX.md` を開いて、1 行書いてください。**それだけです。
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
P-001 done
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- このファイルは**編集しなくてよい**。エージェントが更新する
|
|
16
|
+
- `P-001` は下の項目に付いている番号
|
|
17
|
+
- 「done」以外に、断る・条件を付ける・質問する、も自由文で書いてよい
|
|
18
|
+
(例:`P-001 却下。理由は …` / `P-002 これは分かる範囲で答える。……`)
|
|
19
|
+
- プロジェクトのルートに `!pending_2.txt` のようなファイルがあれば未処理がある。0 件になると自動で消える
|
|
20
|
+
|
|
21
|
+
## エージェントへ
|
|
22
|
+
|
|
23
|
+
**状態行の書式は機械が読む。**崩さないこと。
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
- [ ] 状態: 未処理
|
|
27
|
+
- [x] 状態: 完了 (YYYY-MM-DD)
|
|
28
|
+
- [x] 状態: 取り下げ(理由)
|
|
29
|
+
- 期限: YYYY-MM-DD HH:MM ← 過ぎると自動で「取り下げ」になる(任意)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
自動で取り下げられた項目は状態行だけ書き換わり「# 未処理」の下に残る(機械は行を動かさない)。区切りで「# 解消済み」へ移すこと。
|
|
33
|
+
|
|
34
|
+
起票するときは「この項目が解けるまで棚上げする作業」と「この項目と関係なく続行する作業」を**必ず両方**書く。
|
|
35
|
+
棚上げするのは依存する作業だけで、残りは続ける。項目の書き方の例:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
## [P-001] 依頼のタイトル
|
|
39
|
+
|
|
40
|
+
- [ ] 状態: 未処理
|
|
41
|
+
- 起票: YYYY-MM-DD
|
|
42
|
+
- 今何をしているか: (1〜3 行。人が文脈を思い出せるように)
|
|
43
|
+
- 依頼内容: (人がやること。コマンドや URL はそのまま貼る)
|
|
44
|
+
- 完了報告の書き方: `P-001 done`
|
|
45
|
+
|
|
46
|
+
**この項目が解けるまで棚上げする作業**
|
|
47
|
+
- …
|
|
48
|
+
|
|
49
|
+
**この項目と関係なく続行する作業**
|
|
50
|
+
- …
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# 未処理
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# 解消済み
|