What Does the `--keep-config` Option Preserve in Agent Reach?
The --keep-config flag preserves the ~/.agent-reach directory containing all user configuration, tokens, and API keys while still removing skill files and MCP server entries.
The agent-reach uninstall command in the Panniantong/Agent-Reach repository provides a --keep-config option that allows users to retain their sensitive configuration data during removal. This flag specifically targets the preservation of the local configuration directory while ensuring that skill installations and MCP server entries are still cleaned up. Understanding exactly what this option spares helps prevent accidental data loss when uninstalling the CLI tool.
Default Uninstall Behavior in Agent Reach
By default, the uninstall routine implemented in agent_reach/cli.py removes three distinct categories of data. The private helper _cmd_uninstall() orchestrates this cleanup process across specific file locations.
Configuration Directory
The command deletes the entire ~/.agent-reach folder, which houses the config.yaml file. According to lines 64-71 in agent_reach/cli.py, this file contains all saved tokens, cookies, API keys, and proxy settings established during usage.
Skill Files
The process removes skill installations from known directories including ~/.openclaw/skills/agent-reach, ~/.claude/skills/agent-reach, and ~/.agents/skills/agent-reach. These directories (or symlinks) are completely deleted according to the removal loop at lines 84-92.
MCP Server Entries
Entries added to the MCP server via the mcporter tool—such as exa and xiaohongshu—are removed using mcporter config remove commands if the binary is present on the system. This logic appears at lines 106-124 in agent_reach/cli.py.
How --keep-config Changes Uninstall Behavior
When you append --keep-config to the uninstall command, the behavior changes precisely at step one. The command skips the deletion of the ~/.agent-reach directory entirely, printing "Skipping config directory (--keep-config)" to stdout.
This means:
- Preserved: All user-provided tokens, API keys, cookies, and proxy settings in
~/.agent-reach/config.yaml - Removed: Skill files from OpenClaw, Claude Code, and generic agent directories
- Removed: MCP server entries managed by mcporter
The flag has no effect on skill cleanup or MCP entry removal; it exclusively protects the configuration directory as implemented in the conditional check at lines 64-71.
Usage Examples
# Remove everything including configuration
agent-reach uninstall
# Preserve configuration while removing skills and MCP entries
agent-reach uninstall --keep-config
# Preview what would be removed without making changes
agent-reach uninstall --dry-run
# Preview while keeping config (combines both flags)
agent-reach uninstall --dry-run --keep-config
Source Code Implementation
The uninstall logic resides in agent_reach/cli.py within the _cmd_uninstall() function. The configuration directory removal is conditional:
# Conceptual representation based on lines 64-71
if not keep_config:
shutil.rmtree(config_dir)
print(f"Removed {config_dir}")
else:
print("Skipping config directory (--keep-config)")
Lines 84-92 manage the skill directory cleanup loop, iterating through known installation paths. Lines 106-124 handle the mcporter entry cleanup by executing subprocess calls to remove configured MCP servers.
Summary
- The
--keep-configflag in Agent Reach exclusively preserves the~/.agent-reachdirectory and its contents. - Without this flag, the uninstall command removes configuration files, skill installations, and MCP server entries.
- Skill files located in
~/.openclaw/skills/,~/.claude/skills/, and~/.agents/skills/are always removed during uninstall. - MCP entries added via
mcporterare always removed regardless of the--keep-configsetting. - The implementation in
agent_reach/cli.pyuses a simple conditional check to skip the config directory deletion when the flag is present.
Frequently Asked Questions
Does --keep-config preserve skill files?
No. The --keep-config flag only affects the ~/.agent-reach configuration directory. Skill files installed in ~/.openclaw/skills/agent-reach, ~/.claude/skills/agent-reach, and ~/.agents/skills/agent-reach are always removed during uninstallation, as implemented in lines 84-92 of agent_reach/cli.py.
Can I use --keep-config with --dry-run?
Yes. Combining these flags allows you to preview the uninstallation process while confirming that the configuration directory will remain untouched. The dry-run mode reports what would be deleted without executing the actual removal commands.
What specific data is stored in the preserved configuration directory?
The ~/.agent-reach directory contains the config.yaml file, which stores all user tokens, API keys, authentication cookies, and proxy settings configured during the tool's operation. This data persists when using the --keep-config option.
Will I need to manually uninstall the Python package after running agent-reach uninstall?
Yes. The uninstall command only removes configuration, skills, and MCP entries. To completely remove the package, you must manually run pip uninstall agent-reach and optionally npm uninstall -g mcporter for the MCP tool, as suggested by the CLI output after the uninstall process completes.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →