pi-twiddle
v2.1.1
Published
Prompt distillation extension for pi.
Readme
![]()
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 exemplosIf 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

Prompt report

How it works
- Detect
~input and parse override prefixes - Classify intent and scope
- Inject project context when available
- Optimize via a separate
pisubprocess - Restore preserved fragments
- 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.tsDesign
- Quiet by default
- No API key management
- Graceful fallback on failure
- Footer shows active mode without token-savings counters
Theme: Harpy
