pi-prompt-template-model  by nicobailon

Enhance AI agent interactions with dynamic prompt management

Created 4 months ago
257 stars

Top 98.3% on SourcePulse

GitHubView on GitHub
Project Summary

This pi extension enhances prompt templating by enabling automatic model switching, skill context injection, and session state management directly within prompt definitions. It targets users of the pi AI assistant who frequently switch between different models, tools, or "modes" for specific tasks, aiming to streamline workflows and reduce manual configuration. The primary benefit is creating self-contained, context-aware prompt templates that act like specialized agent modes, automatically configuring the environment and restoring state upon completion.

How It Works

The extension introduces frontmatter fields (model, skill, thinking, restore, etc.) to pi prompt template files. When a command defined by such a template is invoked, the extension parses these fields to dynamically switch the active LLM model, inject specified skill content as context, and set thinking parameters. Upon completion, the restore: true setting automatically reverts the session to its prior model and thinking state, ensuring a seamless user experience without manual intervention. Advanced features include delegating tasks to subagents, running prompts in parallel, and orchestrating complex workflows via chained templates.

Quick Start & Requirements

  • Installation: pi install npm:pi-prompt-template-model
  • Prerequisites: pi assistant, npm. pi-subagents is optional but required for delegated subagent execution.
  • Setup: Restart pi after installation.
  • Docs: The README serves as the primary documentation.

Highlighted Details

  • Dynamic Model/Skill Switching: Define model and skill in frontmatter for automatic configuration per prompt.
  • Session State Management: restore: true automatically reverts model and thinking state after prompt execution.
  • Advanced Workflows: Supports chained templates (chain:), parallel subagent execution (parallel(...)), and looping (loop:).
  • Deterministic Steps: Execute shell commands or scripts before LLM turns, with options for output handoff and timeouts.
  • Best-of-N Comparison: Framework for running multiple LLM agents (workers/reviewers) in parallel for complex tasks like code generation or review.

Maintenance & Community

The repository appears to be a single-contributor project (nicobailon). No specific community links (Discord, Slack) or detailed maintenance information are provided in the README.

Licensing & Compatibility

The README does not explicitly state a license. The installation method (npm:pi-prompt-template-model) suggests it's distributed as an npm package, and its integration with the pi assistant implies compatibility with that ecosystem. Commercial use implications are unclear without a stated license.

Limitations & Caveats

Subagent features require the separate pi-subagents package. New prompt files added mid-session require a pi restart or running an extension command to be recognized. In-memory state restoration is lost if pi closes unexpectedly. Deterministic step execution (v1) has a narrow scope, excluding chains, delegation, and loops.

Health Check
Last Commit

3 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
4
Star History
46 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.