second-brain-cli 0.13.5

Memory layer for AI coding agents: ingest, recall, and sync across machines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use second_brain_core::project_path;
use serde_json::Value;

/// The session's project: the directory Claude Code files the transcript
/// under, named after where the session started and unchanged when the agent
/// changes directory; failing that, the encoded working directory.
pub(super) fn of(input: &Value) -> Option<String> {
    input["transcript_path"]
        .as_str()
        .and_then(project_path::from_transcript)
        .or_else(|| {
            input["cwd"]
                .as_str()
                .filter(|cwd| !cwd.is_empty())
                .map(project_path::encode)
        })
}