@gethmy/mcp 2.2.3 → 2.3.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.
package/src/server.ts CHANGED
@@ -58,6 +58,7 @@ import {
58
58
  } from "./context-assembly.js";
59
59
  import { autoExpandGraph } from "./graph-expansion.js";
60
60
  import { runLifecycleMaintenance } from "./lifecycle-maintenance.js";
61
+ import { runMemoryCleanup } from "./memory-cleanup.js";
61
62
  import { onboardNewUser } from "./onboard.js";
62
63
  import type { PromptVariant } from "./prompt-builder.js";
63
64
 
@@ -1637,6 +1638,51 @@ const TOOLS = {
1637
1638
  required: [],
1638
1639
  },
1639
1640
  },
1641
+
1642
+ harmony_cleanup_memories: {
1643
+ description:
1644
+ "Run a unified memory cleanup: prune stale drafts, consolidate similar memories, detect orphans and duplicates, and backfill embeddings. Returns a health report. Dry-run by default — run with dryRun=false to execute.",
1645
+ inputSchema: {
1646
+ type: "object",
1647
+ properties: {
1648
+ workspaceId: {
1649
+ type: "string",
1650
+ description: "Workspace ID (optional if context set)",
1651
+ },
1652
+ projectId: {
1653
+ type: "string",
1654
+ description: "Project ID (optional)",
1655
+ },
1656
+ dryRun: {
1657
+ type: "boolean",
1658
+ description:
1659
+ "Preview cleanup without executing changes (default: true)",
1660
+ },
1661
+ steps: {
1662
+ type: "array",
1663
+ items: {
1664
+ type: "string",
1665
+ enum: ["prune", "consolidate", "orphans", "duplicates", "backfill"],
1666
+ },
1667
+ description:
1668
+ "Which cleanup steps to run (default: all). Options: prune, consolidate, orphans, duplicates, backfill.",
1669
+ },
1670
+ maxAgeDays: {
1671
+ type: "number",
1672
+ description: "Max age in days for stale draft pruning (default: 30)",
1673
+ },
1674
+ minClusterSize: {
1675
+ type: "number",
1676
+ description: "Min cluster size for consolidation (default: 3)",
1677
+ },
1678
+ orphanAgeDays: {
1679
+ type: "number",
1680
+ description: "Min age in days for orphan detection (default: 14)",
1681
+ },
1682
+ },
1683
+ required: [],
1684
+ },
1685
+ },
1640
1686
  };
1641
1687
 
1642
1688
  // Resource URIs
@@ -3967,6 +4013,34 @@ async function handleToolCall(
3967
4013
  };
3968
4014
  }
3969
4015
 
4016
+ case "harmony_cleanup_memories": {
4017
+ const workspaceId =
4018
+ (args.workspaceId as string) || deps.getActiveWorkspaceId();
4019
+ if (!workspaceId) {
4020
+ throw new Error(
4021
+ "No workspace specified. Use harmony_set_workspace_context or provide workspaceId.",
4022
+ );
4023
+ }
4024
+ const projectId =
4025
+ (args.projectId as string) || deps.getActiveProjectId() || undefined;
4026
+
4027
+ const report = await runMemoryCleanup(client, workspaceId, projectId, {
4028
+ dryRun: args.dryRun as boolean | undefined,
4029
+ steps: args.steps as string[] | undefined,
4030
+ maxAgeDays: args.maxAgeDays as number | undefined,
4031
+ minClusterSize: args.minClusterSize as number | undefined,
4032
+ orphanAgeDays: args.orphanAgeDays as number | undefined,
4033
+ });
4034
+
4035
+ return {
4036
+ success: report.success,
4037
+ dryRun: report.dryRun,
4038
+ summary: report.summary,
4039
+ errors: report.errors,
4040
+ healthReport: report.healthReport,
4041
+ };
4042
+ }
4043
+
3970
4044
  default:
3971
4045
  throw new Error(`Unknown tool: ${name}`);
3972
4046
  }
package/src/skills.ts CHANGED
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
3
  import { areSkillsInstalled } from "./config.js";
4
4
 
5
- export const SKILLS_VERSION = "3";
5
+ export const SKILLS_VERSION = "4";
6
6
 
7
7
  const VERSION_MARKER_PREFIX = "<!-- skills-version:";
8
8
 
@@ -206,6 +206,30 @@ Do not start an agent session.
206
206
 
207
207
  ---
208
208
 
209
+ ## Step E: Auto-Detect Card for Implementation Tasks
210
+
211
+ **IMPORTANT:** This step applies when you are about to implement a plan, feature, or fix
212
+ that was NOT started via /hmy. Before writing any code, check if the work maps to an
213
+ existing Harmony card.
214
+
215
+ ### When to run this check
216
+ - User says "implement this plan", "build this feature", "fix this bug" (without /hmy)
217
+ - You are about to execute a plan file
218
+ - Skip if: the user already started with /hmy, or no Harmony MCP tools are available
219
+
220
+ ### Detection steps
221
+ 1. Call \`harmony_search_cards\` with keywords from the plan title or task description
222
+ 2. If a card matches (same feature/fix described), tell the user:
223
+ "This maps to card #N — starting a session to track progress."
224
+ 3. Call \`harmony_start_agent_session\` with \`moveToColumn: "In Progress"\`, \`addLabels: ["agent"]\`
225
+ 4. Track progress with \`harmony_update_agent_progress\` at milestones
226
+ 5. When done, call \`harmony_end_agent_session\` with \`status: "completed"\`, \`moveToColumn: "Review"\`
227
+
228
+ ### If no match
229
+ Proceed normally without a session. No action needed.
230
+
231
+ ---
232
+
209
233
  ## Key Tools Reference
210
234
 
211
235
  **Cards:** \`harmony_get_card\`, \`harmony_get_card_by_short_id\`, \`harmony_search_cards\`, \`harmony_create_card\`, \`harmony_update_card\`, \`harmony_move_card\`, \`harmony_delete_card\`, \`harmony_assign_card\`
package/src/tui/setup.ts CHANGED
@@ -299,6 +299,17 @@ When given a card reference (e.g., #42 or a card name), follow this workflow:
299
299
  7. Update progress periodically with \`harmony_update_agent_progress\`
300
300
  8. When done, call \`harmony_end_agent_session\` and move to "Review"
301
301
 
302
+ ## Auto-Detect Card for Implementation Tasks
303
+
304
+ Before implementing a plan or feature, check if it maps to an existing Harmony card:
305
+
306
+ 1. Use \`harmony_search_cards\` with keywords from the task description
307
+ 2. If a match is found, call \`harmony_start_agent_session\` (agentIdentifier: "claude-code", agentName: "Claude Code", moveToColumn: "In Progress", addLabels: ["agent"])
308
+ 3. Update progress with \`harmony_update_agent_progress\` at milestones
309
+ 4. When done, call \`harmony_end_agent_session\` with status: "completed", moveToColumn: "Review"
310
+
311
+ Skip if: work was already started with a card reference, or no matching card exists.
312
+
302
313
  ## Available Harmony Tools
303
314
 
304
315
  - \`harmony_get_card\`, \`harmony_get_card_by_short_id\`, \`harmony_search_cards\` - Find cards