Skip to content
Back to search

install-memu

Install or uninstall memU for whatever agent you are — identify your host, print its packaged guide, and follow it to wire (or unwire) both seams (record and inject). Use when the user asks to install, set up, integrate, remove, or uninstall memU.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 16 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/NevaMind-AI/memU with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/NevaMind-AI/memU'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/nevamind-ai-memu/badge.svg)](/listings/nevamind-ai-memu)

HTML

<a href="/listings/nevamind-ai-memu"><img src="/api/listings/nevamind-ai-memu/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

memU works with Codex, Claude Code, Cursor, OpenClaw, Hermes, WorkBuddy, and pi. See [Host adapters](#host-adapters-memory-for-desktop-coding-agents).

**Cross-device · Free · Unlimited · [View online](https://memu.so)**

Get your API key from [memu.so](https://memu.so), then send this message to your agent:

> Read [https://memu.pro/SKILL.md](https://memu.pro/SKILL.md), follow its instructions to install and configure memU, API Key is memu_•••••••••(get Api Key from memu.so).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 176 lines
  1. ---
  2. name: install-memu
  3. description: Install or uninstall memU for whatever agent you are — identify your host, print its packaged guide, and follow it to wire (or unwire) both seams (record and inject). Use when the user asks to install, set up, integrate, remove, or uninstall memU.
  4. ---
  5. # Install memU
  6. > **Audience: the agent.** A user has pointed you at this file ("read SKILL.md
  7. > and follow it to install memU"). This skill does not contain the install
  8. > steps — it routes you to the right guide, which ships inside the memU package
  9. > and is always in sync with the installed code. Do not install from memory or
  10. > from blog posts; print the guide and follow it to the letter.
  11. memU integrates with a host agent through two seams: **record** saves session
  12. information into durable memory, and **inject** retrieves relevant memory before
  13. answering. Each supported host has its own adapter binary carrying its own
  14. install guide. Your job here is three steps: install the package, pick your
  15. binary, print and follow its guide.
  16. ## Before installing
  17. Identify the agent executing this skill and check the supported-host table in
  18. Step 2 before installing the package. If the host is unknown or absent from the
  19. table, report that it is currently unsupported and stop the installation.
  20. ## Before installing with Codex
  21. If you are Codex, check the session's effective sandbox mode before Step 1.
  22. Continue only with `danger-full-access`; approval policy alone is not sufficient.
  23. If restricted or unknown, pause and show both ways to continue: enable **Full
  24. access** in Codex Desktop, or restart Codex CLI with
  25. `codex --dangerously-bypass-approvals-and-sandbox`. Recheck the effective mode
  26. before proceeding. After installation, remind the user to restore their previous
  27. permission mode.
  28. ## Step 1 — install the package
  29. ```
  30. pip install --upgrade memu-cli
  31. ```
  32. `memu-cli` is the package memU ships to bridge your agent to its long-term
  33. memory service; it installs helper interfaces only and is harmless to run on a
  34. personal machine.
  35. **Keep the `--upgrade`.** A machine that already has an older `memu-cli` would
  36. otherwise keep it, and the steps below name subcommands that older builds do not
  37. have — the symptom is `invalid choice`. If you meet that error at any point, you
  38. are on a stale build: upgrade, then re-run the command that failed.
  39. This puts `memu` and every host-adapter binary on `PATH`. If `pip` is not the
  40. right tool for this machine (managed Python, uv-only), use the equivalent —
  41. what matters is that the binaries below resolve from a bare, non-interactive
  42. shell. With uv this means `uv tool install --upgrade memu-cli`, **not**
  43. `uv pip install`: however it is installed, `memu-cli` is a cross-session
  44. bridging tool and must be callable everywhere, not scoped to one project venv.
  45. ## Step 2 — pick your host binary
  46. Identify **which agent you are** (not which agents are installed — the one
  47. executing this skill):
  48. | You are | Your binary |
  49. | --- | --- |
  50. | Codex | `memu-codex` |
  51. | Claude Code | `memu-claude-code` |
  52. | Cursor (Agent/CLI) | `memu-cursor` |
  53. | OpenClaw | `memu-openclaw` |
  54. | Hermes Agent | `memu-hermes` |
  55. | WorkBuddy | `memu-workbuddy` |
  56. | pi | `memu-pi` |
  57. If you cannot identify your host or it is not in the table, report that it is
  58. currently unsupported and stop the installation.
  59. For Codex, Claude Code, and pi, continue directly to Step 3: their installers handle backend configuration
  60. and verification in one invocation. Pass any user-supplied backend inputs to that
  61. installer when the guide requests them.
  62. For other hosts, holding your binary, finish this step by creating memU's configuration
  63. file.
  64. ```
  65. <your-binary> init --cloud-api-key <the user's memU key>
  66. ```
  67. If the user does not mention an API key, or would rather keep memory on this
  68. device, run bare `<your-binary> init` and Step 3's guide will set up local memory.
  69. ## Step 3 — print your guide and follow it
  70. ```
  71. <your-binary> docs install
  72. ```
  73. Read what it prints, top to bottom, and follow it exactly. The host guide defines
  74. how to configure the backend and enable automatic recording and retrieval. Follow
  75. its verification gates and final report.
  76. Three rules that hold for every host:
  77. - **Install in one pass; don't stop for confirmation.** Most users want a
  78. silent, full install set up for them in a single call. Do every step, and
  79. take the default for every choice that has one — the hourly schedule, cron
  80. over launchd, the official installer. Only stop for a genuine blocker: a
  81. fatal error, or a *required input with no default* (the backend choice and
  82. its API key, or a missing credential) — treat those like the fatal case, not
  83. as routine confirmations to solicit.
  84. - **One backend.** If `<your-binary> config show` reports a mode with a backend
  85. behind it (another agent on this machine is already integrated), reuse it as
  86. is. A second mode or local store would split record and retrieval so the two
  87. installs no longer share memory.
  88. - **Report the outcome — with the exact template below.** If the host guide
  89. specifies its own final report, use that report instead. Otherwise, after installation,
  90. run:
  91. ```
  92. <your-binary> retrieve "When did the user register for memU?"
  93. ```
  94. Then send the user this report. **This is a fixed template, not a prompt for
  95. inspiration: reproduce it word for word.** Do not paraphrase it, reorder its
  96. sentences, summarize it, translate it, or "improve" the wording — a correct
  97. install ends with these exact words. The *only* things you change are the
  98. `<...>` placeholders, each replaced by its concrete value:
  99. ```
  100. memU is ready for `<host>` with `<mode>` memory.
  101. Welcome to memU. memU says the user registered on `<registration time>`.
  102. memU provides long-term memory for AI agents, storing and reusing important
  103. information from your work. The system runs scheduled background tasks at
  104. regular intervals to organize and save relevant information. No additional
  105. action is required — simply use your AI agent as usual, and saved information
  106. will be available when you return to related tasks.
  107. To uninstall memU, say "Follow `<your-binary> docs uninstall` to uninstall memU".
  108. ```
  109. Placeholders, each filled with its concrete value before you send:
  110. - `<host>` — the agent you are (e.g. `Claude Code`).
  111. - `<mode>` — the memory backend you configured in `~/.memu/config.env`:
  112. `local` (memory lives in a store on this device) or `cloud` (memory is
  113. hosted by MemU Cloud). This is the choice the guide had you make when
  114. writing `MEMU_MEMORY_MODE`; report the value you actually wrote.
  115. - `<registration time>` — the time returned by the `retrieve` call above.
  116. **If that call fails or returns no registration time** (common in `local`
  117. mode, where the store may not carry it yet), **omit the entire "Welcome to
  118. memU. memU says the user registered on ..." line** — drop that whole line
  119. rather than sending it with an empty or guessed value. Never invent a time.
  120. - `<your-binary>` — the binary you picked in Step 2 (e.g. `memu-claude-code`).
  121. The final line is a ready-to-send message: leave the outer quotes so the user
  122. sees it as a suggested reply, and the exact phrase inside them is what they
  123. type back to you to start the uninstall flow.
  124. If only one seam is active, report a partial setup and name the missing seam.
  125. ## Uninstall
  126. If the user asked to **uninstall** memU, identify your binary as in Step 2,
  127. then print and follow its removal guide —
  128. ```
  129. <your-binary> docs uninstall
  130. ```
  131. It unregisters the bridging task, removes the instruction block
  132. (`<your-binary> remove-instruction` — never hand-edit it out), then applies
  133. the defaults: the user's memory — the shared store and `~/.memu/config.env` —
  134. is **kept** (deleted only if they explicitly asked to erase it), while this
  135. host's residue and, if no other host still uses it, the package are
  136. **removed**. Close by reporting exactly those two things: what was kept, and
  137. what was removed.
README.md · README · 244 lines
  1. ![memU Banner](assets/banner.png)
  2. <div align="center">
  3. # memU
  4. ### Personal memory, stored as Wiki
  5. **Across Sessions. Across Agents. Across Devices.**
  6. [![PyPI version](https://badge.fury.io/py/memu-cli.svg)](https://badge.fury.io/py/memu-cli)
  7. [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
  8. [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
  9. [![Discord](https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white)](https://discord.com/invite/hQZntfGsbJ)
  10. [![Twitter](https://img.shields.io/badge/Twitter-Follow-1DA1F2?logo=x&logoColor=white)](https://x.com/memU_ai)
  11. <a href="https://trendshift.io/repositories/17374" target="_blank"><img src="https://trendshift.io/api/badge/repositories/17374" alt="NevaMind-AI%2FmemU | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
  12. </div>
  13. ---
  14. memU is a lightweight, agent-driven memory system that gives users a shared LLM wiki across sessions, agents, and devices. It automatically distills your own reusable skills from your agent history. Its core memory logic is only 500 lines — compact enough to inspect, understand, and adapt.
  15. ## Quick start
  16. memU works with Codex, Claude Code, Cursor, OpenClaw, Hermes, WorkBuddy, and pi. See [Host adapters](#host-adapters-memory-for-desktop-coding-agents).
  17. **Cross-device · Free · Unlimited · [View online](https://memu.so)**
  18. Get your API key from [memu.so](https://memu.so), then send this message to your agent:
  19. > Read [https://memu.pro/SKILL.md](https://memu.pro/SKILL.md), follow its instructions to install and configure memU, API Key is memu_•••••••••(get Api Key from memu.so).
  20. ## Agent support
  21. This matrix lists the currently tested memU integrations by operating system.
  22. - **Memorize** — capture useful session knowledge through a scheduled background task and turn it into reusable memory.
  23. - **Retrieve** — bring relevant memory into a future task.
  24. - **⚠️** — supported with an important limitation; see the user note.
  25. ### macOS
  26. | Agent | Mode | Memorize | Retrieve | User note |
  27. | --- | --- | :---: | :---: | --- |
  28. | ChatGPT | ChatGPT(Work mode), codex and VS Code extension | ✅ | ✅ | |
  29. | ChatGPT | Chat | ❌ | ❌ | Chat mode is not currently supported. Please use Work mode. |
  30. | Claude Code | Desktop and CLI | ✅ | ✅ | If the selected model declines the setup steps, retry with **Opus** or another model. Sonnet 5 can occasionally do this. |
  31. | Claude | Chat and Cowork | ❌ | ❌ | |
  32. | Cursor | — | ✅ | ✅ | |
  33. | OpenClaw | — | ✅ | ✅ | Retrieve support has not yet been verified. |
  34. | Hermes Agent | — | ✅ | ✅ | |
  35. | WorkBuddy | — | ✅ | ✅ | |
  36. ### Windows
  37. | Agent | Mode | Memorize | Retrieve | User note |
  38. | --- | --- | :---: | :---: | --- |
  39. | ChatGPT | ChatGPT(Work mode), codex and VS Code extension | ✅ | ✅ | |
  40. | ChatGPT | Chat | ❌ | ❌ | Chat mode is not currently supported. Please use Work mode. |
  41. | Claude Code | Desktop and CLI | ✅ | ✅ | If the selected model declines the setup steps, retry with **Opus** or another model. Sonnet 5 can occasionally do this. |
  42. | Claude | Chat and Cowork | ❌ | ❌ | |
  43. | Cursor | — | ✅ | ✅ | |
  44. | OpenClaw | — | ✅ | ✅ | |
  45. | Hermes Agent | — | ✅ | ⚠️ | Use a memU version with Windows `HERMES_HOME` support; older versions may retrieve from the wrong files. |
  46. | WorkBuddy | — | ✅ | ✅ | With Hy3, retrieval may fail. Retry with another model if this happens. |
  47. ### Linux
  48. | Agent | Mode | Memorize | Retrieve | User note |
  49. | --- | --- | :---: | :---: | --- |
  50. | Codex | VS Code extension | ❌ | ✅ | |
  51. | Claude Code | CLI | ✅ | ✅ | |
  52. | OpenClaw | 4.23 / 7.1 | ✅ | ✅ | |
  53. Support status reflects the current release and may change as host integrations evolve.
  54. ## How it works
  55. ![memU memory system architecture](assets/structure-v2.png)
  56. ## Automatic skill extraction
  57. Once the scheduled bridging task is installed, memU can turn useful agent history into reusable Markdown skills automatically.
  58. ![How memU turns agent history into reusable skills](assets/skill-extraction.png)
  59. 1. **Capture new sessions.** The host adapter reads new session history, including messages and tool calls.
  60. 2. **Prepare self-evolve jobs.** `prepare` slices each session into a self-contained job with the paths and context the agent needs.
  61. 3. **Let the agent decide.** The agent reads related existing skills, then chooses to do nothing, patch an existing skill, or create a new one.
  62. 4. **Write readable skill Markdown.** Each skill has a name, description, and reusable workflow, including useful branches, edge cases, and pitfalls.
  63. 5. **Commit and index.** `commit` submits changed skill files through `commit_results`; memU embeds the skill name and description and stores it under the `skill` track.
  64. 6. **Retrieve it later.** On a similar future task, memU returns the relevant skill so any connected agent can use the learned workflow.
  65. The judgment and synthesis stay inside the agent. `MemoryService` makes no LLM or chat calls; it stores, embeds, and retrieves the skill Markdown the agent prepared.
  66. ## Self-hosted
  67. **Private · Single-device · Embedding key required**
  68. To run memU locally with your own storage and embedding provider, send this message to your agent:
  69. > Read [https://raw.githubusercontent.com/NevaMind-AI/MemU/main/SKILL.md](https://raw.githubusercontent.com/NevaMind-AI/MemU/main/SKILL.md) and follow it to install memU.
  70. ## Upgrading from Cola or generic
  71. The Cola and generic adapters, including `memu-cola` and `memu-agent`, have been
  72. removed. **Before upgrading**, use the previous installation to print the guide
  73. for each integration you installed:
  74. ```sh
  75. memu-cola docs uninstall
  76. memu-agent docs uninstall
  77. ```
  78. Follow the applicable guide to disable and remove that integration's scheduled
  79. tasks and managed retrieval instructions/skills. Verify ownership before deleting
  80. files or scheduler entries, and preserve user-edited or unrelated content. Keep
  81. the shared memory store, `~/.memu/config.env`, and tooling needed by other hosts.
  82. Upgrading the package does not clean up integrations; leftover tasks and retrieval
  83. instructions will call commands that no longer exist. If already upgraded, restore
  84. your previous package version to complete cleanup first.
  85. ## Uninstall
  86. To uninstall memU, send this message to your agent:
  87. > Read [https://memu.pro/SKILL.md](https://memu.pro/SKILL.md) and follow its instructions to uninstall memU.
  88. By default, uninstalling removes the host integration and tooling while keeping your memory store and `~/.memu/config.env`, so a later reinstall can resume where you left off. Memory is erased only when you explicitly ask for it.
  89. ## Host adapters: memory for desktop coding agents
  90. memU runs as a sidecar to a desktop agent, one binary per host. Each binds two seams:
  91. - **record** — a scheduled bridging task slices new session logs into self-contained job files; the agent itself distills them into memory/skill Markdown; `commit` submits whatever the agent left on disk back through `commit_results`.
  92. - **inject** — a standing instruction in the host's instruction file tells the agent to run `<binary> retrieve` (→ `progressive_retrieve`) before answering.
  93. | Host | Binary | Session log it mines | Instruction file it patches |
  94. | --- | --- | --- | --- |
  95. | Codex | `memu-codex` | `~/.codex/sessions/**/*.jsonl` | `~/.codex/AGENTS.md` |
  96. | Claude Code | `memu-claude-code` | `~/.claude/projects/<project>/<session>.jsonl` | `~/.claude/CLAUDE.md` |
  97. | Cursor (Agent/CLI) | `memu-cursor` | `~/.cursor/projects/<project>/agent-transcripts/**.jsonl` | `./AGENTS.md` (per project) |
  98. | OpenClaw | `memu-openclaw` | `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite` (SQLite, read-only) + legacy `<agentId>/sessions/*.jsonl` | `~/.openclaw/workspace/AGENTS.md` |
  99. | Hermes Agent | `memu-hermes` | `~/.hermes/state.db` (SQLite, read-only) | `~/.hermes/SOUL.md` |
  100. | WorkBuddy | `memu-workbuddy` | `~/.workbuddy/projects/<project>/<session>.jsonl` | `~/.workbuddy/SOUL.md` |
  101. | pi | `memu-pi` | `~/.pi/agent/sessions/<encoded-cwd>/<session>.jsonl` | `~/.pi/agent/AGENTS.md` |
  102. Hosts not listed above are currently unsupported for new installations.
  103. All hosts share one configured memory backend via `~/.memu/config.env` — local
  104. or MemU Cloud. What one host's sessions taught memU, another host retrieves.
  105. Installation is the one-message setup in [Quick start](#quick-start) or [Self-hosted](#self-hosted). [SKILL.md](SKILL.md) is the routing skill it hands your agent: identify your supported host, install the package, print that host's packaged install guide (`<binary> docs install`), and follow it — configure the memory backend, register the scheduled bridging task, patch the instruction file, each step behind a verify gate — then report which seams (memorization / retrieval) are now active.
  106. Afterwards `<binary> doctor` proves the whole loop resolves: config, selected
  107. mode, and a live retrieval.
  108. Adding another host means implementing one `TranscriptSource` (where its session logs live, how its records are shaped) plus a `HostSpec`-sized CLI — the pipeline, verbs, and instruction text are shared.
  109. ## Developer integration
  110. Use `memu memorize` to turn application-owned conversations into memory and skills.
  111. ## CLI
  112. With memU Cloud, sign in at [memu.so](https://memu.so) to view your memory files. With a local installation, memory lives in the shared store configured by `MEMU_DB` in `~/.memu/config.env` — typically `~/.memu/memu.sqlite3` for local SQLite, or a Postgres DSN.
  113. Once installed, your agent retrieves relevant memory automatically before answering.
  114. To retrieve manually, run the adapter for your host:
  115. ```bash
  116. memu-codex retrieve "What should I remember about this project?"
  117. # or: memu-claude-code / memu-cursor / memu-openclaw / memu-hermes / memu-workbuddy / memu-pi
  118. ```
  119. For pi, run `memu-pi install` to configure the memory backend and install the
  120. extension, then run `/reload` or open a new session. Submitted prompts start
  121. retrieval in the
  122. background; results enter the model context and resume an idle agent. After the
  123. user turn and pending retrieval settle, a background worker processes the saved
  124. conversation into memory using the active session's model. Workers share a lock
  125. and a 30-minute cooldown. Long prompts use an isolated, tool-free pi request to
  126. extract a search query with the active provider/model; extraction has a 12-second
  127. timeout and falls back to the original prefix. The installer registers and verifies
  128. the extension. Run `memu-pi uninstall` and reload to remove it.
  129. Host retrieval returns compact JSON with at most five self-contained `hits` plus independent `resources`. Each hit combines matched `text` with its source's `description`, `track`, and local mirror `path` (or inline `content` when no mirror is available). Its `score` describes the matched segment; `created_at` and `updated_at` describe the source file when available. Hits retain segment order, including excerpts whose source is missing; sources without matched excerpts remain source-only hits. Resources contain `path`, `caption`, and available scores/timestamps. Database IDs and scope metadata are omitted from the agent-facing output.
  130. Install or invoke the CLI directly:
  131. ```bash
  132. pip install memu-cli # library + memu + memu-codex CLIs
  133. npx memu-cli --help # CLI via npm launcher (engine: PyPI package memu-cli)
  134. uvx --from memu-cli memu # CLI via uv, no install
  135. ```
  136. ## Configuration
  137. Values resolve in order: process env → `~/.memu/config.env` → default. memU
  138. supports Local and Cloud memory backends, selected by `MEMU_MEMORY_MODE`; an
  139. unset mode remains Local for backward compatibility.
  140. For Local / self-hosted installations, every CLI flag has a matching variable:
  141. | Setting | Env var | Default |
  142. |---|---|---|
  143. | Store | `MEMU_DB` | `./data/memu.sqlite3` (CLI); **required** for host adapters |
  144. | Embedding provider | `MEMU_EMBED_PROVIDER` | `openai` (also: `jina`, `voyage`, `doubao`, `openrouter`); legacy `MEMU_LLM_PROVIDER` still read |
  145. | API key | `MEMU_API_KEY` | the provider's env var, e.g. `OPENAI_API_KEY` |
  146. | Embedding model | `MEMU_EMBED_MODEL` | the provider's default |
  147. | Base URL | `MEMU_BASE_URL` | the provider's default |
  148. Run `<binary> doctor` to display the resolved mode and verify the same retrieval
  149. path the host uses.
  150. ### Storage backends
  151. | Provider | DSN | Vector search | Use for |
  152. |---|---|---|---|
  153. | `inmemory` | — | brute-force cosine | tests, throwaway sessions |
  154. | `sqlite` | `sqlite:///path.sqlite3` | brute-force cosine | local/default, single writer |
  155. | `postgres` | `postgresql://...` | pgvector | concurrent access, large stores (`pip install "memu-cli[postgres]"`) |
  156. ```python
  157. service = MemoryService(
  158. database_config={"metadata_store": {"provider": "postgres", "dsn": "postgresql://..."}},
  159. embedding_profiles={"default": {"provider": "jina"}},
  160. )
  161. ```
  162. ## Community contributions
  163. Explore the community tasks ([English](docs/community/tasks.en.md) / [简体中文](docs/community/tasks.md)) and claim a task in
  164. [issue #790](https://github.com/NevaMind-AI/memU/issues/790). Each task has a stable
  165. link, a difficulty rating, and acceptance criteria. See [CONTRIBUTING.md](CONTRIBUTING.md)
  166. for development and PR guidelines.
  167. ## License
  168. Apache-2.0
  169. <sub>Partnership Community: <a href="https://linux.do">LINUX DO</a></sub>
src/memu/hosts/claude_code/cli.py · Bundled script · 110 lines · 1 finding marked
  1. """``memu-claude-code`` — the Claude Code host adapter's command-line surface.
  2. The verbs are the shared host-adapter surface (:mod:`memu.hosts.host_cli`); this
  3. module is the Claude Code declaration: where its sessions live, and which file
  4. its standing instruction lands in.
  5. Usage:
  6. memu-claude-code retrieve "<query>" # the inject seam — what the agent runs each turn
  7. memu-claude-code install-instruction # the inject seam — patch ~/.claude/CLAUDE.md to run it
  8. memu-claude-code prepare # slice new sessions into job files
  9. memu-claude-code verify-resources # filter the touched-file log (run by a job)
  10. memu-claude-code commit # submit what the agent produced back to memU
  11. memu-claude-code doctor # check config + store before relying on them
  12. memu-claude-code cowork verify # verify Cowork discovery and composition
  13. memu-claude-code docs install # print the agent-facing install guide
  14. memu-claude-code docs uninstall # print the agent-facing removal guide
  15. """
  16. from __future__ import annotations
  17. import argparse
  18. import platform
  19. import sys
  20. from typing import Any
  21. from memu.hosts import hooks
  22. from memu.hosts.bridging import Layout
  23. from memu.hosts.claude_code import auth, cowork_cmd, install, memorize_hook, prompt_hook, uninstall
  24. from memu.hosts.claude_code.desktop_sessions import ClaudeDesktopTranscriptSource
  25. from memu.hosts.claude_code.sessions import SESSION_DIR
  26. from memu.hosts.host_cli import HostSpec, run
  27. HOST = "claude-code"
  28. CLAUDE_MD = "~/.claude/CLAUDE.md"
  29. """Claude Code's global memory file — loaded into every session across every
  30. project, so the inject seam lands here. (Project-level CLAUDE.md files exist too,
  31. but the instruction belongs at the level retrieval works at: the user.)"""
  32. SKILLS_DIR = "~/.claude/skills"
  33. """Claude Code's personal skills directory. Because it exists, the CLAUDE.md block
  34. is a pointer and the retrieval procedure itself is installed here as a skill."""
  35. SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID"
  36. """Claude Code exports the running session's id to every tool subprocess, headless
  37. ``claude -p`` runs included — verified on 2.1.220. Its value is the transcript's
  38. file name (``<projects>/<escaped cwd>/<sessionId>.jsonl``), which is exactly what
  39. :meth:`TranscriptSource.session_id` reads back, so the bridging run can recognise
  40. its own session without matching any content (#606)."""
  41. async def _cmd_legacy_uninstall(args: argparse.Namespace) -> int:
  42. if platform.system() != "Windows":
  43. print(
  44. "Remove previously configured cron/launchd memU schedules manually. "
  45. "No scheduled tasks were inspected or removed.",
  46. file=sys.stderr,
  47. )
  48. return 1
  49. from memu.hosts import scheduling
  50. return scheduling.uninstall(SPEC, Layout.default(host=HOST, base=args.base_dir))
  51. def _register_extra(sub: Any) -> None:
  52. auth.register(sub)
  53. install.register(sub)
  54. uninstall.register(sub)
  55. cowork_cmd.register(sub)
  56. prompt_hook.register(sub)
  57. memorize_hook.register(sub)
  58. p = sub.add_parser("schedule", help="Remove legacy scheduled bridging registrations")
  59. p.add_argument("action", choices=("uninstall",))
  60. p.add_argument("--base-dir", default=SPEC.default_base_dir, help="memU working directory")
  61. p.set_defaults(handler=_cmd_legacy_uninstall)
  62. SPEC = HostSpec(
  63. host=HOST,
  64. display="Claude Code",
  65. package="memu.hosts.claude_code",
  66. task_name="memu-bridging-claude-code",
  67. former_task_names=("memu-remember-claude-code",),
  68. source_factory=ClaudeDesktopTranscriptSource,
  69. session_dir=SESSION_DIR,
  70. session_help="Claude Code session log (one project dir per escaped cwd)",
  71. instruction_path=CLAUDE_MD,
  72. skills_dir=SKILLS_DIR,
  73. schedule_backend="hook",
  74. session_id_env=SESSION_ID_ENV,
  75. hook=hooks.HookSpec(
  76. agent=hooks.HeadlessAgent(argv=("claude", "-p", "--dangerously-skip-permissions")),
  77. stream_output=memorize_hook.stream_agent,
  78. ),
  79. register_extra=_register_extra,
  80. install_hint=(
  81. " Install a standalone claude:\n"
  82. " winget install Anthropic.ClaudeCode\n"
  83. " # or: irm https://claude.ai/install.ps1 | iex\n"
  84. " # or: npm install -g @anthropic-ai/claude-code"
  85. ),
  86. )
  87. def main(argv: list[str] | None = None) -> int:
  88. return run(SPEC, argv)
  89. if __name__ == "__main__":
  90. sys.exit(main())
src/memu/hosts/codex/cli.py · Bundled script · 119 lines · 2 findings marked
  1. """``memu-codex`` — the Codex host adapter's command-line surface.
  2. Its own binary, not a subcommand of ``memu``, and deliberately so: ``memu`` is
  3. memU's algorithm surface, this is a *host adapter* (ADR 0008). Keeping them apart
  4. means host plumbing never accretes onto the core CLI, and ``memu --help`` keeps
  5. describing the library rather than a grab-bag.
  6. Every command here is a stable ``PATH`` contract, which is the point: the
  7. scheduled bridging task embeds these command strings in its recurring prompt, and
  8. a command survives the reinstalls and directory moves that a baked-in
  9. ``<VENV_PYTHON> /abs/path/to/script.py`` pair does not (ADR 0009).
  10. The verbs themselves are shared across every host adapter and live in
  11. :mod:`memu.hosts.host_cli`; this module is the Codex declaration.
  12. Usage:
  13. memu-codex retrieve "<query>" # the inject seam — what the agent runs each turn
  14. memu-codex install-instruction # the inject seam — patch ~/.codex/AGENTS.md to run it
  15. memu-codex prepare # slice new sessions into job files
  16. memu-codex verify-resources # filter the touched-file log (run by a job)
  17. memu-codex commit # submit what the agent produced back to memU
  18. memu-codex doctor # check backend, standalone CLI and hook definitions
  19. memu-codex docs install # print the agent-facing install guide
  20. memu-codex docs uninstall # print the agent-facing removal guide
  21. """
  22. from __future__ import annotations
  23. import argparse
  24. import sys
  25. from memu.hosts import hooks
  26. from memu.hosts.codex import (
  27. cli_prepare,
  28. install,
  29. memorize_hook,
  30. notify_console,
  31. prompt_hook,
  32. prompt_hook_install,
  33. uninstall,
  34. )
  35. from memu.hosts.codex.sessions import SESSION_DIR, CodexTranscriptSource
  36. from memu.hosts.host_cli import HostSpec, run
  37. HOST = "codex"
  38. VERIFY_COMMAND = "memu-codex verify-resources"
  39. """What the resource job tells the agent to run. A command, never a path."""
  40. AGENTS_MD = "~/.codex/AGENTS.md"
  41. """Codex's global instruction file — loaded into every session, so the inject seam
  42. lands here. The path is the only part of that seam that is Codex-specific."""
  43. SKILLS_DIR = "~/.codex/skills"
  44. """Codex's skills directory."""
  45. HOOK = hooks.HookSpec(
  46. agent=hooks.HeadlessAgent(
  47. argv=(
  48. "codex",
  49. "exec",
  50. "-c",
  51. "notify=[]",
  52. "--json",
  53. "--skip-git-repo-check",
  54. "--dangerously-bypass-approvals-and-sandbox",
  55. "-C",
  56. "{base}",
  57. "-",
  58. )
  59. ),
  60. stream_output=notify_console.stream_agent,
  61. )
  62. def _register_extra(sub: object) -> None:
  63. install.register(sub)
  64. uninstall.register(sub)
  65. cli_prepare.register(sub)
  66. prompt_hook.register(sub)
  67. memorize_hook.register(sub)
  68. prompt_hook_install.register(sub)
  69. SPEC = HostSpec(
  70. host=HOST,
  71. display="Codex",
  72. package="memu.hosts.codex",
  73. task_name="memu-bridging-codex",
  74. former_task_names=("memu-remember", "memu-bridging"),
  75. source_factory=CodexTranscriptSource,
  76. session_dir=SESSION_DIR,
  77. session_help="Codex session log",
  78. instruction_path=AGENTS_MD,
  79. skills_dir=SKILLS_DIR,
  80. schedule_backend="native",
  81. hook=HOOK,
  82. install_hint=(
  83. "Install the standalone Codex CLI using the official native installer:\n"
  84. " Windows (PowerShell): irm https://chatgpt.com/codex/install.ps1 | iex\n"
  85. " macOS/Linux: curl -fsSL https://chatgpt.com/codex/install.sh | sh\n"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 101 on GitHub
  86. "Refresh PATH, verify `codex --version`, then retry `memu-codex install-prompt-hook`."
  87. ),
  88. register_extra=_register_extra,
  89. )
  90. def build_parser() -> argparse.ArgumentParser:
  91. from memu.hosts.host_cli import build_parser as _build
  92. return _build(SPEC)
  93. def main(argv: list[str] | None = None) -> int:
  94. return run(SPEC, argv)
  95. if __name__ == "__main__":
  96. sys.exit(main())
src/memu/hosts/cursor/cli.py · Bundled script · 75 lines · 2 findings marked
  1. """``memu-cursor`` — the Cursor host adapter's command-line surface.
  2. The verbs are the shared host-adapter surface (:mod:`memu.hosts.host_cli`); this
  3. module is the Cursor declaration: where its agent transcripts live, and which
  4. file its standing instruction lands in.
  5. Usage:
  6. memu-cursor retrieve "<query>" # the inject seam — what the agent runs each turn
  7. memu-cursor install-instruction # the inject seam — patch AGENTS.md to run it
  8. memu-cursor prepare # slice new sessions into job files
  9. memu-cursor verify-resources # filter the touched-file log (run by a job)
  10. memu-cursor commit # submit what the agent produced back to memU
  11. memu-cursor doctor # check config + store before relying on them
  12. memu-cursor docs install # print the agent-facing install guide
  13. memu-cursor docs uninstall # print the agent-facing removal guide
  14. """
  15. from __future__ import annotations
  16. import sys
  17. from memu.hosts.cursor.sessions import SESSION_DIR, CursorTranscriptSource
  18. from memu.hosts.host_cli import HostSpec, run
  19. HOST = "cursor"
  20. SESSION_ID_ENV = "CURSOR_CONVERSATION_ID"
  21. AGENTS_MD = "./AGENTS.md"
  22. """Cursor has no global user-level instruction *file* (User Rules are IDE
  23. settings, out of a CLI's reach) — its Agent reads ``AGENTS.md`` from the project
  24. root. So the inject seam is per project: run ``install-instruction`` inside each
  25. project that should retrieve from memU, or pass ``--path``."""
  26. SPEC = HostSpec(
  27. host=HOST,
  28. display="Cursor",
  29. package="memu.hosts.cursor",
  30. task_name="memu-bridging-cursor",
  31. source_factory=CursorTranscriptSource,
  32. session_dir=SESSION_DIR,
  33. session_help="Cursor agent-transcript root (one project dir per escaped cwd)",
  34. instruction_path=AGENTS_MD,
  35. # --trust: cursor-agent refuses to run headless in an untrusted directory
  36. # (field-verified: exit 1 with "Workspace Trust Required"). The flag rides in
  37. # the template so both the auth gate and the scheduled run carry it, and the
  38. # trust lands on the task's working tree (~/.memu/hosts/cursor), nowhere else.
  39. # Never --yolo — that is the blanket permission skip the guides reject.
  40. schedule_backend="os",
  41. schedule_command="cursor-agent --trust -p {prompt}",
  42. # Cursor Agent 2026.08.04 injects its current conversation id into shell
  43. # tools under this name. Cursor names the transcript directory and JSONL
  44. # file with that same id, so TranscriptSource.session_id()'s stem default
  45. # maps the two sides exactly.
  46. session_id_env=SESSION_ID_ENV,
  47. needs_headless_auth=True,
  48. install_hint=(
  49. " Install the standalone Cursor Agent CLI:\n"
  50. " irm 'https://cursor.com/install?win32=true' | iex\n"
  51. " # macOS/Linux/WSL: curl https://cursor.com/install -fsSL | bash\n"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 59 on GitHub
  52. " Then re-run from a NEW terminal - this shell's PATH may predate the install."
  53. ),
  54. auth_hint=(
  55. " sign in to the Cursor IDE on this machine (the CLI reuses that account\n"
  56. " session), or run `cursor-agent login` once. Note: custom-provider (BYOK)\n"
  57. " models do not work in the CLI - runs bill the Cursor account's plan,"
  58. ),
  59. )
  60. def main(argv: list[str] | None = None) -> int:
  61. return run(SPEC, argv)
  62. if __name__ == "__main__":
  63. sys.exit(main())

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.