Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

observability:session

БесплатноБез исполняемых скриптовНе проверен

Query Claude Code session history via a DuckDB index over `~/.claude/projects/`. Use when asked about Claude Code activity ("how many tokens today?", "what…

bendruckerот bendrucker★ 18 звёзд на GitHub

Об этом скилле

Session

Query Claude Code history from a DuckDB index over the JSONL session files. Report each figure with the named query or SQL that produced it, and any index-health alert or Known Blind Spot that bounds it.

Current session ID: ${CLAUDE_SESSION_ID}

Arguments

  • --refresh: run refresh.ts --refresh before querying. Default: the incremental refresh.
  • --host <label>: scope queries through the host param. Default: every host, including local.
  • --since <date>: pass as the after_date param. Default: the full index.

Database

The index is ~/.local/share/claude-sessions/session.duckdb (under $XDG_DATA_HOME when set). Use that path directly in every query and agent prompt.

Refresh

Run refresh.ts before querying. It imports changed files, drops rows for deleted ones, and prints the DB path. Within --max-age (default 300 seconds) of the last refresh it exits without opening the database. Pass --refresh when the user asks for the latest data.

bun ${CLAUDE_SKILL_DIR}/scripts/refresh.ts

Querying

Open the index with duckdb -readonly -json -init ${CLAUDE_SKILL_DIR}/resources/limits.sql:

  • -readonly: a read-write open blocks refreshes and other readers.
  • -init limits.sql: caps memory and threads. DuckDB's per-process defaults let a few concurrent readers freeze the machine.
  • -json: the default box format truncates to 40 rows, and -csv breaks rows on newlines embedded in command and text.

Parameterize with SET VARIABLE and read with getvariable('key'). Quote reserved words: SET VARIABLE "limit" = 5.

duckdb -readonly -json -init ${CLAUDE_SKILL_DIR}/resources/limits.sql ~/.local/share/claude-sessions/session.duckdb "SELECT model, SUM(output_tokens) FROM message_usage GROUP BY model"
duckdb -readonly -json -init ${CLAUDE_SKILL_DIR}/resources/limits.sql ~/.local/share/claude-sessions/session.duckdb < ${CLAUDE_SKILL_DIR}/resources/queries/stats.sql

scripts/usage.ts renders one session's token-burn timeline (--session <id>), or the top sessions by estimated cost (--days <n>). Its cost estimate comes from public API rates and comes to about 0.97 of billed spend.

Locking

Read-only opens share the lock. A refresh with work to do needs exclusive access. A reader and a writer that collide fail with Could not set lock. Retry after the other side finishes. refresh.ts retries on its own and exits 0 when a concurrent refresh holds the lock.

Parallel Queries (Workflows)

For a fan-out of agents over the corpus, the orchestrator runs refresh.ts --refresh once up front. Each agent then opens the DB path read-only with -init limits.sql and runs in the shared checkout. references/workflows.md shows param scoping and the breadth-first survey surfaces.

For mining config-change candidates across the whole corpus, follow references/discovery.md.

Remote Index

Where CLAUDE_SESSION_LAKE_URL is set and no local index exists, query the published lake in place with bun "${CLAUDE_SKILL_DIR}/scripts/lake.ts" query "<sql>", or --name <query>, with each variable as --param name=value. It prints rows as JSON and takes one statement. Table and view names match the local index. Every byte read is S3 egress, so bound each query by a date window and select only the columns it needs. Before running a query, lake.ts query estimates its data reads from the lake's catalog and refuses any query over --max-mb (default 256). Treat a refusal as a sign the query is too wide, not as a reason to raise the budget. Its stderr line reports what the query actually read. The lake holds no local telemetry (mod_events, debug_events), so index-health, classifier, sandbox-bypass-scaffold and mods run only against a local index.

Named Queries

Run the queries in resources/queries/ by name with SET VARIABLE params before writing SQL from scratch. Every query takes project (a glob on the directory's last path component: myapp* matches the repo and its worktrees) and host.

The most used:

  • index-health: the index auditing itself. Run it first in any analysis pass, since its alerts cap what the rest can claim.
  • activity: session interaction profile, one row per prompt source, plus interruptions, compactions, API retries, hook friction, permission modes.
  • hooks: per-hook runs, friction rate, and latency corrected for host-wide slowdowns (excess_p95_ms, not p95_ms).
  • hook-blocks: hook overfiring, grouped by normalized reason signature, including the PreToolUse denies hook_events never records.
  • skill-auto-vs-explicit: per skill, model-routed vs chained vs typed. The disable-model-invocation lever.
  • skill-config-vs-observed: installed skills that never fire, the curation instrument (reads disk, needs -init).
  • sandbox-bypass-effective-command: bypassed commands by their real verb, with how many followed a failed sandboxed run, t
Полный SKILL.md на GitHub

Установить observability:session в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash
Read

Вложенные файлы

CLAUDE.mdREADME.mdreferences/blind-spots.mdreferences/catalog.mdreferences/cross-machine.mdreferences/discovery.mdreferences/schema-discovery.mdreferences/workflows.mdresources/extensions.sqlresources/import.sqlresources/lake/checkpoint.sqlresources/lake/estimate.sqlresources/lake/publish.sqlresources/lake/s3.sqlresources/lake/writer.sqlresources/limits.sqlresources/queries/activity.sqlresources/queries/already-allowed-still-prompting.sqlresources/queries/bare-refs.sqlresources/queries/catalog-reinjection-thrash-sessions.sqlresources/queries/classifier.sqlresources/queries/cli-health.sqlresources/queries/delegation.sqlresources/queries/field-drift.sqlresources/queries/hook-block-then-retry-success.sqlresources/queries/hook-blocks.sqlresources/queries/hook-config-vs-observed.sqlresources/queries/hook-self-timing.sqlresources/queries/hooks.sqlresources/queries/idle-compactions.sqlresources/queries/index-health.sqlresources/queries/memory-loads.sqlresources/queries/model-summary.sqlresources/queries/mods.sqlresources/queries/outcomes.sqlresources/queries/permissions.sqlresources/queries/plan-iterations.sqlresources/queries/plan-sections.sqlresources/queries/plan-sizes.sqlresources/queries/prune-acceptance.sql

FAQ

Что делает скилл observability:session?

Query Claude Code session history via a DuckDB index over `~/.claude/projects/`. Use when asked about Claude Code activity ("how many tokens today?", "what did I work on this week?", "which sessions discussed X?") or instead of reading, grepping, or jq-ing session transcripts. Not for codebase search, git log queries, or arbitrary databases.

Как установить скилл observability:session?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл observability:session запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить observability:session с