Skip to main content

create_session

Function create_session 

Source
pub fn create_session(
    skill: &str,
    target: &TraceTarget,
) -> Result<(String, PathBuf)>
Expand description

Create the session directory, write the opening start event, and return the session id + session directory. The returned path is the value the user passed through TraceTarget with the <date>/<skill> /<session_id> suffix appended — it is not canonicalised, so a relative TraceTarget::Custom(".traces") produces a relative path and an absolute target produces an absolute path. Callers pass both values back into append_event and finalise_session on subsequent CLI invocations.

The per-session directory level is required so that concurrent or repeated invocations of the same skill on the same day never share trace.jsonl or meta.json (ADR-015).