memory-cli 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,8 @@ Modules:
11
11
  `memory`: `remember`, `confirm` (and `observe`), `refute`, `forget`, `triage`, `supersede`, `merge`, `distinct`, `restore`, `promote`, `memories`, `rules`, `memory` (edit) and `settle`
12
12
  `curate`: `curate`, and the session-start curation decisions (passes, marks, pair and note queues)
13
13
  `hooks`: `session-index`, `compact-log` and `signal`, with the session start text and the logic only they use
14
- `diagnostics`: read-only report of local plugin, store, roles and hooks
15
- `install`: `install-command`, which puts a `mem` launcher on PATH, and the plugin-root record the launcher follows
14
+ `diagnostics`: `diagnostics` (read-only report of local plugin, store, roles and hooks) and `protocol` (version and protocol revisions a host plugin probes)
15
+ `install`: `install-command --remove` (removes the launchers an older plugin wrote) and the plugin-root record they followed
16
16
  `synthesis`: `synthesis` (list, new, add, append, edit, attach, rename, remove, detach, topics, refs) and `project-synthesis`, with the logic only they use
17
17
  `split`: CLI for split proposals, preview, apply, status, recovery and undo
18
18
  `split_plan`: read-only synthesis split proposals and previews
@@ -1,4 +1,5 @@
1
- """Read-only report of local memory configuration and observed hook delivery."""
1
+ """Read-only reports: local memory configuration and observed hook delivery (`diagnostics`), and the version and
2
+ protocol revisions a host plugin probes (`protocol`, no store access)."""
2
3
 
3
4
  from __future__ import annotations
4
5
 
@@ -8,10 +9,13 @@ import shutil
8
9
  from collections import deque
9
10
  from datetime import datetime
10
11
  from pathlib import Path
11
- from typing import Any
12
+ from typing import TYPE_CHECKING, Any
12
13
 
13
14
  from memory_cli.commands import common
14
- from memory_cli.core import config, resources, runner
15
+ from memory_cli.core import config, protocol, resources, runner
16
+
17
+ if TYPE_CHECKING:
18
+ import argparse
15
19
 
16
20
  PLUGIN = resources.plugin_root() # None when the engine runs outside the plugin
17
21
  ROLES = (
@@ -114,7 +118,17 @@ def cmd_diagnostics(args: Any) -> int:
114
118
  return 0
115
119
 
116
120
 
121
+ def cmd_protocol(_args: argparse.Namespace) -> int:
122
+ print(
123
+ json.dumps({"version": protocol.package_version(), "protocols": list(protocol.PROTOCOLS)})
124
+ )
125
+ return 0
126
+
127
+
117
128
  def add_parser(sub: Any) -> None:
129
+ sub.add_parser(
130
+ "protocol", help="print the memory-cli version and the protocols it speaks as JSON"
131
+ ).set_defaults(func=cmd_protocol)
118
132
  parser = sub.add_parser(
119
133
  "diagnostics", help="report local host configuration and observed hook delivery"
120
134
  )
@@ -537,8 +537,7 @@ def cmd_session_index(args: argparse.Namespace) -> int:
537
537
  if _host() == "codex" and install.launcher_missing():
538
538
  mem = shlex.quote(resources.shell_mem())
539
539
  text += f"\nmemory: mem is not installed as a command; run it as {mem}"
540
- if resources.plugin_root() is not None: # only a plugin copy can install its launchers
541
- text += f", or install it once: {mem} install-command"
540
+ text += ", or install the CLI once: uv tool install memory-cli"
542
541
  print(text)
543
542
  if args.hook:
544
543
  source = data.get("source")
@@ -1,14 +1,12 @@
1
- """`mem install-command` (ADR 0036): put `mem` (and `mem-research`, `mem-synthesize`) on PATH for every tool, and the plugin-root record it follows.
1
+ """`mem install-command --remove` and the plugin-root record (ADR 0036).
2
2
 
3
- The plugin lives in a versioned cache folder that moves with every update, so the launcher does not embed one path:
4
- it reads `<state dir>/plugin-root`, which each session start refreshes (`record_root`), and falls back to the root
5
- that ran `install-command`."""
3
+ `install-command` no longer creates launchers: the CLI is installed with `uv tool install memory-cli`. `--remove` still
4
+ deletes the launchers an older plugin wrote (only files that carry `MARKER`). `record_root` keeps the plugin-root
5
+ record the old launchers followed, until a plugin adapter stops refreshing it."""
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import contextlib
10
- import os
11
- import shlex
12
10
  import shutil
13
11
  import sys
14
12
  from pathlib import Path
@@ -20,32 +18,10 @@ if TYPE_CHECKING:
20
18
  import argparse
21
19
 
22
20
  MARKER = "# agent-memory launcher (mem install-command)"
23
- RECORD_NAME = "plugin-root"
24
- _EXEC_MODE = 0o755
25
- # Commands the Codex roles and skills call by name; each launcher runs the plugin's `bin/<name>`.
21
+ RECORD_NAME = resources.PLUGIN_RECORD
22
+ # The launchers an older plugin wrote.
26
23
  LAUNCHERS = ("mem", "mem-research", "mem-synthesize")
27
24
 
28
- # Bash twin of `jobs.state_dir()`: MEM_DATA, else $XDG_STATE_HOME/agent-memory (default ~/.local/state); empty is unset.
29
- _LAUNCHER = """#!/usr/bin/env bash
30
- {marker}
31
- if [ -n "${{MEM_DATA:-}}" ]; then d="$MEM_DATA"; else d="${{XDG_STATE_HOME:-$HOME/.local/state}}/agent-memory"; fi
32
- rec=""
33
- [ -r "$d/{record}" ] && IFS= read -r rec < "$d/{record}"
34
- rec="${{rec%$'\\r'}}"
35
- emb={embedded}
36
- marker={marker_q}
37
- for cand in "$rec" "$emb"; do
38
- [ -n "$cand" ] && [ -x "$cand/bin/{name}" ] || continue
39
- [ "$cand/bin/{name}" -ef "$0" ] && continue
40
- line=""
41
- {{ IFS= read -r line; IFS= read -r line; }} < "$cand/bin/{name}" 2>/dev/null
42
- [ "$line" = "$marker" ] && continue
43
- exec "$cand/bin/{name}" "$@"
44
- done
45
- printf '{name}: no plugin copy found; start a Claude Code or Codex session once, or reinstall with %s/bin/mem install-command\n' "$emb" >&2
46
- exit 127
47
- """
48
-
49
25
 
50
26
  def default_bin_dir() -> Path:
51
27
  return Path.home() / ".local" / "bin"
@@ -77,16 +53,6 @@ def record_root() -> None:
77
53
  _write_record()
78
54
 
79
55
 
80
- def launcher_text(root: Path, name: str = "mem") -> str:
81
- return _LAUNCHER.format(
82
- name=name,
83
- marker=MARKER,
84
- marker_q=shlex.quote(MARKER),
85
- record=RECORD_NAME,
86
- embedded=shlex.quote(str(root)),
87
- )
88
-
89
-
90
56
  def _is_ours(path: Path) -> bool:
91
57
  try:
92
58
  if path.is_symlink():
@@ -97,9 +63,9 @@ def _is_ours(path: Path) -> bool:
97
63
  return len(lines) > 1 and lines[1] == MARKER
98
64
 
99
65
 
100
- def _one(bin_dir: Path, name: str, remove: bool, root: Path | None) -> int:
101
- """Install (pointing at `root`, the plugin folder) or remove the launcher `name`; a file that is not ours stays
102
- untouched (returns 1)."""
66
+ def _remove_one(bin_dir: Path, name: str) -> bool:
67
+ """Delete the launcher `name` when it is ours; a file that is not ours stays, with a note on stderr.
68
+ False when the removal failed."""
103
69
  target = bin_dir / name
104
70
  exists = target.exists() or target.is_symlink()
105
71
  if exists and not _is_ours(target):
@@ -107,46 +73,38 @@ def _one(bin_dir: Path, name: str, remove: bool, root: Path | None) -> int:
107
73
  f"mem: {target} exists and is not an agent-memory launcher; left untouched",
108
74
  file=sys.stderr,
109
75
  )
110
- return 1
111
- if remove:
76
+ return True
77
+ try:
112
78
  if exists:
113
79
  target.unlink()
114
- print(f"removed {target}" if exists else f"nothing to remove at {target}")
115
- return 0
116
- assert root is not None # cmd_install_command refuses an install without the plugin
117
- bin_dir.mkdir(parents=True, exist_ok=True)
118
- safe_io.replace_file(target, launcher_text(root, name).encode(), _EXEC_MODE)
119
- print(f"installed {target}")
120
- return 0
121
-
122
-
123
- def _warn_off_path(bin_dir: Path) -> None:
124
- on_path = str(bin_dir.resolve()) in {
125
- str(Path(p).resolve()) for p in os.environ.get("PATH", "").split(os.pathsep) if p
126
- }
127
- if not on_path:
128
- print(f"warning: {bin_dir} is not on PATH; add it so `mem` resolves", file=sys.stderr)
80
+ except OSError as exc:
81
+ print(f"mem: could not remove {target}: {exc.strerror or exc}", file=sys.stderr)
82
+ return False
83
+ print(f"removed {target}" if exists else f"nothing to remove at {target}")
84
+ return True
129
85
 
130
86
 
131
87
  def cmd_install_command(args: argparse.Namespace) -> int:
132
- root = resources.plugin_root()
133
- if not args.remove and (root is None or not (root / "bin").is_dir()):
134
- print("mem: install-command requires the plugin launchers", file=sys.stderr)
88
+ if not args.remove:
89
+ print(
90
+ "mem: install-command no longer creates launchers; install the CLI with: uv tool install memory-cli",
91
+ file=sys.stderr,
92
+ )
135
93
  return 2
136
94
  bin_dir = Path(args.bin_dir).expanduser() if args.bin_dir else default_bin_dir()
