@vheins/local-memory-mcp 0.1.0

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 (196) hide show
  1. package/DASHBOARD.md +129 -0
  2. package/HYBRID_SEARCH.md +204 -0
  3. package/IMPLEMENTATION.md +159 -0
  4. package/README.md +175 -0
  5. package/dist/capabilities.d.ts +22 -0
  6. package/dist/capabilities.d.ts.map +1 -0
  7. package/dist/capabilities.js +23 -0
  8. package/dist/capabilities.js.map +1 -0
  9. package/dist/dashboard/dashboard.test.d.ts +2 -0
  10. package/dist/dashboard/dashboard.test.d.ts.map +1 -0
  11. package/dist/dashboard/dashboard.test.js +362 -0
  12. package/dist/dashboard/dashboard.test.js.map +1 -0
  13. package/dist/dashboard/public/app.js +1187 -0
  14. package/dist/dashboard/public/chart.js +0 -0
  15. package/dist/dashboard/public/index.html +967 -0
  16. package/dist/dashboard/server.d.ts +3 -0
  17. package/dist/dashboard/server.d.ts.map +1 -0
  18. package/dist/dashboard/server.js +297 -0
  19. package/dist/dashboard/server.js.map +1 -0
  20. package/dist/mcp/client.d.ts +34 -0
  21. package/dist/mcp/client.d.ts.map +1 -0
  22. package/dist/mcp/client.js +181 -0
  23. package/dist/mcp/client.js.map +1 -0
  24. package/dist/mcp/client.test.d.ts +2 -0
  25. package/dist/mcp/client.test.d.ts.map +1 -0
  26. package/dist/mcp/client.test.js +130 -0
  27. package/dist/mcp/client.test.js.map +1 -0
  28. package/dist/prompts/registry.d.ts +39 -0
  29. package/dist/prompts/registry.d.ts.map +1 -0
  30. package/dist/prompts/registry.js +90 -0
  31. package/dist/prompts/registry.js.map +1 -0
  32. package/dist/resources/index.d.ts +17 -0
  33. package/dist/resources/index.d.ts.map +1 -0
  34. package/dist/resources/index.js +100 -0
  35. package/dist/resources/index.js.map +1 -0
  36. package/dist/resources/index.test.d.ts +2 -0
  37. package/dist/resources/index.test.d.ts.map +1 -0
  38. package/dist/resources/index.test.js +96 -0
  39. package/dist/resources/index.test.js.map +1 -0
  40. package/dist/router.d.ts +4 -0
  41. package/dist/router.d.ts.map +1 -0
  42. package/dist/router.js +60 -0
  43. package/dist/router.js.map +1 -0
  44. package/dist/router.test.d.ts +2 -0
  45. package/dist/router.test.d.ts.map +1 -0
  46. package/dist/router.test.js +113 -0
  47. package/dist/router.test.js.map +1 -0
  48. package/dist/search_memory_example.d.ts +3 -0
  49. package/dist/search_memory_example.d.ts.map +1 -0
  50. package/dist/search_memory_example.js +56 -0
  51. package/dist/search_memory_example.js.map +1 -0
  52. package/dist/server.d.ts +3 -0
  53. package/dist/server.d.ts.map +1 -0
  54. package/dist/server.js +91 -0
  55. package/dist/server.js.map +1 -0
  56. package/dist/storage/sqlite.d.ts +95 -0
  57. package/dist/storage/sqlite.d.ts.map +1 -0
  58. package/dist/storage/sqlite.js +537 -0
  59. package/dist/storage/sqlite.js.map +1 -0
  60. package/dist/storage/sqlite.test.d.ts +2 -0
  61. package/dist/storage/sqlite.test.d.ts.map +1 -0
  62. package/dist/storage/sqlite.test.js +358 -0
  63. package/dist/storage/sqlite.test.js.map +1 -0
  64. package/dist/storage/vectors.stub.d.ts +12 -0
  65. package/dist/storage/vectors.stub.d.ts.map +1 -0
  66. package/dist/storage/vectors.stub.js +88 -0
  67. package/dist/storage/vectors.stub.js.map +1 -0
  68. package/dist/store_memory_example.d.ts +3 -0
  69. package/dist/store_memory_example.d.ts.map +1 -0
  70. package/dist/store_memory_example.js +69 -0
  71. package/dist/store_memory_example.js.map +1 -0
  72. package/dist/test_quotes_client.d.ts +3 -0
  73. package/dist/test_quotes_client.d.ts.map +1 -0
  74. package/dist/test_quotes_client.js +72 -0
  75. package/dist/test_quotes_client.js.map +1 -0
  76. package/dist/tools/memory.delete.d.ts +9 -0
  77. package/dist/tools/memory.delete.d.ts.map +1 -0
  78. package/dist/tools/memory.delete.js +22 -0
  79. package/dist/tools/memory.delete.js.map +1 -0
  80. package/dist/tools/memory.recap.d.ts +4 -0
  81. package/dist/tools/memory.recap.d.ts.map +1 -0
  82. package/dist/tools/memory.recap.js +42 -0
  83. package/dist/tools/memory.recap.js.map +1 -0
  84. package/dist/tools/memory.search.d.ts +5 -0
  85. package/dist/tools/memory.search.d.ts.map +1 -0
  86. package/dist/tools/memory.search.js +192 -0
  87. package/dist/tools/memory.search.js.map +1 -0
  88. package/dist/tools/memory.search.test.d.ts +2 -0
  89. package/dist/tools/memory.search.test.d.ts.map +1 -0
  90. package/dist/tools/memory.search.test.js +181 -0
  91. package/dist/tools/memory.search.test.js.map +1 -0
  92. package/dist/tools/memory.store.d.ts +5 -0
  93. package/dist/tools/memory.store.d.ts.map +1 -0
  94. package/dist/tools/memory.store.js +41 -0
  95. package/dist/tools/memory.store.js.map +1 -0
  96. package/dist/tools/memory.summarize.d.ts +4 -0
  97. package/dist/tools/memory.summarize.d.ts.map +1 -0
  98. package/dist/tools/memory.summarize.js +13 -0
  99. package/dist/tools/memory.summarize.js.map +1 -0
  100. package/dist/tools/memory.update.d.ts +5 -0
  101. package/dist/tools/memory.update.d.ts.map +1 -0
  102. package/dist/tools/memory.update.js +31 -0
  103. package/dist/tools/memory.update.js.map +1 -0
  104. package/dist/tools/schemas.d.ts +334 -0
  105. package/dist/tools/schemas.d.ts.map +1 -0
  106. package/dist/tools/schemas.js +251 -0
  107. package/dist/tools/schemas.js.map +1 -0
  108. package/dist/types.d.ts +31 -0
  109. package/dist/types.d.ts.map +1 -0
  110. package/dist/types.js +3 -0
  111. package/dist/types.js.map +1 -0
  112. package/dist/utils/git-scope.d.ts +8 -0
  113. package/dist/utils/git-scope.d.ts.map +1 -0
  114. package/dist/utils/git-scope.js +38 -0
  115. package/dist/utils/git-scope.js.map +1 -0
  116. package/dist/utils/logger.d.ts +7 -0
  117. package/dist/utils/logger.d.ts.map +1 -0
  118. package/dist/utils/logger.js +40 -0
  119. package/dist/utils/logger.js.map +1 -0
  120. package/dist/utils/logger.test.d.ts +2 -0
  121. package/dist/utils/logger.test.d.ts.map +1 -0
  122. package/dist/utils/logger.test.js +84 -0
  123. package/dist/utils/logger.test.js.map +1 -0
  124. package/dist/utils/mcp-response.d.ts +44 -0
  125. package/dist/utils/mcp-response.d.ts.map +1 -0
  126. package/dist/utils/mcp-response.js +81 -0
  127. package/dist/utils/mcp-response.js.map +1 -0
  128. package/dist/utils/normalize.d.ts +4 -0
  129. package/dist/utils/normalize.d.ts.map +1 -0
  130. package/dist/utils/normalize.js +51 -0
  131. package/dist/utils/normalize.js.map +1 -0
  132. package/dist/utils/normalize.test.d.ts +2 -0
  133. package/dist/utils/normalize.test.d.ts.map +1 -0
  134. package/dist/utils/normalize.test.js +159 -0
  135. package/dist/utils/normalize.test.js.map +1 -0
  136. package/dist/utils/query-expander.d.ts +2 -0
  137. package/dist/utils/query-expander.d.ts.map +1 -0
  138. package/dist/utils/query-expander.js +50 -0
  139. package/dist/utils/query-expander.js.map +1 -0
  140. package/dist/utils/query-expander.test.d.ts +2 -0
  141. package/dist/utils/query-expander.test.d.ts.map +1 -0
  142. package/dist/utils/query-expander.test.js +35 -0
  143. package/dist/utils/query-expander.test.js.map +1 -0
  144. package/docs/PRD.md +199 -0
  145. package/docs/PROMPT-agent.md +139 -0
  146. package/docs/SPEC-git-scope.md +172 -0
  147. package/docs/SPEC-heuristics.md +199 -0
  148. package/docs/SPEC-server.md +243 -0
  149. package/docs/SPEC-skeleton.md +255 -0
  150. package/docs/SPEC-sqlite-schema.md +183 -0
  151. package/docs/SPEC-tool-schema.md +201 -0
  152. package/docs/SPEC-vector-search.md +198 -0
  153. package/docs/TEST-scenarios.md +179 -0
  154. package/package.json +43 -0
  155. package/scripts/update-null-titles-ai.mjs +272 -0
  156. package/scripts/update-titles-batch.mjs +71 -0
  157. package/scripts/update-titles.mjs +66 -0
  158. package/seed-data.mjs +151 -0
  159. package/src/capabilities.ts +22 -0
  160. package/src/dashboard/dashboard.test.ts +546 -0
  161. package/src/dashboard/public/app.js +1187 -0
  162. package/src/dashboard/public/chart.js +0 -0
  163. package/src/dashboard/public/index.html +967 -0
  164. package/src/dashboard/server.ts +347 -0
  165. package/src/mcp/client.test.ts +164 -0
  166. package/src/mcp/client.ts +212 -0
  167. package/src/prompts/registry.ts +89 -0
  168. package/src/resources/index.test.ts +132 -0
  169. package/src/resources/index.ts +113 -0
  170. package/src/router.test.ts +145 -0
  171. package/src/router.ts +80 -0
  172. package/src/server.ts +99 -0
  173. package/src/storage/sqlite.test.ts +504 -0
  174. package/src/storage/sqlite.ts +688 -0
  175. package/src/storage/vectors.stub.ts +101 -0
  176. package/src/tools/memory.delete.ts +37 -0
  177. package/src/tools/memory.recap.ts +61 -0
  178. package/src/tools/memory.search.test.ts +276 -0
  179. package/src/tools/memory.search.ts +244 -0
  180. package/src/tools/memory.store.ts +56 -0
  181. package/src/tools/memory.summarize.ts +23 -0
  182. package/src/tools/memory.update.ts +46 -0
  183. package/src/tools/schemas.ts +261 -0
  184. package/src/types.ts +36 -0
  185. package/src/utils/git-scope.ts +42 -0
  186. package/src/utils/logger.test.ts +125 -0
  187. package/src/utils/logger.ts +53 -0
  188. package/src/utils/mcp-response.ts +116 -0
  189. package/src/utils/normalize.test.ts +203 -0
  190. package/src/utils/normalize.ts +53 -0
  191. package/src/utils/query-expander.test.ts +40 -0
  192. package/src/utils/query-expander.ts +60 -0
  193. package/storage/.gitkeep +5 -0
  194. package/test.sh +48 -0
  195. package/tsconfig.json +21 -0
  196. package/vitest.config.ts +10 -0
