# kcode-session-log
`kcode-session-log` provides durable append-ordered session transcripts and
pending-object sidecars. Events contain exactly a role and text; their array
positions are stable identities.
```rust
use kcode_session_log::{Role, SessionStore};
let store = SessionStore::new("./data/sessions");
let mut session = store.create_session(
"example-session",
"2026-07-24T00:00:00Z",
)?;
session.add_event(Role::UserMessage, "Hello")?;
session.add_event(Role::KennedyMessage, "Hi")?;
let sealed = session.seal()?;
assert_eq!(sealed.list().events.len(), 2);
# Ok::<(), anyhow::Error>(())
```
Complete appends are synchronized and checksummed. Reopening can discard an
incomplete trailing frame, but rejects checksum-valid structural corruption
and checksum-invalid complete frames. Pending-object bytes are synchronized
and atomically installed before their transcript event becomes durable.
The library owns storage mechanics only. Event interpretation, model context,
session lifecycle, database planning, and transaction commit remain caller
responsibilities.
The crate directory is a conforming `kcode-rust-libs-v2` managed library. Its
manifest is standalone, its package version is literal, and root
`Documentation.md` supplies the agent-facing API reference. Generated Cargo
state must remain outside the crate directory.
See [Documentation.md](Documentation.md) for the API and
[Specification.md](Specification.md) for behavioral guarantees.