spec: issue-3639 Line attribution that survives later edits
Summary
Chainloop Trace reports, for each file in an AI coding session, how many lines the AI wrote and how many a human wrote. Today this split is wrong when a human changes AI-written lines later. The CLI records AI line ranges at edit time and never updates them.
This spec changes the CLI to attribute each line to its last writer. The CLI then reports the net contribution of each session: the lines it added that no later commit replaced. When a later commit replaces lines of a session, the CLI sends that session's evidence again with the new numbers. A commit outside any session that replaces lines of a session joins that session as human work. The platform then stores the CLI split for each file.
Spec: docs/specs/issue-3639-trace-line-attribution.md
Open questions for reviewers
- How long does the CLI keep the trace state (ledger and commit records) of a pushed session? Proposed: 30 days at most, and only while a local branch can reach the session's commits. After that, a replacement of these lines does not update the session.
We would like two reviewers to approve this spec before it merges.
Refs #3639
AI disclosure: Claude Code helped to research and draft this spec.