@waynesutton/agent-memory 0.0.1-alpha.1
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/.claude/settings.json +9 -0
- package/.claude/settings.local.json +7 -0
- package/AGENTS.md +113 -0
- package/CLAUDE.md +79 -0
- package/README.md +1003 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +192 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/parsers/claude-code.d.ts +3 -0
- package/dist/cli/parsers/claude-code.d.ts.map +1 -0
- package/dist/cli/parsers/claude-code.js +75 -0
- package/dist/cli/parsers/claude-code.js.map +1 -0
- package/dist/cli/parsers/codex.d.ts +3 -0
- package/dist/cli/parsers/codex.d.ts.map +1 -0
- package/dist/cli/parsers/codex.js +42 -0
- package/dist/cli/parsers/codex.js.map +1 -0
- package/dist/cli/parsers/conductor.d.ts +3 -0
- package/dist/cli/parsers/conductor.d.ts.map +1 -0
- package/dist/cli/parsers/conductor.js +43 -0
- package/dist/cli/parsers/conductor.js.map +1 -0
- package/dist/cli/parsers/cursor.d.ts +3 -0
- package/dist/cli/parsers/cursor.d.ts.map +1 -0
- package/dist/cli/parsers/cursor.js +50 -0
- package/dist/cli/parsers/cursor.js.map +1 -0
- package/dist/cli/parsers/index.d.ts +12 -0
- package/dist/cli/parsers/index.d.ts.map +1 -0
- package/dist/cli/parsers/index.js +27 -0
- package/dist/cli/parsers/index.js.map +1 -0
- package/dist/cli/parsers/opencode.d.ts +3 -0
- package/dist/cli/parsers/opencode.d.ts.map +1 -0
- package/dist/cli/parsers/opencode.js +72 -0
- package/dist/cli/parsers/opencode.js.map +1 -0
- package/dist/cli/parsers/parsers.test.d.ts +2 -0
- package/dist/cli/parsers/parsers.test.d.ts.map +1 -0
- package/dist/cli/parsers/parsers.test.js +151 -0
- package/dist/cli/parsers/parsers.test.js.map +1 -0
- package/dist/cli/parsers/pi.d.ts +3 -0
- package/dist/cli/parsers/pi.d.ts.map +1 -0
- package/dist/cli/parsers/pi.js +43 -0
- package/dist/cli/parsers/pi.js.map +1 -0
- package/dist/cli/parsers/types.d.ts +25 -0
- package/dist/cli/parsers/types.d.ts.map +1 -0
- package/dist/cli/parsers/types.js +2 -0
- package/dist/cli/parsers/types.js.map +1 -0
- package/dist/cli/parsers/vscode-copilot.d.ts +3 -0
- package/dist/cli/parsers/vscode-copilot.d.ts.map +1 -0
- package/dist/cli/parsers/vscode-copilot.js +69 -0
- package/dist/cli/parsers/vscode-copilot.js.map +1 -0
- package/dist/cli/parsers/zed.d.ts +3 -0
- package/dist/cli/parsers/zed.d.ts.map +1 -0
- package/dist/cli/parsers/zed.js +43 -0
- package/dist/cli/parsers/zed.js.map +1 -0
- package/dist/cli/sync.d.ts +21 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +78 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/type-extractor.d.ts +25 -0
- package/dist/cli/type-extractor.d.ts.map +1 -0
- package/dist/cli/type-extractor.js +254 -0
- package/dist/cli/type-extractor.js.map +1 -0
- package/dist/cli/type-extractor.test.d.ts +2 -0
- package/dist/cli/type-extractor.test.d.ts.map +1 -0
- package/dist/cli/type-extractor.test.js +173 -0
- package/dist/cli/type-extractor.test.js.map +1 -0
- package/dist/client/http.d.ts +44 -0
- package/dist/client/http.d.ts.map +1 -0
- package/dist/client/http.js +311 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/index.d.ts +158 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +256 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +12 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +13 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +18 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +42 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +39 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/actions.d.ts +42 -0
- package/dist/component/actions.d.ts.map +1 -0
- package/dist/component/actions.js +405 -0
- package/dist/component/actions.js.map +1 -0
- package/dist/component/apiKeyMutations.d.ts +29 -0
- package/dist/component/apiKeyMutations.d.ts.map +1 -0
- package/dist/component/apiKeyMutations.js +149 -0
- package/dist/component/apiKeyMutations.js.map +1 -0
- package/dist/component/apiKeyQueries.d.ts +37 -0
- package/dist/component/apiKeyQueries.d.ts.map +1 -0
- package/dist/component/apiKeyQueries.js +127 -0
- package/dist/component/apiKeyQueries.js.map +1 -0
- package/dist/component/checksum.d.ts +6 -0
- package/dist/component/checksum.d.ts.map +1 -0
- package/dist/component/checksum.js +14 -0
- package/dist/component/checksum.js.map +1 -0
- package/dist/component/checksum.test.d.ts +2 -0
- package/dist/component/checksum.test.d.ts.map +1 -0
- package/dist/component/checksum.test.js +27 -0
- package/dist/component/checksum.test.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +4 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/cronActions.d.ts +3 -0
- package/dist/component/cronActions.d.ts.map +1 -0
- package/dist/component/cronActions.js +38 -0
- package/dist/component/cronActions.js.map +1 -0
- package/dist/component/cronQueries.d.ts +6 -0
- package/dist/component/cronQueries.d.ts.map +1 -0
- package/dist/component/cronQueries.js +38 -0
- package/dist/component/cronQueries.js.map +1 -0
- package/dist/component/crons.d.ts +3 -0
- package/dist/component/crons.d.ts.map +1 -0
- package/dist/component/crons.js +18 -0
- package/dist/component/crons.js.map +1 -0
- package/dist/component/format.d.ts +11 -0
- package/dist/component/format.d.ts.map +1 -0
- package/dist/component/format.js +175 -0
- package/dist/component/format.js.map +1 -0
- package/dist/component/format.test.d.ts +2 -0
- package/dist/component/format.test.d.ts.map +1 -0
- package/dist/component/format.test.js +118 -0
- package/dist/component/format.test.js.map +1 -0
- package/dist/component/mutations.d.ts +158 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +745 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/queries.d.ts +94 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +574 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +278 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +161 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +571 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/shared.d.ts +126 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +67 -0
- package/dist/shared.js.map +1 -0
- package/dist/test.d.ts +23 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +21 -0
- package/dist/test.js.map +1 -0
- package/eslint.config.js +15 -0
- package/example/convex/convex.config.ts +7 -0
- package/example/convex/memory.ts +129 -0
- package/llms.md +175 -0
- package/llms.txt +126 -0
- package/package.json +80 -0
- package/prds/API-REFERENCE.md +935 -0
- package/prds/SETUP.md +682 -0
- package/src/cli/index.ts +254 -0
- package/src/cli/parsers/claude-code.ts +80 -0
- package/src/cli/parsers/codex.ts +45 -0
- package/src/cli/parsers/conductor.ts +47 -0
- package/src/cli/parsers/cursor.ts +55 -0
- package/src/cli/parsers/index.ts +30 -0
- package/src/cli/parsers/opencode.ts +84 -0
- package/src/cli/parsers/parsers.test.ts +201 -0
- package/src/cli/parsers/pi.ts +47 -0
- package/src/cli/parsers/types.ts +26 -0
- package/src/cli/parsers/vscode-copilot.ts +78 -0
- package/src/cli/parsers/zed.ts +47 -0
- package/src/cli/sync.ts +110 -0
- package/src/cli/type-extractor.test.ts +241 -0
- package/src/cli/type-extractor.ts +331 -0
- package/src/client/http.ts +415 -0
- package/src/client/index.ts +519 -0
- package/src/component/_generated/api.ts +14 -0
- package/src/component/_generated/dataModel.ts +20 -0
- package/src/component/_generated/server.ts +64 -0
- package/src/component/actions.ts +558 -0
- package/src/component/apiKeyMutations.ts +175 -0
- package/src/component/apiKeyQueries.ts +156 -0
- package/src/component/checksum.test.ts +31 -0
- package/src/component/checksum.ts +13 -0
- package/src/component/convex.config.ts +5 -0
- package/src/component/cronActions.ts +52 -0
- package/src/component/cronQueries.ts +42 -0
- package/src/component/crons.ts +34 -0
- package/src/component/format.test.ts +133 -0
- package/src/component/format.ts +232 -0
- package/src/component/mutations.ts +824 -0
- package/src/component/queries.ts +684 -0
- package/src/component/schema.ts +207 -0
- package/src/mcp/server.ts +695 -0
- package/src/shared.ts +251 -0
- package/src/test.ts +32 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { Doc } from "./_generated/dataModel.js";
|
|
2
|
+
|
|
3
|
+
type MemoryDoc = Doc<"memories">;
|
|
4
|
+
|
|
5
|
+
export interface FormattedFile {
|
|
6
|
+
path: string;
|
|
7
|
+
content: string;
|
|
8
|
+
checksum: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ── Claude Code ─────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
function formatClaudeCode(memory: MemoryDoc, projectSlug: string): FormattedFile {
|
|
14
|
+
const hasPaths = memory.paths && memory.paths.length > 0;
|
|
15
|
+
let content = "";
|
|
16
|
+
|
|
17
|
+
if (hasPaths) {
|
|
18
|
+
content += "---\n";
|
|
19
|
+
content += "paths:\n";
|
|
20
|
+
for (const p of memory.paths!) {
|
|
21
|
+
content += ` - "${p}"\n`;
|
|
22
|
+
}
|
|
23
|
+
content += "---\n\n";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
content += memory.content;
|
|
27
|
+
|
|
28
|
+
const isInstruction = memory.memoryType === "instruction";
|
|
29
|
+
const path = isInstruction
|
|
30
|
+
? `.claude/rules/${sanitizeFilename(memory.title)}.md`
|
|
31
|
+
: `.claude/projects/${projectSlug}/memory/${sanitizeFilename(memory.title)}.md`;
|
|
32
|
+
|
|
33
|
+
return { path, content, checksum: memory.checksum };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ── Cursor ──────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
function formatCursor(memory: MemoryDoc): FormattedFile {
|
|
39
|
+
let content = "---\n";
|
|
40
|
+
content += `description: ${memory.title}\n`;
|
|
41
|
+
|
|
42
|
+
if (memory.paths && memory.paths.length > 0) {
|
|
43
|
+
content += "paths:\n";
|
|
44
|
+
for (const p of memory.paths) {
|
|
45
|
+
content += ` - "${p}"\n`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const alwaysApply =
|
|
50
|
+
memory.priority !== undefined && memory.priority >= 0.8;
|
|
51
|
+
content += `alwaysApply: ${alwaysApply}\n`;
|
|
52
|
+
content += "---\n\n";
|
|
53
|
+
content += memory.content;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
path: `.cursor/rules/${sanitizeFilename(memory.title)}.mdc`,
|
|
57
|
+
content,
|
|
58
|
+
checksum: memory.checksum,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── OpenCode ────────────────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
function formatOpenCode(memory: MemoryDoc): FormattedFile {
|
|
65
|
+
if (memory.memoryType === "journal") {
|
|
66
|
+
return {
|
|
67
|
+
path: `journal/${sanitizeFilename(memory.title)}.md`,
|
|
68
|
+
content: memory.content,
|
|
69
|
+
checksum: memory.checksum,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Instructions get merged into AGENTS.md sections
|
|
74
|
+
return {
|
|
75
|
+
path: "AGENTS.md",
|
|
76
|
+
content: `## ${memory.title}\n\n${memory.content}`,
|
|
77
|
+
checksum: memory.checksum,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ── Codex ───────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
function formatCodex(memory: MemoryDoc): FormattedFile {
|
|
84
|
+
// If paths all share a common directory prefix, place there
|
|
85
|
+
const dir = commonPathPrefix(memory.paths);
|
|
86
|
+
const path = dir ? `${dir}/AGENTS.md` : "AGENTS.md";
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
path,
|
|
90
|
+
content: `## ${memory.title}\n\n${memory.content}`,
|
|
91
|
+
checksum: memory.checksum,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ── Conductor ───────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
function formatConductor(memory: MemoryDoc): FormattedFile {
|
|
98
|
+
return {
|
|
99
|
+
path: `.conductor/rules/${sanitizeFilename(memory.title)}.md`,
|
|
100
|
+
content: memory.content,
|
|
101
|
+
checksum: memory.checksum,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ── Zed ─────────────────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
function formatZed(memory: MemoryDoc): FormattedFile {
|
|
108
|
+
return {
|
|
109
|
+
path: `.zed/rules/${sanitizeFilename(memory.title)}.md`,
|
|
110
|
+
content: memory.content,
|
|
111
|
+
checksum: memory.checksum,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── VS Code Copilot ─────────────────────────────────────────────────
|
|
116
|
+
|
|
117
|
+
function formatVSCodeCopilot(memory: MemoryDoc): FormattedFile {
|
|
118
|
+
return {
|
|
119
|
+
path: `.github/copilot-instructions.md`,
|
|
120
|
+
content: `## ${memory.title}\n\n${memory.content}`,
|
|
121
|
+
checksum: memory.checksum,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── Pi ──────────────────────────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
function formatPi(memory: MemoryDoc): FormattedFile {
|
|
128
|
+
return {
|
|
129
|
+
path: `.pi/rules/${sanitizeFilename(memory.title)}.md`,
|
|
130
|
+
content: memory.content,
|
|
131
|
+
checksum: memory.checksum,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ── Raw (markdown as-is) ────────────────────────────────────────────
|
|
136
|
+
|
|
137
|
+
function formatRaw(memory: MemoryDoc): FormattedFile {
|
|
138
|
+
let content = "---\n";
|
|
139
|
+
content += `title: ${memory.title}\n`;
|
|
140
|
+
content += `type: ${memory.memoryType}\n`;
|
|
141
|
+
content += `scope: ${memory.scope}\n`;
|
|
142
|
+
if (memory.tags.length > 0) {
|
|
143
|
+
content += `tags: [${memory.tags.map((t: string) => `"${t}"`).join(", ")}]\n`;
|
|
144
|
+
}
|
|
145
|
+
if (memory.priority !== undefined) {
|
|
146
|
+
content += `priority: ${memory.priority}\n`;
|
|
147
|
+
}
|
|
148
|
+
if (memory.paths && memory.paths.length > 0) {
|
|
149
|
+
content += "paths:\n";
|
|
150
|
+
for (const p of memory.paths) {
|
|
151
|
+
content += ` - "${p}"\n`;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
content += "---\n\n";
|
|
155
|
+
content += memory.content;
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
path: `memories/${sanitizeFilename(memory.title)}.md`,
|
|
159
|
+
content,
|
|
160
|
+
checksum: memory.checksum,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ── Public API ──────────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
export type ToolFormat =
|
|
167
|
+
| "claude-code"
|
|
168
|
+
| "cursor"
|
|
169
|
+
| "opencode"
|
|
170
|
+
| "codex"
|
|
171
|
+
| "conductor"
|
|
172
|
+
| "zed"
|
|
173
|
+
| "vscode-copilot"
|
|
174
|
+
| "pi"
|
|
175
|
+
| "raw";
|
|
176
|
+
|
|
177
|
+
export function formatMemoryForTool(
|
|
178
|
+
memory: MemoryDoc,
|
|
179
|
+
format: ToolFormat,
|
|
180
|
+
projectSlug?: string,
|
|
181
|
+
): FormattedFile {
|
|
182
|
+
switch (format) {
|
|
183
|
+
case "claude-code":
|
|
184
|
+
return formatClaudeCode(memory, projectSlug ?? "default");
|
|
185
|
+
case "cursor":
|
|
186
|
+
return formatCursor(memory);
|
|
187
|
+
case "opencode":
|
|
188
|
+
return formatOpenCode(memory);
|
|
189
|
+
case "codex":
|
|
190
|
+
return formatCodex(memory);
|
|
191
|
+
case "conductor":
|
|
192
|
+
return formatConductor(memory);
|
|
193
|
+
case "zed":
|
|
194
|
+
return formatZed(memory);
|
|
195
|
+
case "vscode-copilot":
|
|
196
|
+
return formatVSCodeCopilot(memory);
|
|
197
|
+
case "pi":
|
|
198
|
+
return formatPi(memory);
|
|
199
|
+
case "raw":
|
|
200
|
+
return formatRaw(memory);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ── Helpers ─────────────────────────────────────────────────────────
|
|
205
|
+
|
|
206
|
+
function sanitizeFilename(title: string): string {
|
|
207
|
+
return title
|
|
208
|
+
.toLowerCase()
|
|
209
|
+
.replace(/[^a-z0-9-_]/g, "-")
|
|
210
|
+
.replace(/-+/g, "-")
|
|
211
|
+
.replace(/^-|-$/g, "");
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function commonPathPrefix(paths?: string[]): string {
|
|
215
|
+
if (!paths || paths.length === 0) return "";
|
|
216
|
+
if (paths.length === 1) {
|
|
217
|
+
const parts = paths[0].split("/");
|
|
218
|
+
return parts.length > 1 ? parts.slice(0, -1).join("/") : "";
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const split = paths.map((p) => p.split("/"));
|
|
222
|
+
const prefix: string[] = [];
|
|
223
|
+
for (let i = 0; i < split[0].length; i++) {
|
|
224
|
+
const segment = split[0][i];
|
|
225
|
+
if (split.every((parts) => parts[i] === segment)) {
|
|
226
|
+
prefix.push(segment);
|
|
227
|
+
} else {
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return prefix.join("/");
|
|
232
|
+
}
|