How to Build a Claude-Powered Internal Wiki Assistant
Building a Claude-powered internal wiki assistant means connecting your company's documentation (Confluence, Notion, Google Docs, or a plain markdown repo) to Claude so employees can ask questions in natural language and get answers grounded in your actual docs, with citations back to the source pages. The core pattern is retrieval-augmented generation: you search your wiki for relevant chunks, pass them to Claude as context, and let the model compose an answer. This guide walks through the architecture, the retrieval step, the prompt design, and how to wrap it in a reliable API.
Most teams get stuck not on the AI part but on the plumbing: exporting the wiki content, keeping it fresh, handling access control, and running the whole thing behind an API that your Slack bot, internal portal, or support tool can call without you managing infrastructure. Below is a practical build you can ship in a day or two.
Architecture overview
A wiki assistant has four moving parts:
- Ingestion — pull pages from your wiki source and split them into chunks.
- Indexing — embed chunks and store them in a vector database (or even a simple keyword search for small wikis).
- Retrieval — on each question, find the most relevant chunks.
- Generation — send the question plus retrieved chunks to Claude and return a cited answer.
You don't need a massive vector database for most internal wikis. If you have under a few thousand pages, a lightweight setup (pgvector, SQLite with embeddings, or even Postgres full-text search) works fine.
Step 1: Ingest and chunk the wiki
Export pages via your wiki's API (Confluence REST API, Notion API, or a git repo of markdown files). Strip HTML/formatting down to clean text, then chunk by headings rather than fixed character counts — this keeps each chunk semantically coherent and easier for Claude to cite accurately.
function chunkByHeading(markdown) {
const sections = markdown.split(/\n(?=## )/);
return sections.map((s, i) => ({
id: `chunk-${i}`,
text: s.trim(),
}));
}
Store each chunk with metadata: page title, URL, last-updated date. You'll need the URL to cite sources, and the date to flag stale answers.
Step 2: Embed and index
Generate embeddings for each chunk and store them. When a question comes in, embed it too and run a cosine-similarity search to pull the top 5-8 relevant chunks. Keep retrieval tight — Claude performs better with a focused set of relevant passages than a dump of loosely related ones.
Step 3: Design the prompt
The prompt should instruct Claude to answer only from the provided context and to cite the page it used. This is the single biggest factor in whether the assistant is trustworthy or just a confident guesser.
You are an internal documentation assistant. Answer the question using
ONLY the context below. If the answer isn't in the context, say you
don't know and suggest who might know (e.g. "check with the platform team").
Always cite the page title and URL you used.
Context:
{{retrieved_chunks}}
Question: {{user_question}}
This "answer only from context" instruction matters more than prompt-engineering tricks. Without it, Claude will happily fill gaps with general knowledge, which is exactly what you don't want in an internal wiki tool — stale or wrong answers erode trust fast.
Step 4: Call Claude and return a cited answer
Once retrieval and the prompt are ready, the generation call itself is straightforward. Here's an example using SubToAPI, which turns your existing Claude access into a plain HTTPS endpoint with an API key — useful if you want to skip managing Anthropic billing and keys separately for an internal tool with multiple contributors.
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 600,
"messages": [
{
"role": "user",
"content": "Context:\n[Deployment Guide]\nOur staging deploys run via GitHub Actions on push to main...\n\nQuestion: How do I deploy to staging?"
}
]
}'
Parse the response and surface the cited page URLs alongside the answer in your UI — a Slack message, a sidebar widget, or a dedicated search box. See the quickstart and messages docs for the full request/response shape.
Step 5: Stream for a better UX
If the assistant lives in a chat-style UI, streaming the response token-by-token makes it feel responsive instead of a multi-second wait. Check streaming for how to consume server-sent events from the API.
Step 6: Keep the index fresh
Set up a nightly job that re-pulls changed pages (most wiki APIs expose a "last modified" timestamp) and re-embeds only what changed. Stale answers are the fastest way to kill trust in an internal tool — if the assistant tells someone the old deploy process, they'll stop using it.
Handling access control
If your wiki has restricted spaces (HR policies, finance docs), don't index everything into one flat store. Tag chunks with the permission groups that can see them, and filter retrieval results by the requesting user's group before they ever reach the prompt. Never rely on the model to "not mention" restricted content — filter at retrieval time.
Adding tool use for live lookups
Some questions need live data the wiki doesn't have — like "is the staging environment up right now?" For these, give Claude a tool definition that calls an internal status API, and let it decide when to invoke it versus answering from retrieved docs. The tools guide covers defining and handling tool calls in the request/response cycle.
Rolling it out to a team
For a team-wide internal tool, you'll likely have multiple developers building integrations (Slack bot, internal portal, CLI) against the same Claude access. Rather than sharing one raw API key, a setup with separate application keys per integration, usage visibility, and seats makes the rollout easier to manage — which is the kind of layer SubToAPI adds on top of your Claude access. Compare plans if you're scaling this beyond a prototype.
Measuring whether it's working
Track three things from week one: the percentage of questions answered with a citation (versus "I don't know"), how often employees click through to the cited source, and direct feedback via a thumbs up/down on each answer. If "I don't know" rates are high, your retrieval or chunking needs tuning before you touch the prompt.
FAQ
Does this replace my existing wiki search? No — it sits on top of it. Wiki search finds pages; the assistant reads them and composes a direct answer with a citation, which is faster for specific questions.
How do I stop Claude from making up answers? Instruct it explicitly to answer only from the provided context and to say "I don't know" otherwise. Combine that with tight, relevant retrieval — vague or overly broad context chunks are the main cause of hallucinated answers.
Can I add this to Slack instead of a web page? Yes. The generation logic is identical; you just route Slack slash commands or mentions into the same retrieval-plus-Claude pipeline and post the response back as a message with the cited link.