feat: memu CLI, npm launcher, and agent skills for the workspace pair#467
Merged
Conversation
- Add `memu` console entry (src/memu/cli.py) wrapping the five public service entry points: memorize, memorize-workspace (alias: sync), retrieve, retrieve-workspace (alias: search), and export. State persists via a local SQLite store (--db, default ./data/memu.sqlite3); every flag has a MEMU_* env var; --json emits the raw response. - Add npm package `memu-cli` (npm/): a zero-dependency launcher that delegates to uvx / pipx / python3 -m memu, so `npx memu-cli` works from the JS ecosystem without porting the engine. - Ship Agent Skills (.claude/skills/memu-memorize, memu-retrieve) so skills-compatible agents can invoke the workspace pair directly. - Refresh README: CLI + skills sections, layered File/Segment/Resource architecture table, memorize_workspace/retrieve_workspace API docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a first-party memu command-line interface and a zero-dependency npm launcher so the existing MemoryService workflows can be invoked from terminals/CI/agent environments, plus Claude Agent Skills and README updates to document the “workspace pair” (memorize_workspace / retrieve_workspace) usage.
Changes:
- Introduces
memuCLI (src/memu/cli.py) +python -m memuentrypoint, and wires the console script inpyproject.toml. - Adds
npm/launcher package (memu-cli) that delegates touvx/pipx/python3 -m memu. - Adds agent skill docs for memorize/retrieve workspace flows and refreshes README with CLI + layered model + API docs.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_cli.py |
Adds CLI surface tests for parsing, DB config mapping, and common error paths. |
src/memu/cli.py |
Implements argparse CLI, env-var flag mapping, and handlers for memorize/retrieve/export flows. |
src/memu/__main__.py |
Enables python -m memu for the npm launcher. |
README.md |
Documents CLI usage, agent skills, and updated storage/retrieval layering. |
pyproject.toml |
Registers the memu console script entry point. |
npm/README.md |
Documents npx memu-cli usage as a thin launcher over memu-py. |
npm/package.json |
Defines npm package metadata and published binaries. |
npm/bin/memu.js |
Implements runner selection and argument/exit-code forwarding to the Python CLI. |
.claude/skills/memu-retrieve/SKILL.md |
Adds a retrieval skill wrapping retrieve-workspace with fallback to retrieve. |
.claude/skills/memu-memorize/SKILL.md |
Adds a memorize skill wrapping memorize-workspace (and single-file memorize). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+101
to
+107
| llm: dict[str, Any] = {"provider": args.provider} | ||
| if args.model: | ||
| llm["chat_model"] = args.model | ||
| if args.base_url: | ||
| llm["base_url"] = args.base_url | ||
| if args.api_key: | ||
| llm["api_key"] = args.api_key |
Comment on lines
+125
to
+129
| path = pathlib.Path(args.path).expanduser() | ||
| if not path.exists(): | ||
| print(f"error: no such file: {path}", file=sys.stderr) | ||
| return 2 | ||
| modality = args.modality or infer_modality(path) |
Comment on lines
+5
to
+7
| "bin": { | ||
| "memu": "bin/memu.js" | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memuCLI (src/memu/cli.py): console entry wrapping the five public service entry points —memorize,memorize-workspace(aliassync),retrieve,retrieve-workspace(aliassearch),export. State persists through a local SQLite store (--db, default./data/memu.sqlite3), so memorize in one invocation and retrieve in the next. Every flag has aMEMU_*env var;--jsonemits the raw response; errors are one-line withMEMU_DEBUG=1for tracebacks.memu-cli(npm/): zero-dependency launcher that delegates touvx --from memu-py memu→pipx run→python3 -m memu, sonpx memu-cliworks from the JS ecosystem without porting the engine. Note: effective for end users once the next memu-py release (with the CLI) is on PyPI..claude/skills/memu-memorize,.claude/skills/memu-retrieve): let Claude Code and other skills-compatible agents call the workspace pair directly — memorize on "remember this / sync this folder", retrieve on "what do we know about…", with the LLM-free fast path as default andretrieveas fallback.memorize_workspace()/retrieve_workspace()API docs,MemUService→MemoryServiceconsistency fix.Test plan
uv run pytest— 179 passed (2 pre-existing failures from the missing optionalmarkitdownextra, unrelated)tests/test_cli.pycovers parser wiring, DB config dispatch, and error pathsuv run ruff check/ruff format --check/mypy/deptryall greenmemu --help, error paths (missing file, unknown extension, missing key → clean one-line errors with correct exit codes), npm launcher forwards args/exit codes viaMEMU_PYTHON🤖 Generated with Claude Code