anywhere-claude-mem
bleed00/anywhere-claude-mem
A DeepSeek Harness plugin that turns the anywhere-claude-mem git sync into a DSH peer: pull cross-machine memory at session start and push new prompts/observations as they land in the claude-mem worker
Install
dsh plugin --profile web add github:bleed00/anywhere-claude-memREADME
Anywhere-claude-mem
Two-way synchronization of claude-mem memory across multiple OpenCode and DeepSeek Harness installations, on Linux and Windows.
OpenCode / DeepSeek Harness -> claude-mem worker -> Anywhere-claude-mem Python CLI -> private Git data repository
Each machine exports its local claude-mem memory to a private Git repository and imports the merged memory of the other machines. The sync core is pure Python; only the service integration, config paths, launchers, process handling, and the startup-pull trigger differ per OS or per coding tool.
Both platforms write into the same claude-mem worker, so the automatic
watcher recognizes OpenCode and DeepSeek Harness observations alike. Only who
runs anywhere-claude-mem startup-pull when the tool starts changes with the platform
selected during install: an OpenCode plugin, or a DeepSeek Harness plugin.
Quick install
Run the installer from the wrapper directory. It asks a few questions, clones (or attaches) your private data repository, and sets up the automatic watcher.
Linux:
git clone https://github.com/Bleed00/Anywhere-claude-mem.git
cd Anywhere-claude-mem
python3 -m anywhere_claude_mem install
Windows (PowerShell):
git clone https://github.com/Bleed00/Anywhere-claude-mem.git
cd Anywhere-claude-mem
pip install -e .
python -m anywhere_claude_mem install
On Windows the
anywhere-claude-mem,anywhere-pushandanywhere-pullcommands come frompip install -e .; on Linux the installer writes them to~/.local/bin.
The terminal UI differs by platform: Windows uses
richandquestionary(installed bypip install -e .); Linux uses a zero-dependency ANSI UI, so no pip package or virtual environment is needed there.
The install command is interactive:
- asks which platform to set up — OpenCode or DeepSeek Harness;
- verifies Git, Python,
curl, the chosen tool (OpenCode + the claude-mem plugin, or DeepSeek Harness + a DSH profile), and a running worker; - offers to create a new private data repository (requires
gh) or attach an existing one (always available); - clones the data repository into
data/; - asks whether automatic synchronization should be enabled (and its thresholds);
- asks whether to pull memory when the chosen tool starts (startup pull);
- installs the watcher service and the startup-pull trigger for the platform
you chose (an OpenCode plugin, or the
dsh-anywhere-claude-memDeepSeek Harness bundle).
When the installer finishes you can start using it immediately:
anywhere-claude-mem push # export local memory to the data repository
anywhere-claude-mem pull # import the data repository into the local worker
anywhere-claude-mem status # show sync and service state
Choosing a platform
During install you pick opencode or deepseek. The choice changes only the startup-pull trigger:
- opencode writes and registers the
anywhere-claude-mem.jsOpenCode startup plugin (the historical behavior); - deepseek installs the
@bleed00/dsh-anywhere-claude-membundle into a DeepSeek Harness profile, which pulls the data repository at session start and pushes new memory back on "put" events.
Everything else — the git sync, the merge rules, the automatic watcher — is identical regardless of platform. The watcher's push trigger already reads claude-mem's own rows, so OpenCode and DeepSeek Harness observations are pushed the same way by the same code.
Prerequisites
Install these before running the installer (which ones are required depends on the platform you select):
- OpenCode — for the
opencodeplatform - claude-mem installed and configured as an OpenCode plugin (for the
opencodeplatform) - DeepSeek Harness (
dshonPATHwith at least one profile) — for thedeepseekplatform - a running claude-mem worker
- Python 3.10 or newer
- Git
curl- GitHub CLI (
gh) — optional; only needed to create a new data repository. Without it you can still attach an existing one. - a private GitHub data repository (or permission to create one)
Install OpenCode and claude-mem
For the opencode platform:
opencode --version # verify OpenCode
npx -y @thedotmack/claude-mem install --ide opencode # install claude-mem
Install DeepSeek Harness
For the deepseek platform, install DeepSeek Harness and create a profile:
npx -y @deepseek-ai/dsh web # or `dsh plugin init <profile>` for a CLI profile
dsh plugin --profile <profile> add @deepseek-ai/dsh-base
The anywhere-claude-mem installer mounts @bleed00/dsh-anywhere-claude-mem into the profile you
choose; the claude-mem worker still must be running.
Configure the worker, for example with OpenRouter. Save as
~/.claude-mem/settings.json:
{
"CLAUDE_MEM_RUNTIME": "worker",
"CLAUDE_MEM_PROVIDER": "openrouter",
"CLAUDE_MEM_OPENROUTER_MODEL": "poolside/laguna-xs-2.1:free",
"CLAUDE_MEM_OPENROUTER_API_KEY": "YOUR_API_KEY"
}
Protect it and start the worker:
chmod 600 ~/.claude-mem/settings.json
npx claude-mem start
npx claude-mem status
Install GitHub CLI
Used only to create a new data repository. Skip this if you will attach an existing repository.
# Arch / CachyOS
sudo pacman -S github-cli
# Debian / Ubuntu
sudo apt install gh
# Fedora
sudo dnf install gh
# Windows
winget install GitHub.cli
Then authenticate:
gh auth login
Choose GitHub.com, HTTPS, and browser authentication.
Usage
Manual synchronization
Export the local memory to the private data repository:
anywhere-claude-mem push
anywhere-push # alias
Import the data repository into the local worker:
anywhere-claude-mem pull
anywhere-pull # alias
Both operations are idempotent: re-running a pull never creates duplicate records, and a push with nothing new produces no commit.
Run the first full export explicitly right after installing, so the accumulated memory is available on every machine:
anywhere-claude-mem push
Status
anywhere-claude-mem status
Shows whether the worker is reachable, the state of the local data repository, the automatic-sync configuration, and the watcher service status.
Automatic synchronization
During installation, enable automatic sync and configure:
- observations per push (e.g.
1,10,30); - polling interval in seconds;
- debounce interval in seconds.
The watcher starts from a baseline of the observations already present, so
installing never pushes the whole database unexpectedly. After the first manual
anywhere-claude-mem push, the watcher pushes automatically once the configured number of
new observations is reached. A failed push is retried at the next polling
cycle.
The watcher is installed per platform:
- Linux: a
systemd --userservice (anywhere-claude-mem-watch.service) with restart on failure. - Windows: a per-user registry Run key that launches the watcher hidden
at logon via
pythonw.exe. It uses no elevated APIs, so it works on accounts where Task Scheduler registration is blocked; as a trade-off it does not auto-restart on crash (it starts again at the next logon). Output is appended to%APPDATA%\anywhere-claude-mem\watch.log.
The installer also registers a startup-pull trigger for the platform you chose.
For opencode that is an OpenCode startup plugin that runs
anywhere-claude-mem startup-pull whenever OpenCode starts; for deepseek it is the
@bleed00/dsh-anywhere-claude-mem bundle in the selected DSH profile, which pulls at
session start and pushes new memory back on "put" events. Both run with retries
while the worker is still starting and do not modify the claude-mem plugin.
Useful commands:
anywhere-claude-mem status # overall state incl. service
anywhere-claude-mem service status # watcher service state
anywhere-claude-mem service remove # stop and remove the watcher service
anywhere-claude-mem watch # run the watcher in the foreground
anywhere-claude-mem startup-pull # test the startup pull manually
systemctl --user status anywhere-claude-mem-watch.service # Linux service state
journalctl --user -u anywhere-claude-mem-watch.service -f # Linux watcher logs
Get-Content "$env:APPDATA\anywhere-claude-mem\watch.log" -Tail 20 # Windows watcher log
Uninstall
anywhere-claude-mem uninstall # remove service, launchers, startup trigger and config
anywhere-claude-mem reinstall # uninstall and run the installer again
uninstall removes whichever startup trigger this install registered: the
OpenCode plugin, or the @bleed00/dsh-anywhere-claude-mem bundle from the saved DSH
profile.
Data model and merge safety
The data repository contains:
sessions.json
observations.json
summaries.json
prompts.json
Records are merged using stable cross-device keys instead of local SQLite numeric IDs:
- sessions: platform plus content session ID;
- observations: memory session, title, and creation timestamp;
- summaries: memory session ID;
- prompts: platform, content session ID, and prompt number.
The first push exports the complete local knowledge base. Later pushes preserve the complete accumulated data while Git stores only the differences in each commit. Deletions and edits are propagated through tombstones so every machine converges on the same state.
Configuration
The local Anywhere-claude-mem configuration is stored at:
~/.config/anywhere-claude-mem/config.json # Linux
%APPDATA%\anywhere-claude-mem\config.json # Windows
It contains local paths, the data repository URL, the selected platform
(opencode or deepseek), the chosen DSH profile (dsh_profile, when deepseek),
and automatic-sync settings. It does not contain API keys.
Watcher state is stored separately at:
~/.config/anywhere-claude-mem/watch-state.json # Linux
%APPDATA%\anywhere-claude-mem\watch-state.json # Windows
Security
- Keep the data repository private. It contains prompts, observations, and summaries from your sessions.
- Never commit
~/.claude-mem/settings.jsonor API keys. - Use
chmod 600 ~/.claude-mem/settings.json(Linux). - The wrapper repository is safe to publish only after its Git history has been audited and no personal data has ever been committed.
Development
On Linux the CLI runs from the wrapper with no installation:
python3 -m anywhere_claude_mem --help
python3 -m unittest discover tests
On Windows, install the package (editable) to get the anywhere-claude-mem,
anywhere-push and anywhere-pull commands and the rich/questionary UI:
pip install -e .
anywhere-claude-mem install bootstraps this automatically on Windows when the commands
or the UI dependencies are missing.
The runtime uses the Python standard library, plus rich and questionary
for the Windows terminal UI (Linux uses a zero-dependency ANSI UI), and the
system git and gh commands.
Platform-specific pieces
The sync core (data.py, sync.py, git.py, watcher.py, the worker HTTP
client) is platform-independent. Only these pieces differ per OS or per coding
tool:
service.pydispatches toservice_linux.py(systemd user services) orservice_windows.py(logon autostart via the per-user Run key).config.pyresolves~/.config/anywhere-claude-memon POSIX and%APPDATA%\anywhere-claude-memon Windows, and skipschmodon Windows.lock.pychecks process liveness withos.kill(pid, 0)on POSIX andOpenProcess/GetExitCodeProcesson Windows.worker.pydiscovers the claude-mem worker port fromworker.pid/supervisor.json, then env/settings, then a health probe; it never relies on a uid that does not exist on Windows.ui.pydispatches toui_rich.py(rich + questionary, Windows) orui_ansi.py(zero-dependency ANSI, Linux).cli.pygenerates POSIX symlink launchers or relies on pip console scripts on Windows, and hides console windows for background subprocesses.deepseek.pydiscovers DSH profiles under$DSH_HOME/profilesand mounts (or removes) the@bleed00/dsh-anywhere-claude-membundle viadsh plugin.git.pyandcli.pyrun background subprocesses withCREATE_NO_WINDOWon Windows so no console window flashes.
The data format and worker API are platform- and tool-independent.
DeepSeek Harness plugin
The dsh-plugin/ directory is a self-contained, installable DeepSeek Harness
bundle (@bleed00/dsh-anywhere-claude-mem). It makes DSH a full peer of the sync: on
agent/session-start it runs anywhere-claude-mem startup-pull (the same command the
OpenCode plugin runs), and as prompts/tool results land in the claude-mem worker
it pushes the new memory back to git through a debounced, fire-and-forget
anywhere-claude-mem push.
It never touches the worker API or SQLite — it only shells out to the anywhere-claude-mem
CLI. Because anywhere-claude-mem push is idempotent and serialized by anywhere-claude-mem's
SyncLock, the automatic watcher can stay active as an independent fallback
without conflict.
cd dsh-plugin
pnpm install --config.auto-install-peers=false
pnpm run build # tsc + tsdown → lib/index.js
pnpm test
License
MIT - see LICENSE.