pub struct ClaudeCodeJsonl { /* private fields */ }Expand description
Adapter for Claude Code session .jsonl files (spec-067 §9 Phase 3).
Strict and version-pinned: only "type": "user" and "type": "assistant" records
are processed. All other record types are silently skipped. A user/assistant record
that lacks the expected message structure causes an Err — no silent mis-parsing.
Files are expected to be scoped to the current project by the calling binary layer
(path enforcement via ~/.claude/projects/<project-slug>/). This adapter performs
no I/O and no path checks; it receives raw text from the binary layer.
§Examples
use zeph_memory::graph::ingest::{ClaudeCodeJsonl, IngestSourceAdapter, ImportBatchId};
let raw = r#"{"type":"user","uuid":"abc","message":{"role":"user","content":"hello"}}"#;
let adapter = ClaudeCodeJsonl::new("session-42");
let batch = ImportBatchId::new();
let docs = adapter.parse(raw, &batch).unwrap();
assert!(!docs.is_empty());Implementations§
Source§impl ClaudeCodeJsonl
impl ClaudeCodeJsonl
Sourcepub fn new(session_id: impl Into<String>) -> Self
pub fn new(session_id: impl Into<String>) -> Self
Creates a new ClaudeCodeJsonl adapter for the given session ID.
session_id is embedded in every document’s source_uri as
"claude-code:<session_id>#<uuid>".
The context_window defaults to 3 preceding messages.
Sourcepub fn with_context_window(self, n: usize) -> Self
pub fn with_context_window(self, n: usize) -> Self
Overrides the context window size.
Trait Implementations§
Source§impl IngestSourceAdapter for ClaudeCodeJsonl
impl IngestSourceAdapter for ClaudeCodeJsonl
Source§fn parse(
&self,
raw: &str,
batch_id: &ImportBatchId,
) -> Result<Vec<IngestDocument>, MemoryError>
fn parse( &self, raw: &str, batch_id: &ImportBatchId, ) -> Result<Vec<IngestDocument>, MemoryError>
Parse a Claude Code .jsonl session file.
Skips non-user/assistant records silently. A user or assistant record
that lacks the expected message structure is a schema error and causes Err.
Auto Trait Implementations§
impl Freeze for ClaudeCodeJsonl
impl RefUnwindSafe for ClaudeCodeJsonl
impl Send for ClaudeCodeJsonl
impl Sync for ClaudeCodeJsonl
impl Unpin for ClaudeCodeJsonl
impl UnsafeUnpin for ClaudeCodeJsonl
impl UnwindSafe for ClaudeCodeJsonl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request