feat(trace): record how a trace session was run

Merged
JI
1mo ago
+246-4

chainloop trace hooks and chainloop trace run both emit a CHAINLOOP_AI_CODING_SESSION material with an identical shape, so an ongoing coding session and a one-shot wrapped command cannot be told apart once attested.

This PR adds a new session.mode field to the AI coding session payload, with the following values:

  • coding for a session traced through the git hooks installed by trace init
  • generic for a single-shot chainloop trace run

An absent mode means coding, so sessions recorded before this change keep their meaning. The mode is also published as the chainloop.material.aisession.mode material annotation, which is an exact key/value match consumers can filter on without downloading and parsing the session itself.

The field is a plain string rather than a closed enumeration, so further modes (spec, security) need no schema version bump. It is added to the redaction deny-list alongside the other identifiers and enumerations the secret scanner must never rewrite.

Ingesting the mode into the platform database and defaulting the AI coding dashboards to mode = "coding" is separate follow-up work.


AI disclosure: this contribution was assisted by Claude Code.