myagentmemory 0.4.17 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -71
- package/dist/cli-spec.d.ts +7 -1
- package/dist/cli-spec.js +214 -12
- package/dist/cli.js +2053 -156
- package/dist/completions.js +24 -18
- package/dist/core.d.ts +42 -4
- package/dist/core.js +242 -68
- package/dist/hooks.d.ts +21 -1
- package/dist/hooks.js +382 -87
- package/dist/mcp-server.d.ts +27 -0
- package/dist/mcp-server.js +106 -0
- package/dist/plugin-bootstrap.js +4 -4
- package/dist/plugin-host.d.ts +34 -0
- package/dist/plugin-runtime.d.ts +22 -1
- package/dist/plugin-runtime.js +65 -2
- package/dist/plugin-service.d.ts +10 -4
- package/dist/plugin-service.js +52 -8
- package/dist/upgrade.d.ts +80 -0
- package/dist/upgrade.js +243 -0
- package/docs/official-plugin-bootstrap.md +3 -3
- package/package.json +24 -4
- package/scripts/install-skills.sh +1 -1
- package/skills/agent/SKILL.md +12 -2
- package/skills/claude-code/SKILL.md +17 -2
- package/skills/codex/SKILL.md +14 -2
- package/skills/cursor/SKILL.md +14 -2
- package/src/cli-spec.ts +218 -12
- package/src/completions.ts +26 -18
- package/src/core.ts +312 -123
- package/src/hooks.ts +395 -85
- package/src/plugin-bootstrap.ts +4 -4
- package/src/plugin-host.ts +34 -0
- package/src/cli.ts +0 -1332
- package/src/plugin-runtime.ts +0 -390
- package/src/plugin-service.ts +0 -627
package/README.md
CHANGED
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
# AgentMemory
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Your agent forgets everything. AgentMemory doesn't.**
|
|
4
|
+
|
|
5
|
+
Every new session with [Claude Code](https://claude.ai/code), [Codex](https://github.com/openai/codex), or [Cursor](https://cursor.com) starts cold — the decisions you made yesterday are gone, and you explain them again. AgentMemory gives your agents a persistent, local, plain-Markdown memory that survives across sessions and models.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g myagentmemory
|
|
9
|
+
agent-memory setup # one-shot: memory dir, skills, hooks, MCP, local Pro preview
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Then open your agent and ask *"what do you remember about me?"* — that's the wow.
|
|
4
13
|
|
|
5
14
|
[](https://www.npmjs.com/package/myagentmemory)
|
|
6
15
|
[](https://www.npmjs.com/package/myagentmemory)
|
|
7
16
|
[](LICENSE)
|
|
8
17
|
[](https://jayzeng.github.io/agentmemory/)
|
|
9
18
|
|
|
10
|
-
[Website and quickstart](https://jayzeng.github.io/agentmemory/) · [Field report:
|
|
19
|
+
[Website and quickstart](https://jayzeng.github.io/agentmemory/) · [Field report: 1,000+ coding-agent sessions](https://www.jayzeng.com/writing/agentmemory-field-report/) · [Install](#installation) · [CLI commands](#cli-commands) · [How it works](#how-it-works)
|
|
11
20
|
|
|
12
|
-
|
|
21
|
+
## Why AgentMemory
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
- AgentMemory injects your decisions, scratchpad, and daily log at session start — no copy-paste, no re-explaining.
|
|
24
|
+
- Repeated corrections become durable memory you can inspect and undo (Pro).
|
|
25
|
+
- Every memory is a plain Markdown file you own. Memory content, session content, queries, and repository paths stay on this machine.
|
|
15
26
|
|
|
16
|
-
|
|
27
|
+
AgentMemory does not provide a Python SDK, does not provide a vector database, and does not provide a knowledge graph. It is a local Markdown store with a CLI, agent skills, and optional full-text and semantic search via [qmd](https://github.com/tobi/qmd). See [product boundary](docs/product-boundary.md) for full scope.
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
- **Curated continuity** — retain judgments that should affect future work instead of warehousing every transcript and abandoned path.
|
|
20
|
-
- **Plain Markdown, local-first** — read, edit, diff, back up, or delete every memory. No database, cloud service, or lock-in.
|
|
21
|
-
- **Optional retrieval** — skills load base context at session start and search related memories explicitly when a task needs them; qmd adds keyword, semantic, and hybrid search.
|
|
22
|
-
- **Shared across agents** — Claude Code, Codex, Cursor, and Agent can use the same store even as models and harnesses change.
|
|
23
|
-
- **Correctable state** — provenance, temporal status, secret screening, supersession, and forgetting help keep retained memory aligned with reality.
|
|
29
|
+
> **Field report:** "A session records what the agent did. Memory is a judgment about what the next agent should know." Read [What 1,000+ coding agent sessions taught me about LLM memory](https://www.jayzeng.com/writing/agentmemory-field-report/).
|
|
24
30
|
|
|
25
|
-
> **Naming:** `agentmemory` is the GitHub repo (and Homebrew tap), `myagentmemory` is the npm package, and `agent-memory` is the installed CLI binary.
|
|
31
|
+
> **Naming:** `agentmemory` is the GitHub repo (and Homebrew tap), `myagentmemory` is the npm package, and `agent-memory` is the installed CLI binary. Free and MIT-licensed. See [product boundary](docs/product-boundary.md) for what it isn't.
|
|
26
32
|
|
|
27
|
-
###
|
|
33
|
+
### AgentMemory Pro preview
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
**Core remembers what you save. Pro learns from what you do.** Core remains free, MIT-licensed, and useful forever. Pro adds three things:
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
- **Remember past sessions** — ask *"what did we decide about auth?"* across Claude Code, Codex, and Cursor.
|
|
38
|
+
- **Learn from your patterns** — turn repeated corrections into memory you can inspect and undo.
|
|
39
|
+
- **Private by default** — memory and session content index locally. Pro installation uses a pseudonymous installation identifier and bounded compatibility metadata, never your memory or session content.
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
Preview what Pro would find in your existing sessions *before* installing anything:
|
|
34
42
|
|
|
35
43
|
```bash
|
|
36
|
-
agent-memory pro
|
|
44
|
+
agent-memory pro preview # local-only scan, previews up to 50 sessions/day
|
|
45
|
+
agent-memory pro install # free preview, no account required
|
|
37
46
|
agent-memory recall "what did we decide about authentication?"
|
|
38
47
|
agent-memory learn
|
|
39
48
|
agent-memory dashboard
|
|
40
49
|
```
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
Pre-install preview: up to 50 local sessions per day. Free installed preview: 20 recalls + 5 learning scans per local day. Memory, session, query, and repository content stay on your machine; installation sends only a pseudonymous identifier and bounded compatibility metadata. Full detail on [privacy, signing, and installation](docs/official-plugin-bootstrap.md).
|
|
43
52
|
|
|
44
53
|
## Installation
|
|
45
54
|
|
|
@@ -58,11 +67,8 @@ npm install -g myagentmemory
|
|
|
58
67
|
bun run build:cli
|
|
59
68
|
# => produces dist/agent-memory
|
|
60
69
|
|
|
61
|
-
#
|
|
62
|
-
agent-memory
|
|
63
|
-
|
|
64
|
-
# Install skill files for Claude Code, Codex, Cursor, and Agent
|
|
65
|
-
agent-memory install-skills
|
|
70
|
+
# One-shot setup: memory dir, qmd collection, skills, hooks, MCP registration, local Pro preview
|
|
71
|
+
agent-memory setup
|
|
66
72
|
|
|
67
73
|
# Uninstall skill files
|
|
68
74
|
agent-memory uninstall-skills
|
|
@@ -70,6 +76,8 @@ agent-memory uninstall-skills
|
|
|
70
76
|
|
|
71
77
|
The npm package installs a platform-neutral Node.js executable. The optional Homebrew and `build:cli` paths use a native binary built for the current platform.
|
|
72
78
|
|
|
79
|
+
`agent-memory setup` is the recommended entry point — it is idempotent, so re-running it after an upgrade or a partial install is always safe. Pass `--skip-skills`, `--skip-hooks`, `--skip-plugin`, or `--skip-mcp` to opt out of individual steps, or `--yes --json` for scripted/CI installs. If you want the older step-by-step interactive wizard instead, `agent-memory init` still works.
|
|
80
|
+
|
|
73
81
|
`install-skills` writes a SKILL.md into each agent's config directory:
|
|
74
82
|
- `~/.claude/skills/agent-memory/SKILL.md` — Claude Code skill
|
|
75
83
|
- `~/.codex/skills/agent-memory/SKILL.md` — Codex skill
|
|
@@ -86,7 +94,7 @@ If you're on Pi and prefer a native extension, use `pi-memory` (https://github.c
|
|
|
86
94
|
|
|
87
95
|
### Optional: Enable search with qmd
|
|
88
96
|
|
|
89
|
-
When qmd is installed, the collection is automatically set up via `agent-memory init
|
|
97
|
+
When qmd is installed, the collection is automatically set up via `agent-memory setup` (or `init`).
|
|
90
98
|
|
|
91
99
|
Note: `memory_search` **semantic**/**deep** modes require vector embeddings. If you see a warning like "need embeddings", run `qmd embed` once and retry.
|
|
92
100
|
|
|
@@ -144,27 +152,39 @@ The memory directory defaults to `~/.agent-memory/`. Override with `AGENT_MEMORY
|
|
|
144
152
|
|
|
145
153
|
## CLI Commands
|
|
146
154
|
|
|
155
|
+
Run `agent-memory help` for the full generated list, or `agent-memory <command> --help` for a command's flags and examples.
|
|
156
|
+
|
|
147
157
|
| Command | Purpose |
|
|
148
158
|
|---------|---------|
|
|
149
|
-
| `agent-memory
|
|
150
|
-
| `agent-memory
|
|
159
|
+
| `agent-memory setup [--yes] [--skip-skills] [--skip-hooks] [--skip-plugin] [--skip-mcp]` | One-shot idempotent installer: memory dir + skills + hooks + local Pro preview + MCP registration |
|
|
160
|
+
| `agent-memory context [--query <text>] [--no-search] [--layer stable\|dynamic\|full]` | Build context and optionally include qmd matches for a query |
|
|
161
|
+
| `agent-memory save "<text>"` | Shortcut: append a daily memory entry |
|
|
162
|
+
| `agent-memory note "<text>"` | Shortcut: add a scratchpad checklist item |
|
|
163
|
+
| `agent-memory write "<text>" --target <long_term\|daily\|topic> [--mode append\|overwrite] [--source-uri <uri>] [--topic <name>] [--date YYYY-MM-DD]` | Write to memory files with optional provenance |
|
|
151
164
|
| `agent-memory read --target <long_term\|scratchpad\|daily\|list\|topic\|topics> [--date YYYY-MM-DD] [--topic <name>]` | Read memory files |
|
|
152
165
|
| `agent-memory scratchpad <add\|done\|undo\|clear_done\|list> [--text <text>]` | Manage checklist |
|
|
153
|
-
| `agent-memory search --query <text> [--mode keyword\|semantic\|deep] [--limit N]` | Search via qmd |
|
|
154
|
-
| `agent-memory
|
|
166
|
+
| `agent-memory search --query <text> [--mode keyword\|semantic\|deep] [--limit N]` | Search indexed memory via qmd |
|
|
167
|
+
| `agent-memory distil [--dry-run]` | Rebuild a compact MEMORY.md index from logs and topics |
|
|
168
|
+
| `agent-memory sync` | Update the qmd index and semantic embeddings |
|
|
169
|
+
| `agent-memory install-skills [--uninstall]` | Install bundled SKILL.md files into local agent directories |
|
|
155
170
|
| `agent-memory uninstall-skills` | Uninstall bundled SKILL.md files from local agent directories |
|
|
156
171
|
| `agent-memory completion [bash\|zsh\|fish\|powershell] [--stdout]` | Install or print shell completion |
|
|
157
|
-
| `agent-memory install-hooks [--yes] [--only <agents>]` | Install managed
|
|
172
|
+
| `agent-memory install-hooks [--yes] [--all] [--only <agents>] [--mode stable\|per-turn]` | Install managed context and memory-write reminder hooks |
|
|
158
173
|
| `agent-memory uninstall-hooks [--only <agents>]` | Remove only hooks managed by AgentMemory |
|
|
159
|
-
| `agent-memory init` |
|
|
160
|
-
| `agent-memory status` | Show config, qmd status, file counts |
|
|
161
|
-
| `agent-memory
|
|
174
|
+
| `agent-memory init [--yes] [--skip-skills] [--skip-hooks]` | Legacy interactive wizard; `setup` runs this as its first step |
|
|
175
|
+
| `agent-memory status [--probe]` | Show config, qmd status, file counts, embedding health |
|
|
176
|
+
| `agent-memory doctor` | One-shot health check across memory, qmd, skills, hooks, and Pro |
|
|
177
|
+
| `agent-memory tutorial` | Guided 3-minute walkthrough in a throwaway sandbox |
|
|
178
|
+
| `agent-memory pro <install\|preview\|status\|upgrade\|manage>` | Install and manage the no-account AgentMemory Pro preview |
|
|
162
179
|
| `agent-memory recall <query>` | Recall decisions and context from prior coding sessions with Pro |
|
|
163
|
-
| `agent-memory learn` | Find repeated corrections worth remembering with Pro |
|
|
164
|
-
| `agent-memory dashboard` | Open the private local Memory Dashboard |
|
|
180
|
+
| `agent-memory learn [--preview]` | Find repeated corrections worth remembering with Pro |
|
|
181
|
+
| `agent-memory dashboard [--no-browser]` | Open the private local Memory Dashboard |
|
|
165
182
|
| `agent-memory plugin <list\|status\|install\|update\|uninstall\|manage>` | Discover and manage optional signed first-party plugins |
|
|
183
|
+
| `agent-memory serve --mcp [--register]` | Run as a Model Context Protocol (MCP) server over stdio |
|
|
184
|
+
| `agent-memory upgrade [--check] [--cli\|--plugin] [--yes]` | Check for and install newer CLI/Pro releases |
|
|
185
|
+
| `agent-memory version` | Print the installed version |
|
|
166
186
|
|
|
167
|
-
Global flags: `--dir <path>` (override directory), `--json` (machine output)
|
|
187
|
+
Global flags: `--dir <path>` (override directory), `--json` (machine output), `--help`, `--version`
|
|
168
188
|
|
|
169
189
|
### memory_search modes
|
|
170
190
|
|
|
@@ -215,13 +235,15 @@ The context builder emits the following sections in priority order. Installed sk
|
|
|
215
235
|
|
|
216
236
|
Total output, including headings and truncation notices, is hard-capped at 16,000 characters. Explicitly untrusted, expired, superseded, revoked, or retired blocks are excluded; legacy secret-like values are redacted before injection. When qmd is unavailable, the relevant-memory step is skipped and the rest still works.
|
|
217
237
|
|
|
218
|
-
|
|
238
|
+
Supported detected hosts can receive managed automatic context hooks after `agent-memory install-hooks`; Claude Code also receives a periodic memory-write reminder. Bundled skills remain the portable fallback and use explicit search when a task relates to prior work.
|
|
239
|
+
|
|
240
|
+
`context --layer` can request a subset instead of the full six-section build: `stable` (scratchpad + topics + MEMORY.md — durable facts unlikely to change with the current prompt), `dynamic` (today's log + qmd search + yesterday's log — turn-scoped, prompt-dependent), or `full` (default, all six sections). This backs the hook system's two install modes (`install-hooks --mode stable|per-turn` / `AGENT_MEMORY_HOOK_MODE`): `per-turn` (the default) installs a SessionStart hook that loads the `stable` layer once plus a UserPromptSubmit hook that reloads the `dynamic` layer every turn; `stable` mode installs SessionStart only, loading the `full` context once per session.
|
|
219
241
|
|
|
220
242
|
### Selective injection
|
|
221
243
|
|
|
222
|
-
When qmd is available and `context --query` is supplied, the CLI sanitizes the query, limits it to 200 characters, and
|
|
244
|
+
When qmd is available and `context --query` is supplied, the CLI sanitizes the query, limits it to 200 characters, and runs one fused `qmd` query (BM25 + vector, reciprocal-rank-fused server-side) against the current prompt, including the top three hits with the standard context. Programmatic integrations should spawn the CLI with an argument array so query text is not evaluated by a shell.
|
|
223
245
|
|
|
224
|
-
The search has
|
|
246
|
+
The search has an 8-second timeout and fails silently. If qmd is down or the query returns nothing, injection falls back to the standard behavior.
|
|
225
247
|
|
|
226
248
|
### Provenance, temporal state, and secret screening
|
|
227
249
|
|
|
@@ -245,7 +267,7 @@ These are content conventions, not enforced metadata. qmd's full-text indexing m
|
|
|
245
267
|
|
|
246
268
|
- **Persistence**: Memory files are plain markdown on disk — readable, editable, and git-friendly.
|
|
247
269
|
- **Tool response previews**: Write/scratchpad tools return size-capped previews instead of full file contents.
|
|
248
|
-
- **qmd auto-setup**: Via `agent-memory init
|
|
270
|
+
- **qmd auto-setup**: Via `agent-memory setup` (or `init`), the collection and path contexts are created automatically.
|
|
249
271
|
- **qmd re-indexing**: After every write, a debounced `qmd update` runs in the background (fire-and-forget, non-blocking) unless disabled via `AGENT_MEMORY_QMD_UPDATE`.
|
|
250
272
|
- **qmd embeddings**: Semantic/deep search needs vector embeddings. If you see "need embeddings" warnings, run `qmd embed` once and retry.
|
|
251
273
|
- **Graceful degradation**: If qmd is not installed, core tools work fine. `memory_search` returns install instructions.
|
|
@@ -256,7 +278,10 @@ These are content conventions, not enforced metadata. qmd's full-text indexing m
|
|
|
256
278
|
|----------|--------|---------|-------------|
|
|
257
279
|
| `AGENT_MEMORY_DIR` | path | `~/.agent-memory` | Memory directory |
|
|
258
280
|
| `AGENT_MEMORY_QMD_UPDATE` | `background`, `manual`, `off` | `background` | Controls automatic `qmd update` after writes |
|
|
281
|
+
| `AGENT_MEMORY_QMD_EMBED` | `background`, `manual`, `off` | `background` | Controls automatic embedding generation after `init`/`setup` |
|
|
259
282
|
| `AGENT_MEMORY_PLUGIN_DIR` | path | `~/.agent-memory/system/plugins` | Machine-local official plugin installation root; independent of `AGENT_MEMORY_DIR` |
|
|
283
|
+
| `AGENT_MEMORY_HOOK_MODE` | `stable`, `per-turn` | `per-turn` | SessionStart-only vs. SessionStart + UserPromptSubmit hook installation |
|
|
284
|
+
| `AGENT_MEMORY_SKILLS_ROOT` | path | auto-detected | Override where `install-skills`/`setup` look for the bundled `skills/` directory |
|
|
260
285
|
|
|
261
286
|
## Running tests
|
|
262
287
|
|
|
@@ -309,38 +334,10 @@ Publication is tag-driven through `.github/workflows/publish-npm.yml`. Configure
|
|
|
309
334
|
|
|
310
335
|
AgentMemory contains portions adapted from [pi-mem](https://github.com/jo-inc/pi-mem), used under its MIT License; the upstream copyright notice is preserved in [LICENSE](LICENSE). Semantic search is powered by [qmd](https://github.com/tobi/qmd).
|
|
311
336
|
|
|
312
|
-
##
|
|
313
|
-
|
|
314
|
-
### 0.4.12
|
|
337
|
+
## Copyright and commercial licensing
|
|
315
338
|
|
|
316
|
-
|
|
317
|
-
- **Standalone tool functions**: Extracted `memoryWrite()`, `memoryRead()`, `scratchpadAction()`, `memorySearch()` into `src/core.ts` as standalone functions usable without any framework.
|
|
318
|
-
- **Renamed package**: `pi-memory` → `myagentmemory` (npm); the CLI binary is `agent-memory`.
|
|
319
|
-
- **Renamed env var**: `PI_MEMORY_QMD_UPDATE` → `AGENT_MEMORY_QMD_UPDATE` (old name still works as fallback).
|
|
320
|
-
- **Default memory directory**: Now always `~/.agent-memory/`.
|
|
321
|
-
- **Removed pi-specific tests**: Deleted `test/e2e.ts`, `test/eval-recall.ts`, `test/unit.ts`.
|
|
339
|
+
AgentMemory Core is released under the MIT License. Jay Zeng retains copyright in his original contributions and may also offer commercial products or differently licensed versions of code for which he holds the necessary rights. Existing MIT grants remain valid, and adapted upstream portions remain subject to their preserved copyright notices and license terms.
|
|
322
340
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
- **Multi-platform support**: Memory system now works with Claude Code and OpenAI Codex via CLI + skills, in addition to pi.
|
|
326
|
-
- **Extracted shared core**: `src/core.ts` contains platform-agnostic logic (paths, truncation, scratchpad, context builder, qmd) with zero pi peer dependencies.
|
|
327
|
-
- **CLI binary**: `agent-memory` CLI with subcommands: `context`, `write`, `read`, `scratchpad`, `search`, `init`, `status`.
|
|
328
|
-
- **Skill files**: `skills/claude-code/SKILL.md` and `skills/codex/SKILL.md` for installation into respective platforms.
|
|
329
|
-
- **Configurable memory directory**: `AGENT_MEMORY_DIR` env var or `--dir` flag (default: `~/.agent-memory/`).
|
|
330
|
-
- **CLI tests**: `test/cli.test.ts` with unit and subprocess tests.
|
|
331
|
-
|
|
332
|
-
### 0.2.0
|
|
333
|
-
|
|
334
|
-
- **Selective injection**: Before each turn, the user's prompt is searched against memory via qmd. Top results are injected into the system prompt alongside standard context, surfacing relevant past decisions without explicit tool calls.
|
|
335
|
-
- **qmd auto-setup**: The extension automatically creates the collection and path contexts on session start when qmd is available. No manual `qmd collection add` needed.
|
|
336
|
-
- **Tags and links**: `memory_write` and context injection now encourage `#tags` and `[[wiki-links]]` as searchable content conventions.
|
|
337
|
-
- **Context priority reordering**: Injection order is now scratchpad > today > search results > MEMORY.md > yesterday.
|
|
338
|
-
- **Unit tests**: Added deterministic tests (no LLM/qmd needed).
|
|
339
|
-
- **Recall eval**: Added recall effectiveness evaluation.
|
|
340
|
-
|
|
341
|
-
### 0.1.0
|
|
341
|
+
## Changelog
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
- Context injection of MEMORY.md, scratchpad, and today/yesterday daily logs.
|
|
345
|
-
- qmd integration for keyword, semantic, and hybrid search.
|
|
346
|
-
- Debounced background `qmd update` after writes.
|
|
343
|
+
See [CHANGELOG.md](CHANGELOG.md) for the full release history.
|
package/dist/cli-spec.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface CliOptionSpec {
|
|
|
6
6
|
kind: CliValueKind;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
export declare const COMMANDS: readonly ["context", "write", "read", "scratchpad", "search", "distil", "sync", "
|
|
9
|
+
export declare const COMMANDS: readonly ["context", "save", "note", "write", "read", "scratchpad", "search", "distil", "sync", "setup", "status", "doctor", "tutorial", "install-skills", "uninstall-skills", "install-hooks", "uninstall-hooks", "completion", "pro", "recall", "learn", "dashboard", "plugin", "serve", "upgrade", "version", "help"];
|
|
10
10
|
export declare const PLUGIN_COMMANDS: readonly ["list", "status", "install", "update", "uninstall", "manage"];
|
|
11
11
|
export declare const WORKER_ACTIONS: readonly [];
|
|
12
12
|
export declare const SCRATCHPAD_ACTIONS: readonly ["add", "done", "undo", "clear_done", "list"];
|
|
@@ -23,3 +23,9 @@ export declare const OPTION_SPECS: Record<string, CliOptionSpec>;
|
|
|
23
23
|
export declare const SHELL_DESCRIPTIONS: Record<string, string>;
|
|
24
24
|
export declare function optionDescription(option: string): string;
|
|
25
25
|
export declare function optionTakesValue(option: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Render per-command help using existing spec metadata. Called when the user
|
|
28
|
+
* runs `agent-memory <cmd> --help` — should list the command's real flags with
|
|
29
|
+
* descriptions and one or two concrete examples, not the top-level command list.
|
|
30
|
+
*/
|
|
31
|
+
export declare function renderCommandHelp(command: string): string;
|
package/dist/cli-spec.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export const COMMANDS = [
|
|
2
2
|
"context",
|
|
3
|
+
"save",
|
|
4
|
+
"note",
|
|
3
5
|
"write",
|
|
4
6
|
"read",
|
|
5
7
|
"scratchpad",
|
|
6
8
|
"search",
|
|
7
9
|
"distil",
|
|
8
10
|
"sync",
|
|
9
|
-
"
|
|
11
|
+
"setup",
|
|
10
12
|
"status",
|
|
13
|
+
"doctor",
|
|
14
|
+
"tutorial",
|
|
11
15
|
"install-skills",
|
|
12
16
|
"uninstall-skills",
|
|
13
17
|
"install-hooks",
|
|
@@ -18,6 +22,8 @@ export const COMMANDS = [
|
|
|
18
22
|
"learn",
|
|
19
23
|
"dashboard",
|
|
20
24
|
"plugin",
|
|
25
|
+
"serve",
|
|
26
|
+
"upgrade",
|
|
21
27
|
"version",
|
|
22
28
|
"help",
|
|
23
29
|
];
|
|
@@ -26,24 +32,30 @@ export const WORKER_ACTIONS = [];
|
|
|
26
32
|
export const SCRATCHPAD_ACTIONS = ["add", "done", "undo", "clear_done", "list"];
|
|
27
33
|
export const COMMAND_DESCRIPTIONS = {
|
|
28
34
|
context: "build context from scratchpad, logs, topics, and long-term memory",
|
|
35
|
+
save: 'shortcut: agent-memory save "<text>" → daily memory entry',
|
|
36
|
+
note: 'shortcut: agent-memory note "<text>" → scratchpad checklist item',
|
|
29
37
|
write: "append or overwrite a daily, topic, or long-term memory entry",
|
|
30
38
|
read: "read daily, topic, scratchpad, or long-term memory",
|
|
31
39
|
scratchpad: "add, complete, reopen, list, or clear persistent checklist items",
|
|
32
40
|
search: "search indexed memory with keyword, semantic, or deep qmd modes",
|
|
33
41
|
distil: "rebuild a compact MEMORY.md index from logs and topics",
|
|
34
42
|
sync: "update the qmd index and semantic embeddings",
|
|
35
|
-
|
|
43
|
+
setup: "one-shot idempotent installer: init + skills + hooks + plugin + mcp",
|
|
36
44
|
status: "show memory paths, file counts, qmd, and embedding health",
|
|
45
|
+
doctor: "run a one-shot health check across memory, qmd, skills, hooks, and Pro",
|
|
46
|
+
tutorial: "guided 3-minute walkthrough in a throwaway sandbox",
|
|
37
47
|
"install-skills": "install core instructions for detected agents",
|
|
38
48
|
"uninstall-skills": "remove core instructions from detected agents",
|
|
39
|
-
"install-hooks": "install
|
|
40
|
-
"uninstall-hooks": "remove only
|
|
49
|
+
"install-hooks": "install managed context and memory-write reminder hooks",
|
|
50
|
+
"uninstall-hooks": "remove only hooks managed by agent-memory",
|
|
41
51
|
completion: "install or print Bash, Zsh, Fish, or PowerShell completion",
|
|
42
52
|
pro: "install, inspect, or upgrade AgentMemory Pro",
|
|
43
53
|
recall: "recall decisions and context from prior coding sessions with Pro",
|
|
44
54
|
learn: "find repeated corrections worth remembering with Pro",
|
|
45
55
|
dashboard: "open the private local Memory Dashboard",
|
|
46
56
|
plugin: "discover, install, update, or remove optional official plugins",
|
|
57
|
+
serve: "run as a Model Context Protocol (MCP) server over stdio",
|
|
58
|
+
upgrade: "check for and install newer agent-memory CLI and Pro plugin releases",
|
|
47
59
|
version: "print the installed agent-memory version",
|
|
48
60
|
help: "show this command overview",
|
|
49
61
|
};
|
|
@@ -65,24 +77,41 @@ export const SCRATCHPAD_ACTION_DESCRIPTIONS = {
|
|
|
65
77
|
};
|
|
66
78
|
export const GLOBAL_OPTIONS = ["--dir", "--json", "--help", "--version", "-h", "-V"];
|
|
67
79
|
export const COMMAND_OPTIONS = {
|
|
68
|
-
context: ["--query", "--no-search"],
|
|
80
|
+
context: ["--query", "--no-search", "--layer"],
|
|
81
|
+
save: ["--target"],
|
|
82
|
+
note: [],
|
|
69
83
|
write: ["--content", "--target", "--mode", "--topic", "--date", "--source-uri"],
|
|
70
84
|
read: ["--target", "--date", "--topic"],
|
|
71
85
|
scratchpad: ["--text"],
|
|
72
86
|
search: ["--query", "--mode", "--limit"],
|
|
73
87
|
distil: ["--dry-run"],
|
|
74
88
|
sync: [],
|
|
75
|
-
init: [],
|
|
89
|
+
init: ["--yes", "--skip-skills", "--skip-hooks"],
|
|
90
|
+
setup: ["--yes", "--skip-skills", "--skip-hooks", "--skip-plugin", "--skip-mcp"],
|
|
76
91
|
status: ["--probe"],
|
|
77
|
-
|
|
92
|
+
doctor: [],
|
|
93
|
+
tutorial: [],
|
|
94
|
+
"install-skills": ["--uninstall"],
|
|
78
95
|
"uninstall-skills": [],
|
|
79
|
-
"install-hooks": ["--yes", "--all", "--only"],
|
|
96
|
+
"install-hooks": ["--yes", "--all", "--only", "--mode"],
|
|
80
97
|
"uninstall-hooks": ["--only"],
|
|
81
98
|
completion: ["--stdout"],
|
|
82
99
|
pro: [],
|
|
83
|
-
recall: [
|
|
84
|
-
|
|
100
|
+
recall: [
|
|
101
|
+
"--scope",
|
|
102
|
+
"--cwd",
|
|
103
|
+
"--limit",
|
|
104
|
+
"--context",
|
|
105
|
+
"--queries",
|
|
106
|
+
"--multi",
|
|
107
|
+
"--sessions",
|
|
108
|
+
"--events",
|
|
109
|
+
"--per-query",
|
|
110
|
+
],
|
|
111
|
+
learn: ["--preview"],
|
|
85
112
|
dashboard: ["--no-browser"],
|
|
113
|
+
serve: ["--mcp", "--register", "--only"],
|
|
114
|
+
upgrade: ["--check", "--refresh", "--yes", "--quiet", "--cli", "--plugin"],
|
|
86
115
|
version: [],
|
|
87
116
|
help: [],
|
|
88
117
|
};
|
|
@@ -93,6 +122,12 @@ export const PLUGIN_COMMAND_OPTIONS = {
|
|
|
93
122
|
update: ["--channel"],
|
|
94
123
|
uninstall: ["--yes"],
|
|
95
124
|
manage: ["--no-browser"],
|
|
125
|
+
// Plugin runtime commands forwarded to the installed bundle
|
|
126
|
+
index: ["--date", "--since"],
|
|
127
|
+
recall: ["--query", "--limit", "--cwd", "--host", "--mode"],
|
|
128
|
+
worker: ["--token"],
|
|
129
|
+
learn: ["--limit", "--dry-run"],
|
|
130
|
+
eval: ["--limit"],
|
|
96
131
|
};
|
|
97
132
|
export const WORKER_ACTION_OPTIONS = {};
|
|
98
133
|
export const SCRATCHPAD_ACTION_OPTIONS = {
|
|
@@ -113,7 +148,14 @@ export const OPTION_SPECS = {
|
|
|
113
148
|
"--no-search": { description: "build context without invoking qmd" },
|
|
114
149
|
"--content": { description: "memory entry content to persist", value: { label: "text", kind: "value" } },
|
|
115
150
|
"--target": { description: "memory destination or collection to read", value: { label: "target", kind: "value" } },
|
|
116
|
-
"--mode": {
|
|
151
|
+
"--mode": {
|
|
152
|
+
description: "write behavior, qmd search strategy, or hook mode (stable|per-turn)",
|
|
153
|
+
value: { label: "mode", kind: "value" },
|
|
154
|
+
},
|
|
155
|
+
"--layer": {
|
|
156
|
+
description: "context layer to emit: stable, dynamic, or full (default)",
|
|
157
|
+
value: { label: "layer", kind: "value" },
|
|
158
|
+
},
|
|
117
159
|
"--topic": { description: "topic name used to resolve a topic file", value: { label: "name", kind: "value" } },
|
|
118
160
|
"--date": { description: "daily-log date in YYYY-MM-DD form", value: { label: "date", kind: "value" } },
|
|
119
161
|
"--source-uri": {
|
|
@@ -132,8 +174,13 @@ export const OPTION_SPECS = {
|
|
|
132
174
|
"--state": { description: "override the plugin state root", value: { label: "directory", kind: "directory" } },
|
|
133
175
|
"--with-plugin": { description: "include both the core and optional plugin skills" },
|
|
134
176
|
"--plugin-only": { description: "operate only on the optional plugin skill" },
|
|
135
|
-
"--yes": { description: "apply eligible
|
|
177
|
+
"--yes": { description: "apply eligible changes without interactive prompts" },
|
|
136
178
|
"--all": { description: "apply eligible hook changes without confirmation" },
|
|
179
|
+
"--skip-skills": { description: "init: don't prompt to install agent skills" },
|
|
180
|
+
"--skip-hooks": { description: "init: don't prompt to install SessionStart hooks" },
|
|
181
|
+
"--skip-plugin": { description: "setup: don't offer to install the paid plugin bundle" },
|
|
182
|
+
"--skip-mcp": { description: "setup: don't register the MCP server in detected local harnesses" },
|
|
183
|
+
"--preview": { description: "learn: show detected patterns without writing or consuming quota" },
|
|
137
184
|
"--only": {
|
|
138
185
|
description: "restrict hook changes to comma-separated agent keys",
|
|
139
186
|
value: { label: "agents", kind: "value" },
|
|
@@ -156,6 +203,23 @@ export const OPTION_SPECS = {
|
|
|
156
203
|
description: "surrounding events included with each recall hit",
|
|
157
204
|
value: { label: "number", kind: "number" },
|
|
158
205
|
},
|
|
206
|
+
"--queries": {
|
|
207
|
+
description: "JSON array of query strings for one-shot multi-query recall",
|
|
208
|
+
value: { label: "json", kind: "value" },
|
|
209
|
+
},
|
|
210
|
+
"--multi": { description: "treat each positional argument as a separate recall query" },
|
|
211
|
+
"--sessions": {
|
|
212
|
+
description: "maximum sessions returned by multi-query recall",
|
|
213
|
+
value: { label: "number", kind: "number" },
|
|
214
|
+
},
|
|
215
|
+
"--events": {
|
|
216
|
+
description: "top events per session returned by multi-query recall",
|
|
217
|
+
value: { label: "number", kind: "number" },
|
|
218
|
+
},
|
|
219
|
+
"--per-query": {
|
|
220
|
+
description: "candidate hits considered per query before fusion",
|
|
221
|
+
value: { label: "number", kind: "number" },
|
|
222
|
+
},
|
|
159
223
|
"--pi": { description: "override the Pi session root", value: { label: "directory", kind: "directory" } },
|
|
160
224
|
"--codex": { description: "override the Codex session root", value: { label: "directory", kind: "directory" } },
|
|
161
225
|
"--claude": {
|
|
@@ -208,6 +272,13 @@ export const OPTION_SPECS = {
|
|
|
208
272
|
"--agent": { description: "internal SessionStart host key", value: { label: "agent", kind: "value" } },
|
|
209
273
|
"--token": { description: "internal session-worker lease token", value: { label: "token", kind: "value" } },
|
|
210
274
|
"--uninstall": { description: "use install-skills compatibility uninstall mode" },
|
|
275
|
+
"--mcp": { description: "serve as an MCP server over stdio (used by Claude Code)" },
|
|
276
|
+
"--register": { description: "register the MCP server in detected supported agents and exit" },
|
|
277
|
+
"--check": { description: "upgrade: report available updates without installing" },
|
|
278
|
+
"--refresh": { description: "upgrade: force a live registry lookup and rewrite the 24h cache" },
|
|
279
|
+
"--quiet": { description: "upgrade: suppress non-error output (used by the passive session-start refresh)" },
|
|
280
|
+
"--cli": { description: "upgrade: limit action to the CLI binary" },
|
|
281
|
+
"--plugin": { description: "upgrade: limit action to the Pro plugin bundle" },
|
|
211
282
|
};
|
|
212
283
|
export const SHELL_DESCRIPTIONS = {
|
|
213
284
|
bash: "generate or install Bash completion",
|
|
@@ -221,3 +292,134 @@ export function optionDescription(option) {
|
|
|
221
292
|
export function optionTakesValue(option) {
|
|
222
293
|
return OPTION_SPECS[option]?.value !== undefined;
|
|
223
294
|
}
|
|
295
|
+
// One-line usage template per command — shows the shape agents/humans should type.
|
|
296
|
+
const COMMAND_USAGE = {
|
|
297
|
+
context: 'agent-memory context [--query "text"] [--no-search] [--json]',
|
|
298
|
+
save: 'agent-memory save "<text>" [--target daily|topic|long_term]',
|
|
299
|
+
note: 'agent-memory note "<text>"',
|
|
300
|
+
write: 'agent-memory write "<text>" [--target daily|topic|long_term] [--mode append|overwrite] [--topic <name>] [--date YYYY-MM-DD]',
|
|
301
|
+
read: "agent-memory read [--target daily|topic|long_term|scratchpad] [--date YYYY-MM-DD] [--topic <name>]",
|
|
302
|
+
scratchpad: 'agent-memory scratchpad <add|done|undo|clear_done|list> [--text "text"]',
|
|
303
|
+
search: 'agent-memory search --query "text" [--mode keyword|semantic|deep] [--limit N]',
|
|
304
|
+
distil: "agent-memory distil [--dry-run]",
|
|
305
|
+
sync: "agent-memory sync",
|
|
306
|
+
init: "agent-memory init [--yes] [--skip-skills] [--skip-hooks]",
|
|
307
|
+
setup: "agent-memory setup [--yes] [--json]",
|
|
308
|
+
status: "agent-memory status [--probe] [--json]",
|
|
309
|
+
doctor: "agent-memory doctor [--json]",
|
|
310
|
+
tutorial: "agent-memory tutorial",
|
|
311
|
+
"install-skills": "agent-memory install-skills [--json]",
|
|
312
|
+
"uninstall-skills": "agent-memory uninstall-skills [--json]",
|
|
313
|
+
"install-hooks": "agent-memory install-hooks [--yes] [--all] [--only claude,codex,cursor] [--mode stable|per-turn] [--json]",
|
|
314
|
+
"uninstall-hooks": "agent-memory uninstall-hooks [--only claude,codex,cursor] [--json]",
|
|
315
|
+
completion: "agent-memory completion [bash|zsh|fish|powershell] [--stdout]",
|
|
316
|
+
pro: "agent-memory pro <install|status|upgrade> [--channel stable] [--yes]",
|
|
317
|
+
recall: 'agent-memory recall "<query>" [--limit N] [--context N] [--scope current|global] [--cwd <path>] [--json]\n Multi-query: agent-memory recall --queries \'["q1","q2","q3"]\' [--sessions N] [--events N]',
|
|
318
|
+
learn: "agent-memory learn [--preview] [--json]",
|
|
319
|
+
dashboard: "agent-memory dashboard [--no-browser]",
|
|
320
|
+
plugin: "agent-memory plugin <list|status|install|update|uninstall|manage> [--channel stable] [--yes] [--no-browser]",
|
|
321
|
+
upgrade: "agent-memory upgrade [--check] [--yes] [--cli|--plugin] [--refresh] [--json]",
|
|
322
|
+
version: "agent-memory version",
|
|
323
|
+
help: "agent-memory help [<command>]",
|
|
324
|
+
};
|
|
325
|
+
// Concrete examples per command — what an agent or dev is most likely to want.
|
|
326
|
+
const COMMAND_EXAMPLES = {
|
|
327
|
+
save: [
|
|
328
|
+
'agent-memory save "shipped the new recall path — bundle at 1.2.3"',
|
|
329
|
+
'agent-memory save --target long_term "prefer bun test over npm test in example-api"',
|
|
330
|
+
],
|
|
331
|
+
note: ['agent-memory note "verify the digest backfill against a real corpus"'],
|
|
332
|
+
write: [
|
|
333
|
+
'agent-memory write "keep sessions in reverse-chron order" --target long_term --mode overwrite',
|
|
334
|
+
'agent-memory write "half-line summary" --target topic --topic scheduling-machine',
|
|
335
|
+
],
|
|
336
|
+
read: [
|
|
337
|
+
"agent-memory read --target long_term",
|
|
338
|
+
"agent-memory read --target daily --date 2026-08-24",
|
|
339
|
+
"agent-memory read --target topic --topic scheduling-machine",
|
|
340
|
+
],
|
|
341
|
+
scratchpad: [
|
|
342
|
+
'agent-memory scratchpad add --text "chase down the flake in test/web.test.ts"',
|
|
343
|
+
'agent-memory scratchpad done --text "chase down the flake"',
|
|
344
|
+
"agent-memory scratchpad list",
|
|
345
|
+
],
|
|
346
|
+
search: [
|
|
347
|
+
'agent-memory search --query "API test collection credentials"',
|
|
348
|
+
'agent-memory search --query "grafana alert routing" --mode semantic --limit 10',
|
|
349
|
+
],
|
|
350
|
+
recall: [
|
|
351
|
+
'agent-memory recall "API test collection for booking service"',
|
|
352
|
+
'agent-memory recall --queries \'["API test collection for booking service","booking client integration","client credential setup"]\' --sessions 5',
|
|
353
|
+
'agent-memory recall "auth refresh" --scope current --limit 5',
|
|
354
|
+
],
|
|
355
|
+
context: ["agent-memory context", 'agent-memory context --query "grafana alerts" --json'],
|
|
356
|
+
status: ["agent-memory status", "agent-memory status --json"],
|
|
357
|
+
init: ["agent-memory init", "agent-memory init --yes --skip-hooks"],
|
|
358
|
+
setup: ["agent-memory setup", "agent-memory setup --json"],
|
|
359
|
+
"install-hooks": [
|
|
360
|
+
"agent-memory install-hooks",
|
|
361
|
+
"agent-memory install-hooks --yes",
|
|
362
|
+
"agent-memory install-hooks --only claude,codex",
|
|
363
|
+
"agent-memory install-hooks --mode stable # SessionStart only (skip UserPromptSubmit)",
|
|
364
|
+
],
|
|
365
|
+
distil: ["agent-memory distil", "agent-memory distil --dry-run"],
|
|
366
|
+
learn: ["agent-memory learn", "agent-memory learn --preview # see patterns without consuming quota or writing"],
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Render per-command help using existing spec metadata. Called when the user
|
|
370
|
+
* runs `agent-memory <cmd> --help` — should list the command's real flags with
|
|
371
|
+
* descriptions and one or two concrete examples, not the top-level command list.
|
|
372
|
+
*/
|
|
373
|
+
export function renderCommandHelp(command) {
|
|
374
|
+
const canonical = command === "distill" ? "distil" : command;
|
|
375
|
+
const known = new Set([...COMMANDS, "distill", "setup"]);
|
|
376
|
+
if (!known.has(canonical)) {
|
|
377
|
+
return `agent-memory: unknown command '${command}'. Run 'agent-memory help' for the full list.`;
|
|
378
|
+
}
|
|
379
|
+
const description = COMMAND_DESCRIPTIONS[canonical] ??
|
|
380
|
+
(canonical === "setup" ? "one-shot idempotent installer: init + skills + hooks + plugin + mcp" : "");
|
|
381
|
+
const usage = COMMAND_USAGE[canonical] ?? `agent-memory ${canonical} [options]`;
|
|
382
|
+
const options = COMMAND_OPTIONS[canonical] ?? [];
|
|
383
|
+
const examples = COMMAND_EXAMPLES[canonical] ?? [];
|
|
384
|
+
const optLines = [];
|
|
385
|
+
// Command-specific options
|
|
386
|
+
for (const opt of options) {
|
|
387
|
+
const spec = OPTION_SPECS[opt];
|
|
388
|
+
if (!spec)
|
|
389
|
+
continue;
|
|
390
|
+
const label = spec.value ? `${opt} <${spec.value.label}>` : opt;
|
|
391
|
+
optLines.push(` ${label.padEnd(24)} ${spec.description}`);
|
|
392
|
+
}
|
|
393
|
+
// Global options that are always available
|
|
394
|
+
const globalKeys = ["--dir", "--json", "--help", "--version"];
|
|
395
|
+
const globalLines = globalKeys
|
|
396
|
+
.map((opt) => {
|
|
397
|
+
const spec = OPTION_SPECS[opt];
|
|
398
|
+
if (!spec)
|
|
399
|
+
return "";
|
|
400
|
+
const label = spec.value ? `${opt} <${spec.value.label}>` : opt;
|
|
401
|
+
return ` ${label.padEnd(24)} ${spec.description}`;
|
|
402
|
+
})
|
|
403
|
+
.filter(Boolean);
|
|
404
|
+
// Command-specific subactions
|
|
405
|
+
let subactionLines = "";
|
|
406
|
+
if (canonical === "scratchpad") {
|
|
407
|
+
subactionLines = `\nActions:\n${SCRATCHPAD_ACTIONS.map((a) => ` ${a.padEnd(24)} ${SCRATCHPAD_ACTION_DESCRIPTIONS[a]}`).join("\n")}\n`;
|
|
408
|
+
}
|
|
409
|
+
if (canonical === "plugin" || canonical === "pro") {
|
|
410
|
+
subactionLines = `\nSubcommands:\n${PLUGIN_COMMANDS.map((a) => ` ${a.padEnd(24)} ${PLUGIN_COMMAND_DESCRIPTIONS[a]}`).join("\n")}\n`;
|
|
411
|
+
}
|
|
412
|
+
const parts = [`agent-memory ${canonical} — ${description}`, "", "Usage:", ` ${usage}`];
|
|
413
|
+
if (subactionLines)
|
|
414
|
+
parts.push(subactionLines);
|
|
415
|
+
if (optLines.length)
|
|
416
|
+
parts.push("\nOptions:", ...optLines);
|
|
417
|
+
if (globalLines.length)
|
|
418
|
+
parts.push("\nGlobal:", ...globalLines);
|
|
419
|
+
if (examples.length) {
|
|
420
|
+
parts.push("\nExamples:");
|
|
421
|
+
for (const ex of examples)
|
|
422
|
+
parts.push(` $ ${ex}`);
|
|
423
|
+
}
|
|
424
|
+
return parts.join("\n");
|
|
425
|
+
}
|