claw-mo-up
Bring up the mo markdown viewer for the current project and open the browser. When a server is already running, restart it by default so new files on disk become visible (fsnotify can silently miss events).
For config schema, decision tree, --restart vs --clear semantics, and browser opening: read ${CLAUDE_PLUGIN_ROOT}/references/shared.md
Arguments
$ARGUMENTS(optional)--reuse— Skipmo --restartwhen live matches config. Use this when the running session is known-good and the user explicitly wants zero interruption.
Steps
[!NOTE] With autosync enabled (default),
/claw-mo-upis only needed to (a) start mo for the first time in a session, (b) recover from a silent fsnotify miss viamo --restart, or (c) reconcile a drifted runtime to saved config. Routine new-file visibility does not require a restart anymore.
Prerequisites:
command -v mo >/dev/null 2>&1. If missing, tell userbrew install k1LoW/tap/moand stop.Project key:
git rev-parse --show-toplevel(fallback:$PWD).Read config from
${CLAUDE_PLUGIN_DATA}/config.json. If no entry for this project, tell the user to run/claw-mo-setupand stop.v1 migration: If the entry has
patternsinstead ofgroups, migrate togroupsformat and save back.Probe server:
mo --status --json 2>/dev/null. Extract the server whose port matches$PORT.Branch on state — see the decision tree in
shared.md:(a) No server on this port → start per group sequentially:
mo --no-open -w 'pattern1' -w 'pattern2' --target groupName -p $PORT mo --no-open -w 'pattern3' --target anotherGroup -p $PORT(b) Server running, live matches config:
- Default:
mo --restart -p $PORT— fresh fsnotify scan, session preserved. This is the main fix for the "docs exist on disk but don't show up in mo" class of bug. - If
--reuseflag was passed: skip restart, reuse as-is.
(c) Server running, live differs from config (treat config as source of truth):
- Show a concise diff (groups added/removed, patterns changed) so the user sees why a clear is happening
printf 'y\n' | mo --clear -p $PORT- Start per group as in (a)
- Mention that ad-hoc runtime edits were discarded; persist via
/claw-mo-manageor/claw-mo-setupnext time
- Default:
Open browser — prefer cmux whenever reachable.
$CMUX_SURFACE_IDalone is not a reliable signal:cmux path (
$CMUX_SURFACE_IDset ORcommand -v cmux):cmux list-pane-surfacesto inspect existing surfaces- If a surface already targets
localhost:$PORT, reuse it:cmux browser "surface:N" navigate "http://localhost:$PORT"(keep thesurface:prefix) - Otherwise
cmux browser open "http://localhost:$PORT"(oropen-splitfor first-time split layout)
Fallback:
open "http://localhost:$PORT"
Report what actually happened:
started/restarted (fresh scan)/reused as-is/cleared + rebuilt (config drift)- active groups + file counts (from
mo --status --json) - the URL
Gotchas
- Restart is the default because fsnotify can silently miss file creation events (new subdirectories, high load, macOS FSEvents coalescing).
mo --restartis cheap (<1s), preserves the session, and forces a full re-scan. The old "reuse silently" behavior hid missing files. - Always
--no-openwhen starting mo — the skill controls browser opening separately. - Start groups sequentially, not in parallel — the first invocation must start the server before others can add to it.
- mo auto-restores previous sessions from its backup file. A matching port alone does not guarantee a correct session. Always compare the full live group→patterns mapping to config; if it drifts, clear and rebuild.
- mo status reports absolute patterns; config stores relative globs. Normalize config patterns to absolute paths under the project root before comparing, and sort within each group so ordering differences don't create false mismatches.
mo --restartdoes NOT prompt — safe to call directly. Only--clearneedsprintf 'y\n' |./claw-mo-upis the reconcile point: ad-hoc runtime-only edits belong in/claw-mo-manageor/claw-mo-setupif they should persist.- Prefer cmux over
openwhenever cmux is reachable.$CMUX_SURFACE_IDmay be unset even inside a cmux pane (nested shells). Checkcommand -v cmuxtoo. - Reuse cmux surface before
browser open—openstacks duplicate tabs. Pass the exact identifier (e.g.,surface:4, not4). - Autosync vs.
/claw-mo-up: the PostToolUse hook handles routine new-file visibility for files Claude writes./claw-mo-upremains the fix when (a) mo isn't running yet, (b) fsnotify missed something an external editor wrote, or (c) config drifted. Don't run/claw-mo-upas a reflex on every new file — it's cheap but not free.
Related Commands
/claw-mo-setup— initial project configuration (patterns, groups)/claw-mo-down— stop the mo server/claw-mo-manage— modify patterns, check status, refresh