Skip to content

Implement renderBase() template function for inheritance #4

@sbaker

Description

@sbaker

Problem

renderBase() is referenced in architecture docs as a way to control where inherited (parent) content renders within a child prompt, but it was never implemented. The template stage uses concatenation (parentContent + "\n\n" + childContent) which doesn't give the child control over placement.

Example that fails:

inherits: "@eval/prompts/base-evaluator.prmd"
---
## Safety-Specific Context
...

{{ renderBase() }}

## Additional Output Schema
...

Error:

Template syntax error: Unable to call `renderBase`, which is undefined or falsey

Proposed Behavior

renderBase() should be registered as a Nunjucks function during template processing when inherits: is present. It renders the parent's body content at the call site instead of prepending it.

Possible variants:

  • {{ renderBase() }} — render full parent body
  • {{ renderBase("system") }} — render only the parent's system section
  • {{ renderBase("user") }} — render only the parent's user section

When renderBase() is used, the compiler should skip the default concatenation behavior and let the child control placement entirely.

Current Workaround

Remove renderBase() calls and rely on the default concatenation model. Parent content is prepended automatically. This works for simple cases but doesn't allow the child to wrap or interleave parent content.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions