MCPcopy Create free account
hub / github.com/JordanCoin/codemap / detectAgentID

Function detectAgentID

cmd/hooks.go:1270–1284  ·  view source on GitHub ↗

detectAgentID returns the current AI agent based on environment signals.

()

Source from the content-addressed store, hash-verified

1268
1269// detectAgentID returns the current AI agent based on environment signals.
1270func detectAgentID() string {
1271 // Claude Code sets CLAUDE_CODE=1
1272 if os.Getenv("CLAUDE_CODE") == "1" || os.Getenv("CLAUDE_CODE_ENTRYPOINT") != "" {
1273 return "claude-code"
1274 }
1275 // Codex sets CODEX=1
1276 if os.Getenv("CODEX") == "1" {
1277 return "codex"
1278 }
1279 // Cursor sets CURSOR_SESSION_ID
1280 if os.Getenv("CURSOR_SESSION_ID") != "" {
1281 return "cursor"
1282 }
1283 return "unknown"
1284}
1285
1286// sessionStartTime estimates when this session started from daemon events.
1287func sessionStartTime(state *watch.State) time.Time {

Callers 1

writeSessionHandoffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected