@ezmodo/mcp-server 0.13.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 (98) hide show
  1. package/README.md +305 -0
  2. package/config/development.js +20 -0
  3. package/config/endpoint-map.js +351 -0
  4. package/config/index.js +34 -0
  5. package/config/production.js +18 -0
  6. package/config/staging.js +18 -0
  7. package/handlers/access.js +141 -0
  8. package/handlers/activity.js +112 -0
  9. package/handlers/agents.js +95 -0
  10. package/handlers/ai-intelligence.js +55 -0
  11. package/handlers/attachments.js +30 -0
  12. package/handlers/catalogs.js +169 -0
  13. package/handlers/components.js +282 -0
  14. package/handlers/context-manifest.js +1150 -0
  15. package/handlers/decisions.js +114 -0
  16. package/handlers/designs.js +118 -0
  17. package/handlers/documents.js +227 -0
  18. package/handlers/entities.js +95 -0
  19. package/handlers/epics.js +190 -0
  20. package/handlers/facts.js +62 -0
  21. package/handlers/feature-flags.js +142 -0
  22. package/handlers/features.js +137 -0
  23. package/handlers/folders.js +127 -0
  24. package/handlers/git-context.js +917 -0
  25. package/handlers/github.js +72 -0
  26. package/handlers/graph.js +23 -0
  27. package/handlers/index.js +205 -0
  28. package/handlers/links.js +156 -0
  29. package/handlers/milestones.js +131 -0
  30. package/handlers/organizations.js +14 -0
  31. package/handlers/projects.js +122 -0
  32. package/handlers/recurring-tasks.js +33 -0
  33. package/handlers/tags.js +124 -0
  34. package/handlers/tasks.js +561 -0
  35. package/handlers/testing.js +116 -0
  36. package/handlers/todos.js +43 -0
  37. package/handlers/watchers.js +54 -0
  38. package/handlers/work-templates.js +32 -0
  39. package/index.js +175 -0
  40. package/lib/active-session.js +86 -0
  41. package/lib/auto-assign.js +93 -0
  42. package/lib/autolink.js +176 -0
  43. package/lib/changed-files.js +22 -0
  44. package/lib/env.js +45 -0
  45. package/lib/git-helpers.js +553 -0
  46. package/lib/git-utils.js +73 -0
  47. package/lib/http-client.js +164 -0
  48. package/lib/links-at-create.js +94 -0
  49. package/lib/local-cache.js +140 -0
  50. package/lib/logger.js +109 -0
  51. package/lib/manifest-loader.js +182 -0
  52. package/lib/manifest-query.js +686 -0
  53. package/lib/repo-config-dir.js +118 -0
  54. package/lib/version.js +10 -0
  55. package/lib/web-url.js +69 -0
  56. package/lib/worktree-tools.js +950 -0
  57. package/package.json +62 -0
  58. package/prompts/ai-workflow-automation.js +96 -0
  59. package/prompts/index.js +39 -0
  60. package/prompts/zephly-usage-guide-content.txt +631 -0
  61. package/prompts/zephly-usage-guide.js +119 -0
  62. package/tools/access-entity-types.js +28 -0
  63. package/tools/access.js +152 -0
  64. package/tools/activity.js +38 -0
  65. package/tools/agents.js +208 -0
  66. package/tools/ai-intelligence.js +111 -0
  67. package/tools/attachments.js +92 -0
  68. package/tools/catalogs.js +341 -0
  69. package/tools/components.js +249 -0
  70. package/tools/context-manifest.js +236 -0
  71. package/tools/decisions.js +168 -0
  72. package/tools/designs.js +222 -0
  73. package/tools/documents.js +287 -0
  74. package/tools/entities.js +223 -0
  75. package/tools/epics.js +267 -0
  76. package/tools/facts.js +70 -0
  77. package/tools/feature-flags.js +300 -0
  78. package/tools/features.js +246 -0
  79. package/tools/folders.js +122 -0
  80. package/tools/git-context.js +109 -0
  81. package/tools/github.js +172 -0
  82. package/tools/graph.js +70 -0
  83. package/tools/index.js +77 -0
  84. package/tools/link-params.js +93 -0
  85. package/tools/linkable-types.js +36 -0
  86. package/tools/links.js +199 -0
  87. package/tools/milestones.js +176 -0
  88. package/tools/organizations.js +23 -0
  89. package/tools/projects.js +172 -0
  90. package/tools/recurring-tasks.js +115 -0
  91. package/tools/tags.js +219 -0
  92. package/tools/task-item-schema.js +57 -0
  93. package/tools/task-type.js +33 -0
  94. package/tools/tasks.js +680 -0
  95. package/tools/testing.js +344 -0
  96. package/tools/todos.js +69 -0
  97. package/tools/watchers.js +81 -0
  98. package/tools/work-templates.js +96 -0
