1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! # `claude_storage_core` - Claude Code Storage Access Library
//!
//! Pure library for structured read/write access to Claude Code's filesystem-based storage.
//!
//! ## Overview
//!
//! Claude Code stores conversations in a filesystem-based "database" at `~/.claude/`,
//! using JSONL (JSON Lines) files for conversation history and directory hierarchies
//! for project organization. This crate provides safe, structured access to that storage.
//!
//! **Zero dependencies**: This library has no runtime dependencies for fast compilation
//! and minimal attack surface. All parsing is hand-written using `std` only.
//!
//! ## Architecture
//!
//! Claude Code's storage is filesystem-native:
//! - **Projects**: Directories in `~/.claude/projects/`
//! - **Sessions**: JSONL files within project directories
//! - **Entries**: Individual JSON objects (one per line in JSONL files)
//!
//! ## Core Types
//!
//! - [`Storage`]: Entry point for all storage operations
//! - [`Project`]: Represents a project (UUID or path-based)
//! - [`Session`]: Represents a conversation session (JSONL file)
//! - [`Entry`]: Individual conversation entry (user or assistant message)
//!
//! ## Safety Guarantees
//!
//! - **Append-only**: Write operations only append to JSONL files (no modification/deletion)
//! - **Atomic writes**: Uses temp file + rename pattern
//! - **Format validation**: All reads validate JSONL structure
//! - **Path encoding**: Automatic encoding/decoding of filesystem paths
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use claude_storage_core::{ Storage, ProjectId };
//!
//! fn main() -> claude_storage_core::Result< () >
//! {
//! // List all projects
//! let storage = Storage::new()?;
//! for project in storage.list_projects()?
//! {
//! println!( "Project: {:?}", project.id() );
//!
//! // List sessions within project
//! for mut session in project.sessions()?
//! {
//! println!( " Session: {}", session.id() );
//! println!( " Entries: {}", session.entries()?.len() );
//! }
//! }
//! Ok( () )
//! }
//! ```
//!
//! ## Extraction Context
//!
//! This is the core library extracted from the monolithic `claude_storage` crate (2025-11-29).
//! The CLI functionality remains in the `claude_storage` crate, which depends on this core library.
pub use ;
pub use ;
pub use ;
pub use
;
pub use Session;
pub use ;
pub use Storage;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;