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.
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
Markdown
[](/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
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
- ---
- name: install-memu
- 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.
- ---
- # Install memU
- > **Audience: the agent.** A user has pointed you at this file ("read SKILL.md
- > and follow it to install memU"). This skill does not contain the install
- > steps — it routes you to the right guide, which ships inside the memU package
- > and is always in sync with the installed code. Do not install from memory or
- > from blog posts; print the guide and follow it to the letter.
- memU integrates with a host agent through two seams: **record** saves session
- information into durable memory, and **inject** retrieves relevant memory before
- answering. Each supported host has its own adapter binary carrying its own
- install guide. Your job here is three steps: install the package, pick your
- binary, print and follow its guide.
- ## Before installing
- Identify the agent executing this skill and check the supported-host table in
- Step 2 before installing the package. If the host is unknown or absent from the
- table, report that it is currently unsupported and stop the installation.
- ## Before installing with Codex
- If you are Codex, check the session's effective sandbox mode before Step 1.
- Continue only with `danger-full-access`; approval policy alone is not sufficient.
- If restricted or unknown, pause and show both ways to continue: enable **Full
- access** in Codex Desktop, or restart Codex CLI with
- `codex --dangerously-bypass-approvals-and-sandbox`. Recheck the effective mode
- before proceeding. After installation, remind the user to restore their previous
- permission mode.
- ## Step 1 — install the package
- ```
- pip install --upgrade memu-cli
- ```
- `memu-cli` is the package memU ships to bridge your agent to its long-term
- memory service; it installs helper interfaces only and is harmless to run on a
- personal machine.
- **Keep the `--upgrade`.** A machine that already has an older `memu-cli` would
- otherwise keep it, and the steps below name subcommands that older builds do not
- have — the symptom is `invalid choice`. If you meet that error at any point, you
- are on a stale build: upgrade, then re-run the command that failed.
- This puts `memu` and every host-adapter binary on `PATH`. If `pip` is not the
- right tool for this machine (managed Python, uv-only), use the equivalent —
- what matters is that the binaries below resolve from a bare, non-interactive
- shell. With uv this means `uv tool install --upgrade memu-cli`, **not**
- `uv pip install`: however it is installed, `memu-cli` is a cross-session
- bridging tool and must be callable everywhere, not scoped to one project venv.
- ## Step 2 — pick your host binary
- Identify **which agent you are** (not which agents are installed — the one
- executing this skill):
- | You are | Your binary |
- | --- | --- |
- | Codex | `memu-codex` |
- | Claude Code | `memu-claude-code` |
- | Cursor (Agent/CLI) | `memu-cursor` |
- | OpenClaw | `memu-openclaw` |
- | Hermes Agent | `memu-hermes` |
- | WorkBuddy | `memu-workbuddy` |
- | pi | `memu-pi` |
- If you cannot identify your host or it is not in the table, report that it is
- currently unsupported and stop the installation.
- For Codex, Claude Code, and pi, continue directly to Step 3: their installers handle backend configuration
- and verification in one invocation. Pass any user-supplied backend inputs to that
- installer when the guide requests them.
- For other hosts, holding your binary, finish this step by creating memU's configuration
- file.
- ```
- <your-binary> init --cloud-api-key <the user's memU key>
- ```
- If the user does not mention an API key, or would rather keep memory on this
- device, run bare `<your-binary> init` and Step 3's guide will set up local memory.
- ## Step 3 — print your guide and follow it
- ```
- <your-binary> docs install
- ```
- Read what it prints, top to bottom, and follow it exactly. The host guide defines
- how to configure the backend and enable automatic recording and retrieval. Follow
- its verification gates and final report.
- Three rules that hold for every host:
- - **Install in one pass; don't stop for confirmation.** Most users want a
- silent, full install set up for them in a single call. Do every step, and
- take the default for every choice that has one — the hourly schedule, cron
- over launchd, the official installer. Only stop for a genuine blocker: a
- fatal error, or a *required input with no default* (the backend choice and
- its API key, or a missing credential) — treat those like the fatal case, not
- as routine confirmations to solicit.
- - **One backend.** If `<your-binary> config show` reports a mode with a backend
- behind it (another agent on this machine is already integrated), reuse it as
- is. A second mode or local store would split record and retrieval so the two
- installs no longer share memory.
- - **Report the outcome — with the exact template below.** If the host guide
- specifies its own final report, use that report instead. Otherwise, after installation,
- run:
- ```
- <your-binary> retrieve "When did the user register for memU?"
- ```
- Then send the user this report. **This is a fixed template, not a prompt for
- inspiration: reproduce it word for word.** Do not paraphrase it, reorder its
- sentences, summarize it, translate it, or "improve" the wording — a correct
- install ends with these exact words. The *only* things you change are the
- `<...>` placeholders, each replaced by its concrete value:
- ```
- memU is ready for `<host>` with `<mode>` memory.
- Welcome to memU. memU says the user registered on `<registration time>`.
- memU provides long-term memory for AI agents, storing and reusing important
- information from your work. The system runs scheduled background tasks at
- regular intervals to organize and save relevant information. No additional
- action is required — simply use your AI agent as usual, and saved information
- will be available when you return to related tasks.
- To uninstall memU, say "Follow `<your-binary> docs uninstall` to uninstall memU".
- ```
- Placeholders, each filled with its concrete value before you send:
- - `<host>` — the agent you are (e.g. `Claude Code`).
- - `<mode>` — the memory backend you configured in `~/.memu/config.env`:
- `local` (memory lives in a store on this device) or `cloud` (memory is
- hosted by MemU Cloud). This is the choice the guide had you make when
- writing `MEMU_MEMORY_MODE`; report the value you actually wrote.
- - `<registration time>` — the time returned by the `retrieve` call above.
- **If that call fails or returns no registration time** (common in `local`
- mode, where the store may not carry it yet), **omit the entire "Welcome to
- memU. memU says the user registered on ..." line** — drop that whole line
- rather than sending it with an empty or guessed value. Never invent a time.
- - `<your-binary>` — the binary you picked in Step 2 (e.g. `memu-claude-code`).
- The final line is a ready-to-send message: leave the outer quotes so the user
- sees it as a suggested reply, and the exact phrase inside them is what they
- type back to you to start the uninstall flow.
- If only one seam is active, report a partial setup and name the missing seam.
- ## Uninstall
- If the user asked to **uninstall** memU, identify your binary as in Step 2,
- then print and follow its removal guide —
- ```
- <your-binary> docs uninstall
- ```
- It unregisters the bridging task, removes the instruction block
- (`<your-binary> remove-instruction` — never hand-edit it out), then applies
- the defaults: the user's memory — the shared store and `~/.memu/config.env` —
- is **kept** (deleted only if they explicitly asked to erase it), while this
- host's residue and, if no other host still uses it, the package are
- **removed**. Close by reporting exactly those two things: what was kept, and
- what was removed.
README.md · README · 244 lines
- 
- <div align="center">
- # memU
- ### Personal memory, stored as Wiki
- **Across Sessions. Across Agents. Across Devices.**
- [](https://badge.fury.io/py/memu-cli)
- [](https://opensource.org/licenses/Apache-2.0)
- [](https://www.python.org/downloads/)
- [](https://discord.com/invite/hQZntfGsbJ)
- [](https://x.com/memU_ai)
- <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>
- </div>
- ---
- 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.
- ## Quick start
- 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).
- ## Agent support
- This matrix lists the currently tested memU integrations by operating system.
- - **Memorize** — capture useful session knowledge through a scheduled background task and turn it into reusable memory.
- - **Retrieve** — bring relevant memory into a future task.
- - **⚠️** — supported with an important limitation; see the user note.
- ### macOS
- | Agent | Mode | Memorize | Retrieve | User note |
- | --- | --- | :---: | :---: | --- |
- | ChatGPT | ChatGPT(Work mode), codex and VS Code extension | ✅ | ✅ | |
- | ChatGPT | Chat | ❌ | ❌ | Chat mode is not currently supported. Please use Work mode. |
- | 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. |
- | Claude | Chat and Cowork | ❌ | ❌ | |
- | Cursor | — | ✅ | ✅ | |
- | OpenClaw | — | ✅ | ✅ | Retrieve support has not yet been verified. |
- | Hermes Agent | — | ✅ | ✅ | |
- | WorkBuddy | — | ✅ | ✅ | |
- ### Windows
- | Agent | Mode | Memorize | Retrieve | User note |
- | --- | --- | :---: | :---: | --- |
- | ChatGPT | ChatGPT(Work mode), codex and VS Code extension | ✅ | ✅ | |
- | ChatGPT | Chat | ❌ | ❌ | Chat mode is not currently supported. Please use Work mode. |
- | 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. |
- | Claude | Chat and Cowork | ❌ | ❌ | |
- | Cursor | — | ✅ | ✅ | |
- | OpenClaw | — | ✅ | ✅ | |
- | Hermes Agent | — | ✅ | ⚠️ | Use a memU version with Windows `HERMES_HOME` support; older versions may retrieve from the wrong files. |
- | WorkBuddy | — | ✅ | ✅ | With Hy3, retrieval may fail. Retry with another model if this happens. |
- ### Linux
- | Agent | Mode | Memorize | Retrieve | User note |
- | --- | --- | :---: | :---: | --- |
- | Codex | VS Code extension | ❌ | ✅ | |
- | Claude Code | CLI | ✅ | ✅ | |
- | OpenClaw | 4.23 / 7.1 | ✅ | ✅ | |
- Support status reflects the current release and may change as host integrations evolve.
- ## How it works
- 
- ## Automatic skill extraction
- Once the scheduled bridging task is installed, memU can turn useful agent history into reusable Markdown skills automatically.
- 
- 1. **Capture new sessions.** The host adapter reads new session history, including messages and tool calls.
- 2. **Prepare self-evolve jobs.** `prepare` slices each session into a self-contained job with the paths and context the agent needs.
- 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.
- 4. **Write readable skill Markdown.** Each skill has a name, description, and reusable workflow, including useful branches, edge cases, and pitfalls.
- 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.
- 6. **Retrieve it later.** On a similar future task, memU returns the relevant skill so any connected agent can use the learned workflow.
- 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.
- ## Self-hosted
- **Private · Single-device · Embedding key required**
- To run memU locally with your own storage and embedding provider, send this message to your agent:
- > 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.
- ## Upgrading from Cola or generic
- The Cola and generic adapters, including `memu-cola` and `memu-agent`, have been
- removed. **Before upgrading**, use the previous installation to print the guide
- for each integration you installed:
- ```sh
- memu-cola docs uninstall
- memu-agent docs uninstall
- ```
- Follow the applicable guide to disable and remove that integration's scheduled
- tasks and managed retrieval instructions/skills. Verify ownership before deleting
- files or scheduler entries, and preserve user-edited or unrelated content. Keep
- the shared memory store, `~/.memu/config.env`, and tooling needed by other hosts.
- Upgrading the package does not clean up integrations; leftover tasks and retrieval
- instructions will call commands that no longer exist. If already upgraded, restore
- your previous package version to complete cleanup first.
- ## Uninstall
- To uninstall memU, send this message to your agent:
- > Read [https://memu.pro/SKILL.md](https://memu.pro/SKILL.md) and follow its instructions to uninstall memU.
- 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.
- ## Host adapters: memory for desktop coding agents
- memU runs as a sidecar to a desktop agent, one binary per host. Each binds two seams:
- - **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`.
- - **inject** — a standing instruction in the host's instruction file tells the agent to run `<binary> retrieve` (→ `progressive_retrieve`) before answering.
- | Host | Binary | Session log it mines | Instruction file it patches |
- | --- | --- | --- | --- |
- | Codex | `memu-codex` | `~/.codex/sessions/**/*.jsonl` | `~/.codex/AGENTS.md` |
- | Claude Code | `memu-claude-code` | `~/.claude/projects/<project>/<session>.jsonl` | `~/.claude/CLAUDE.md` |
- | Cursor (Agent/CLI) | `memu-cursor` | `~/.cursor/projects/<project>/agent-transcripts/**.jsonl` | `./AGENTS.md` (per project) |
- | OpenClaw | `memu-openclaw` | `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite` (SQLite, read-only) + legacy `<agentId>/sessions/*.jsonl` | `~/.openclaw/workspace/AGENTS.md` |
- | Hermes Agent | `memu-hermes` | `~/.hermes/state.db` (SQLite, read-only) | `~/.hermes/SOUL.md` |
- | WorkBuddy | `memu-workbuddy` | `~/.workbuddy/projects/<project>/<session>.jsonl` | `~/.workbuddy/SOUL.md` |
- | pi | `memu-pi` | `~/.pi/agent/sessions/<encoded-cwd>/<session>.jsonl` | `~/.pi/agent/AGENTS.md` |
- Hosts not listed above are currently unsupported for new installations.
- All hosts share one configured memory backend via `~/.memu/config.env` — local
- or MemU Cloud. What one host's sessions taught memU, another host retrieves.
- 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.
- Afterwards `<binary> doctor` proves the whole loop resolves: config, selected
- mode, and a live retrieval.
- 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.
- ## Developer integration
- Use `memu memorize` to turn application-owned conversations into memory and skills.
- ## CLI
- 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.
- Once installed, your agent retrieves relevant memory automatically before answering.
- To retrieve manually, run the adapter for your host:
- ```bash
- memu-codex retrieve "What should I remember about this project?"
- # or: memu-claude-code / memu-cursor / memu-openclaw / memu-hermes / memu-workbuddy / memu-pi
- ```
- For pi, run `memu-pi install` to configure the memory backend and install the
- extension, then run `/reload` or open a new session. Submitted prompts start
- retrieval in the
- background; results enter the model context and resume an idle agent. After the
- user turn and pending retrieval settle, a background worker processes the saved
- conversation into memory using the active session's model. Workers share a lock
- and a 30-minute cooldown. Long prompts use an isolated, tool-free pi request to
- extract a search query with the active provider/model; extraction has a 12-second
- timeout and falls back to the original prefix. The installer registers and verifies
- the extension. Run `memu-pi uninstall` and reload to remove it.
- 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.
- Install or invoke the CLI directly:
- ```bash
- pip install memu-cli # library + memu + memu-codex CLIs
- npx memu-cli --help # CLI via npm launcher (engine: PyPI package memu-cli)
- uvx --from memu-cli memu # CLI via uv, no install
- ```
- ## Configuration
- Values resolve in order: process env → `~/.memu/config.env` → default. memU
- supports Local and Cloud memory backends, selected by `MEMU_MEMORY_MODE`; an
- unset mode remains Local for backward compatibility.
- For Local / self-hosted installations, every CLI flag has a matching variable:
- | Setting | Env var | Default |
- |---|---|---|
- | Store | `MEMU_DB` | `./data/memu.sqlite3` (CLI); **required** for host adapters |
- | Embedding provider | `MEMU_EMBED_PROVIDER` | `openai` (also: `jina`, `voyage`, `doubao`, `openrouter`); legacy `MEMU_LLM_PROVIDER` still read |
- | API key | `MEMU_API_KEY` | the provider's env var, e.g. `OPENAI_API_KEY` |
- | Embedding model | `MEMU_EMBED_MODEL` | the provider's default |
- | Base URL | `MEMU_BASE_URL` | the provider's default |
- Run `<binary> doctor` to display the resolved mode and verify the same retrieval
- path the host uses.
- ### Storage backends
- | Provider | DSN | Vector search | Use for |
- |---|---|---|---|
- | `inmemory` | — | brute-force cosine | tests, throwaway sessions |
- | `sqlite` | `sqlite:///path.sqlite3` | brute-force cosine | local/default, single writer |
- | `postgres` | `postgresql://...` | pgvector | concurrent access, large stores (`pip install "memu-cli[postgres]"`) |
- ```python
- service = MemoryService(
- database_config={"metadata_store": {"provider": "postgres", "dsn": "postgresql://..."}},
- embedding_profiles={"default": {"provider": "jina"}},
- )
- ```
- ## Community contributions
- Explore the community tasks ([English](docs/community/tasks.en.md) / [简体中文](docs/community/tasks.md)) and claim a task in
- [issue #790](https://github.com/NevaMind-AI/memU/issues/790). Each task has a stable
- link, a difficulty rating, and acceptance criteria. See [CONTRIBUTING.md](CONTRIBUTING.md)
- for development and PR guidelines.
- ## License
- Apache-2.0
- <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
- """``memu-claude-code`` — the Claude Code host adapter's command-line surface.
- The verbs are the shared host-adapter surface (:mod:`memu.hosts.host_cli`); this
- module is the Claude Code declaration: where its sessions live, and which file
- its standing instruction lands in.
- Usage:
- memu-claude-code retrieve "<query>" # the inject seam — what the agent runs each turn
- memu-claude-code install-instruction # the inject seam — patch ~/.claude/CLAUDE.md to run it
- memu-claude-code prepare # slice new sessions into job files
- memu-claude-code verify-resources # filter the touched-file log (run by a job)
- memu-claude-code commit # submit what the agent produced back to memU
- memu-claude-code doctor # check config + store before relying on them
- memu-claude-code cowork verify # verify Cowork discovery and composition
- memu-claude-code docs install # print the agent-facing install guide
- memu-claude-code docs uninstall # print the agent-facing removal guide
- """
- from __future__ import annotations
- import argparse
- import platform
- import sys
- from typing import Any
- from memu.hosts import hooks
- from memu.hosts.bridging import Layout
- from memu.hosts.claude_code import auth, cowork_cmd, install, memorize_hook, prompt_hook, uninstall
- from memu.hosts.claude_code.desktop_sessions import ClaudeDesktopTranscriptSource
- from memu.hosts.claude_code.sessions import SESSION_DIR
- from memu.hosts.host_cli import HostSpec, run
- HOST = "claude-code"
- CLAUDE_MD = "~/.claude/CLAUDE.md"
- """Claude Code's global memory file — loaded into every session across every
- project, so the inject seam lands here. (Project-level CLAUDE.md files exist too,
- but the instruction belongs at the level retrieval works at: the user.)"""
- SKILLS_DIR = "~/.claude/skills"
- """Claude Code's personal skills directory. Because it exists, the CLAUDE.md block
- is a pointer and the retrieval procedure itself is installed here as a skill."""
- SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID"
- """Claude Code exports the running session's id to every tool subprocess, headless
- ``claude -p`` runs included — verified on 2.1.220. Its value is the transcript's
- file name (``<projects>/<escaped cwd>/<sessionId>.jsonl``), which is exactly what
- :meth:`TranscriptSource.session_id` reads back, so the bridging run can recognise
- its own session without matching any content (#606)."""
- async def _cmd_legacy_uninstall(args: argparse.Namespace) -> int:
- if platform.system() != "Windows":
- print(
- "Remove previously configured cron/launchd memU schedules manually. "
- "No scheduled tasks were inspected or removed.",
- file=sys.stderr,
- )
- return 1
- from memu.hosts import scheduling
- return scheduling.uninstall(SPEC, Layout.default(host=HOST, base=args.base_dir))
- def _register_extra(sub: Any) -> None:
- auth.register(sub)
- install.register(sub)
- uninstall.register(sub)
- cowork_cmd.register(sub)
- prompt_hook.register(sub)
- memorize_hook.register(sub)
- p = sub.add_parser("schedule", help="Remove legacy scheduled bridging registrations")
- p.add_argument("action", choices=("uninstall",))
- p.add_argument("--base-dir", default=SPEC.default_base_dir, help="memU working directory")
- p.set_defaults(handler=_cmd_legacy_uninstall)
- SPEC = HostSpec(
- host=HOST,
- display="Claude Code",
- package="memu.hosts.claude_code",
- task_name="memu-bridging-claude-code",
- former_task_names=("memu-remember-claude-code",),
- source_factory=ClaudeDesktopTranscriptSource,
- session_dir=SESSION_DIR,
- session_help="Claude Code session log (one project dir per escaped cwd)",
- instruction_path=CLAUDE_MD,
- skills_dir=SKILLS_DIR,
- schedule_backend="hook",
- session_id_env=SESSION_ID_ENV,
- hook=hooks.HookSpec(
- agent=hooks.HeadlessAgent(argv=("claude", "-p", "--dangerously-skip-permissions")),
- Note: Starts a coding agent with its permission prompts off
- Line 92 on GitHub
- stream_output=memorize_hook.stream_agent,
- ),
- register_extra=_register_extra,
- install_hint=(
- " Install a standalone claude:\n"
- " winget install Anthropic.ClaudeCode\n"
- " # or: irm https://claude.ai/install.ps1 | iex\n"
- " # or: npm install -g @anthropic-ai/claude-code"
- ),
- )
- def main(argv: list[str] | None = None) -> int:
- return run(SPEC, argv)
- if __name__ == "__main__":
- sys.exit(main())
src/memu/hosts/codex/cli.py · Bundled script · 119 lines · 2 findings marked
- """``memu-codex`` — the Codex host adapter's command-line surface.
- Its own binary, not a subcommand of ``memu``, and deliberately so: ``memu`` is
- memU's algorithm surface, this is a *host adapter* (ADR 0008). Keeping them apart
- means host plumbing never accretes onto the core CLI, and ``memu --help`` keeps
- describing the library rather than a grab-bag.
- Every command here is a stable ``PATH`` contract, which is the point: the
- scheduled bridging task embeds these command strings in its recurring prompt, and
- a command survives the reinstalls and directory moves that a baked-in
- ``<VENV_PYTHON> /abs/path/to/script.py`` pair does not (ADR 0009).
- The verbs themselves are shared across every host adapter and live in
- :mod:`memu.hosts.host_cli`; this module is the Codex declaration.
- Usage:
- memu-codex retrieve "<query>" # the inject seam — what the agent runs each turn
- memu-codex install-instruction # the inject seam — patch ~/.codex/AGENTS.md to run it
- memu-codex prepare # slice new sessions into job files
- memu-codex verify-resources # filter the touched-file log (run by a job)
- memu-codex commit # submit what the agent produced back to memU
- memu-codex doctor # check backend, standalone CLI and hook definitions
- memu-codex docs install # print the agent-facing install guide
- memu-codex docs uninstall # print the agent-facing removal guide
- """
- from __future__ import annotations
- import argparse
- import sys
- from memu.hosts import hooks
- from memu.hosts.codex import (
- cli_prepare,
- install,
- memorize_hook,
- notify_console,
- prompt_hook,
- prompt_hook_install,
- uninstall,
- )
- from memu.hosts.codex.sessions import SESSION_DIR, CodexTranscriptSource
- from memu.hosts.host_cli import HostSpec, run
- HOST = "codex"
- VERIFY_COMMAND = "memu-codex verify-resources"
- """What the resource job tells the agent to run. A command, never a path."""
- AGENTS_MD = "~/.codex/AGENTS.md"
- """Codex's global instruction file — loaded into every session, so the inject seam
- lands here. The path is the only part of that seam that is Codex-specific."""
- SKILLS_DIR = "~/.codex/skills"
- """Codex's skills directory."""
- HOOK = hooks.HookSpec(
- agent=hooks.HeadlessAgent(
- argv=(
- "codex",
- "exec",
- "-c",
- "notify=[]",
- "--json",
- "--skip-git-repo-check",
- "--dangerously-bypass-approvals-and-sandbox",
- "-C",
- "{base}",
- "-",
- )
- ),
- stream_output=notify_console.stream_agent,
- )
- def _register_extra(sub: object) -> None:
- install.register(sub)
- uninstall.register(sub)
- cli_prepare.register(sub)
- prompt_hook.register(sub)
- memorize_hook.register(sub)
- prompt_hook_install.register(sub)
- SPEC = HostSpec(
- host=HOST,
- display="Codex",
- package="memu.hosts.codex",
- task_name="memu-bridging-codex",
- former_task_names=("memu-remember", "memu-bridging"),
- source_factory=CodexTranscriptSource,
- session_dir=SESSION_DIR,
- session_help="Codex session log",
- instruction_path=AGENTS_MD,
- skills_dir=SKILLS_DIR,
- schedule_backend="native",
- hook=HOOK,
- install_hint=(
- "Install the standalone Codex CLI using the official native installer:\n"
- " Windows (PowerShell): irm https://chatgpt.com/codex/install.ps1 | iex\n"
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 100 on GitHub
- " 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
- "Refresh PATH, verify `codex --version`, then retry `memu-codex install-prompt-hook`."
- ),
- register_extra=_register_extra,
- )
- def build_parser() -> argparse.ArgumentParser:
- from memu.hosts.host_cli import build_parser as _build
- return _build(SPEC)
- def main(argv: list[str] | None = None) -> int:
- return run(SPEC, argv)
- if __name__ == "__main__":
- sys.exit(main())
src/memu/hosts/cursor/cli.py · Bundled script · 75 lines · 2 findings marked
- """``memu-cursor`` — the Cursor host adapter's command-line surface.
- The verbs are the shared host-adapter surface (:mod:`memu.hosts.host_cli`); this
- module is the Cursor declaration: where its agent transcripts live, and which
- file its standing instruction lands in.
- Usage:
- memu-cursor retrieve "<query>" # the inject seam — what the agent runs each turn
- memu-cursor install-instruction # the inject seam — patch AGENTS.md to run it
- memu-cursor prepare # slice new sessions into job files
- memu-cursor verify-resources # filter the touched-file log (run by a job)
- memu-cursor commit # submit what the agent produced back to memU
- memu-cursor doctor # check config + store before relying on them
- memu-cursor docs install # print the agent-facing install guide
- memu-cursor docs uninstall # print the agent-facing removal guide
- """
- from __future__ import annotations
- import sys
- from memu.hosts.cursor.sessions import SESSION_DIR, CursorTranscriptSource
- from memu.hosts.host_cli import HostSpec, run
- HOST = "cursor"
- SESSION_ID_ENV = "CURSOR_CONVERSATION_ID"
- AGENTS_MD = "./AGENTS.md"
- """Cursor has no global user-level instruction *file* (User Rules are IDE
- settings, out of a CLI's reach) — its Agent reads ``AGENTS.md`` from the project
- root. So the inject seam is per project: run ``install-instruction`` inside each
- project that should retrieve from memU, or pass ``--path``."""
- SPEC = HostSpec(
- host=HOST,
- display="Cursor",
- package="memu.hosts.cursor",
- task_name="memu-bridging-cursor",
- source_factory=CursorTranscriptSource,
- session_dir=SESSION_DIR,
- session_help="Cursor agent-transcript root (one project dir per escaped cwd)",
- instruction_path=AGENTS_MD,
- # --trust: cursor-agent refuses to run headless in an untrusted directory
- # (field-verified: exit 1 with "Workspace Trust Required"). The flag rides in
- # the template so both the auth gate and the scheduled run carry it, and the
- # trust lands on the task's working tree (~/.memu/hosts/cursor), nowhere else.
- # Never --yolo — that is the blanket permission skip the guides reject.
- schedule_backend="os",
- schedule_command="cursor-agent --trust -p {prompt}",
- # Cursor Agent 2026.08.04 injects its current conversation id into shell
- # tools under this name. Cursor names the transcript directory and JSONL
- # file with that same id, so TranscriptSource.session_id()'s stem default
- # maps the two sides exactly.
- session_id_env=SESSION_ID_ENV,
- needs_headless_auth=True,
- install_hint=(
- " Install the standalone Cursor Agent CLI:\n"
- " irm 'https://cursor.com/install?win32=true' | iex\n"
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 58 on GitHub
- " # 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
- " Then re-run from a NEW terminal - this shell's PATH may predate the install."
- ),
- auth_hint=(
- " sign in to the Cursor IDE on this machine (the CLI reuses that account\n"
- " session), or run `cursor-agent login` once. Note: custom-provider (BYOK)\n"
- " models do not work in the CLI - runs bill the Cursor account's plan,"
- ),
- )
- def main(argv: list[str] | None = None) -> int:
- return run(SPEC, argv)
- if __name__ == "__main__":
- sys.exit(main())
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.