Skip to main content

close_from_bytes

Function close_from_bytes 

Source
pub fn close_from_bytes(
    raw: &[u8],
    pool: &Pool,
    event_log: PathBuf,
    fixtures_dir: &Path,
) -> Result<CloseOutcome, SessionError>
Expand description

Run the full session-close pipeline.

§Arguments

  • raw — raw bytes of the session events JSON file.
  • pool — open SQLite connection pool with all migrations applied.
  • event_log — path to the JSONL ledger file. Created if absent.
  • fixtures_dir — directory containing INDEX.toml and replay fixtures for cortex_reflect::reflect(). Must be supplied even if reflection is expected to produce no candidates (the adapter must initialise).

§Lifecycle state

Reflected candidates are placed in pending_mcp_commit status, NOT active. MCP callers leave them there until cortex_session_commit is called with the operator’s confirmation token. CLI callers may call MemoryRepo::set_active on each memory_id in CloseOutcome directly after this function returns, since the CLI close is operator-initiated and synchronous (ADR 0047 §2 Alternatives).