RAG with Confluence: Build an AI Knowledge Base from Your Docs
RAG (Retrieval-Augmented Generation) lets you query your Confluence knowledge base using natural language. It retrieves relevant pages and uses AI to generate accurate answers from your documentation.
- How to prepare Confluence content for RAG indexing
- How to choose the right RAG platform for your needs
- How to index and configure your Confluence knowledge base
- How to test, optimize, and deploy your RAG system
Your team has hundreds of Confluence pages, but finding the right information still takes too long. Search returns too many results, keywords miss synonyms, and context gets lost across pages.
RAG (Retrieval-Augmented Generation) changes this by combining search with AI generation. Instead of returning pages, it returns answers — synthesized from your Confluence content. This guide covers how to build a RAG system with Confluence.
Why RAG Matters for Confluence
Natural language queries. Instead of guessing keywords, ask questions in plain English: "How do we handle production incidents?" or "What is our deployment process?"
Synthesized answers. RAG combines information from multiple pages into a single, coherent answer. No more clicking through 5 pages to piece together a response.
Always current. RAG indexes your live Confluence content. When you update a page, the knowledge base updates automatically.
Reduced support burden. Teams can self-serve answers instead of asking the same questions repeatedly. This frees up senior team members for higher-value work.
How to Build RAG with Confluence: Step-by-Step
1. Prepare Your Confluence Content for RAG
RAG quality depends on content quality. Before indexing, clean up your Confluence pages:
Content cleanup checklist:
- Remove outdated or inaccurate pages
- Fix broken links and references
- Add clear headings and structure
- Include metadata (tags, labels, categories)
- Remove duplicate content
- Ensure consistent formatting
Content structure for RAG:
# Clear, descriptive title
## Introduction paragraph (what this page covers)
## Main content sections with H2/H3 headers
## FAQ section with Q&A pairs
## Related pages section
Best content types for RAG:
- How-to guides and tutorials
- FAQ pages
- Policy and procedure documents
- Troubleshooting guides
- Architecture and design documents
- Onboarding materials
Content to exclude:
- Meeting notes (too informal, time-sensitive)
- Decision logs (context-dependent)
- Personal pages (not shared knowledge)
- Draft pages (incomplete information)
2. Choose a RAG Platform or Tool
Option A: Atlassian Intelligence (native)
- Pros: Built-in, no setup, respects permissions
- Cons: Limited customization, requires Premium/Enterprise plan
- Best for: Teams already on Atlassian Premium who want quick setup
Option B: Marketplace apps
| App | Features | Pricing |
|---|---|---|
| Guru | AI search, verified answers | $15/user/month |
| Tettra | AI Q&A, content suggestions | $99/month |
| Slab | AI search, knowledge base | $66/month |
| Tettra | AI Q&A, content suggestions | $99/month |
Option C: Custom RAG solution
- Pros: Full control, custom models, unlimited customization
- Cons: Requires development effort, maintenance, hosting
- Best for: Teams with specific requirements or sensitive data
Custom RAG stack:
- Data source: Confluence REST API
- Embedding: OpenAI, Cohere, or open-source models
- Vector store: Pinecone, Weaviate, or ChromaDB
- Orchestration: LangChain, LlamaIndex
- Interface: Web app, Slack bot, or CLI
3. Index Your Confluence Content
Using Atlassian Intelligence:
- Go to Site Administration > Atlassian Intelligence
- Enable Knowledge base feature
- Select which spaces to index
- Configure permissions (respect Confluence access)
- Wait for initial indexing (varies by content size)
Using a custom RAG solution:
# Example: Index Confluence pages with LangChain
from langchain.document_loaders import ConfluenceLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import Pinecone
# Load pages from Confluence
loader = ConfluenceLoader(
url="https://your-domain.atlassian.net",
username="email@company.com",
api_key="your-api-key"
)
pages = loader.load(space_key="ENG")
# Split into chunks
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=200
)
chunks = splitter.split_documents(pages)
# Create embeddings and store
embeddings = OpenAIEmbeddings()
vectorstore = Pinecone.from_documents(
chunks,
embeddings,
index_name="confluence-kb"
)
Chunking strategy:
- Chunk size: 500-1000 tokens (balance between context and precision)
- Overlap: 100-200 tokens (maintain context across chunks)
- Split by: Headers first, then paragraphs, then sentences
- Metadata: Include page title, space, URL, last updated
4. Test and Optimize Retrieval Quality
Testing checklist:
- Run 20-30 sample queries covering different topics
- Evaluate answer accuracy (correct, partially correct, wrong)
- Check if answers cite the right source pages
- Test with edge cases (ambiguous queries, out-of-scope questions)
- Verify permission filtering works correctly
Common issues and fixes:
| Issue | Cause | Fix |
|---|---|---|
| Wrong answers | Poor chunking | Adjust chunk size and overlap |
| Missing answers | Content not indexed | Check space/label filters |
| Outdated answers | Stale content | Re-index more frequently |
| Irrelevant results | Bad embeddings | Try different embedding model |
| Slow responses | Large index | Optimize vector store, add filters |
Optimization parameters:
- Top K: Number of chunks to retrieve (start with 5, adjust based on quality)
- Similarity threshold: Minimum match score (0.7-0.8 typical)
- Reranking: Use a reranker model to improve relevance
- Hybrid search: Combine keyword and semantic search
5. Deploy and Monitor Your AI Knowledge Base
Deployment options:
- Slack bot: Team asks questions in Slack, bot responds with answers
- Web interface: Standalone search page for the knowledge base
- Confluence integration: AI assistant within Confluence itself
- API: Custom applications that query the knowledge base
Monitoring and improvement:
- Track query logs to identify common questions
- Monitor failed queries (no answer or wrong answer)
- Collect user feedback on answer quality
- Update content based on gaps identified
- Re-index regularly as content changes
Metrics to track:
- Query volume (daily/weekly)
- Answer accuracy (user ratings)
- Failed query rate
- Content freshness (average age of indexed pages)
- User adoption (active users, queries per user)
FAQ
What is RAG and why does it matter for Confluence?
RAG (Retrieval-Augmented Generation) combines search with AI generation. It retrieves relevant Confluence content, then uses an LLM to generate accurate answers. This makes your Confluence knowledge base searchable via natural language queries.
Can I build RAG with Confluence without coding?
Yes. Tools like Atlassian Intelligence, Guru, and Tettra provide no-code RAG solutions for Confluence. For custom requirements, you can build with LangChain, LlamaIndex, or similar frameworks.
How accurate is RAG with Confluence content?
Accuracy depends on content quality, chunking strategy, and embedding model. Well-structured Confluence pages typically yield 85-95% accuracy. Poorly organized content may need cleanup before indexing.
What Confluence content works best for RAG?
FAQ pages, how-to guides, policy documents, and troubleshooting guides work best. Meeting notes, decision logs, and informal pages may produce less reliable results.
How do I handle sensitive Confluence content in RAG?
Use RAG tools that respect Confluence permissions. Most enterprise solutions filter content based on the querying user's access rights, ensuring sensitive pages are only returned to authorized users.