pi-twiddle

Prompt distillation extension for pi.

Packages

Package details

extension

Install pi-twiddle from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-twiddle
Package
pi-twiddle
Version
2.1.1
Published
Jun 25, 2026
Downloads
250/mo · 13/wk
Author
bscordeiro
License
MIT
Types
extension
Size
221.1 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Twiddle

Twiddle

Prompt distillation for pi. Twiddle cleans, sharpens, and structures prompts before they reach the agent.

Not free: every optimization costs tokens. Tiny prompts can cost more than they improve. The footer shows the active mode: ~ Twiddle for manual mode and ≈ Twiddle for auto-mode.

What it does

  • Translates any language into clear engineering English
  • Classifies intent with fast regex rules
  • Injects project context when useful
  • Preserves code blocks, inline code, URLs, hashes, and semver
  • Falls back through a model chain on timeout
  • Skips optimization if output would exceed token budget

Quick Start

/twiddle-model
/twiddle-auto-on

~explique o padrão Repository em NestJS com exemplos

If no optimization model is configured yet, Twiddle offers the available models once per session. Selecting a model saves it and continues optimization; canceling sends prompts unchanged for the rest of the session.

Default token budget threshold is 40%.

Activation

Input Behavior
~text Optimize and forward
~.text Bypass, send original
~!text Optimize silently
~raw:text Bypass, alias for ~.
~bug:text Force bug_fix
~feature:text Force new_feature
~refactor:text Force refactor
~research:text Force research
~test:text Force testing
~review:text Force review
~docs:text Force docs
~infra:text Force infrastructure
~design:text Force design

Auto-mode (/twiddle-auto-on): every prompt gets distilled, unless it is a trivial greeting.

Footer

Indicator Mode
~ Twiddle Manual mode — use ~ to optimize a prompt
≈ Twiddle Auto-mode — eligible prompts are optimized automatically

While optimization is running, Twiddle uses a subtle shimmer over the name. The footer does not show token savings because Twiddle is focused on clarity, translation, structure, and deduplication rather than savings accounting.

Commands

Command Purpose
/twiddle Show current config
/twiddle-model Select optimization model
/twiddle-threshold [0–500] Set token budget margin
/twiddle-timeout [5–60] Set per-model timeout in seconds
/twiddle-fallback add|remove|list|clear Manage fallback chain
/twiddle-verbose quiet|normal|debug Set notification verbosity
/twiddle-auto-on Enable auto-mode
/twiddle-auto-off Disable auto-mode
/twiddle-report Show session stats
/twiddle-setup Interactive setup
/twiddle-reset Restore defaults

Screenshots

Settings

Twiddle Settings

Prompt report

Twiddle Prompt Report

How it works

  1. Detect ~ input and parse override prefixes
  2. Classify intent and scope
  3. Inject project context when available
  4. Optimize via a separate pi subprocess
  5. Restore preserved fragments
  6. Keep original prompt if optimization misses budget or fails

Project layout

pi-twiddle/
├── index.ts
├── optimizer.ts
├── intent.ts
├── project.ts
├── preserve.ts
├── tokenizer.ts
├── footer.ts
├── missing-model-warning.ts
├── config.ts
├── README.md
├── package.json
├── tsconfig.json
├── assets/
└── *.test.ts

Design

  • Quiet by default
  • No API key management
  • Graceful fallback on failure
  • Footer shows active mode without token-savings counters

Theme: Harpy