Metadata-Version: 2.5
Name: memory-cli
Version: 0.2.1
Summary: The memory engine: the `mem` command and its background entries
Project-URL: Repository, https://github.com/Mili-ssm/memory-cli
Author: Mili-ssm
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Python: <3.16,>=3.12
Requires-Dist: pyyaml
Description-Content-Type: text/markdown

# memory-cli

[![CI](https://github.com/Mili-ssm/memory-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Mili-ssm/memory-cli/actions/workflows/ci.yml)

The `mem` memory engine: a store of notes and lessons you search, curate and keep in git, plus the background commands that
settle, capture, corroborate, integrate, research and synthesize it. It is the engine of the
[Agent-Skills](https://github.com/Mili-ssm/Agent-Skills) `memory` plugin for Claude Code and Codex, and works from a terminal on its own.

## Status

Alpha (`0.1.0`), on [PyPI](https://pypi.org/project/memory-cli/). The Agent-Skills memory plugin still bundles its own frozen copy of
this engine until it switches to this package.

## Requirements

| Need | Detail |
|---|---|
| [uv](https://docs.astral.sh/uv/) | installs the commands in an isolated environment |
| Python | 3.12 to 3.15 |
| OS | Linux or macOS (Windows is not supported yet) |
| git | the store keeps its history in git |

## Install

| From | Command |
|---|---|
| PyPI | `uv tool install memory-cli` |
| A checkout | `uv tool install .` |

If `uv tool install` refuses because `~/.local/bin/mem*` already exists, those files are launchers an older plugin wrote.
Remove them (files with another second line are kept) and install again:

```
uvx --from memory-cli mem install-command --remove && uv tool install memory-cli
```

## Commands

| Command | Does |
|---|---|
| `mem` | memory engine: search and read a store of notes, and write, curate and check it |
| `mem-auto` | one bounded curation run in the background |
| `mem-capture` | memory capture from session transcripts: `run`, `auto`, `sweep`, `exclude`, `ack` |
| `mem-corroborate` | a background pass that matches lessons by meaning and keeps one general record of each |
| `mem-integrate` | joins loose knowledge notes to the parts of syntheses with two cheap read-only sessions each |
| `mem-research` | answer a question from memory, then (by depth) check notes and the question against the web |
| `mem-settle` | one bounded settling run in the background |
| `mem-synthesize` | write syntheses for topics that have none, quietly, one headless session per step |

`<command> --help` lists the options. The background commands run a headless `claude` or `codex` session (`--runner`).

## Use from a host plugin

A plugin adapter starts the installed CLI and can pin what it needs:

| Variable or command | Meaning |
|---|---|
| `mem protocol` | one JSON line `{"version": "0.2.0", "protocols": [1]}`; no store access, no writes; 0.1.0 lacks it |
| `MEM_REQUIRE_PROTOCOL=N` | every entry point exits 78 with one stderr line unless it speaks revision N; unset or empty skips the check |
| `MEM_PLUGIN_ROOT=DIR` | the plugin folder (must hold `hooks/`) for the synthesize skill, diagnostics and hooks; else the source tree, else the folder in `<state dir>/plugin-root` |

## Development

```sh
uv sync --group dev                       # pinned Ruff and basedpyright, pytest
uv tool install pre-commit && pre-commit install   # once per clone: commit checks lint and types, push runs the suite
uv run pytest tests -q -n auto            # full suite; `-m "not slow"` skips the tests that spawn processes
uv run ruff check . && uv run ruff format --check .
uv run basedpyright
uv build                                  # sdist, then the wheel from it
```

The repository carries its own tool configuration (`ruff.toml`, `pyrightconfig.json`, `tests/pytest.ini`, `.pre-commit-config.yaml`), so it works the same nested in an Agent-Skills checkout or on its own. The package is flat (`memory_cli/` at the root) so a fix ports one to one between this repository and the plugin's copy.

## Release

Maintainers. The workflow `.github/workflows/release.yml` builds once, tests that wheel on Linux and macOS, rehearses an
install, and publishes through PyPI Trusted Publishing (environments `pypi` and `testpypi`; no tokens).

1. Rehearse: set `version` in `pyproject.toml` to a pre-release (`X.Y.ZrcN` or `X.Y.Z.devN`; an index accepts a version
   only once), merge to `main`, then run the workflow from `main` with `workflow_dispatch` (`target: testpypi`).
2. Release: set `version` to `X.Y.Z` and the `CHANGELOG.md` heading to `## [X.Y.Z] - YYYY-MM-DD`; merge to `main`.
3. Tag `vX.Y.Z` on that `main` commit (it must equal the `pyproject.toml` version) and push the tag. After the tests the
   `publish-pypi` job waits for the owner's approval of the `pypi` environment, then publishes. PyPI is reachable only
   from a `v*` tag.

A pull request that touches the workflow, `pyproject.toml` or `tests/packaging/` runs everything except publishing.

## License

MIT, see [LICENSE](LICENSE).
