Install
Install with PiG
pig install npm:pi-template-kitInstall with Pi
pi install npm:pi-template-kitPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
README
Written by the package's publisher, shown as published in version 0.3.0 (README.md). PiG does not review it.
pi-template-kit
Shared LiquidJS prompt-template toolkit for Pi packages.
Why
grounded-compaction and pi-prompt-composer both grew local Liquid engines:
- same engine defaults
- overlapping filters
- incompatible
{% xml %}implementations - duplicated frontmatter/template loading logic
pi-template-kit is the small library that owns that shared layer. It does not own pi-loom host orchestration, system prompt graph policy, reminders, provider payloads, or custom-message registries.
Package surfaces
| Import | Purpose |
|---|---|
pi-template-kit/liquid | createEngine, filters, native {% xml %} tag |
pi-template-kit/template | loadTemplate, loadTemplateFromString, frontmatter + partial/layout roots |
pi-template-kit | re-exports both surfaces |
Example
import { loadTemplate } from 'pi-template-kit/template';
const template = await loadTemplate('compaction-prompt.md');
const out = template.render({ focus: 'ship it' });
The {% xml %} tag
Wraps a block in an XML element, and emits nothing when the body is empty — so an
optional prompt section needs no surrounding {% if %}.
{% xml "focus" %}{{ focus }}{% endxml %}
<focus>
ship it
</focus>
Attributes
Optional key:value pairs after the tag name. Values are Liquid expressions or
quoted literals, parsed by Liquid's own Hash — the same grammar {% for %} uses.
{% xml "files-touched" cwd:cwd mode:"strict" %}{{ manifest }}{% endxml %}
<files-touched cwd="/Users/v/project" mode="strict">
…manifest…
</files-touched>
key:value, notkey=value. The equals form is Liquid's bare-flag spelling and bindstrue, socwd=cwdemitscwd="true"— a wrong value rather than an error. Use the colon.- Nil and empty values are omitted, so passing an optional variable unguarded
yields
<files-touched>rather thancwd="". - Values are XML-escaped (
&,<,>,"). - An empty body still emits nothing, attributes notwithstanding.
Ownership split
| Package | Owns |
|---|---|
pi-template-kit | Liquid engine, shared filters, {% xml %} tag, file template loader |
pi-loom | prompt graph, system reminders, host coordinator, provider handoff metadata |
pi-prompt-composer | grouped prompt discovery, arg collection, shell block policy |
grounded-compaction | compaction render variables, summary workflow, examples |
pi-prompt-core | legacy messages registry until consumers migrate; no new template/system-prompt work |
Development
pnpm install
pnpm run check
License
MIT