agentsclimarketplace

Loki activity

Skill dominion525/agent-skills/skills/loki-activity

A collection of Skills for Claude Code

Install
npx -y skills add dominion525/agent-skills --skill loki-activity

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Retrieves, aggregates, and visualizes Claude Code OTEL telemetry stored in Grafana Loki to produce per-project work blocks and totals. Use when the user asks for time spent today, this week, a project-by-project activity summary, or a heatmap visualization (e.g. says "今日の作業時間" / "今週の稼働" / "プロジェクト別の作業サマリー" / "ヒートマップ").

SKILL.md

8.8 KB, ~3.0k tokens by cl100k_base, as published. Nobody here has run it

loki-activity スキル

Grafana Lokiに蓄積されたClaude CodeのOTELテレメトリから、 プロジェクト別の作業時間を集計してレポートする。

前提条件

  • logclijqgit がインストール済み(activity.sh 起動時に必須チェック)
  • 環境変数 LOKI_ADDR, LOKI_USERNAME, LOKI_PASSWORD が設定済み
  • ヒートマップ表示を使う場合のみ: uv および Python 3.10+ がインストール済み(PEP 723 で rich / Pillow を自動インストール)

動作ルール

  • Loki 側の必須ラベル: service_name="claude-code"service_namespaceevent_nameevent_timestamp。これらが Claude Code の OTEL テレメトリとして揃っている前提で動く。
  • 現在時刻の確認: 「今日」「今週」「過去 N 日」のような相対時間指定を解釈する前に、必ず date コマンドで現在の UTC / JST を確認する。AI のシステムプロンプト上の時刻と実行ホストの時刻にズレがあると、フィルタ範囲を取り違える。
  • 引数の優先順位: --all を指定した場合、--project および自動フィルタ(カレントリポジトリ名)は無効になる。
  • 予約語との衝突: all / week / month はそれぞれ「全プロジェクト」「過去 7 日」「過去 30 日」として解釈される。同名のプロジェクトを指したい場合は --project all 等を明示する。

引数の処理

$ARGUMENTS を以下のルールで解析する:

ユーザー入力解釈スクリプト引数
(なし)過去24時間、現在のプロジェクト(デフォルト: カレントリポジトリ名で自動フィルタ)
3過去3日分、現在のプロジェクト--since 72h
all過去24時間、全プロジェクト--all
all 3過去3日分、全プロジェクト--all --since 72h
aleister過去24h、特定プロジェクト--project aleister
aleister 7過去7日、特定プロジェクト--project aleister --since 168h
week過去7日、現在のプロジェクト--since 168h
month過去30日、現在のプロジェクト--since 720h
all week過去7日、全プロジェクト--all --since 168h
all --overall過去24時間、全プロジェクト合算のみ--all + heatmap.py --overall

数値はN日分を意味し、N * 24 で時間に換算する。 weekmonth はそれぞれ 168h、720h のエイリアス。 文字列は service_namespace の部分一致フィルタとして扱う。 all を指定すると全プロジェクトを対象にする。 デフォルトではカレントリポジトリ名(git rev-parse --show-toplevel のbasename)で自動フィルタする。Git 管理外のディレクトリで実行された場合はフィルタが空になり、結果として全プロジェクトを対象にする(--all を指定した場合と同等)。

スクリプト呼び出し

解析した引数をもとに、以下のようにスクリプトを呼び出す:

bash ~/.claude/skills/loki-activity/scripts/activity.sh [OPTIONS]

