# PluginLoader

**Kind:** Class

**Source:** [`atloria-monorepo/libs/agent-core/src/plugins/plugin-loader.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/plugins/plugin-loader.ts#L28)

## Methods

| Method | Signature | Returns |
|---|---|---|
| `loadFromDirectory` | `loadFromDirectory(pluginsDir: string)` | `Promise<LoadedPlugin[]>` |
| `loadPlugin` | `loadPlugin(pluginDir: string)` | `Promise<LoadedPlugin>` |

## Where it refuses work

- `PluginLoader` stops the work with `Error` when `!manifest || typeof manifest !== 'object'` — “Manifest must be a JSON object”.
- `PluginLoader` stops the work with `Error` when `typeof manifest.name !== 'string' || !manifest.name` — “Manifest must have a "name" string field”.
- `PluginLoader` stops the work with `Error` when `!KEBAB_CASE_RE.test(manifest.name)`.
- `PluginLoader` stops the work with `Error` when `typeof manifest.version !== 'string'` — “"version" must be a string”.
- `PluginLoader` stops the work with an early return when `!fs.existsSync(pluginsDir)`.
- `PluginLoader` stops the work with an early return when `!fs.existsSync(skillsDir)`.

## When something fails

- `PluginLoader` handles failure in 2 places: it logs it and continues in 1, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.
