@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.
Files changed (200) hide show
  1. package/.claude/settings.json +9 -0
  2. package/.claude/settings.local.json +7 -0
  3. package/AGENTS.md +113 -0
  4. package/CLAUDE.md +79 -0
  5. package/README.md +1003 -0
  6. package/dist/cli/index.d.ts +3 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +192 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/cli/parsers/claude-code.d.ts +3 -0
  11. package/dist/cli/parsers/claude-code.d.ts.map +1 -0
  12. package/dist/cli/parsers/claude-code.js +75 -0
  13. package/dist/cli/parsers/claude-code.js.map +1 -0
  14. package/dist/cli/parsers/codex.d.ts +3 -0
  15. package/dist/cli/parsers/codex.d.ts.map +1 -0
  16. package/dist/cli/parsers/codex.js +42 -0
  17. package/dist/cli/parsers/codex.js.map +1 -0
  18. package/dist/cli/parsers/conductor.d.ts +3 -0
  19. package/dist/cli/parsers/conductor.d.ts.map +1 -0
  20. package/dist/cli/parsers/conductor.js +43 -0
  21. package/dist/cli/parsers/conductor.js.map +1 -0
  22. package/dist/cli/parsers/cursor.d.ts +3 -0
  23. package/dist/cli/parsers/cursor.d.ts.map +1 -0
  24. package/dist/cli/parsers/cursor.js +50 -0
  25. package/dist/cli/parsers/cursor.js.map +1 -0
  26. package/dist/cli/parsers/index.d.ts +12 -0
  27. package/dist/cli/parsers/index.d.ts.map +1 -0
  28. package/dist/cli/parsers/index.js +27 -0
  29. package/dist/cli/parsers/index.js.map +1 -0
  30. package/dist/cli/parsers/opencode.d.ts +3 -0
  31. package/dist/cli/parsers/opencode.d.ts.map +1 -0
  32. package/dist/cli/parsers/opencode.js +72 -0
  33. package/dist/cli/parsers/opencode.js.map +1 -0
  34. package/dist/cli/parsers/parsers.test.d.ts +2 -0
  35. package/dist/cli/parsers/parsers.test.d.ts.map +1 -0
  36. package/dist/cli/parsers/parsers.test.js +151 -0
  37. package/dist/cli/parsers/parsers.test.js.map +1 -0
  38. package/dist/cli/parsers/pi.d.ts +3 -0
  39. package/dist/cli/parsers/pi.d.ts.map +1 -0
  40. package/dist/cli/parsers/pi.js +43 -0
  41. package/dist/cli/parsers/pi.js.map +1 -0
  42. package/dist/cli/parsers/types.d.ts +25 -0
  43. package/dist/cli/parsers/types.d.ts.map +1 -0
  44. package/dist/cli/parsers/types.js +2 -0
  45. package/dist/cli/parsers/types.js.map +1 -0
  46. package/dist/cli/parsers/vscode-copilot.d.ts +3 -0
  47. package/dist/cli/parsers/vscode-copilot.d.ts.map +1 -0
  48. package/dist/cli/parsers/vscode-copilot.js +69 -0
  49. package/dist/cli/parsers/vscode-copilot.js.map +1 -0
  50. package/dist/cli/parsers/zed.d.ts +3 -0
  51. package/dist/cli/parsers/zed.d.ts.map +1 -0
  52. package/dist/cli/parsers/zed.js +43 -0
  53. package/dist/cli/parsers/zed.js.map +1 -0
  54. package/dist/cli/sync.d.ts +21 -0
  55. package/dist/cli/sync.d.ts.map +1 -0
  56. package/dist/cli/sync.js +78 -0
  57. package/dist/cli/sync.js.map +1 -0
  58. package/dist/cli/type-extractor.d.ts +25 -0
  59. package/dist/cli/type-extractor.d.ts.map +1 -0
  60. package/dist/cli/type-extractor.js +254 -0
  61. package/dist/cli/type-extractor.js.map +1 -0
  62. package/dist/cli/type-extractor.test.d.ts +2 -0
  63. package/dist/cli/type-extractor.test.d.ts.map +1 -0
  64. package/dist/cli/type-extractor.test.js +173 -0
  65. package/dist/cli/type-extractor.test.js.map +1 -0
  66. package/dist/client/http.d.ts +44 -0
  67. package/dist/client/http.d.ts.map +1 -0
  68. package/dist/client/http.js +311 -0
  69. package/dist/client/http.js.map +1 -0
  70. package/dist/client/index.d.ts +158 -0
  71. package/dist/client/index.d.ts.map +1 -0
  72. package/dist/client/index.js +256 -0
  73. package/dist/client/index.js.map +1 -0
  74. package/dist/component/_generated/api.d.ts +12 -0
  75. package/dist/component/_generated/api.d.ts.map +1 -0
  76. package/dist/component/_generated/api.js +13 -0
  77. package/dist/component/_generated/api.js.map +1 -0
  78. package/dist/component/_generated/dataModel.d.ts +18 -0
  79. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  80. package/dist/component/_generated/dataModel.js +11 -0
  81. package/dist/component/_generated/dataModel.js.map +1 -0
  82. package/dist/component/_generated/server.d.ts +42 -0
  83. package/dist/component/_generated/server.d.ts.map +1 -0
  84. package/dist/component/_generated/server.js +39 -0
  85. package/dist/component/_generated/server.js.map +1 -0
  86. package/dist/component/actions.d.ts +42 -0
  87. package/dist/component/actions.d.ts.map +1 -0
  88. package/dist/component/actions.js +405 -0
  89. package/dist/component/actions.js.map +1 -0
  90. package/dist/component/apiKeyMutations.d.ts +29 -0
  91. package/dist/component/apiKeyMutations.d.ts.map +1 -0
  92. package/dist/component/apiKeyMutations.js +149 -0
  93. package/dist/component/apiKeyMutations.js.map +1 -0
  94. package/dist/component/apiKeyQueries.d.ts +37 -0
  95. package/dist/component/apiKeyQueries.d.ts.map +1 -0
  96. package/dist/component/apiKeyQueries.js +127 -0
  97. package/dist/component/apiKeyQueries.js.map +1 -0
  98. package/dist/component/checksum.d.ts +6 -0
  99. package/dist/component/checksum.d.ts.map +1 -0
  100. package/dist/component/checksum.js +14 -0
  101. package/dist/component/checksum.js.map +1 -0
  102. package/dist/component/checksum.test.d.ts +2 -0
  103. package/dist/component/checksum.test.d.ts.map +1 -0
  104. package/dist/component/checksum.test.js +27 -0
  105. package/dist/component/checksum.test.js.map +1 -0
  106. package/dist/component/convex.config.d.ts +3 -0
  107. package/dist/component/convex.config.d.ts.map +1 -0
  108. package/dist/component/convex.config.js +4 -0
  109. package/dist/component/convex.config.js.map +1 -0
  110. package/dist/component/cronActions.d.ts +3 -0
  111. package/dist/component/cronActions.d.ts.map +1 -0
  112. package/dist/component/cronActions.js +38 -0
  113. package/dist/component/cronActions.js.map +1 -0
  114. package/dist/component/cronQueries.d.ts +6 -0
  115. package/dist/component/cronQueries.d.ts.map +1 -0
  116. package/dist/component/cronQueries.js +38 -0
  117. package/dist/component/cronQueries.js.map +1 -0
  118. package/dist/component/crons.d.ts +3 -0
  119. package/dist/component/crons.d.ts.map +1 -0
  120. package/dist/component/crons.js +18 -0
  121. package/dist/component/crons.js.map +1 -0
  122. package/dist/component/format.d.ts +11 -0
  123. package/dist/component/format.d.ts.map +1 -0
  124. package/dist/component/format.js +175 -0
  125. package/dist/component/format.js.map +1 -0
  126. package/dist/component/format.test.d.ts +2 -0
  127. package/dist/component/format.test.d.ts.map +1 -0
  128. package/dist/component/format.test.js +118 -0
  129. package/dist/component/format.test.js.map +1 -0
  130. package/dist/component/mutations.d.ts +158 -0
  131. package/dist/component/mutations.d.ts.map +1 -0
  132. package/dist/component/mutations.js +745 -0
  133. package/dist/component/mutations.js.map +1 -0
  134. package/dist/component/queries.d.ts +94 -0
  135. package/dist/component/queries.d.ts.map +1 -0
  136. package/dist/component/queries.js +574 -0
  137. package/dist/component/queries.js.map +1 -0
  138. package/dist/component/schema.d.ts +278 -0
  139. package/dist/component/schema.d.ts.map +1 -0
  140. package/dist/component/schema.js +161 -0
  141. package/dist/component/schema.js.map +1 -0
  142. package/dist/mcp/server.d.ts +11 -0
  143. package/dist/mcp/server.d.ts.map +1 -0
  144. package/dist/mcp/server.js +571 -0
  145. package/dist/mcp/server.js.map +1 -0
  146. package/dist/shared.d.ts +126 -0
  147. package/dist/shared.d.ts.map +1 -0
  148. package/dist/shared.js +67 -0
  149. package/dist/shared.js.map +1 -0
  150. package/dist/test.d.ts +23 -0
  151. package/dist/test.d.ts.map +1 -0
  152. package/dist/test.js +21 -0
  153. package/dist/test.js.map +1 -0
  154. package/eslint.config.js +15 -0
  155. package/example/convex/convex.config.ts +7 -0
  156. package/example/convex/memory.ts +129 -0
  157. package/llms.md +175 -0
  158. package/llms.txt +126 -0
  159. package/package.json +80 -0
  160. package/prds/API-REFERENCE.md +935 -0
  161. package/prds/SETUP.md +682 -0
  162. package/src/cli/index.ts +254 -0
  163. package/src/cli/parsers/claude-code.ts +80 -0
  164. package/src/cli/parsers/codex.ts +45 -0
  165. package/src/cli/parsers/conductor.ts +47 -0
  166. package/src/cli/parsers/cursor.ts +55 -0
  167. package/src/cli/parsers/index.ts +30 -0
  168. package/src/cli/parsers/opencode.ts +84 -0
  169. package/src/cli/parsers/parsers.test.ts +201 -0
  170. package/src/cli/parsers/pi.ts +47 -0
  171. package/src/cli/parsers/types.ts +26 -0
  172. package/src/cli/parsers/vscode-copilot.ts +78 -0
  173. package/src/cli/parsers/zed.ts +47 -0
  174. package/src/cli/sync.ts +110 -0
  175. package/src/cli/type-extractor.test.ts +241 -0
  176. package/src/cli/type-extractor.ts +331 -0
  177. package/src/client/http.ts +415 -0
  178. package/src/client/index.ts +519 -0
  179. package/src/component/_generated/api.ts +14 -0
  180. package/src/component/_generated/dataModel.ts +20 -0
  181. package/src/component/_generated/server.ts +64 -0
  182. package/src/component/actions.ts +558 -0
  183. package/src/component/apiKeyMutations.ts +175 -0
  184. package/src/component/apiKeyQueries.ts +156 -0
  185. package/src/component/checksum.test.ts +31 -0
  186. package/src/component/checksum.ts +13 -0
  187. package/src/component/convex.config.ts +5 -0
  188. package/src/component/cronActions.ts +52 -0
  189. package/src/component/cronQueries.ts +42 -0
  190. package/src/component/crons.ts +34 -0
  191. package/src/component/format.test.ts +133 -0
  192. package/src/component/format.ts +232 -0
  193. package/src/component/mutations.ts +824 -0
  194. package/src/component/queries.ts +684 -0
  195. package/src/component/schema.ts +207 -0
  196. package/src/mcp/server.ts +695 -0
  197. package/src/shared.ts +251 -0
  198. package/src/test.ts +32 -0
  199. package/tsconfig.json +21 -0
  200. package/vitest.config.ts +8 -0
