Skip to content

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

Rust

Merge pull request #26 from wblech/feat/uninstall-command

AkitaOnRails68c61c7de134
diff --cc CHANGELOG.md
index 441a0c26,8b8db708..6ba9ddcf
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -6,102 -6,21 +6,116 @@@ The format is based on [Keep a Changelo
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Added
+- `ai-memory bootstrap` now prunes collected sources before POSTing to the
+ server and supports `--chunk-input-tokens` to process large repositories via
+ sequential LLM calls instead of one oversized prompt.
+- Opt-in extension event metadata for `/hook`: custom integrations can
+ pass `extension=<namespace>` (and optionally `source_event=<name>`) to
+ preserve a validated third-party source event while storage keeps the
+ canonical `ObservationKind` closed. Unknown events without an extension
+ still collapse to `other` with no source-event metadata.
+- `.ai-memory.toml` marker file lets a directory tree declare its
+ `workspace` (required) and `project` (optional) without depending on
+ `basename($cwd)`. Lifecycle hook scripts walk up from `cwd` to find
+ the closest marker and forward `cwd` plus the declared names as
+ query params on `POST /hook` and `GET /handoff`. Markers can also set
+ `project_strategy = "repo-root"` to derive project identity from the
+ main git repository root, so linked worktrees share one project. Server
+ accepts the new params as optional overrides;
+ absent marker means the previous behaviour (`workspace = "default"`,
+ `project = basename(cwd)`) — fully backward compatible. See
+ [`docs/marker-file.md`](docs/marker-file.md).
+- Oh My Pi / OMP is now a first-class integration: `install-mcp --client pi`
+ and `--client omp` write native `~/.omp/agent/mcp.json` config, while
+ `install-hooks --agent omp` and `--agent pi` write the TypeScript extension
+ used for lifecycle capture and handoff injection.
+- Graph-aware retrieval: `memory_query` now combines FTS5, wikilink-neighbor
+ expansion, optional vector RRF, and bounded raw-observation fallback.
+- Observation FTS indexing and unresolved-link diagnostics surfaced through
+ admin/CLI status paths.
+- `_slots/` wiki pages are automatically pinned and surfaced in briefing /
+ explore snapshots.
+- Server-side scheduled maintenance for forget sweep and lint, with optional
+ embedding backfill scheduling.
+- Experimental native Windows support: PowerShell Docker wrapper,
+ `ai-memory.cmd`, `.ps1` lifecycle hooks in parity with `.sh` hooks, Windows
+ Tailwind hash/download support, and [`docs/windows.md`](docs/windows.md).
+- Google Gemini LLM provider via `AI_MEMORY_LLM_PROVIDER=gemini`, with
+ `gemini-2.5-flash` as the default hosted Google model and `GEMINI_API_KEY`
+ / `GOOGLE_API_KEY` support.
+- Google Gemini embeddings via `AI_MEMORY_EMBEDDING_PROVIDER=google` or
+ `gemini`, with `gemini-embedding-001` as the default embedding model and
+ `GEMINI_API_KEY` / `GOOGLE_API_KEY` support.
+- Antigravity CLI (`agy`) support for MCP config (`serverUrl`) and lifecycle
+ capture through its `PreInvocation`, `PreToolUse`, `PostToolUse`, and `Stop`
+ hook events.
+- README support matrix for operating systems, agent integrations, LLM
+ providers, and embedding providers.
+
+### Changed
+- Same-body page upserts are now true no-ops, avoiding periodic watcher
+ reconcile writes, FTS churn, and misleading recent-page timestamps.
+- Graph-neighbor expansion for hybrid search now batches all seed pages into
+ one SQL query instead of issuing incoming/outgoing lookups per seed.
+- Embedding backfill stores embeddings in chunks instead of one writer
+ command and SQLite transaction per page.
+- Hook ingestion now bounds in-flight processing and returns HTTP 429 when
+ saturated instead of spawning unbounded background tasks.
+- Documented the vector backend policy and the measured criteria required
+ before adding `sqlite-vec`.
+- Clarified Gemini CLI support docs: MCP registration, lifecycle hooks,
+ SessionStart handoff injection, and SessionEnd capture are now called out
+ consistently across README and install guides.
+- Added OpenClaw lifecycle support via a generated native plugin package and
+ updated Cursor / Claude Desktop / OpenClaw support docs against current
+ upstream MCP and hook documentation.
+- Docker images now bundle both POSIX and PowerShell hook scripts.
+
+### Fixed
+- `serve` now warns and starts when stored embedding rows were created with a
+ different `(provider, model, dim)` than the current config. Hybrid search
+ ignores stale rows until `ai-memory embed --force` or scheduled backfill
+ re-embeds them, avoiding the previous startup deadlock.
+- Session capture now persists every documented agent kind (`cursor`,
+ `gemini-cli`, `claude-desktop`, `openclaw`, `omp` / `pi`) instead of
+ failing the `sessions.agent_kind` database CHECK for agents added after
+ the initial schema.
+- `memory_handoff_begin` and `memory_handoff_accept` now resolve the active
+ project the same way the briefing/search tools do, so MCP handoffs land in
+ the project currently reported by hooks instead of the server's baked
+ default project.
+- Natural-language `memory_query` text containing bare colons, such as
+ `pick: handoff`, no longer trips FTS5 column syntax errors while explicit
+ FTS operators like `quick OR slow` remain supported.
+- Marker-file routing now reaches the generated OpenCode and OMP
+ TypeScript hook integrations, not only the POSIX/PowerShell script
+ hooks. POSIX helpers also preserve the outer hook `cwd` when nested
+ tool payloads contain their own `cwd`, and encode `+` correctly in
+ marker-derived query parameters.
+- `backup --to` now streams the tarball to disk instead of buffering the full
+ archive in CLI memory.
+- Hyphenated FTS5 queries such as `ai-memory` are normalized safely instead of
+ being parsed as column operators.
+- Gemini 2.5 Flash requests disable default dynamic thinking so hidden thought
+ tokens do not consume `maxOutputTokens` and truncate strict JSON responses.
+- `install-mcp --client claude-code` now prints the direct-edit JSON path as
+ `~/.claude.json`, matching the `--apply` path and `claude mcp add` behavior.
+ ### Added
+ - `ai-memory uninstall` — removes ai-memory's hooks, MCP registration, and
+ CLAUDE.md/AGENTS.md instruction block across all detected agents (dry-run by
+ default; `--apply` to execute, with timestamped backups). `--purge-data`
+ wipes wiki/db/raw via the reset guard. `--only hooks|mcp|instructions` to
+ narrow. Docker/volume teardown is printed as a hint, not executed.
+
+ ### Changed
+ - `ai-memory uninstall --purge-data` now previews the `wiki/`/`db/`/`raw/`
+ wipe in dry-run (mirroring `reset`) and refuses **up front** if an
+ `ai-memory` process is alive (all-or-nothing) instead of removing the
+ wiring and then skipping the purge. The data wipe is now shared with
+ `reset` via a single internal helper.
+
## [0.1.3] - 2026-05-24
### Added
diff --cc crates/ai-memory-cli/src/commands/install_hooks.rs
index 5a5f8679,95e43bc4..b61b76ba
--- a/crates/ai-memory-cli/src/commands/install_hooks.rs
+++ b/crates/ai-memory-cli/src/commands/install_hooks.rs
@@@ -107,14 -151,10 +149,11 @@@ fn apply_to_claude_code_settings
) -> Result<()> {
let path = match &args.config_file {
Some(p) => p.clone(),
- None => dirs::home_dir()
- .context("could not locate $HOME for ~/.claude/settings.json")?
- .join(".claude")
- .join("settings.json"),
+ None => claude_settings_path()?,
};
let staged = stage_hook_scripts(hooks_dir, "claude-code")?;
- let payload = build_claude_code_payload(&staged, server_url, auth_token);
+ let command_dir = staged_command_dir(&staged, "claude-code");
+ let payload = build_claude_code_payload(&command_dir, server_url, auth_token);
let our_hooks = payload
.get("hooks")
.and_then(|v| v.as_object())
@@@ -181,14 -221,10 +220,11 @@@ fn apply_to_codex_settings
) -> Result<()> {
let path = match &args.config_file {
Some(p) => p.clone(),
- None => dirs::home_dir()
- .context("could not locate $HOME for ~/.codex/hooks.json")?
- .join(".codex")
- .join("hooks.json"),
+ None => codex_hooks_path()?,
};
let staged = stage_hook_scripts(hooks_dir, "codex")?;
- let outcome = merge_codex_hooks(&staged, server_url, auth_token, &path)?;
+ let command_dir = staged_command_dir(&staged, "codex");
+ let outcome = merge_codex_hooks(&command_dir, server_url, auth_token, &path)?;
println!(
"✓ {} {} ({})",
outcome.verb(),
@@@ -276,14 -312,10 +312,11 @@@ fn apply_to_cursor_settings
) -> Result<()> {
let path = match &args.config_file {
Some(p) => p.clone(),
- None => dirs::home_dir()
- .context("could not locate $HOME for ~/.cursor/hooks.json")?
- .join(".cursor")
- .join("hooks.json"),
+ None => cursor_hooks_path()?,
};
let staged = stage_hook_scripts(hooks_dir, "cursor")?;
- let outcome = merge_cursor_hooks(&staged, server_url, auth_token, &path)?;
+ let command_dir = staged_command_dir(&staged, "cursor");
+ let outcome = merge_cursor_hooks(&command_dir, server_url, auth_token, &path)?;
println!(
"✓ {} {} ({})",
outcome.verb(),
@@@ -352,14 -384,10 +385,11 @@@ fn apply_to_gemini_settings
) -> Result<()> {
let path = match &args.config_file {
Some(p) => p.clone(),
- None => dirs::home_dir()
- .context("could not locate $HOME for ~/.gemini/settings.json")?
- .join(".gemini")
- .join("settings.json"),
+ None => gemini_settings_path()?,
};
let staged = stage_hook_scripts(hooks_dir, "gemini-cli")?;
- let outcome = merge_gemini_hooks(&staged, server_url, auth_token, &path)?;
+ let command_dir = staged_command_dir(&staged, "gemini-cli");
+ let outcome = merge_gemini_hooks(&command_dir, server_url, auth_token, &path)?;
println!(
"✓ {} {} ({})",
outcome.verb(),