# `Agentic.Protocol.ACP.Quirks`

Agent-specific quirks and workarounds for ACP implementations.

Different ACP agents have non-standard behaviors that need special handling.
This module centralizes those quirks so the generic ACP client can work
correctly with all agents without per-agent modules.

Derived from https://github.com/openclaw/acpx/blob/main/src/acp/agent-command.ts

## Known Quirks

| Agent | Quirk |
|-------|-------|
| Gemini | Version detection; < 0.33.0 needs `--experimental-acp` |
| Claude | 60s session creation timeout |
| Copilot | Pre-flight `--help` check for ACP support |
| Qoder | Extra args `--max-turns`, `--allowed-tools` |
| Droid | Different subcommand structure |
| Gemini | 15s startup timeout |

# `close_grace_ms`

```elixir
@spec close_grace_ms(String.t(), [String.t()]) :: non_neg_integer()
```

Get agent-specific grace period after stdin close before SIGTERM.

# `filter_non_json_lines`

```elixir
@spec filter_non_json_lines(String.t()) :: String.t()
```

Filter non-JSON stdout lines for agents that produce them.

# `infer_tool_kind`

```elixir
@spec infer_tool_kind(String.t() | nil) :: atom()
```

Infer tool kind from tool title when agent doesn't provide one.

# `mutate_args`

```elixir
@spec mutate_args(String.t(), [String.t()], keyword()) :: {String.t(), [String.t()]}
```

Mutate command args for agent-specific requirements.

# `needs_preflight?`

```elixir
@spec needs_preflight?(String.t(), [String.t()]) :: boolean()
```

Check if agent needs pre-flight validation.

# `preflight_check`

```elixir
@spec preflight_check(String.t(), [String.t()]) :: :ok | {:error, term()}
```

Run pre-flight validation for agents that need it.

# `session_create_timeout`

```elixir
@spec session_create_timeout(String.t(), [String.t()]) :: non_neg_integer()
```

Get agent-specific timeout for session creation.

# `should_filter_stdout?`

```elixir
@spec should_filter_stdout?(String.t(), [String.t()]) :: boolean()
```

Check if stdout lines from this agent should be filtered.

# `startup_timeout`

```elixir
@spec startup_timeout(String.t(), [String.t()]) :: non_neg_integer()
```

Get agent-specific timeout for startup.

---

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