Transform your signals through LLM-based distortion pedals. Like a guitar pedal processes audio, TwistedPair processes text through multiple "rhetorical operations" to provide diverse perspectives on any input. This is an experimental application, exploiting the unpredictable, hallucinatory nature of LLMs.
Released: November 26, 2025
TwistedPair is a signal distortion system with three control knobs:
- Mode: Distortion type (6 rhetorical operations)
- Tone: Verbal style (5 expression styles)
- Gain: Temperature/amplitude (1-10 scale)
- INVERT_ER: Challenge the premise, argue the opposite
- SO_WHAT_ER: Question significance and consequences
- ECHO_ER: Amplify and validate the core message
- WHAT_IF_ER: Explore alternative scenarios
- CUCUMB_ER: Cool, detached, emotionless analysis
- ARCHIV_ER: Contextualize with historical perspective
- NEUTRAL: Balanced, objective expression
- TECHNICAL: Precise, analytical language
- PRIMAL: Raw, visceral, emotional
- POETIC: Metaphorical, aesthetic expression
- SATIRICAL: Ironic, humorous critique
- Ensemble Mode: Run all 6 distortion modes simultaneously with shared Tone/Gain
- Manual Mode: Select specific Mode + Tone + Gain combination for targeted output
With 6 modes × 5 tones × 10 gain levels = 300 different "pedal settings" to explore, you have extensive signal distortion possibilities.
Accurate Summarization:
- CUCUMB_ER + NEUTRAL + Gain=1 - Analytical summary with clear language
- ECHO_ER + NEUTRAL + Gain=3 - Highlights key points without distortion
Deep Analysis:
- SO_WHAT_ER + TECHNICAL + Gain=3~5 - Explore implications with precision
- CUCUMB_ER + TECHNICAL + Gain=2~4 - Structured, evidence-oriented commentary
Creative Exploration:
- WHAT_IF_ER + POETIC + Gain=6~8 - Imaginative scenarios with lyrical language
- ECHO_ER + POETIC + Gain=5~7 - Amplify ideas with metaphorical richness
Critical Thinking:
- INVERT_ER + SATIRICAL + Gain=4~6 - Challenge assumptions with wit
- SO_WHAT_ER + PRIMAL + Gain=4~6 - Provocative questioning with raw impact
Historical Context:
- ARCHIV_ER + TECHNICAL + Gain=3~4 - Scholarly references and parallels
- ARCHIV_ER + NEUTRAL + Gain=2~3 - Clear historical contextualization
Maximum Chaos (Experimental):
- Any Mode + PRIMAL + Gain=10 - Extreme creativity, unpredictable outputs
- WHAT_IF_ER + SATIRICAL + Gain=10 - Wild speculative humor
✅ Analog Knob Interface - Guitar pedal aesthetic with rotary drag controls
✅ Completely Local - No cloud, no cost, no Internet required. Privacy protected.
✅ Multiple LLM Models - Dynamic selection (mistral, llama3.1, gemma3:4b, phi3:14b, openchat, dolphin3, qwen3)
✅ Real-time Processing - Animated knob glow during generation
✅ Copy to Clipboard - Individual outputs or all outputs with formatted headers
- Python 3.8+
- Ollama installed and running
- At least one model installed (recommended:
ollama pull mistral)
- Install Python dependencies:
pip install fastapi==0.121.3 uvicorn==0.38.0 requests==2.32.5 jinja2==3.1.6- Start Ollama (if not already running):
ollama serve- Start the TwistedPair server:
uvicorn server:app --reload- Open the interface:
- Open
index.htmlin your web browser - Or navigate to
http://localhost:8000(if served)
- Open
Validate the installation with the test suite:
python test_twistedpair.pyThis runs a sample signal through all 6 modes and outputs results to ./runs/.
- Enter your signal in the text area
- Adjust Tone and Gain knobs
- Select your preferred LLM model
- Click "🔊 Distort Signal (All 6 Modes)"
- View 6 different perspectives simultaneously
- Toggle to Manual Mode
- Adjust Mode, Tone, and Gain knobs
- Select your preferred LLM model
- Click "🔊 Distort Signal"
- View single targeted output
- Drag the red handle in circular motion to rotate knobs
- 270° rotation range (-135° to +135°)
- Real-time value display updates as you drag
- Use Shift+Enter to quickly submit
- Click ✕ Clear to reset input
- Click ✕ Cancel to abort processing
- Use 📋 Copy buttons to save outputs
- Try different models for varied responses
- pedal.py - Prompt engineering (mode instructions + tone styles)
- agent.py - LLM execution wrapper with sampler injection
- ensemble.py - Multi-perspective processing
- server.py - FastAPI REST API
- ollama_sampler.py - Ollama HTTP client
- index.html - Analog knob web interface
POST /distort- Ensemble mode (6 outputs)POST /distort-manual- Manual mode (single output)GET /knobs- Available modes and tonesGET /models- Available Ollama models
User Input → Signal → Knobs → Prompt → Agent → LLM → AgentOutput → Display
Edit config.py to customize:
DEFAULT_MODEL = "mistral" # Change default LLM
AVAILABLE_LLM_MODELS = [...] # Add/remove models
OUTPUT_DIR = "./runs" # Change output directoryThis release includes multiple interface variants:
- index.html - Default (analog knobs + glow effects)
- index_simple.html - Dropdown selectors (no knobs)
- index_noFX.html - Analog knobs without glow effects
All core types (Signal, Knobs, Prompt) use frozen dataclasses for provenance integrity. Never modify after creation—always create new instances.
Agent takes a callable instead of hardcoded LLM client:
Agent(agent_id="...", model_name="...", sampler=my_llm_function)
# sampler signature: (system: str, user: str, temperature: float) -> strEdit config.py:
AVAILABLE_LLM_MODELS = [
"mistral",
"your-new-model", # Add here
...
]Then pull the model: ollama pull your-new-model
- Manual interface with analog knobs
- Ensemble and manual modes
- 7 LLM model support
- Full polish suite
- Screenpipe integration for automatic capture
- Background monitoring of clipboard/screen
- Auto-trigger distortion on new content
- Archive history with index.html generation
MIT
Built with:
TwistedPair V1.0 - Signal distortion through rhetorical operations
"Like a pedal, but for ideas"

