@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,207 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
|
|
4
|
+
export const memoryTypeValidator = v.union(
|
|
5
|
+
v.literal("instruction"),
|
|
6
|
+
v.literal("learning"),
|
|
7
|
+
v.literal("reference"),
|
|
8
|
+
v.literal("feedback"),
|
|
9
|
+
v.literal("journal"),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const scopeValidator = v.union(
|
|
13
|
+
v.literal("project"),
|
|
14
|
+
v.literal("user"),
|
|
15
|
+
v.literal("org"),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const syncDirectionValidator = v.union(
|
|
19
|
+
v.literal("push"),
|
|
20
|
+
v.literal("pull"),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const historyEventValidator = v.union(
|
|
24
|
+
v.literal("created"),
|
|
25
|
+
v.literal("updated"),
|
|
26
|
+
v.literal("archived"),
|
|
27
|
+
v.literal("restored"),
|
|
28
|
+
v.literal("merged"),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const feedbackSentimentValidator = v.union(
|
|
32
|
+
v.literal("positive"),
|
|
33
|
+
v.literal("negative"),
|
|
34
|
+
v.literal("very_negative"),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const ingestEventValidator = v.union(
|
|
38
|
+
v.literal("added"),
|
|
39
|
+
v.literal("updated"),
|
|
40
|
+
v.literal("deleted"),
|
|
41
|
+
v.literal("skipped"),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export default defineSchema({
|
|
45
|
+
// Core memory documents — each row is one markdown memory
|
|
46
|
+
memories: defineTable({
|
|
47
|
+
projectId: v.string(),
|
|
48
|
+
scope: scopeValidator,
|
|
49
|
+
userId: v.optional(v.string()),
|
|
50
|
+
agentId: v.optional(v.string()),
|
|
51
|
+
sessionId: v.optional(v.string()),
|
|
52
|
+
title: v.string(),
|
|
53
|
+
content: v.string(),
|
|
54
|
+
memoryType: memoryTypeValidator,
|
|
55
|
+
tags: v.array(v.string()),
|
|
56
|
+
paths: v.optional(v.array(v.string())),
|
|
57
|
+
priority: v.optional(v.float64()),
|
|
58
|
+
source: v.optional(v.string()),
|
|
59
|
+
lastSyncedAt: v.optional(v.float64()),
|
|
60
|
+
checksum: v.string(),
|
|
61
|
+
archived: v.boolean(),
|
|
62
|
+
embeddingId: v.optional(v.id("embeddings")),
|
|
63
|
+
// Access tracking for relevance decay
|
|
64
|
+
accessCount: v.optional(v.float64()),
|
|
65
|
+
lastAccessedAt: v.optional(v.float64()),
|
|
66
|
+
// Feedback aggregation
|
|
67
|
+
positiveCount: v.optional(v.float64()),
|
|
68
|
+
negativeCount: v.optional(v.float64()),
|
|
69
|
+
})
|
|
70
|
+
.index("by_project", ["projectId", "archived", "memoryType"])
|
|
71
|
+
.index("by_project_scope", ["projectId", "scope", "userId", "archived"])
|
|
72
|
+
.index("by_project_title", ["projectId", "title"])
|
|
73
|
+
.index("by_type_priority", ["projectId", "memoryType", "priority"])
|
|
74
|
+
.index("by_agent", ["projectId", "agentId", "archived"])
|
|
75
|
+
.index("by_session", ["projectId", "sessionId", "archived"])
|
|
76
|
+
.index("by_source", ["projectId", "source", "archived"])
|
|
77
|
+
.index("by_last_accessed", ["projectId", "lastAccessedAt"])
|
|
78
|
+
.searchIndex("search_content", {
|
|
79
|
+
searchField: "content",
|
|
80
|
+
filterFields: ["projectId", "memoryType", "scope", "archived"],
|
|
81
|
+
})
|
|
82
|
+
.searchIndex("search_title", {
|
|
83
|
+
searchField: "title",
|
|
84
|
+
filterFields: ["projectId", "memoryType"],
|
|
85
|
+
}),
|
|
86
|
+
|
|
87
|
+
// Vector embeddings for semantic search
|
|
88
|
+
embeddings: defineTable({
|
|
89
|
+
memoryId: v.id("memories"),
|
|
90
|
+
embedding: v.array(v.float64()),
|
|
91
|
+
model: v.string(),
|
|
92
|
+
dimensions: v.float64(),
|
|
93
|
+
})
|
|
94
|
+
.index("by_memory", ["memoryId"])
|
|
95
|
+
.vectorIndex("by_embedding", {
|
|
96
|
+
vectorField: "embedding",
|
|
97
|
+
dimensions: 1536,
|
|
98
|
+
filterFields: [],
|
|
99
|
+
}),
|
|
100
|
+
|
|
101
|
+
// Project registry
|
|
102
|
+
projects: defineTable({
|
|
103
|
+
projectId: v.string(),
|
|
104
|
+
name: v.string(),
|
|
105
|
+
description: v.optional(v.string()),
|
|
106
|
+
settings: v.object({
|
|
107
|
+
autoSync: v.boolean(),
|
|
108
|
+
syncFormats: v.array(v.string()),
|
|
109
|
+
embeddingModel: v.optional(v.string()),
|
|
110
|
+
embeddingDimensions: v.optional(v.float64()),
|
|
111
|
+
// Custom prompts for intelligent ingest
|
|
112
|
+
factExtractionPrompt: v.optional(v.string()),
|
|
113
|
+
updateDecisionPrompt: v.optional(v.string()),
|
|
114
|
+
// Relevance decay settings
|
|
115
|
+
decayEnabled: v.optional(v.boolean()),
|
|
116
|
+
decayHalfLifeDays: v.optional(v.float64()),
|
|
117
|
+
// Read-only API rate limiting
|
|
118
|
+
apiRateLimit: v.optional(
|
|
119
|
+
v.object({
|
|
120
|
+
requestsPerWindow: v.float64(),
|
|
121
|
+
windowMs: v.float64(),
|
|
122
|
+
}),
|
|
123
|
+
),
|
|
124
|
+
}),
|
|
125
|
+
}).index("by_projectId", ["projectId"]),
|
|
126
|
+
|
|
127
|
+
// Sync log — tracks push/pull sync events
|
|
128
|
+
syncLog: defineTable({
|
|
129
|
+
projectId: v.string(),
|
|
130
|
+
userId: v.optional(v.string()),
|
|
131
|
+
memoryId: v.id("memories"),
|
|
132
|
+
targetFormat: v.string(),
|
|
133
|
+
targetPath: v.string(),
|
|
134
|
+
syncedAt: v.float64(),
|
|
135
|
+
checksum: v.string(),
|
|
136
|
+
direction: syncDirectionValidator,
|
|
137
|
+
}).index("by_project_user", ["projectId", "userId", "syncedAt"]),
|
|
138
|
+
|
|
139
|
+
// Memory history — audit trail of all changes
|
|
140
|
+
memoryHistory: defineTable({
|
|
141
|
+
memoryId: v.id("memories"),
|
|
142
|
+
projectId: v.string(),
|
|
143
|
+
previousContent: v.optional(v.string()),
|
|
144
|
+
newContent: v.optional(v.string()),
|
|
145
|
+
previousTitle: v.optional(v.string()),
|
|
146
|
+
newTitle: v.optional(v.string()),
|
|
147
|
+
event: historyEventValidator,
|
|
148
|
+
actor: v.string(), // userId, agentId, "mcp", "cli", "system", "ingest"
|
|
149
|
+
timestamp: v.float64(),
|
|
150
|
+
})
|
|
151
|
+
.index("by_memory", ["memoryId", "timestamp"])
|
|
152
|
+
.index("by_project", ["projectId", "timestamp"]),
|
|
153
|
+
|
|
154
|
+
// Memory feedback — quality signals from agents/users
|
|
155
|
+
memoryFeedback: defineTable({
|
|
156
|
+
memoryId: v.id("memories"),
|
|
157
|
+
projectId: v.string(),
|
|
158
|
+
sentiment: feedbackSentimentValidator,
|
|
159
|
+
comment: v.optional(v.string()),
|
|
160
|
+
actor: v.string(),
|
|
161
|
+
timestamp: v.float64(),
|
|
162
|
+
})
|
|
163
|
+
.index("by_memory", ["memoryId", "timestamp"])
|
|
164
|
+
.index("by_project", ["projectId", "timestamp"]),
|
|
165
|
+
|
|
166
|
+
// Memory relations — graph connections between memories
|
|
167
|
+
memoryRelations: defineTable({
|
|
168
|
+
projectId: v.string(),
|
|
169
|
+
fromMemoryId: v.id("memories"),
|
|
170
|
+
toMemoryId: v.id("memories"),
|
|
171
|
+
relationship: v.string(), // e.g. "contradicts", "extends", "replaces", "related_to"
|
|
172
|
+
metadata: v.optional(v.object({
|
|
173
|
+
confidence: v.optional(v.float64()),
|
|
174
|
+
createdBy: v.optional(v.string()),
|
|
175
|
+
})),
|
|
176
|
+
timestamp: v.float64(),
|
|
177
|
+
})
|
|
178
|
+
.index("by_from", ["fromMemoryId", "relationship"])
|
|
179
|
+
.index("by_to", ["toMemoryId", "relationship"])
|
|
180
|
+
.index("by_project", ["projectId", "relationship"]),
|
|
181
|
+
|
|
182
|
+
// API keys — for read-only HTTP API access
|
|
183
|
+
apiKeys: defineTable({
|
|
184
|
+
keyHash: v.string(), // SHA-256 hash of the plaintext key
|
|
185
|
+
projectId: v.string(),
|
|
186
|
+
name: v.string(), // human-readable label
|
|
187
|
+
permissions: v.array(v.string()), // allowed endpoints: "list", "get", "search", "context", "export", "history", "relations"
|
|
188
|
+
rateLimitOverride: v.optional(
|
|
189
|
+
v.object({
|
|
190
|
+
requestsPerWindow: v.float64(),
|
|
191
|
+
windowMs: v.float64(),
|
|
192
|
+
}),
|
|
193
|
+
),
|
|
194
|
+
lastUsedAt: v.optional(v.float64()),
|
|
195
|
+
expiresAt: v.optional(v.float64()),
|
|
196
|
+
revoked: v.boolean(),
|
|
197
|
+
})
|
|
198
|
+
.index("by_key", ["keyHash"])
|
|
199
|
+
.index("by_project", ["projectId", "revoked"]),
|
|
200
|
+
|
|
201
|
+
// Rate limit tracking — fixed-window token counting per API key
|
|
202
|
+
rateLimitTokens: defineTable({
|
|
203
|
+
keyHash: v.string(),
|
|
204
|
+
windowStart: v.float64(),
|
|
205
|
+
tokenCount: v.float64(),
|
|
206
|
+
}).index("by_key_window", ["keyHash", "windowStart"]),
|
|
207
|
+
});
|