agent-enderun 0.8.8 → 0.9.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.
Files changed (164) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +5 -5
  2. package/{ENDERUN.md → .enderun/ENDERUN.md} +4 -2
  3. package/.enderun/PROJECT_MEMORY.md +32 -43
  4. package/.enderun/STATUS.md +25 -28
  5. package/.enderun/agents/agent_army_schema.json +29 -7
  6. package/.enderun/agents/backend.md +48 -39
  7. package/.enderun/agents/database.md +55 -0
  8. package/.enderun/agents/devops.md +30 -17
  9. package/.enderun/agents/explorer.md +5 -5
  10. package/.enderun/agents/frontend.md +97 -76
  11. package/.enderun/agents/git.md +4 -4
  12. package/.enderun/agents/manager.md +68 -59
  13. package/.enderun/agents/mobile.md +4 -4
  14. package/.enderun/agents/native.md +106 -0
  15. package/.enderun/agents/quality.md +122 -0
  16. package/.enderun/agents/schema/agent-lifecycle-schema.json +29 -8
  17. package/.enderun/cli-commands.json +7 -3
  18. package/.enderun/config.json +8 -2
  19. package/.enderun/knowledge/SHIM_TEMPLATE.md +25 -0
  20. package/.enderun/knowledge/context_boundary_rules.md +57 -0
  21. package/.enderun/knowledge/corporate-governance/high-risk-action-approval-flow.md +29 -0
  22. package/.enderun/knowledge/documentation_ownership.md +53 -0
  23. package/.enderun/knowledge/eslint-standards.md +63 -0
  24. package/.enderun/knowledge/frontend_professionalization_guidelines.md +7 -7
  25. package/.enderun/knowledge/hermes_live_test_guidelines.md +5 -5
  26. package/.enderun/knowledge/hermes_protocol.md +1 -1
  27. package/.enderun/knowledge/lessons-learned.md +14 -0
  28. package/.enderun/knowledge/manager_authority_audit_enforcement.md +10 -10
  29. package/.enderun/knowledge/project_scaffold_guidelines.md +4 -4
  30. package/.enderun/knowledge/reference_application_guidelines.md +6 -6
  31. package/.enderun/mcp_config.json +9 -0
  32. package/.enderun/memory-graph/agent-contexts/backend.json +1 -1
  33. package/.enderun/memory-graph/agent-contexts/devops.json +1 -1
  34. package/.enderun/memory-graph/agent-contexts/explorer.json +1 -1
  35. package/.enderun/memory-graph/agent-contexts/frontend.json +1 -1
  36. package/.enderun/memory-graph/agent-contexts/git.json +1 -1
  37. package/.enderun/memory-graph/agent-contexts/manager.json +1 -1
  38. package/.enderun/memory-graph/agent-contexts/mobile.json +1 -1
  39. package/.enderun/memory-graph/agent-contexts/native.json +1 -0
  40. package/.enderun/memory-graph/agent-contexts/quality.json +1 -0
  41. package/.enderun/memory-graph/graph.json +123 -15
  42. package/.enderun/memory-graph/shared-facts.json +26 -31
  43. package/.enderun/queue/README.md +13 -13
  44. package/README.md +171 -393
  45. package/agent.md +25 -0
  46. package/bin/cli.js +10 -10
  47. package/bin/init-check.js +69 -0
  48. package/bin/update-contract.js +57 -38
  49. package/bin/validate-agent-army.js +38 -13
  50. package/claude.md +14 -8
  51. package/docs/README.md +24 -16
  52. package/docs/architecture/README.md +9 -0
  53. package/docs/architecture/standards/data-fetching-patterns.md +13 -0
  54. package/docs/architecture/standards/design-system.md +31 -0
  55. package/docs/architecture/standards/logging.md +7 -0
  56. package/docs/architecture/standards/tech-stack.md +9 -0
  57. package/docs/getting-started.md +9 -259
  58. package/docs/user/README.md +35 -0
  59. package/docs/user/action-plan-2026.md +9 -0
  60. package/docs/user/getting-started.md +13 -0
  61. package/docs/user/roadmap.md +13 -0
  62. package/eslint.config.js +68 -0
  63. package/framework-mcp/dist/index.js +178 -24
  64. package/framework-mcp/package.json +6 -33
  65. package/framework-mcp/tsconfig.json +3 -6
  66. package/gemini.md +12 -6
  67. package/grok.md +25 -0
  68. package/package.json +13 -5
  69. package/panda.config.ts +86 -86
  70. package/src/cli/adapters.ts +208 -0
  71. package/src/cli/commands/app.ts +38 -0
  72. package/src/cli/commands/check.ts +87 -0
  73. package/src/cli/commands/compliance.ts +55 -0
  74. package/src/cli/commands/contract.ts +45 -0
  75. package/src/cli/commands/explorer.ts +45 -0
  76. package/src/cli/commands/git.ts +39 -0
  77. package/src/cli/commands/init.ts +272 -0
  78. package/src/cli/commands/knowledge.ts +44 -0
  79. package/src/cli/commands/lint.ts +25 -0
  80. package/src/cli/commands/log.ts +37 -0
  81. package/src/cli/commands/memory.ts +78 -0
  82. package/src/cli/commands/orchestrate.ts +111 -0
  83. package/src/cli/commands/script.ts +20 -0
  84. package/src/cli/commands/security.ts +38 -0
  85. package/src/cli/commands/status.ts +59 -0
  86. package/src/cli/commands/trace.ts +46 -0
  87. package/src/cli/index.ts +74 -2155
  88. package/src/cli/utils/app.ts +764 -0
  89. package/src/cli/utils/claude.ts +56 -0
  90. package/src/cli/utils/fs.ts +139 -0
  91. package/src/cli/utils/memory.ts +141 -0
  92. package/src/cli/utils/pkg.ts +215 -0
  93. package/src/cli/utils/string.ts +48 -0
  94. package/src/cli/utils/time.ts +27 -0
  95. package/tsconfig.json +9 -0
  96. package/.enderun/agents/analyst.md +0 -238
  97. package/.enderun/agents/orchestrator.md +0 -172
  98. package/.enderun/agents/qa.md +0 -124
  99. package/.enderun/agents/security.md +0 -202
  100. package/.enderun/knowledge/api_design_rules.md +0 -6
  101. package/.enderun/knowledge/branded_types_pattern.md +0 -8
  102. package/.enderun/knowledge/code_review_checklist.md +0 -7
  103. package/.enderun/knowledge/contract_versioning.md +0 -7
  104. package/.enderun/knowledge/database_migration.md +0 -6
  105. package/.enderun/knowledge/deployment_checklist.md +0 -7
  106. package/.enderun/knowledge/git_commit_strategy.md +0 -10
  107. package/.enderun/knowledge/monitoring_setup.md +0 -5
  108. package/.enderun/knowledge/performance_guidelines.md +0 -11
  109. package/.enderun/knowledge/repository_patterns.md +0 -9
  110. package/.enderun/knowledge/security_scanning.md +0 -6
  111. package/.enderun/knowledge/testing_standards.md +0 -7
  112. package/.enderun/knowledge/troubleshooting_guide.md +0 -5
  113. package/.enderun/logs/analyst.json +0 -1
  114. package/.enderun/logs/backend.json +0 -1
  115. package/.enderun/logs/devops.json +0 -1
  116. package/.enderun/logs/explorer.json +0 -1
  117. package/.enderun/logs/frontend.json +0 -1
  118. package/.enderun/logs/git.json +0 -1
  119. package/.enderun/logs/manager.json +0 -1
  120. package/.enderun/logs/mobile.json +0 -1
  121. package/.enderun/logs/native.json +0 -1
  122. package/.enderun/logs/orchestrator.json +0 -1
  123. package/.enderun/logs/qa.json +0 -1
  124. package/.enderun/logs/security.json +0 -1
  125. package/.enderun/memory-graph/agent-contexts/analyst.json +0 -1
  126. package/.enderun/memory-graph/agent-contexts/orchestrator.json +0 -1
  127. package/.enderun/memory-graph/agent-contexts/qa.json +0 -1
  128. package/.enderun/memory-graph/agent-contexts/security.json +0 -1
  129. package/.env.example +0 -10
  130. package/cursor.md +0 -19
  131. package/docs/action-plan-2026.md +0 -119
  132. package/docs/roadmap.md +0 -142
  133. package/framework-mcp/README.md +0 -55
  134. package/framework-mcp/dist/schemas.js +0 -84
  135. package/framework-mcp/dist/tools/codebase.js +0 -294
  136. package/framework-mcp/dist/tools/contract.js +0 -197
  137. package/framework-mcp/dist/tools/framework.js +0 -225
  138. package/framework-mcp/dist/tools/git.js +0 -51
  139. package/framework-mcp/dist/tools/governance.js +0 -696
  140. package/framework-mcp/dist/tools/index.js +0 -47
  141. package/framework-mcp/dist/tools/knowledge.js +0 -133
  142. package/framework-mcp/dist/tools/memory.js +0 -217
  143. package/framework-mcp/dist/tools/messages.js +0 -193
  144. package/framework-mcp/dist/tools/monitoring.js +0 -294
  145. package/framework-mcp/dist/tools/orchestration.js +0 -369
  146. package/framework-mcp/dist/tools/pipeline.js +0 -267
  147. package/framework-mcp/dist/tools/security.js +0 -137
  148. package/framework-mcp/dist/utils.js +0 -121
  149. package/framework-mcp/src/index.ts +0 -49
  150. package/framework-mcp/src/schemas.ts +0 -106
  151. package/framework-mcp/src/tools/codebase.ts +0 -284
  152. package/framework-mcp/src/tools/contract.ts +0 -221
  153. package/framework-mcp/src/tools/framework.ts +0 -223
  154. package/framework-mcp/src/tools/git.ts +0 -42
  155. package/framework-mcp/src/tools/governance.ts +0 -891
  156. package/framework-mcp/src/tools/index.ts +0 -50
  157. package/framework-mcp/src/tools/knowledge.ts +0 -141
  158. package/framework-mcp/src/tools/memory.ts +0 -207
  159. package/framework-mcp/src/tools/messages.ts +0 -213
  160. package/framework-mcp/src/tools/monitoring.ts +0 -351
  161. package/framework-mcp/src/tools/orchestration.ts +0 -440
  162. package/framework-mcp/src/tools/pipeline.ts +0 -353
  163. package/framework-mcp/src/tools/security.ts +0 -143
  164. package/framework-mcp/src/utils.ts +0 -130