@@ -0,0 +1,631 @@
1
+ type: 'text',
2
+ text: `# Zephly MCP Integration Guide
3
+
4
+ You have access to Zephly's intelligent project management tools. Use them to help users with project planning, task management, and team coordination.
5
+
6
+ ## When to Use Zephly Tools
7
+
8
+ **Proactively use these tools when:**
9
+ - User mentions tasks, projects, sprints, or team coordination
10
+ - User asks about project status, health, or blockers
11
+ - User needs help prioritizing work or deciding what to work on next
12
+ - User is planning team assignments or workload distribution
13
+ - User is breaking down epics/features into tasks
14
+ - User asks about project timelines or estimates
15
+ - User mentions dependencies, blockers, or handoffs
16
+
17
+ ## Tool Categories
18
+
19
+ ### Project Context Management (4 tools) 🆕
20
+ - \`detect_git_repository\` - Auto-detect git repo and match to Zephly projects by URL (with confidence scores)
21
+ - \`get_current_project_context\` - Auto-detect which Zephly project from .zephly/config.json (walks up directory tree, includes validation)
22
+ - \`initialize_project_context\` - Interactive setup to create .zephly/config.json (now with git auto-detection!)
23
+ - \`search_projects\` - Search/filter projects by name, type, or organization
24
+
25
+ **IMPORTANT**: Use these tools at the start of ANY work session to establish which Zephly project you're working on. This eliminates the need to pass projectId to every tool call.
26
+
27
+ ### Organization Discovery (3 tools)
28
+ - \`list_organizations\` - List all workspaces the user has access to (use first when creating projects/goals)
29
+ - \`get_default_organization\` - Get user's default/primary workspace (use as fallback)
30
+ - \`list_projects\` - List all projects accessible to API key (with org info, git URLs, roles)
31
+
32
+ ### Basic Operations (7 tools)
33
+ - \`create_task\` - Create tasks with AI context, metadata, and implementation steps
34
+ - \`update_task\` - Update task properties, status, and manage steps (add/toggle/update/delete)
35
+ - \`complete_task\` - Mark tasks completed with notes
36
+ - \`get_project_context\` - Retrieve project memory/knowledge/config
37
+ - \`add_task_context\` - Add knowledge/memory to tasks
38
+ - \`search_tasks\` - **Semantic/vector search** with natural language queries OR filter-based search (automatically uses AI-powered similarity when searchText provided)
39
+ - \`get_documentation\` - Retrieve project documentation
40
+
41
+ ### Intelligence Tools (4 tools)
42
+ - \`get_project_insights\` - Comprehensive project health: blockers, at-risk tasks, velocity trends, team workload
43
+ - \`suggest_next_actions\` - Personalized recommendations based on dependencies, deadlines, capacity
44
+ - \`analyze_dependency_graph\` - Critical path analysis, bottleneck detection, parallel opportunities
45
+ - \`estimate_task_duration\` - AI-powered estimates based on historical data
46
+
47
+ ### Team Coordination (6 tools)
48
+ - \`analyze_team_capacity\` - Resource allocation and availability analysis
49
+ - \`suggest_task_assignments\` - Smart task-to-person matching by skills and capacity
50
+ - \`identify_handoff_needs\` - Detect blocked tasks grouped by blocker with urgency
51
+ - \`bulk_task_operations\` - Atomic batch operations (create/update/delete multiple tasks)
52
+ - \`apply_task_template\` - Reusable workflows with variable substitution (feature, bug, design)
53
+ - \`pull_ai_task_from_queue\` - Get intelligent task queue for AI agents with auto-assignment (NEW)
54
+
55
+ ### Git Worktree Tools (5 tools) 🆕
56
+ - \`create_epic_worktree\` - Create worktree for an entire epic (all tasks share one branch) ⭐ NEW
57
+ - \`create_task_worktree\` - Create isolated git worktree for a task with automatic branch generation
58
+ - \`sync_task_worktree_status\` - Sync git status to task (dirty, ahead/behind, conflicts)
59
+ - \`cleanup_task_worktrees\` - Clean up worktrees for completed tasks (with dry-run mode)
60
+ - \`list_project_worktrees\` - List all worktrees with task associations and status
61
+
62
+ **What are worktrees?** Git worktrees allow multiple working directories for the same repository, enabling parallel development. Zephly supports two approaches:
63
+
64
+ 1. **Epic-Level Worktrees** (Recommended for related tasks): Create one worktree for an entire epic, allowing all tasks to share the same branch. Perfect for feature batches, dependent tasks, or work that should be in one PR.
65
+
66
+ 2. **Task-Level Worktrees**: Create separate worktrees for individual tasks (1:1:1 mapping: Task → Branch → Worktree).
67
+
68
+ **Key benefits:**
69
+ - Work on multiple tasks/epics simultaneously without branch switching
70
+ - Each task has isolated workspace (no stashing needed)
71
+ - Automatic branch naming from task/epic metadata
72
+ - Team visibility into active development work
73
+ - Clean context switching for AI agents and developers
74
+
75
+ ## Working with Task Steps
76
+
77
+ Task steps are lightweight implementation checklists within tasks. Use them to break down work into concrete, actionable items.
78
+
79
+ **Creating tasks with steps:**
80
+ \`\`\`javascript
81
+ create_task({
82
+ projectId: "abc123",
83
+ title: "Implement user authentication",
84
+ description: "Add OAuth2 login flow...",
85
+ steps: [
86
+ "Set up OAuth2 provider configuration",
87
+ "Create login UI components",
88
+ "Implement token validation middleware",
89
+ "Add session management",
90
+ "Write integration tests"
91
+ ]
92
+ })
93
+ \`\`\`
94
+
95
+ **Managing steps:**
96
+ - \`update_task({ taskId, addStep: "New step content" })\` - Add a new step
97
+ - \`update_task({ taskId, toggleStep: { stepId: "xyz", completed: true } })\` - Mark step complete
98
+ - \`update_task({ taskId, updateStepContent: { stepId: "xyz", content: "Updated text" } })\` - Edit step
99
+ - \`update_task({ taskId, deleteStep: "xyz" })\` - Remove step
100
+
101
+ **Best practices:**
102
+ - Break tasks into 3-7 steps for optimal tracking
103
+ - Use clear, action-oriented step descriptions
104
+ - Mark steps complete as you progress for real-time visibility
105
+ - Use steps for implementation details within a single task
106
+
107
+ ## Best Practices
108
+
109
+ 1. **🆕 Establish project context FIRST**: Call \`get_current_project_context\` at the start of every session. If not found, use \`initialize_project_context\` to set it up. This eliminates repetitive projectId parameters and enables git workflow integration.
110
+ 2. **Start with context**: After establishing which project, call \`get_project_context\` to understand project state (memory, knowledge, config)
111
+ 3. **Check health proactively**: Use \`get_project_insights\` to identify issues before planning
112
+ 4. **Estimate before creating**: Use \`estimate_task_duration\` when creating tasks to set realistic expectations
113
+ 5. **Check capacity before assigning**: Use \`analyze_team_capacity\` to avoid overloading team members
114
+ 6. **Batch related operations**: Use \`bulk_task_operations\` for efficiency when creating/updating multiple tasks
115
+ 7. **Use templates**: Apply \`apply_task_template\` for common workflows (features, bugs, design iterations)
116
+ 8. **Track dependencies**: Use \`analyze_dependency_graph\` to identify critical path and bottlenecks
117
+ 9. **🆕 Use worktrees for parallel development**: Choose epic-level (\`create_epic_worktree\`) for related tasks that should be in one PR, or task-level (\`create_task_worktree\`) for independent work. Epic worktrees are recommended when multiple tasks form a cohesive feature. Sync status with \`sync_task_worktree_status\` for team visibility.
118
+
119
+ ## 🤖 AI Workflow Automation (NEW!)
120
+
121
+ **IMPORTANT:** When you (as an AI agent) are implementing features or working on complex tasks, **automatically track your work in Zephly in real-time**. Don't wait for users to ask you to update documentation or check off tasks.
122
+
123
+ **When to Use Workflow Automation:**
124
+ - User asks you to implement a feature (not just explain or plan)
125
+ - Task involves multiple implementation steps (>3 steps)
126
+ - Work needs team visibility or historical tracking
127
+ - You're working in a codebase with \`.zephly/config.json\`
128
+
129
+ **Workflow Steps:**
130
+ 1. **Create Epic** - Use \`create_epic\` to create the high-level feature container with success criteria
131
+ 2. **Break Down Tasks** - Create 3-7 tasks with \`create_task\`, each with implementation steps
132
+ 3. **Track Progress** - Update steps with \`update_task\` (toggle, add, modify) as you work
133
+ 4. **Update Status** - Move tasks through workflow: backlog → todo → in_progress → in_review → completed
134
+ 5. **Document** - Use \`create_document\` to create setup guides, API docs, or troubleshooting guides
135
+ 6. **Wrap Up** - Use \`update_epic\` to mark epic completed when all tasks are done
136
+
137
+ **Example:**
138
+ \`\`\`javascript
139
+ // 1. Create epic
140
+ const epic = await create_epic({
141
+ projectId: "abc123",
142
+ title: "User Authentication System",
143
+ successCriteria: ["Users can sign up", "Sessions persist", "Admin roles work"]
144
+ })
145
+
146
+ // 2. Create tasks with steps
147
+ await create_task({
148
+ epicId: epic.id,
149
+ title: "Implement OAuth2 backend",
150
+ steps: ["Set up OAuth2 config", "JWT generation", "Validation middleware", "Tests"],
151
+ assigneeType: "ai",
152
+ assigneeId: "claude"
153
+ })
154
+
155
+ // 3. Track progress
156
+ await update_task({ taskId: "task1", status: "in_progress" })
157
+ await update_task({ taskId: "task1", toggleStep: { stepId: "step1", completed: true } })
158
+
159
+ // 4. Document
160
+ await create_document({
161
+ projectId: "abc123",
162
+ title: "Authentication Setup Guide",
163
+ content: "# How to configure OAuth2...",
164
+ type: "setup"
165
+ })
166
+
167
+ // 5. Complete
168
+ await complete_task({ taskId: "task1", completionNotes: "OAuth2 implementation complete" })
169
+ await update_epic({ epicId: epic.id, status: "completed" })
170
+ \`\`\`
171
+
172
+ **See the \`ai-workflow-automation\` prompt for complete guidelines** (use "Invoke prompt: ai-workflow-automation" in Claude Desktop).
173
+
174
+ **Benefits:**
175
+ - Real-time visibility for users (no "black box" AI work)
176
+ - Historical record of decisions and implementation details
177
+ - Documentation created alongside code
178
+ - Competitive advantage: "The only PM tool where AI agents manage their own project tracking"
179
+
180
+ ## Example Workflows
181
+
182
+ ### Setting Up Project Context (FIRST THING TO DO!)
183
+ When starting work in any directory, establish project context FIRST:
184
+
185
+ **Step 1: Check if context exists**
186
+ \`\`\`javascript
187
+ const context = await get_current_project_context()
188
+
189
+ if (context.found) {
190
+ // ✅ Context found! Use it
191
+ console.log(\`Working on: \${context.projectName} (\${context.projectId})\`)
192
+ // Now you can use context.projectId in all subsequent calls
193
+ } else {
194
+ // ❌ No context - need to initialize
195
+ await initialize_project_context() // Interactive mode
196
+ }
197
+ \`\`\`
198
+
199
+ **Step 2a: Interactive initialization (recommended)**
200
+ \`\`\`javascript
201
+ // Call without params - tool returns available projects
202
+ const result = await initialize_project_context()
203
+ // Returns: { mode: 'interactive', organizations: [...] }
204
+
205
+ // Present options to user, then call again with selection:
206
+ await initialize_project_context({
207
+ projectId: 'selected-project-id',
208
+ organizationId: 'selected-org-id'
209
+ })
210
+ // Creates .zephly/config.json automatically
211
+ \`\`\`
212
+
213
+ **Step 2b: Automated initialization (if you know the IDs)**
214
+ \`\`\`javascript
215
+ await initialize_project_context({
216
+ projectId: 'abc123',
217
+ organizationId: 'org456'
218
+ })
219
+ // ✅ Creates .zephly/config.json
220
+ // ✅ Updates .gitignore
221
+ \`\`\`
222
+
223
+ **Step 3: Monorepo support**
224
+ \`\`\`javascript
225
+ await initialize_project_context({
226
+ projectId: 'monorepo-root-id',
227
+ organizationId: 'org456',
228
+ monorepoProjects: [
229
+ { projectId: 'backend-id', name: 'Backend API', path: 'packages/api' },
230
+ { projectId: 'frontend-id', name: 'Frontend', path: 'packages/web' }
231
+ ]
232
+ })
233
+
234
+ // Later, when you cd into packages/api, get_current_project_context
235
+ // will automatically return backend-id!
236
+ \`\`\`
237
+
238
+ **Why this matters:**
239
+ - Eliminates repetitive projectId parameters
240
+ - Survives git operations (committed or gitignored)
241
+ - Works offline (no API calls needed to know context)
242
+ - AI task queue can use this for git clone workflows
243
+
244
+ ### Git Repository Auto-Detection (NEW!)
245
+ When working in a git repository, automatically match to Zephly projects:
246
+
247
+ \`\`\`javascript
248
+ // 1. Detect git and match to projects
249
+ const gitInfo = await detect_git_repository()
250
+
251
+ if (gitInfo.matchCount > 0) {
252
+ // High confidence match found!
253
+ const bestMatch = gitInfo.matches[0]
254
+ console.log(\`Found match: \${bestMatch.project.name} (confidence: \${bestMatch.confidence})\`)
255
+
256
+ // Use it to initialize context
257
+ await initialize_project_context({
258
+ projectId: bestMatch.project.id,
259
+ organizationId: bestMatch.project.organizationId
260
+ })
261
+ } else if (gitInfo.isGitRepository) {
262
+ // Git repo but no matches - ask user to select
263
+ console.log(\`Git repo detected: \${gitInfo.remoteUrl}\`)
264
+ console.log(\`No matching projects found. Please select one.\`)
265
+ }
266
+ \`\`\`
267
+
268
+ **How URL Matching Works:**
269
+ - **Exact match (1.0)**: URLs are identical (ignoring protocol/trailing slashes)
270
+ - **High confidence (0.95)**: Same repository, different protocol (https vs git@)
271
+ - **Medium confidence (0.5)**: Same repository name
272
+ - **Low confidence (<0.5)**: Not shown
273
+
274
+ **Supported URL formats:**
275
+ - \`https://github.com/user/repo.git\`
276
+ - \`git@github.com:user/repo.git\`
277
+ - \`https://gitlab.com/user/repo\`
278
+ - Any git hosting service
279
+
280
+ ### Choosing a Workspace (Organization Selection)
281
+ When a user wants to create a project or goal without specifying which workspace:
282
+ 1. \`list_organizations\` - Get all available workspaces
283
+ 2. Present options to user: "Which workspace? 1) Acme Corp, 2) Personal, 3) Startup Inc"
284
+ 3. User selects one → use that \`organizationId\`
285
+ 4. If user has only one org, skip to step 4 directly
286
+ 5. Alternative: \`get_default_organization\` - Use default if user doesn't want to choose
287
+
288
+ **Example:**
289
+ \`\`\`javascript
290
+ // User: "Create a new project called Marketing Campaign"
291
+ const orgs = await list_organizations()
292
+ // Returns: [
293
+ // { id: "org1", name: "Acme Corp", slug: "acme", type: "team" },
294
+ // { id: "org2", name: "Personal Workspace", slug: "personal", type: "individual" }
295
+ // ]
296
+
297
+ // Present to user: "Which workspace? 1) Acme Corp, 2) Personal Workspace"
298
+ // User selects: "Acme Corp"
299
+ const organizationId = "org1"
300
+
301
+ // Now create the project
302
+ await create_project({
303
+ organizationId,
304
+ name: "Marketing Campaign",
305
+ description: "Q2 marketing push"
306
+ })
307
+ \`\`\`
308
+
309
+ ### Starting a New Feature
310
+ 1. \`get_project_context\` - Understand current project state
311
+ 2. \`get_project_insights\` - Check for existing blockers
312
+ 3. \`estimate_task_duration\` - Estimate the feature work
313
+ 4. \`apply_task_template\` - Use "feature" template (specs → dev → test → docs)
314
+ 5. \`analyze_team_capacity\` - Check team bandwidth
315
+ 6. \`suggest_task_assignments\` - Assign to right people
316
+
317
+ ### Daily Standup / Status Check
318
+ 1. \`get_project_insights\` - Get health score, blockers, velocity
319
+ 2. \`identify_handoff_needs\` - Find what's blocking what
320
+ 3. \`suggest_next_actions\` - Prioritized work queue for each team member
321
+ 4. \`analyze_team_capacity\` - Check for overallocation
322
+
323
+ ### Sprint Planning
324
+ 1. \`get_project_context\` - Review project goals and context
325
+ 2. \`analyze_dependency_graph\` - Understand task dependencies
326
+ 3. \`analyze_team_capacity\` - Check available capacity
327
+ 4. \`estimate_task_duration\` - Estimate new tasks
328
+ 5. \`suggest_task_assignments\` - Match tasks to team members
329
+ 6. \`bulk_task_operations\` - Create sprint tasks in batch
330
+
331
+ ### Breaking Down an Epic
332
+ 1. \`get_project_context\` - Understand project architecture
333
+ 2. \`estimate_task_duration\` - Estimate each task
334
+ 3. \`apply_task_template\` - Use templates for common patterns
335
+ 4. \`bulk_task_operations\` - Create all tasks with dependencies
336
+ 5. \`analyze_dependency_graph\` - Verify dependency structure
337
+
338
+ ### AI Agent Task Queue (NEW!)
339
+ When you (as an AI agent) need to find work:
340
+ 1. \`pull_ai_task_from_queue\` - Get prioritized queue (no selection)
341
+ - Shows unassigned tasks + tasks already assigned to AI agents
342
+ - Intelligent scoring: urgency (40%) + importance (40%) + status (20%)
343
+ - Filters: priority, status, labels
344
+ 2. Review the queue and select the highest-priority task that matches your capabilities
345
+ 3. \`pull_ai_task_from_queue\` - Auto-assign by passing \`selectTaskId\`
346
+ 4. Work on the task and update status as you progress
347
+ 5. \`complete_task\` - Mark done when finished
348
+
349
+ **Example:**
350
+ \`\`\`javascript
351
+ // 1. Get queue (browse available work)
352
+ const queue = await pull_ai_task_from_queue({
353
+ projectId: "proj123",
354
+ agentId: "claude",
355
+ agentName: "Claude",
356
+ priority: "high", // Optional: filter to high priority only
357
+ status: "todo", // Optional: filter to ready-to-start tasks
358
+ limit: 10
359
+ })
360
+ // Returns: { tasks: [{taskId, title, score, reason, ...}, ...], queueSize: 10 }
361
+
362
+ // 2. Select and claim a task
363
+ const claimed = await pull_ai_task_from_queue({
364
+ projectId: "proj123",
365
+ agentId: "claude",
366
+ agentName: "Claude",
367
+ selectTaskId: "task456" // Auto-assigns to you
368
+ })
369
+ // Returns: { task: {...full task details...}, assigned: true }
370
+
371
+ // 3. If git context included, clone repo
372
+ if (claimed.gitContext) {
373
+ // Git context automatically included if project has gitRepositoryUrl!
374
+ console.log(\`Clone: \${claimed.gitContext.cloneCommand}\`)
375
+ console.log(\`Checkout: \${claimed.gitContext.checkoutCommand}\`)
376
+ }
377
+
378
+ // 4. Work on it, then complete
379
+ await complete_task({ taskId: "task456", notes: "Implemented feature X" })
380
+ \`\`\`
381
+
382
+ **Git Context in Task Assignment:**
383
+ When a task is assigned, if the project has a \`gitRepositoryUrl\` configured, the response automatically includes:
384
+ \`\`\`javascript
385
+ {
386
+ task: {...},
387
+ gitContext: {
388
+ repository: "https://github.com/user/repo.git",
389
+ branch: "main",
390
+ cloneCommand: "git clone https://github.com/user/repo.git",
391
+ checkoutCommand: "git checkout main"
392
+ }
393
+ }
394
+ \`\`\`
395
+
396
+ **Smart Scoring Explained:**
397
+ - **Urgency (40%)**: Overdue tasks = 1.0, due today = 0.9, due in 3 days = 0.75, etc.
398
+ - **Importance (40%)**: Based on task priority + how many other tasks it blocks
399
+ - **Status (20%)**: Unassigned > assigned to you > assigned to other AI agents
400
+
401
+ **Use Cases:**
402
+ - Autonomous AI agents running on cron jobs
403
+ - AI pair programming sessions ("What should I work on next?")
404
+ - AI agents specializing in certain types of work (frontend vs backend)
405
+
406
+ ### Working with Git Worktrees (NEW!)
407
+ Enable parallel development by creating isolated workspaces for tasks or epics.
408
+
409
+ **Choose Your Approach:**
410
+ - **Epic-Level**: Multiple related tasks share one worktree/branch (one PR for entire feature)
411
+ - **Task-Level**: Each task gets its own isolated worktree/branch (separate PRs)
412
+
413
+ ---
414
+
415
+ **Option A: Epic-Level Worktrees (Recommended for Related Tasks)**
416
+
417
+ **Step 1: Create epic worktree**
418
+ \`\`\`javascript
419
+ // Create worktree for entire epic
420
+ const worktree = await create_epic_worktree({
421
+ epicId: "epic123",
422
+ baseBranch: "develop", // optional
423
+ updateTasks: true // Updates all tasks in epic to reference this branch
424
+ })
425
+
426
+ // Result:
427
+ // {
428
+ // success: true,
429
+ // worktreePath: "/Users/dev/worktrees/epic-123",
430
+ // branchName: "feature/epic-123-user-authentication",
431
+ // baseBranch: "develop",
432
+ // baseCommit: "abc123...",
433
+ // updatedTaskCount: 5 // All 5 tasks now reference this branch
434
+ // }
435
+
436
+ // Navigate to worktree and work on any task in the epic
437
+ console.log(\`cd \${worktree.worktreePath}\`)
438
+ \`\`\`
439
+
440
+ **Step 2: Work on tasks within the epic**
441
+ All tasks in the epic share the same worktree and branch. You can work on them together, commit incrementally, and create one PR for the entire feature.
442
+
443
+ **Step 3: Sync status**
444
+ \`\`\`javascript
445
+ // Sync status at epic level (updates all tasks)
446
+ const status = await sync_task_worktree_status({
447
+ taskId: "any-task-in-epic" // Status syncs to epic branch
448
+ })
449
+ \`\`\`
450
+
451
+ **Benefits:**
452
+ - ✅ Single PR for related work
453
+ - ✅ Test tasks together (dependencies)
454
+ - ✅ Fewer context switches
455
+ - ✅ Natural grouping by epic
456
+
457
+ ---
458
+
459
+ **Option B: Task-Level Worktrees (For Independent Tasks)**
460
+
461
+ **Step 1: Create a worktree when starting a task**
462
+ \`\`\`javascript
463
+ // Get task details (by task number - preferred)
464
+ const task = await get_task({
465
+ taskNumber: 42,
466
+ projectId: "project123"
467
+ })
468
+
469
+ // Or by document ID (backward compatible)
470
+ // const task = await get_task({ taskId: "task123" })
471
+
472
+ // Create worktree with automatic branch generation
473
+ const worktree = await create_task_worktree({
474
+ taskId: task.id,
475
+ // Optional: specify custom paths/branches
476
+ baseBranch: "develop", // defaults to project.gitContext.defaultBranch
477
+ worktreePath: "../worktrees/task123" // defaults to project setting
478
+ })
479
+
480
+ // Result:
481
+ // {
482
+ // success: true,
483
+ // worktreePath: "/Users/dev/worktrees/task123",
484
+ // branchName: "feature/task123-add-user-auth",
485
+ // baseBranch: "develop",
486
+ // baseCommit: "abc123..."
487
+ // }
488
+
489
+ // Now navigate to worktree and start coding
490
+ console.log(\`cd \${worktree.worktreePath}\`)
491
+ \`\`\`
492
+
493
+ **Step 2: Sync status as you work**
494
+ \`\`\`javascript
495
+ // After making changes, sync status to Firestore
496
+ const status = await sync_task_worktree_status({
497
+ taskId: "task123"
498
+ })
499
+
500
+ // Result shows current state:
501
+ // {
502
+ // isDirty: true, // Has uncommitted changes
503
+ // aheadBy: 2, // 2 commits ahead of base branch
504
+ // behindBy: 0, // Up to date with base
505
+ // hasConflicts: false,
506
+ // files: [
507
+ // { status: "M ", file: "src/auth.ts" },
508
+ // { status: "??", file: "src/auth.test.ts" }
509
+ // ]
510
+ // }
511
+
512
+ // This updates task.gitContext for team visibility
513
+ \`\`\`
514
+
515
+ **Step 3: Clean up when done**
516
+ \`\`\`javascript
517
+ // After completing task, clean up worktree
518
+ const cleanup = await cleanup_task_worktrees({
519
+ projectId: "proj123",
520
+ taskIds: ["task123"],
521
+ deleteBranches: true, // Also delete branch if merged
522
+ dryRun: false
523
+ })
524
+
525
+ // Result:
526
+ // {
527
+ // cleaned: 1,
528
+ // results: [{
529
+ // taskId: "task123",
530
+ // action: "removed",
531
+ // worktreePath: "/Users/dev/worktrees/task123",
532
+ // branchAction: "deleted",
533
+ // reason: "Branch was merged"
534
+ // }]
535
+ // }
536
+ \`\`\`
537
+
538
+ **Step 4: List all worktrees (team visibility)**
539
+ \`\`\`javascript
540
+ // See all active worktrees for a project
541
+ const worktrees = await list_project_worktrees({
542
+ projectId: "proj123"
543
+ })
544
+
545
+ // Result shows active development:
546
+ // {
547
+ // worktrees: [
548
+ // {
549
+ // path: "/Users/alice/worktrees/task123",
550
+ // branch: "feature/task123-add-auth",
551
+ // taskId: "task123",
552
+ // taskTitle: "Add user authentication",
553
+ // taskStatus: "in_progress",
554
+ // assignee: { type: "human", name: "Alice" },
555
+ // isDirty: true,
556
+ // aheadBy: 3,
557
+ // behindBy: 0
558
+ // },
559
+ // {
560
+ // path: "/Users/bob/worktrees/task456",
561
+ // branch: "fix/task456-memory-leak",
562
+ // taskId: "task456",
563
+ // taskTitle: "Fix memory leak",
564
+ // taskStatus: "in_review",
565
+ // assignee: { type: "human", name: "Bob" },
566
+ // isDirty: false,
567
+ // aheadBy: 5,
568
+ // behindBy: 1
569
+ // }
570
+ // ],
571
+ // totalCount: 2,
572
+ // orphanedCount: 0
573
+ // }
574
+ \`\`\`
575
+
576
+ **Workflow Benefits:**
577
+ - **Context switching**: Jump between tasks without losing work
578
+ - **Parallel development**: Work on multiple features simultaneously
579
+ - **Team coordination**: See what everyone is working on
580
+ - **AI-friendly**: Clean workspace boundaries for AI agents
581
+ - **Automatic cleanup**: No stale branches accumulating
582
+
583
+ **Branch Naming Conventions:**
584
+
585
+ **Epic Branches:**
586
+ - \`feature/epic-{epic-id}-{title}\` - All epic branches use 'feature' prefix
587
+ - Example: \`feature/epic-123-user-authentication-system\`
588
+
589
+ **Task Branches:**
590
+ - \`feature/{task-id}-{title}\` - For new features
591
+ - \`fix/{task-id}-{title}\` - For bug fixes
592
+ - \`refactor/{task-id}-{title}\` - For refactoring
593
+ - \`docs/{task-id}-{title}\` - For documentation
594
+ - Example: \`feature/ZEP-123-add-login-page\`
595
+
596
+ ## Tips for AI Assistants
597
+
598
+ - **Discover workspaces first**: When creating projects/goals, always call \`list_organizations\` first and let the user choose which workspace to use. Don't assume!
599
+ - **Handle single organization gracefully**: If user has only one org, use it directly without prompting
600
+ - **Be proactive**: Don't wait for users to ask about Zephly - suggest using these tools when relevant
601
+ - **Explain insights**: When showing project insights, interpret the data (e.g., "Your velocity is declining - this suggests...")
602
+ - **Provide context**: When suggesting actions, explain the reasoning (dependencies, deadlines, capacity)
603
+ - **Batch operations**: When creating multiple related tasks, use \`bulk_task_operations\` for atomicity
604
+ - **Follow up**: After creating tasks, offer to analyze dependencies or suggest assignments
605
+ - **Track context**: Use \`add_task_context\` to maintain AI memory across sessions
606
+ - **Use worktrees for parallel work**: When starting work on an epic, use \`create_epic_worktree\` to create a shared workspace for all related tasks (recommended for features). For independent tasks, use \`create_task_worktree\`. Sync status periodically with \`sync_task_worktree_status\` for team visibility. Clean up with \`cleanup_task_worktrees\` when done.
607
+
608
+ ## Authentication & Access Control
609
+
610
+ All tools require a valid Zephly API key (set in ZEPHLY_API_KEY environment variable).
611
+
612
+ **API Key Workspace Permissions:**
613
+ - Each API key can be restricted to specific workspaces (organizations) or granted access to all workspaces
614
+ - When creating an API key at https://zephly.app/settings/api-keys, you specify which workspaces it can access
615
+ - API keys with "all workspaces" access work in any workspace the user is an active member of (including future workspaces)
616
+ - API keys with specific workspace restrictions only work in those designated workspaces
617
+ - All MCP functions automatically validate both API key permissions AND active workspace membership
618
+
619
+ **Access Control Flow:**
620
+ 1. API key is validated
621
+ 2. Workspace/project access is checked based on API key permissions
622
+ 3. User's active membership in the workspace is verified
623
+ 4. Operation proceeds only if all checks pass
624
+
625
+ **Error Messages:**
626
+ - "API key does not have access to workspace..." - API key lacks permission for that workspace
627
+ - "User is not an active member of workspace..." - User membership was revoked
628
+ - "Project not found" - Project doesn't exist or belongs to inaccessible workspace
629
+
630
+ This dual-layer security ensures that even with a valid API key, access requires both explicit key permissions and active workspace membership.`,
631
+ },