Wiki Setup Plan โ wiki.freemo.io
Task: Serve memory-wiki plugin files via a web-accessible wiki at https://wiki.freemo.io, with Caddy auto-SSL, two-way file sync (auto-update from memory plugin changes + manual edits trigger wiki reload), and full read/write/edit capability.
Session: a51dd481-3e35-498e-8a70-bd50dc2fcf78 (failed, 0 runtime, never produced output โ this plan is the recovery)
Date: 2026-06-16
Environment Assessment
| Item | Value |
|------|-------|
| Caddy version | 2.11.4 (/usr/bin/caddy, config: /etc/caddy/Caddyfile) |
| Memory wiki files | /home/openclaw/.openclaw/workspace/memory/wiki/ (identity, plans-and-specs, test-page.md) |
| Obsidian available? | No โ Electron desktop app, not installable on Linux server |
| Node.js available | v24 |
| Python3 available | Yes |
| DNS CNAME | wiki.freemo.io โ server public IP (already set) |
| Ports available | Likely 19000+ range (19000 chosen for wiki) |
| Existing Caddy sites | claw.freemo.io (โ18789), claw-relay.freemo.io (โ47800), graa.freemo.io (โ18789) |
Architecture
Browser (https://wiki.freemo.io)
โ
โ HTTPS (Let's Encrypt auto via Caddy)
โผ
Caddy reverse proxy (wiki.freemo.io:443 โ localhost:19000)
โ
โ HTTP
โผ
Wiki Server (Python/FastAPI on port 19000)
โ
โ
โผ
File System: /home/openclaw/.openclaw/workspace/memory/wiki/*.md
Two-way sync:
- Memory plugin writes โ files โ wiki server serves (file-watcher detects changes, reloads cache)
- Manual browser edits โ wiki server writes โ files โ memory plugin detects via inotify/dogpile
Step-by-Step Plan
Phase 1 โ Wiki Server (Python/FastAPI)
- Install FastAPI + dependencies (already on server or install via pip):
pip install fastapi uvicorn markdown2 pygments watchdog
(watchdog = file-watcher for two-way sync)
- Create wiki server script at
/home/openclaw/wiki-server.py:
.md files from /home/openclaw/.openclaw/workspace/memory/wiki/ as rendered HTML
- Markdown rendering with syntax highlighting (pygments)
- Edit mode: POST to /edit/ saves back to file system
- File-watcher (watchdog) on the wiki dir โ clears render cache when files change
- Dogpile/double-check lock to prevent thundering-herd on cache miss
- Run it on port 19000 (background, via systemd service or supervisor):
uvicorn wiki-server:app --host 127.0.0.1 --port 19000 --log-level info
- Test locally:
curl http://localhost:19000/ # should list pages
curl http://localhost:19000/page/test-page # render a page
Phase 2 โ Caddy Configuration
- Add to
/etc/caddy/Caddyfile:
wiki.freemo.io {
reverse_proxy localhost:19000
}
- Reload Caddy (auto-detects new site, fetches Let's Encrypt cert):
sudo caddy reload --config /etc/caddy/Caddyfile
- Verify SSL:
curl -s https://wiki.freemo.io/ | head -20
Phase 3 โ Two-Way Sync Details
- Auto-update from memory plugin (memory โ wiki):
/home/openclaw/.openclaw/workspace/memory/wiki/
- Any file change (created, modified, deleted) invalidates the render cache
- Next browser request re-renders fresh content
- Memory plugin writes files normally โ watchdog triggers cache clear
- Manual browser edits (wiki โ memory):
- POST /edit/ with content โ wiki server writes *.md file
- Watchdog on the memory plugin dir detects changes โ next memory operation picks them up
- (Optional: webhook notify memory plugin ingest cron to process new files)
- Ensure dogpile lock prevents cache-thundering when multiple requests hit a cold cache:
dogpile lock file in /tmp/wiki-cache-lock/
- First request rebuilds; others wait for the lock to release
Phase 4 โ Security & Access Control
- Authentication (if needed โ consider optional):
- Option B: Basic auth via Caddy basicauth directive
- Default: public for now; add auth if private pages are needed
- Rate limiting (optional):
limit_reqin Caddy if needed
- Read-only vs edit mode:
/edit/ is open by default
- Can restrict to local network or add token auth
Implementation Order (exact commands)
1. Install deps
pip install fastapi uvicorn markdown2 pygments watchdog
2. Create wiki server (script at /home/openclaw/wiki-server.py)
(see Phase 1 details above)
3. Start server
uvicorn wiki-server:app --host 127.0.0.1 --port 19000 &
4. Test
curl http://localhost:19000/
5. Add to Caddyfile (/etc/caddy/Caddyfile)
wiki.freemo.io { reverse_proxy localhost:19000 }
6. Reload Caddy
sudo caddy reload --config /etc/caddy/Caddyfile
7. Verify
curl -s https://wiki.freemo.io/ | head -20
Key Risks & Mitigations
| Risk | Mitigation |
|------|-----------|
| Obsidian vault format (.obsidian/) | Not applicable โ using server-side wiki, not Obsidian vault |
| Memory plugin writes files without watchdog trigger | Already using watchdog in wiki server; no conflict |
| Concurrent edits from browser + memory plugin | File-lock + last-write-wins; low risk on single-user wiki |
| SSL cert not auto-provisioned | Caddy's ACME handles it automatically; DNS must be reachable |
| Caddy reload breaks existing sites | Using --config /etc/caddy/Caddyfile appends site, doesn't replace |
Verification Checklist
- [ ]
pip installsucceeds - [ ] Wiki server starts on port 19000
- [ ]
curl http://localhost:19000/returns page list - [ ]
curl http://localhost:19000/page/test-pagerenders markdown - [ ]
wiki.freemo.ioresolves in DNS - [ ]
curl -s https://wiki.freemo.io/returns rendered content - [ ] Edit flow works: POST to
/edit/test-page, reload shows changes - [ ] File watcher clears cache on manual file edits
- [ ] Memory plugin write โ browser sees updated content
- [ ] No Caddy config breakage on existing sites
Not Covered Here (separate tasks)
- Obsidian desktop app (client-side vault sync) โ can add Obsidian LiveSync plugin separately
- Authentication / user accounts โ add if needed
- Backups of wiki files โ standard file backup of
/home/openclaw/.openclaw/workspace/memory/wiki/ - CDN / image hosting โ can use existing object storage or local
/attachments/dir - Search โ can add client-side lunr.js or server-side FTS if needed