@@ -0,0 +1,272 @@
1
+ import Database from "better-sqlite3";
2
+
3
+ const db = new Database("./storage/memory.db");
4
+
5
+ const updates = [
6
+ { id: "8f39f96f-9dfe-4fb1-9009-583dea050f8b", title: "UI/UX Standards Reference" },
7
+ { id: "d889d58d-a3c1-4a7d-abfc-c3db4767c3f8", title: "Agent Test Contract Overview" },
8
+ { id: "618271d5-b381-4f44-97fb-3640b3caefd8", title: "Agent Test Contract Prohibitions" },
9
+ { id: "1fb1ccea-4439-4dd0-bae0-e17a88e050b6", title: "Mandatory Test Workflow" },
10
+ { id: "2a1abf9e-c179-43fd-82c0-93421adf5f56", title: "PHPStan Analyze Contract" },
11
+ { id: "029194e9-5c8a-4d3c-8291-4ad00ccb83e2", title: "Core Test Contract Principles" },
12
+ { id: "f6ff0814-ccfa-45cd-8f9c-98495a4b1120", title: "Test Run Success Criteria" },
13
+ { id: "fb9bbdf9-892a-4a62-bc3d-6e69bd041b3c", title: "Test Execution Notes" },
14
+ { id: "b914ff1d-1f02-410e-a753-af46707a7c56", title: "Modern PHP Standards" },
15
+ { id: "4c1410ba-a1e5-4001-999c-8a1cf0b1a8f0", title: "Logic Placement Hierarchy" },
16
+ { id: "c52901f4-1a92-410f-a53b-ab8e078e9090", title: "Enum Usage Standards" },
17
+ { id: "125aaff7-4fec-4f6f-9f02-14d97434b85a", title: "Enum Standards Examples" },
18
+ { id: "7acd38ca-ac6e-460e-a04c-8048888be3dc", title: "Control Structure Standards" },
19
+ { id: "7bf572d9-3058-474f-a2f2-f625e45a9701", title: "Formatting and Linting Rules" },
20
+ { id: "07c1ca5c-d6d4-4c46-ab0c-ce9d2048d17a", title: "Testing Standards Reference" },
21
+ { id: "e110d653-0975-4102-aac7-c022de62ad4d", title: "Database Key Integrity Rules" },
22
+ { id: "d9723501-cd6a-48e0-a216-5317911dd520", title: "Database Type Precision Rules" },
23
+ { id: "4b3b628f-12e7-486e-856b-1e96c5095948", title: "Database Indexing Strategy" },
24
+ { id: "17c6c930-6085-4f07-bfa1-0ed36ec14a88", title: "PermissionGrid Collection Fix" },
25
+ { id: "01cbd943-b041-4b2e-8447-322bdb4577f3", title: "Permission Grid Architecture" },
26
+ { id: "f150685f-b0d5-451e-a90a-1160a6ac8578", title: "Configuration Cluster Audit Findings" },
27
+ { id: "cd6c4cbb-5dfa-44dd-abcb-7a45fc6b925d", title: "Configuration Audit Fully Fixed" },
28
+ { id: "4a609f56-ee19-4c7e-b3cf-b7db0988f751", title: "Filament Edit Profile UUID Issue" },
29
+ { id: "302d10e6-679c-4112-a5b9-800dc3c76c65", title: "UUID Adapters for Edit Profile" },
30
+ { id: "65b2abd8-46d3-4271-b439-41bff94bf7a9", title: "Edit Profile Tests Without RefreshDatabase" },
31
+ { id: "3714b83f-2227-47e7-a652-cbee3bcb7786", title: "Edit Profile Plugin Integration" },
32
+ { id: "44e46e26-b6e0-4832-8803-d3ce87619dc8", title: "Edit Profile Moved to Header Menu" },
33
+ { id: "c4fbd382-6d09-4d91-b2c4-5cce9ac9b4a4", title: "Tabbed Edit Profile Page" },
34
+ { id: "4d394a7a-6d74-4866-b17a-d435a81b6636", title: "UUID-Safe Edit Profile Override" },
35
+ { id: "dbb6654d-3de9-4705-bd47-24bae762ded8", title: "Filament Impersonation Architecture" },
36
+ { id: "49884dea-3e94-475b-8d05-355312fdb218", title: "Organization Overview Refactor Complete" },
37
+ { id: "0866ef97-7016-4b66-980b-a90172813154", title: "Combined Company Contact Chart Widgets" },
38
+ { id: "4c86f596-c45b-4aaf-ac6d-6e30060771fe", title: "Organization Charts Initialization Fix" },
39
+ { id: "00794324-dfa3-4926-b031-f2253cb858e1", title: "List Page Header Widget Pattern" },
40
+ { id: "df263657-7540-4755-b082-29d8bdf560a6", title: "Activity Logging Model Relations" },
41
+ { id: "5090e185-787e-4c1a-b900-11817fa7fa3e", title: "Product Overview Widgets Added" },
42
+ { id: "149e6183-a8f3-441a-a073-0efd716e5158", title: "User Login History Relation Manager" },
43
+ { id: "d4898e3c-c609-4fd9-b981-87f087ad6fe8", title: "Login History Translation Keys" },
44
+ { id: "dbaa87c8-f4b3-4b20-8e6e-5ffb5b0a7ac3", title: "Accessibility Governance Services" },
45
+ { id: "a5a98929-8a5a-4c2f-8760-4dbc11b7e366", title: "HR Module Initial Implementation" },
46
+ { id: "68f3da37-5d53-430e-abbf-d53b9abad91c", title: "Restart App After Policy Changes" },
47
+ { id: "6ae93530-804b-4dbc-9742-67c8c306cddc", title: "HR Model Policies" },
48
+ { id: "4474ac72-5b5b-48a1-a26c-effbad880194", title: "HR Module Refactor Aligned with PurchaseRequest" },
49
+ { id: "f9857baa-9513-4955-abb1-b5bbb13385b6", title: "AttendanceResource Structure Refactor" },
50
+ { id: "ccafec7b-7a76-43cc-b505-b2edd0694b76", title: "HumanCapital Audit Completion" },
51
+ { id: "4ecfde94-4a16-4d63-a665-202edeece951", title: "All Resources Use getEloquentQuery" },
52
+ { id: "9e4c3eeb-904f-4568-9625-f78644d64e44", title: "Required Filament Resource Query Pattern" },
53
+ { id: "76a3d1a3-9ee7-4e8f-9a64-c028c4e72211", title: "HumanCapital Infolists Synced with Forms" },
54
+ { id: "1d50bffe-b3ae-4840-9afe-e55160b98132", title: "Keep Form and Infolist in Sync" },
55
+ { id: "07b192cc-32ff-4aab-9cb0-651b3b44369a", title: "BloodType Enum and Employee Bank Fixes" },
56
+ { id: "81fe0a6d-d03a-44fb-93a7-de737ccd3423", title: "EmployeeBank Rename and BloodType Import" },
57
+ { id: "a6d55c29-435a-46ce-92fc-449e72b9a9f4", title: "Master Bank Indonesia Implementation" },
58
+ { id: "be2be6ca-dfd6-4fee-873b-a5a7dc022162", title: "EmployeeBank Uses bank_id Relation" },
59
+ { id: "b0cdc934-b970-454c-99fc-3b8f809f91bd", title: "Employee Sequence-Based Code Generation" },
60
+ { id: "46238b8a-6383-4b5a-b852-49276230ed71", title: "Employee Contact User Core Integration" },
61
+ { id: "5544f864-c76f-4423-afac-40566c4d0a38", title: "Test Suite Architecture Reorganization" },
62
+ { id: "35244acd-6565-4099-8aab-fe6a63b3c7dc", title: "All Tests Migrated to Pest" },
63
+ { id: "1dc9c426-2461-43c5-a274-9a456d000302", title: "Test Folder Reorganization" },
64
+ { id: "f1ba91ff-3e1a-49bd-af03-baed2c38b429", title: "Employee Bank Tooltip Fix" },
65
+ { id: "0629635d-64e3-4300-ab54-f10ae0c20b03", title: "Employee Address Integration" },
66
+ { id: "2739a271-5554-4f75-bc97-40ee73899f02", title: "Employee Address Polymorphic Integration" },
67
+ { id: "d708393f-fff7-44f4-b45a-7558938e6f41", title: "Password Reset Route Requirement" },
68
+ { id: "d794e098-7c3b-4df2-9b5a-1d1db394e4ba", title: "Pest Testing Framework Standard" },
69
+ { id: "06e95b54-438f-4253-9b25-1010baa9083e", title: "EmployeeAddresses Converted to Pest" },
70
+ { id: "598eb161-c68f-4fef-96b7-90ba258d1383", title: "Address Repeater Modal Init Fix" },
71
+ { id: "b4ba0753-c3c9-49f7-befb-d5c498d3f038", title: "Emergency Contacts Use Contacts Table" },
72
+ { id: "5c528770-13e7-4975-9fdb-74d397764db5", title: "Contact Relation Enum for Family Links" },
73
+ { id: "aebf005b-3ec6-4988-8d01-5cb916026a0e", title: "Emergency Contacts Relationship Pattern" },
74
+ { id: "f1de47a2-8039-483a-b9d9-78fe7db42c88", title: "Emergency Contact MorphOne Address" },
75
+ { id: "79fa3dd1-4155-4545-acfe-e03957f41ccd", title: "Emergency Contact Address State Path" },
76
+ { id: "fabefcff-331c-49d6-b2d6-f12766cd0677", title: "Emergency Contact Address Defaults" },
77
+ { id: "e5322903-ffe8-48d2-bba7-54aaca82747b", title: "CompanyType Resource Implementation" },
78
+ { id: "92a3f448-18bf-41c6-9945-a956261fc97f", title: "AddressSchema Parameter Contract" },
79
+ { id: "1ddcaf8f-e9e9-42d7-b560-f85f0c4f263a", title: "AddressSchema Map Picker Integration" },
80
+ { id: "3aa0cd4d-6b4d-4abb-99ce-d3733374b151", title: "Leaflet Animation Drift Fix" },
81
+ { id: "8c73f52a-b3b3-4430-b5a5-a0fa5683aefd", title: "Leaflet Module Refactor" },
82
+ { id: "d51d23f9-0899-4228-9bb9-dc0af98c3321", title: "Leaflet Longitude NaN Bug Fix" },
83
+ { id: "cd5f12b9-ee41-4b5e-8078-67b603b6bc82", title: "Reverse Geocoding Autofill" },
84
+ { id: "17e30e9a-9d8b-4e88-b60d-ebf8a31f28e7", title: "Address Map Layout Improvements" },
85
+ { id: "feeb13d7-d226-46b6-9480-006938d4a4ed", title: "Live Address Badge on Map" },
86
+ { id: "ca92f27e-ce6e-47cf-ac78-fd10a8eeb971", title: "Trait Alias Fix for Address Traits" },
87
+ { id: "22c5bcd5-45b5-49bb-bd0b-7a471a47a6be", title: "Form Edit Coordinate Hydration" },
88
+ { id: "36a09c0c-0795-4adc-b795-c599a663330e", title: "Company Edit Geolocation Hydration" },
89
+ { id: "dd92f509-217b-4043-a384-fc80de74fdd8", title: "Full Address Relation Hydration" },
90
+ { id: "4cf1a20d-ff45-43e9-b1d0-6f4b23a13e46", title: "AddressSchema Hydration Callback Fix" },
91
+ { id: "35311555-a9bc-4bde-b824-e65ff802d042", title: "Leaflet Blade Component Cleanup" },
92
+ { id: "59d72730-2fc5-4a6a-b31b-955791e86a4f", title: "Initial Map Badge and Radius Fix" },
93
+ { id: "492bbd81-f5cc-4ec7-ae24-d3cb41b84991", title: "Livewire Form State Access Fix" },
94
+ { id: "cd1dd54b-ecd1-45bd-87e8-1d5792d15974", title: "Map Radius Load Retry Fix" },
95
+ { id: "74820082-f22c-4422-978b-82e8a7f051f0", title: "Geofence Radius Initialization Fix" },
96
+ { id: "a71506fe-b80b-41ee-9744-fa95abdc733f", title: "Leaflet Geofence Radius Fix" },
97
+ { id: "b931384b-074c-466f-9b3a-65877d15e20b", title: "Livewire Window Radius Dispatch Fix" },
98
+ { id: "3ebe7a77-c739-4431-a631-06eefcf0f35b", title: "Employee Education Feature Complete" },
99
+ { id: "53ad12b9-afaf-44c9-b46c-b96534a848b8", title: "EmployeeEducation Test Coverage Complete" },
100
+ { id: "7d94d017-27c9-49b2-ad2f-1d6581abce29", title: "EmployeeEducation Atomic Schema Refactor" },
101
+ { id: "90203751-9668-4530-853d-7f97dec3d946", title: "LocaleDivisionService Closure Fix" },
102
+ { id: "df22daff-9dc4-4444-9dab-f791236ba30f", title: "Export Classified as High Risk" },
103
+ { id: "1e79a98a-bfe4-41b6-bbeb-d022af33220a", title: "SpatieMediaLibrary Import Namespace" },
104
+ { id: "55a1cf62-3256-4cd8-96f8-6d3fce9618f3", title: "LeafletMap Form Component Path" },
105
+ { id: "434a33bf-d3fa-4864-a57c-c54f1440445e", title: "User Password Dehydration Pattern" },
106
+ { id: "57751765-7154-4622-a156-9f2a43c24b7e", title: "Filament v4 Action Namespace Change" },
107
+ { id: "0fb827ea-e6d7-4584-9730-cd68c5a0ed9f", title: "Grid and Section Namespace Change" },
108
+ { id: "bbd10be1-7865-4b98-9295-b531f21ab47b", title: "PHPStan Entry Component Fixes" },
109
+ { id: "ddbd3db7-76f8-489f-81dc-bf974da7a318", title: "Sales Cluster PHPStan Remediation" },
110
+ { id: "7dbd0c55-5f74-4a1d-8140-8b44ea41df84", title: "PurchaseRequestResource PHPStan Fixes" },
111
+ { id: "f9b8a9b0-733d-4a66-bf60-af2d750c1020", title: "Procurement Cluster PHPStan Patterns" },
112
+ { id: "ff85e478-e9c9-4d90-8c76-2c755c32d695", title: "Procurement Page Subnavigation Complete" },
113
+ { id: "733ecb2e-f6bb-4c3c-9fc9-888e88978d21", title: "Procurement Memory Leak Root Cause" },
114
+ { id: "1f5b0138-671b-402c-8dba-71bd43467e87", title: "Procurement PHPStan Segfault Fix" },
115
+ { id: "34d75c43-8be6-409c-910f-7b679a044622", title: "Procurement Schema Graph Segfault Cause" },
116
+ { id: "f4614f3d-264e-4ea8-98cc-475be472c643", title: "FormService Chain Type Hint Fix" },
117
+ { id: "f375bb43-e841-4857-8950-84add032e591", title: "PHPStan Parallel Worker Segfault Workaround" },
118
+ { id: "ca30f8f5-d371-4185-86c2-ec5f294f6af2", title: "Procurement State PHPStan Fixes" },
119
+ { id: "f2271c58-347c-4a13-a405-1e4099180b68", title: "Company Category Limit Validation" },
120
+ { id: "568b137e-a136-4c46-86c7-4be24c39b09b", title: "Contact Form Address Tab" },
121
+ { id: "a253a902-8b96-4cf3-acf9-6c8edb0f11de", title: "Contact Address Relationship Saving" },
122
+ { id: "c5b33671-97b6-4360-bc5f-dc72f192f3f7", title: "Group Mutation Lifecycle Pattern" },
123
+ { id: "5a1b55d3-1135-49df-ab20-c56148b2f9be", title: "Map Overlay z-index Fix" },
124
+ { id: "f8878650-e930-444f-84eb-0e1a9f931a23", title: "Company Type Category Pivot" },
125
+ { id: "ab55c73f-48e2-4cf5-ab1a-10742afc27f7", title: "Filament Atomic Schema Pattern" },
126
+ { id: "42fc12c4-81df-466b-a5dc-ccb1e79c3171", title: "Skill Files Converted to Plain Markdown" },
127
+ { id: "dd8a2f2f-484c-43e7-9eda-c2af5c278667", title: "HumanCapital Audit Fix Batch" },
128
+ { id: "2e611a78-f4d2-4533-8d41-a06286d9dccb", title: "HumanCapital View Page Pattern" },
129
+ { id: "e12829e6-99c4-4a01-9abb-1fad94d94a7a", title: "HumanCapital Audit Standardization" },
130
+ { id: "d9c1ad2c-11b3-419d-af8b-ff7ff1d0572a", title: "Architecture Audit Anomalies" },
131
+ { id: "0c7853c3-3f34-4ea3-8a82-03cd837d7e61", title: "View Page Header Action Standard" },
132
+ { id: "2e8b4b4e-a910-46cd-b6ed-83854b784a1f", title: "Filament Heroicon Enum Standard" },
133
+ { id: "18c3cd0e-b19f-4891-bfd6-eaa0a8d80d10", title: "Education History Table Method" },
134
+ { id: "ecd38029-8175-49ad-9c56-79125b3ebc79", title: "Nested Closure Violations Found" },
135
+ { id: "5ce28640-46a3-4956-8237-8eccde140ba2", title: "Nested Closure Audit Complete" },
136
+ { id: "9c0902c8-6656-44d7-bab8-84036aa43bc2", title: "Full Cluster Closure Violation Scan" },
137
+ { id: "19c45e11-526b-4854-994f-13aabe1937cc", title: "LocaleDivisionService Refactor Phase 1" },
138
+ { id: "5cf7d896-bdf8-46ce-b3be-98ed760fb12b", title: "All Closure Violations Fixed" },
139
+ { id: "71328408-9a17-4b69-9e7a-f74698268f20", title: "PHPStan Trait Requirement Rule" },
140
+ { id: "403d7956-6b6e-4ac8-a9f4-94a78b383d1a", title: "Stable PHPStan Parallel Config" },
141
+ { id: "f3e3f63e-e542-4eb8-a51c-f6553822c4ee", title: "Filtered Test Run Requirement" },
142
+ { id: "d6f46285-3128-4e82-a4d9-093afaf54553", title: "Local Test Execution Rules" },
143
+ { id: "a9002120-1d68-4fc0-a6da-a05f42274f28", title: "Common PHPStan Error Patterns" },
144
+ { id: "eb0831db-f908-4b94-bdb4-14ca16600c20", title: "PHPStan Batch Fix Session" },
145
+ { id: "2ac69a43-2c0e-404c-83e8-9c1f10bb4001", title: "Comprehensive PHPStan Remediation" },
146
+ { id: "1d205a43-6486-4d04-9c51-9edba90b9e0b", title: "Procurement State Still Causes Segfault" },
147
+ { id: "f81f6c41-a197-4362-84b0-e1f4e3f7439d", title: "PHPStan Segfault Resolved" },
148
+ { id: "9cde1f8d-079c-43be-9d29-f732921d784d", title: "AddressSchema State Service Refactor" },
149
+ { id: "a4d38f36-bea5-4186-a484-571544a57bb6", title: "AddressSchema Autoload Fix" },
150
+ { id: "2cbfcd9c-3e53-4c67-aa15-89f657a83fc8", title: "PurchaseRequest Tax State Wrapper Fix" },
151
+ { id: "d11494ab-7ebe-448b-8922-6ee3168c8c1f", title: "Schema-Safe HasCalculations Wrappers" },
152
+ { id: "e0b47972-fa89-4910-b55a-e54c0dd05f68", title: "Closure Delegator Refactor" },
153
+ { id: "5e351a49-a493-4cd7-b22e-300cf77966de", title: "First-Class Callable Wrapper Cleanup" },
154
+ { id: "e8c7857f-dbc6-45d0-b0d9-d764570f3e7b", title: "Direct Service Call Refactor" },
155
+ { id: "fd66464e-04e3-4453-9378-f9005b2bb4a5", title: "HasVisibilityClosures Removed" },
156
+ { id: "6b2ddd4b-31be-4f47-ab34-34b8d2420878", title: "State Method Naming Convention" },
157
+ { id: "66491d8e-e6c0-4831-afe6-ec61e5ecf83d", title: "Forbidden Closure Delegator Pattern" },
158
+ { id: "64b39b4b-db6f-4650-9371-30e4bcbe8246", title: "State Update Callback Pattern" },
159
+ { id: "8789fd15-3656-48e5-820f-948abe00898e", title: "ProductCategory Prefill Moved to State" },
160
+ { id: "1577aa8b-1dbe-454d-9075-037a3d68ed32", title: "BusinessUnit Renaming Pattern" },
161
+ { id: "3d99fbee-912e-497d-98fe-586ff2c455b6", title: "Disable PHPStan Parallel on Trait States" },
162
+ { id: "0f2da83e-e903-4543-b7e4-61b4de7774ac", title: "Mandatory Recalculate Callback Pattern" },
163
+ { id: "83cef32e-ebfe-459a-86d9-8e501c59dac4", title: "Explicit Service Callback Pattern" },
164
+ { id: "40bbddd4-2458-42b3-99f6-df7c6198816d", title: "HumanCapital Exporter Namespace Fix" },
165
+ { id: "543dd381-8d27-439f-875b-d19abcbf7628", title: "Importer Rollout Complete" },
166
+ { id: "d6fe5a13-bd9d-43e6-917f-1745779286d2", title: "Repeater-Safe Pivot Ordering Rule" },
167
+ { id: "64b069ed-3fa2-4a30-bbba-554a40096b2b", title: "Payroll Page Subnavigation Pattern" },
168
+ { id: "db89be41-03b7-4fb6-a82c-3e6fcf3daf17", title: "SalaryRule and SalaryStructure Audit" },
169
+ { id: "c2c7a812-a629-4aca-af4f-f1e5a0cc89e4", title: "Demo Seeder Layered Architecture" },
170
+ { id: "67c531e1-ea98-400d-9b22-20bfc12a2bf6", title: "Active Contract Column Added" },
171
+ { id: "89f24320-b7dd-48ee-a034-dd4ea94bc250", title: "CreatePromotion Subnavigation Fix" },
172
+ { id: "eade49cb-1971-44b8-9d88-f92bd8c86c84", title: "PromotionResource Audit Fixes" },
173
+ { id: "9e110359-21aa-4471-a91d-694bb8b5cfc4", title: "TextEntry URL Standardization" },
174
+ { id: "1ec0eb39-0953-427d-93c6-b2364bbf1a98", title: "Major Feature Completion Audit" },
175
+ { id: "41c0bc2b-4b01-4179-811e-20cfbfecc25b", title: "Employee Promotions Complete" },
176
+ { id: "a4028dda-f7ae-4f1b-b6e6-cd173ab5f491", title: "Deterministic Seeder Pattern" },
177
+ { id: "f28e47ae-6b8d-47e0-ac3f-1e23e9118eb5", title: "Demo Currency Seeder Centralized" },
178
+ { id: "4b723fb9-e21d-4d8e-be48-d33a9d508f1f", title: "DbConfig Becomes Single Source" },
179
+ { id: "351a4e85-eaf8-4e30-b0da-00f55aa3e066", title: "Missing Policies Created" },
180
+ { id: "7fce684a-9e93-4024-8b2b-cd649e699b55", title: "AnalyticDashboard Permission Prefix Bug" },
181
+ { id: "f725bc92-826c-4d13-bab3-a345c309ab43", title: "AnalyticsCluster Page Override Removed" },
182
+ { id: "680b51a9-cc8b-4bd0-b248-61ac779f23d8", title: "Database Fields Must Be English" },
183
+ { id: "d431a5b6-f66e-45fd-9cc5-fdbbbdd23c23", title: "Duplicate Tax ID Column Issue" },
184
+ { id: "706903c1-e361-4d52-a930-dee54857758c", title: "Translatable UI Labels Only" },
185
+ { id: "4315ad9e-6fde-4801-8cf9-d13f3135c023", title: "TikTok Store Order Sync Chain" },
186
+ { id: "b55fc0c7-4814-4e79-b0b3-7522b85b4586", title: "Store Order Variadic Signature Fix" },
187
+ { id: "3ad35e7f-609f-41c6-8dc4-c89f2abeae73", title: "Sync Job Display Name Improvements" },
188
+ { id: "c9bb4446-a80a-4fcf-b7e0-cae87337e164", title: "TikTokOrderService Static Call Bridge" },
189
+ { id: "64c3cc14-ad14-49a5-adc5-5370e986d18e", title: "Canonical Shop Filter Resolution" },
190
+ { id: "beb9ed74-e0ce-4daf-be62-2b9cf2847861", title: "Settlement Store Sync Refactor" },
191
+ { id: "9ae08e33-75c5-4edc-b4f7-5443a65841ba", title: "Statement Transactions Clean Break" },
192
+ { id: "1fff3eff-dfb6-402b-887d-d70637b432de", title: "Analytics Cluster Static Service Cleanup" },
193
+ { id: "60d72157-83cc-40fb-84b7-d72054487d56", title: "Eager Load New Shop Mapping Fields" },
194
+ { id: "8b01af64-7e45-495d-8e6e-2583bdd98ce3", title: "Skip Accurate Push on Refunds" },
195
+ { id: "23ee2756-3f4d-45b5-b90c-43f9f360aa3b", title: "Accurate Duplicate Invoice Recovery" },
196
+ { id: "95396a31-71bd-4251-bdde-af64b9da6ba4", title: "Accurate Reconcile Refactor" },
197
+ { id: "58829066-1512-44fc-887a-c6f9e897d744", title: "Accurate Reconcile Daily Schedule" },
198
+ { id: "eea68e7b-9559-49ad-8bd0-2e6f09fb31ea", title: "Hardcoded Signature Data Regression" },
199
+ { id: "4046acf2-4c5a-4526-b308-f6004414fe7a", title: "POS Documentation Coverage Checklist" },
200
+ { id: "0323b415-894f-4ead-ab94-32d58161cb04", title: "Critical Issues in PDF Refactor PR" },
201
+ { id: "48caa34c-c9d4-411d-bd09-1b76ef297c0c", title: "PDF Refactor Testing Gaps" },
202
+ { id: "248cac7f-60ad-4681-a21d-db6976886ac2", title: "ExportEmployeePDF IDOR Risk" },
203
+ { id: "5eca2500-0629-4502-a6f9-10f637de682a", title: "PR #96 Security Approval" },
204
+ { id: "0b9deb79-dae3-456b-bdf4-2a065a358d2a", title: "Clear Debounce Timers on Unmount" },
205
+ { id: "c348d00a-eef2-4ee1-bd70-bc30893326e6", title: "Avoid Dual Filtering Strategy" },
206
+ { id: "dcb1b51e-1cdc-4d5b-8096-cba71f8f994d", title: "Router Guard Auth Race Condition" },
207
+ { id: "2b968612-cfa7-4adf-a548-0da58cfdc458", title: "Logout vs ClearAuthState Pattern" },
208
+ { id: "68a593f4-18fe-49c7-b696-0de5231c63df", title: "Separate Debounce Timers per Task" },
209
+ { id: "f8e6c494-e9a1-4e3f-88ec-87ba75a619eb", title: "Filament v5 Enum Interface Gap" },
210
+ { id: "fa176615-29bb-45d3-a506-ce473a792223", title: "Filament v5 Badge Enum Pattern" },
211
+ { id: "01fc97b0-027d-4e8c-a078-025afa5f642b", title: "Critical Duplication Pattern in PR #982" },
212
+ { id: "2eb2547e-2e72-48b3-b236-fc1d78a95f68", title: "Report Refactor Quality Issues" },
213
+ { id: "63b32961-8c7a-4395-85b7-8f868ba2c664", title: "Alphabetize Vue Class Attributes" },
214
+ { id: "1dcb3381-7541-4654-bdd8-15ec54ae5af2", title: "Filament v5 Upgrade Architecture Pattern" },
215
+ { id: "328ba0c8-e6b4-438e-bd7b-98ad96173f73", title: "MediaController IDOR Protection" },
216
+ { id: "2e2a58f3-003d-4887-8490-b7b7dafab974", title: "PR #116 Upgrade Approved" },
217
+ { id: "cfa732ba-cbe7-4cc0-bbd5-f6f6d1e3d08b", title: "Router Guard Logout Navigation Race" },
218
+ { id: "e97f7b88-0323-4189-b886-cf4395b39551", title: "Token Validation Race Condition" },
219
+ { id: "9c4079b8-2c3a-4041-9f35-8b0b72039d85", title: "Strict Role Equality Validation" },
220
+ { id: "7c15b06f-32d2-4507-93b0-f44b371cf12e", title: "Extract Shared QC Formatters" },
221
+ { id: "8086b4db-14c7-4742-bcda-13353392a83f", title: "Suspended User Checks Must Be Server-Side" },
222
+ { id: "acd9ef46-f879-42c7-ac9a-001c1c8c08e7", title: "PR #97 Visualization Rejected" },
223
+ { id: "fd0a40df-124f-4f5f-86d9-6c20c4be4c6b", title: "Concurrent fetchUser Guard Issue" },
224
+ { id: "edfeac45-f75a-46f2-9f5b-2c76c6148e68", title: "Dashboard Layout and Store Issues" },
225
+ { id: "e91aa766-b3ae-4dd6-a853-1d600eac0ddd", title: "Component Style Encapsulation Issue" },
226
+ { id: "1814846f-daa7-4bd1-a225-f8567981b329", title: "Prefer Heroicon Enums" },
227
+ { id: "56eaf88b-6935-4c8c-9536-d80b2c61d42f", title: "SQLite-Safe Migration Pattern" },
228
+ { id: "34eedb7d-d4f9-4dfe-a333-719145b5f8bd", title: "Concern-Based Test Architecture" },
229
+ { id: "aba16f6b-5b7e-46a5-a20f-4eea060f73b5", title: "Pinia Stores Must Re-throw Errors" },
230
+ { id: "3f4851d6-b5ad-4e2c-a9a3-b978b8cbcb69", title: "Check Legacy and Modular Auth Views" },
231
+ { id: "aab1e321-91b1-4f95-88ab-938cda0870aa", title: "SequenceService Numbering Pattern" },
232
+ { id: "422b8a89-2aa1-45ac-8928-e53cbe43872e", title: "BOM Moved to Manufacturing Cluster" },
233
+ { id: "85918e65-e55a-4a63-811e-c5a0a695cabf", title: "MaterialIssuanceInfolist TypeError Fix" },
234
+ { id: "bfa527c1-fe63-4811-be29-22692b5e1b45", title: "Work Order Layout Adjustment" },
235
+ { id: "d6202abd-42af-4199-9b99-712f204f5591", title: "Work Order Workflow UI Refactor" },
236
+ { id: "9e357508-b3be-4cd2-8f3c-21afd23e53d2", title: "Work Order Stock Movement Infolist" },
237
+ { id: "6ec5f4df-addb-43f6-a3af-e606ba854722", title: "Material Issuance Workflow Step" },
238
+ { id: "0d6b5c3b-c21e-41ba-9623-29c303a71b30", title: "Finalized Work Order UI" }
239
+ ];
240
+
241
+ const existing = db
242
+ .prepare("SELECT id FROM memories WHERE title IS NULL OR trim(title) = ''")
243
+ .all()
244
+ .map((row) => row.id);
245
+
246
+ const existingSet = new Set(existing);
247
+ const pendingUpdates = updates.filter((row) => existingSet.has(row.id));
248
+
249
+ if (pendingUpdates.length !== existing.length) {
250
+ const missing = existing.filter((id) => !updates.find((row) => row.id === id));
251
+ throw new Error(`Missing titles for ${missing.length} memories: ${missing.join(", ")}`);
252
+ }
253
+
254
+ const stmt = db.prepare("UPDATE memories SET title = ?, updated_at = ? WHERE id = ?");
255
+ const now = new Date().toISOString();
256
+
257
+ const tx = db.transaction((rows) => {
258
+ for (const row of rows) {
259
+ stmt.run(row.title, now, row.id);
260
+ }
261
+ });
262
+
263
+ tx(pendingUpdates);
264
+
265
+ const remaining = db
266
+ .prepare("SELECT COUNT(*) AS count FROM memories WHERE title IS NULL OR trim(title) = ''")
267
+ .get().count;
268
+
269
+ console.log(JSON.stringify({
270
+ updated: pendingUpdates.length,
271
+ remaining,
272
+ }, null, 2));
@@ -0,0 +1,71 @@
1
+ import Database from "better-sqlite3";
2
+
3
+ const DB_PATH = "./storage/memory.db";
4
+ const db = new Database(DB_PATH);
5
+
6
+ // Get all memories with null titles
7
+ const memories = db.prepare("SELECT id, type, content FROM memories WHERE title IS NULL OR title = ''").all();
8
+
9
+ console.log(`Found ${memories.length} memories with null titles`);
10
+
11
+ const OLLAMA_URL = "http://localhost:11434/api/generate";
12
+ const MODEL = "qwen3.5:cloud";
13
+
14
+ async function generateTitlesBatch(contents) {
15
+ const prompt = `Generate short titles (max 50 chars) for each of these ${contents.length} memory entries.
16
+ Respond with a JSON array of titles in the same order, nothing else.
17
+
18
+ ${contents.map((c, i) => `${i + 1}. [${c.type}] ${c.content.substring(0, 200)}`).join('\n')}`;
19
+
20
+ try {
21
+ const response = await fetch(OLLAMA_URL, {
22
+ method: "POST",
23
+ headers: { "Content-Type": "application/json" },
24
+ body: JSON.stringify({
25
+ model: MODEL,
26
+ prompt,
27
+ stream: false
28
+ })
29
+ });
30
+
31
+ const data = await response.json();
32
+ let text = data.response?.trim() || "";
33
+
34
+ // Try to parse as JSON array
35
+ try {
36
+ const titles = JSON.parse(text);
37
+ return titles;
38
+ } catch {
39
+ // If not valid JSON, try to extract titles manually
40
+ const lines = text.split('\n').filter(l => l.trim());
41
+ return lines.map(l => l.replace(/^\d+[\.\)]\s*/, '').replace(/^["']|["']$/g, '').trim().substring(0, 50));
42
+ }
43
+ } catch (error) {
44
+ console.error("Error:", error.message);
45
+ return contents.map(c => c.content.substring(0, 47) + "...");
46
+ }
47
+ }
48
+
49
+ // Process in batches
50
+ const BATCH_SIZE = 10;
51
+ let processed = 0;
52
+
53
+ for (let i = 0; i < memories.length; i += BATCH_SIZE) {
54
+ const batch = memories.slice(i, i + BATCH_SIZE);
55
+ const titles = await generateTitlesBatch(batch);
56
+
57
+ for (let j = 0; j < batch.length; j++) {
58
+ let title = titles[j] || batch[j].content.substring(0, 47) + "...";
59
+ title = title.replace(/^["']|["']$/g, '').trim();
60
+ if (title.length > 50) title = title.substring(0, 47) + "...";
61
+
62
+ db.prepare("UPDATE memories SET title = ? WHERE id = ?").run(title, batch[j].id);
63
+ processed++;
64
+ }
65
+
66
+ console.log(`[${processed}/${memories.length}] Batch ${Math.ceil((i + BATCH_SIZE) / BATCH_SIZE)} done`);
67
+ await new Promise(r => setTimeout(r, 500));
68
+ }
69
+
70
+ console.log("Done!");
71
+ db.close();
@@ -0,0 +1,66 @@
1
+ import Database from "better-sqlite3";
2
+ import { readFileSync } from "fs";
3
+
4
+ const DB_PATH = "./storage/memory.db";
5
+ const db = new Database(DB_PATH);
6
+
7
+ // Get all memories with null titles
8
+ const memories = db.prepare("SELECT id, type, content FROM memories WHERE title IS NULL OR title = ''").all();
9
+
10
+ console.log(`Found ${memories.length} memories with null titles`);
11
+
12
+ const OLLAMA_URL = "http://localhost:11434/api/generate";
13
+ const MODEL = "qwen3.5:cloud";
14
+
15
+ async function generateTitle(content, type) {
16
+ const prompt = `Based on this memory content, generate a short descriptive title (max 50 characters).
17
+
18
+ Memory type: ${type}
19
+ Content: ${content.substring(0, 500)}
20
+
21
+ Respond ONLY with the title, nothing else.`;
22
+
23
+ try {
24
+ const response = await fetch(OLLAMA_URL, {
25
+ method: "POST",
26
+ headers: { "Content-Type": "application/json" },
27
+ body: JSON.stringify({
28
+ model: MODEL,
29
+ prompt,
30
+ stream: false,
31
+ format: "json"
32
+ })
33
+ });
34
+
35
+ const data = await response.json();
36
+ let title = data.response?.trim() || "";
37
+
38
+ // Clean up title
39
+ title = title.replace(/^["']|["']$/g, "").trim();
40
+ if (title.length > 50) {
41
+ title = title.substring(0, 47) + "...";
42
+ }
43
+
44
+ return title || content.substring(0, 47) + "...";
45
+ } catch (error) {
46
+ console.error("Error generating title:", error.message);
47
+ return content.substring(0, 47) + "...";
48
+ }
49
+ }
50
+
51
+ let processed = 0;
52
+
53
+ for (const memory of memories) {
54
+ const title = await generateTitle(memory.content, memory.type);
55
+
56
+ db.prepare("UPDATE memories SET title = ? WHERE id = ?").run(title, memory.id);
57
+
58
+ processed++;
59
+ console.log(`[${processed}/${memories.length}] ${memory.id.substring(0, 8)} -> "${title}"`);
60
+
61
+ // Small delay to not overload the LLM
62
+ await new Promise(r => setTimeout(r, 100));
63
+ }
64
+
65
+ console.log("Done!");
66
+ db.close();
package/seed-data.mjs ADDED
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "child_process";
3
+ import { createInterface } from "readline";
4
+
5
+ const serverPath = "./dist/server.js";
6
+ const serverProcess = spawn("node", [serverPath], {
7
+ stdio: ["pipe", "pipe", "inherit"]
8
+ });
9
+
10
+ let requestId = 0;
11
+ const pendingRequests = new Map();
12
+
13
+ const rl = createInterface({
14
+ input: serverProcess.stdout,
15
+ crlfDelay: Infinity
16
+ });
17
+
18
+ rl.on("line", (line) => {
19
+ try {
20
+ const response = JSON.parse(line);
21
+ if (!response.id) return;
22
+
23
+ const pending = pendingRequests.get(response.id);
24
+ if (pending) {
25
+ pendingRequests.delete(response.id);
26
+ if (response.error) {
27
+ pending.reject(new Error(response.error.message));
28
+ } else {
29
+ pending.resolve(response.result);
30
+ }
31
+ }
32
+ } catch (err) {
33
+ console.error("Parse error:", err);
34
+ }
35
+ });
36
+
37
+ function call(method, params = {}) {
38
+ const id = ++requestId;
39
+ const request = { jsonrpc: "2.0", id, method, params };
40
+
41
+ return new Promise((resolve, reject) => {
42
+ pendingRequests.set(id, { resolve, reject });
43
+ serverProcess.stdin.write(JSON.stringify(request) + "\n");
44
+
45
+ setTimeout(() => {
46
+ if (pendingRequests.has(id)) {
47
+ pendingRequests.delete(id);
48
+ reject(new Error("Timeout"));
49
+ }
50
+ }, 5000);
51
+ });
52
+ }
53
+
54
+ async function main() {
55
+ try {
56
+ // Initialize
57
+ await call("initialize", {
58
+ protocolVersion: "2024-11-05",
59
+ capabilities: {},
60
+ clientInfo: { name: "seed", version: "1.0" }
61
+ });
62
+
63
+ console.log("Adding sample memories...");
64
+
65
+ // Add sample memories
66
+ const memories = [
67
+ {
68
+ type: "decision",
69
+ content: "Use TypeScript for all new backend services. Static typing reduces bugs and improves maintainability.",
70
+ importance: 5,
71
+ scope: { repo: "backend-api" }
72
+ },
73
+ {
74
+ type: "mistake",
75
+ content: "Don't use ORM queries in loops - causes N+1 query problem. Always use batch loading or raw SQL with joins.",
76
+ importance: 4,
77
+ scope: { repo: "backend-api", language: "typescript" }
78
+ },
79
+ {
80
+ type: "code_fact",
81
+ content: "Authentication is handled by JWT middleware in src/middleware/auth.ts. Token validation uses RS256 algorithm.",
82
+ importance: 3,
83
+ scope: { repo: "backend-api", folder: "src/middleware" }
84
+ },
85
+ {
86
+ type: "pattern",
87
+ content: "All API responses follow the format: { success: boolean, data?: any, error?: string }. Maintain consistency.",
88
+ importance: 4,
89
+ scope: { repo: "backend-api" }
90
+ },
91
+ {
92
+ type: "decision",
93
+ content: "Frontend uses React with TypeScript and Material-UI for component library. No class components allowed.",
94
+ importance: 5,
95
+ scope: { repo: "frontend-app", language: "typescript" }
96
+ },
97
+ {
98
+ type: "mistake",
99
+ content: "Never store sensitive data in localStorage - use httpOnly cookies instead. localStorage is vulnerable to XSS.",
100
+ importance: 5,
101
+ scope: { repo: "frontend-app" }
102
+ },
103
+ {
104
+ type: "code_fact",
105
+ content: "Database migrations are in migrations/ directory. Run 'npm run migrate' to apply. Never edit migration history.",
106
+ importance: 3,
107
+ scope: { repo: "backend-api", folder: "migrations" }
108
+ },
109
+ {
110
+ type: "pattern",
111
+ content: "Error handling follows try-catch pattern with specific error types. Always log errors before rethrowing.",
112
+ importance: 3,
113
+ scope: { repo: "backend-api" }
114
+ },
115
+ {
116
+ type: "decision",
117
+ content: "Use Docker for development environments. docker-compose.yml defines all services. No local installs.",
118
+ importance: 4,
119
+ scope: { repo: "devops" }
120
+ },
121
+ {
122
+ type: "code_fact",
123
+ content: "CI/CD pipeline uses GitHub Actions. Deploy to staging on merge to main, production requires manual approval.",
124
+ importance: 3,
125
+ scope: { repo: "devops" }
126
+ }
127
+ ];
128
+
129
+ for (const memory of memories) {
130
+ try {
131
+ const result = await call("tools/call", {
132
+ name: "memory.store",
133
+ arguments: memory
134
+ });
135
+ console.log(`✓ Added: ${memory.content.substring(0, 50)}...`);
136
+ } catch (err) {
137
+ console.error(`✗ Failed to add: ${memory.content.substring(0, 50)}...`, err.message);
138
+ }
139
+ }
140
+
141
+ console.log("\nSample data added successfully!");
142
+ serverProcess.kill();
143
+ process.exit(0);
144
+ } catch (err) {
145
+ console.error("Error:", err);
146
+ serverProcess.kill();
147
+ process.exit(1);
148
+ }
149
+ }
150
+
151
+ main();
@@ -0,0 +1,22 @@
1
+ // MCP Server Capabilities
2
+ export const CAPABILITIES = {
3
+ serverInfo: {
4
+ name: "mcp-memory-local",
5
+ version: "0.1.0"
6
+ },
7
+ capabilities: {
8
+ resources: {
9
+ list: true,
10
+ read: true,
11
+ templates: true
12
+ },
13
+ tools: {
14
+ list: true,
15
+ call: true
16
+ },
17
+ prompts: {
18
+ list: true,
19
+ get: true
20
+ }
21
+ }
22
+ };