polymind-cli
v1.0.0
Published
PolyMind CLI - Multi-model AI council debates in your terminal with interactive TUI
Downloads
7
Maintainers
Readme
PolyMind CLI
The LLM Council: Let multiple AI models collaborate, review each other's work, and synthesize the best response
🏛️ The LLM Council
Instead of querying a single AI model, PolyMind creates a council of AI models that work together:
- Stage 1 - First Opinions: All models respond to your query individually
- Stage 2 - Peer Review: Models review and rank each other's responses (anonymized)
- Stage 3 - Chairman Synthesis: A designated Chairman compiles the final answer
Why use an LLM Council?
- ✅ Eliminates single-model bias - Multiple perspectives reduce errors
- ✅ Peer review improves quality - Models critique each other anonymously
- ✅ Best-of-breed synthesis - Chairman combines the strongest insights
- ✅ Transparency - See all individual responses in a tab view
🌟 What's New
v1.0.0 brings the LLM Council system with:
- 🏛️ LLM Council Mode - Multi-model collaboration with 3-stage workflow
- 🔥 Live Streaming - Real-time AI responses with token-by-token streaming
- 📊 Peer Review System - Models rank each other anonymously
- 🎯 Chairman Synthesis - Final response from the council's best insights
- 📚 RAG Support - Context-aware responses from your codebase
- 🔌 Multi-Provider - Gemini, GPT, Claude, Grok, and more
- 🎨 Beautiful TUI - Tab view for comparing model responses
🚀 Quick Start
# Install globally
npm install -g @polymind/cli
# Configure your API keys (at least 2 providers recommended)
polymind init
export OPENAI_API_KEY="your-key"
export ANTHROPIC_API_KEY="your-key"
# Query the LLM Council
polymind council "What is the future of artificial intelligence?"
# Or start live chat with a single model
polymind live --rag✨ Key Features
🏛️ LLM Council Mode (NEW!)
Harness the collective intelligence of multiple AI models working together.
polymind council "Explain quantum computing"How it works:
Stage 1: First Opinions
- Query sent to all council members (GPT, Gemini, Claude, Grok)
- Each model responds independently
- View responses in an interactive tab interface
Stage 2: Peer Review
- Each model reviews OTHER models' responses (anonymized as "Response A", "Response B")
- Models rank responses by accuracy and insight
- Prevents favoritism and bias
Stage 3: Chairman Synthesis
- Designated Chairman reviews all responses and rankings
- Synthesizes the best insights into one final answer
- Shows which sources were incorporated
Example Council:
polymind council "Should we use microservices?" \
--gemini-key $GEMINI_API_KEY \
--openai-key $OPENAI_API_KEY \
--anthropic-key $ANTHROPIC_API_KEY \
--chairman "Claude Sonnet"Gemini Deep Reasoning Preset:
# Use the highest reasoning Gemini models
polymind council "Explain quantum entanglement" --gemini-deep
# With custom chairman
polymind council "Your question" --gemini-deep --chairman "Gemini 2.5 Pro"This preset includes:
- Chairman: Gemini 3 Pro Preview
- Members: Gemini 3 Pro Preview, Gemini 2.5 Pro, Gemini 2.5 Flash
🔴 Live Streaming Mode
Experience real-time AI responses with token-by-token streaming, just like ChatGPT but in your terminal.
polymind # Launch live chat
polymind live --rag # Enable RAG for contextFeatures:
- Real-time streaming responses
- Automatic codebase indexing
- Slash command support (
/help,/rag,/model,/exit) - Context-aware conversations
- Model switching on the fly
📚 RAG (Retrieval-Augmented Generation)
Automatically indexes your workspace to provide context-aware responses about your code.
polymind live --rag # Enable RAG modeWhat it does:
- Indexes
.ts,.tsx,.js,.jsx,.md,.jsonfiles - Semantic search across your codebase
- Injects relevant context into AI queries
- Real-time stats:
📚 Indexed 247 files (1.2MB)
🎭 Live Multi-Agent Debates
Watch multiple AI personas deliberate on complex topics in real-time.
polymind debate "Should we colonize Mars?"
polymind debate "Is AGI achievable by 2030?" --rounds 4Council Members:
- 🎯 Pragmatist - Practical problem solver
- 🚀 Visionary - Future-focused innovator
- 🤔 Skeptic - Critical analyst
- ⚖️ Ethicist - Moral compass
Each persona streams their argument in real-time, then a synthesized conclusion is generated.
🔌 Multi-Model Support
Switch between providers and models dynamically:
# Configure your provider
polymind init --provider gemini
# Switch models mid-conversation
/model gemini-2.0-flash-exp
/model gpt-4-turbo
/model claude-3-opusSupported Providers:
- Google Gemini -
gemini-2.0-flash-exp,gemini-1.5-pro,gemini-1.5-flash - OpenAI -
gpt-4-turbo,gpt-4,gpt-3.5-turbo(coming soon) - Anthropic -
claude-3-opus,claude-3-sonnet,claude-3-haiku(coming soon)
📚 Commands
Interactive Commands
| Command | Alias | Description |
|---------|-------|-------------|
| polymind | - | Launch live streaming chat (default) |
| polymind live | l | Explicitly start live mode |
| polymind debate <question> | - | Start multi-agent council debate |
| polymind init | - | Configure API keys and settings |
| polymind status | - | Check configuration |
Slash Commands (In Chat)
| Command | Description |
|---------|-------------|
| /help | Show available commands |
| /rag | Toggle RAG mode |
| /model <name> | Switch AI model |
| /clear | Clear chat history |
| /exit | Quit application |
| /debate <topic> | Start debate mode |
🔧 Configuration
Initial Setup
polymind initYou'll be prompted for:
- AI provider (Gemini, OpenAI, Anthropic)
- API key
- Default model
- Feature preferences (streaming, RAG, etc.)
Manual Configuration
Config is stored in ~/.config/polymind/config.json:
{
"provider": "gemini",
"apiKey": "your-api-key-here",
"streaming": true,
"quirks": true,
"animations": true
}Environment Variables
export POLYMIND_API_KEY="your-key"
export POLYMIND_PROVIDER="gemini"🎨 Advanced Usage
Live Chat with RAG
# Enable RAG to query your codebase
polymind live --rag
# In chat:
> Explain how the streaming client works
> What files implement the debate logic?
> Summarize the RAG engine architectureCustom Debate Parameters
# More rounds
polymind debate "Future of work" --rounds 5
# Specific model
polymind debate "AI ethics" --model gemini-1.5-pro --rounds 3Keyboard Shortcuts
ESC- Exit applicationCtrl+C(during stream) - Cancel current responseCtrl+C(idle) - Exit application
🏗️ Architecture
Inspired by Gemini CLI, PolyMind uses:
- Ink - React for terminal UIs
- Google Generative AI SDK - For Gemini models
- Streaming Architecture - Real-time token-by-token responses
- RAG Engine - Document indexing and semantic search
- Multi-Agent System - Parallel persona processing
📦 Installation
From npm
npm install -g @polymind/cliFrom Source
git clone https://github.com/reyyanxahmed/polymind-cli.git
cd polymind-cli
npm install
npm run build
npm link🚀 Deployment
For Developers
# Build and test locally
npm run build
npm link
# Deploy to npm
./scripts/deploy.sh 1.0.0CI/CD
GitHub Actions automatically publishes to npm when you push a version tag:
git tag v1.0.0
git push origin v1.0.0git push origin v1.0.0
## 🛠️ Development
### Local Development
```bash
# Clone the repo
git clone https://github.com/reyyanxahmed/polymind-cli.git
cd polymind-cli
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run build
# Link globally for testing
npm linkProject Structure
polymind-cli/
├── src/
│ ├── core/
│ │ ├── streaming-client.ts # Multi-model streaming client
│ │ └── rag-engine.ts # RAG indexing and search
│ ├── commands/
│ │ ├── live.ts # Live streaming chat command
│ │ ├── live-debate.ts # Live debate command
│ │ └── init.ts # Setup wizard
│ ├── ui/
│ │ ├── apps/
│ │ │ ├── LiveChatApp.tsx # Main streaming chat UI
│ │ │ └── LiveDebateApp.tsx # Multi-agent debate UI
│ │ └── components/
│ └── utils/
│ └── slash-commands.ts # Command parsing
├── package.json
└── README.md🤝 Contributing
We welcome contributions! Areas where you can help:
- Provider Integrations - OpenAI, Anthropic, Ollama, etc.
- RAG Enhancements - Better embeddings, vector databases
- UI/UX - More animations, themes, customization
- Features - Image support, voice, web search
- Documentation - Tutorials, examples, translations
See CONTRIBUTING.md for guidelines.
📄 License
MIT © PolyMind Team
🔗 Links
- GitHub: https://github.com/reyyanxahmed/polymind-cli
- npm: https://www.npmjs.com/package/@polymind/cli
- Issues: https://github.com/reyyanxahmed/polymind-cli/issues
- Inspiration: Gemini CLI
🙏 Credits
Built with inspiration from:
- Gemini CLI - Architecture and streaming design
- Ink - React for terminal UIs
- Commander.js - CLI framework
Made with ❤️ by the PolyMind Team
Type polymind and let the AI council begin!
