Repository navigation
Description
Summary
codebase-memory-mcp uninstall --help does not print help — it performs a real, destructive uninstall: it removes agent configurations (Claude Code, Codex, Gemini, VS Code, Cursor, …), skills, hooks, and deletes the installed binary, then exits 0.
This happened to me on a real machine: I ran uninstall --help to look up the flag for selective removal, and it wiped the tool from all five detected agents and deleted the binary.
Environment
- codebase-memory-mcp 0.9.0 (release binary, UI variant)
- macOS (darwin/arm64)
Reproduction (safe, uses a throwaway HOME)
FAKEHOME=$(mktemp -d)
mkdir -p "$FAKEHOME/.local/bin" "$FAKEHOME/.claude"
echo fake-binary > "$FAKEHOME/.local/bin/codebase-memory-mcp"
echo '{"mcpServers":{"codebase-memory-mcp":{"command":"x"}}}' > "$FAKEHOME/.claude/.mcp.json"
HOME="$FAKEHOME" codebase-memory-mcp uninstall --helpOutput:
codebase-memory-mcp uninstall
Claude Code: removed 0 skill(s)
removed MCP config entry
removed PreToolUse + SessionStart + SubagentStart hooks
Removed .../.local/bin/codebase-memory-mcp
Uninstall complete.
Exit code 0. The fake binary is gone and .claude/.mcp.json is emptied — help was never printed.
Root cause
Three compounding issues:
- Subcommand dispatch matches before global
--help—handle_subcommandin src/main.c scans argv positionally, so inuninstall --helpthe subcommand matches ati=1and dispatches before the--helpcheck ever seesi=2. cbm_cmd_uninstallsilently ignores unknown flags — src/cli/cli.c#L4087-L4094 only looks for-y/-n(viaparse_auto_answer) and--dry-run; anything else —--help,-h, or a typo like--dryrun— falls through to a full uninstall. Note the typo case is arguably worse:uninstall --dryrunperforms a real uninstall when the user explicitly asked for a dry run.- No confirmation gate on the destructive path — the agent-config removal and binary deletion at src/cli/cli.c#L4104-L4137 run unconditionally. The only
prompt_ynis for index deletion.prompt_ynitself fails closed on non-TTY stdin (good), but nothing destructive is behind it — so evenuninstall -n("answer no to everything") removes all configs and the binary.
The same unknown-flag blindness affects the other mutating subcommands: install --help silently rewrites agent configs, and update --help downloads and replaces the binary.
Expected behavior
uninstall --help/install --help/update --helpprint usage and exit 0 without touching anything.uninstall <unknown-flag>errors out with usage instead of running.uninstallasks for confirmation (or requires-ywhen non-interactive) before removing configs and the binary;-naborts.
Proposed fix
I have a patch ready and will open a PR referencing this issue shortly:
- a
--help/-hcheck at the top ofcbm_cmd_install,cbm_cmd_uninstall, andcbm_cmd_updatethat prints per-command usage and exits 0; - strict flag validation in
cbm_cmd_uninstall(unknown flag → error + usage, exit 1); - a
prompt_ynconfirmation gate in front of the destructive uninstall path (skipped for--dry-run;-yauto-confirms as before, matching the existingscripts/smoke-test.shphase 6b invocationuninstall --dry-run -y); - regression tests in
tests/test_cli.c.
Activity
DeusData commentedon Jul 14, 2026
Thanks for the safe throwaway-HOME reproduction. This is a high-priority 0.9.1-rc safety bug and is also labeled security because help or unknown flags must never trigger destructive configuration or binary removal. PR #1040 is the current fix candidate, but its platform smoke checks are still failing and must be resolved before review can complete.
vpzed commentedon Jul 23, 2026
Hit this same bug today on Linux. In addition the uninstall left the cbm-code-discovery-gate, cbm-session-reminder, and cbm-subagent-reminder hook files in ~/.claude/hooks so the uninstall didn't completely remove things.
DeusData commentedon Jul 24, 2026
Thanks for confirming the same behavior on Linux. The leftover
cbm-code-discovery-gate,cbm-session-reminder, andcbm-subagent-reminderfiles extend the acceptance criteria: help and unknown flags must never mutate state, and a confirmed uninstall must remove every hook file owned by this installation without touching unrelated hooks. This remains in the0.9.1-rcsafety queue.DeusData commentedon Aug 14, 2026
@metehanulusoy — you did the whole job here: a safe throwaway-
HOMEreproduction, the three compounding causes with line references, and the observation that a typo'd--dryrunis arguably worse than--help, because it performs a real uninstall while the user believes they explicitly asked for the opposite.I am sorry this hit you on a real machine and removed cbm from all five detected agents. A flag whose entire purpose is to be safe should never be destructive, and the security label on this is deserved.
A fix is up as PR #1641: the guard now runs before anything destructive happens, so
--helpprints help and unknown flags error out instead of falling through to a real uninstall. @vpzed — thank you for the Linux confirmation and for catching that thecbm-code-discovery-gate,cbm-session-reminderandcbm-subagent-reminderfiles survived the uninstall; removing every hook we own, and only those, is part of the acceptance criteria. This is in scope for tonight's v0.10.5.fix(cli): stop `uninstall --help` from performing a real uninstall
DeusData commentedon Sep 26, 2026
Thank you, @metehanulusoy, for the safe reproduction and the three-cause breakdown, and @vpzed for the Linux confirmation!
What changed:
uninstall --helpnow prints usage and exits without touching anything (v0.10.5, a530c8a).--dryrunare rejected with an error instead of falling through to a real uninstall.cbm-code-discovery-gate,cbm-session-reminderandcbm-subagent-reminderscripts and leaves unrelated hooks alone.Could you confirm on v0.11.0?
github-actions commentedon Sep 26, 2026
Thanks for the report! To move this forward we need a bit more so we can reproduce it ourselves:
codebase-memory-mcp --versionyou're onOnce that's here we'll pick it straight back up. Heads-up: issues left
awaiting-reporterare automatically closed after a few weeks of silence, but a comment reopens the door anytime.