@@ -0,0 +1,126 @@
1
+ export declare const MEMORY_TYPES: readonly ["instruction", "learning", "reference", "feedback", "journal"];
2
+ export type MemoryType = (typeof MEMORY_TYPES)[number];
3
+ export declare const memoryTypeValidator: import("convex/values").VUnion<"instruction" | "learning" | "reference" | "feedback" | "journal", [import("convex/values").VLiteral<"instruction", "required">, import("convex/values").VLiteral<"learning", "required">, import("convex/values").VLiteral<"reference", "required">, import("convex/values").VLiteral<"feedback", "required">, import("convex/values").VLiteral<"journal", "required">], "required", never>;
4
+ export declare const SCOPES: readonly ["project", "user", "org"];
5
+ export type Scope = (typeof SCOPES)[number];
6
+ export declare const scopeValidator: import("convex/values").VUnion<"project" | "user" | "org", [import("convex/values").VLiteral<"project", "required">, import("convex/values").VLiteral<"user", "required">, import("convex/values").VLiteral<"org", "required">], "required", never>;
7
+ export declare const syncDirectionValidator: import("convex/values").VUnion<"push" | "pull", [import("convex/values").VLiteral<"push", "required">, import("convex/values").VLiteral<"pull", "required">], "required", never>;
8
+ export declare const TOOL_FORMATS: readonly ["claude-code", "cursor", "opencode", "codex", "conductor", "zed", "vscode-copilot", "pi", "raw"];
9
+ export type ToolFormat = (typeof TOOL_FORMATS)[number];
10
+ export declare const toolFormatValidator: import("convex/values").VUnion<"claude-code" | "cursor" | "opencode" | "codex" | "conductor" | "zed" | "vscode-copilot" | "pi" | "raw", [import("convex/values").VLiteral<"claude-code", "required">, import("convex/values").VLiteral<"cursor", "required">, import("convex/values").VLiteral<"opencode", "required">, import("convex/values").VLiteral<"codex", "required">, import("convex/values").VLiteral<"conductor", "required">, import("convex/values").VLiteral<"zed", "required">, import("convex/values").VLiteral<"vscode-copilot", "required">, import("convex/values").VLiteral<"pi", "required">, import("convex/values").VLiteral<"raw", "required">], "required", never>;
11
+ export declare const HISTORY_EVENTS: readonly ["created", "updated", "archived", "restored", "merged"];
12
+ export type HistoryEvent = (typeof HISTORY_EVENTS)[number];
13
+ export declare const FEEDBACK_SENTIMENTS: readonly ["positive", "negative", "very_negative"];
14
+ export type FeedbackSentiment = (typeof FEEDBACK_SENTIMENTS)[number];
15
+ export declare const INGEST_EVENTS: readonly ["added", "updated", "deleted", "skipped"];
16
+ export type IngestEvent = (typeof INGEST_EVENTS)[number];
17
+ export interface Memory {
18
+ _id: string;
19
+ _creationTime: number;
20
+ projectId: string;
21
+ scope: Scope;
22
+ userId?: string;
23
+ agentId?: string;
24
+ sessionId?: string;
25
+ title: string;
26
+ content: string;
27
+ memoryType: MemoryType;
28
+ tags: string[];
29
+ paths?: string[];
30
+ priority?: number;
31
+ source?: string;
32
+ lastSyncedAt?: number;
33
+ checksum: string;
34
+ archived: boolean;
35
+ embeddingId?: string;
36
+ accessCount?: number;
37
+ lastAccessedAt?: number;
38
+ positiveCount?: number;
39
+ negativeCount?: number;
40
+ }
41
+ export interface ContextBundle {
42
+ pinned: Memory[];
43
+ relevant: Memory[];
44
+ available: Array<{
45
+ _id: string;
46
+ title: string;
47
+ memoryType: MemoryType;
48
+ priority: number;
49
+ }>;
50
+ }
51
+ export interface ExportedFile {
52
+ path: string;
53
+ content: string;
54
+ checksum: string;
55
+ }
56
+ export interface ImportResult {
57
+ created: number;
58
+ updated: number;
59
+ unchanged: number;
60
+ }
61
+ export interface MemoryHistoryEntry {
62
+ _id: string;
63
+ _creationTime: number;
64
+ memoryId: string;
65
+ projectId: string;
66
+ previousContent?: string;
67
+ newContent?: string;
68
+ previousTitle?: string;
69
+ newTitle?: string;
70
+ event: HistoryEvent;
71
+ actor: string;
72
+ timestamp: number;
73
+ }
74
+ export interface MemoryFeedbackEntry {
75
+ _id: string;
76
+ _creationTime: number;
77
+ memoryId: string;
78
+ projectId: string;
79
+ sentiment: FeedbackSentiment;
80
+ comment?: string;
81
+ actor: string;
82
+ timestamp: number;
83
+ }
84
+ export interface MemoryRelation {
85
+ _id: string;
86
+ _creationTime: number;
87
+ projectId: string;
88
+ fromMemoryId: string;
89
+ toMemoryId: string;
90
+ relationship: string;
91
+ metadata?: {
92
+ confidence?: number;
93
+ createdBy?: string;
94
+ };
95
+ timestamp: number;
96
+ }
97
+ export interface IngestResult {
98
+ results: Array<{
99
+ memoryId: string;
100
+ content: string;
101
+ event: IngestEvent;
102
+ previousContent?: string;
103
+ }>;
104
+ totalProcessed: number;
105
+ }
106
+ export interface ApiKeyInfo {
107
+ _id: string;
108
+ keyHash: string;
109
+ projectId: string;
110
+ name: string;
111
+ permissions: string[];
112
+ rateLimitOverride?: {
113
+ requestsPerWindow: number;
114
+ windowMs: number;
115
+ };
116
+ lastUsedAt?: number;
117
+ expiresAt?: number;
118
+ revoked: boolean;
119
+ }
120
+ export interface ApiKeyCreateResult {
121
+ key: string;
122
+ keyHash: string;
123
+ }
124
+ export declare const API_PERMISSIONS: readonly ["list", "get", "search", "context", "export", "history", "relations"];
125
+ export type ApiPermission = (typeof API_PERMISSIONS)[number];
126
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY,0EAMf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,mBAAmB,6ZAM/B,CAAC;AAOF,eAAO,MAAM,MAAM,qCAAsC,CAAC;AAC1D,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,cAAc,qPAI1B,CAAC;AAIF,eAAO,MAAM,sBAAsB,kLAGlC,CAAC;AAIF,eAAO,MAAM,YAAY,4GAUf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,mBAAmB,6pBAU/B,CAAC;AAIF,eAAO,MAAM,cAAc,mEAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAI3D,eAAO,MAAM,mBAAmB,oDAItB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CA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AAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,WAAW,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,CAAC,EAAE;QAClB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,iFAQlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/shared.js ADDED
@@ -0,0 +1,67 @@
1
+ import { v } from "convex/values";
2
+ // ── Memory types ────────────────────────────────────────────────────
3
+ // instruction: maps to CLAUDE.md / .cursor/rules / AGENTS.md
4
+ // learning: auto-discovered patterns (auto-memory)
5
+ // reference: architecture docs, API specs
6
+ // feedback: corrections, preferences
7
+ // journal: session logs (OpenCode-style)
8
+ export const MEMORY_TYPES = [
9
+ "instruction",
10
+ "learning",
11
+ "reference",
12
+ "feedback",
13
+ "journal",
14
+ ];
15
+ export const memoryTypeValidator = v.union(v.literal("instruction"), v.literal("learning"), v.literal("reference"), v.literal("feedback"), v.literal("journal"));
16
+ // ── Scope types ─────────────────────────────────────────────────────
17
+ // project: shared across team via Convex
18
+ // user: personal to one user
19
+ // org: organization-wide policies
20
+ export const SCOPES = ["project", "user", "org"];
21
+ export const scopeValidator = v.union(v.literal("project"), v.literal("user"), v.literal("org"));
22
+ // ── Sync direction ──────────────────────────────────────────────────
23
+ export const syncDirectionValidator = v.union(v.literal("push"), v.literal("pull"));
24
+ // ── Tool formats ────────────────────────────────────────────────────
25
+ export const TOOL_FORMATS = [
26
+ "claude-code",
27
+ "cursor",
28
+ "opencode",
29
+ "codex",
30
+ "conductor",
31
+ "zed",
32
+ "vscode-copilot",
33
+ "pi",
34
+ "raw",
35
+ ];
36
+ export const toolFormatValidator = v.union(v.literal("claude-code"), v.literal("cursor"), v.literal("opencode"), v.literal("codex"), v.literal("conductor"), v.literal("zed"), v.literal("vscode-copilot"), v.literal("pi"), v.literal("raw"));
37
+ // ── History events ──────────────────────────────────────────────────
38
+ export const HISTORY_EVENTS = [
39
+ "created",
40
+ "updated",
41
+ "archived",
42
+ "restored",
43
+ "merged",
44
+ ];
45
+ // ── Feedback sentiments ─────────────────────────────────────────────
46
+ export const FEEDBACK_SENTIMENTS = [
47
+ "positive",
48
+ "negative",
49
+ "very_negative",
50
+ ];
51
+ // ── Ingest events ───────────────────────────────────────────────────
52
+ export const INGEST_EVENTS = [
53
+ "added",
54
+ "updated",
55
+ "deleted",
56
+ "skipped",
57
+ ];
58
+ export const API_PERMISSIONS = [
59
+ "list",
60
+ "get",
61
+ "search",
62
+ "context",
63
+ "export",
64
+ "history",
65
+ "relations",
66
+ ];
67
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,uEAAuE;AACvE,6DAA6D;AAC7D,sDAAsD;AACtD,4CAA4C;AAC5C,wCAAwC;AACxC,6CAA6C;AAE7C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,a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,CAAC,EAClB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAChB,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC3B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACf,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CACjB,CAAC;AAEF,uEAAuE;AAEvE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,QAAQ;CACA,CAAC;AAIX,uEAAuE;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU;IACV,UAAU;IACV,eAAe;CACP,CAAC;AAIX,uEAAuE;AAEvE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;CACD,CAAC;AAuIX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,KAAK;IACL,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;CACH,CAAC"}
package/dist/test.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ declare global {
2
+ interface ImportMeta {
3
+ glob(pattern: string): Record<string, () => Promise<unknown>>;
4
+ }
5
+ }
6
+ /**
7
+ * Register the agentMemory component in a convex-test instance.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import agentMemoryTest from "@waynesutton/agent-memory/test";
12
+ * import { convexTest } from "convex-test";
13
+ *
14
+ * const t = convexTest();
15
+ * agentMemoryTest.register(t);
16
+ * ```
17
+ */
18
+ export declare function register(t: any, name?: string): void;
19
+ declare const _default: {
20
+ register: typeof register;
21
+ };
22
+ export default _default;
23
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/D;CACF;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAEtB,CAAC,EAAE,GAAG,EACN,IAAI,GAAE,MAAsB,QAG7B;;;;AAED,wBAA4B"}
package/dist/test.js ADDED
@@ -0,0 +1,21 @@
1
+ import schema from "./component/schema.js";
2
+ const modules = import.meta.glob("./component/**/*.ts");
3
+ /**
4
+ * Register the agentMemory component in a convex-test instance.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import agentMemoryTest from "@waynesutton/agent-memory/test";
9
+ * import { convexTest } from "convex-test";
10
+ *
11
+ * const t = convexTest();
12
+ * agentMemoryTest.register(t);
13
+ * ```
14
+ */
15
+ export function register(
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ t, name = "agentMemory") {
18
+ t.registerComponent(name, schema, modules);
19
+ }
20
+ export default { register };
21
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAS3C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ;AACtB,8DAA8D;AAC9D,CAAM,EACN,OAAe,aAAa;IAE5B,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,eAAe,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import convexPlugin from "@convex-dev/eslint-plugin";
2
+
3
+ export default [
4
+ {
5
+ plugins: {
6
+ "@convex-dev": convexPlugin,
7
+ },
8
+ files: ["src/component/**/*.ts"],
9
+ rules: {
10
+ "@convex-dev/no-old-registered-function-syntax": "error",
11
+ "@convex-dev/require-argument-validators": "error",
12
+ "@convex-dev/no-collect-in-query": "error",
13
+ },
14
+ },
15
+ ];
@@ -0,0 +1,7 @@
1
+ import { defineApp } from "convex/server";
2
+ import agentMemory from "../../src/component/convex.config.js";
3
+
4
+ const app = defineApp();
5
+ app.use(agentMemory);
6
+
7
+ export default app;
@@ -0,0 +1,129 @@
1
+ import { v } from "convex/values";
2
+ import { query, mutation, action } from "./_generated/server.js";
3
+ import { components } from "./_generated/api.js";
4
+ import { AgentMemory } from "../../src/client/index.js";
5
+
6
+ const memory = new AgentMemory(components.agentMemory, {
7
+ projectId: "example-app",
8
+ defaultScope: "project",
9
+ });
10
+
11
+ // ── Public mutations ────────────────────────────────────────────────
12
+
13
+ export const remember = mutation({
14
+ args: {
15
+ title: v.string(),
16
+ content: v.string(),
17
+ memoryType: v.union(
18
+ v.literal("instruction"),
19
+ v.literal("learning"),
20
+ v.literal("reference"),
21
+ v.literal("feedback"),
22
+ v.literal("journal"),
23
+ ),
24
+ tags: v.optional(v.array(v.string())),
25
+ paths: v.optional(v.array(v.string())),
26
+ priority: v.optional(v.float64()),
27
+ },
28
+ returns: v.string(),
29
+ handler: async (ctx, args) => {
30
+ return await memory.remember(ctx, {
31
+ title: args.title,
32
+ content: args.content,
33
+ memoryType: args.memoryType,
34
+ tags: args.tags,
35
+ paths: args.paths,
36
+ priority: args.priority,
37
+ source: "example-app",
38
+ });
39
+ },
40
+ });
41
+
42
+ export const forget = mutation({
43
+ args: { memoryId: v.string() },
44
+ returns: v.null(),
45
+ handler: async (ctx, args) => {
46
+ await memory.forget(ctx, args.memoryId);
47
+ return null;
48
+ },
49
+ });
50
+
51
+ // ── Public queries ──────────────────────────────────────────────────
52
+
53
+ export const listMemories = query({
54
+ args: {
55
+ memoryType: v.optional(
56
+ v.union(
57
+ v.literal("instruction"),
58
+ v.literal("learning"),
59
+ v.literal("reference"),
60
+ v.literal("feedback"),
61
+ v.literal("journal"),
62
+ ),
63
+ ),
64
+ },
65
+ returns: v.any(),
66
+ handler: async (ctx, args) => {
67
+ return await memory.list(ctx, {
68
+ memoryType: args.memoryType,
69
+ });
70
+ },
71
+ });
72
+
73
+ export const recall = query({
74
+ args: { q: v.string() },
75
+ returns: v.any(),
76
+ handler: async (ctx, args) => {
77
+ return await memory.search(ctx, args.q);
78
+ },
79
+ });
80
+
81
+ export const getContext = query({
82
+ args: {
83
+ activePaths: v.optional(v.array(v.string())),
84
+ },
85
+ returns: v.any(),
86
+ handler: async (ctx, args) => {
87
+ return await memory.getContextBundle(ctx, {
88
+ activePaths: args.activePaths,
89
+ });
90
+ },
91
+ });
92
+
93
+ // ── Type ingestion ──────────────────────────────────────────────────
94
+
95
+ export const ingestTypes = mutation({
96
+ args: {
97
+ types: v.array(
98
+ v.object({
99
+ title: v.string(),
100
+ content: v.string(),
101
+ tags: v.optional(v.array(v.string())),
102
+ paths: v.optional(v.array(v.string())),
103
+ priority: v.optional(v.float64()),
104
+ }),
105
+ ),
106
+ },
107
+ returns: v.any(),
108
+ handler: async (ctx, args) => {
109
+ return await memory.ingestTypes(ctx, args.types);
110
+ },
111
+ });
112
+
113
+ // ── Actions (for vector search) ─────────────────────────────────────
114
+
115
+ export const semanticRecall = action({
116
+ args: {
117
+ q: v.string(),
118
+ embeddingApiKey: v.string(),
119
+ },
120
+ returns: v.any(),
121
+ handler: async (ctx, args) => {
122
+ // Create a memory instance with the API key for this request
123
+ const memWithKey = new AgentMemory(components.agentMemory, {
124
+ ...memory.config,
125
+ embeddingApiKey: args.embeddingApiKey,
126
+ });
127
+ return await memWithKey.semanticSearch(ctx, args.q);
128
+ },
129
+ });
package/llms.md ADDED
@@ -0,0 +1,175 @@
1
+ # @waynesutton/agent-memory — Agent Reference
2
+
3
+ A Convex Component for persistent, cloud-synced agent memory. Markdown-first memory backend for AI coding agents across CLIs and IDEs.
4
+
5
+ ## For AI Agents Using This Library
6
+
7
+ You are working with `@waynesutton/agent-memory`, a Convex component that gives you persistent memory across sessions, tools, and machines. This document tells you how to use it effectively.
8
+
9
+ ## The Architecture
10
+
11
+ ```
12
+ Your App (Convex)
13
+ ├── convex/convex.config.ts ← registers the component with app.use(agentMemory)
14
+ ├── convex/memory.ts ← your wrapper functions calling AgentMemory class
15
+ ├── convex/http.ts ← optional: mounts MemoryHttpApi for REST access
16
+ └── node_modules/@waynesutton/agent-memory/
17
+ ├── src/component/ ← Convex backend (9 tables, isolated)
18
+ ├── src/client/index.ts ← AgentMemory class (main API)
19
+ ├── src/client/http.ts ← MemoryHttpApi class (HTTP endpoints)
20
+ ├── src/mcp/server.ts ← MCP server (14 tools)
21
+ └── src/cli/ ← CLI for push/pull/sync
22
+ ```
23
+
24
+ ## How to Use
25
+
26
+ ### 1. Setup (in consuming app)
27
+
28
+ ```typescript
29
+ // convex/convex.config.ts
30
+ import { defineApp } from "convex/server";
31
+ import agentMemory from "@waynesutton/agent-memory/convex.config.js";
32
+ const app = defineApp();
33
+ app.use(agentMemory);
34
+ export default app;
35
+ ```
36
+
37
+ ```typescript
38
+ // convex/memory.ts
39
+ import { AgentMemory } from "@waynesutton/agent-memory";
40
+ import { components } from "./_generated/api.js";
41
+
42
+ const memory = new AgentMemory(components.agentMemory, {
43
+ projectId: "my-project",
44
+ agentId: "my-agent", // identifies you
45
+ llmApiKey: process.env.OPENAI_API_KEY, // for intelligent ingest
46
+ });
47
+ ```
48
+
49
+ ### 2. Saving Memories
50
+
51
+ ```typescript
52
+ const id = await memory.remember(ctx, {
53
+ title: "api-conventions",
54
+ content: "# API Conventions\n\n- Use camelCase\n- Return JSON",
55
+ memoryType: "instruction", // instruction | learning | reference | feedback | journal
56
+ tags: ["api", "style"],
57
+ paths: ["src/api/**"], // file patterns for relevance matching
58
+ priority: 0.9, // >= 0.8 = pinned (always included in context)
59
+ });
60
+ ```
61
+
62
+ ### 3. Retrieving Memories
63
+
64
+ ```typescript
65
+ // Full-text search
66
+ const results = await memory.search(ctx, "API authentication");
67
+
68
+ // List with filters
69
+ const mems = await memory.list(ctx, {
70
+ memoryType: "instruction",
71
+ tags: ["api"],
72
+ agentId: "claude-code",
73
+ });
74
+
75
+ // Progressive context bundle (best for agent sessions)
76
+ const bundle = await memory.getContextBundle(ctx, {
77
+ activePaths: ["src/api/routes.ts"],
78
+ });
79
+ // bundle.pinned — high-priority memories (always include)
80
+ // bundle.relevant — path-matched memories
81
+ // bundle.available — everything else (summaries only)
82
+ ```
83
+
84
+ ### 4. Intelligent Ingest
85
+
86
+ Feed raw text and the LLM pipeline extracts facts, deduplicates against existing memories, and decides ADD/UPDATE/DELETE/SKIP per fact:
87
+
88
+ ```typescript
89
+ const result = await memory.ingest(ctx, rawConversationText);
90
+ // result.results: [{ event: "added"|"updated"|"deleted"|"skipped", content, memoryId }]
91
+ ```
92
+
93
+ ### 5. Feedback Loop
94
+
95
+ Rate memories to influence priority scoring in future context bundles:
96
+
97
+ ```typescript
98
+ await memory.addFeedback(ctx, memoryId, "positive", { comment: "Very helpful" });
99
+ await memory.addFeedback(ctx, memoryId, "negative", { comment: "Outdated" });
100
+ ```
101
+
102
+ ### 6. Memory Relations
103
+
104
+ Build a knowledge graph between memories:
105
+
106
+ ```typescript
107
+ await memory.addRelation(ctx, memoryA, memoryB, "extends");
108
+ await memory.addRelation(ctx, memoryC, memoryA, "contradicts", { confidence: 0.9 });
109
+ ```
110
+
111
+ ### 7. HTTP API
112
+
113
+ Expose memories as REST endpoints:
114
+
115
+ ```typescript
116
+ // convex/http.ts
117
+ import { httpRouter } from "convex/server";
118
+ import { MemoryHttpApi } from "@waynesutton/agent-memory/http";
119
+ import { components } from "./_generated/api";
120
+
121
+ const http = httpRouter();
122
+ new MemoryHttpApi(components.agentMemory).mount(http, "/api/memory");
123
+ export default http;
124
+ ```
125
+
126
+ Create API keys: `await memory.createApiKey(ctx, { name: "...", permissions: ["list", "search"] })`
127
+
128
+ ## Key Types
129
+
130
+ ```typescript
131
+ type MemoryType = "instruction" | "learning" | "reference" | "feedback" | "journal";
132
+ type Scope = "project" | "user" | "org";
133
+ type FeedbackSentiment = "positive" | "negative" | "very_negative";
134
+ type ToolFormat = "claude-code" | "cursor" | "opencode" | "codex" | "conductor" | "zed" | "vscode-copilot" | "pi" | "raw";
135
+ ```
136
+
137
+ ## Convex Component Constraints
138
+
139
+ When working with this component, be aware of:
140
+
141
+ - **No `ctx.auth`** — components don't have access to the app's auth. Pass `userId`/`agentId` explicitly in config.
142
+ - **No `process.env`** — components can't read environment variables. API keys are passed as function arguments.
143
+ - **IDs become strings** — Convex document IDs cross the component boundary as strings, not typed `Id<"table">`.
144
+ - **Isolated tables** — the component's 9 tables are namespaced under `agentMemory:` and isolated from your app's tables.
145
+
146
+ ## MCP Server Tools (14)
147
+
148
+ When using via MCP, these tools are available:
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `memory_remember` | Save a new memory |
153
+ | `memory_recall` | Full-text search |
154
+ | `memory_semantic_recall` | Vector similarity search |
155
+ | `memory_list` | List with filters |
156
+ | `memory_context` | Get context bundle |
157
+ | `memory_forget` | Archive a memory |
158
+ | `memory_restore` | Restore archived memory |
159
+ | `memory_update` | Update existing memory |
160
+ | `memory_history` | View audit trail |
161
+ | `memory_feedback` | Rate as helpful/unhelpful |
162
+ | `memory_relate` | Create relationship |
163
+ | `memory_relations` | View graph connections |
164
+ | `memory_batch_archive` | Archive multiple |
165
+ | `memory_ingest` | LLM-powered fact extraction |
166
+
167
+ ## File References
168
+
169
+ - Component schema: `src/component/schema.ts`
170
+ - Client API: `src/client/index.ts`
171
+ - HTTP API: `src/client/http.ts`
172
+ - MCP server: `src/mcp/server.ts`
173
+ - Shared types: `src/shared.ts`
174
+ - Full API reference: `prds/API-REFERENCE.md`
175
+ - Setup guide: `prds/SETUP.md`