Skip to content

Claude model attribution - #255

Open
davidabram wants to merge 12 commits into
mainfrom
claude-attribution
Open

Claude model attribution#255
davidabram wants to merge 12 commits into
mainfrom
claude-attribution

Conversation

@davidabram

Copy link
Copy Markdown
Member

No description provided.

Production Claude diff traces often lack model identity because PostToolUse metadata and asynchronous transcript lookup are frequently unavailable at hook time. Define a Claude-specific latest-model state register to capture lifecycle observations and preserve direct > transcript > state > NULL attribution precedence.

The plan keeps state local-only, isolates subagents, guards observations by timestamp, and avoids restoring the retired generic session-model abstraction.

Plan: claude-model-attribution-state (T01-T06)

Co-authored-by: SCE <sce@crocoder.dev>
davidabram and others added 2 commits September 1, 2026 20:19
Claude PostToolUse hooks can miss model identity because transcript writes are asynchronous, leaving diff traces nullable at hook time. Document a bounded local latest-model-state register keyed by canonical session and agent scope, with direct metadata and exact transcript lookup taking precedence.

Define local observation-time ordering, deterministic tie-breaking, post-switch visibility limitations, and no export or synchronization scope. Complete T01 in `context/plans/claude-model-attribution-state.md`.

Co-authored-by: SCE <sce@crocoder.dev>
Persist the latest locally observed Claude model per session and agent so later attribution hooks can resolve model state without broadening scope to other agents. Add the additive repository migration and typed adapter helpers with timestamp, lifecycle-kind, and lexical tie-break guards for deterministic concurrent writes and replay-safe updates. Keep the register outside the Agent Trace export streams and document the completed T02 plan work.

Co-authored-by: SCE <sce@crocoder.dev>
davidabram and others added 8 commits September 1, 2026 20:37
Persist Claude SessionStart and PostModelSwitch observations locally so later attribution can consult exact session and agent scopes. Add the silent `sce hooks claude-model-state` route with normalized model IDs, guarded observation times, fail-open diagnostics, and no stdout, network, or sync behavior.

Plan: claude-model-attribution-state (T03)

Co-authored-by: SCE <sce@crocoder.dev>
Co-authored-by: SCE <sce@crocoder.dev>
Resolve Claude diff-trace attribution in direct, transcript, exact agent-state order while keeping agent scope ephemeral and subagents isolated. Open the repository Agent Trace DB once and perform the state lookup only when event-local attribution is unavailable, with regression coverage for precedence and persistence behavior.

Ref: context/plans/claude-model-attribution-state.md T04

Co-authored-by: SCE <sce@crocoder.dev>
Co-authored-by: SCE <sce@crocoder.dev>
Claude Code model switches can leave local attribution stale when only SessionStart is observed. Register SessionStart and PostModelSwitch for silent claude-model-state intake while preserving existing hooks and user settings through idempotent setup merging and doctor drift repair. Record compatibility evidence showing Claude Code 2.1.250 safely ignores the unknown event, so installation remains unconditional without a raised minimum or capability gate.

Plan: claude-model-attribution-state (T05)

Co-authored-by: SCE <sce@crocoder.dev>
Co-authored-by: SCE <sce@crocoder.dev>
Co-authored-by: SCE <sce@crocoder.dev>
Ensure Claude lifecycle state is exposed to hook tests and verify persisted diff traces use SessionStart/PostModelSwitch fallback while preserving direct/transcript precedence and subagent isolation. Record the migration-003 `sce setup` upgrade note and complete the `claude-model-attribution-state` plan task T06.

Co-authored-by: SCE <sce@crocoder.dev>
Register Claude model-state guidance on session start and model switches, and align Codex hook entries with the current hook schema. Remove obsolete dead-code allowances so the model-state query and conversion paths are compiled as active repository functionality.
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