Skip to content

feat: memu CLI, npm launcher, and agent skills for the workspace pair#467

Merged
sairin1202 merged 2 commits into
mainfrom
feat/cli-npm-skills
Jul 5, 2026
Merged

feat: memu CLI, npm launcher, and agent skills for the workspace pair#467
sairin1202 merged 2 commits into
mainfrom
feat/cli-npm-skills

Conversation

@sairin1202

Copy link
Copy Markdown
Contributor

Summary

  • memu CLI (src/memu/cli.py): console entry wrapping the five public service entry points — memorize, memorize-workspace (alias sync), retrieve, retrieve-workspace (alias search), 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 a MEMU_* env var; --json emits the raw response; errors are one-line with MEMU_DEBUG=1 for tracebacks.
  • npm package memu-cli (npm/): zero-dependency launcher that delegates to uvx --from memu-py memupipx runpython3 -m memu, so npx memu-cli works 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.
  • Agent Skills (.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 and retrieve as fallback.
  • README refresh: CLI + Agent Skills sections, architecture table updated to the layered File/Segment/Resource model with both read paths, memorize_workspace() / retrieve_workspace() API docs, MemUServiceMemoryService consistency fix.

Test plan

  • uv run pytest — 179 passed (2 pre-existing failures from the missing optional markitdown extra, unrelated)
  • New tests/test_cli.py covers parser wiring, DB config dispatch, and error paths
  • uv run ruff check / ruff format --check / mypy / deptry all green
  • Manual: memu --help, error paths (missing file, unknown extension, missing key → clean one-line errors with correct exit codes), npm launcher forwards args/exit codes via MEMU_PYTHON

🤖 Generated with Claude Code

- 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>
Copilot AI review requested due to automatic review settings July 5, 2026 08:55
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sairin1202 sairin1202 merged commit c861974 into main Jul 5, 2026
3 checks passed
@sairin1202 sairin1202 deleted the feat/cli-npm-skills branch July 5, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 memu CLI (src/memu/cli.py) + python -m memu entrypoint, and wires the console script in pyproject.toml.
  • Adds npm/ launcher package (memu-cli) that delegates to uvx/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 thread src/memu/cli.py
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 thread src/memu/cli.py
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 thread npm/package.json
Comment on lines +5 to +7
"bin": {
"memu": "bin/memu.js"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants