Key takeaways
- Move one space at a time, starting with the content people search for most, and leave what nobody reads behind.
- Export each space from Confluence as HTML, convert it to Markdown with the free script below, and import the zip under Settings › Import & export.
- Every page arrives as a draft, so nothing is published until someone has checked it.
- Images, page trees and Confluence macros need a clean-up pass; the script lists every image it finds so none are missed.
- Claude can do much of the clean-up through CompassDocs’ built-in MCP server, and we walk new customers through it.
What moves, and what changes
CompassDocs stores every document as Markdown, and its importer takes a zip of Markdown files with a short header (front-matter) on each one. There is no one-click Confluence importer, so the route is: export from Confluence, convert to Markdown, import the zip. Here is how the main Confluence pieces map across.
| In Confluence | In CompassDocs | How it moves |
|---|---|---|
| Space | Space | Created by the import from the space name you give the script |
| Page text, headings, lists, tables, links | Document | Converted to Markdown by the script |
| Images and attachments | Images in the document | Re-added after import; the script lists every one |
| Page tree | Parent page on each document | Pages import flat; set the parent page where the tree matters |
| Info, note and warning panels | Callouts | Arrive as plain text; turn the important ones back into callouts |
| Labels | Tags | The script tags every page from-confluence; add your own tags after |
| Page history and comments | Version history and comments | Not carried over; history starts fresh at import. Keep Confluence read-only for reference |
| Space permissions | Roles per space | Set again in CompassDocs (step 6) |
That last column is the honest part of any migration. Page history, comments and complex macros (Jira issue lists, page-tree macros, embedded apps) don’t survive a Markdown export from any tool. If a space depends on them, keep the old space read-only for reference rather than trying to rebuild every macro.
Plan the move
Most Confluence sites hold years of pages, and a lot of them are out of date. A migration is the cheapest moment you’ll ever get to leave them behind.
- List your spaces and give each one an owner. The owner decides what moves and checks the imported drafts.
- Sort pages into move, archive and drop. Move what people use: procedures, runbooks, policies, onboarding and reference pages. Archive what you must keep but nobody reads. Drop meeting notes and drafts nobody has opened in a year.
- Decide the space layout in CompassDocs. You don’t have to copy Confluence one for one. Teams often merge small spaces into one, or split a sprawling space by audience.
- Pick a pilot space. Choose one that’s used every day and small enough to check by hand, such as the IT or HR space. Run the whole process on it before the rest.
- Set a cut-over date per space and tell people when the Confluence copy becomes read-only.
Step 1: Install CompassDocs
The Community edition is free and open source with unlimited users. On a Linux server with Docker, one command starts CompassDocs and PostgreSQL, and a setup wizard creates your admin account in the browser:
curl -fsSL https://raw.githubusercontent.com/Felix-AZ-Solutions-LLC/CompassDocs/main/install.sh | bash
Requirements, other platforms and the Node.js install path are on the self-hosting page. You need an admin account to import.
Step 2: Export a space from Confluence
In Confluence, open the space, go to its space settings, choose Export space and pick HTML. Export the whole space or only the pages you sorted into “move”. You need to be a space admin, and the exact menu names differ a little between Confluence Cloud and Data Center.
Confluence emails or downloads a zip. Unzip it: you’ll get one HTML file per page, an index.html, and folders such as attachments and images. Keep the folder; you’ll need the attachments in step 5.
Step 3: Convert the export to Markdown
This free script reads the exported HTML pages, keeps only each page’s main content (not Confluence’s menus and footers), converts it to Markdown with pandoc, and packs the result into a zip CompassDocs can import. It needs Python 3.8 or later and pandoc.
python3 confluence2compassdocs.py ./IT-export it "IT"
The three arguments are the unzipped export folder, a short name for the CompassDocs space (letters, numbers and dashes), and the space’s display name. It writes two files:
it-import.zip: one Markdown document per page, each marked as a draft and taggedfrom-confluence.it-images.csv: every image reference it found, by page, as your checklist for step 5.
Show the script (confluence2compassdocs.py)
#!/usr/bin/env python3
"""Turn a Confluence HTML space export into a CompassDocs import zip.
Usage: python3 confluence2compassdocs.py EXPORT_FOLDER SPACE_SLUG "Space name"
Needs Python 3.8+ and pandoc. Writes SPACE_SLUG-import.zip and SPACE_SLUG-images.csv.
Every page is imported as a draft so you can review it before publishing.
"""
import csv, html, json, re, subprocess, sys, zipfile
from html.parser import HTMLParser
from pathlib import Path
class MainContent(HTMLParser):
"""Collects the page title and the HTML inside <div id="main-content">."""
def __init__(self):
super().__init__(convert_charrefs=False)
self.title, self.in_title, self.depth, self.parts = "", False, 0, []
def handle_starttag(self, tag, attrs):
if tag == "title":
self.in_title = True
if self.depth:
self.depth += tag == "div"
self.parts.append(self.get_starttag_text())
elif tag == "div" and dict(attrs).get("id") == "main-content":
self.depth = 1
def handle_startendtag(self, tag, attrs):
if self.depth:
self.parts.append(self.get_starttag_text())
def handle_endtag(self, tag):
if tag == "title":
self.in_title = False
if self.depth:
self.depth -= tag == "div"
if self.depth:
self.parts.append(f"</{tag}>")
def handle_data(self, data):
if self.in_title:
self.title += data
if self.depth:
self.parts.append(data)
def handle_entityref(self, name):
self.handle_data(f"&{name};")
def handle_charref(self, name):
self.handle_data(f"&#{name};")
def main(folder, space, space_name):
space = re.sub(r"[^a-z0-9]+", "-", space.lower()).strip("-") or "imported"
out, report = Path(f"{space}-import.zip"), Path(f"{space}-images.csv")
pages = 0
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as z, report.open("w", newline="") as r:
images = csv.writer(r)
images.writerow(["document", "image"])
for page in sorted(Path(folder).glob("*.html")):
if page.name == "index.html":
continue
p = MainContent()
p.feed(page.read_text(encoding="utf-8", errors="replace"))
title = html.unescape(p.title.split(" : ", 1)[-1]).strip()
if not title or not p.parts:
print(f"skipped {page.name}: no title or main content")
continue
body = subprocess.run(
["pandoc", "-f", "html", "-t", "gfm-raw_html", "--wrap=none"],
input="".join(p.parts), capture_output=True, text=True, check=True,
).stdout
for src in re.findall(r"!\[[^\]]*\]\(([^)\s]+)", body):
images.writerow([title, src])
front = {"title": title, "space": space, "space_name": space_name,
"type": "knowledge", "status": "draft", "tags": ["from-confluence"]}
head = "\n".join(f"{k}: {json.dumps(v, ensure_ascii=False)}" for k, v in front.items())
z.writestr(f"documents/{space}/{page.stem}.md", f"---\n{head}\n---\n\n{body}")
pages += 1
z.writestr("manifest.json", json.dumps({"spaces": [{"slug": space, "name": space_name}]}, indent=2))
print(f"{pages} pages -> {out}; image references listed in {report}")
if __name__ == "__main__":
if len(sys.argv) != 4:
sys.exit(__doc__)
main(*sys.argv[1:])
Each document starts with a front-matter header like this, which is what the importer reads:
---
title: "Reset a user's MFA"
space: "it"
space_name: "IT"
type: "knowledge"
status: "draft"
tags: ["from-confluence"]
---
You can change type to sop, technical or policy before importing if you already know what a page is, or set it in CompassDocs afterwards. A title is required; a page without one is skipped and listed in the import result.
Step 4: Import into CompassDocs
- Sign in as an admin and open Settings › Import & export (or type “import” in the command palette).
- Under Import, choose the zip and select Import. A zip can be up to 50 MB; split a very large space into several zips.
- Read the result: how many documents were created, updated and skipped, and why any were skipped.
The space is created for you if it doesn’t exist yet. Every page lands as a draft, so readers see nothing until it’s been checked and published.
Importing is safe to repeat. Documents are matched by title within the space, so if you fix something in the export and import again, matching drafts are updated in place rather than duplicated. One thing to watch: two Confluence pages with the same title in the same space will land as one document, so rename duplicates first.
Already have policies with read confirmations? An import never overwrites a published document that requires read confirmation unless you tick Also overwrite documents that require read confirmation. That stops a re-import from quietly asking everyone to confirm a policy again.
Step 5: Clean up images, page trees and macros
Go through the pilot space’s drafts with the space owner. Most pages need a few minutes each; long reference pages need longer.
- Images. Work down
it-images.csv. For each image, open the file from the export’sattachmentsorimagesfolder and paste it into the step it illustrates; the editor sizes it in place. Remove the old image line. - Page tree. Where order matters (an onboarding path, a runbook set), set the Parent page on each document so the subpages sit under it again.
- Panels and macros. Turn important notes and warnings back into callouts, and replace Jira or page-tree macros with a link or a short list.
- Document type. Mark procedures as SOPs, runbooks and architecture notes as Technical, and policies as Policy. Pages that should follow one of your templates are good candidates to have Claude rewrite (see below).
- Links. Links to other Confluence pages still point at Confluence. Run Content health under Settings to find broken links and orphans, and repoint them to the new documents.
- Tags. Add tags people will filter by, and remove
from-confluenceonce a page is checked if you like.
Step 6: Set up spaces, roles and approvals
Confluence space permissions don’t export, so set access in CompassDocs before you publish.
- Roles per space. Give people Viewer, Editor, Approver or Admin on each space, or build custom roles from individual permissions.
- Approvals. Choose open mode, where editors publish directly, or strict mode, where an approver reviews every change. Many teams use strict mode for policies and SOPs and open mode for team notes.
- Sign-in. With Enterprise, connect SSO (SAML or OIDC) and sync groups, so access follows your directory instead of a separate list.
- AI answers. Turn on AI search with your own Anthropic API key so people can ask questions and get answers that cite your documents.
Step 7: Publish and switch people over
- Publish the checked drafts, or send them through approval if the space uses strict mode.
- Make the Confluence space read-only on the cut-over date, and add a banner at the top of its home page pointing to CompassDocs.
- Announce it with the links people use most, such as the IT how-to pages or the employee handbook. An announcement in CompassDocs works well once people are signed in.
- Watch what people search for. Analytics shows searches that came up empty in the first weeks. Each one is a page that was missed or is named differently from what people expect.
- Repeat for the next space. The second space always goes faster than the pilot.
Using Claude to speed it up
CompassDocs is built for MCP. Once an admin connects Claude to your workspace, Claude works within your permissions and can take on much of step 5:
- Search the imported drafts, then revise, retitle, retag and move them, rewriting a converted page into your SOP or runbook template with callouts and checklists.
- Place an image from a URL, reuse one already in the workspace, or give you a one-time drop link for a screenshot.
- Draft a policy handbook from imported policies, for a person to review and publish.
Approvals still apply to everything Claude changes, so your reviewers stay in control. When you start with CompassDocs, we walk you through this setup; talk to us if you’d like help planning a migration.
Troubleshooting
- “missing title” in the import result: that file has no
titlein its front-matter. The script takes titles from the exported page; if a page had none, add one and import again. - Two pages became one: they had the same title in the same space. Rename one in the Markdown and import again.
- “File is too large”: the zip is over 50 MB. Export the space in parts, or run the script on part of the export folder at a time.
- A page is empty or skipped by the script: it had no main content in the export, which is normal for some index pages. Recreate it by hand if you need it.
- A policy wasn’t updated: it requires read confirmation and is protected. Tick the overwrite box if you mean to replace it.