Skip to content

Move deterministic cc.* metrics into trace metadata - #12

Merged
collincunn merged 1 commit into
mainfrom
collinc/cc-metadata-consolidation
Jun 3, 2026
Merged

Move deterministic cc.* metrics into trace metadata#12
collincunn merged 1 commit into
mainfrom
collinc/cc-metadata-consolidation

Conversation

@collincunn

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #11. Moves all deterministic git-grounded metrics out of feedback scores and into trace.metadata.cc. Feedback scores are now reserved for evaluative judgments (cc.summary, cc.task_class) emitted by the LLM tagger.

Why

After #11 we had a split surface: identity in metadata.cc, but the 11 git metrics as feedback scores. That conflated observation (counts, repo state, sha bounds) with judgment (categorical task type, narrative summary). It also let the LLM tagger fight with the Go hook over cc.repository — different writers, different shapes (category_name="emitted" vs the actual repo string).

Cleaner mental model:

Surface Contains
metadata.cc All Claude-Code-specific observations the hook can measure deterministically
feedback_scores LLM-tagger evaluations only — cc.summary, cc.task_class

What lands on metadata.cc now

Identity (set at trace creation, unchanged from #11):

  • user_email, user_uuid, user_display_name, org_uuid, org_name

Git metrics (moved from feedback scores → merged at trace close):

  • repository, branch, head_sha_start, head_sha_end
  • commits_in_trace, lines_committed
  • uncommitted_lines, uncommitted_files
  • files_authored, lines_authored, lines_overwritten

Merge strategy

metadata is a JsonNode — PATCH replaces it wholesale. To preserve identity (set at creation) and any non-cc metadata Opik adds (e.g. providers), postTraceMetrics now:

  1. GETs the trace
  2. Mutates metadata.cc with new git keys
  3. PATCHes the full metadata back, with project_name included (Opik 409s without it)

Test plan

  • Verified live: latest closing trace has 16 keys in metadata.cc (5 identity + 11 git), and metadata.providers=["anthropic"] survives the merge intact
  • Verified empty feedback_scores from the hook (only LLM tagger writes there now)
  • Reproduced 409 from the previous attempt, confirmed project_name in PATCH body fixes it
  • make build succeeds for all four target platforms

🤖 Generated with Claude Code

After #11 landed the 11 git-grounded metrics as feedback scores, it became
clear that feedback scores should be reserved for evaluative judgments
(task_class, summary) and that observational data belongs in metadata.

All deterministic metrics now live under metadata.cc alongside identity:
  repository, branch, head_sha_start, head_sha_end,
  commits_in_trace, lines_committed,
  uncommitted_lines, uncommitted_files,
  files_authored, lines_authored, lines_overwritten.

Identity (set at trace creation) and metrics (set at trace close) are
merged via GET → mutate → PATCH so non-cc metadata Opik adds (e.g.
providers) is preserved. The PATCH carries project_name so Opik accepts
the workspace/project check.

API client gains a Get helper. metrics.go drops putScore — feedback-score
writes are out of the Go hook entirely. Identity comment clarified to
note it is preferred over git config for stable user/org primitives.
@collincunn
collincunn merged commit d8708e6 into main Jun 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant