diff --git a/bin/omarchy-remove-ai-llmman b/bin/omarchy-remove-ai-llmman new file mode 100755 index 000000000000..4747b489d5a9 --- /dev/null +++ b/bin/omarchy-remove-ai-llmman @@ -0,0 +1,43 @@ +#!/bin/bash + +# omarchy:summary=Remove llmman along with every model it pulled. +# omarchy:requires-sudo=true + +set -euo pipefail + +# Before anything else: without HOME, touch nothing (rm -rf paths would root at /). +: "${HOME:?HOME must be set}" + +# `llmman launch` and `llmman run` leave a `llmman serve` daemon behind, +# detached from any terminal, with the store open and a model possibly still +# loaded. It has no stop command of its own; its own advice is this pkill, which +# matches the daemon's command line and no plain CLI invocation. +pkill -TERM -f 'llmman serve' 2>/dev/null || true + +# Like the OpenClaw remover: a daemon that will not stop aborts the removal, +# rather than leaving it running on a deleted package and store. +for _ in {1..50}; do + pgrep -f 'llmman serve' >/dev/null || break + sleep 0.2 +done +if pgrep -f 'llmman serve' >/dev/null; then + echo "Could not stop llmman serve; llmman was not removed." >&2 + exit 1 +fi + +omarchy-pkg-drop llmman-bin + +# The store (an OCI layout of every pulled model), the llama.cpp releases it +# downloaded and the prompt history all sit under one data directory; aliases, +# provider keys and the trust policy under one config directory. Both are +# llmman's own. So are the two files it writes into other agents' homes under +# its own name: the codex profile overlay and the AGY settings directory. The +# agents themselves, and anything else in ~/.codex and ~/.gemini, stay. +rm -rf \ + "$HOME/.local/share/llmman" \ + "$HOME/.config/llmman" \ + "$HOME/.codex/llmman.config.toml" \ + "$HOME/.gemini/llmman" + +echo "" +echo "llmman and its models have been removed." diff --git a/default/omarchy/omarchy-menu.jsonc b/default/omarchy/omarchy-menu.jsonc index 7583d8d8ce95..bbfaca011e88 100644 --- a/default/omarchy/omarchy-menu.jsonc +++ b/default/omarchy/omarchy-menu.jsonc @@ -245,6 +245,7 @@ "install.ai.dictation": {"icon":"","label":"Dictation","disabled":"omarchy-pkg-present voxtype-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-install"}, "install.ai.grok-bot": {"icon":"","iconFont":"omarchy","label":"Grok Bot","disabled":"omarchy-pkg-present grok-bot","action":"omarchy-install-and-launch 'Grok Bot' grok-bot grok-bot"}, "install.ai.hermes": {"icon":"","iconFont":"omarchy","label":"Hermes Desktop","disabled":"omarchy-pkg-present hermes-desktop","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-hermes"}, + "install.ai.llmman": {"icon":"󰒋","label":"llmman","disabled":"omarchy-cmd-present llmman","action":"omarchy-install-app llmman llmman-bin"}, "install.ai.lm-studio": {"icon":"","iconFont":"omarchy","label":"LM Studio","disabled":"omarchy-pkg-present lmstudio-bin","action":"omarchy-install-app 'LM Studio' lmstudio-bin"}, "install.ai.ollama": {"icon":"","iconFont":"omarchy","label":"Ollama","disabled":"omarchy-cmd-present ollama","action":"if omarchy-cmd-present nvidia-smi; then ollama_pkg=ollama-cuda; elif omarchy-cmd-present rocminfo; then ollama_pkg=ollama-rocm; else ollama_pkg=ollama; fi; omarchy-install-app Ollama \"$ollama_pkg\""}, "install.ai.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","disabled":"omarchy-pkg-present openclaw","action":"omarchy-launch-floating-terminal-with-presentation omarchy-install-ai-openclaw"}, @@ -313,6 +314,7 @@ "remove.ai.claude": {"icon":"","iconFont":"omarchy","label":"Claude Desktop","when":"omarchy-pkg-present claude-desktop","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-claude"}, "remove.ai.dictation": {"icon":"","label":"Dictation","when":"omarchy-pkg-present voxtype-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-voxtype-remove"}, "remove.ai.grok-bot": {"icon":"","iconFont":"omarchy","label":"Grok Bot","when":"omarchy-pkg-present grok-bot","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-grok-bot"}, + "remove.ai.llmman": {"icon":"󰒋","label":"llmman","when":"omarchy-pkg-present llmman-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-llmman"}, "remove.ai.lm-studio": {"icon":"","iconFont":"omarchy","label":"LM Studio","when":"omarchy-pkg-present lmstudio-bin","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-lm-studio"}, "remove.ai.ollama": {"icon":"","iconFont":"omarchy","label":"Ollama","when":"omarchy-pkg-present ollama","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-ollama"}, "remove.ai.openclaw": {"icon":"","iconFont":"omarchy","label":"OpenClaw","when":"omarchy-pkg-present openclaw","action":"omarchy-launch-floating-terminal-with-presentation omarchy-remove-ai-openclaw"}, diff --git a/manual/17-ai.md b/manual/17-ai.md index 8c3d48b024ca..94e400908d40 100644 --- a/manual/17-ai.md +++ b/manual/17-ai.md @@ -56,7 +56,9 @@ OpenClaw's desktop experience is its Control UI, which opens as a web app backed ### Local LLMs -Omarchy recommends two ways of running local LLM models: LM Studio and Ollama. LM Studio provides a GUI interface for finding open-weight models, installing them, and running them. It's a great way to get going easily. Ollama offers a CLI for doing so similarly. But if you're new to local models, I'd start with LM Studio. You can install either under _Install > AI_ in the Omarchy Menu. +Omarchy recommends three ways of running local LLM models: LM Studio, Ollama, and llmman. LM Studio provides a GUI interface for finding open-weight models, installing them, and running them. It's a great way to get going easily. Ollama offers a CLI for doing so similarly. But if you're new to local models, I'd start with LM Studio. You can install any of them under _Install > AI_ in the Omarchy Menu. + +[llmman](https://github.com/llmmanorg/llmman) is the one for pointing the coding agents above at a local model: `llmman launch claude --model qwen3.8` fetches the tested upstream `llama.cpp` build for your GPU, loads the model, and starts Claude Code against it (the same works for `opencode`, `codex`, `agy`, and others). Models are plain OCI artifacts, pulled straight from Docker Hub or Hugging Face, and `llmman serve` answers the Ollama, OpenAI, and Anthropic APIs on one endpoint, so anything that already talks to Ollama works unchanged. Swap `--model` for `--provider` to run the same agent against a hosted model instead. ### The Omarchy Skill diff --git a/test/shell.d/remove-ai-test.sh b/test/shell.d/remove-ai-test.sh index d81e6ca6811b..64746745a5e7 100644 --- a/test/shell.d/remove-ai-test.sh +++ b/test/shell.d/remove-ai-test.sh @@ -23,6 +23,17 @@ printf 'pkill:%s\n' "$*" >>"$TEST_LOG" SCRIPT chmod +x "$tmp_dir/bin/pkill" +# omarchy-remove-ai-llmman waits for the daemon to exit. The stub reports it +# running for as many calls as TEST_POLLS holds, then gone, so the developer's +# own daemon never matters. +cat >"$tmp_dir/bin/pgrep" <<'SCRIPT' +#!/bin/bash +polls=$(cat "$TEST_POLLS" 2>/dev/null || echo 0) +((polls > 0)) || exit 1 +echo $((polls - 1)) >"$TEST_POLLS" +SCRIPT +chmod +x "$tmp_dir/bin/pgrep" + # omarchy-remove-ai-perplexity asks through gum whether the user's data goes # too. The stub answers "no" unless a test says otherwise and logs the call: a # real gum would hang the run, and one that answered "yes" on its own would be @@ -40,6 +51,7 @@ export TEST_GUM_LOG="$tmp_dir/gum-log" touch "$TEST_GUM_LOG" export TEST_LOG="$tmp_dir/log" +export TEST_POLLS="$tmp_dir/polls" export PATH="$tmp_dir/bin:$PATH" fresh_home() { @@ -221,6 +233,71 @@ ollama_row=$(grep '^ "remove.ai.ollama":' "$ROOT/default/omarchy/omarchy-menu.j fail "Ollama removal is offered only where the package is installed" "$ollama_row" pass "Ollama removal is offered only where the package is installed" +# llmman keeps its store, config and the files it drops into other agents' +# homes under its own name; the agents' own state next to them is not its to +# take. The detached `llmman serve` daemon has no stop command, so pkill is how +# it goes, and the stub above keeps that off the developer's own daemon. +fresh_home +mkdir -p "$HOME/.local/share/llmman/store" "$HOME/.config/llmman" "$HOME/.codex" \ + "$HOME/.gemini/llmman/antigravity-cli" "$HOME/.gemini/config/skills" "$HOME/.hermes" +touch "$HOME/.codex/llmman.config.toml" "$HOME/.codex/config.toml" \ + "$HOME/.gemini/llmman/antigravity-cli/settings.json" "$HOME/.hermes/config.yaml" +"$ROOT/bin/omarchy-remove-ai-llmman" >/dev/null + +for gone in .local/share/llmman .config/llmman .codex/llmman.config.toml .gemini/llmman; do + [[ ! -e $HOME/$gone ]] || fail "llmman removal deletes its store, config and the files it wrote under its own name" "$gone" +done +pass "llmman removal deletes its store, config and the files it wrote under its own name" + +for kept in .codex/config.toml .gemini/config/skills .hermes/config.yaml; do + [[ -e $HOME/$kept ]] || fail "llmman removal keeps the agents' own state" "$kept" +done +pass "llmman removal keeps the agents' own state" + +grep -qx 'drop:llmman-bin' "$TEST_LOG" || fail "llmman removal drops the llmman-bin package" +pass "llmman removal drops the llmman-bin package" + +grep -qx "pkill:-TERM -f llmman serve" "$TEST_LOG" || fail "llmman removal stops the serve daemon before deleting its store" +pass "llmman removal stops the serve daemon before deleting its store" + +: >"$TEST_LOG" +if env -u HOME "$ROOT/bin/omarchy-remove-ai-llmman" >/dev/null 2>&1; then + fail "llmman removal refuses to run without HOME" +fi +[[ ! -s $TEST_LOG ]] || fail "llmman removal touches nothing without HOME" "$(<"$TEST_LOG")" +pass "llmman removal refuses to run without HOME" + +# A daemon that outlives the wait aborts the removal with the package and store +# intact. sleep is stubbed so the full wait does not run in the test. +mkdir -p "$HOME/.local/share/llmman" +printf '#!/bin/bash\n' >"$tmp_dir/bin/sleep" +chmod +x "$tmp_dir/bin/sleep" +: >"$TEST_LOG" +echo 999 >"$TEST_POLLS" +if "$ROOT/bin/omarchy-remove-ai-llmman" >/dev/null 2>&1; then + fail "llmman removal aborts while the serve daemon is still running" +fi +if grep -q '^drop:' "$TEST_LOG" || [[ ! -d $HOME/.local/share/llmman ]]; then + fail "llmman removal keeps the package and store while the serve daemon is still running" +fi +pass "llmman removal aborts while the serve daemon is still running" + +# One that exits while it is being waited on does not. +: >"$TEST_LOG" +echo 3 >"$TEST_POLLS" +"$ROOT/bin/omarchy-remove-ai-llmman" >/dev/null || fail "llmman removal proceeds once the serve daemon exits" +rm -f "$tmp_dir/bin/sleep" +grep -qx 'drop:llmman-bin' "$TEST_LOG" && [[ ! -e $HOME/.local/share/llmman ]] || + fail "llmman removal proceeds once the serve daemon exits" +pass "llmman removal proceeds once the serve daemon exits" + +# The command alone is also provided by a cargo or curl install that +# omarchy-pkg-drop will not touch, so the package is what the remover keys on. +llmman_row=$(grep '^ "remove.ai.llmman":' "$ROOT/default/omarchy/omarchy-menu.jsonc") +[[ $llmman_row == *'"when":"omarchy-pkg-present llmman-bin"'* ]] || + fail "llmman removal is offered only where the package is installed" "$llmman_row" +pass "llmman removal is offered only where the package is installed" + # OpenClaw's gateway unit and web app launcher are the app's own; the agent # state in ~/.openclaw is the user's. systemctl and openclaw are stubbed so the # sandbox never reaches the real user manager or a real gateway.