clear
Skill0 starsChanged 52 days agoMITView on GitHub
このセッションが動いている tmux ペインへ /clear を送り、ターンが終わったところでコンテキストを空にする。Discord のメッセージでは組み込みの /clear が実行されないので、その代わりに使う。ターミナルで直接 /clear できるときは要らない
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zecod/claude-queuetheir own version, first seen Nov 15, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- zecod/claude-queue★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
Discord からの /clear
channel 経由のメッセージは Claude への入力テキストとして届くだけで、/clear のような組み込みコマンドは実行されない(公式は未対応。anthropics/claude-code#37342)。そこで、このセッションが動いている tmux ペインへ tmux send-keys で /clear と Enter を送る。/clear はターンの途中に送ってもキューに入り、このターンが終わった直後に実行される。
手順
今の使用量を調べる。失敗しても先へ進む
${CLAUDE_PLUGIN_ROOT}/skills/ctx/scripts/context_usage.py- これからクリアすることを Discord に reply する。例「コンテキストをクリアするね(今 54%、544K tokens)。終わったらこのチャンネルに知らせるよ」
- 進めている作業に、まだ保存していない要点(台帳や設計メモに書くこと)があれば、ここで保存する。クリアしたあとには引き継がれない
/clear を送る。
--chat-idには、届いた<channel>タグのchat_idを渡す(完了通知の宛先になる)${CLAUDE_SKILL_DIR}/scripts/clear_session.sh --chat-id <chat_id>- 出力の頭で分ける
OK:なら、ほかのツールを呼ばずに短く終える。ターンが終わると /clear が走り、新しいセッションの SessionStart フック(このプラグインのhooks/notify-clear-done.py)が Discord へ「クリアしたよ」を投稿するNG:なら、その理由(tmux の外で動いている、端末の無いリモートセッションなど)を Discord に伝える。その場合はユーザーがターミナルで /clear するしかない
仕組みと制約
- 送り先は、
CLAUDE_PID→ そのプロセスの TTY → 同じ TTY を持つ tmux ペイン、の順に特定する。Discord セッションは tmux の中でclaude --channels plugin:discord-bot@ryuki-pluginsとして動かす前提で、scripts/start-discord.shがそのように起動する - /clear のあともプロセスと MCP の接続(Discord とのやりとり)はそのまま残り、セッション ID だけが新しくなる
- 完了通知はフックが出すので、プラグインを入れ替えたあとは Discord セッションの再起動が要る
- ターミナルで手動で /clear したときは通知しない。通知のきっかけになるマーカー(
${DISCORD_BOT_STATE_DIR:-~/.claude/discord-bot}/pending-clear.json)が無いため - /compact は扱わない
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

