Skip to main content

Claude Code Session Client

A session-persistent client wrapper for the Claude Code SDK Python that provides automatic conversation persistence and session resumption capabilities.

Features

  • Automatic Session Persistence: Conversations are automatically saved to local storage
  • Session Resumption: Resume previous conversations using session IDs
  • Context Retention: Maintain conversation context across client restarts
  • Multi-turn Conversations: Seamlessly handle complex multi-turn interactions
  • Storage Management: Organized session storage with metadata tracking

Installation

pip install claude-code-session-client

Quick Start

import trio
from pathlib import Path
from claude_code_session_client import SessionPersistentClient
from claude_code_sdk import ClaudeCodeOptions

async def main():
    storage_path = Path("./sessions")
    
    async with SessionPersistentClient(
        options=ClaudeCodeOptions(),
        storage_path=storage_path
    ) as client:
        # Start conversation
        await client.query("Hello! What can you help me with?")
        
        async for message in client.receive_response():
            # Handle responses
            print(message)

if __name__ == "__main__":
    trio.run(main)

Session Resumption

# Resume a previous session
session_id = "your-session-id"
await client.start_or_resume_session(session_id)

Requirements

  • Python 3.10+
  • claude-code-sdk-python
  • trio

License

MIT License

Metadata

Release files for claude-code-session-client 0.0.1

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-code-session-client 0.0.1
File Size Uploaded
claude_code_session_client-0.0.1.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-code-session-client 0.0.1
File Interpreter ABI Platform
claude_code_session_client-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / claude_code_session_client-0.0.1.tar.gz

Download URL claude_code_session_client-0.0.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
79b40d110d7828b2e58a4321efc49c63dae1e25e0b47b11e7981688c612eb53c
BLAKE2b-256 checksum
How to use checksums
8557dfb355aae06d57e5f45879c9fe688d0b37d116681c2b37299ffdc8fcec1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release files / claude_code_session_client-0.0.1-py3-none-any.whl

Download URL claude_code_session_client-0.0.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad2aba3ffcd3d5d5efd9e2c048c2e442957daee1c8c8cf7fc75329f2f7a61fab
BLAKE2b-256 checksum
How to use checksums
73c66008ba63c36f7aabccf84aa27efe4efdfda9712a1d9084d1a44c0b939992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.18

Release history Release notifications | RSS feed

This release

0.0.1 This release

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