Skip to content

feat: emit claude agent identities#342

Open
michiosw wants to merge 1 commit into
mainfrom
feat/claude-agent-identity
Open

feat: emit claude agent identities#342
michiosw wants to merge 1 commit into
mainfrom
feat/claude-agent-identity

Conversation

@michiosw

@michiosw michiosw commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Where We Are

The CLI still exports legacy Claude session values in some hosted ledger paths. Normal decision rows and GitHub dry-run rows must not produce different identities for the same Claude request.

Where We Want To Go

New CLI ledger exports use canonical Claude identities: agent_provider=anthropic, agent=claude_code, and agent=claude_cowork. Current released clients remain accepted by the API.

How do we get there

  • Add agent_provider to SQLite agent sessions.
  • Normalize legacy Claude and CoWork aliases before storing sessions.
  • Export agent_provider in ledger batches.
  • Use the same canonical identity for normal actions and GitHub dry-run actions.
  • Update tests for canonical Claude session and dry-run identities.

Verification:

  • go test ./cmd/kontext ./internal/guard/store/sqlite ./internal/managedobserve
  • go test -race ./...

@michiosw michiosw marked this pull request as ready for review June 25, 2026 13:10

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Greptile Summary

This PR canonicalizes Claude identities in the local ledger path. The main changes are:

  • Adds agent_provider to SQLite agent sessions.
  • Normalizes Claude and CoWork aliases before storing sessions and actions.
  • Exports agent_provider in ledger session batches.
  • Updates GitHub dry-run rows and tests for canonical Claude identities.

Confidence Score: 4/5

This is close, but the dry-run identity mismatch should be fixed before merging.

  • The session schema and scan changes look consistent.
  • Claude aliases now normalize in both normal and dry-run action builders.
  • The dry-run builder still includes an extra identity field before hashing, so the same Claude request can export different identity hashes.

internal/guard/store/sqlite/githubdryrun.go

Important Files Changed

Filename Overview
internal/guard/store/sqlite/githubdryrun.go Updates dry-run identity construction, but the hashed payload still differs from the normal action row for the same Claude request.
internal/guard/store/sqlite/store.go Adds canonical hosted agent identity handling for sessions and normal action rows.
internal/guard/store/sqlite/ledger.go Adds agent_provider to exported agent session ledger records.

Reviews (2): Last reviewed commit: "feat: emit claude agent identities" | Re-trigger Greptile

Comment thread internal/guard/store/sqlite/store.go
@michiosw michiosw force-pushed the feat/claude-agent-identity branch 2 times, most recently from a657158 to 4601a15 Compare June 25, 2026 13:22
Comment thread internal/guard/store/sqlite/githubdryrun.go Outdated
@michiosw michiosw force-pushed the feat/claude-agent-identity branch from 4601a15 to 79d3600 Compare June 25, 2026 13:34
@michiosw michiosw requested a review from tumberger June 25, 2026 13:35

@tumberger tumberger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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.

2 participants