Skip to main content

claude-session-status

Know at a glance whether your Claude Code prompt cache is still warm — before you send your next message.

Problem

Claude's prompt cache has a 5-minute TTL. If you haven't sent a message in over 5 minutes, the cache expires and Claude re-processes your full conversation context on the next turn — costing more tokens. When you're juggling multiple projects across several terminals, it's easy to lose track of which sessions are still within that window.

This package tracks the timestamp of your last Claude turn per session and shows you a live countdown so you know exactly how much time you have left before the cache expires.

What the statuses mean

Status Meaning
WARM + countdown Last turn was less than 5 min ago — cache is active, next message is cheap
EXPIRED Last turn was more than 5 min ago — cache is gone, next message re-processes full context
ENDED Session was closed

Install

pip install claude-session-status

Hook integration

Run once after install:

claude-session-status install-hooks

This writes the required hooks into ~/.claude/settings.json automatically, preserving any existing config. To remove them:

claude-session-status uninstall-hooks

What each hook does:

  • SessionStart → records session opened, stamps initial turn time
  • Stop → fires after every Claude response, updates last-turn timestamp
  • PostToolUse → fires after every tool call mid-turn, keeps TTL accurate during long multi-tool runs
  • SessionEnd → marks session closed

Live view

claude-session-status watch
claude-session-status  (Ctrl-C to quit)

SESSION         TITLE                     PROJECT             LAST TURN      CACHE
abc123def456    Fix auth bug              my-app              0m 12s ago     WARM  ████████░░  4m 48s left
xyz789abcd12    Build dashboard           other-proj          4m 51s ago     WARM  ░░░░░░░░░░  0m 09s left
def456ghi789    Refactor pipeline         old-project         6m 03s ago     EXPIRED  (6m 3s ago)
abc999xyz000    Update tests              done-project        -              ENDED

Refreshes every second.

Commands

claude-session-status install-hooks    # Add hooks to ~/.claude/settings.json
claude-session-status uninstall-hooks  # Remove hooks from ~/.claude/settings.json
claude-session-status watch            # Live cache status table (Ctrl-C to quit)
claude-session-status mark-start       # Called by SessionStart hook
claude-session-status mark-turn        # Called by Stop and PostToolUse hooks
claude-session-status mark-end         # Called by SessionEnd hook

DB schema

CREATE TABLE session_status (
    session_id   TEXT PRIMARY KEY,
    title        TEXT,
    project      TEXT,
    cwd          TEXT,
    started_at   TIMESTAMP,
    last_turn_at TIMESTAMP,
    status       TEXT  -- 'active' | 'ended'
)

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

Design

  • Runtime dependency: duckdb only
  • Every DB access: open → read/write → close. No persistent connections.
  • Hook commands are silent on success, errors go to stderr (never block Claude Code)
  • PostToolUse hook is async — never delays tool execution
  • 3-retry lock backoff on connect
  • Session title read from ai-title entries in the Claude Code transcript JSONL

Metadata

Release files for claude-session-status 0.2.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-session-status 0.2.11
File Size Uploaded
claude_session_status-0.2.11.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-session-status 0.2.11
File Interpreter ABI Platform
claude_session_status-0.2.11-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / claude_session_status-0.2.11.tar.gz

Download URL claude_session_status-0.2.11.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8706eb9bc20813d5278f7eda361c3d81366f09134450974455d24ddda048f65a
BLAKE2b-256 checksum
How to use checksums
6b84abd525809875f0256166a562c6309deea297b3701c08d918f858116ab691
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / claude_session_status-0.2.11-py3-none-any.whl

Download URL claude_session_status-0.2.11-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a90d7930dc475b8d3288f52e9375dc440793e18979385e144b4e07c24dde471
BLAKE2b-256 checksum
How to use checksums
f9568d4175843466be6820acd344b18cf9ffdb852aa9eca4607ab806b1eb67ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.11 This release

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page