137
- failed = sum(_one(bin_dir, name, args.remove, root) for name in LAUNCHERS)
138
- if not args.remove:
139
- _warn_off_path(bin_dir)
140
- return 1 if failed else 0
95
+ results = [_remove_one(bin_dir, name) for name in LAUNCHERS] # every launcher is tried
96
+ return 0 if all(results) else 1
141
97
 
142
98
 
143
99
  def add_parser(sub: Any) -> None:
144
100
  cmd = sub.add_parser(
145
101
  "install-command",
146
- help="install `mem`, `mem-research` and `mem-synthesize` as commands on PATH (launchers that follow the plugin)",
102
+ help="no longer installs launchers (use `uv tool install memory-cli`); with --remove, delete the ones an older plugin wrote",
103
+ )
104
+ cmd.add_argument(
105
+ "--remove", action="store_true", help="delete the launchers an older plugin wrote"
147
106
  )
148
107
  cmd.add_argument(
149
- "--remove", action="store_true", help="delete the launchers this command wrote"
108
+ "--bin-dir", metavar="DIR", help="where the launchers are (default: ~/.local/bin)"
150
109
  )
151
- cmd.add_argument("--bin-dir", metavar="DIR", help="where to put it (default: ~/.local/bin)")
152
110
  cmd.set_defaults(func=cmd_install_command)
@@ -3,6 +3,7 @@
3
3
  `auto_state`: `mem-auto` state, run lock, failure line
4
4
  `config`: store resolution for every entry point
5
5
  `headless`: spec and runner of `claude -p` sessions
6
+ `protocol`: the protocol revisions a host plugin may require (`MEM_REQUIRE_PROTOCOL`) and the check that refuses an unsupported one
6
7
  `resources`: package data, the plugin folder when there is one, and the command that starts a child entry point
7
8
  `runner`: the `claude` or `codex` runner of a pass: resolution, Codex argv and environment, one `Outcome`
8
9
  `codex_pass`: one Codex session of a pass in the shape the builders read, the token cap, the refusal text
@@ -0,0 +1,54 @@
1
+ """The host contract a plugin adapter relies on: which command-surface revisions this `mem` speaks.
2
+
3
+ Revision 1 is introduced with memory-cli 0.2.0 (0.1.0 has no `mem protocol`, which is how an adapter rejects it). A plugin sets `MEM_REQUIRE_PROTOCOL=<N>` before it starts any
4
+ entry point; an entry that does not speak N refuses with exit 78 (EX_CONFIG) instead of failing in the middle of a command.
5
+ """
6
+
7
+ import os
8
+ import sys
9
+
10
+ PROTOCOLS = (1,)
11
+ REQUIRE_ENV = "MEM_REQUIRE_PROTOCOL"
12
+ EXIT_UNSUPPORTED = 78
13
+ _DIST = "memory-cli"
14
+
15
+
16
+ def package_version() -> str:
17
+ """The installed `memory-cli` version, `unknown` when the package metadata is absent.
18
+
19
+ Imported here, not at the top: every entry point loads this module, and the valid path never needs the version."""
20
+ from importlib.metadata import PackageNotFoundError, version # ruff: ignore[import-outside-top-level]
21
+
22
+ try:
23
+ return version(_DIST)
24
+ except PackageNotFoundError:
25
+ return "unknown"
26
+
27
+
28
+ def _wanted(raw: str) -> int | None:
29
+ try:
30
+ return int(raw)
31
+ except ValueError:
32
+ return None
33
+
34
+
35
+ def require() -> None:
36
+ """Exit 78 with one stderr line when `MEM_REQUIRE_PROTOCOL` names a revision this `mem` does not speak."""
37
+ raw = os.environ.get(REQUIRE_ENV, "")
38
+ if not raw:
39
+ return
40
+ wanted = _wanted(raw)
41
+ if wanted in PROTOCOLS:
42
+ return
43
+ fix = (
44
+ "update the plugin or install an older memory-cli"
45
+ if wanted is not None and wanted < min(PROTOCOLS)
46
+ else "run: uv tool install --upgrade memory-cli"
47
+ )
48
+ listed = ", ".join(map(str, PROTOCOLS))
49
+ print(
50
+ f"memory: this mem (memory-cli {package_version()}) supports protocol {listed}, "
51
+ f"the plugin needs {raw}; {fix}",
52
+ file=sys.stderr,
53
+ )
54
+ sys.exit(EXIT_UNSUPPORTED)
@@ -3,8 +3,8 @@
3
3
  Three kinds of lookup, so a caller names its need and never counts `parents[N]`:
4
4
 
5
5
  - package data (`TEMPLATES`, the `*_BRIEFS` folders) ships inside the wheel and is always there;
6
- - the plugin folder (`plugin_root`) exists only while the engine runs from the plugin's source tree (`engine/..`
7
- holding `hooks/`); an installed `memory-cli` has none;
6
+ - the plugin folder (`plugin_root`): `MEM_PLUGIN_ROOT`, else the plugin's source tree (`engine/..`), else the folder the
7
+ state record names, each only when it holds `hooks/`; an installed `memory-cli` that no plugin ever ran has none;
8
8
  - a child entry point (`mem_command`, `child_env`) always starts from the running installation: its interpreter and
9
9
  `-m memory_cli`, never a `mem` found on `PATH`, which may be an older copy.
10
10
  """
@@ -15,18 +15,42 @@ import sys
15
15
  from collections.abc import Mapping
16
16
  from pathlib import Path
17
17
 
18
+ from memory_cli.core import jobs
19
+
18
20
  PACKAGE_DIR = Path(__file__).resolve().parents[1]
19
21
  TEMPLATES = PACKAGE_DIR / "templates"
20
22
  MEM_PY = PACKAGE_DIR / "mem.py" # `mem stats` counts this file by name
21
23
  INTEGRATE_BRIEFS = PACKAGE_DIR / "integrate" / "briefs"
22
24
  SPLIT_BRIEFS = PACKAGE_DIR / "split" / "briefs"
23
25
  SYNTHESIZE_BRIEFS = PACKAGE_DIR / "synthesize" / "briefs"
26
+ PLUGIN_RECORD = "plugin-root" # file in the state dir; `mem session-index --hook` writes it
27
+
28
+
29
+ def _holds_hooks(root: Path) -> bool:
30
+ return (root / "hooks").is_dir()
31
+
32
+
33
+ def _recorded_root() -> Path | None:
34
+ """The folder `<state dir>/plugin-root` names (the session-start hook refreshes it), when it exists."""
35
+ try:
36
+ line = (jobs.state_dir() / PLUGIN_RECORD).read_text(encoding="utf-8").splitlines()[0]
37
+ except (OSError, UnicodeDecodeError, IndexError):
38
+ return None
39
+ return Path(line) if line else None
24
40
 
25
41
 
26
42
  def plugin_root() -> Path | None:
27
- """The plugin folder this source tree sits in (`engine/..` when it holds `hooks/`), else None."""
28
- root = PACKAGE_DIR.parent.parent
29
- return root if (root / "hooks").is_dir() else None
43
+ """The plugin folder, first that holds `hooks/`: `MEM_PLUGIN_ROOT` (a plugin adapter starting an installed CLI),
44
+ the source tree's own (`engine/..`), the folder the state record names (a bare installed `mem` run by an agent),
45
+ else None."""
46
+ for candidate in (
47
+ Path(given) if (given := os.environ.get("MEM_PLUGIN_ROOT")) else None,
48
+ PACKAGE_DIR.parent.parent,
49
+ _recorded_root(),
50
+ ):
51
+ if candidate is not None and _holds_hooks(candidate):
52
+ return candidate
53
+ return None
30
54
 
31
55
 
32
56
  def mem_command(entry: str | None = None) -> list[str]:
memory_cli/entry/auto.py CHANGED
@@ -44,7 +44,7 @@ if TYPE_CHECKING:
44
44
  from collections.abc import Callable
45
45
 
46
46
  from memory_cli.core import auto_state as au
47
- from memory_cli.core import codex_pass, jobs, resources
47
+ from memory_cli.core import codex_pass, jobs, protocol, resources
48
48
  from memory_cli.core import runner as runners
49
49
  from memory_cli.entry import integrate, split_auto
50
50
  from memory_cli.synthesize import pipeline as sp
@@ -621,6 +621,7 @@ def _dispatch(args: argparse.Namespace, store: Path) -> int:
621
621
 
622
622
 
623
623
  def main(argv: list[str] | None = None) -> int:
624
+ protocol.require()
624
625
  parser = argparse.ArgumentParser(
625
626
  prog="mem-auto", description=(__doc__ or "mem-auto").splitlines()[0]
626
627
  )
@@ -39,7 +39,7 @@ from typing import Any
39
39
  from memory_cli.capture import codex_rollout
40
40
  from memory_cli.capture import extract as capture
41
41
  from memory_cli.capture import state as cs
42
- from memory_cli.core import codex_pass, headless, jobs, resources
42
+ from memory_cli.core import codex_pass, headless, jobs, protocol, resources
43
43
  from memory_cli.core import runner as runners
44
44
  from memory_cli.memories import records
45
45
  from memory_cli.synthesize import pipeline as sp
@@ -1317,6 +1317,7 @@ def cmd_exclude(args: argparse.Namespace) -> int:
1317
1317
 
1318
1318
 
1319
1319
  def main(argv: list[str] | None = None) -> int:
1320
+ protocol.require()
1320
1321
  parser = argparse.ArgumentParser(
1321
1322
  prog="mem-capture", description=(__doc__ or "").splitlines()[0]
1322
1323
  )
@@ -36,6 +36,7 @@ import sys
36
36
  import time
37
37
 
38
38
  from memory_cli.capture import state as cs
39
+ from memory_cli.core import protocol
39
40
  from memory_cli.core import runner as runners
40
41
  from memory_cli.corroborate import state as corroborate_state
41
42
 
@@ -87,7 +88,8 @@ def _command(name: str, without_engine=_no_engine):
87
88
  return without_engine if corroborate_cli is None else getattr(corroborate_cli, name)
88
89
 
89
90
 
90
- def main(argv: list[str] | None = None) -> int:
91
+ def main(argv: list[str] | None = None) -> int: # ruff: ignore[too-many-statements] # one parser, built in place
92
+ protocol.require()
91
93
  parser = argparse.ArgumentParser(
92
94
  prog="mem-corroborate", description=(__doc__ or "").splitlines()[0]
93
95
  )
@@ -33,7 +33,7 @@ from dataclasses import dataclass, field
33
33
  from pathlib import Path
34
34
  from typing import TYPE_CHECKING, Any
35
35
 
36
- from memory_cli.core import auto_state, codex_pass, headless, jobs, resources, runner
36
+ from memory_cli.core import auto_state, codex_pass, headless, jobs, protocol, resources, runner
37
37
  from memory_cli.core.file_journal import FileJournal
38
38
  from memory_cli.entry import integrate_self_check
39
39
  from memory_cli.integrate import answers, plan
@@ -665,6 +665,7 @@ def _dispatch(args: argparse.Namespace, store: Path) -> int:
665
665
 
666
666
 
667
667
  def main(argv: list[str] | None = None) -> int:
668
+ protocol.require()
668
669
  parser = _parser()
669
670
  args = parser.parse_args(argv)
670
671
  if args.self_check:
@@ -2,8 +2,10 @@
2
2
 
3
3
  import sys
4
4
 
5
+ from memory_cli.core import protocol
5
6
  from memory_cli.research import pipeline
6
7
 
7
8
 
8
9
  def main(argv: list[str] | None = None) -> int:
10
+ protocol.require()
9
11
  return pipeline.main(sys.argv[1:] if argv is None else argv)
@@ -29,7 +29,7 @@ from dataclasses import dataclass, field
29
29
  from pathlib import Path
30
30
 
31
31
  logger = logging.getLogger(__name__)
32
- from memory_cli.core import codex_pass, headless, jobs, resources
32
+ from memory_cli.core import codex_pass, headless, jobs, protocol, resources
33
33
  from memory_cli.core import runner as runners
34
34
  from memory_cli.settle import state as ss
35
35
  from memory_cli.synthesize import pipeline as sp
@@ -599,6 +599,7 @@ def _run(store: Path, args: argparse.Namespace) -> int:
599
599
 
600
600
 
601
601
  def main(argv: list[str] | None = None) -> int:
602
+ protocol.require()
602
603
  parser = _parser()
603
604
  args = parser.parse_args(argv)
604
605
  if args.self_check:
@@ -15,8 +15,10 @@ Usage: mem-synthesize [--topic T]... [--budget USD (3)] [--no-references] [--dry
15
15
  mem-synthesize --backfill [s:<handle> ...] [--budget USD] [--dry-run] [--store PATH] [--claude PATH]
16
16
  """
17
17
 
18
+ from memory_cli.core import protocol
18
19
  from memory_cli.synthesize import cli
19
20
 
20
21
 
21
22
  def main(argv: list[str] | None = None) -> int:
23
+ protocol.require()
22
24
  return cli.main(__doc__ or "", argv)
memory_cli/mem.py CHANGED
@@ -27,7 +27,7 @@ from memory_cli.commands import (
27
27
  )
28
28
  from memory_cli.commands.diagnostics import add_parser as _parser_add_diagnostics
29
29
  from memory_cli.commands.install import add_parser as _parser_add_install
30
- from memory_cli.core import config, safe_io
30
+ from memory_cli.core import config, protocol, safe_io
31
31
  from memory_cli.memories import records, rules
32
32
  from memory_cli.notes import due as due_queries
33
33
  from memory_cli.notes.fields import (
@@ -79,7 +79,6 @@ _NO_STORE_NEEDED = (
79
79
  "signal",
80
80
  "projects",
81
81
  "project-synthesis",
82
- "install-command",
83
82
  )
84
83
 
85
84
 
@@ -1090,6 +1089,7 @@ def build_parser() -> argparse.ArgumentParser:
1090
1089
 
1091
1090
 
1092
1091
  def main(argv: list[str] | None = None) -> int:
1092
+ protocol.require()
1093
1093
  try:
1094
1094
  return _dispatch(argv)
1095
1095
  except safe_io.UnsafePath as exc: # a symlink where a command refuses one
@@ -1139,7 +1139,7 @@ def _store_refusal(args: argparse.Namespace, root: Path | None) -> str | None:
1139
1139
 
1140
1140
  def _dispatch_store(args: argparse.Namespace) -> int | None:
1141
1141
  """Resolve the store into `args.root`; the exit code of a refusal, or None to run the command."""
1142
- if args.command in {"init", "diagnostics", "terms", "history"}:
1142
+ if args.command in {"init", "diagnostics", "terms", "history", "protocol", "install-command"}:
1143
1143
  return None
1144
1144
  if (
1145
1145
  args.command in _NO_STORE_NEEDED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: memory-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: The memory engine: the `mem` command and its background entries
5
5
  Project-URL: Repository, https://github.com/Mili-ssm/memory-cli
6
6
  Author: Mili-ssm
@@ -52,8 +52,11 @@ this engine until it switches to this package.
52
52
  | A checkout | `uv tool install .` |
53
53
 
54
54
  If `uv tool install` refuses because `~/.local/bin/mem*` already exists, those files are launchers an older plugin wrote.
55
- Remove them with `mem install-command --remove` (from the plugin's `mem`), or delete the `~/.local/bin/mem*` files whose
56
- second line is `# agent-memory launcher (mem install-command)`, then install again.
55
+ Remove them (files with another second line are kept) and install again:
56
+
57
+ ```
58
+ uvx --from memory-cli mem install-command --remove && uv tool install memory-cli
59
+ ```
57
60
 
58
61
  ## Commands
59
62
 
@@ -70,6 +73,16 @@ second line is `# agent-memory launcher (mem install-command)`, then install aga
70
73
 
71
74
  `<command> --help` lists the options. The background commands run a headless `claude` or `codex` session (`--runner`).
72
75
 
76
+ ## Use from a host plugin
77
+
78
+ A plugin adapter starts the installed CLI and can pin what it needs:
79
+
80
+ | Variable or command | Meaning |
81
+ |---|---|
82
+ | `mem protocol` | one JSON line `{"version": "0.2.0", "protocols": [1]}`; no store access, no writes; 0.1.0 lacks it |
83
+ | `MEM_REQUIRE_PROTOCOL=N` | every entry point exits 78 with one stderr line unless it speaks revision N; unset or empty skips the check |
84
+ | `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` |
85
+
73
86
  ## Development
74
87
 
75
88
  ```sh
@@ -1,20 +1,20 @@
1
1
  memory_cli/__init__.py,sha256=pCfxV1hapOLTFMYikRR7A9D3wzR88IhtLfr2vsqEx_g,103
2
2
  memory_cli/__main__.py,sha256=Xf4KupRJ8WlYq1Yz-kQo0AZC23xmMZcTqyBzYtBhe9M,1596
3
- memory_cli/mem.py,sha256=eodJ1QeaMAvytxxnastlad70VFbGxNfeURPMSEhMt-M,46058
3
+ memory_cli/mem.py,sha256=i4eSyhzLVJqmOrKDuyUHyjDuROHQjebPisrmgDqGeAU,46099
4
4
  memory_cli/capture/__init__.py,sha256=PQal1v9Ha8D2HB3wjXdrPfi-D-W1rckGNcqIBCkh2U4,335
5
5
  memory_cli/capture/codex_rollout.py,sha256=xBqK-J521PTPSTeoL9_PebUib9B2DVe4ft6CKFXquTA,6261
6
6
  memory_cli/capture/event_lines.py,sha256=e5SfWhWJxTdT8KMQVV8R_R6IQ-bOFzu_WGjyk1YGziU,2217
7
7
  memory_cli/capture/extract.py,sha256=Sw1PPFFTQZy35B1fgXvPPuQIgGAcN9fUuMz3MZ6DxQE,16327
8
8
  memory_cli/capture/state.py,sha256=Vc25SFcRjaqRB9npPNUe7xTsk4zBuWVKhB2aV_MKfXQ,7015
9
- memory_cli/commands/__init__.py,sha256=ZAchrlFEU-5ml3dIcG3AhyJFU4M2J4KepfikVxju9g0,1818
9
+ memory_cli/commands/__init__.py,sha256=YTKeHbCmrDoRECiWbFERfk2MXTljSkLlqIu3Fojy-tQ,1913
10
10
  memory_cli/commands/admin.py,sha256=6rCyImoMjoE8aZthOY4A-gD1d8e060d-ohp_fkKPGvQ,12481
11
11
  memory_cli/commands/common.py,sha256=VmFE4hxqwdznOZKlpIEqKlK5x8S6-9ca_OTXq568TfI,23367
12
12
  memory_cli/commands/curate.py,sha256=6-yagnNNX-BV6U1QKdxYSUv3FnG__wntUH3FXSig62k,46000
13
- memory_cli/commands/diagnostics.py,sha256=amcPdHz4f_KcygncJRSAh-RT_AHIWrRNncHzsYsqbHQ,4293
13
+ memory_cli/commands/diagnostics.py,sha256=WdA6l5dbCgDjA_jpNnz3bhgEcDjoc1D7KAzvn1ziIK4,4796
14
14
  memory_cli/commands/edit.py,sha256=kjKd_kihDQJAqIWyL11WBCf7PLxnj-gFzFa_kpc4OdM,52088
15
- memory_cli/commands/hooks.py,sha256=TRB3k96JAAvogabfnAqFtxP6WyW5bDA6p5tgYB7mmkc,27264
15
+ memory_cli/commands/hooks.py,sha256=gCSaX7XQVbcE7PDpCbzzfDAPj0f0h2u-gIhZWLNh1HA,27173
16
16
  memory_cli/commands/import_recovery.py,sha256=B8G7rwQiy5Wyzcbteefb7CqPzQ_ewbwjhaAyfdZzS6Q,1056
17
- memory_cli/commands/install.py,sha256=mzqelbj3WDsbO4ENSqEXOw3ZRnoQ-qR4UIjR-7xfZt8,5553
17
+ memory_cli/commands/install.py,sha256=zTxRjtdb543vyVrtGfwR5_oUVBDaYi8HVTANCDhyQ3U,3885
18
18
  memory_cli/commands/integrate.py,sha256=r-Pf0Drs1FziGvp-DVEJKpyabtn5_nr3kmVylPIR5s4,18161
19
19
  memory_cli/commands/memory.py,sha256=QBoA94-sMRdLKP0H5SpMgPNd8M7p233fm_9Zc2256ec,83083
20
20
  memory_cli/commands/read.py,sha256=WP7p8mmcMEHk9V4LYNQk86MOtutrbhye2yH5_CQYcDQ,47652
@@ -23,14 +23,15 @@ memory_cli/commands/split.py,sha256=AfOIs2JUhNFCIDOvRJB-G2eGhHQCAxX0mumgc8UL9XU,
23
23
  memory_cli/commands/split_plan.py,sha256=_bSSIy3cLXGxXHGny3NAeq99SMBUtskZ81WKPC2xsE4,7968
24
24
  memory_cli/commands/split_transaction.py,sha256=OOm-R9l6juvdG3xvf9Lh0xYXcFi4f7kn4JQueuGklqA,7839
25
25
  memory_cli/commands/synthesis.py,sha256=mFGh6WWseKbJiRL7S_kEH2RmETs4w-jRTw_0otraLDY,42745
26
- memory_cli/core/__init__.py,sha256=ShzVne2z4__VPQXqlSBtrIaYvzOHRpu-9hVdKpIKm7M,968
26
+ memory_cli/core/__init__.py,sha256=ymYSeckh9mRPsSmpmS3cNThVzqN4pe-rORujO1oWPEo,1100
27
27
  memory_cli/core/auto_state.py,sha256=Hg4Lzt526WU6LaRUzJD77-Kr82AhquC0wTO-9XXVdNE,1183
28
28
  memory_cli/core/codex_pass.py,sha256=qP8DvCfpfaDk5IC1VwmpM2rv6JDanPkn0OLPcOwldkQ,4182
29
29
  memory_cli/core/config.py,sha256=1Qg6Ih0jcx9NsSLtA4orhha3X4pkkgZmLS4c0dJUXso,3291
30
30
  memory_cli/core/file_journal.py,sha256=ms-p__8MjIvOi6COl_C1xBGfZTbVG1B_Ip9YeZhiS3g,6571
31
31
  memory_cli/core/headless.py,sha256=kBGlpuabvtSGzhepuGIMYc2Hh5D_NZPAIUdzTX3fS1g,3868
32
32
  memory_cli/core/jobs.py,sha256=pTNpx6F6_7TPJ1NCR4kExOZvXRIvfrJsveh-ejzWHw4,4511
33
- memory_cli/core/resources.py,sha256=jOVXihPIU0XW1OJ5CYPA5P-yzhzPFKxU_-8uyHPUxsQ,2642
33
+ memory_cli/core/protocol.py,sha256=Oi-cGCSMQQAnOBwoE6gxPj0Iv0q4gv8DI2w9cTaVnT0,1806
34
+ memory_cli/core/resources.py,sha256=yu44Fygiz9XgpBwl_zVq_2eVJnRfLnzgtrU4Wr-hXmM,3612
34
35
  memory_cli/core/runner.py,sha256=Gui55h1n_ygYc3UD_RDb6X1PYlOHRx5lolSzcmCL-9Y,15909
35
36
  memory_cli/core/safe_io.py,sha256=siSGXEgl9BDmVtNzvCGxS1hdtMw6AQVVke38H9s7PNs,5368
36
37
  memory_cli/core/store_git.py,sha256=94eDniVevgO23hzDz94qEBmpZMjb482e9ZTrWpSKM1M,14300
@@ -47,15 +48,15 @@ memory_cli/corroborate/state.py,sha256=2NVuRv3GL96Cjf89AF4snxNP74_FglkCKjDaoDLBV
47
48
  memory_cli/digest/__init__.py,sha256=XxIWvgqvZ4u1wyLoWZg2rPVUzPFAPgy5DLl3tTgmeBw,143
48
49
  memory_cli/digest/lessons.py,sha256=MCwRdqLneKV78fbBUIQtLKTJaX_Yd6QQPZCzT0O_Or8,18188
49
50
  memory_cli/entry/__init__.py,sha256=DNdRowSNkyL-P5Mbeuf6L9Jr1K7WAVS4SvnkErdSr2k,894
50
- memory_cli/entry/auto.py,sha256=HfZaT7KYPVOw13gYAhIeGCpR6WOlome5pdZn-sZYxn8,26005
51
- memory_cli/entry/capture.py,sha256=okmHWQxFsJFKTlMrWw7oDzXlR-pregw590CuaOWcz-M,59518
52
- memory_cli/entry/corroborate.py,sha256=-3aT2myMRj_fRVo-xpjOIQCMUPzrmK-E3HG9Ho1UUw8,9544
53
- memory_cli/entry/integrate.py,sha256=OAye-or2MagFmw-UgH2mAZYcuVsVnt3HoKp0j6NEzKY,26387
51
+ memory_cli/entry/auto.py,sha256=GqO_fHwqo8p_XcS215hdplMGCLWF96cBhZonRXwgA_g,26038
52
+ memory_cli/entry/capture.py,sha256=4jrTao4Alj7C0p_PDZlpL1nYCLErXAuNkwHembXIqSI,59551
53
+ memory_cli/entry/corroborate.py,sha256=jcMofAsV_4m3wD_rueGdZfUwG8Shl2WK_5h3_Uh6fSk,9671
54
+ memory_cli/entry/integrate.py,sha256=GEEqupbsiTfV31-2HxVxOVTqdxickjZeUNXbCkGL0Io,26420
54
55
  memory_cli/entry/integrate_self_check.py,sha256=0Phu0a-WlhKba_PPF9Uuh1Xs9JyLpkB030zK3t8l734,7956
55
- memory_cli/entry/research.py,sha256=PLBTq1TeQ6BaWosARNtcvZleh34Ye2privCrOa7PyS0,251
56
- memory_cli/entry/settle.py,sha256=E5lmrOkPKcEe6zdv-JepI3HjUJ0PgQME4pA_1wNuyfA,22688
56
+ memory_cli/entry/research.py,sha256=vEQCB7HglIjztMohABS9RscUEhgl84_g9xgCZ7cSYPI,311
57
+ memory_cli/entry/settle.py,sha256=AM5JmnFY-WD8aFOwsZS0pbcJlMcnBxMOhJJsgfxwteM,22721
57
58
  memory_cli/entry/split_auto.py,sha256=C3VUT0xLQXKYkc0vFLFJanFVE3pQhxLfQlUuXlXBr-I,17987
58
- memory_cli/entry/synthesize.py,sha256=NUaj-0cBRrufbh8a3W_-HQ0aDwfw9aYQCLedbfVrIUM,1468
59
+ memory_cli/entry/synthesize.py,sha256=tRibkZRrhwcOR0IIEW1w85vEQBRgilyDw-fIbCrLkmw,1528
59
60
  memory_cli/integrate/__init__.py,sha256=CjI-qM7jcKrIelC4H1sXu7kbxfLbXchleeCNEfKiMrk,821
60
61
  memory_cli/integrate/answers.py,sha256=96bxVk4rndHYoebZpDJh5tWVFcckUFsmwgBkaYy_WrU,1480
61
62
  memory_cli/integrate/log.py,sha256=St9-GOMAL_auToa6WEz0iS7dJzDDeZsOCiWTGfBe7rc,1621
@@ -121,8 +122,8 @@ memory_cli/templates/knowledge.md,sha256=rPyfZMdQIOf5UUKTAZp83TwXI16GxRDMQBW0m4S
121
122
  memory_cli/templates/literature.md,sha256=DFSYBW5RMLmkTYHpn0SucXBZKgW0ITqv7KsITxvfmKI,528
122
123
  memory_cli/templates/research.md,sha256=VfevyU6y3XJrMkN1og-JWENovY75hpWg979BsMgEOds,484
123
124
  memory_cli/templates/synthesis.md,sha256=vcXP-06DXGhyxMmggnjpMEQlYshfJ4oHB3NwF-lsvB4,44
124
- memory_cli-0.1.0.dist-info/METADATA,sha256=XJaMfiKTTpfTnbHoAXFRDqACxKxH6UoqVTGA6M2TTtM,5052
125
- memory_cli-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
126
- memory_cli-0.1.0.dist-info/entry_points.txt,sha256=xIkzFd9lnBUwegUqo6HwFkn8HFjykuhEXgEYlnOLNXg,364
127
- memory_cli-0.1.0.dist-info/licenses/LICENSE,sha256=ddv8mjZKLr_0T4-a6m7l3aUXWXSz73FYDZi7Y9WkVxI,1065
128
- memory_cli-0.1.0.dist-info/RECORD,,
125
+ memory_cli-0.2.0.dist-info/METADATA,sha256=crquo5yC87GLppD4aE9UaLE8caq5BIWskOCbtj36Hyc,5594
126
+ memory_cli-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
127
+ memory_cli-0.2.0.dist-info/entry_points.txt,sha256=xIkzFd9lnBUwegUqo6HwFkn8HFjykuhEXgEYlnOLNXg,364
128
+ memory_cli-0.2.0.dist-info/licenses/LICENSE,sha256=ddv8mjZKLr_0T4-a6m7l3aUXWXSz73FYDZi7Y9WkVxI,1065
129
+ memory_cli-0.2.0.dist-info/RECORD,,