# Class LittleGhost::PromptResolver

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/PromptResolver.html

PromptResolver turns conventional ERB files into an agent's system prompt. It
supports ordered application roots and partials without allowing a template
name to escape those roots.

    resolver = LittleGhost::PromptResolver.new(paths: ["app/prompts"])
    prompt = resolver.render("support/system", locals: {product: "Acme"})
    prompt.include?("Acme") # => true

In `support/system.erb`:

    <%= partial "shared/rules", locals: {product: product} %>

Earlier invocation roots override configured roots. Template names must be
relative, and both lexical traversal and symbolic-link escapes are rejected.
Partials use an underscore-prefixed filename and receive only their explicitly
supplied locals.

Every configured root is trusted Ruby code because ERB executes inside the
current process. Keep roots application-controlled and non-user-writable. See
the [Prompts as Views guide](../prompt_views.md) for the
conventional Agent workflow.

## Inheritance

`LittleGhost::PromptResolver < Object`

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new(paths: [], max_depth: DEFAULT_MAX_DEPTH)
```

Configures ordered application roots and a partial recursion bound, which
defaults to 20 nested templates.

## Instance methods

<a id="method-i-render"></a>
### `#render`

```ruby
#render(name, locals: {}, invocation_paths: [])
```

Renders `name` with validated local variables.

`invocation_paths` accepts only TrustedPath values because those roots take
precedence over application configuration. The wrapper records the directory
selected by application code; it does not inspect who can modify that
directory.
