Documentation
¶
Overview ¶
Package session tracks the identity of the agent session driving a chunk invocation, so per-session state (which sidecar this session owns) stays separate when several sessions share one working tree.
Index ¶
Constants ¶
const EnvClaudeSessionID = "CLAUDE_CODE_SESSION_ID"
EnvClaudeSessionID is set by Claude Code in the environment of every command it runs. It is what makes a session identifiable outside the Stop hook, where the session ID arrives in the hook payload instead: an agent running `chunk sidecar sync` or `chunk validate --remote` itself would otherwise look anonymous and share one sidecar with every other session in the repo.
It lives here rather than in the config package because, like the agent signals in internal/telemetry, it is a variable another tool sets rather than one of chunk's own. config.EnvChunkSessionID, which users set themselves, does live there.
Variables ¶
This section is empty.
Functions ¶
func IDFromEnv ¶ added in v0.7.160
func IDFromEnv() string
IDFromEnv returns the session ID advertised by the environment, or "" when nothing in it names a session.
config.EnvChunkSessionID wins over the agent's own variable, so an agent chunk does not recognise — or a test — can still pin a session identity by hand.
The value is sanitised because it becomes part of a state file name and of a generated sidecar name: everything outside [A-Za-z0-9._-] is dropped and the result is capped. Real session IDs are UUIDs, so in practice this changes nothing; it only stops a hostile or malformed value from escaping the state directory.
Types ¶
This section is empty.