Expand description
Opt-in JSONL event log for debugging and calibration. Disabled by default
— every entry point short-circuits unless telemetry is enabled, via either
telemetry = true in ~/.config/ski/config.toml or a truthy SKI_TELEMETRY
env var (1|true|yes|on, e.g. in the env block of ~/.claude/settings.json).
Each entry point calls init right after Config::load to reflect the
config flag into the process; enabled is then config-OR-env.
Two event kinds, appended one JSON object per line to
$XDG_STATE_HOME/ski/telemetry.jsonl:
recommend— whatski hookdecided on a prompt. Emitted on every ranked prompt, including the ones where ski injects nothing: the prompt, the stage, the top-Kconsideredranking (id + raw stage score) the chooser produced before the gate, thecandidatesthat cleared the gate, which ids survived the char budget (injected), and anabstainedreason when nothing was injected. The always-presentconsideredlist is what lets a later analysis see where ski ranked a skill on a prompt it stayed silent on.use— a skill the model loaded itself (seen byski observe) — i.e. the host’s own (native) skill chooser’s pick. Joining auseto the prompt’srecommendevent bysession+prompttells us whether the native pick was something ski injected, ranked-but-abstained-on, or never surfaced.
Best-effort, like the rest of the hot path: any IO/serialization failure is swallowed so telemetry can never block or fail a prompt.
Functions§
- enabled
- Whether the event log is active. Cheap; called at every entry point so a
disabled log costs one env lookup and nothing else. On when the config flag
(via
init) or a truthySKI_TELEMETRYenv var is set. - init
- Reflect
cfg.telemetryinto the process soenabledsees it. Call once, right afterConfig::load, in any entry point that may record events. - record_
recommend - Record the hook’s decision on a prompt. Emitted on every ranked prompt, even
when ski injects nothing, so the always-present
consideredranking records where ski placed each skill on a prompt it stayed silent on. - record_
use - Record that the model loaded
skill_iditself.viais"skill"(theSkilltool) or"read"(opened theSKILL.md).promptis the active prompt the hook stashed in session state (empty if none), lettingski historytie a recall miss back to the call that triggered it.