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:


Step-by-Step Plan

Phase 1 โ€” Wiki Server (Python/FastAPI)

  1. Install FastAPI + dependencies (already on server or install via pip):
pip install fastapi uvicorn markdown2 pygments watchdog

(watchdog = file-watcher for two-way sync)

  1. Create wiki server script at /home/openclaw/wiki-server.py:
- Serve all .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

  1. 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
  1. Test locally:
curl http://localhost:19000/  # should list pages

curl http://localhost:19000/page/test-page # render a page

Phase 2 โ€” Caddy Configuration

  1. Add to /etc/caddy/Caddyfile:
wiki.freemo.io {

reverse_proxy localhost:19000

}

  1. Reload Caddy (auto-detects new site, fetches Let's Encrypt cert):
sudo caddy reload --config /etc/caddy/Caddyfile
  1. Verify SSL:
curl -s https://wiki.freemo.io/ | head -20

Phase 3 โ€” Two-Way Sync Details

  1. Auto-update from memory plugin (memory โ†’ wiki):
- The file-watcher in the wiki server watches /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

  1. Manual browser edits (wiki โ†’ memory):
- Edit button on each page โ†’ opens textarea

- 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)

  1. 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

  1. Authentication (if needed โ€” consider optional):
- Option A: No auth (wiki is public content, no sensitive data in wiki dir)

- Option B: Basic auth via Caddy basicauth directive

- Default: public for now; add auth if private pages are needed

  1. Rate limiting (optional): limit_req in Caddy if needed
  1. Read-only vs edit mode:
- Edit endpoint /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


Not Covered Here (separate tasks)