@prmichaelsen/remember-mcp 2.7.10 → 2.8.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 (76) hide show
  1. package/.env.example +6 -0
  2. package/AGENT.md +224 -21
  3. package/CHANGELOG.md +47 -912
  4. package/README.md +35 -0
  5. package/agent/commands/acp.command-create.md +373 -0
  6. package/agent/commands/acp.design-create.md +225 -0
  7. package/agent/commands/acp.init.md +40 -5
  8. package/agent/commands/acp.package-create.md +895 -0
  9. package/agent/commands/acp.package-info.md +212 -0
  10. package/agent/commands/acp.package-install.md +207 -33
  11. package/agent/commands/acp.package-list.md +280 -0
  12. package/agent/commands/acp.package-publish.md +541 -0
  13. package/agent/commands/acp.package-remove.md +293 -0
  14. package/agent/commands/acp.package-search.md +307 -0
  15. package/agent/commands/acp.package-update.md +361 -0
  16. package/agent/commands/acp.package-validate.md +540 -0
  17. package/agent/commands/acp.pattern-create.md +327 -0
  18. package/agent/commands/acp.plan.md +553 -0
  19. package/agent/commands/acp.proceed.md +112 -86
  20. package/agent/commands/acp.project-create.md +673 -0
  21. package/agent/commands/acp.project-list.md +225 -0
  22. package/agent/commands/acp.project-set.md +227 -0
  23. package/agent/commands/acp.report.md +3 -0
  24. package/agent/commands/acp.resume.md +238 -0
  25. package/agent/commands/acp.status.md +1 -0
  26. package/agent/commands/acp.sync.md +56 -15
  27. package/agent/commands/acp.task-create.md +391 -0
  28. package/agent/commands/acp.update.md +1 -0
  29. package/agent/commands/acp.validate.md +62 -10
  30. package/agent/commands/acp.version-check-for-updates.md +6 -5
  31. package/agent/commands/acp.version-check.md +7 -6
  32. package/agent/commands/acp.version-update.md +7 -6
  33. package/agent/commands/command.template.md +48 -0
  34. package/agent/commands/git.commit.md +6 -3
  35. package/agent/commands/git.init.md +1 -0
  36. package/agent/manifest.template.yaml +13 -0
  37. package/agent/package.template.yaml +53 -0
  38. package/agent/progress.template.yaml +3 -0
  39. package/agent/progress.yaml +103 -5
  40. package/agent/scripts/acp.common.sh +1536 -0
  41. package/agent/scripts/acp.install.sh +293 -0
  42. package/agent/scripts/acp.package-create.sh +925 -0
  43. package/agent/scripts/acp.package-info.sh +270 -0
  44. package/agent/scripts/acp.package-install.sh +675 -0
  45. package/agent/scripts/acp.package-list.sh +263 -0
  46. package/agent/scripts/acp.package-publish.sh +420 -0
  47. package/agent/scripts/acp.package-remove.sh +272 -0
  48. package/agent/scripts/acp.package-search.sh +156 -0
  49. package/agent/scripts/acp.package-update.sh +438 -0
  50. package/agent/scripts/acp.package-validate.sh +954 -0
  51. package/agent/scripts/acp.project-list.sh +121 -0
  52. package/agent/scripts/acp.project-set.sh +138 -0
  53. package/agent/scripts/{uninstall.sh → acp.uninstall.sh} +25 -15
  54. package/agent/scripts/{check-for-updates.sh → acp.version-check-for-updates.sh} +24 -14
  55. package/agent/scripts/{version.sh → acp.version-check.sh} +20 -8
  56. package/agent/scripts/{update.sh → acp.version-update.sh} +44 -25
  57. package/agent/scripts/acp.yaml-parser.sh +853 -0
  58. package/agent/scripts/acp.yaml-validate.sh +205 -0
  59. package/agent/tasks/task-68-fix-missing-space-properties.md +192 -0
  60. package/agent/tasks/task-69-add-comprehensive-tool-debugging.md +454 -0
  61. package/dist/config.d.ts +18 -0
  62. package/dist/server-factory.js +296 -19
  63. package/dist/server.js +296 -19
  64. package/dist/utils/debug.d.ts +52 -0
  65. package/dist/utils/debug.spec.d.ts +5 -0
  66. package/dist/weaviate/client.d.ts +1 -1
  67. package/package.json +1 -1
  68. package/src/config.ts +33 -0
  69. package/src/tools/confirm.ts +70 -7
  70. package/src/tools/publish.ts +19 -1
  71. package/src/tools/query-space.ts +36 -3
  72. package/src/tools/search-space.ts +36 -3
  73. package/src/utils/debug.spec.ts +257 -0
  74. package/src/utils/debug.ts +138 -0
  75. package/src/weaviate/client.ts +42 -3
  76. package/agent/scripts/install.sh +0 -157
package/dist/server.js CHANGED
@@ -479,12 +479,36 @@ function validateConfig() {
479
479
  });
480
480
  });
481
481
  }
482
- var import_dotenv, config;
482
+ var import_dotenv, debugConfig, config;
483
483
  var init_config = __esm({
484
484
  "src/config.ts"() {
485
485
  "use strict";
486
486
  import_dotenv = __toESM(require_main(), 1);
487
487
  import_dotenv.default.config();
488
+ debugConfig = {
489
+ level: (() => {
490
+ const level = process.env.REMEMBER_MCP_DEBUG_LEVEL?.toUpperCase();
491
+ switch (level) {
492
+ case "TRACE":
493
+ return 5 /* TRACE */;
494
+ case "DEBUG":
495
+ return 4 /* DEBUG */;
496
+ case "INFO":
497
+ return 3 /* INFO */;
498
+ case "WARN":
499
+ return 2 /* WARN */;
500
+ case "ERROR":
501
+ return 1 /* ERROR */;
502
+ case "NONE":
503
+ return 0 /* NONE */;
504
+ default:
505
+ return 0 /* NONE */;
506
+ }
507
+ })(),
508
+ enabled: (level) => {
509
+ return debugConfig.level >= level;
510
+ }
511
+ };
488
512
  config = {
489
513
  // Weaviate
490
514
  weaviate: {
@@ -538,6 +562,103 @@ import {
538
562
  init_config();
539
563
  init_logger();
540
564
  import weaviate from "weaviate-client";
565
+
566
+ // src/utils/debug.ts
567
+ init_config();
568
+ init_logger();
569
+ var DebugLogger = class {
570
+ context;
571
+ constructor(context) {
572
+ this.context = context;
573
+ }
574
+ trace(message, data) {
575
+ if (debugConfig.enabled(5 /* TRACE */)) {
576
+ logger.debug(`[TRACE] ${message}`, {
577
+ ...this.context,
578
+ ...data,
579
+ debugLevel: "TRACE"
580
+ });
581
+ }
582
+ }
583
+ debug(message, data) {
584
+ if (debugConfig.enabled(4 /* DEBUG */)) {
585
+ logger.debug(`[DEBUG] ${message}`, {
586
+ ...this.context,
587
+ ...data,
588
+ debugLevel: "DEBUG"
589
+ });
590
+ }
591
+ }
592
+ info(message, data) {
593
+ if (debugConfig.enabled(3 /* INFO */)) {
594
+ logger.info(`[INFO] ${message}`, {
595
+ ...this.context,
596
+ ...data,
597
+ debugLevel: "INFO"
598
+ });
599
+ }
600
+ }
601
+ warn(message, data) {
602
+ if (debugConfig.enabled(2 /* WARN */)) {
603
+ logger.warn(`[WARN] ${message}`, {
604
+ ...this.context,
605
+ ...data,
606
+ debugLevel: "WARN"
607
+ });
608
+ }
609
+ }
610
+ error(message, data) {
611
+ if (debugConfig.enabled(1 /* ERROR */)) {
612
+ logger.error(`[ERROR] ${message}`, {
613
+ ...this.context,
614
+ ...data,
615
+ debugLevel: "ERROR"
616
+ });
617
+ }
618
+ }
619
+ /**
620
+ * Dump full object (TRACE only)
621
+ * Use with caution - may expose sensitive data
622
+ */
623
+ dump(label, obj) {
624
+ if (debugConfig.enabled(5 /* TRACE */)) {
625
+ logger.debug(`[DUMP] ${label}`, {
626
+ ...this.context,
627
+ dump: JSON.stringify(obj, null, 2),
628
+ debugLevel: "TRACE"
629
+ });
630
+ }
631
+ }
632
+ /**
633
+ * Time an async operation (DEBUG and above)
634
+ * Logs start, completion, and duration
635
+ */
636
+ async time(label, fn) {
637
+ if (!debugConfig.enabled(4 /* DEBUG */)) {
638
+ return fn();
639
+ }
640
+ const start = Date.now();
641
+ this.debug(`${label} - Starting`);
642
+ try {
643
+ const result = await fn();
644
+ const duration = Date.now() - start;
645
+ this.debug(`${label} - Completed`, { durationMs: duration });
646
+ return result;
647
+ } catch (error) {
648
+ const duration = Date.now() - start;
649
+ this.error(`${label} - Failed`, {
650
+ durationMs: duration,
651
+ error: error instanceof Error ? error.message : String(error)
652
+ });
653
+ throw error;
654
+ }
655
+ }
656
+ };
657
+ function createDebugLogger(context) {
658
+ return new DebugLogger(context);
659
+ }
660
+
661
+ // src/weaviate/client.ts
541
662
  var client = null;
542
663
  async function initWeaviateClient() {
543
664
  if (client) {
@@ -660,20 +781,52 @@ var ALL_MEMORY_PROPERTIES = [
660
781
  // Comment/threading fields
661
782
  "parent_id",
662
783
  "thread_root_id",
663
- "moderation_flags"
784
+ "moderation_flags",
785
+ // Space/publishing fields (for Memory_public collection)
786
+ "spaces",
787
+ "space_id",
788
+ "author_id",
789
+ "ghost_id",
790
+ "attribution",
791
+ "published_at",
792
+ "discovery_count",
793
+ "space_memory_id"
664
794
  ];
665
795
  async function fetchMemoryWithAllProperties(collection, memoryId) {
796
+ const debug = createDebugLogger({
797
+ tool: "weaviate-client",
798
+ operation: "fetchMemoryWithAllProperties"
799
+ });
800
+ debug.debug("Fetching memory", {
801
+ memoryId,
802
+ collectionName: collection.name,
803
+ propertyCount: ALL_MEMORY_PROPERTIES.length
804
+ });
666
805
  try {
667
- return await collection.query.fetchObjectById(memoryId, {
668
- returnProperties: ALL_MEMORY_PROPERTIES
806
+ const result = await debug.time("Fetch with all properties", async () => {
807
+ return await collection.query.fetchObjectById(memoryId, {
808
+ returnProperties: ALL_MEMORY_PROPERTIES
809
+ });
810
+ });
811
+ debug.trace("Fetch result", {
812
+ found: !!result,
813
+ propertyCount: result?.properties ? Object.keys(result.properties).length : 0,
814
+ hasSpaces: !!result?.properties?.spaces,
815
+ hasAuthorId: !!result?.properties?.author_id
669
816
  });
817
+ return result;
670
818
  } catch (error) {
819
+ debug.warn("Fetch with all properties failed, falling back", {
820
+ error: error instanceof Error ? error.message : String(error)
821
+ });
671
822
  logger.warn("Failed to fetch with all properties, falling back to unspecified fetch", {
672
823
  module: "weaviate-client",
673
824
  memoryId,
674
825
  error: error instanceof Error ? error.message : String(error)
675
826
  });
676
- return await collection.query.fetchObjectById(memoryId);
827
+ return await debug.time("Fetch without property specification", async () => {
828
+ return await collection.query.fetchObjectById(memoryId);
829
+ });
677
830
  }
678
831
  }
679
832
 
@@ -4073,7 +4226,14 @@ var publishTool = {
4073
4226
  }
4074
4227
  };
4075
4228
  async function handlePublish(args, userId) {
4229
+ const debug = createDebugLogger({
4230
+ tool: "remember_publish",
4231
+ userId,
4232
+ operation: "publish_request"
4233
+ });
4076
4234
  try {
4235
+ debug.info("Tool invoked");
4236
+ debug.trace("Arguments", { args });
4077
4237
  logger.info("Starting publish request", {
4078
4238
  tool: "remember_publish",
4079
4239
  userId,
@@ -4082,8 +4242,10 @@ async function handlePublish(args, userId) {
4082
4242
  spaceCount: args.spaces.length,
4083
4243
  additionalTags: args.additional_tags?.length || 0
4084
4244
  });
4245
+ debug.debug("Validating space IDs", { spaces: args.spaces });
4085
4246
  const invalidSpaces = args.spaces.filter((s) => !isValidSpaceId(s));
4086
4247
  if (invalidSpaces.length > 0) {
4248
+ debug.warn("Invalid space IDs detected", { invalidSpaces });
4087
4249
  logger.warn("Invalid space IDs provided", {
4088
4250
  tool: "remember_publish",
4089
4251
  invalidSpaces,
@@ -4127,7 +4289,9 @@ async function handlePublish(args, userId) {
4127
4289
  memoryId: args.memory_id
4128
4290
  });
4129
4291
  const userCollection = weaviateClient.collections.get(collectionName);
4130
- const memory = await fetchMemoryWithAllProperties(userCollection, args.memory_id);
4292
+ const memory = await debug.time("Fetch memory from user collection", async () => {
4293
+ return await fetchMemoryWithAllProperties(userCollection, args.memory_id);
4294
+ });
4131
4295
  logger.debug("Memory fetch result", {
4132
4296
  tool: "remember_publish",
4133
4297
  found: !!memory,
@@ -4222,6 +4386,10 @@ async function handlePublish(args, userId) {
4222
4386
  2
4223
4387
  );
4224
4388
  } catch (error) {
4389
+ debug.error("Tool failed", {
4390
+ error: error instanceof Error ? error.message : String(error),
4391
+ stack: error instanceof Error ? error.stack : void 0
4392
+ });
4225
4393
  return handleToolError(error, {
4226
4394
  toolName: "remember_publish",
4227
4395
  userId,
@@ -4259,13 +4427,23 @@ Violating these requirements bypasses user consent and is a security violation.`
4259
4427
  }
4260
4428
  };
4261
4429
  async function handleConfirm(args, userId) {
4430
+ const debug = createDebugLogger({
4431
+ tool: "remember_confirm",
4432
+ userId,
4433
+ operation: "confirm_action"
4434
+ });
4262
4435
  try {
4436
+ debug.info("Tool invoked");
4437
+ debug.trace("Arguments", { token: args.token });
4263
4438
  logger.info("Starting confirmation", {
4264
4439
  tool: "remember_confirm",
4265
4440
  userId,
4266
4441
  token: args.token
4267
4442
  });
4268
- const request = await confirmationTokenService.confirmRequest(userId, args.token);
4443
+ debug.debug("Validating confirmation token");
4444
+ const request = await debug.time("Confirm token", async () => {
4445
+ return await confirmationTokenService.confirmRequest(userId, args.token);
4446
+ });
4269
4447
  logger.debug("Token validation result", {
4270
4448
  tool: "remember_confirm",
4271
4449
  requestFound: !!request,
@@ -4296,6 +4474,10 @@ async function handleConfirm(args, userId) {
4296
4474
  }
4297
4475
  throw new Error(`Unknown action type: ${request.action}`);
4298
4476
  } catch (error) {
4477
+ debug.error("Tool failed", {
4478
+ error: error instanceof Error ? error.message : String(error),
4479
+ stack: error instanceof Error ? error.stack : void 0
4480
+ });
4299
4481
  handleToolError(error, {
4300
4482
  toolName: "remember_confirm",
4301
4483
  userId,
@@ -4305,7 +4487,16 @@ async function handleConfirm(args, userId) {
4305
4487
  }
4306
4488
  }
4307
4489
  async function executePublishMemory(request, userId) {
4490
+ const debug = createDebugLogger({
4491
+ tool: "remember_confirm",
4492
+ userId,
4493
+ operation: "execute_publish"
4494
+ });
4308
4495
  try {
4496
+ debug.debug("Executing publish memory action", {
4497
+ memoryId: request.payload.memory_id,
4498
+ spaces: request.payload.spaces
4499
+ });
4309
4500
  logger.info("Executing publish memory action", {
4310
4501
  function: "executePublishMemory",
4311
4502
  userId,
@@ -4322,10 +4513,12 @@ async function executePublishMemory(request, userId) {
4322
4513
  collectionName: getMemoryCollectionName(userId),
4323
4514
  memoryId: request.payload.memory_id
4324
4515
  });
4325
- const originalMemory = await fetchMemoryWithAllProperties(
4326
- userCollection,
4327
- request.payload.memory_id
4328
- );
4516
+ const originalMemory = await debug.time("Fetch original memory", async () => {
4517
+ return await fetchMemoryWithAllProperties(
4518
+ userCollection,
4519
+ request.payload.memory_id
4520
+ );
4521
+ });
4329
4522
  logger.info("Original memory fetch result", {
4330
4523
  function: "executePublishMemory",
4331
4524
  found: !!originalMemory,
@@ -4356,6 +4549,26 @@ async function executePublishMemory(request, userId) {
4356
4549
  2
4357
4550
  );
4358
4551
  }
4552
+ if (originalMemory.properties.space_memory_id) {
4553
+ const requestedSpaces = request.payload.spaces?.join(", ") || "unknown";
4554
+ logger.warn("Memory already published", {
4555
+ function: "executePublishMemory",
4556
+ memoryId: request.payload.memory_id,
4557
+ existingSpaceMemoryId: originalMemory.properties.space_memory_id,
4558
+ requestedSpaces: request.payload.spaces
4559
+ });
4560
+ return JSON.stringify(
4561
+ {
4562
+ success: false,
4563
+ error: "Already published",
4564
+ message: `This memory has already been published to this space. Space memory ID: ${originalMemory.properties.space_memory_id}`,
4565
+ space_memory_id: originalMemory.properties.space_memory_id,
4566
+ requested_spaces: request.payload.spaces
4567
+ },
4568
+ null,
4569
+ 2
4570
+ );
4571
+ }
4359
4572
  if (originalMemory.properties.user_id !== userId) {
4360
4573
  logger.warn("Permission denied - wrong owner", {
4361
4574
  function: "executePublishMemory",
@@ -4415,14 +4628,20 @@ async function executePublishMemory(request, userId) {
4415
4628
  contentLength: publishedMemory.content?.length || 0,
4416
4629
  titleValue: publishedMemory.title || "NO_TITLE"
4417
4630
  });
4418
- const result = await publicCollection.data.insert({
4419
- properties: publishedMemory
4631
+ const result = await debug.time("Insert into Memory_public", async () => {
4632
+ return await publicCollection.data.insert({
4633
+ properties: publishedMemory
4634
+ });
4420
4635
  });
4421
4636
  logger.info("Memory published successfully", {
4422
4637
  function: "executePublishMemory",
4423
4638
  spaceMemoryId: result,
4424
4639
  spaces: request.payload.spaces
4425
4640
  });
4641
+ debug.info("Memory published successfully", {
4642
+ spaceMemoryId: result,
4643
+ spaces: request.payload.spaces
4644
+ });
4426
4645
  try {
4427
4646
  await userCollection.data.update({
4428
4647
  id: request.payload.memory_id,
@@ -4453,6 +4672,10 @@ async function executePublishMemory(request, userId) {
4453
4672
  2
4454
4673
  );
4455
4674
  } catch (error) {
4675
+ debug.error("Execute publish failed", {
4676
+ error: error instanceof Error ? error.message : String(error),
4677
+ stack: error instanceof Error ? error.stack : void 0
4678
+ });
4456
4679
  handleToolError(error, {
4457
4680
  toolName: "remember_confirm",
4458
4681
  userId,
@@ -4597,7 +4820,15 @@ Let the search algorithm find ALL relevant memories regardless of type unless ex
4597
4820
  }
4598
4821
  };
4599
4822
  async function handleSearchSpace(args, userId) {
4823
+ const debug = createDebugLogger({
4824
+ tool: "remember_search_space",
4825
+ userId,
4826
+ operation: "search_spaces"
4827
+ });
4600
4828
  try {
4829
+ debug.info("Tool invoked");
4830
+ debug.trace("Arguments", { args });
4831
+ debug.debug("Validating space IDs", { spaces: args.spaces });
4601
4832
  const invalidSpaces = args.spaces.filter((s) => !isValidSpaceId(s));
4602
4833
  if (invalidSpaces.length > 0) {
4603
4834
  return JSON.stringify(
@@ -4655,10 +4886,21 @@ async function handleSearchSpace(args, userId) {
4655
4886
  filterList.push(publicCollection.filter.byProperty("created_at").lessOrEqual(new Date(args.date_to)));
4656
4887
  }
4657
4888
  const whereFilter = filterList.length > 0 ? Filters3.and(...filterList) : void 0;
4658
- const searchResults = await publicCollection.query.hybrid(args.query, {
4889
+ debug.debug("Executing hybrid search", {
4890
+ query: args.query,
4891
+ filterCount: filterList.length,
4659
4892
  limit: args.limit || 10,
4660
- offset: args.offset || 0,
4661
- ...whereFilter && { where: whereFilter }
4893
+ offset: args.offset || 0
4894
+ });
4895
+ const searchResults = await debug.time("Hybrid search query", async () => {
4896
+ return await publicCollection.query.hybrid(args.query, {
4897
+ limit: args.limit || 10,
4898
+ offset: args.offset || 0,
4899
+ ...whereFilter && { where: whereFilter }
4900
+ });
4901
+ });
4902
+ debug.debug("Search completed", {
4903
+ resultCount: searchResults.objects.length
4662
4904
  });
4663
4905
  const memories = searchResults.objects.map((obj) => ({
4664
4906
  id: obj.uuid,
@@ -4673,8 +4915,16 @@ async function handleSearchSpace(args, userId) {
4673
4915
  offset: args.offset || 0,
4674
4916
  limit: args.limit || 10
4675
4917
  };
4918
+ debug.info("Tool completed successfully", {
4919
+ resultCount: memories.length,
4920
+ spaces: args.spaces
4921
+ });
4676
4922
  return JSON.stringify(result, null, 2);
4677
4923
  } catch (error) {
4924
+ debug.error("Tool failed", {
4925
+ error: error instanceof Error ? error.message : String(error),
4926
+ stack: error instanceof Error ? error.stack : void 0
4927
+ });
4678
4928
  return handleToolError(error, {
4679
4929
  toolName: "remember_search_space",
4680
4930
  operation: "search spaces",
@@ -4758,7 +5008,15 @@ Let the query algorithm find ALL relevant memories regardless of type unless exp
4758
5008
  }
4759
5009
  };
4760
5010
  async function handleQuerySpace(args, userId) {
5011
+ const debug = createDebugLogger({
5012
+ tool: "remember_query_space",
5013
+ userId,
5014
+ operation: "query_spaces"
5015
+ });
4761
5016
  try {
5017
+ debug.info("Tool invoked");
5018
+ debug.trace("Arguments", { args });
5019
+ debug.debug("Validating space IDs", { spaces: args.spaces });
4762
5020
  const invalidSpaces = args.spaces.filter((s) => !isValidSpaceId(s));
4763
5021
  if (invalidSpaces.length > 0) {
4764
5022
  return JSON.stringify(
@@ -4808,9 +5066,20 @@ async function handleQuerySpace(args, userId) {
4808
5066
  filterList.push(publicCollection.filter.byProperty("created_at").lessOrEqual(new Date(args.date_to)));
4809
5067
  }
4810
5068
  const whereFilter = filterList.length > 0 ? Filters4.and(...filterList) : void 0;
4811
- const searchResults = await publicCollection.query.nearText(args.question, {
4812
- limit: args.limit || 10,
4813
- ...whereFilter && { where: whereFilter }
5069
+ debug.debug("Executing semantic query", {
5070
+ question: args.question,
5071
+ filterCount: filterList.length,
5072
+ limit: args.limit || 10
5073
+ });
5074
+ const searchResults = await debug.time("Semantic query", async () => {
5075
+ return await publicCollection.query.nearText(args.question, {
5076
+ limit: args.limit || 10,
5077
+ ...whereFilter && { where: whereFilter }
5078
+ });
5079
+ });
5080
+ debug.debug("Query completed", {
5081
+ resultCount: searchResults.objects.length,
5082
+ format: args.format || "detailed"
4814
5083
  });
4815
5084
  const format = args.format || "detailed";
4816
5085
  if (format === "compact") {
@@ -4839,9 +5108,17 @@ async function handleQuerySpace(args, userId) {
4839
5108
  memories,
4840
5109
  total: memories.length
4841
5110
  };
5111
+ debug.info("Tool completed successfully", {
5112
+ resultCount: memories.length,
5113
+ format: "detailed"
5114
+ });
4842
5115
  return JSON.stringify(result, null, 2);
4843
5116
  }
4844
5117
  } catch (error) {
5118
+ debug.error("Tool failed", {
5119
+ error: error instanceof Error ? error.message : String(error),
5120
+ stack: error instanceof Error ? error.stack : void 0
5121
+ });
4845
5122
  return handleToolError(error, {
4846
5123
  toolName: "remember_query_space",
4847
5124
  operation: "query spaces",
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Debug logging utility for remember-mcp
3
+ *
4
+ * Provides configurable debug logging via REMEMBER_MCP_DEBUG_LEVEL environment variable.
5
+ * Levels: NONE (default), ERROR, WARN, INFO, DEBUG, TRACE
6
+ */
7
+ export interface DebugContext {
8
+ tool: string;
9
+ userId?: string;
10
+ operation?: string;
11
+ [key: string]: any;
12
+ }
13
+ export declare class DebugLogger {
14
+ private context;
15
+ constructor(context: DebugContext);
16
+ trace(message: string, data?: any): void;
17
+ debug(message: string, data?: any): void;
18
+ info(message: string, data?: any): void;
19
+ warn(message: string, data?: any): void;
20
+ error(message: string, data?: any): void;
21
+ /**
22
+ * Dump full object (TRACE only)
23
+ * Use with caution - may expose sensitive data
24
+ */
25
+ dump(label: string, obj: any): void;
26
+ /**
27
+ * Time an async operation (DEBUG and above)
28
+ * Logs start, completion, and duration
29
+ */
30
+ time<T>(label: string, fn: () => Promise<T>): Promise<T>;
31
+ }
32
+ /**
33
+ * Create a debug logger with context
34
+ *
35
+ * @param context - Context information (tool name, userId, operation, etc.)
36
+ * @returns DebugLogger instance
37
+ *
38
+ * @example
39
+ * const debug = createDebugLogger({
40
+ * tool: 'remember_create_memory',
41
+ * userId: 'user123',
42
+ * operation: 'create',
43
+ * });
44
+ *
45
+ * debug.info('Tool invoked');
46
+ * debug.trace('Arguments', { args });
47
+ * const result = await debug.time('Database operation', async () => {
48
+ * return await collection.insert(data);
49
+ * });
50
+ */
51
+ export declare function createDebugLogger(context: DebugContext): DebugLogger;
52
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for debug utility
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=debug.spec.d.ts.map
@@ -41,7 +41,7 @@ export declare function getAuditCollectionName(userId: string): string;
41
41
  * List of all memory properties to fetch
42
42
  * Matches the actual Weaviate schema properties exactly
43
43
  */
44
- export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "content", "title", "summary", "type", "weight", "base_weight", "trust", "confidence", "computed_weight", "location_gps_lat", "location_gps_lng", "location_address", "location_city", "location_country", "location_source", "locale_language", "locale_timezone", "context_conversation_id", "context_summary", "context_timestamp", "relationships", "access_count", "last_accessed_at", "tags", "references", "created_at", "updated_at", "version", "template_id", "memory_ids", "relationship_type", "observation", "strength", "parent_id", "thread_root_id", "moderation_flags"];
44
+ export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "content", "title", "summary", "type", "weight", "base_weight", "trust", "confidence", "computed_weight", "location_gps_lat", "location_gps_lng", "location_address", "location_city", "location_country", "location_source", "locale_language", "locale_timezone", "context_conversation_id", "context_summary", "context_timestamp", "relationships", "access_count", "last_accessed_at", "tags", "references", "created_at", "updated_at", "version", "template_id", "memory_ids", "relationship_type", "observation", "strength", "parent_id", "thread_root_id", "moderation_flags", "spaces", "space_id", "author_id", "ghost_id", "attribution", "published_at", "discovery_count", "space_memory_id"];
45
45
  /**
46
46
  * Fetch a memory object by ID with all properties
47
47
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/remember-mcp",
3
- "version": "2.7.10",
3
+ "version": "2.8.0",
4
4
  "description": "Multi-tenant memory system MCP server with vector search and relationships",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -3,6 +3,39 @@ import { logger } from './utils/logger.js';
3
3
 
4
4
  dotenv.config();
5
5
 
6
+ /**
7
+ * Debug levels for tool logging
8
+ */
9
+ export enum DebugLevel {
10
+ NONE = 0, // No debug output (production default)
11
+ ERROR = 1, // Only errors
12
+ WARN = 2, // Warnings and errors
13
+ INFO = 3, // Info, warnings, and errors
14
+ DEBUG = 4, // Debug, info, warnings, and errors
15
+ TRACE = 5, // Everything including parameter dumps
16
+ }
17
+
18
+ /**
19
+ * Debug configuration
20
+ */
21
+ export const debugConfig = {
22
+ level: ((): DebugLevel => {
23
+ const level = process.env.REMEMBER_MCP_DEBUG_LEVEL?.toUpperCase();
24
+ switch (level) {
25
+ case 'TRACE': return DebugLevel.TRACE;
26
+ case 'DEBUG': return DebugLevel.DEBUG;
27
+ case 'INFO': return DebugLevel.INFO;
28
+ case 'WARN': return DebugLevel.WARN;
29
+ case 'ERROR': return DebugLevel.ERROR;
30
+ case 'NONE': return DebugLevel.NONE;
31
+ default: return DebugLevel.NONE;
32
+ }
33
+ })(),
34
+ enabled: (level: DebugLevel): boolean => {
35
+ return debugConfig.level >= level;
36
+ },
37
+ };
38
+
6
39
  export const config = {
7
40
  // Weaviate
8
41
  weaviate: {