# `LlmCore.Memory.Hindsight.Config`
[🔗](https://github.com/fosferon/llm_core/blob/v0.3.0/lib/llm_core/memory/hindsight/config.ex#L1)

Hindsight-specific configuration with multi-level precedence.

## Hindsight 0.4+
Uses REST API. URLs are base URLs (e.g. `http://localhost:8888`),
not MCP paths. Operations use `/v1/default/banks/{bank_id}/...`.

## Precedence (highest to lowest)
1. UI runtime override (ETS, session-only)
2. Project config (`<project>/.llm_core/config.yml`)
3. Global config (`~/.llm_core/config.yml`)
4. Environment variable (`HINDSIGHT_URL`)
5. Auto-discovered endpoint

## Configuration Options

```yaml
memory:
  hindsight:
    url: http://localhost:8888
    api_key_env: HINDSIGHT_API_KEY
    enabled: true
    default_bank_id: platform
    timeout_health_ms: 2000
    timeout_retain_ms: 10000
    timeout_recall_ms: 30000
    timeout_reflect_ms: 60000
    max_retries: 3
    retry_backoff_ms: [1000, 2000, 4000]
    circuit_failure_threshold: 5
    circuit_reset_ms: 30000
    cache_ttl_ms: 300000
    cache_max_entries: 1000
    prefetch_on_startup: true
```

# `t`

```elixir
@type t() :: %LlmCore.Memory.Hindsight.Config{
  api_key_env: String.t(),
  cache_max_entries: pos_integer(),
  cache_reflect_ttl_ms: pos_integer(),
  cache_ttl_ms: pos_integer(),
  circuit_failure_threshold: pos_integer(),
  circuit_reset_ms: pos_integer(),
  default_bank_id: String.t() | nil,
  enabled: boolean(),
  max_retries: non_neg_integer(),
  prefetch_on_startup: boolean(),
  retain_raw_llm: boolean(),
  retry_backoff_ms: [pos_integer()],
  timeout_health_ms: pos_integer(),
  timeout_recall_ms: pos_integer(),
  timeout_reflect_ms: pos_integer(),
  timeout_retain_ms: pos_integer(),
  url: String.t() | nil
}
```

# `clear_runtime_override`

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

Clears the runtime override map.

# `clear_ui_override`

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

Clears the UI override.

# `defaults`

```elixir
@spec defaults() :: map()
```

Returns default configuration.

# `effective_bank_id`

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

Returns the effective default bank identifier, if configured.

# `effective_config`

```elixir
@spec effective_config() :: t()
```

Returns the effective configuration merging all sources.

# `effective_url`

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

Returns the effective URL using precedence rules.

# `get_api_key`

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

Returns the API key for authentication (from configured env var).

# `get_discovered_url`

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

Gets the discovered URL if available.

# `requires_auth?`

```elixir
@spec requires_auth?(String.t() | nil) :: boolean()
```

Checks if URL requires authentication (non-localhost).

# `set_discovered_url`

```elixir
@spec set_discovered_url(String.t() | nil) :: :ok
```

Stores a discovered URL (from auto-discovery).

# `set_runtime_override`

```elixir
@spec set_runtime_override(map()) :: :ok
```

Applies a runtime override map sourced from the TOML configuration loader.

# `set_ui_override`

```elixir
@spec set_ui_override(String.t() | nil) :: :ok
```

Sets a UI override URL (session-only, not persisted).

---

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