Session-persistent client for Claude Code SDK
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_session_client-0.0.1.tar.gz.
File metadata
- Download URL: claude_code_session_client-0.0.1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79b40d110d7828b2e58a4321efc49c63dae1e25e0b47b11e7981688c612eb53c
|
|
| MD5 |
0640afd7c385a03a9e657710c5acdf5b
|
|
| BLAKE2b-256 |
8557dfb355aae06d57e5f45879c9fe688d0b37d116681c2b37299ffdc8fcec1b
|
File details
Details for the file claude_code_session_client-0.0.1-py3-none-any.whl.
File metadata
- Download URL: claude_code_session_client-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad2aba3ffcd3d5d5efd9e2c048c2e442957daee1c8c8cf7fc75329f2f7a61fab
|
|
| MD5 |
711f675afd77159cfe06c84883097033
|
|
| BLAKE2b-256 |
73c66008ba63c36f7aabccf84aa27efe4efdfda9712a1d9084d1a44c0b939992
|