# `LLMDB.Packaged`
[🔗](https://github.com/agentjido/llm_db/blob/main/lib/llm_db/packaged.ex#L1)

Provides access to the packaged base snapshot.

This is NOT a Source - it returns the pre-processed, version-stable snapshot
that ships with each release. The snapshot has already been through the full
ETL pipeline (normalize → validate → merge → enrich → filter → index).

Sources (ModelsDev, Local, Config) provide raw data that gets merged ON TOP
of this base snapshot.

## Loading Strategy

Behavior controlled by `:compile_embed` configuration option:
- `true` - Snapshot embedded at compile-time (zero runtime IO, recommended for production)
- `false` - Snapshot loaded at runtime from priv directory with integrity checking

## Security

Production deployments should use `compile_embed: true` to eliminate runtime atom
creation and file I/O. Runtime mode includes SHA-256 integrity verification to
prevent tampering with the snapshot file.

### Integrity Policy

The `:integrity_policy` config option controls integrity check behavior:
- `:strict` (default) - Fail on hash mismatch, treating it as tampering
- `:warn` - Log warning and continue, useful in dev when snapshot regenerates frequently
- `:off` - Skip mismatch warnings entirely

In development, use `:warn` mode. The snapshot file is marked as an `@external_resource`,
so Mix automatically recompiles the module when it changes, refreshing the hash.

# `manifest_path`

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

Returns the absolute path to the packaged manifest file.

## Returns

String path to `priv/llm_db/manifest.json` within the application directory.

# `providers_dir`

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

Returns the absolute path to the providers directory.

## Returns

String path to `priv/llm_db/providers/` within the application directory.

# `snapshot`

```elixir
@spec snapshot() :: map() | nil
```

Returns the packaged base snapshot (runtime loaded with integrity check).

This snapshot is the pre-processed output of the ETL pipeline and serves
as the stable foundation for this package version.

Includes SHA-256 integrity verification to prevent tampering.

## Returns

Fully indexed snapshot map with providers, models, and indexes, or `nil` if not available.

---

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