Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.2.0a2 — uninstall and route recovery

- Add `/sloth uninstall` previews and `/sloth uninstall confirm`, with terminal equivalents for Hermes and standalone services.
- Save the original Hermes model route during setup and restore it on disconnect; preserve unrelated settings and refuse to guess missing backups.
- Disable plugin startup, drain and stop verified owned processes, and keep existing backend servers and saved data.
- Document package removal, optional archive/build cleanup, and manual uninstall for older alphas.

## 0.2.0a1 — coordinated release updates

- Add `/sloth update check` and `/sloth update`, plus equivalent terminal commands.
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ sloth-memory saves a local model's conversation inference state to disk and rest
it when you return. Built for people running open-weight models on their own hardware.
MIT licensed. No cloud service or account. The portable runtime uses psutil.

**Alpha release `0.2.0a1`.** Supports Linux, macOS, and
**Alpha release `0.2.0a2`.** Supports Linux, macOS, and
Windows startup, automatic free-port selection, and routing adapters for llama.cpp,
Ollama, vLLM, and MLX-LM. Disk park/resume through this adapter still requires the
managed patched llama.cpp runtime and one slot. See [backend capabilities](docs/backends.md).
Download the [current alpha](https://github.com/uncrayon/sloth-memory/releases/tag/v0.2.0a1).
Download the [current alpha](https://github.com/uncrayon/sloth-memory/releases/tag/v0.2.0a2).
Existing users: follow the [update guide](docs/updates.md), including the one-time
proxy replacement for installations older than this release.
The service is independent of Hermes. A native Hermes adapter provides startup,
Expand All @@ -37,7 +37,7 @@ Your agent → sloth-memory (local proxy) → inference server
local archive files
```

## Install from main
## Install the latest alpha

Requirements: Linux, macOS, or Windows, Python 3.10+, and Git. Building the managed
llama.cpp runtime also needs CMake, a C/C++ toolchain, and your own supported GGUF
Expand All @@ -50,7 +50,7 @@ instead of creating the standalone environment below.
Standalone installation on macOS/Linux:

```bash
git clone --branch v0.2.0a1 https://github.com/uncrayon/sloth-memory.git
git clone --branch v0.2.0a2 https://github.com/uncrayon/sloth-memory.git
cd sloth-memory
python3 -m venv .venv
source .venv/bin/activate
Expand Down Expand Up @@ -112,6 +112,9 @@ For terminal use on any OS: `python -m sloth_memory update check` and

## Use with Hermes

Before trying the plugin, read [uninstall and return to your original backend](docs/uninstall.md).
It covers `/sloth uninstall`, package removal, and optional archive/build cleanup.

Install sloth-memory in Hermes' Python environment, enable it with
`hermes plugins enable sloth-memory`, and restart Hermes. Then run:

Expand Down
2 changes: 1 addition & 1 deletion docs/backends.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backends and operating systems

This describes alpha `0.2.0a1`. Older alpha.2 installations retain their original
This describes alpha `0.2.0a2`. Older alpha.2 installations retain their original
Linux-only scope until upgraded.

## Capability contract
Expand Down
2 changes: 1 addition & 1 deletion docs/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Runtime compatibility

This page describes alpha `0.2.0a1`. See [backends](backends.md) for routing
This page describes alpha `0.2.0a2`. See [backends](backends.md) for routing
capabilities. Older alpha.2 installations retain their original Linux-only scope.

## Runtime
Expand Down
10 changes: 7 additions & 3 deletions docs/hermes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hermes adapter and onboarding

These instructions install alpha `0.2.0a1`, including portable startup, automatic
These instructions install alpha `0.2.0a2`, including portable startup, automatic
port selection, and release updates. See [backend setup](backends.md) for capabilities.

The adapter ships inside sloth-memory as a native Hermes plugin. It uses plugin
Expand All @@ -13,7 +13,7 @@ Install into **the same Python environment that runs Hermes**:

```bash
# With your Hermes virtual environment activated:
git clone --branch v0.2.0a1 https://github.com/uncrayon/sloth-memory.git
git clone --branch v0.2.0a2 https://github.com/uncrayon/sloth-memory.git
cd sloth-memory
python -m pip install --upgrade .
hermes plugins enable sloth-memory
Expand All @@ -26,7 +26,7 @@ Use `hermes plugins list --plain --no-bundled` to check that it is enabled.
For an existing installation, follow [updates and recovery](updates.md). Versions
older than `0.2.0a1` need a one-time package installation and proxy replacement;
subsequent releases can use `/sloth update`. Run `sloth-memory --version` in
Hermes' environment to confirm `0.2.0a1`. Restart Hermes after installation to
Hermes' environment to confirm `0.2.0a2`. Restart Hermes after installation to
load the entry point. The adapter is tested against Hermes
0.21.0, upstream commit `9dd6634c5635321cf38840cc30e9b51226689128`.
Use Python 3.11–3.13 for Hermes; the standalone service also supports 3.10/3.14.
Expand Down Expand Up @@ -56,6 +56,10 @@ backend. Connecting an existing server in routing mode requires no build.

## Persistence and updates

To remove the integration and return to your original model server, see
[uninstall and recovery](uninstall.md). Existing servers and model weights are
kept. The guide also includes manual removal for older versions.

The installed package, plugin enablement, profile configuration, and saved slots
persist across a computer restart. When Hermes launches, the enabled plugin
starts its managed services if autostart is on. Starting Hermes itself at boot or
Expand Down
168 changes: 168 additions & 0 deletions docs/uninstall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Uninstall and return to your original backend

The automated commands below require **`0.2.0a2` or newer**. For `0.2.0a1`,
use `/sloth update` first or follow the manual procedure below.

Uninstall has two steps: disconnect the integration, then remove the package and
any files you no longer want. Disconnect first so Hermes does not keep calling a
proxy that has been removed. No sudo is required for the standard installation.

## What was installed?

| Component | Location / owner | Removal |
| --- | --- | --- |
| Python package and Hermes entry point | The Python environment used for installation | `python -m pip uninstall sloth-memory` |
| Enabled plugin and model route | Active Hermes profile's `config.yaml` | Automated disconnect restores the saved route and disables the plugin |
| Proxy and hourly cleanup loop | A Sloth Python process | Automated disconnect stops the verified archive-owned proxy |
| Managed llama.cpp backend, if selected | Process started by Sloth | Automated disconnect stops the verified archive-owned backend |
| Existing llama.cpp, Ollama, vLLM, or MLX server | Your existing installation | Kept running |
| Saved slots, logs, update backups and metadata | Configured archive directory | Kept until you explicitly remove that directory |
| Optional patched llama.cpp build | `runtime/` in the source checkout, or your `--output` directory | Remove this separate build directory when no longer used |
| Model weights and Hermes transcripts | Your original locations | Kept |

The adapter does not patch Hermes source. The build script patches an exported
copy of llama.cpp inside its output directory, including when `--source` points
to an existing checkout. It does not patch that original checkout or an existing
Gemma server. There is no system cron job to remove; cleanup runs inside the proxy.
Custom modifications made outside this repository's installer need their own
rollback procedure.

## Disconnect from Hermes

Finish active turns and close other clients sharing the proxy. For a shared bot,
restrict `/sloth` and `/sloth-memory` to administrators through Hermes' command
access controls. This operation changes the active profile's model route and
stops its owned services; it is not limited to the current chat.

Preview without changing anything:

```text
/sloth uninstall
```

Apply the preview:

```text
/sloth uninstall confirm
```

The command drains current inference, saves verified resident state in native
mode, restores the model fields saved before setup, disables the plugin and its
automatic startup, and stops its owned services. A failed drain/save aborts before
changing the profile. Process IDs and creation times are checked along with launch
arguments; unrelated processes are not terminated. A stale PID is not enough to
claim a process. There is no force-kill fallback.

An existing upstream server remains running. `--external` installations only
disconnect Hermes; their external proxy also remains under its service owner's
control. Use a separate archive per independent test stack. Other profiles sharing
an archive must be disconnected separately before removing the package or data.

Restart Hermes and **start a new conversation** afterward. Existing sessions may
retain the old proxy URL. The uninstall command does not rewrite stored sessions
or automatically restart the gateway.

Terminal equivalent, in the Python environment that runs Hermes:

```bash
python -m sloth_memory uninstall --hermes
python -m sloth_memory uninstall --hermes --confirm
```

These commands use the active Hermes profile (`HERMES_HOME` when set). They read
its archive setting, so do not add `--archive-dir`. They also work after stopping
the gateway, as long as the package and Hermes are still installed.

If setup predates route backups, or the model fields were edited afterward,
uninstall refuses to guess the previous connection. Run `hermes model` and select
your original backend first, then retry. If Hermes already points elsewhere, that
route is preserved. Unrelated profile settings are kept. Repeating disconnect is
safe; the disabled plugin's commands disappear after Hermes reloads its plugins.

## Remove the package and optional data

After disconnecting, close all Hermes processes using the installation (for a
gateway, `hermes gateway stop`). Activate that same Python environment, then run:

```bash
python -m pip uninstall sloth-memory
```

This removes Sloth's installed package, command launcher, and plugin entry point.
It keeps dependencies that Hermes or other packages may also use. Do not delete
Hermes' virtual environment. Restart the gateway if you want Hermes running again.
Discord and Telegram menus update when Hermes synchronizes its command catalog;
cached menus may take longer to reflect removal.

For a complete disk cleanup, remove these **only after all their services have
stopped**:

1. The exact archive directory printed by the preview. On a default Mac setup it
is `~/Library/Application Support/sloth-memory`; `--archive-dir`,
`SLOTH_ARCHIVE_DIR`, or `XDG_DATA_HOME` can change it. This deletes saved KV
snapshots, logs, and update rollback backups. Inspect a custom directory first;
it may contain other files you placed there.
2. The optional `runtime/` build directory, or the custom build output you chose.
Removing this isolated source/build tree removes its patched runtime. Do not
remove your pre-existing inference server installation.
3. The `sloth-memory` source checkout if you no longer need it. Check for your own
changes, downloaded weights, or other files before removing the directory.

Use Finder/Trash on macOS or your OS file manager to review these removals. The
chat command intentionally keeps them: paths can be shared or contain user data.
Model weights and conversation transcripts are not reconstructed by reinstalling
the plugin.

The disabled profile entry and original route backup remain for recovery. After
the package is removed, you may delete `plugins.entries.sloth-memory` and the
`sloth-memory` item from `plugins.disabled` in the active profile's `config.yaml`.
Preserve other entries. If you manually added `sloth` to Telegram's command-menu
priority list, remove that one item too. Remove any Sloth-only environment
variables you added to the profile or shell; preserve variables needed by other
services. Do not restore an entire old config file over newer unrelated settings.

## Standalone service

Restore your agent's original backend URL and stop other clients first. Then:

```bash
python -m sloth_memory uninstall --archive-dir "/absolute/path/to/archive"
python -m sloth_memory uninstall --archive-dir "/absolute/path/to/archive" --confirm
python -m pip uninstall sloth-memory
```

Standalone uninstall has no knowledge of an agent's configuration. It previews
and stops only the proxy and managed backend recorded in that archive. If a
supervisor outside Sloth starts them automatically, disable that supervisor first.
Services started with unrecognized launch arguments must be stopped through their
original terminal or service owner. Remove optional data/builds as described above.

## Manual procedure for 0.2.0a1

1. Finish active turns. If using native snapshots, `/sloth park` can save the
current conversation before shutdown.
2. Run `/sloth autostart off`, then `hermes plugins disable sloth-memory` in the
terminal. Autostart off alone does not stop an existing process.
3. Use `hermes model` to select your original server URL and served model ID.
Consult your pre-install profile backup if necessary. Do not select Sloth's
proxy address. Then stop the gateway (`hermes gateway stop`) and close other
interactive Hermes clients.
4. Stop the Sloth proxy using its original terminal (Ctrl-C), supervisor, or OS
process manager. For a detached process, `proxy.json` inside the archive records
its PID. Inspect the running process's command and start time before terminating
it; a stale manifest can refer to a reused PID. Its command should be
`python -m sloth_memory serve` with your archive path. A managed backend is
recorded in `runtime.json`; its command must match the stored `argv` including
`--slot-save-path`. Stop only that managed instance. Keep any server you were
already running before installing Sloth.
5. Remove the Python package and optional files using the preceding section.
Restart Hermes and start a new conversation to check the direct backend route.

## Reinstall after disconnecting

Install the desired Sloth version in Hermes' environment, enable it again with
`hermes plugins enable sloth-memory`, then restart Hermes. Run `/sloth setup` with
the backend arguments again (see [backend setup](backends.md)). Explicit setup
clears the saved uninstall flag and re-enables automatic startup. A bare
`/sloth setup` only shows instructions. Reuse an archive only when its model and
runtime are compatible, or select a new archive for the next backend test.
2 changes: 1 addition & 1 deletion docs/updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ package reinstall alone leaves their old proxy process running. To bootstrap:
2. Activate the Python environment that runs Hermes and install the release:

```bash
python -m pip install --upgrade https://github.com/uncrayon/sloth-memory/releases/download/v0.2.0a1/sloth_memory-0.2.0a1-py3-none-any.whl
python -m pip install --upgrade https://github.com/uncrayon/sloth-memory/releases/download/v0.2.0a2/sloth_memory-0.2.0a2-py3-none-any.whl
```

3. With all inference clients still stopped, save any resident state and stop
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sloth-memory"
version = "0.2.0a1"
version = "0.2.0a2"
description = "Let your local AI nap. Resume long conversations from saved inference state."
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion src/sloth_memory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Persistent inference state for local open-weight models."""

__version__ = "0.2.0a1"
__version__ = "0.2.0a2"
23 changes: 22 additions & 1 deletion src/sloth_memory/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def main():
parser = argparse.ArgumentParser(description="Let your local AI nap. Save its work for later.")
parser.add_argument("--version", action="version", version=__version__)
sub = parser.add_subparsers(dest="command", required=True)
uninstall = sub.add_parser("uninstall", help="preview or disconnect services; keep packages and data until explicitly removed")
uninstall.add_argument("--confirm", action="store_true", help="apply the uninstall after previewing")
uninstall.add_argument("--hermes", action="store_true", help="restore routing and disable the plugin in the active Hermes profile")
uninstall.add_argument("--archive-dir", help="standalone archive; --hermes reads the profile's archive setting")
update = sub.add_parser("update", help="check or install an official release, retaining rollback files")
update.add_argument("action", nargs="?", choices=("check",))
update.add_argument("--archive-dir")
Expand Down Expand Up @@ -65,7 +69,24 @@ def main():
cmd.add_argument("--cleanup", action=argparse.BooleanOptionalAction, default=None)
args = parser.parse_args()
try:
if args.command == "update":
if args.command == "uninstall":
if args.hermes:
if args.archive_dir:
parser.error("--hermes uses its profile's archive; do not pass --archive-dir")
try:
from .hermes_uninstall import run
print(run(confirm=args.confirm))
except ImportError as exc:
raise RuntimeError("activate Hermes' Python environment to use --hermes") from exc
else:
from . import removal
archive = directory(args.archive_dir)
result = removal.stop(archive) if args.confirm else removal.plan(archive)
print(json.dumps({"applied": args.confirm, "archive_dir": str(archive),
"proxy_pid": result["proxy"]["pid"] if result["proxy"] else None,
"backend_pid": result["backend"]["pid"] if result["backend"] else None,
"note": "Packages, snapshots, weights and builds are kept. Restore agent routes and stop other clients before --confirm."}, indent=2))
elif args.command == "update":
from . import updates
archive = directory(args.archive_dir)
result = updates.check(archive) if args.action == "check" else updates.apply(archive)
Expand Down
Loading
Loading