Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

feat(uninstall): CLI surface + dispatch (stub run)

wlechda390f6d97d7
diff --git a/crates/ai-memory-cli/src/cli.rs b/crates/ai-memory-cli/src/cli.rs
index eac6872b..a5711dd2 100644
--- a/crates/ai-memory-cli/src/cli.rs
+++ b/crates/ai-memory-cli/src/cli.rs
@@ -92,6 +92,37 @@ pub enum Command {
/// Useful after renaming the project's directory on disk so the hook
/// router keeps writing into the same logical project.
RenameProject(RenameProjectArgs),
+ /// Remove ai-memory's wiring (hooks, MCP, instructions) from all
+ /// detected agents. Dry-run unless `--apply`.
+ Uninstall(UninstallArgs),
+}
+
+/// Which concern `uninstall` should touch. Omitted = all three.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
+pub enum UninstallOnly {
+ Hooks,
+ Mcp,
+ Instructions,
+}
+
+/// Arguments for `uninstall`.
+#[derive(Debug, Args)]
+pub struct UninstallArgs {
+ /// Actually modify files. Without it, prints the removal plan and
+ /// exits (dry-run), mirroring `reset` without `--confirm`.
+ #[arg(long)]
+ pub apply: bool,
+ /// After removing the wiring, wipe wiki/, db/, raw/ via the reset
+ /// path (refuses if another ai-memory process is alive). Only
+ /// meaningful with `--apply`.
+ #[arg(long)]
+ pub purge_data: bool,
+ /// Limit to one concern. Omitted = hooks + mcp + instructions.
+ #[arg(long, value_enum)]
+ pub only: Option<UninstallOnly>,
+ /// Skip the interactive confirmation when a TTY is attached.
+ #[arg(long)]
+ pub yes: bool,
}
/// Arguments for `reorg`.
diff --git a/crates/ai-memory-cli/src/commands/uninstall.rs b/crates/ai-memory-cli/src/commands/uninstall.rs
index 2de79b85..a12a350a 100644
--- a/crates/ai-memory-cli/src/commands/uninstall.rs
+++ b/crates/ai-memory-cli/src/commands/uninstall.rs
@@ -11,6 +11,19 @@ use ai_memory_core::{MARKER_END, MARKER_START};
use crate::commands::apply_shared::mutate_json;
use crate::commands::apply_shared::mutate_toml;
use crate::cli::McpClient;
+use crate::cli::UninstallArgs;
+use crate::config::Config;
+
+/// Run the `uninstall` subcommand.
+///
+/// # Errors
+/// Returns an error if a config file is malformed or a removal write
+/// fails. Absent files / nothing-to-remove are not errors.
+pub fn run(_config: &Config, _args: UninstallArgs) -> anyhow::Result<()> {
+ // Implemented in later tasks (build plan, dry-run, apply, purge).
+ println!("uninstall: not yet implemented");
+ Ok(())
+}
/// Remove the `<!-- ai-memory:start -->`…`<!-- ai-memory:end -->`
/// block (inclusive) from a CLAUDE.md / AGENTS.md. Returns the new
diff --git a/crates/ai-memory-cli/src/main.rs b/crates/ai-memory-cli/src/main.rs
index 2b9dc655..241186f6 100644
--- a/crates/ai-memory-cli/src/main.rs
+++ b/crates/ai-memory-cli/src/main.rs
@@ -61,5 +61,6 @@ async fn main() -> Result<()> {
Command::Reorg(args) => commands::reorg::run(&config, args).await,
Command::PurgeProject(args) => commands::purge_project::run(&config, args).await,
Command::RenameProject(args) => commands::rename_project::run(&config, args).await,
+ Command::Uninstall(args) => commands::uninstall::run(&config, args),
}
}