MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / _session_path

Function _session_path

core/sessions.py:33–41  ·  view source on GitHub ↗

Get session file path for a project directory.

(project_dir: str = None)

Source from the content-addressed store, hash-verified

31 return text
32
33def _session_path(project_dir: str = None) -> Path:
34 """Get session file path for a project directory."""
35 SESSIONS_DIR.mkdir(exist_ok=True)
36 cwd = project_dir or os.getcwd()
37 # Hash the path to make a safe filename
38 key = hashlib.sha256(cwd.encode()).hexdigest()[:12]
39 # Also include last dir name for readability
40 name = Path(cwd).name
41 return SESSIONS_DIR / f"{name}_{key}.json"
42
43def save_session(history: list, project_dir: str = None, max_turns: int = 6):
44 """Save conversation history to disk. Keeps last max_turns turns."""

Callers 4

save_sessionFunction · 0.85
load_sessionFunction · 0.85
clear_sessionFunction · 0.85
session_existsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected