character-ai/prompt-poet — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small Python library called Prompt Poet that makes it easy for regular people and developers to create reusable AI prompts without messy string building.

I want users to write prompt templates in YAML with Jinja2 variables, loops, conditionals, and reusable included sections. The library should render those templates with data and turn them into chat messages with names, roles, and content, ready to send to a chat model. It should support things like chat history, different instructions for audio versus text users, adding example conversations only when needed, and keeping prompts clean without random whitespace.

Please include smart truncation so older or lower priority prompt parts can be shortened when the prompt is too long. Also add token counting and section level stats so people can see which parts of the prompt use the most tokens, including nested sections.

Make it installable with pip, add clear examples, and include tests for the main template rendering, truncation, includes, whitespace handling, and token stats.

Want more depth? Deep Reverse