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.
- 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
- Refuses outputs that drop, duplicate, or invent protected fragments
- Falls back through a model chain on failure (never on explicit cancel)
- Skips optimization if output would exceed the expansion limit
- Stores each applied transformation as a session entry (original vs applied) without polluting model context
/twiddle
/twiddle-auto-toggle
~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 expansion limit is 40%: optimized text longer than input + 40% is discarded and the original is sent.
| 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-toggle): every prompt gets distilled. The default minimum is 1 character, but numeric-only prompts are skipped. Configure minimum length, expansion limit, timeout, fallbacks, and verbosity under /twiddle. ~ always optimizes, regardless of length.
| 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.
| Command | Purpose |
|---|---|
/twiddle |
Open the control panel (model, fallbacks, limits, verbosity, auto-mode) |
/twiddle-compare |
Show debug data, original text, and processed text from the latest optimization |
/twiddle-auto-toggle |
Toggle auto-mode |
/twiddle-reset |
Restore defaults (clears model and fallbacks) |
- Detect
~input and parse override prefixes - Classify intent and scope
- Inject project context when available
- Optimize via separate
pisubprocess; oversized prompts use temporary@filetransport and are removed after execution - Verify every protected placeholder survived exactly once, then restore fragments
- Keep original prompt if optimization is cancelled, misses expansion limit, or fails
- Record comparison (original vs applied) as session entry; restore only active branch and reapply every transformed user message consistently across model calls
Each applied optimization stores original and optimized text in session file as collapsed twiddle-comparison entry (outside model context). Resume, branch, export (/export), and share (/share) include these records. Config is validated before use and written atomically. Avoid pasting secrets you would not keep in history.
pi-twiddle/
├── index.ts
├── optimizer.ts
├── intent.ts
├── picker.ts
├── project.ts
├── preserve.ts
├── tokenizer.ts
├── footer.ts
├── missing-model-warning.ts
├── history.ts
├── config.ts
├── README.md
├── package.json
├── tsconfig.json
├── assets/
└── *.test.ts
- Quiet by default
- No API key management
- Graceful fallback on failure
- Footer shows active mode without token-savings counters
Theme: Harpy