オプション:

  • --since DURATION — 期間(logcli形式: 24h, 168h, 720h
  • --project NAME — プロジェクトフィルタ(service_namespace部分一致)
  • --all — 全プロジェクトを対象にする(デフォルトのカレントリポジトリ自動フィルタを無効化)
  • --detail — 全イベント一覧を出力する(デフォルトはサマリー)
  • --interval N — サマリーの区切り分数(デフォルト: 10、60の約数を推奨: 5, 10, 15, 20, 30)

--project--all も指定しない場合、カレントリポジトリ名で自動的にフィルタされる。

スクリプトの出力

サマリーモード(デフォルト)

時間帯ごとにイベント数を集計した要約を返す。

{
  "query_params": { "since": "24h", "project_filter": "sandbox", "mode": "summary", "interval_minutes": 10 },
  "projects": [
    {
      "namespace": "sandbox",
      "interval_minutes": 10,
      "slots": [
        { "time_utc": "2026-04-05T04:30:00Z", "total": 35, "user_prompt": 3, "api_request": 11, "tool_use": 21 },
        { "time_utc": "2026-04-05T04:40:00Z", "total": 23, "user_prompt": 2, "api_request": 6, "tool_use": 15 }
      ]
    }
  ]
}

各スロットのフィールド:

  • time_utc — 時間帯の開始時刻(UTC)
  • total — その時間帯のイベント総数
  • user_prompt — 人間がプロンプトを送信した回数(人間のアクティビティの確実な証拠)
  • api_request — Claude APIリクエスト数(Claudeが処理中。数分から10分かかることもある)
  • tool_use — ツール実行関連のイベント数(tool_result + tool_decision)

ディテールモード(--detail)

全イベントの一覧を時系列で返す。データ量が多くなるため、特定の時間帯を詳しく調べたい場合に使う。

作業ブロックの判定(あなたが行う)

サマリーのスロット一覧を見て、「人間が作業していたと思われるひとかたまりの時間帯」を判断する。 機械的な固定閾値で切るのではなく、文脈を読んで判断すること。

判断の目安:

  • user_prompt が含まれるスロットは人間が能動的に操作していた証拠
  • user_prompt がなくても api_requesttool_use が多いスロットは、Claudeが処理中(数分から10分かかることもある)
  • スロットが連続していれば一連の作業とみなす
  • 空のスロット(データなし)が挟まっていても、前後の文脈から一連の作業と判断できるならまとめてよい
  • 完璧でなくてよい。後で人間が補正する前提

レポートのフォーマット

タイムスタンプはUTCからJST(+9時間)に変換して表示する。

プロジェクトごとに作業ブロックの開始・終了時刻と推定時間を出す。 複数プロジェクトがある場合はプロジェクト別にまとめる。

データが0件の場合は「該当期間にイベントが見つかりませんでした」と報告する。

ヒートマップ表示

ユーザーが「ヒートマップ」「heatmap」「可視化」等と言った場合、activity.shの出力をヒートマップスクリプトにパイプして表示する。

bash ~/.claude/skills/loki-activity/scripts/activity.sh [OPTIONS] | uv run ~/.claude/skills/loki-activity/scripts/heatmap.py [--color]
  • デフォルトはASCIIモード(ブロック文字で密度表示)
  • --color をつけるとTrueColorモード(GitHubの草風の緑グラデーション)
  • --metric で表示メトリクスを変更可能(total, user_prompt, api_request, tool_use)
  • --image で iTerm2 インライン画像、--output FILE で PNG ファイル保存、--overall で全プロジェクト合算のみ表示(複数プロジェクトが対象のときに有効)
  • 期間が複数日に渡っても、日付別ではなく同時刻帯を日跨ぎで合算して 24 時間 1 グリッドにする(曜日 × 時刻のマトリクスにはならない)
  • activity.shのオプション(--all, --since, --project)はそのまま使える
  • --detail は heatmap.py にパイプできない(detail 出力は events 構造、heatmap.py は slots 構造を要求するため)

エラー時の挙動

  • logcli 実行失敗: activity.sh は exit 1 で終了し、stderr に エラー: logcli の実行に失敗しました (exit code: N) を出力する。認証情報(環境変数)の不足、Loki 接続不可、クエリ構文エラー等が主な原因。
  • 依存コマンドなし: logcli, jq, git のいずれかが PATH になければ exit 1 で エラー: ... が見つかりません を出して終了する。
  • 対象期間にデータなし: スクリプト自体は exit 0 で正常終了し、projects: [](空配列)の JSON を返す。「該当期間にイベントが見つかりませんでした」と報告する。
  • Git 管理外で実行: 自動フィルタが効かず全プロジェクトを対象にする(--all と同等)。エラーにはならない。

Gives 0 of the 12 instructions most monitoring observability skills give in ~3.0k tokens

Counted across 481 of the 483 authors here whose files we hold, read 2026-08-06

  • link every alert to a runbookin 43 of 481, across 35 files
  • use structured json loggingin 36 of 481, across 31 files
  • alert on user-facing symptomsin 20 of 481, across 15 files
  • emit structured JSON logs with stable event namesin 18 of 481, across 13 files
  • propagate trace context across boundariesin 16 of 481
  • use histograms for latency trackingin 14 of 481, across 9 files
  • use OpenTelemetry for distributed tracingin 13 of 481, across 8 files
  • include a correlation ID on every log linein 13 of 481, across 8 files
  • Define service level objectivesin 10 of 481, across 7 files
  • Call useAzureMonitor before importing other modulesin 9 of 481, across 2 files
  • stop and ask for clarification if inputs are missingin 9 of 481, across 2 files
  • define on-call questions before adding telemetryin 9 of 481, across 4 files

Said here and by no other author read

  • convert relative time inputs to hours
  • identify the current project from the git repository
  • override project filters with the --all flag
  • determine current time before interpreting relative dates
  • convert numerical arguments to hours by multiplying by twenty-four
  • run the activity script with parsed options

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.