class LittleGhost::PromptResolver

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.