Skip to main content

Track warm/cold status of Claude Code sessions in a dedicated DuckDB file

Project description

claude-session-status

Tracks whether Claude Code sessions are warm (actively running) or cold (ended) in a dedicated DuckDB file.

Problem

claude-session-logger writes to sessions.duckdb at session end via a SessionEnd hook. If a TUI (e.g. the session browser) holds a persistent read-only connection to that file, the write blocks and the hook hangs. This package sidesteps the conflict entirely by using its own DB (~/.claude/claude-session-status/status.duckdb) and never holding an open connection between operations.

What warm/cold means

Status When set Meaning
warm SessionStart hook fires Claude Code is actively running in this project
cold SessionEnd hook fires Session ended (Claude Code exited or was interrupted)

Install

pip install claude-session-status

Hook integration

Add to ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {"type": "command", "command": "claude-session-status mark-warm"}
    ],
    "SessionEnd": [
      {"type": "command", "command": "claude-session-status mark-cold"}
    ]
  }
}

Claude Code pipes session JSON to stdin; the scripts extract session_id, project, and cwd automatically.

Commands

# Live-refresh table of warm/cold sessions (Ctrl-C to quit)
claude-session-status watch

# Called by hooks (reads JSON from stdin)
claude-session-status mark-warm
claude-session-status mark-cold

DB schema

CREATE TABLE session_status (
    session_id TEXT PRIMARY KEY,
    project    TEXT,
    cwd        TEXT,
    started_at TIMESTAMP,
    updated_at TIMESTAMP,
    status     TEXT  -- 'warm' | 'cold'
)

DB location: ~/.claude/claude-session-status/status.duckdb

Design

  • Runtime dependency: duckdb only
  • Every DB access: open → read/write → close. No persistent connections.
  • mark-warm / mark-cold: silent on success, errors go to stderr (never block Claude Code)
  • 3-retry lock backoff on connect

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_session_status-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_session_status-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file claude_session_status-0.1.1.tar.gz.

File metadata

  • Download URL: claude_session_status-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for claude_session_status-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3285211b3ae35facd3bf715422e1dbe27103b52942981f23e6f4e97a32fd90e3
MD5 ee7f72adb3bd5553dd7875abcceb16f7
BLAKE2b-256 4bb023af70d773aa6f2d12d66613de8e854061eef47711322c0ca15793a2787d

See more details on using hashes here.

File details

Details for the file claude_session_status-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_session_status-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f4ac29490dc706255b49e422e7dd0aaf4cb88615f8f803dcb5fdb32abdfab1c
MD5 b919d068d8659d6ac3cd98a080cd21a1
BLAKE2b-256 b857e2c71b35da65d8eeed8234f36a10c48b51fc7a28649efecf0290419988a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page