# `Lei.AgenticDetector`
[🔗](https://github.com/kitplummer/lowendinsight/blob/main/lib/lei/agentic_detector.ex#L1)

Classifies contributors as human, bot, or AI-assisted (agent)
based on email/name patterns and commit message trailers.

# `analyze`

```elixir
@spec analyze([{map(), [String.t()]}], non_neg_integer()) :: map()
```

Analyzes a list of contributors with their commit messages.

Expects a list of `{contributor, commit_messages}` tuples where
contributor is a map/struct with `:name`, `:email`, `:count` fields,
and commit_messages is a list of commit body strings.

Returns analysis summary with classified contributors and metrics.

# `classify_contributor`

```elixir
@spec classify_contributor(String.t(), String.t()) :: :human | :bot
```

Classifies a contributor as `:human` or `:bot` based on name/email patterns.

# `classify_ratio`

```elixir
@spec classify_ratio(float()) :: {:ok, String.t()}
```

Classifies an agentic contribution ratio into a human/mixed/agent label.

Thresholds are controlled by env vars:
  - `LEI_AGENTIC_MIXED_THRESHOLD` (default 0.3): lower boundary for "mixed"
  - `LEI_AGENTIC_AGENT_THRESHOLD` (default 0.7): lower boundary for "agent"

Boundaries:
  - ratio < mixed_threshold → "human"
  - mixed_threshold ≤ ratio ≤ agent_threshold → "mixed"
  - ratio > agent_threshold → "agent"

Deprecated env vars `LEI_CRITICAL_AGENTIC_LEVEL`, `LEI_HIGH_AGENTIC_LEVEL`, and
`LEI_MEDIUM_AGENTIC_LEVEL` are no longer used; a warning is logged at startup if they are set.

# `detect_ai_coauthors`

```elixir
@spec detect_ai_coauthors([String.t()]) :: [String.t()]
```

Detects AI co-author trailers in commit messages.
Returns a deduplicated list of matched AI tool names.

# `warn_deprecated_env_vars`

```elixir
@spec warn_deprecated_env_vars() :: :ok
```

Logs a deprecation warning for each legacy agentic env var that is still set.
Called once at application startup via `Lei.Application`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
