Skip to main content

Module hook

Module hook 

Source
Expand description

The SessionStart recall hook: parse CC’s stdin JSON, query the index for the launch project, and print a small fenced brief to stdout (injected into the agent context on exit 0). Empty output when there is no history. Untrusted session titles/paths are sanitized and fenced as DATA, never instructions.

Structs§

BriefEntry

Constants§

FENCE_TAG

Functions§

relativize
Strip the cwd prefix to keep paths relative (no absolute paths in agent-facing output); fall back to the basename for out-of-tree paths.
render_brief
Render the fenced brief. Empty entries -> empty string (zero bytes -> no injection). Leads with low-free-text fields (date, tool, touched files); the title is the one free-text field, sanitized and capped. nonce makes the envelope unforgeable.
session_start
The SessionStart hook entry point. Reads CC’s JSON from stdin (bounded), prints a fenced project brief to stdout, and ALWAYS returns cleanly (empty output on any error/garbage/no-history). Never returns Err - a non-zero exit or a Rust error on stdout would pollute the agent context at session start.