@@ -1,351 +0,0 @@
1
- import { Tool } from "@modelcontextprotocol/sdk/types.js";
2
- import { promises as fs } from "fs";
3
- import path from "path";
4
- import { getFrameworkDir } from "../utils.js";
5
-
6
- // ─── Tool Definitions ─────────────────────────────────────────────────────────
7
-
8
- export const monitoringTools: Tool[] = [
9
- {
10
- name: "get_army_health_dashboard",
11
- description:
12
- "Returns a comprehensive health dashboard for the entire Agent Enderun Army. Includes agent states, active tasks, health scores, queue depth, and recent blockages. Single call for full army situational awareness.",
13
- inputSchema: {
14
- type: "object",
15
- properties: {
16
- projectRoot: { type: "string", description: "Root directory of the project" },
17
- },
18
- required: [],
19
- },
20
- },
21
- {
22
- name: "calculate_agent_performance_score",
23
- description:
24
- "Calculates a dynamic performance score for a specific agent based on their last N actions from the audit log. Returns success rate, average execution time, and blockage frequency.",
25
- inputSchema: {
26
- type: "object",
27
- properties: {
28
- agentName: { type: "string", description: "Agent identifier (e.g. @backend)" },
29
- lastN: { type: "number", description: "Number of recent actions to analyze", default: 20 },
30
- },
31
- required: ["agentName"],
32
- },
33
- },
34
- {
35
- name: "detect_bottleneck_agents",
36
- description:
37
- "Scans all agent logs and STATUS.md to identify agents that are causing delays — either by being BLOCKED, exceeding execution timeout, or having a high blockage frequency. Returns a prioritized list of bottlenecks.",
38
- inputSchema: {
39
- type: "object",
40
- properties: {
41
- thresholdMinutes: {
42
- type: "number",
43
- description: "Minutes after which an EXECUTING agent is considered a bottleneck",
44
- default: 30,
45
- },
46
- },
47
- required: [],
48
- },
49
- },
50
- {
51
- name: "generate_war_room_report",
52
- description:
53
- "Generates a crisis-mode summary report for @manager. Includes: all BLOCKED/ERROR agents, unresolved dependencies, critical path analysis, and recommended immediate actions. Designed for high-urgency situations.",
54
- inputSchema: {
55
- type: "object",
56
- properties: {
57
- traceId: { type: "string", description: "Active Trace ID for the crisis" },
58
- crisisDescription: { type: "string", description: "Brief description of the crisis or incident" },
59
- },
60
- required: ["traceId", "crisisDescription"],
61
- },
62
- },
63
- ];
64
-
65
- // ─── Handlers ─────────────────────────────────────────────────────────────────
66
-
67
- export const monitoringHandlers: Record<
68
- string,
69
- (args: unknown, projectRoot: string) => Promise<{ content: Array<{ type: string; text: string }> }>
70
- > = {
71
- async get_army_health_dashboard(_args, projectRoot) {
72
- const results: {
73
- generatedAt: string;
74
- agents: unknown[];
75
- queueDepth: { pending: number; processing: number; completed: number; failed: number };
76
- recentBlockages: unknown[];
77
- recentBroadcasts: unknown[];
78
- overallHealth: string;
79
- } = {
80
- generatedAt: new Date().toISOString(),
81
- agents: [],
82
- queueDepth: { pending: 0, processing: 0, completed: 0, failed: 0 },
83
- recentBlockages: [],
84
- recentBroadcasts: [],
85
- overallHealth: "GREEN",
86
- };
87
-
88
- // Read STATUS.md
89
- const frameworkDir = getFrameworkDir(projectRoot);
90
- const statusPath = path.join(projectRoot, frameworkDir, "STATUS.md");
91
- try {
92
- const statusContent = await fs.readFile(statusPath, "utf-8");
93
- const lines = statusContent
94
- .split("\n")
95
- .filter((l) => l.includes("|") && !l.includes("---") && !l.includes("Agent"));
96
- results.agents = lines
97
- .map((line) => {
98
- const cells = line.split("|").map((c) => c.trim()).filter(Boolean);
99
- return cells.length >= 4
100
- ? {
101
- agent: cells[0],
102
- state: cells[1],
103
- currentTask: cells[2],
104
- blockedBy: cells[3],
105
- healthScore: cells[4] ?? "—",
106
- lastAction: cells[5] ?? "—",
107
- }
108
- : null;
109
- })
110
- .filter(Boolean);
111
- } catch {
112
- results.agents = [{ error: "STATUS.md not found or unreadable" }];
113
- }
114
-
115
- // Read queue depths
116
- const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
117
- for (const subdir of ["pending", "processing", "completed", "failed"] as const) {
118
- try {
119
- const files = await fs.readdir(path.join(queueBase, subdir));
120
- results.queueDepth[subdir] = files.filter((f) => f.endsWith(".json")).length;
121
- } catch {
122
- results.queueDepth[subdir] = 0;
123
- }
124
- }
125
-
126
- // Read orchestrator log for recent blockages and broadcasts
127
- const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
128
- try {
129
- const logContent = await fs.readFile(logPath, "utf-8");
130
- const log = JSON.parse(logContent) as {
131
- blockages?: unknown[];
132
- broadcasts?: unknown[];
133
- };
134
- results.recentBlockages = (log.blockages ?? []).slice(-5);
135
- results.recentBroadcasts = (log.broadcasts ?? []).slice(-3);
136
- } catch {
137
- // No log yet
138
- }
139
-
140
- // Calculate overall health
141
- const blockedCount = (results.agents as Array<{ state?: string }>).filter(
142
- (a) => a?.state?.includes("BLOCKED") || a?.state?.includes("ERROR")
143
- ).length;
144
- if (blockedCount >= 3) results.overallHealth = "RED";
145
- else if (blockedCount >= 1) results.overallHealth = "YELLOW";
146
- else results.overallHealth = "GREEN";
147
-
148
- return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
149
- },
150
-
151
- async calculate_agent_performance_score(args, projectRoot) {
152
- const { agentName, lastN } = args as { agentName: string; lastN?: number };
153
- const n = lastN ?? 20;
154
- const logName = agentName.replace("@", "") + ".json";
155
- const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", logName);
156
-
157
- try {
158
- const content = await fs.readFile(logPath, "utf-8");
159
- const log = JSON.parse(content) as { actions?: Array<{ status?: string; durationMs?: number }> };
160
- const actions = (log.actions ?? []).slice(-n);
161
- const total = actions.length;
162
- const successful = actions.filter((a) => a.status === "SUCCESS" || a.status === "DONE").length;
163
- const successRate = total > 0 ? ((successful / total) * 100).toFixed(1) + "%" : "N/A";
164
- const avgDuration =
165
- total > 0
166
- ? (
167
- actions.reduce((sum, a) => sum + (a.durationMs ?? 0), 0) / total
168
- ).toFixed(0) + "ms"
169
- : "N/A";
170
-
171
- return {
172
- content: [
173
- {
174
- type: "text",
175
- text: JSON.stringify(
176
- {
177
- agent: agentName,
178
- analyzedActions: total,
179
- successRate,
180
- averageExecutionTime: avgDuration,
181
- generatedAt: new Date().toISOString(),
182
- },
183
- null,
184
- 2
185
- ),
186
- },
187
- ],
188
- };
189
- } catch {
190
- return {
191
- content: [
192
- {
193
- type: "text",
194
- text: JSON.stringify({
195
- agent: agentName,
196
- error: "No log found or log is empty",
197
- analyzedActions: 0,
198
- }),
199
- },
200
- ],
201
- };
202
- }
203
- },
204
-
205
- async detect_bottleneck_agents(args, projectRoot) {
206
- const { thresholdMinutes } = args as { thresholdMinutes?: number };
207
- const threshold = thresholdMinutes ?? 30;
208
-
209
- const statusPath = path.join(projectRoot, getFrameworkDir(projectRoot), "STATUS.md");
210
- const bottlenecks: Array<{ agent: string; reason: string; state: string; severity: string }> = [];
211
-
212
- try {
213
- const content = await fs.readFile(statusPath, "utf-8");
214
- const lines = content
215
- .split("\n")
216
- .filter((l) => l.includes("|") && !l.includes("---") && !l.includes("Agent"));
217
-
218
- for (const line of lines) {
219
- const cells = line.split("|").map((c) => c.trim()).filter(Boolean);
220
- if (cells.length < 2) continue;
221
- const [agent, state] = cells;
222
- if (state.includes("BLOCKED")) {
223
- bottlenecks.push({ agent, state, reason: "Agent is in BLOCKED state", severity: "CRITICAL" });
224
- } else if (state.includes("ERROR")) {
225
- bottlenecks.push({ agent, state, reason: "Agent is in ERROR state", severity: "CRITICAL" });
226
- } else if (state.includes("EXECUTING")) {
227
- bottlenecks.push({
228
- agent,
229
- state,
230
- reason: `Agent has been EXECUTING for more than ${threshold} minutes (verify manually)`,
231
- severity: "HIGH",
232
- });
233
- }
234
- }
235
- } catch {
236
- return {
237
- content: [
238
- {
239
- type: "text",
240
- text: JSON.stringify({ error: "Could not read STATUS.md" }),
241
- },
242
- ],
243
- };
244
- }
245
-
246
- return {
247
- content: [
248
- {
249
- type: "text",
250
- text: JSON.stringify(
251
- {
252
- bottlenecks,
253
- total: bottlenecks.length,
254
- analysisThresholdMinutes: threshold,
255
- generatedAt: new Date().toISOString(),
256
- },
257
- null,
258
- 2
259
- ),
260
- },
261
- ],
262
- };
263
- },
264
-
265
- async generate_war_room_report(args, projectRoot) {
266
- const { traceId, crisisDescription } = args as {
267
- traceId: string;
268
- crisisDescription: string;
269
- };
270
-
271
- // Gather all data for the war room report
272
- const report: {
273
- warRoomReport: boolean;
274
- traceId: string;
275
- crisisDescription: string;
276
- generatedAt: string;
277
- agentStatuses: unknown[];
278
- queueSnapshot: unknown;
279
- recentBlockages: unknown[];
280
- immediateActions: string[];
281
- } = {
282
- warRoomReport: true,
283
- traceId,
284
- crisisDescription,
285
- generatedAt: new Date().toISOString(),
286
- agentStatuses: [],
287
- queueSnapshot: {},
288
- recentBlockages: [],
289
- immediateActions: [],
290
- };
291
-
292
- // Agent statuses
293
- const frameworkDir = getFrameworkDir(projectRoot);
294
- const statusPath = path.join(projectRoot, frameworkDir, "STATUS.md");
295
- try {
296
- const content = await fs.readFile(statusPath, "utf-8");
297
- const lines = content
298
- .split("\n")
299
- .filter((l) => l.includes("|") && !l.includes("---") && !l.includes("Agent"));
300
- report.agentStatuses = lines
301
- .map((l) => {
302
- const cells = l.split("|").map((c) => c.trim()).filter(Boolean);
303
- return cells.length >= 2 ? { agent: cells[0], state: cells[1] } : null;
304
- })
305
- .filter(Boolean);
306
- } catch {
307
- report.agentStatuses = [];
308
- }
309
-
310
- // Queue snapshot
311
- const queueBase = path.join(projectRoot, getFrameworkDir(projectRoot), "queue");
312
- const snapshot: Record<string, number> = {};
313
- for (const dir of ["pending", "processing", "completed", "failed"]) {
314
- try {
315
- const files = await fs.readdir(path.join(queueBase, dir));
316
- snapshot[dir] = files.length;
317
- } catch {
318
- snapshot[dir] = 0;
319
- }
320
- }
321
- report.queueSnapshot = snapshot;
322
-
323
- // Recent blockages
324
- const logPath = path.join(projectRoot, getFrameworkDir(projectRoot), "logs", "orchestrator.json");
325
- try {
326
- const logContent = await fs.readFile(logPath, "utf-8");
327
- const log = JSON.parse(logContent) as { blockages?: unknown[] };
328
- report.recentBlockages = (log.blockages ?? []).slice(-10);
329
- } catch {
330
- report.recentBlockages = [];
331
- }
332
-
333
- // Generate recommended immediate actions
334
- const blockedAgents = (report.agentStatuses as Array<{ agent: string; state: string }>).filter(
335
- (a) => a.state.includes("BLOCKED") || a.state.includes("ERROR")
336
- );
337
- if (blockedAgents.length > 0) {
338
- report.immediateActions.push(
339
- `IMMEDIATE: Resolve ${blockedAgents.map((a) => a.agent).join(", ")} blockages — these are on the critical path`
340
- );
341
- }
342
- if ((snapshot["pending"] ?? 0) > 5) {
343
- report.immediateActions.push("HIGH: Queue has excessive pending tasks — consider deploying additional agents");
344
- }
345
- if (report.immediateActions.length === 0) {
346
- report.immediateActions.push("No critical immediate actions required — monitor agent states");
347
- }
348
-
349
- return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
350
- },
351
- };