myagentmemory 0.4.13 → 0.4.15

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 CHANGED
@@ -1,29 +1,36 @@
1
- # agent-memory
1
+ # AgentMemory
2
2
 
3
- **Persistent memory for AI coding agents.** Give [Claude Code](https://claude.ai/code), [OpenAI Codex](https://github.com/openai/codex), [Cursor](https://cursor.com), and Agent (Cursor CLI) a memory that survives across sessions — long-term facts, daily logs, topic notes, and a scratchpad checklist, stored as plain markdown and searchable with [qmd](https://github.com/tobi/qmd)-powered semantic search.
3
+ **Memory that survives the agent.** AgentMemory is a local, user-owned state layer for [Claude Code](https://claude.ai/code), [OpenAI Codex](https://github.com/openai/codex), [Cursor](https://cursor.com), and Agent (Cursor CLI). Keep scratch work, daily evidence, topic notes, and durable decisions as plain Markdown, then retrieve what matters with optional [qmd](https://github.com/tobi/qmd) search.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/myagentmemory?color=cb3837&logo=npm)](https://www.npmjs.com/package/myagentmemory)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/myagentmemory?color=cb3837&logo=npm)](https://www.npmjs.com/package/myagentmemory)
7
7
  [![license](https://img.shields.io/npm/l/myagentmemory)](LICENSE)
8
8
  [![website](https://img.shields.io/badge/website-jayzeng.github.io%2Fagentmemory-0d9b7a)](https://jayzeng.github.io/agentmemory/)
9
9
 
10
- [Website and quickstart](https://jayzeng.github.io/agentmemory/) · [Install](#installation) · [CLI commands](#cli-commands) · [How it works](#how-it-works)
10
+ [Website and quickstart](https://jayzeng.github.io/agentmemory/) · [Field report: lessons from 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
11
 
12
- ## Why agent-memory?
12
+ > **Field report:** “A session records what the agent did. Memory is a judgment about what the next agent should know.” Read [What 1000+ coding agent sessions taught me about LLM memory](https://www.jayzeng.com/writing/agentmemory-field-report/).
13
13
 
14
- Coding agents forget everything between sessions. `agent-memory` gives them a durable, local-first memory so they stop re-learning your stack, your preferences, and past decisions on every run.
14
+ ## Why AgentMemory?
15
15
 
16
- - **Persistent project memory** decisions, preferences, and project context carry across sessions instead of starting cold.
17
- - **Plain Markdown, local-first** — every memory is a readable, git-friendly file on disk. No database, cloud service, or lock-in.
18
- - **Optional semantic search** — [qmd](https://github.com/tobi/qmd) adds keyword, semantic, and hybrid search across memory files.
19
- - **Explicit retrieval** — skills load base context at session start and search for related memories when a task needs them.
20
- - **Shared across agents** — Claude Code, Codex, Cursor, and Agent can use the same store.
16
+ Coding-agent sessions preserve activity. They do not decide which facts, decisions, and follow-ups should remain useful tomorrow. AgentMemory gives that accumulated state explicit lifetimes, a user-controlled home, and a path back into future work.
17
+
18
+ - **Different lifetimes and scopes** — route short-lived follow-ups, chronological evidence, continuing topics, and durable decisions to the right destination.
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.
21
24
 
22
25
  > **Naming:** `agentmemory` is the GitHub repo (and Homebrew tap), `myagentmemory` is the npm package, and `agent-memory` is the installed CLI binary. Also known as *coding agent memory* or *AI coding memory*.
23
26
 
24
27
  ### Product boundary
25
28
 
26
- AgentMemory is a local Markdown store with a CLI, optional qmd search, and agent skills. It is not a Python SDK, vector database, or knowledge graph. The Markdown files remain the source of truth.
29
+ AgentMemory is free, open-source software under the MIT License. The core is a local Markdown store with a CLI, optional qmd search, and agent skills, and it remains fully usable without an account or commercial plugin. It does not automatically import every vendor transcript or silently decide what becomes durable. It is not a Python SDK, vector database, or knowledge graph. The Markdown files remain the source of truth.
30
+
31
+ ### Optional official plugins
32
+
33
+ The MIT-licensed core can discover and host separately distributed, signed first-party plugins while remaining fully useful on its own. Optional plugins may use their own license and distribution terms; their implementation and browser assets are not part of the `myagentmemory` package. `agent-memory plugin list` and `plugin status` report local state. In an interactive terminal, `agent-memory plugin install` opens a nonce-bound loopback page for an email address, resumes the waiting command, verifies signed release metadata and the downloaded bundle, and installs atomically. The free plan uses a configurable daily agent-session allowance keyed by normalized email. D1 stores bounded activation metadata, a credential hash, and opaque SessionStart usage operations; it never receives memory, session content, queries, repository paths, raw agent session identifiers, IP addresses, or user-agent strings. Authentication and payment can extend this free activation flow later. See the [official plugin bootstrap and host contract](docs/official-plugin-bootstrap.md).
27
34
 
28
35
  ## Installation
29
36
 
@@ -35,8 +42,8 @@ brew install jayzeng/agentmemory/agent-memory
35
42
  # Install the portable CLI globally (Node.js 20+; macOS, Linux, or Windows)
36
43
  npm install -g myagentmemory
37
44
 
38
- # If you hit SSL errors due to corporate MITM/inspection, try:
39
- # npm config set strict-ssl false
45
+ # If corporate TLS inspection requires a private CA, use your organization's CA file:
46
+ # npm config set cafile /path/to/corporate-ca.pem
40
47
 
41
48
  # Or build from source
42
49
  bun run build:cli
@@ -83,7 +90,28 @@ qmd embed
83
90
 
84
91
  Without qmd, all core tools (write/read/scratchpad) work normally. Only `memory_search` and selective injection require qmd.
85
92
 
86
- ## Architecture
93
+ ## Memory lifecycle
94
+
95
+ AgentMemory implements a state lifecycle rather than a transcript archive. Scratch, daily, topic, and durable memory are destinations for different needs—not mandatory steps through which every entry must pass.
96
+
97
+ ```
98
+ Session / external evidence
99
+
100
+
101
+ Extract, qualify, or discard
102
+
103
+ ├── Scratch — short-lived follow-ups
104
+ ├── Daily — chronological evidence
105
+ ├── Topic — continuing threads
106
+ └── Durable — curated facts and decisions
107
+
108
+
109
+ Retrieve · supersede · invalidate · forget
110
+ ```
111
+
112
+ The files are the current implementation of this lifecycle. The durable state remains useful even if the agent, model, harness, or optional retriever changes. The [field report](https://www.jayzeng.com/writing/agentmemory-field-report/) explains the evidence and design lessons behind it.
113
+
114
+ ## Repository architecture
87
115
 
88
116
  ```
89
117
  ┌───────────────┐
@@ -116,8 +144,12 @@ The memory directory defaults to `~/.agent-memory/`. Override with `AGENT_MEMORY
116
144
  | `agent-memory search --query <text> [--mode keyword\|semantic\|deep] [--limit N]` | Search via qmd |
117
145
  | `agent-memory install-skills` | Install bundled SKILL.md files into local agent directories |
118
146
  | `agent-memory uninstall-skills` | Uninstall bundled SKILL.md files from local agent directories |
147
+ | `agent-memory completion [bash\|zsh\|fish\|powershell] [--stdout]` | Install or print shell completion |
148
+ | `agent-memory install-hooks [--yes] [--only <agents>]` | Install managed session-start memory hooks |
149
+ | `agent-memory uninstall-hooks [--only <agents>]` | Remove only hooks managed by AgentMemory |
119
150
  | `agent-memory init` | Create dirs, detect qmd, setup collection |
120
151
  | `agent-memory status` | Show config, qmd status, file counts |
152
+ | `agent-memory plugin <list\|status\|install\|update\|uninstall\|manage>` | Discover and manage optional signed first-party plugins |
121
153
 
122
154
  Global flags: `--dir <path>` (override directory), `--json` (machine output)
123
155
 
@@ -211,6 +243,7 @@ These are content conventions, not enforced metadata. qmd's full-text indexing m
211
243
  |----------|--------|---------|-------------|
212
244
  | `AGENT_MEMORY_DIR` | path | `~/.agent-memory` | Memory directory |
213
245
  | `AGENT_MEMORY_QMD_UPDATE` | `background`, `manual`, `off` | `background` | Controls automatic `qmd update` after writes |
246
+ | `AGENT_MEMORY_PLUGIN_DIR` | path | `~/.agent-memory/system/plugins` | Machine-local official plugin installation root; independent of `AGENT_MEMORY_DIR` |
214
247
 
215
248
  ## Running tests
216
249
 
@@ -251,16 +284,7 @@ agent-memory install-skills
251
284
 
252
285
  ## Publishing (maintainers)
253
286
 
254
- ```bash
255
- # Confirm package name is available
256
- npm view myagentmemory
257
-
258
- # Bump version (choose patch/minor/major)
259
- npm version patch
260
-
261
- # Publish to npm (public)
262
- npm publish --access public
263
- ```
287
+ Publication is tag-driven through `.github/workflows/publish-npm.yml`. Configure `jayzeng/agentmemory` and `publish-npm.yml` as the npm trusted publisher for `myagentmemory`, merge a versioned changelog/package update, and push the matching `v<version>` tag. The workflow uses short-lived OIDC credentials, runs the complete release gate, and publishes the public package with provenance. Do not publish this package from the private plugin workspace.
264
288
 
265
289
  ### Repository assets (maintainers)
266
290
 
@@ -0,0 +1,25 @@
1
+ export type CliValueKind = "directory" | "file" | "number" | "value";
2
+ export interface CliOptionSpec {
3
+ description: string;
4
+ value?: {
5
+ label: string;
6
+ kind: CliValueKind;
7
+ };
8
+ }
9
+ export declare const COMMANDS: readonly ["context", "write", "read", "scratchpad", "search", "distil", "sync", "init", "status", "install-skills", "uninstall-skills", "install-hooks", "uninstall-hooks", "completion", "plugin", "version", "help"];
10
+ export declare const PLUGIN_COMMANDS: readonly ["list", "status", "install", "update", "uninstall", "manage"];
11
+ export declare const WORKER_ACTIONS: readonly [];
12
+ export declare const SCRATCHPAD_ACTIONS: readonly ["add", "done", "undo", "clear_done", "list"];
13
+ export declare const COMMAND_DESCRIPTIONS: Record<(typeof COMMANDS)[number], string>;
14
+ export declare const PLUGIN_COMMAND_DESCRIPTIONS: Record<(typeof PLUGIN_COMMANDS)[number], string>;
15
+ export declare const WORKER_ACTION_DESCRIPTIONS: Record<(typeof WORKER_ACTIONS)[number], string>;
16
+ export declare const SCRATCHPAD_ACTION_DESCRIPTIONS: Record<(typeof SCRATCHPAD_ACTIONS)[number], string>;
17
+ export declare const GLOBAL_OPTIONS: readonly ["--dir", "--json", "--help", "--version", "-h", "-V"];
18
+ export declare const COMMAND_OPTIONS: Record<string, readonly string[]>;
19
+ export declare const PLUGIN_COMMAND_OPTIONS: Record<string, readonly string[]>;
20
+ export declare const WORKER_ACTION_OPTIONS: Record<string, readonly string[]>;
21
+ export declare const SCRATCHPAD_ACTION_OPTIONS: Record<string, readonly string[]>;
22
+ export declare const OPTION_SPECS: Record<string, CliOptionSpec>;
23
+ export declare const SHELL_DESCRIPTIONS: Record<string, string>;
24
+ export declare function optionDescription(option: string): string;
25
+ export declare function optionTakesValue(option: string): boolean;
@@ -0,0 +1,211 @@
1
+ export const COMMANDS = [
2
+ "context",
3
+ "write",
4
+ "read",
5
+ "scratchpad",
6
+ "search",
7
+ "distil",
8
+ "sync",
9
+ "init",
10
+ "status",
11
+ "install-skills",
12
+ "uninstall-skills",
13
+ "install-hooks",
14
+ "uninstall-hooks",
15
+ "completion",
16
+ "plugin",
17
+ "version",
18
+ "help",
19
+ ];
20
+ export const PLUGIN_COMMANDS = ["list", "status", "install", "update", "uninstall", "manage"];
21
+ export const WORKER_ACTIONS = [];
22
+ export const SCRATCHPAD_ACTIONS = ["add", "done", "undo", "clear_done", "list"];
23
+ export const COMMAND_DESCRIPTIONS = {
24
+ context: "build context from scratchpad, logs, topics, and long-term memory",
25
+ write: "append or overwrite a daily, topic, or long-term memory entry",
26
+ read: "read daily, topic, scratchpad, or long-term memory",
27
+ scratchpad: "add, complete, reopen, list, or clear persistent checklist items",
28
+ search: "search indexed memory with keyword, semantic, or deep qmd modes",
29
+ distil: "rebuild a compact MEMORY.md index from logs and topics",
30
+ sync: "update the qmd index and semantic embeddings",
31
+ init: "create memory storage and configure qmd when available",
32
+ status: "show memory paths, file counts, qmd, and embedding health",
33
+ "install-skills": "install core instructions for detected agents",
34
+ "uninstall-skills": "remove core instructions from detected agents",
35
+ "install-hooks": "install automatic SessionStart indexing and context hooks",
36
+ "uninstall-hooks": "remove only SessionStart hooks managed by agent-memory",
37
+ completion: "install or print Bash, Zsh, Fish, or PowerShell completion",
38
+ plugin: "index, recall, learn from, and evaluate prior agent sessions",
39
+ version: "print the installed agent-memory version",
40
+ help: "show top-level, command, or nested plugin help",
41
+ };
42
+ export const PLUGIN_COMMAND_DESCRIPTIONS = {
43
+ list: "list optional official plugins and local availability",
44
+ status: "show the installed bundle and entitlement state",
45
+ install: "authenticate if needed, then install or upgrade the official bundle",
46
+ update: "upgrade an existing official bundle when a compatible release exists",
47
+ uninstall: "remove official plugin executables while preserving user data",
48
+ manage: "open the AgentMemory account and billing website",
49
+ };
50
+ export const WORKER_ACTION_DESCRIPTIONS = {};
51
+ export const SCRATCHPAD_ACTION_DESCRIPTIONS = {
52
+ add: "add a new open checklist item; requires --text",
53
+ done: "complete the first open substring match; requires --text",
54
+ undo: "reopen the first completed substring match; requires --text",
55
+ clear_done: "remove every completed checklist item",
56
+ list: "show checklist items and completion counts",
57
+ };
58
+ export const GLOBAL_OPTIONS = ["--dir", "--json", "--help", "--version", "-h", "-V"];
59
+ export const COMMAND_OPTIONS = {
60
+ context: ["--query", "--no-search"],
61
+ write: ["--content", "--target", "--mode", "--topic", "--date", "--source-uri"],
62
+ read: ["--target", "--date", "--topic"],
63
+ scratchpad: ["--text"],
64
+ search: ["--query", "--mode", "--limit"],
65
+ distil: ["--dry-run"],
66
+ sync: [],
67
+ init: [],
68
+ status: ["--probe"],
69
+ "install-skills": [],
70
+ "uninstall-skills": [],
71
+ "install-hooks": ["--yes", "--all", "--only"],
72
+ "uninstall-hooks": ["--only"],
73
+ completion: ["--stdout"],
74
+ version: [],
75
+ help: [],
76
+ };
77
+ export const PLUGIN_COMMAND_OPTIONS = {
78
+ list: [],
79
+ status: ["--channel"],
80
+ install: ["--channel", "--no-browser", "--yes"],
81
+ update: ["--channel"],
82
+ uninstall: ["--yes"],
83
+ manage: ["--no-browser"],
84
+ };
85
+ export const WORKER_ACTION_OPTIONS = {};
86
+ export const SCRATCHPAD_ACTION_OPTIONS = {
87
+ add: ["--text"],
88
+ done: ["--text"],
89
+ undo: ["--text"],
90
+ clear_done: [],
91
+ list: [],
92
+ };
93
+ export const OPTION_SPECS = {
94
+ "--dir": { description: "override the active memory directory", value: { label: "directory", kind: "directory" } },
95
+ "--json": { description: "emit command-specific structured JSON" },
96
+ "--help": { description: "show help for the selected command" },
97
+ "--version": { description: "print the installed version and exit" },
98
+ "-h": { description: "show help for the selected command" },
99
+ "-V": { description: "print the installed version and exit" },
100
+ "--query": { description: "memory search or context-retrieval query", value: { label: "text", kind: "value" } },
101
+ "--no-search": { description: "build context without invoking qmd" },
102
+ "--content": { description: "memory entry content to persist", value: { label: "text", kind: "value" } },
103
+ "--target": { description: "memory destination or collection to read", value: { label: "target", kind: "value" } },
104
+ "--mode": { description: "write behavior or qmd search strategy", value: { label: "mode", kind: "value" } },
105
+ "--topic": { description: "topic name used to resolve a topic file", value: { label: "name", kind: "value" } },
106
+ "--date": { description: "daily-log date in YYYY-MM-DD form", value: { label: "date", kind: "value" } },
107
+ "--source-uri": {
108
+ description: "optional provenance URI stored with an entry",
109
+ value: { label: "uri", kind: "value" },
110
+ },
111
+ "--text": { description: "checklist item text or substring to match", value: { label: "text", kind: "value" } },
112
+ "--limit": { description: "maximum number of search or recall results", value: { label: "number", kind: "number" } },
113
+ "--dry-run": { description: "preview generated memory without writing MEMORY.md" },
114
+ "--probe": { description: "run a live semantic query to verify embeddings" },
115
+ "--since": { description: "metrics reporting window in days", value: { label: "days", kind: "number" } },
116
+ "--port": {
117
+ description: "web-console port; use 0 to select an available port",
118
+ value: { label: "number", kind: "number" },
119
+ },
120
+ "--state": { description: "override the plugin state root", value: { label: "directory", kind: "directory" } },
121
+ "--with-plugin": { description: "include both the core and optional plugin skills" },
122
+ "--plugin-only": { description: "operate only on the optional plugin skill" },
123
+ "--yes": { description: "apply eligible hook changes without confirmation" },
124
+ "--all": { description: "apply eligible hook changes without confirmation" },
125
+ "--only": {
126
+ description: "restrict hook changes to comma-separated agent keys",
127
+ value: { label: "agents", kind: "value" },
128
+ },
129
+ "--stdout": { description: "print the completion script without installing it" },
130
+ "--channel": {
131
+ description: "select the official release channel",
132
+ value: { label: "channel", kind: "value" },
133
+ },
134
+ "--no-browser": { description: "print account URLs instead of opening a browser" },
135
+ "--scope": {
136
+ description: "search globally or only in the current workspace",
137
+ value: { label: "scope", kind: "value" },
138
+ },
139
+ "--cwd": {
140
+ description: "restrict session operations to a working directory",
141
+ value: { label: "directory", kind: "directory" },
142
+ },
143
+ "--context": {
144
+ description: "surrounding events included with each recall hit",
145
+ value: { label: "number", kind: "number" },
146
+ },
147
+ "--pi": { description: "override the Pi session root", value: { label: "directory", kind: "directory" } },
148
+ "--codex": { description: "override the Codex session root", value: { label: "directory", kind: "directory" } },
149
+ "--claude": {
150
+ description: "override the Claude Code session root",
151
+ value: { label: "directory", kind: "directory" },
152
+ },
153
+ "--host": {
154
+ description: "session host (pi/codex/claude) or web loopback bind address",
155
+ value: { label: "host", kind: "value" },
156
+ },
157
+ "--max-per-host": {
158
+ description: "maximum session files read from each host",
159
+ value: { label: "number", kind: "number" },
160
+ },
161
+ "--recent": {
162
+ description: "most recently modified session files refreshed per host",
163
+ value: { label: "number", kind: "number" },
164
+ },
165
+ "--interval": {
166
+ description: "watch polling interval in milliseconds",
167
+ value: { label: "milliseconds", kind: "number" },
168
+ },
169
+ "--once": { description: "run one watch iteration and exit" },
170
+ "--lines": {
171
+ description: "number of recent worker log entries to return",
172
+ value: { label: "number", kind: "number" },
173
+ },
174
+ "--threshold": {
175
+ description: "minimum repeated evidence required for a candidate",
176
+ value: { label: "number", kind: "number" },
177
+ },
178
+ "--output": { description: "also write the report to this file", value: { label: "file", kind: "file" } },
179
+ "--replay": { description: "back up and rebuild derived learning layers" },
180
+ "--journal": {
181
+ description: "override the experience journal directory",
182
+ value: { label: "directory", kind: "directory" },
183
+ },
184
+ "--candidates-dir": {
185
+ description: "override the candidate ledger directory",
186
+ value: { label: "directory", kind: "directory" },
187
+ },
188
+ "--decisions-dir": {
189
+ description: "override the decision ledger directory",
190
+ value: { label: "directory", kind: "directory" },
191
+ },
192
+ "--auto-dir": {
193
+ description: "override the materialized auto-memory directory",
194
+ value: { label: "directory", kind: "directory" },
195
+ },
196
+ "--agent": { description: "internal SessionStart host key", value: { label: "agent", kind: "value" } },
197
+ "--token": { description: "internal session-worker lease token", value: { label: "token", kind: "value" } },
198
+ "--uninstall": { description: "use install-skills compatibility uninstall mode" },
199
+ };
200
+ export const SHELL_DESCRIPTIONS = {
201
+ bash: "generate or install Bash completion",
202
+ zsh: "generate or install Zsh completion",
203
+ fish: "generate or install Fish completion",
204
+ powershell: "generate or install PowerShell completion",
205
+ };
206
+ export function optionDescription(option) {
207
+ return OPTION_SPECS[option]?.description ?? option;
208
+ }
209
+ export function optionTakesValue(option) {
210
+ return OPTION_SPECS[option]?.value !== undefined;
211
+ }
package/dist/cli.d.ts CHANGED
@@ -12,6 +12,10 @@
12
12
  * search — Search via qmd
13
13
  * init — Create dirs, detect qmd, setup collection
14
14
  * status — Show config, qmd status, file counts
15
+ * completion — Install or print shell completion
16
+ * install-hooks — Install managed session-start hooks
17
+ * uninstall-hooks — Remove managed session-start hooks
18
+ * plugin — Discover and bootstrap optional official plugins
15
19
  *
16
20
  * Global flags:
17
21
  * --dir <path> Override memory directory