myagentmemory 0.4.12 → 0.4.14

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.
@@ -0,0 +1,236 @@
1
+ export type CliValueKind = "directory" | "file" | "number" | "value";
2
+
3
+ export interface CliOptionSpec {
4
+ description: string;
5
+ value?: {
6
+ label: string;
7
+ kind: CliValueKind;
8
+ };
9
+ }
10
+
11
+ export const COMMANDS = [
12
+ "context",
13
+ "write",
14
+ "read",
15
+ "scratchpad",
16
+ "search",
17
+ "distil",
18
+ "sync",
19
+ "init",
20
+ "status",
21
+ "install-skills",
22
+ "uninstall-skills",
23
+ "install-hooks",
24
+ "uninstall-hooks",
25
+ "completion",
26
+ "plugin",
27
+ "version",
28
+ "help",
29
+ ] as const;
30
+
31
+ export const PLUGIN_COMMANDS = ["list", "status", "install", "update", "uninstall", "manage"] as const;
32
+
33
+ export const WORKER_ACTIONS = [] as const;
34
+ export const SCRATCHPAD_ACTIONS = ["add", "done", "undo", "clear_done", "list"] as const;
35
+
36
+ export const COMMAND_DESCRIPTIONS: Record<(typeof COMMANDS)[number], string> = {
37
+ context: "build context from scratchpad, logs, topics, and long-term memory",
38
+ write: "append or overwrite a daily, topic, or long-term memory entry",
39
+ read: "read daily, topic, scratchpad, or long-term memory",
40
+ scratchpad: "add, complete, reopen, list, or clear persistent checklist items",
41
+ search: "search indexed memory with keyword, semantic, or deep qmd modes",
42
+ distil: "rebuild a compact MEMORY.md index from logs and topics",
43
+ sync: "update the qmd index and semantic embeddings",
44
+ init: "create memory storage and configure qmd when available",
45
+ status: "show memory paths, file counts, qmd, and embedding health",
46
+ "install-skills": "install core instructions for detected agents",
47
+ "uninstall-skills": "remove core instructions from detected agents",
48
+ "install-hooks": "install automatic SessionStart indexing and context hooks",
49
+ "uninstall-hooks": "remove only SessionStart hooks managed by agent-memory",
50
+ completion: "install or print Bash, Zsh, Fish, or PowerShell completion",
51
+ plugin: "index, recall, learn from, and evaluate prior agent sessions",
52
+ version: "print the installed agent-memory version",
53
+ help: "show top-level, command, or nested plugin help",
54
+ };
55
+
56
+ export const PLUGIN_COMMAND_DESCRIPTIONS: Record<(typeof PLUGIN_COMMANDS)[number], string> = {
57
+ list: "list optional official plugins and local availability",
58
+ status: "show the installed bundle and entitlement state",
59
+ install: "authenticate if needed, then install or upgrade the official bundle",
60
+ update: "upgrade an existing official bundle when a compatible release exists",
61
+ uninstall: "remove official plugin executables while preserving user data",
62
+ manage: "open the AgentMemory account and billing website",
63
+ };
64
+
65
+ export const WORKER_ACTION_DESCRIPTIONS: Record<(typeof WORKER_ACTIONS)[number], string> = {};
66
+
67
+ export const SCRATCHPAD_ACTION_DESCRIPTIONS: Record<(typeof SCRATCHPAD_ACTIONS)[number], string> = {
68
+ add: "add a new open checklist item; requires --text",
69
+ done: "complete the first open substring match; requires --text",
70
+ undo: "reopen the first completed substring match; requires --text",
71
+ clear_done: "remove every completed checklist item",
72
+ list: "show checklist items and completion counts",
73
+ };
74
+
75
+ export const GLOBAL_OPTIONS = ["--dir", "--json", "--help", "--version", "-h", "-V"] as const;
76
+
77
+ export const COMMAND_OPTIONS: Record<string, readonly string[]> = {
78
+ context: ["--query", "--no-search"],
79
+ write: ["--content", "--target", "--mode", "--topic", "--date", "--source-uri"],
80
+ read: ["--target", "--date", "--topic"],
81
+ scratchpad: ["--text"],
82
+ search: ["--query", "--mode", "--limit"],
83
+ distil: ["--dry-run"],
84
+ sync: [],
85
+ init: [],
86
+ status: ["--probe"],
87
+ "install-skills": [],
88
+ "uninstall-skills": [],
89
+ "install-hooks": ["--yes", "--all", "--only"],
90
+ "uninstall-hooks": ["--only"],
91
+ completion: ["--stdout"],
92
+ version: [],
93
+ help: [],
94
+ };
95
+
96
+ export const PLUGIN_COMMAND_OPTIONS: Record<string, readonly string[]> = {
97
+ list: [],
98
+ status: ["--channel"],
99
+ install: ["--channel", "--no-browser", "--yes"],
100
+ update: ["--channel"],
101
+ uninstall: ["--yes"],
102
+ manage: ["--no-browser"],
103
+ };
104
+
105
+ export const WORKER_ACTION_OPTIONS: Record<string, readonly string[]> = {};
106
+
107
+ export const SCRATCHPAD_ACTION_OPTIONS: Record<string, readonly string[]> = {
108
+ add: ["--text"],
109
+ done: ["--text"],
110
+ undo: ["--text"],
111
+ clear_done: [],
112
+ list: [],
113
+ };
114
+
115
+ export const OPTION_SPECS: Record<string, CliOptionSpec> = {
116
+ "--dir": { description: "override the active memory directory", value: { label: "directory", kind: "directory" } },
117
+ "--json": { description: "emit command-specific structured JSON" },
118
+ "--help": { description: "show help for the selected command" },
119
+ "--version": { description: "print the installed version and exit" },
120
+ "-h": { description: "show help for the selected command" },
121
+ "-V": { description: "print the installed version and exit" },
122
+ "--query": { description: "memory search or context-retrieval query", value: { label: "text", kind: "value" } },
123
+ "--no-search": { description: "build context without invoking qmd" },
124
+ "--content": { description: "memory entry content to persist", value: { label: "text", kind: "value" } },
125
+ "--target": { description: "memory destination or collection to read", value: { label: "target", kind: "value" } },
126
+ "--mode": { description: "write behavior or qmd search strategy", value: { label: "mode", kind: "value" } },
127
+ "--topic": { description: "topic name used to resolve a topic file", value: { label: "name", kind: "value" } },
128
+ "--date": { description: "daily-log date in YYYY-MM-DD form", value: { label: "date", kind: "value" } },
129
+ "--source-uri": {
130
+ description: "optional provenance URI stored with an entry",
131
+ value: { label: "uri", kind: "value" },
132
+ },
133
+ "--text": { description: "checklist item text or substring to match", value: { label: "text", kind: "value" } },
134
+ "--limit": { description: "maximum number of search or recall results", value: { label: "number", kind: "number" } },
135
+ "--dry-run": { description: "preview generated memory without writing MEMORY.md" },
136
+ "--probe": { description: "run a live semantic query to verify embeddings" },
137
+ "--since": { description: "metrics reporting window in days", value: { label: "days", kind: "number" } },
138
+ "--port": {
139
+ description: "web-console port; use 0 to select an available port",
140
+ value: { label: "number", kind: "number" },
141
+ },
142
+ "--state": { description: "override the plugin state root", value: { label: "directory", kind: "directory" } },
143
+ "--with-plugin": { description: "include both the core and optional plugin skills" },
144
+ "--plugin-only": { description: "operate only on the optional plugin skill" },
145
+ "--yes": { description: "apply eligible hook changes without confirmation" },
146
+ "--all": { description: "apply eligible hook changes without confirmation" },
147
+ "--only": {
148
+ description: "restrict hook changes to comma-separated agent keys",
149
+ value: { label: "agents", kind: "value" },
150
+ },
151
+ "--stdout": { description: "print the completion script without installing it" },
152
+ "--channel": {
153
+ description: "select the official release channel",
154
+ value: { label: "channel", kind: "value" },
155
+ },
156
+ "--no-browser": { description: "print account URLs instead of opening a browser" },
157
+ "--scope": {
158
+ description: "search globally or only in the current workspace",
159
+ value: { label: "scope", kind: "value" },
160
+ },
161
+ "--cwd": {
162
+ description: "restrict session operations to a working directory",
163
+ value: { label: "directory", kind: "directory" },
164
+ },
165
+ "--context": {
166
+ description: "surrounding events included with each recall hit",
167
+ value: { label: "number", kind: "number" },
168
+ },
169
+ "--pi": { description: "override the Pi session root", value: { label: "directory", kind: "directory" } },
170
+ "--codex": { description: "override the Codex session root", value: { label: "directory", kind: "directory" } },
171
+ "--claude": {
172
+ description: "override the Claude Code session root",
173
+ value: { label: "directory", kind: "directory" },
174
+ },
175
+ "--host": {
176
+ description: "session host (pi/codex/claude) or web loopback bind address",
177
+ value: { label: "host", kind: "value" },
178
+ },
179
+ "--max-per-host": {
180
+ description: "maximum session files read from each host",
181
+ value: { label: "number", kind: "number" },
182
+ },
183
+ "--recent": {
184
+ description: "most recently modified session files refreshed per host",
185
+ value: { label: "number", kind: "number" },
186
+ },
187
+ "--interval": {
188
+ description: "watch polling interval in milliseconds",
189
+ value: { label: "milliseconds", kind: "number" },
190
+ },
191
+ "--once": { description: "run one watch iteration and exit" },
192
+ "--lines": {
193
+ description: "number of recent worker log entries to return",
194
+ value: { label: "number", kind: "number" },
195
+ },
196
+ "--threshold": {
197
+ description: "minimum repeated evidence required for a candidate",
198
+ value: { label: "number", kind: "number" },
199
+ },
200
+ "--output": { description: "also write the report to this file", value: { label: "file", kind: "file" } },
201
+ "--replay": { description: "back up and rebuild derived learning layers" },
202
+ "--journal": {
203
+ description: "override the experience journal directory",
204
+ value: { label: "directory", kind: "directory" },
205
+ },
206
+ "--candidates-dir": {
207
+ description: "override the candidate ledger directory",
208
+ value: { label: "directory", kind: "directory" },
209
+ },
210
+ "--decisions-dir": {
211
+ description: "override the decision ledger directory",
212
+ value: { label: "directory", kind: "directory" },
213
+ },
214
+ "--auto-dir": {
215
+ description: "override the materialized auto-memory directory",
216
+ value: { label: "directory", kind: "directory" },
217
+ },
218
+ "--agent": { description: "internal SessionStart host key", value: { label: "agent", kind: "value" } },
219
+ "--token": { description: "internal session-worker lease token", value: { label: "token", kind: "value" } },
220
+ "--uninstall": { description: "use install-skills compatibility uninstall mode" },
221
+ };
222
+
223
+ export const SHELL_DESCRIPTIONS: Record<string, string> = {
224
+ bash: "generate or install Bash completion",
225
+ zsh: "generate or install Zsh completion",
226
+ fish: "generate or install Fish completion",
227
+ powershell: "generate or install PowerShell completion",
228
+ };
229
+
230
+ export function optionDescription(option: string): string {
231
+ return OPTION_SPECS[option]?.description ?? option;
232
+ }
233
+
234
+ export function optionTakesValue(option: string): boolean {
235
+ return OPTION_SPECS[option]?.value !== undefined;
236
+ }