agent-planner-mcp 0.5.1 → 0.6.1
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/AGENT_GUIDE.md +3 -3
- package/SKILL.md +7 -11
- package/package.json +1 -1
- package/src/tools.js +34 -263
package/AGENT_GUIDE.md
CHANGED
|
@@ -17,9 +17,9 @@ This guide is optimized for AI agents using AgentPlanner MCP tools.
|
|
|
17
17
|
|
|
18
18
|
### Before Starting Work
|
|
19
19
|
```javascript
|
|
20
|
-
|
|
20
|
+
get_plan_context({ plan_id: "..." })
|
|
21
21
|
```
|
|
22
|
-
Returns:
|
|
22
|
+
Returns: plan overview, phase summaries, linked goals, knowledge
|
|
23
23
|
|
|
24
24
|
### Update Task Status
|
|
25
25
|
```javascript
|
|
@@ -244,7 +244,7 @@ Key rules:
|
|
|
244
244
|
|
|
245
245
|
## Best Practices
|
|
246
246
|
|
|
247
|
-
1. **Use `get_task_context`
|
|
247
|
+
1. **Use `get_task_context` for task work, `get_plan_context` for plan overview** - progressive depth gives you exactly what you need
|
|
248
248
|
2. **Check dependencies before starting** - use `suggest_next_tasks` to find what's ready
|
|
249
249
|
3. **Log as you work** - helps humans and future agents follow
|
|
250
250
|
4. **Record important findings** - use `add_learning` after research, decisions, and discoveries
|
package/SKILL.md
CHANGED
|
@@ -110,7 +110,6 @@ Each suggestion includes a `reason` field explaining why it's recommended.
|
|
|
110
110
|
| `delete_node` | Delete a node and its children |
|
|
111
111
|
| `move_node` | Reparent or reorder a node |
|
|
112
112
|
| `batch_update_nodes` | Update multiple nodes at once |
|
|
113
|
-
| `get_node_context` | Detailed node info with children and logs |
|
|
114
113
|
| `get_node_ancestry` | Path from root to node |
|
|
115
114
|
|
|
116
115
|
When creating nodes:
|
|
@@ -150,12 +149,9 @@ Cycle detection is automatic — you cannot create a dependency that would form
|
|
|
150
149
|
|
|
151
150
|
| Tool | Purpose |
|
|
152
151
|
|------|---------|
|
|
153
|
-
| `get_task_context` | **
|
|
152
|
+
| `get_task_context` | **Primary.** Progressive context at depth 1-4 with token budgeting |
|
|
153
|
+
| `get_plan_context` | Plan overview with phase summaries and knowledge |
|
|
154
154
|
| `suggest_next_tasks` | Find ready tasks based on dependency analysis |
|
|
155
|
-
| `understand_context` | Full situation overview for a plan or goal (see Orientation) |
|
|
156
|
-
| `get_plan_context` | Plan overview with phase summaries |
|
|
157
|
-
| `get_agent_context` | Legacy leaf-up context (use `get_task_context` instead) |
|
|
158
|
-
| `get_context` | Legacy full-plan context (use `get_task_context` or `understand_context` instead) |
|
|
159
155
|
|
|
160
156
|
### Logging
|
|
161
157
|
|
|
@@ -261,11 +257,10 @@ Use `get_recent_episodes` to review what has been learned recently across all pl
|
|
|
261
257
|
| Tool | Purpose |
|
|
262
258
|
|------|---------|
|
|
263
259
|
| `get_started` | Guidance on how to use AgentPlanner — call when new or unsure how to approach a task |
|
|
264
|
-
| `understand_context` | Comprehensive context about a plan or goal (purpose, state, activity, blockers, knowledge) |
|
|
265
260
|
|
|
266
261
|
`get_started` accepts an optional `topic`: `overview`, `planning`, `execution`, `knowledge`, or `collaboration`.
|
|
267
262
|
|
|
268
|
-
|
|
263
|
+
To understand a plan before starting, use `get_plan_context({ plan_id })` for the overview, then `get_task_context({ node_id, depth: 4 })` for deep context on a specific task.
|
|
269
264
|
|
|
270
265
|
### Other
|
|
271
266
|
|
|
@@ -325,9 +320,10 @@ When to use RPI vs. a single task:
|
|
|
325
320
|
### Starting a New Session
|
|
326
321
|
```
|
|
327
322
|
1. get_my_tasks({}) → see what's in progress or blocked across all plans
|
|
328
|
-
2. get_recent_episodes({ max_episodes: 10 }) → review
|
|
329
|
-
3. If resuming: get_task_context({ node_id: "...", depth: 2 })
|
|
330
|
-
4. If
|
|
323
|
+
2. get_recent_episodes({ max_episodes: 10 }) → review recent knowledge across all plans
|
|
324
|
+
3. If resuming a task: get_task_context({ node_id: "...", depth: 2 })
|
|
325
|
+
4. If orienting on a plan: get_plan_context({ plan_id: "..." })
|
|
326
|
+
5. If starting fresh: suggest_next_tasks({ plan_id: "..." })
|
|
331
327
|
```
|
|
332
328
|
|
|
333
329
|
### Breaking Down a Large Task
|
package/package.json
CHANGED
package/src/tools.js
CHANGED
|
@@ -182,18 +182,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
182
182
|
// CONTEXT LOADING - Get everything you need
|
|
183
183
|
// Use before starting work on a plan/goal
|
|
184
184
|
// ========================================
|
|
185
|
-
{
|
|
186
|
-
name: "get_context",
|
|
187
|
-
description: "Load EVERYTHING you need to work on a plan or goal: structure, status, progress, blocked tasks, recent activity, and relevant knowledge. Call this FIRST before starting work.",
|
|
188
|
-
inputSchema: {
|
|
189
|
-
type: "object",
|
|
190
|
-
properties: {
|
|
191
|
-
plan_id: { type: "string", description: "Plan to get context for" },
|
|
192
|
-
goal_id: { type: "string", description: "Goal to get context for" },
|
|
193
|
-
include_knowledge: { type: "boolean", default: true, description: "Include relevant knowledge entries" }
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
185
|
{
|
|
198
186
|
name: "get_my_tasks",
|
|
199
187
|
description: "Get tasks that need attention - blocked tasks, in-progress tasks, and next tasks to start. Perfect for status check-ins.",
|
|
@@ -297,14 +285,19 @@ function setupTools(server, apiClientOverride) {
|
|
|
297
285
|
// ===== PLAN MANAGEMENT TOOLS =====
|
|
298
286
|
{
|
|
299
287
|
name: "list_plans",
|
|
300
|
-
description: "List
|
|
288
|
+
description: "List plans. By default excludes completed/archived plans — set include_completed to true to see all.",
|
|
301
289
|
inputSchema: {
|
|
302
290
|
type: "object",
|
|
303
291
|
properties: {
|
|
304
|
-
status: {
|
|
305
|
-
type: "string",
|
|
292
|
+
status: {
|
|
293
|
+
type: "string",
|
|
306
294
|
description: "Optional filter by plan status",
|
|
307
295
|
enum: ["draft", "active", "completed", "archived"]
|
|
296
|
+
},
|
|
297
|
+
include_completed: {
|
|
298
|
+
type: "boolean",
|
|
299
|
+
description: "If true, include completed and archived plans (default: false)",
|
|
300
|
+
default: false
|
|
308
301
|
}
|
|
309
302
|
}
|
|
310
303
|
}
|
|
@@ -474,18 +467,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
474
467
|
required: ["plan_id", "node_id"]
|
|
475
468
|
}
|
|
476
469
|
},
|
|
477
|
-
{
|
|
478
|
-
name: "get_node_context",
|
|
479
|
-
description: "Get comprehensive context for a node including children and logs",
|
|
480
|
-
inputSchema: {
|
|
481
|
-
type: "object",
|
|
482
|
-
properties: {
|
|
483
|
-
plan_id: { type: "string", description: "Plan ID" },
|
|
484
|
-
node_id: { type: "string", description: "Node ID" }
|
|
485
|
-
},
|
|
486
|
-
required: ["plan_id", "node_id"]
|
|
487
|
-
}
|
|
488
|
-
},
|
|
489
470
|
{
|
|
490
471
|
name: "get_node_ancestry",
|
|
491
472
|
description: "Get the path from root to a specific node",
|
|
@@ -742,7 +723,7 @@ function setupTools(server, apiClientOverride) {
|
|
|
742
723
|
// ===== PLAN STRUCTURE & SUMMARY =====
|
|
743
724
|
{
|
|
744
725
|
name: "get_plan_structure",
|
|
745
|
-
description: "Get the hierarchical structure of a plan with minimal fields (id, parent_id, node_type, title, status, order_index). Use
|
|
726
|
+
description: "Get the hierarchical structure of a plan with minimal fields (id, parent_id, node_type, title, status, order_index). Use get_task_context for detailed information about specific nodes.",
|
|
746
727
|
inputSchema: {
|
|
747
728
|
type: "object",
|
|
748
729
|
properties: {
|
|
@@ -769,33 +750,9 @@ function setupTools(server, apiClientOverride) {
|
|
|
769
750
|
},
|
|
770
751
|
|
|
771
752
|
// ===== AGENT CONTEXT TOOLS (Leaf-up context loading) =====
|
|
772
|
-
{
|
|
773
|
-
name: "get_agent_context",
|
|
774
|
-
description: "Get focused context for a specific task/node. Uses leaf-up traversal - returns only the relevant path from the node to root, not the entire plan tree. Best for agents starting work on a specific task.",
|
|
775
|
-
inputSchema: {
|
|
776
|
-
type: "object",
|
|
777
|
-
properties: {
|
|
778
|
-
node_id: {
|
|
779
|
-
type: "string",
|
|
780
|
-
description: "Task or phase node ID to get context for"
|
|
781
|
-
},
|
|
782
|
-
include_knowledge: {
|
|
783
|
-
type: "boolean",
|
|
784
|
-
description: "Include knowledge entries from relevant scopes (plan, goals, org)",
|
|
785
|
-
default: true
|
|
786
|
-
},
|
|
787
|
-
include_siblings: {
|
|
788
|
-
type: "boolean",
|
|
789
|
-
description: "Include sibling tasks in the same phase",
|
|
790
|
-
default: false
|
|
791
|
-
}
|
|
792
|
-
},
|
|
793
|
-
required: ["node_id"]
|
|
794
|
-
}
|
|
795
|
-
},
|
|
796
753
|
{
|
|
797
754
|
name: "get_plan_context",
|
|
798
|
-
description: "Get plan-level context overview. Returns plan details, phase summaries (not full tree), linked goals, and organization. Use
|
|
755
|
+
description: "Get plan-level context overview. Returns plan details, phase summaries (not full tree), linked goals, and organization. Use get_task_context for task-focused work.",
|
|
799
756
|
inputSchema: {
|
|
800
757
|
type: "object",
|
|
801
758
|
properties: {
|
|
@@ -863,15 +820,20 @@ function setupTools(server, apiClientOverride) {
|
|
|
863
820
|
// ===== GOAL TOOLS =====
|
|
864
821
|
{
|
|
865
822
|
name: "list_goals",
|
|
866
|
-
description: "List goals
|
|
823
|
+
description: "List goals. By default returns only active goals — set include_inactive to true to see all.",
|
|
867
824
|
inputSchema: {
|
|
868
825
|
type: "object",
|
|
869
826
|
properties: {
|
|
870
827
|
organization_id: { type: "string", description: "Filter by organization ID" },
|
|
871
|
-
status: {
|
|
872
|
-
type: "string",
|
|
828
|
+
status: {
|
|
829
|
+
type: "string",
|
|
873
830
|
description: "Filter by status",
|
|
874
831
|
enum: ["active", "achieved", "at_risk", "abandoned"]
|
|
832
|
+
},
|
|
833
|
+
include_inactive: {
|
|
834
|
+
type: "boolean",
|
|
835
|
+
description: "If true, include achieved/paused/abandoned goals (default: false)",
|
|
836
|
+
default: false
|
|
875
837
|
}
|
|
876
838
|
}
|
|
877
839
|
}
|
|
@@ -1147,18 +1109,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
1147
1109
|
}
|
|
1148
1110
|
}
|
|
1149
1111
|
},
|
|
1150
|
-
{
|
|
1151
|
-
name: "understand_context",
|
|
1152
|
-
description: "Get comprehensive context about a plan or goal - its purpose, current state, recent activity, blocked tasks, and relevant knowledge. Use this BEFORE starting work to understand the full situation.",
|
|
1153
|
-
inputSchema: {
|
|
1154
|
-
type: "object",
|
|
1155
|
-
properties: {
|
|
1156
|
-
plan_id: { type: "string", description: "Plan ID to understand" },
|
|
1157
|
-
goal_id: { type: "string", description: "Goal ID to understand" },
|
|
1158
|
-
include_knowledge: { type: "boolean", description: "Include relevant knowledge entries", default: true }
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
1112
|
]
|
|
1163
1113
|
};
|
|
1164
1114
|
});
|
|
@@ -1240,7 +1190,7 @@ function setupTools(server, apiClientOverride) {
|
|
|
1240
1190
|
next_steps: [
|
|
1241
1191
|
"Use quick_status to update task progress",
|
|
1242
1192
|
"Use quick_log to document your work",
|
|
1243
|
-
"Use
|
|
1193
|
+
"Use get_plan_context to load full plan details"
|
|
1244
1194
|
]
|
|
1245
1195
|
});
|
|
1246
1196
|
}
|
|
@@ -1376,88 +1326,7 @@ function setupTools(server, apiClientOverride) {
|
|
|
1376
1326
|
// ========================================
|
|
1377
1327
|
// CONTEXT LOADING IMPLEMENTATIONS
|
|
1378
1328
|
// ========================================
|
|
1379
|
-
|
|
1380
|
-
if (name === "get_context") {
|
|
1381
|
-
// Redirect to understand_context implementation (same functionality)
|
|
1382
|
-
const { plan_id, goal_id, include_knowledge = true } = args;
|
|
1383
|
-
|
|
1384
|
-
if (!plan_id && !goal_id) {
|
|
1385
|
-
return formatResponse({
|
|
1386
|
-
error: "Provide either plan_id or goal_id to get context",
|
|
1387
|
-
suggestion: "Use list_plans or list_goals to find IDs"
|
|
1388
|
-
});
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
const context = {
|
|
1392
|
-
retrieved_at: new Date().toISOString()
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
|
-
// Get goal context
|
|
1396
|
-
if (goal_id) {
|
|
1397
|
-
try {
|
|
1398
|
-
context.goal = await apiClient.goals.get(goal_id);
|
|
1399
|
-
if (include_knowledge) {
|
|
1400
|
-
try {
|
|
1401
|
-
const graphResult = await apiClient.graphiti.graphSearch({ query: context.goal?.title || '', max_results: 10 });
|
|
1402
|
-
context.goal_knowledge = graphResult?.results?.facts || [];
|
|
1403
|
-
} catch (e) {}
|
|
1404
|
-
}
|
|
1405
|
-
} catch (e) {
|
|
1406
|
-
context.goal_error = e.message;
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// Get plan context
|
|
1411
|
-
if (plan_id) {
|
|
1412
|
-
try {
|
|
1413
|
-
context.plan = await apiClient.plans.getPlan(plan_id);
|
|
1414
|
-
context.plan_url = buildPlanUrl(plan_id);
|
|
1415
|
-
|
|
1416
|
-
const nodes = await apiClient.nodes.getNodes(plan_id);
|
|
1417
|
-
context.statistics = calculatePlanStatistics(nodes);
|
|
1418
|
-
context.progress_percentage = context.statistics.total > 0
|
|
1419
|
-
? ((context.statistics.status_counts.completed / context.statistics.total) * 100).toFixed(1) + '%'
|
|
1420
|
-
: '0%';
|
|
1421
|
-
|
|
1422
|
-
const flatNodes = flattenNodes(nodes);
|
|
1423
|
-
context.needs_attention = {
|
|
1424
|
-
blocked: flatNodes.filter(n => n.status === 'blocked').map(n => ({
|
|
1425
|
-
id: n.id, title: n.title, type: n.node_type
|
|
1426
|
-
})),
|
|
1427
|
-
in_progress: flatNodes.filter(n => n.status === 'in_progress').map(n => ({
|
|
1428
|
-
id: n.id, title: n.title, type: n.node_type
|
|
1429
|
-
})),
|
|
1430
|
-
ready_to_start: flatNodes
|
|
1431
|
-
.filter(n => n.node_type === 'task' && n.status === 'not_started')
|
|
1432
|
-
.slice(0, 5)
|
|
1433
|
-
.map(n => ({ id: n.id, title: n.title }))
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
try {
|
|
1437
|
-
const activity = await apiClient.activity.getPlanActivity(plan_id);
|
|
1438
|
-
context.recent_activity = (activity || []).slice(0, 5);
|
|
1439
|
-
} catch (e) {}
|
|
1440
|
-
|
|
1441
|
-
if (include_knowledge) {
|
|
1442
|
-
try {
|
|
1443
|
-
const graphResult = await apiClient.graphiti.graphSearch({ query: context.plan?.title || '', max_results: 10 });
|
|
1444
|
-
context.plan_knowledge = graphResult?.results?.facts || [];
|
|
1445
|
-
} catch (e) {}
|
|
1446
|
-
}
|
|
1447
|
-
} catch (e) {
|
|
1448
|
-
context.plan_error = e.message;
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
context.recommendation = context.needs_attention?.blocked?.length > 0
|
|
1453
|
-
? "⚠️ There are blocked tasks that need attention first"
|
|
1454
|
-
: context.needs_attention?.in_progress?.length > 0
|
|
1455
|
-
? "Continue working on the in-progress tasks"
|
|
1456
|
-
: "Pick a task from ready_to_start to begin";
|
|
1457
|
-
|
|
1458
|
-
return formatResponse(context);
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1329
|
+
|
|
1461
1330
|
if (name === "get_my_tasks") {
|
|
1462
1331
|
const { plan_id, status = ["blocked", "in_progress"] } = args;
|
|
1463
1332
|
|
|
@@ -1711,7 +1580,7 @@ function setupTools(server, apiClientOverride) {
|
|
|
1711
1580
|
phases: createdPhases,
|
|
1712
1581
|
tasks: createdTasks,
|
|
1713
1582
|
next_steps: [
|
|
1714
|
-
"Use
|
|
1583
|
+
"Use get_plan_context to review the imported plan",
|
|
1715
1584
|
"Use quick_status to update task progress"
|
|
1716
1585
|
]
|
|
1717
1586
|
});
|
|
@@ -1796,9 +1665,16 @@ function setupTools(server, apiClientOverride) {
|
|
|
1796
1665
|
|
|
1797
1666
|
// ===== PLAN MANAGEMENT =====
|
|
1798
1667
|
if (name === "list_plans") {
|
|
1799
|
-
const { status } = args;
|
|
1668
|
+
const { status, include_completed } = args;
|
|
1800
1669
|
const plans = await apiClient.plans.getPlans();
|
|
1801
|
-
|
|
1670
|
+
let filteredPlans;
|
|
1671
|
+
if (status) {
|
|
1672
|
+
filteredPlans = plans.filter(p => p.status === status);
|
|
1673
|
+
} else if (!include_completed) {
|
|
1674
|
+
filteredPlans = plans.filter(p => p.status !== 'completed' && p.status !== 'archived');
|
|
1675
|
+
} else {
|
|
1676
|
+
filteredPlans = plans;
|
|
1677
|
+
}
|
|
1802
1678
|
return formatResponse(filteredPlans);
|
|
1803
1679
|
}
|
|
1804
1680
|
|
|
@@ -1902,17 +1778,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
1902
1778
|
}
|
|
1903
1779
|
}
|
|
1904
1780
|
|
|
1905
|
-
if (name === "get_node_context") {
|
|
1906
|
-
const { plan_id, node_id } = args;
|
|
1907
|
-
|
|
1908
|
-
// Get node with context
|
|
1909
|
-
const response = await apiClient.axiosInstance.get(
|
|
1910
|
-
`/plans/${plan_id}/nodes/${node_id}/context`
|
|
1911
|
-
);
|
|
1912
|
-
|
|
1913
|
-
return formatResponse(response.data);
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
1781
|
if (name === "get_node_ancestry") {
|
|
1917
1782
|
const { plan_id, node_id } = args;
|
|
1918
1783
|
|
|
@@ -2122,17 +1987,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
2122
1987
|
}
|
|
2123
1988
|
|
|
2124
1989
|
// ===== AGENT CONTEXT TOOLS =====
|
|
2125
|
-
if (name === "get_agent_context") {
|
|
2126
|
-
const { node_id, include_knowledge = true, include_siblings = false } = args;
|
|
2127
|
-
|
|
2128
|
-
const result = await apiClient.context.getNodeContext(node_id, {
|
|
2129
|
-
include_knowledge,
|
|
2130
|
-
include_siblings
|
|
2131
|
-
});
|
|
2132
|
-
|
|
2133
|
-
return formatResponse(result);
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
1990
|
if (name === "get_plan_context") {
|
|
2137
1991
|
const { plan_id, include_knowledge = true } = args;
|
|
2138
1992
|
|
|
@@ -2169,8 +2023,9 @@ function setupTools(server, apiClientOverride) {
|
|
|
2169
2023
|
|
|
2170
2024
|
// ===== GOAL TOOLS =====
|
|
2171
2025
|
if (name === "list_goals") {
|
|
2172
|
-
const { organization_id, status } = args;
|
|
2173
|
-
const
|
|
2026
|
+
const { organization_id, status, include_inactive } = args;
|
|
2027
|
+
const effectiveStatus = status || (!include_inactive ? 'active' : undefined);
|
|
2028
|
+
const result = await apiClient.goals.list({ organization_id, status: effectiveStatus });
|
|
2174
2029
|
return formatResponse(result);
|
|
2175
2030
|
}
|
|
2176
2031
|
|
|
@@ -2385,7 +2240,7 @@ function setupTools(server, apiClientOverride) {
|
|
|
2385
2240
|
recommended_workflow: [
|
|
2386
2241
|
"1. Check list_goals to understand current objectives",
|
|
2387
2242
|
"2. Use list_plans to see existing plans",
|
|
2388
|
-
"3. Before working on a plan, use
|
|
2243
|
+
"3. Before working on a plan, use get_plan_context to get the full picture",
|
|
2389
2244
|
"4. Update task statuses as you work (update_node with status)",
|
|
2390
2245
|
"5. Store important decisions and learnings using add_learning",
|
|
2391
2246
|
"6. Check recall_knowledge before making decisions to see past context"
|
|
@@ -2486,90 +2341,6 @@ function setupTools(server, apiClientOverride) {
|
|
|
2486
2341
|
return formatResponse(guides[topic] || guides.overview);
|
|
2487
2342
|
}
|
|
2488
2343
|
|
|
2489
|
-
if (name === "understand_context") {
|
|
2490
|
-
const { plan_id, goal_id, include_knowledge = true } = args;
|
|
2491
|
-
|
|
2492
|
-
if (!plan_id && !goal_id) {
|
|
2493
|
-
return formatResponse({
|
|
2494
|
-
error: "Provide either plan_id or goal_id to get context"
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
const context = {
|
|
2499
|
-
retrieved_at: new Date().toISOString()
|
|
2500
|
-
};
|
|
2501
|
-
|
|
2502
|
-
// Get goal context
|
|
2503
|
-
if (goal_id) {
|
|
2504
|
-
try {
|
|
2505
|
-
context.goal = await apiClient.goals.get(goal_id);
|
|
2506
|
-
|
|
2507
|
-
// Get related knowledge if available
|
|
2508
|
-
if (include_knowledge) {
|
|
2509
|
-
try {
|
|
2510
|
-
const graphResult = await apiClient.graphiti.graphSearch({ query: context.goal?.title || '', max_results: 10 });
|
|
2511
|
-
context.goal_knowledge = graphResult?.results?.facts || [];
|
|
2512
|
-
} catch (e) {
|
|
2513
|
-
// Knowledge fetch failed, continue without it
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
} catch (e) {
|
|
2517
|
-
context.goal_error = e.message;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
// Get plan context
|
|
2522
|
-
if (plan_id) {
|
|
2523
|
-
try {
|
|
2524
|
-
context.plan = await apiClient.plans.getPlan(plan_id);
|
|
2525
|
-
|
|
2526
|
-
const nodes = await apiClient.nodes.getNodes(plan_id);
|
|
2527
|
-
context.statistics = calculatePlanStatistics(nodes);
|
|
2528
|
-
context.progress_percentage = context.statistics.total > 0
|
|
2529
|
-
? ((context.statistics.status_counts.completed / context.statistics.total) * 100).toFixed(1) + '%'
|
|
2530
|
-
: '0%';
|
|
2531
|
-
|
|
2532
|
-
// Get blocked and in-progress tasks for attention
|
|
2533
|
-
const flatNodes = flattenNodes(nodes);
|
|
2534
|
-
context.needs_attention = {
|
|
2535
|
-
blocked: flatNodes.filter(n => n.status === 'blocked').map(n => ({
|
|
2536
|
-
id: n.id,
|
|
2537
|
-
title: n.title,
|
|
2538
|
-
type: n.node_type
|
|
2539
|
-
})),
|
|
2540
|
-
in_progress: flatNodes.filter(n => n.status === 'in_progress').map(n => ({
|
|
2541
|
-
id: n.id,
|
|
2542
|
-
title: n.title,
|
|
2543
|
-
type: n.node_type
|
|
2544
|
-
}))
|
|
2545
|
-
};
|
|
2546
|
-
|
|
2547
|
-
// Get recent activity
|
|
2548
|
-
try {
|
|
2549
|
-
const activity = await apiClient.activity.getPlanActivity(plan_id);
|
|
2550
|
-
context.recent_activity = (activity || []).slice(0, 5);
|
|
2551
|
-
} catch (e) {
|
|
2552
|
-
// Activity fetch failed, continue without it
|
|
2553
|
-
}
|
|
2554
|
-
|
|
2555
|
-
// Get related knowledge if available
|
|
2556
|
-
if (include_knowledge) {
|
|
2557
|
-
try {
|
|
2558
|
-
const graphResult = await apiClient.graphiti.graphSearch({ query: context.plan?.title || '', max_results: 10 });
|
|
2559
|
-
context.plan_knowledge = graphResult?.results?.facts || [];
|
|
2560
|
-
} catch (e) {
|
|
2561
|
-
// Knowledge fetch failed, continue without it
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
} catch (e) {
|
|
2565
|
-
context.plan_error = e.message;
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
context.recommendation = "Review the statistics, needs_attention, and knowledge entries before starting work.";
|
|
2570
|
-
return formatResponse(context);
|
|
2571
|
-
}
|
|
2572
|
-
|
|
2573
2344
|
// ===== GOALS HEALTH DASHBOARD =====
|
|
2574
2345
|
if (name === "check_goals_health") {
|
|
2575
2346
|
const { status_filter } = args || {};
|