Skip to main content

memorysync-cli (Python)

MemorySync from your terminal. Zero dependencies.

The same CLI as the npm package memorysync-cli, implemented in Python. Same 21 commands, same flags, same output formats, same exit codes. The two are interchangeable, so you only need one.

pipx install memorysync-cli

pipx is recommended because this is an application rather than a library. pip install works too, but outside a virtual environment it fails on externally-managed Pythons — Homebrew and most Linux distributions — with externally-managed-environment (PEP 668).

Requires Python 3.9 or newer.

Getting started

memorysync init                       # store a key, pick a default user
memorysync add "Prefers pnpm" --user alice
memorysync search "package manager" --user alice
memorysync quota                      # how much of the plan is left

Both memorysync and msync are installed; msync is just shorter.

Parity is enforced, not promised

Both CLIs read one generated command tree, so help --json is byte-identical between them. The test suite runs both and compares stdout for every offline command, including all four completion scripts, and compares exit codes for each failure mode. A command added to one and not the other fails the build.

That matters because the alternative does not hold. Mem0 ships a Node and a Python CLI and documents them as identical; their Python CLI answers help --json with twelve commands while their Node CLI answers with a name, a version and a description and no commands at all, and the two sit on different versions.

Zero dependencies

argparse, urllib.request and json cover everything. Mem0's Python CLI depends on httpx, rich and typer.

Every dependency is code on a customer's machine that they cannot audit on our behalf, which matters more for a closed-source tool because nobody else is reading our lockfile. A table and eight colours do not justify it.

Agent mode

Pass --json (or --agent) before the command for one JSON envelope, no colour, no spinners, errors as JSON with a non-zero exit:

memorysync --json search "preferences" --user alice

data is always a list, for every command. An agent parses one shape rather than remembering which commands return an object.

memorysync help --json     # the whole command tree, for self-discovery

Exit codes

A script can branch on the cause rather than parsing prose.

Code Meaning
0 Success
1 Unclassified failure
2 Usage: unknown command, bad flag, bad value
3 Auth: missing, expired or revoked credentials
4 Quota: a plan limit is reached
5 Network: unreachable or timed out
6 Not found
130 Interrupted

Code 4 earns its place. Over a plan limit the API returns success with an empty result rather than an error, deliberately, so an assistant never narrates billing state to an end user. From a terminal that silence is unhelpful, so the CLI reads usage and turns it into a distinct code — otherwise an exhausted plan is indistinguishable from an empty database.

Where your key is stored

Never in the config file. In order: MEMORYSYNC_API_KEY, then the OS keychain, then an owner-only encrypted file.

Platform Storage
macOS Keychain, via security
Linux Keyring, via secret-tool, when libsecret is present
Windows Owner-only encrypted file

Windows has no scriptable Credential Manager path that avoids a dependency, so it uses the file tier. That is the same on the Node CLI. The file is 0600 and its contents are tied to the machine and user, which stops a casual cat or a backup scraper; anyone who can already run code as you can read it. The keychain is better, which is why it is tried first.

Deleting

delete is two-step by default: without --yes it previews and changes nothing.

delete --all clears that one end user's memories and nothing else. No form of any command can delete an account, a project or an API key.

To clear every memory for an end user through the API directly, use a wide filter on DELETE /memory/forget, for example {"before": "<now>"}. Not /memory/user/purge: despite its path it is not end-user scoped and erases the account behind the credential.

Environment variables

Variable Purpose
MEMORYSYNC_API_KEY Key, highest priority
MEMORYSYNC_BASE_URL API base URL
MEMORYSYNC_USER Default end user
MEMORYSYNC_PROJECT Default project
MEMORYSYNC_PROFILE Named profile
MEMORYSYNC_OUTPUT Default output format
MEMORYSYNC_CONFIG_DIR Where config and credentials live
NO_COLOR Disable colour

Documentation

https://docs.memorysync.io/cli

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memorysync_cli-1.0.2.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memorysync_cli-1.0.2-py3-none-any.whl (52.8 kB view details)

Uploaded Python 3

File details

Details for the file memorysync_cli-1.0.2.tar.gz.

File metadata

  • Download URL: memorysync_cli-1.0.2.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.5

File hashes

Hashes for memorysync_cli-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8955ef07484dd6c51c719a4478687e5e5a8889e0c8af6fa0f1be262d4731ef3f
MD5 c50fc4c53dfd4f82e576f6969654735a
BLAKE2b-256 018ab9604cdf7b3e4c062e400c786bdb3436f549da52aef076a80bbfe423633b

See more details on using hashes here.

File details

Details for the file memorysync_cli-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: memorysync_cli-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 52.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.5

File hashes

Hashes for memorysync_cli-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2767e4c237e01970b43b93fa6033dee9b8688249310ed8a78977baa92f9dac8d
MD5 a3abce3d06333c1ddc9de8e011987087
BLAKE2b-256 8fd75e81cda6c307515fc8f9e0cca4524d32a5ae5f79dab4ffefb070e181d314

See more details on using hashes here.

Release history Release notifications | RSS feed

1.6.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.3

2 files

This release

1.0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page