fix(trace): separate Pi cache token accounting and update generated hook configs

Closed
MI
25m ago
+446-34

Summary

  • Separate Pi cache accounting: cache reads and writes are preserved as their own evidence categories, and total_tokens is recomputed as base input + output, excluding both cache categories. Cost stays authoritative from the session. Invalid or overflowing counters are ignored with deterministic warnings.
  • Keep the Pi evidence schema_version at v1 and stop gating the cache-accounting checks on the schema version.
  • Regenerate the Claude Code and Cursor hook configurations after the missing-CLI guard, so hooks no-op when the chainloop CLI is not on PATH.
  • Add the managed Pi extension (.pi/extensions/chainloop-trace.ts) and teach the OpenCode plugin the OpenCode 2.x tool-result shape.

Refs #3704 (Pi provider support).

Assisted-by: Claude Code