Expand description
ai-memory install <agent> — wire ai-memory boot and the
ai-memory-mcp server into AI agents’ config files (issue #487 PR-2/3).
Each target writes a precisely-marked managed block so re-running
install is a no-op and --uninstall removes the block surgically
without disturbing user-added keys.
§Behavior summary
- Default
--dry-run: prints the diff (pretty before/after JSON, plus a unified diff over the JSON serialization) and writes nothing. --apply: writes the modified config; backs up the original to<config>.bak.<timestamp>first.--uninstall: removes the managed block, leaving any unrelated keys the user added intact.
§Idempotent marker
Every managed block has a sentinel key:
"// ai-memory:managed-block:start": "Do not edit. Managed by `ai-memory install`. https://github.com/alphaonedev/ai-memory-mcp/issues/487"plus an // ai-memory:managed-block:end sibling. When present, the
installer recognises the existing block and:
- On install: replaces it with the freshly-rendered block (so config bumps in future ai-memory releases land cleanly).
- On uninstall: removes both sentinel keys and any siblings the installer originally inserted.
§Targets
See Target for the full list. Each target’s specifics
(config path discovery, JSON shape) live in apply_target_* helpers.
Structs§
- Install
Args - Args for
ai-memory install. - Target
Args - Shared per-target args. Constructed identically for every target so the dispatch table can pull them out generically.
Enums§
- Hook
Kind - Harness-side hook variant selectable via
--hook <kind>. Today onlyPretoolis wired; future variants (e.g.PostToolUse,Stop) plug into the same dispatch shape. - Target
- Concrete target enum used internally.
TargetCmdcarries clap metadata;Targetis a stable tag for the dispatch table and derivesValueEnumfor completeness. - Target
Cmd - Per-target subcommand. Each variant carries the same shared option
set (
--apply,--uninstall,--config <path>) — clap-derive renders one subcommand per target so users get tab-completion on the agent name and per-target--help.
Functions§
- run
ai-memory install <agent>entry point.