Skip to main content

ClaudeConvo

Struct ClaudeConvo 

Source
pub struct ClaudeConvo { /* private fields */ }
Expand description

High-level interface for reading Claude conversations.

This is the primary entry point for most use cases. It provides convenient methods for reading conversations, listing projects, and accessing conversation history.

§Example

use toolpath_claude::ClaudeConvo;

let manager = ClaudeConvo::new();

// List all projects
let projects = manager.list_projects()?;

// Read a conversation
let convo = manager.read_conversation(
    "/Users/alex/project",
    "session-uuid"
)?;

println!("Conversation has {} messages", convo.message_count());

Implementations§

Source§

impl ClaudeConvo

Source

pub fn new() -> Self

Creates a new ClaudeConvo manager with default path resolution.

Source

pub fn with_resolver(resolver: PathResolver) -> Self

Creates a ClaudeConvo manager with a custom path resolver.

This is useful for testing or when working with non-standard paths.

§Example
use toolpath_claude::{ClaudeConvo, PathResolver};

let resolver = PathResolver::new()
    .with_home("/custom/home")
    .with_claude_dir("/custom/.claude");

let manager = ClaudeConvo::with_resolver(resolver);
Source

pub fn io(&self) -> &ConvoIO

Returns a reference to the underlying ConvoIO.

Source

pub fn resolver(&self) -> &PathResolver

Returns a reference to the path resolver.

Source

pub fn read_conversation( &self, project_path: &str, session_id: &str, ) -> Result<Conversation>

Reads a conversation by project path and session ID.

§Arguments
  • project_path - The project path (e.g., “/Users/alex/project”)
  • session_id - The session UUID
§Returns

Returns the parsed conversation or an error if the file doesn’t exist or can’t be parsed.

Source

pub fn read_conversation_metadata( &self, project_path: &str, session_id: &str, ) -> Result<ConversationMetadata>

Reads conversation metadata without loading the full content.

This is more efficient when you only need basic information about a conversation.

Source

pub fn list_conversations(&self, project_path: &str) -> Result<Vec<String>>

Lists all conversation session IDs for a project.

Source

pub fn list_conversation_metadata( &self, project_path: &str, ) -> Result<Vec<ConversationMetadata>>

Lists metadata for all conversations in a project.

Results are sorted by last activity (most recent first).

Source

pub fn list_projects(&self) -> Result<Vec<String>>

Lists all projects that have conversations.

Returns the original project paths (e.g., “/Users/alex/project”).

Source

pub fn read_history(&self) -> Result<Vec<HistoryEntry>>

Reads the global history file.

The history file contains a record of all queries across all projects.

Source

pub fn exists(&self) -> bool

Checks if the Claude directory exists.

Source

pub fn claude_dir_path(&self) -> Result<PathBuf>

Returns the path to the Claude directory.

Source

pub fn conversation_exists( &self, project_path: &str, session_id: &str, ) -> Result<bool>

Checks if a specific conversation exists.

Source

pub fn project_exists(&self, project_path: &str) -> bool

Checks if a project directory exists.

Source

pub fn query<'a>(&self, conversation: &'a Conversation) -> ConversationQuery<'a>

Creates a query builder for a conversation.

Source

pub fn query_history<'a>(&self, history: &'a [HistoryEntry]) -> HistoryQuery<'a>

Creates a query builder for history entries.

Source

pub fn read_all_conversations( &self, project_path: &str, ) -> Result<Vec<Conversation>>

Reads all conversations for a project.

Returns a vector of conversations sorted by last activity.

Source

pub fn most_recent_conversation( &self, project_path: &str, ) -> Result<Option<Conversation>>

Gets the most recent conversation for a project.

Source

pub fn find_conversations_with_text( &self, project_path: &str, search_text: &str, ) -> Result<Vec<Conversation>>

Finds conversations that contain specific text.

Trait Implementations§

Source§

impl Clone for ClaudeConvo

Source§

fn clone(&self) -> ClaudeConvo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClaudeConvo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ClaudeConvo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.