Unified Ask (`!ask`)
The !ask command is an agentic search engine that queries all community knowledge sources, synthesizes a single AI-powered answer with citations, and uses multi-round gap detection for thorough results.
Quick Start
Section titled “Quick Start”!ask <question> Search all relevant sources, get synthesized answer!ask <question> --broadcast Search + broadcast answer to multiple groups!ask --sources List available search sources and their statusAliases: !a
Examples:
!ask What are the claude code plugins and lessons learned?!ask What link was posted about AI in the DoD?!ask How do I set up ATAK?!ask --broadcast What's the latest on drone regulations?How It Works
Section titled “How It Works”!ask uses a 4-stage agentic pipeline that intelligently searches across 7 knowledge sources:
Round 1 (~3-5s): ├─ ROUTER — AI picks 2-4 relevant sources for the question │ Bot sends progress: "Searching wiki, outline docs, wikipedia..." ├─ PARALLEL SEARCH — Selected sources queried simultaneously └─ GAP DETECTION — AI reviews results: "Have enough info?"
Round 2 (only if gaps detected, ~3-5s): ├─ Search additional sources identified by gap detection └─ GAP DETECTION again
Round 3 (final, if still gaps): └─ Search remaining sources, then synthesize regardless
Synthesis (~2-3s): AI combines ALL gathered context → single answer with citationsMax 3 rounds. After round 3, the bot synthesizes whatever context has been gathered. If no relevant sources are found, it falls back to a general AI answer with a disclaimer.
Search Sources
Section titled “Search Sources”The router (a fast AI call) selects which sources to query based on the question:
| Source | When Selected | Search Method | Speed |
|---|---|---|---|
| IrregularPedia Wiki | Technical/community topics, how-to, guides | Hybrid (keyword + semantic embeddings) | ~2-3s |
| Outline Docs | Team documentation, meeting notes, policies | Outline API full-text search | ~1-2s |
| File Archive | Looking for specific files, documents, PDFs | Smart search + grep | ~2-4s |
| RSS Links | News, recent articles, shared links | PostgreSQL term-based search | ~0.5s |
| Q&A History | Previously asked/answered questions | PostgreSQL term-based search | ~0.5s |
| Wikipedia | General knowledge, concepts, people, organizations | MediaWiki Action API | ~1-2s |
| Google Knowledge Graph | Entity disambiguation, quick facts | Knowledge Graph API | ~1s |
Router Heuristics
Section titled “Router Heuristics”The AI router uses these rules to pick sources:
- Technical questions about community tools → wiki first, then outline
- General knowledge or “what is X” → wikipedia, knowledge_graph
- “Has anyone asked about…” → qa_history
- Looking for a specific file → files
- Recent news or articles → rss
- AI/security/tech topics → always includes wiki
- Topics that may not be community-specific → includes wikipedia
Response Format
Section titled “Response Format”🤖 Ask: "what are the claude code plugins and lessons learned?"
Claude Code supports several plugin types for extending its capabilities:
1. **MCP Servers** - Model Context Protocol servers that provide additional tools. Configure in `.claude/settings.json`...
2. **Custom Slash Commands** - Define in `.claude/commands/`...
**Key lessons learned from production projects:**- Always establish CLAUDE.md files early- Use project rules to enforce coding standards- ...
📚 Sources (searched: wiki, outline, wikipedia):• Claude Code - IrregularPedia: https://irregularpedia.org/ai-ml/claude-code/• Project Rules & Lessons Learned: https://irregularpedia.org/ai-ml/project-rules-lessons-learned/• Claude Code Setup - Outline: https://outline.irregularchat.com/doc/...Format details:
- Header echoes the original question
- AI-synthesized answer (max ~1500 chars for Signal readability)
- Source list at bottom with clickable URLs
- Sources searched noted parenthetically
Comparison with Other Commands
Section titled “Comparison with Other Commands”!ask is an orchestrator — it calls into the same search backends as the individual commands, but combines and synthesizes results.
| Command | What It Does | When to Use |
|---|---|---|
!ask | Unified search across all sources + AI synthesis | General questions, when you don’t know which source to check |
!wikiask / !wa | Search IrregularPedia wiki only | Specific wiki knowledge |
!ol ask | Search Outline docs only | Specific team documentation |
!files -s | Smart file search only | Looking for a specific file |
!ai | Pure AI (no source search) | Opinions, creative tasks, general chat |
!qa | Submit question to Q&A database for community answers | Want human answers tracked over time |
When to use !ask vs specific commands:
- Use
!askwhen you’re not sure which source has the answer - Use specific commands when you know exactly where to look (faster, more targeted)
!askadds ~5-15 seconds of overhead for routing and gap detection
Relationship to Q&A System
Section titled “Relationship to Q&A System”The original !ask command (submit a question for community answers) has been renamed to !qa. See Q&A System for documentation.
| Old Command | New Command | Purpose |
|---|---|---|
!ask <question> | !qa <question> | Submit question for community tracking |
!q <question> | !q <question> | Still works (alias for !qa) |
!question <hash> | !question <hash> | View question details (unchanged) |
| (new) | !ask <question> | Unified agentic search |
Error Handling
Section titled “Error Handling”| Scenario | Behavior |
|---|---|
| No sources return results | Falls back to pure AI answer with disclaimer |
| One source times out | Continues with remaining sources, notes timeout |
| All sources timeout | Returns error suggesting specific commands |
| OpenAI rate limit | Queues synthesis, retries once after 5s |
| Wikipedia API down | Skips, uses remaining sources |
| Google KG API key missing | Skips Knowledge Graph silently |
Per-source timeout: 5 seconds
Total timeout: 30 seconds max — synthesizes with whatever is gathered
Rate limit: 10 !ask calls per hour per user
Configuration
Section titled “Configuration”Required
Section titled “Required”| Variable | Purpose |
|---|---|
OPENAI_API_KEY | Powers the router, gap detection, and synthesis (gpt-4o-mini) |
Optional
Section titled “Optional”| Variable | Purpose | Default |
|---|---|---|
GOOGLE_KG_API_KEY | Google Knowledge Graph API | Disabled if not set |
QA_WEB_URL | Base URL for Q&A web links in results | None |
Wikipedia search requires no API key or authentication (uses the public MediaWiki Action API).
Architecture
Section titled “Architecture”Pipeline Stages
Section titled “Pipeline Stages”- Router — Single gpt-4o-mini call (
temperature: 0.1) picks 2-4 sources - Parallel Search — All selected sources searched simultaneously via
Promise.all() - Gap Detection — gpt-4o-mini evaluates gathered context, decides if more sources are needed
- Synthesizer — gpt-4o-mini combines all context into a cohesive answer (
temperature: 0.3with context,0.7without)
Key Files
Section titled “Key Files”| File | Purpose |
|---|---|
src/src/utils/unified-search.ts | Router, parallel search, gap detection, synthesizer |
src/src/utils/wikipedia-client.ts | Wikipedia MediaWiki Action API client |
src/src/utils/knowledge-graph-client.ts | Google Knowledge Graph API client |
src/src/utils/rss-search.ts | RSS links term-based search |
src/src/bot/command-handler.ts | handleUnifiedAsk() method, command routing |
Search Term Extraction
Section titled “Search Term Extraction”For RSS and Q&A history, natural language questions are split into individual search terms with stop words removed. For example:
Question: "was there a link posted last week about ai in the dod?"Stop words removed: ["link", "posted", "last", "week", "about"]Search terms: ["ai", "dod"]SQL: WHERE (title ILIKE '%ai%' OR summary ILIKE '%ai%') OR (title ILIKE '%dod%' OR summary ILIKE '%dod%')This dramatically improves recall compared to matching the entire question as a single pattern.
Related Documentation
Section titled “Related Documentation”- Q&A System — Community Q&A tracking (
!qa) - Wiki & Knowledge — Wiki search commands (
!wikiask,!wikisearch) - Outline Docs — Team documentation (
!ol ask) - RSS Reader — Link aggregation and search
- Integrations — External service configuration (Wikipedia, Knowledge Graph)
- Architecture Overview — System architecture