@gethmy/mcp 2.1.1 → 2.1.2

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.
@@ -3,6 +3,7 @@ import { homedir } from "node:os";
3
3
  import { dirname, join } from "node:path";
4
4
  import * as p from "@clack/prompts";
5
5
  import { areSkillsInstalled, getConfigPath, getLocalConfigPath, hasProjectContext, isConfigured, loadConfig, saveLocalConfig, } from "../config.js";
6
+ import { buildSkillFile, HARMONY_WORKFLOW_PROMPT } from "../skills.js";
6
7
  import { detectAgents } from "./agents.js";
7
8
  import { runDocsStep } from "./docs.js";
8
9
  import { colors, formatPath, messages } from "./theme.js";
@@ -11,296 +12,6 @@ import { getWriteSummary, writeFilesWithProgress } from "./writer.js";
11
12
  const GLOBAL_SKILLS_DIR = join(homedir(), ".agents", "skills");
12
13
  // API base URL
13
14
  const API_URL = "https://gethmy.com/api";
14
- // Harmony workflow prompt - shared across agents
15
- const HARMONY_WORKFLOW_PROMPT = `# Harmony Card Workflow
16
-
17
- Start work on a Harmony card. Card reference: $ARGUMENTS
18
-
19
- ## 1. Find & Fetch Card
20
-
21
- Parse the reference and fetch the card:
22
- - \`#42\` or \`42\` → \`harmony_get_card_by_short_id\` with \`shortId: 42\`
23
- - UUID → \`harmony_get_card\` with \`cardId\`
24
- - Name/text → \`harmony_search_cards\` with \`query\`
25
-
26
- ## 2. Get Board State
27
-
28
- Call \`harmony_get_board\` to get columns and labels. From the response:
29
- - Find the "In Progress" (or "Progress") column ID
30
- - Find the "agent" label ID
31
-
32
- ## 3. Setup Card for Work
33
-
34
- Execute these in sequence:
35
- 1. \`harmony_move_card\` → Move to "In Progress" column
36
- 2. \`harmony_add_label_to_card\` → Add "agent" label
37
- 3. \`harmony_start_agent_session\`:
38
- - \`cardId\`: Card UUID
39
- - \`agentIdentifier\`: Your agent identifier
40
- - \`agentName\`: Your agent name
41
- - \`currentTask\`: "Analyzing card requirements"
42
-
43
- ## 4. Generate Work Prompt
44
-
45
- Call \`harmony_generate_prompt\` with:
46
- - \`cardId\` or \`shortId\` (+ \`projectId\` if using shortId)
47
- - \`variant\`: Select based on task:
48
- - \`"execute"\` (default) → Clear tasks, bug fixes, well-defined work
49
- - \`"analysis"\` → Complex features, unclear requirements
50
- - \`"draft"\` → Medium complexity, want feedback first
51
-
52
- The generated prompt provides role framing, focus areas, subtasks, linked cards, and suggested outputs.
53
-
54
- ## 5. Display Card Summary
55
-
56
- Show the user: Card title, short ID, role, priority, labels, due date, description, and subtasks.
57
-
58
- ## 6. Implement Solution
59
-
60
- Work on the card following the generated prompt's guidance. Update progress at milestones:
61
- - \`harmony_update_agent_progress\` with \`progressPercent\` (0-100), \`currentTask\`, \`status\`, \`blockers\`
62
-
63
- **Progress checkpoints:** 20% (exploration), 50% (implementation), 80% (testing), 100% (done)
64
-
65
- ## 7. Complete Work
66
-
67
- When finished:
68
- 1. \`harmony_end_agent_session\` with \`status: "completed"\`, \`progressPercent: 100\`
69
- 2. \`harmony_move_card\` to "Review" column
70
- 3. Summarize accomplishments
71
-
72
- If pausing: \`harmony_end_agent_session\` with \`status: "paused"\`
73
-
74
- ## Key Tools Reference
75
-
76
- **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\`
77
-
78
- **Subtasks:** \`harmony_create_subtask\`, \`harmony_toggle_subtask\`, \`harmony_delete_subtask\`
79
-
80
- **Labels:** \`harmony_add_label_to_card\`, \`harmony_remove_label_from_card\`, \`harmony_create_label\`
81
-
82
- **Links:** \`harmony_add_link_to_card\`, \`harmony_remove_link_from_card\`, \`harmony_get_card_links\`
83
-
84
- **Board:** \`harmony_get_board\`, \`harmony_list_projects\`, \`harmony_get_context\`, \`harmony_set_project_context\`
85
-
86
- **Sessions:** \`harmony_start_agent_session\`, \`harmony_update_agent_progress\`, \`harmony_end_agent_session\`, \`harmony_get_agent_session\`
87
-
88
- **AI:** \`harmony_generate_prompt\`, \`harmony_process_command\`
89
- `;
90
- // Harmony plan prompt - unified plan creation and execution workflow
91
- const HARMONY_PLAN_PROMPT = `# Harmony Plan Workflow
92
-
93
- Create a new plan or work on an existing one. Argument: $ARGUMENTS
94
-
95
- ## Step 1 — Detect Intent
96
-
97
- Parse \`$ARGUMENTS\` to determine the workflow:
98
-
99
- - **UUID** (contains dashes, 36 chars) → call \`harmony_get_plan\` with \`planId\` directly → **Step 2A**
100
- - **\`#N\`** (short ID) → call \`harmony_get_card_by_short_id\` to get the card, then \`harmony_get_plan\` with \`cardId\` → **Step 2A**
101
- - **Text** (anything else) → call \`harmony_list_plans\` with \`search\` set to the text
102
- - If **one match** → use it → **Step 2A**
103
- - If **multiple matches** → list them with title, status, phase, and updated date. Ask the user to pick one using \`AskUserQuestion\` → **Step 2A**
104
- - If **no matches** → ask user: "No existing plans found for '$ARGUMENTS'. Would you like to create a new plan on this topic?" → **Step 2B**
105
- - **Empty / vague topic** → **Step 2B** (create new plan)
106
-
107
- ---
108
-
109
- ## Step 2A — Work on Existing Plan
110
-
111
- ### 2A.1 — Analyze & Display
112
-
113
- Once you have the plan ID, call \`harmony_get_plan\` to fetch the full plan with tasks. Show a structured summary:
114
-
115
- \\\`\\\`\\\`
116
- ## [Plan Title]
117
- **Status:** draft/active/archived | **Phase:** plan/execute/verify/done
118
- **Tasks:** N total (X pending, Y in_progress, Z completed)
119
- **URL:** https://gethmy.com/plans/{id}
120
- \\\`\\\`\\\`
121
-
122
- If plan is in execute phase and tasks already have linked cards, note which tasks have cards and which don't.
123
-
124
- ### 2A.2 — Recall Context
125
-
126
- Call \`harmony_memory_search\` with the plan title to find related knowledge, patterns, or decisions that may inform execution.
127
-
128
- ### 2A.3 — Present Options
129
-
130
- Use \`AskUserQuestion\` to offer execution choices. Adapt options based on plan state:
131
-
132
- #### Default options (plan in \`plan\` phase):
133
-
134
- **(A) Single card** — Create one card with plan summary + link to plan. Best for simple plans.
135
- **(B) Multiple cards** — Create one card per task via \`harmony_advance_plan\`. Best for complex plans with independent tasks.
136
- **(C) Analyze only** — Review the plan and design an implementation approach. Create cards later.
137
- **(D) Skip** — Do nothing.
138
-
139
- #### If plan has no tasks:
140
- Only offer **(A) Single card**, **(C) Analyze only**, or **(D) Skip**.
141
-
142
- #### If plan is already in \`execute\` phase with existing cards:
143
- **(A) Work on existing cards** — List cards with short IDs, suggest \`/hmy #N\` to start
144
- **(B) Create cards for remaining tasks** — Only create cards for tasks without linked cards
145
- **(C) Analyze progress** — Review what's done vs remaining
146
- **(D) Skip**
147
-
148
- ### 2A.4 — Execute Choice
149
-
150
- #### Option A — Single card
151
- 1. Call \`harmony_create_card\` with:
152
- - \`title\`: Plan title
153
- - \`description\`: Brief 2-3 sentence summary of the plan + \`\\n\\n[View plan](https://gethmy.com/plans/{planId})\`
154
- - \`priority\`: based on plan task priorities (use highest)
155
- 2. Call \`harmony_update_plan\` to set \`status: "active"\`, \`workflowPhase: "execute"\`
156
-
157
- #### Option B — Multiple cards (advance plan)
158
- 1. Call \`harmony_advance_plan\` with:
159
- - \`planId\`: the plan ID
160
- - \`phase\`: \`"execute"\`
161
- - \`summary\`: Brief summary of the plan scope
162
- 2. Display the created cards with their short IDs
163
-
164
- #### Option C — Analyze only
165
- 1. Present a structured implementation analysis:
166
- - Suggested order of tasks
167
- - Dependencies between tasks
168
- - Key technical considerations from memory search
169
- - Estimated complexity
170
- 2. Suggest creating cards when ready
171
-
172
- #### Option D — Skip
173
- Acknowledge and stop.
174
-
175
- ### 2A.5 — Summary
176
-
177
- After execution, show:
178
- - Created card(s) with short IDs
179
- - Current plan phase
180
- - Suggest next step: \`/hmy #N\` to start working on a card
181
-
182
- ---
183
-
184
- ## Step 2B — Create New Plan
185
-
186
- ### 2B.1 — Context Gathering
187
-
188
- Before interviewing, gather existing context:
189
-
190
- 1. Call \`harmony_get_board\` for board state (columns, cards, labels)
191
- 2. Call \`harmony_recall\` with relevant tags to find existing knowledge on the topic
192
- 3. Call \`harmony_memory_search\` with the topic to find related patterns/decisions/lessons
193
-
194
- Note what you learn — reference it during the interview to ask smarter questions.
195
-
196
- ### 2B.2 — Structured Interview (3-5 questions)
197
-
198
- Interview the user with **3-5 focused questions** using AskUserQuestion. Adapt based on complexity.
199
-
200
- #### Core Questions
201
- 1. **Problem & Audience**: What problem are we solving? Who benefits?
202
- 2. **Scope**: What's in v1, what's deferred?
203
- 3. **Technical Constraints**: Any technical preferences, constraints, or existing patterns to follow?
204
-
205
- #### Adaptive Follow-ups (if needed)
206
- - Key user flows or interactions?
207
- - Integration points with existing systems?
208
- - Performance, security, or accessibility requirements?
209
-
210
- #### Interview Rules
211
- - Reference what you found in Step 2B.1 (board state, memories) to ask informed questions
212
- - Skip questions that aren't relevant — simple features need fewer questions
213
- - Tell the user when you have enough information to draft
214
-
215
- ### 2B.3 — Plan Document
216
-
217
- Create a structured markdown document:
218
-
219
- \\\`\\\`\\\`markdown
220
- # [Title]
221
-
222
- ## Problem
223
- [What problem we're solving and why]
224
-
225
- ## Scope
226
-
227
- ### In Scope
228
- - [Feature/capability 1]
229
- - [Feature/capability 2]
230
-
231
- ### Out of Scope
232
- - [Deferred items]
233
-
234
- ## Approach
235
- [Technical design, architecture decisions, key patterns]
236
-
237
- ### Key Decisions
238
- | Decision | Choice | Rationale |
239
- |----------|--------|-----------|
240
- | ... | ... | ... |
241
-
242
- ## Tasks
243
- 1. **[Task title]** — priority: high
244
- [Brief description]
245
-
246
- 2. **[Task title]** — priority: medium
247
- [Brief description]
248
-
249
- [Continue for all tasks...]
250
-
251
- ## Risks & Mitigations
252
- | Risk | Mitigation |
253
- |------|------------|
254
- | ... | ... |
255
-
256
- ## Success Criteria
257
- - [ ] [Measurable criterion]
258
- \\\`\\\`\\\`
259
-
260
- ### 2B.4 — Create Plan
261
-
262
- Call \`harmony_create_plan\` with:
263
- - \`title\`: The plan title
264
- - \`content\`: Full markdown document from Step 2B.3
265
- - \`source\`: \`"agent"\`
266
- - \`workflowPhase\`: \`"plan"\`
267
- - \`tasks\`: Array of tasks from the Tasks section, each with:
268
- - \`content\`: Task title + brief description
269
- - \`priority\`: \`"high"\`, \`"medium"\`, or \`"low"\`
270
- - \`status\`: \`"pending"\`
271
-
272
- ### 2B.5 — User Approval
273
-
274
- Show the user:
275
- - Plan URL: \`https://gethmy.com/plans/{id}\`
276
- - Number of tasks created
277
- - Brief summary
278
-
279
- Then ask: **"Ready to execute? I'll create board cards from these tasks and start the execution phase."**
280
-
281
- Options:
282
- 1. **Yes, advance to Execute** — proceed to Step 2B.6
283
- 2. **Let me review first** — end here, they can advance later from the UI
284
- 3. **Make changes** — iterate on the plan
285
-
286
- ### 2B.6 — Advance to Execute
287
-
288
- Call \`harmony_advance_plan\` with:
289
- - \`planId\`: The plan ID from Step 2B.4
290
- - \`phase\`: \`"execute"\`
291
- - \`summary\`: A 2-3 sentence summary of the key decisions made during planning
292
-
293
- Report the result:
294
- - "Created N cards in 'To Do'. Use \`/hmy #<id>\` to start working on any card."
295
- - List the created cards with their short IDs
296
-
297
- ## Key Tools Reference
298
-
299
- **Discovery:** \`harmony_list_plans\`, \`harmony_get_plan\`, \`harmony_get_card_by_short_id\`
300
- **Context:** \`harmony_get_board\`, \`harmony_recall\`, \`harmony_memory_search\`
301
- **Planning:** \`harmony_create_plan\`, \`harmony_advance_plan\`, \`harmony_update_plan\`
302
- **Execution:** \`harmony_create_card\`, \`harmony_update_card\`
303
- `;
304
15
  /**
305
16
  * Register MCP server using Claude CLI
306
17
  * Returns true if successful, false if CLI unavailable or failed
@@ -432,24 +143,9 @@ function getAgentFiles(agentId, cwd, installMode = "global") {
432
143
  const symlinks = [];
433
144
  switch (agentId) {
434
145
  case "claude": {
435
- // Claude Code skill file
436
- const skillContent = `---
437
- name: hmy
438
- description: Start working on a Harmony card. Use when given a card reference like #42, UUID, or card name to implement.
439
- argument-hint: <card-reference>
440
- ---
441
-
442
- ${HARMONY_WORKFLOW_PROMPT.replace("Your agent identifier", "claude-code").replace("Your agent name", "Claude Code")}
443
- `;
444
- // hmy-plan skill file (unified plan creation + execution)
445
- const planSkillContent = `---
446
- name: hmy-plan
447
- description: Create a new plan or work on an existing one. Use when asked to plan a feature, execute a plan, review a plan, or given a plan reference.
448
- argument-hint: [plan name, ID, or topic to plan]
449
- ---
450
-
451
- ${HARMONY_PLAN_PROMPT.replace("$ARGUMENTS", "$ARGUMENTS")}
452
- `;
146
+ // Claude Code skill files built from the central skill registry
147
+ const skillContent = buildSkillFile("hmy", "claude");
148
+ const planSkillContent = buildSkillFile("hmy-plan", "claude");
453
149
  if (installMode === "global") {
454
150
  // Global mode: Write skills to ~/.agents/skills/, symlink directories to ~/.claude/skills/
455
151
  files.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethmy/mcp",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "MCP server for Harmony Kanban board - enables AI coding agents to manage your boards",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/cli.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  saveConfig,
15
15
  } from "./config.js";
16
16
  import { HarmonyMCPServer } from "./server.js";
17
+ import { refreshSkills } from "./skills.js";
17
18
  import { runSetup } from "./tui/setup.js";
18
19
 
19
20
  const require = createRequire(import.meta.url);
@@ -28,6 +29,7 @@ program
28
29
  .command("serve")
29
30
  .description("Start the MCP server (stdio transport)")
30
31
  .action(async () => {
32
+ await refreshSkills();
31
33
  const server = new HarmonyMCPServer();
32
34
  await server.run();
33
35
  });
@@ -332,6 +332,27 @@ export async function assembleContext(
332
332
  }
333
333
  }
334
334
 
335
+ // Cross-project memory: fetch workspace-scoped entities only
336
+ // This ensures shared decisions/patterns are available without leaking project-private data
337
+ if (candidates.length < 20) {
338
+ try {
339
+ const wsResult = await client.listMemoryEntities({
340
+ workspace_id: workspaceId,
341
+ scope: "workspace",
342
+ limit: 20,
343
+ });
344
+ if (wsResult.entities?.length > 0) {
345
+ const existingIds = new Set(candidates.map((c) => c.id));
346
+ const additional = wsResult.entities
347
+ .map(mapToContextEntity)
348
+ .filter((e) => !existingIds.has(e.id));
349
+ candidates.push(...additional);
350
+ }
351
+ } catch {
352
+ // Continue with what we have
353
+ }
354
+ }
355
+
335
356
  if (candidates.length === 0) {
336
357
  return {
337
358
  context: "",