claudewheel v0.15.1 /claudewheel.session
Edit
On this page

Session lookup: locate session JSONL files and extract metadata.

#claudewheel.session

#claudewheel.session

Session lookup: locate session JSONL files and extract metadata.

#SessionInfo

Metadata for a single session resolved from the shared store.

#OrphanedProject

A project directory in the shared store whose original cwd no longer exists.

#get_session_cwd

python
def get_session_cwd(jsonl_path: Path, max_lines: int=MAX_CWD_SCAN_LINES) -> str | None

Read up to max_lines from a JSONL file and return the first cwd value.

Returns None when the file is missing, empty, or contains no cwd field within the scanned range. Corrupt JSON lines are silently skipped.

#find_session

python
def find_session(session_id: str, shared_projects_dir: Path | None=None) -> SessionInfo | None

Locate a session by UUID in the shared projects store.

Globs /*/.jsonl and returns a :class:SessionInfo on the first match (UUIDs are globally unique). Returns None when no matching file exists.

#find_orphaned_project_dirs

python
def find_orphaned_project_dirs(shared_projects_dir: Path | None=None) -> list[OrphanedProject]

Find all project dirs whose original cwd no longer exists on disk.

Scans every subdirectory of shared_projects_dir (defaulting to SHARED_DIR / "projects"). For each, reads the newest .jsonl file (by mtime) to extract the cwd. If the cwd is not None and no longer exists on disk, the project is included as an :class:OrphanedProject.