agentleFS
umitsu-techumitsu-tech/claude-code-discord-bot/skills/ctx/SKILL.md

ctx

Skill0 starsChanged 52 days agoMITView on GitHub

今のセッションのコンテキスト使用率(ctx)と利用上限の使用率(5h / 7d)を同梱スクリプトで調べて返す。Discord からの依頼なら reply で返し、ターミナルから呼ばれたらその場で答える

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. ctxrs/ctx★ 1.2ksame name
    2. motiful/ctx★ 1same name
    3. puretensor/agent-context-bundles★ 1same name
    4. ctx-hq/ctx★ 0same 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.

  • In this repository6 other files it gives its agents.

The file

Files
SKILL.md

コンテキスト使用量の確認

Discord セッションは 1 つのセッションを開いたまま使うので、コンテキストの残りを Discord から確かめられるようにする。値はターミナル下部のステータスラインと同じ。

手順

  1. 次を実行する。引数は要らない(セッション ID は環境変数 CLAUDE_CODE_SESSION_ID から取る)

    ${CLAUDE_SKILL_DIR}/scripts/context_usage.py
  2. Discord からの依頼なら、出力をそのままコードブロックに入れて reply する。前置きは付けない。コードブロックに入れるのは、Discord が行頭の記号をリスト表示に変えて崩すため
  3. ctx が 80% 以上なら、「区切りのいいところで /clear しようか」と一言添える
  4. ターミナルから呼ばれたときは reply せず、出力をそのまま答える

数値の意味

  • ctx: コンテキストウィンドウの使用率。直前の API 応答の時点の入力トークン(キャッシュを含む)をウィンドウ幅で割ったもの
  • 5h / 7d: 利用上限の使用率と、リセットの時刻(JST)
  • source statusline: ステータスラインが保存した JSON から読んだ値。ターミナルの表示と同じ
  • source transcript: ステータスラインの JSON が無いときの代わり。会話ログの usage から概算し、ウィンドウ幅は settings.json の model から推定する([1m] なら 1M)。5h / 7d は出ない

失敗したとき

「使用量データが見つかりません」と出たら、まだ API の応答が 1 回も無い新しいセッションか、ステータスラインの JSON を保存する設定が無い環境。1 ターン進めてから実行し直すか、README のセットアップ(ステータスラインの JSON を保存する手順)を確かめるよう伝える。

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.