← Catalog

pi-template-kit

Shared LiquidJS prompt-template engine, filters, XML tag, and file loader for Pi packages.

Package

Install

Install with PiG

pig install npm:pi-template-kit

Install with Pi

pi install npm:pi-template-kit
Review before installing

Packages 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

ImportPurpose
pi-template-kit/liquidcreateEngine, filters, native {% xml %} tag
pi-template-kit/templateloadTemplate, loadTemplateFromString, frontmatter + partial/layout roots
pi-template-kitre-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, not key=value. The equals form is Liquid's bare-flag spelling and binds true, so cwd=cwd emits cwd="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 than cwd="".
  • Values are XML-escaped (&, <, >, ").
  • An empty body still emits nothing, attributes notwithstanding.

Ownership split

PackageOwns
pi-template-kitLiquid engine, shared filters, {% xml %} tag, file template loader
pi-loomprompt graph, system reminders, host coordinator, provider handoff metadata
pi-prompt-composergrouped prompt discovery, arg collection, shell block policy
grounded-compactioncompaction render variables, summary workflow, examples
pi-prompt-corelegacy messages registry until consumers migrate; no new template/system-prompt work

Development

pnpm install
pnpm run check

License

MIT