pub struct SessionState {
pub active: Option<RepoBinding>,
pub subagents: HashMap<String, RepoBinding>,
pub last_injected_repo: Option<String>,
pub active_project: Option<ProjectBinding>,
pub subagent_projects: HashMap<String, ProjectBinding>,
pub auto_bind_checked: Vec<String>,
pub auto_bind_off: bool,
pub storage_root: Option<String>,
pub inferred_repos: BTreeMap<String, InferredRepo>,
}Expand description
Session-level active binding plus per-worktree subagent overrides (keyed by the subagent’s git worktree toplevel path — design §7).
Fields§
§active: Option<RepoBinding>§subagents: HashMap<String, RepoBinding>§last_injected_repo: Option<String>The repo id whose policies were last injected into a hook response for
this session (sub-plan C). Used by UserPromptSubmit to avoid
re-injecting unchanged context on every prompt. #[serde(default)]
keeps old on-disk session files (without this field) loadable.
active_project: Option<ProjectBinding>§subagent_projects: HashMap<String, ProjectBinding>§auto_bind_checked: Vec<String>Origin remote URLs this session already looked up without binding
(unregistered, or ambiguous), so auto_bind asks the server once per
remote, not once per hook event — and says so once.
auto_bind_off: boolSet by repo reset: the session stays unbound instead of being bound
again from its checkout’s remote on the next hook event.
storage_root: Option<String>The directory holding the .tracevault/ this session keeps its
session dir (.stream_offset, pending queues, origin) in, recorded
once by the SessionStart hook from where the session started
(VIS-1257). Claude Code’s hook cwd follows the shell’s cd, so
resolving it per event split a session that moved from an umbrella
dir into a child repo across two session dirs, each re-sending the
transcript from its own offset. Absent for sessions started before
this was recorded, and for agents without a SessionStart hook: those
keep resolving from each event’s cwd. Read through storage_root.
inferred_repos: BTreeMap<String, InferredRepo>What each checkout this session touched resolves to for a project-only
session’s events (VIS-1258), keyed by the checkout’s git toplevel, so
the server is asked once per checkout and not once per event. Read and
written only through crate::inferred_repo.