TODO: Jinja2 template rendering for plan creation

todo-jinja2-plan-templates Todo

open todo

TODO: Jinja2 template rendering for plan creation

Problem

Plan creation currently requires hand-writing ~3000 tokens of repetitive HTML. Every phase repeats the same boilerplate structure (Slug, Goal, Owner, Repo, Forgejo Issue, Scope). The /plan skill fetches the template but agents still write the full HTML by hand. Token waste is 60-70% reducible.

Impact

  • Plan creation burns ~3000 output tokens per plan (most is boilerplate)
  • Error-prone — agents sometimes add non-template sections or miss required fields despite hooks catching the latter
  • Hooks enforce correctness (required sections present) but not efficiency (minimal token output)

Proposed Fix

Add Jinja2 template rendering to pal-e-docs or claude-custom:
  • Store Jinja2 templates alongside HTML templates in pal-e-docs
  • Agent provides structured data (phases list, decisions, etc.) instead of raw HTML
  • Rendering happens server-side or in a skill before create_note
  • Cuts plan creation tokens by 60-70%

Alternatives

  • Server-side: pal-e-docs API accepts structured JSON + template slug, renders HTML internally
  • Client-side: /plan skill includes Jinja2 rendering before calling create_note
  • Hybrid: templates in pal-e-docs, rendering in claude-custom skill
  • template-plan — the current plan template (HTML in pre block)
  • template-phase — the current phase template
  • phase-postgres-epilogue-cleanup — tracked as Epilogue item
  • check-note-template.sh — enforcement hook that validates required sections