Repository navigation
feat(account): record which account domain a coding agent reports - #394
Merged
Merged
Conversation
EDR and SIEM logs show that an agent's process ran, not which account was signed in inside it. A developer using a personal account on a company machine was invisible, because that account is outside the company's tenant and its vendor admin logs. Events now carry an optional `account` block: domain, source, and organization ID where one is reported. The full address needs AGENTMETRY_LOG_ACCOUNT_EMAIL=1. Cursor reports it through `user_email`. Claude Code reports it through OpenTelemetry, and hooks fall back to the undocumented `~/.claude.json`. That fallback means the account last signed in on the machine, so it is labelled `local_config` and skipped when an API key, token, cloud provider, profile or another endpoint selects a different credential. Codex, Antigravity and Copilot document no account field and stay absent. Detection events keep the block, so the alert a SOC reads carries the domain. ECS keeps it under `agentmetry.account` rather than `user.*`, because a reported claim is not the OS user's identity. The HTTP model declares it and external.py bounds it, so the spool replay behaves the same way. The schema stays additive. The fingerprint is unchanged at 15846a0915769d4a. No real Cursor session and no live SIEM has run this yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EDR and SIEM logs show that an agent's process ran, not which account was signed in inside it. A developer using a personal account on a company machine is outside the company's tenant, so vendor admin logs do not show it either. This records the account the agent reports.
The maintainer decided on 2026-11-07 to build this as an exception to the feature stop.
What an event gets
The domain is stored by default. The full address needs
AGENTMETRY_LOG_ACCOUNT_EMAIL=1, set on both the hook and the recorder.user_emailin hook inputuser.emailandorganization.idin OpenTelemetry~/.claude.json, labelledlocal_configDecisions worth checking
local_configis weak on purpose. It means the account last signed in on the machine. It is skipped whenANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN, a non-AnthropicANTHROPIC_BASE_URL, Bedrock, Vertex, Foundry,CLAUDE_CODE_OAUTH_TOKEN,ANTHROPIC_PROFILEor the federation pair selects another credential.apiKeyHelper, an active profile and a gateway sign-in cannot be seen from the environment, and the docs say so.ANTHROPIC_BASE_URL=https://api.anthropic.com, so only a different host skips the fallback.live.pyis not frozen.agentmetry.account.*, notuser.*. A reported claim is not the OS user's identity.15846a0915769d4a.Checks
Run from this branch on Windows, in an environment with
ANTHROPIC_BASE_URLset to the official host:pytest -q: 2150 passed, 7 skippedruff check agentmetry tests: cleanagentmetry benchmark: 0 missed, 0 false positivesThe worktree also ran a scratch recorder with a temp data dir: account domain retained on the detection event, no full synthetic email in the output, and
verify --trailpassing.Not proven
🤖 Generated with Claude Code