feat(mem0-plugin): auto coding categories, global search, OpenCode parity (#5300)
This commit is contained in:
@@ -141,29 +141,27 @@ Parse the auto_import output and print a user-friendly summary:
|
||||
- Project file import failed. Check API key and retry with: /mem0:onboard
|
||||
```
|
||||
|
||||
## Step 5: Install coding categories
|
||||
## Step 5: Coding categories (automatic)
|
||||
|
||||
The setup script is idempotent — it compares existing categories against the proposed set and skips the API call if they already match (tolerates order differences and extra API fields). Safe to re-run.
|
||||
Coding categories optimized for development workflows are installed **automatically in the background on session start** — the same way project files are imported (Step 4). The user is no longer asked. This step only verifies they are in place and applies them if the background run hasn't finished yet.
|
||||
|
||||
Ask: "Install coding categories optimized for development workflows? [Y/n]"
|
||||
The installer is idempotent and self-caching: it compares existing categories against the proposed set, skips the API call when they already match, and skips all network calls entirely once applied for this account (re-applying only if the taxonomy changes). Safe to run anytime.
|
||||
|
||||
If yes, run the setup script using the plugin's venv python:
|
||||
Run it in the foreground to verify, using the plugin's venv python:
|
||||
|
||||
```bash
|
||||
VENV_PY="${CLAUDE_PLUGIN_DATA}/venv/bin/python3"
|
||||
if [ -x "${VENV_PY}" ]; then
|
||||
"${VENV_PY}" "${CLAUDE_PLUGIN_ROOT}/scripts/setup_coding_categories.py" --apply
|
||||
MEM0_DEBUG=1 "${VENV_PY}" "${CLAUDE_PLUGIN_ROOT}/scripts/auto_setup_categories.py"
|
||||
else
|
||||
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/setup_coding_categories.py" --apply
|
||||
MEM0_DEBUG=1 python3 "${CLAUDE_PLUGIN_ROOT}/scripts/auto_setup_categories.py"
|
||||
fi
|
||||
```
|
||||
|
||||
Parse the output:
|
||||
- `"Categories already match -- skipping update."` → Print: `- Coding categories already installed. Skipped.`
|
||||
- `"Done."` → Print: `- Coding categories installed (<N> categories).`
|
||||
- Error → Print the error and suggest re-running `/mem0:onboard`.
|
||||
|
||||
If the script fails with "mem0ai SDK not found", run the dependency installer first:
|
||||
- contains `Applied <N> coding categories` → Print: `- Coding categories installed (<N> categories).`
|
||||
- contains `already configured` → Print: `- Coding categories already configured.`
|
||||
- error or `SDK not ready` → run the dependency installer first, then retry:
|
||||
```bash
|
||||
"${CLAUDE_PLUGIN_ROOT}/scripts/ensure_deps.sh"
|
||||
```
|
||||
@@ -177,7 +175,7 @@ Print a summary:
|
||||
user_id: <user_id>
|
||||
project_id: <project_id> (app_id)
|
||||
files: <N> found, <M> imported
|
||||
categories: <N installed | already installed | skipped by user>
|
||||
categories: <installed | already configured>
|
||||
|
||||
Memory is now active for this project. Start working — mem0 will
|
||||
automatically search relevant context and capture learnings.
|
||||
|
||||
@@ -1,18 +1,75 @@
|
||||
---
|
||||
name: switch-project
|
||||
description: Overrides the auto-detected project scope to read and write memories under a different project ID. Use when working across multiple projects, accessing memories from another repo, or when auto-detection resolves to the wrong project.
|
||||
description: Overrides the auto-detected project scope to read and write memories under a different project ID, or enables global search to access all memories across all users and projects. Use when working across multiple projects, accessing memories from another repo, enabling team-wide memory access, or when auto-detection resolves to the wrong project.
|
||||
---
|
||||
|
||||
# Mem0 Switch Project
|
||||
|
||||
Override the automatic project_id detection for the current directory.
|
||||
Override the automatic project_id detection for the current directory, or enable global search mode.
|
||||
|
||||
## Usage
|
||||
|
||||
The user provides a project name as an argument: `/mem0:switch-project <project-name>`
|
||||
- `/mem0:switch-project <project-name>` — switch to a specific project scope
|
||||
- `/mem0:switch-project --global` — enable global search (all memories, all users, all projects)
|
||||
- `/mem0:switch-project --no-global` — disable global search and return to per-project scoping
|
||||
|
||||
## Execution
|
||||
|
||||
### If `--global` flag is provided:
|
||||
|
||||
1. Set `global_search: true` in `~/.mem0/settings.json` using the Bash tool:
|
||||
|
||||
```bash
|
||||
python3 -c "
|
||||
import json, os
|
||||
settings_file = os.path.expanduser('~/.mem0/settings.json')
|
||||
settings = {}
|
||||
if os.path.isfile(settings_file):
|
||||
with open(settings_file) as f:
|
||||
settings = json.load(f)
|
||||
settings['global_search'] = True
|
||||
with open(settings_file, 'w') as f:
|
||||
json.dump(settings, f, indent=2)
|
||||
print('Global search enabled')
|
||||
"
|
||||
```
|
||||
|
||||
2. Print:
|
||||
```
|
||||
Global search enabled.
|
||||
Searches now return all memories across all users and projects.
|
||||
Writes still use the current user_id and app_id.
|
||||
Restart the session for the change to take effect.
|
||||
```
|
||||
|
||||
### If `--no-global` flag is provided:
|
||||
|
||||
1. Set `global_search: false` in `~/.mem0/settings.json` using the Bash tool:
|
||||
|
||||
```bash
|
||||
python3 -c "
|
||||
import json, os
|
||||
settings_file = os.path.expanduser('~/.mem0/settings.json')
|
||||
settings = {}
|
||||
if os.path.isfile(settings_file):
|
||||
with open(settings_file) as f:
|
||||
settings = json.load(f)
|
||||
settings['global_search'] = False
|
||||
with open(settings_file, 'w') as f:
|
||||
json.dump(settings, f, indent=2)
|
||||
print('Global search disabled')
|
||||
"
|
||||
```
|
||||
|
||||
2. Print:
|
||||
```
|
||||
Global search disabled.
|
||||
Searches now return only memories scoped to the current project.
|
||||
Restart the session for the change to take effect.
|
||||
```
|
||||
|
||||
### If a project name is provided (no flags):
|
||||
|
||||
1. If no project name was given, ask: "What project_id should this directory use?"
|
||||
|
||||
2. Write the mapping to `~/.mem0/project_map.json` using the Bash tool:
|
||||
|
||||
Reference in New Issue
Block a user