claude-mpm 4.20.3__py3-none-any.whl → 5.1.8__py3-none-any.whl

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.

Potentially problematic release.


This version of claude-mpm might be problematic. Click here for more details.

Files changed (520) hide show
  1. claude_mpm/VERSION +1 -1
  2. claude_mpm/agents/BASE_PM.md +35 -6
  3. claude_mpm/agents/OUTPUT_STYLE.md +3 -48
  4. claude_mpm/agents/PM_INSTRUCTIONS.md +1241 -667
  5. claude_mpm/agents/PM_INSTRUCTIONS_TEACH.md +1322 -0
  6. claude_mpm/agents/WORKFLOW.md +75 -2
  7. claude_mpm/agents/__init__.py +6 -0
  8. claude_mpm/agents/agent_loader.py +1 -4
  9. claude_mpm/agents/base_agent.json +6 -3
  10. claude_mpm/agents/base_agent_loader.py +10 -35
  11. claude_mpm/agents/frontmatter_validator.py +1 -1
  12. claude_mpm/agents/templates/circuit-breakers.md +1254 -0
  13. claude_mpm/agents/templates/context-management-examples.md +544 -0
  14. claude_mpm/agents/templates/{pm_red_flags.md → pm-red-flags.md} +89 -19
  15. claude_mpm/agents/templates/pr-workflow-examples.md +427 -0
  16. claude_mpm/agents/templates/research-gate-examples.md +669 -0
  17. claude_mpm/agents/templates/structured-questions-examples.md +615 -0
  18. claude_mpm/agents/templates/ticket-completeness-examples.md +139 -0
  19. claude_mpm/agents/templates/ticketing-examples.md +277 -0
  20. claude_mpm/cli/__init__.py +37 -2
  21. claude_mpm/cli/commands/__init__.py +2 -0
  22. claude_mpm/cli/commands/agent_source.py +774 -0
  23. claude_mpm/cli/commands/agent_state_manager.py +188 -30
  24. claude_mpm/cli/commands/agents.py +959 -36
  25. claude_mpm/cli/commands/agents_cleanup.py +210 -0
  26. claude_mpm/cli/commands/agents_discover.py +338 -0
  27. claude_mpm/cli/commands/aggregate.py +1 -1
  28. claude_mpm/cli/commands/analyze.py +3 -3
  29. claude_mpm/cli/commands/auto_configure.py +537 -239
  30. claude_mpm/cli/commands/cleanup.py +1 -1
  31. claude_mpm/cli/commands/config.py +7 -4
  32. claude_mpm/cli/commands/configure.py +924 -45
  33. claude_mpm/cli/commands/configure_agent_display.py +4 -4
  34. claude_mpm/cli/commands/configure_navigation.py +63 -46
  35. claude_mpm/cli/commands/debug.py +12 -12
  36. claude_mpm/cli/commands/doctor.py +10 -2
  37. claude_mpm/cli/commands/hook_errors.py +277 -0
  38. claude_mpm/cli/commands/local_deploy.py +1 -4
  39. claude_mpm/cli/commands/mcp_install_commands.py +1 -1
  40. claude_mpm/cli/commands/mpm_init/__init__.py +73 -0
  41. claude_mpm/cli/commands/mpm_init/core.py +573 -0
  42. claude_mpm/cli/commands/mpm_init/display.py +341 -0
  43. claude_mpm/cli/commands/mpm_init/git_activity.py +427 -0
  44. claude_mpm/cli/commands/mpm_init/modes.py +397 -0
  45. claude_mpm/cli/commands/mpm_init/prompts.py +442 -0
  46. claude_mpm/cli/commands/mpm_init_cli.py +396 -0
  47. claude_mpm/cli/commands/mpm_init_handler.py +67 -1
  48. claude_mpm/cli/commands/postmortem.py +401 -0
  49. claude_mpm/cli/commands/run.py +125 -167
  50. claude_mpm/cli/commands/skill_source.py +694 -0
  51. claude_mpm/cli/commands/skills.py +835 -44
  52. claude_mpm/cli/executor.py +78 -3
  53. claude_mpm/cli/interactive/agent_wizard.py +1032 -47
  54. claude_mpm/cli/parsers/agent_source_parser.py +171 -0
  55. claude_mpm/cli/parsers/agents_parser.py +256 -4
  56. claude_mpm/cli/parsers/auto_configure_parser.py +13 -0
  57. claude_mpm/cli/parsers/base_parser.py +53 -0
  58. claude_mpm/cli/parsers/config_parser.py +96 -43
  59. claude_mpm/cli/parsers/mpm_init_parser.py +42 -0
  60. claude_mpm/cli/parsers/skill_source_parser.py +169 -0
  61. claude_mpm/cli/parsers/skills_parser.py +145 -0
  62. claude_mpm/cli/parsers/source_parser.py +138 -0
  63. claude_mpm/cli/startup.py +564 -108
  64. claude_mpm/cli/startup_display.py +480 -0
  65. claude_mpm/cli/utils.py +1 -1
  66. claude_mpm/cli_module/commands.py +1 -1
  67. claude_mpm/commands/{mpm-auto-configure.md → mpm-agents-auto-configure.md} +9 -0
  68. claude_mpm/commands/mpm-agents-detect.md +9 -0
  69. claude_mpm/commands/{mpm-agents.md → mpm-agents-list.md} +9 -0
  70. claude_mpm/commands/mpm-agents-recommend.md +9 -0
  71. claude_mpm/commands/{mpm-config.md → mpm-config-view.md} +9 -0
  72. claude_mpm/commands/mpm-doctor.md +9 -0
  73. claude_mpm/commands/mpm-help.md +17 -2
  74. claude_mpm/commands/mpm-init.md +28 -3
  75. claude_mpm/commands/mpm-monitor.md +9 -0
  76. claude_mpm/commands/mpm-postmortem.md +123 -0
  77. claude_mpm/commands/mpm-session-resume.md +381 -0
  78. claude_mpm/commands/mpm-status.md +9 -0
  79. claude_mpm/commands/{mpm-organize.md → mpm-ticket-organize.md} +9 -0
  80. claude_mpm/commands/mpm-ticket-view.md +552 -0
  81. claude_mpm/commands/mpm-version.md +9 -0
  82. claude_mpm/commands/mpm.md +11 -0
  83. claude_mpm/config/agent_presets.py +488 -0
  84. claude_mpm/config/agent_sources.py +325 -0
  85. claude_mpm/config/skill_presets.py +392 -0
  86. claude_mpm/config/skill_sources.py +590 -0
  87. claude_mpm/constants.py +13 -0
  88. claude_mpm/core/api_validator.py +1 -1
  89. claude_mpm/core/claude_runner.py +19 -35
  90. claude_mpm/core/config.py +24 -0
  91. claude_mpm/core/constants.py +1 -1
  92. claude_mpm/core/framework/__init__.py +3 -16
  93. claude_mpm/core/framework/loaders/file_loader.py +54 -101
  94. claude_mpm/core/framework/loaders/instruction_loader.py +25 -5
  95. claude_mpm/core/framework/processors/metadata_processor.py +1 -1
  96. claude_mpm/core/hook_error_memory.py +381 -0
  97. claude_mpm/core/hook_manager.py +41 -2
  98. claude_mpm/core/interactive_session.py +131 -10
  99. claude_mpm/core/interfaces.py +56 -1
  100. claude_mpm/core/logger.py +3 -1
  101. claude_mpm/core/oneshot_session.py +110 -8
  102. claude_mpm/core/protocols/__init__.py +23 -0
  103. claude_mpm/core/protocols/runner_protocol.py +103 -0
  104. claude_mpm/core/protocols/session_protocol.py +131 -0
  105. claude_mpm/core/shared/singleton_manager.py +11 -4
  106. claude_mpm/core/system_context.py +38 -0
  107. claude_mpm/core/unified_config.py +22 -0
  108. claude_mpm/dashboard/static/css/activity.css +69 -69
  109. claude_mpm/dashboard/static/css/connection-status.css +10 -10
  110. claude_mpm/dashboard/static/css/dashboard.css +15 -15
  111. claude_mpm/dashboard/static/js/components/activity-tree.js +178 -178
  112. claude_mpm/dashboard/static/js/components/agent-hierarchy.js +101 -101
  113. claude_mpm/dashboard/static/js/components/agent-inference.js +31 -31
  114. claude_mpm/dashboard/static/js/components/build-tracker.js +59 -59
  115. claude_mpm/dashboard/static/js/components/code-simple.js +107 -107
  116. claude_mpm/dashboard/static/js/components/connection-debug.js +101 -101
  117. claude_mpm/dashboard/static/js/components/diff-viewer.js +113 -113
  118. claude_mpm/dashboard/static/js/components/event-viewer.js +12 -12
  119. claude_mpm/dashboard/static/js/components/file-change-tracker.js +57 -57
  120. claude_mpm/dashboard/static/js/components/file-change-viewer.js +74 -74
  121. claude_mpm/dashboard/static/js/components/file-tool-tracker.js +6 -6
  122. claude_mpm/dashboard/static/js/components/file-viewer.js +42 -42
  123. claude_mpm/dashboard/static/js/components/module-viewer.js +27 -27
  124. claude_mpm/dashboard/static/js/components/session-manager.js +14 -14
  125. claude_mpm/dashboard/static/js/components/socket-manager.js +1 -1
  126. claude_mpm/dashboard/static/js/components/ui-state-manager.js +14 -14
  127. claude_mpm/dashboard/static/js/components/unified-data-viewer.js +110 -110
  128. claude_mpm/dashboard/static/js/components/working-directory.js +8 -8
  129. claude_mpm/dashboard/static/js/connection-manager.js +76 -76
  130. claude_mpm/dashboard/static/js/dashboard.js +76 -58
  131. claude_mpm/dashboard/static/js/extension-error-handler.js +22 -22
  132. claude_mpm/dashboard/static/js/socket-client.js +138 -121
  133. claude_mpm/dashboard/templates/code_simple.html +23 -23
  134. claude_mpm/dashboard/templates/index.html +18 -18
  135. claude_mpm/experimental/cli_enhancements.py +1 -5
  136. claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  137. claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-313.pyc +0 -0
  138. claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-313.pyc +0 -0
  139. claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-313.pyc +0 -0
  140. claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-313.pyc +0 -0
  141. claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-313.pyc +0 -0
  142. claude_mpm/hooks/claude_hooks/event_handlers.py +3 -1
  143. claude_mpm/hooks/claude_hooks/hook_handler.py +24 -7
  144. claude_mpm/hooks/claude_hooks/installer.py +45 -0
  145. claude_mpm/hooks/claude_hooks/memory_integration.py +12 -1
  146. claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-313.pyc +0 -0
  147. claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-313.pyc +0 -0
  148. claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-313.pyc +0 -0
  149. claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-313.pyc +0 -0
  150. claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-313.pyc +0 -0
  151. claude_mpm/hooks/failure_learning/__init__.py +2 -8
  152. claude_mpm/hooks/failure_learning/failure_detection_hook.py +1 -6
  153. claude_mpm/hooks/failure_learning/fix_detection_hook.py +1 -6
  154. claude_mpm/hooks/failure_learning/learning_extraction_hook.py +1 -6
  155. claude_mpm/hooks/kuzu_response_hook.py +1 -5
  156. claude_mpm/hooks/templates/pre_tool_use_simple.py +78 -0
  157. claude_mpm/hooks/templates/pre_tool_use_template.py +323 -0
  158. claude_mpm/models/git_repository.py +198 -0
  159. claude_mpm/scripts/claude-hook-handler.sh +3 -3
  160. claude_mpm/scripts/start_activity_logging.py +3 -1
  161. claude_mpm/services/agents/agent_builder.py +45 -9
  162. claude_mpm/services/agents/agent_preset_service.py +238 -0
  163. claude_mpm/services/agents/agent_selection_service.py +484 -0
  164. claude_mpm/services/agents/auto_deploy_index_parser.py +569 -0
  165. claude_mpm/services/agents/cache_git_manager.py +621 -0
  166. claude_mpm/services/agents/deployment/agent_deployment.py +126 -2
  167. claude_mpm/services/agents/deployment/agent_discovery_service.py +105 -73
  168. claude_mpm/services/agents/deployment/agent_format_converter.py +1 -1
  169. claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +1 -5
  170. claude_mpm/services/agents/deployment/agent_metrics_collector.py +3 -3
  171. claude_mpm/services/agents/deployment/agent_restore_handler.py +1 -4
  172. claude_mpm/services/agents/deployment/agent_template_builder.py +236 -15
  173. claude_mpm/services/agents/deployment/agents_directory_resolver.py +101 -15
  174. claude_mpm/services/agents/deployment/async_agent_deployment.py +2 -1
  175. claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -3
  176. claude_mpm/services/agents/deployment/multi_source_deployment_service.py +115 -15
  177. claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +2 -2
  178. claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +1 -4
  179. claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +363 -0
  180. claude_mpm/services/agents/deployment/single_agent_deployer.py +2 -2
  181. claude_mpm/services/agents/deployment/system_instructions_deployer.py +168 -46
  182. claude_mpm/services/agents/deployment/validation/deployment_validator.py +2 -2
  183. claude_mpm/services/agents/git_source_manager.py +629 -0
  184. claude_mpm/services/agents/loading/framework_agent_loader.py +9 -12
  185. claude_mpm/services/agents/local_template_manager.py +50 -10
  186. claude_mpm/services/agents/single_tier_deployment_service.py +696 -0
  187. claude_mpm/services/agents/sources/__init__.py +13 -0
  188. claude_mpm/services/agents/sources/agent_sync_state.py +516 -0
  189. claude_mpm/services/agents/sources/git_source_sync_service.py +1087 -0
  190. claude_mpm/services/agents/startup_sync.py +239 -0
  191. claude_mpm/services/agents/toolchain_detector.py +474 -0
  192. claude_mpm/services/analysis/__init__.py +25 -0
  193. claude_mpm/services/analysis/postmortem_reporter.py +474 -0
  194. claude_mpm/services/analysis/postmortem_service.py +765 -0
  195. claude_mpm/services/cli/session_pause_manager.py +504 -0
  196. claude_mpm/services/cli/session_resume_helper.py +36 -16
  197. claude_mpm/services/cli/unified_dashboard_manager.py +1 -1
  198. claude_mpm/services/command_deployment_service.py +200 -6
  199. claude_mpm/services/core/base.py +31 -11
  200. claude_mpm/services/core/interfaces/__init__.py +1 -3
  201. claude_mpm/services/core/interfaces/health.py +1 -4
  202. claude_mpm/services/core/interfaces.py +56 -1
  203. claude_mpm/services/core/models/__init__.py +2 -11
  204. claude_mpm/services/core/models/agent_config.py +3 -0
  205. claude_mpm/services/core/models/process.py +4 -0
  206. claude_mpm/services/diagnostics/checks/__init__.py +4 -0
  207. claude_mpm/services/diagnostics/checks/agent_check.py +0 -2
  208. claude_mpm/services/diagnostics/checks/agent_sources_check.py +577 -0
  209. claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
  210. claude_mpm/services/diagnostics/checks/mcp_check.py +0 -1
  211. claude_mpm/services/diagnostics/checks/mcp_services_check.py +7 -15
  212. claude_mpm/services/diagnostics/checks/monitor_check.py +0 -1
  213. claude_mpm/services/diagnostics/checks/skill_sources_check.py +587 -0
  214. claude_mpm/services/diagnostics/diagnostic_runner.py +9 -0
  215. claude_mpm/services/diagnostics/doctor_reporter.py +40 -10
  216. claude_mpm/services/diagnostics/models.py +21 -0
  217. claude_mpm/services/event_bus/direct_relay.py +3 -3
  218. claude_mpm/services/event_bus/event_bus.py +36 -3
  219. claude_mpm/services/event_bus/relay.py +23 -7
  220. claude_mpm/services/events/consumers/logging.py +1 -2
  221. claude_mpm/services/git/__init__.py +21 -0
  222. claude_mpm/services/git/git_operations_service.py +494 -0
  223. claude_mpm/services/github/__init__.py +21 -0
  224. claude_mpm/services/github/github_cli_service.py +397 -0
  225. claude_mpm/services/infrastructure/monitoring/__init__.py +1 -5
  226. claude_mpm/services/infrastructure/monitoring/aggregator.py +1 -6
  227. claude_mpm/services/infrastructure/monitoring/resources.py +1 -1
  228. claude_mpm/services/instructions/__init__.py +9 -0
  229. claude_mpm/services/instructions/instruction_cache_service.py +374 -0
  230. claude_mpm/services/local_ops/__init__.py +5 -13
  231. claude_mpm/services/local_ops/health_checks/__init__.py +1 -3
  232. claude_mpm/services/local_ops/health_manager.py +1 -4
  233. claude_mpm/services/local_ops/process_manager.py +1 -1
  234. claude_mpm/services/local_ops/resource_monitor.py +2 -2
  235. claude_mpm/services/mcp_config_manager.py +75 -145
  236. claude_mpm/services/mcp_gateway/auto_configure.py +31 -25
  237. claude_mpm/services/mcp_gateway/config/configuration.py +1 -1
  238. claude_mpm/services/mcp_gateway/core/process_pool.py +41 -26
  239. claude_mpm/services/mcp_gateway/server/mcp_gateway.py +1 -6
  240. claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -2
  241. claude_mpm/services/mcp_gateway/tools/document_summarizer.py +1 -1
  242. claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +26 -21
  243. claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +6 -2
  244. claude_mpm/services/mcp_service_verifier.py +6 -3
  245. claude_mpm/services/memory/failure_tracker.py +19 -4
  246. claude_mpm/services/memory/optimizer.py +1 -1
  247. claude_mpm/services/model/model_router.py +8 -9
  248. claude_mpm/services/monitor/daemon.py +29 -9
  249. claude_mpm/services/monitor/daemon_manager.py +96 -19
  250. claude_mpm/services/monitor/server.py +2 -2
  251. claude_mpm/services/native_agent_converter.py +356 -0
  252. claude_mpm/services/port_manager.py +1 -1
  253. claude_mpm/services/pr/__init__.py +14 -0
  254. claude_mpm/services/pr/pr_template_service.py +329 -0
  255. claude_mpm/services/project/documentation_manager.py +2 -1
  256. claude_mpm/services/project/project_organizer.py +4 -0
  257. claude_mpm/services/project/toolchain_analyzer.py +3 -1
  258. claude_mpm/services/runner_configuration_service.py +17 -3
  259. claude_mpm/services/self_upgrade_service.py +165 -7
  260. claude_mpm/services/session_management_service.py +16 -4
  261. claude_mpm/services/skills/__init__.py +18 -0
  262. claude_mpm/services/skills/git_skill_source_manager.py +1169 -0
  263. claude_mpm/services/skills/skill_discovery_service.py +568 -0
  264. claude_mpm/services/skills_config.py +547 -0
  265. claude_mpm/services/skills_deployer.py +955 -0
  266. claude_mpm/services/socketio/handlers/connection.py +1 -1
  267. claude_mpm/services/socketio/handlers/git.py +2 -2
  268. claude_mpm/services/socketio/server/core.py +1 -4
  269. claude_mpm/services/socketio/server/main.py +1 -3
  270. claude_mpm/services/system_instructions_service.py +1 -3
  271. claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +0 -3
  272. claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +0 -1
  273. claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +1 -1
  274. claude_mpm/services/unified/deployment_strategies/vercel.py +1 -5
  275. claude_mpm/services/unified/unified_deployment.py +1 -5
  276. claude_mpm/services/version_control/conflict_resolution.py +6 -4
  277. claude_mpm/services/visualization/__init__.py +1 -5
  278. claude_mpm/services/visualization/mermaid_generator.py +2 -3
  279. claude_mpm/skills/__init__.py +3 -3
  280. claude_mpm/skills/agent_skills_injector.py +42 -49
  281. claude_mpm/skills/bundled/infrastructure/env-manager/scripts/validate_env.py +576 -0
  282. claude_mpm/skills/bundled/main/mcp-builder/scripts/connections.py +17 -10
  283. claude_mpm/skills/bundled/main/mcp-builder/scripts/evaluation.py +92 -39
  284. claude_mpm/skills/bundled/main/skill-creator/scripts/init_skill.py +13 -12
  285. claude_mpm/skills/bundled/main/skill-creator/scripts/package_skill.py +5 -3
  286. claude_mpm/skills/bundled/main/skill-creator/scripts/quick_validate.py +19 -12
  287. claude_mpm/skills/bundled/performance-profiling.md +6 -0
  288. claude_mpm/skills/bundled/testing/webapp-testing/examples/console_logging.py +6 -6
  289. claude_mpm/skills/bundled/testing/webapp-testing/examples/element_discovery.py +13 -9
  290. claude_mpm/skills/bundled/testing/webapp-testing/examples/static_html_automation.py +8 -8
  291. claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +37 -15
  292. claude_mpm/skills/skills_registry.py +44 -48
  293. claude_mpm/skills/skills_service.py +117 -108
  294. claude_mpm/templates/questions/__init__.py +38 -0
  295. claude_mpm/templates/questions/base.py +193 -0
  296. claude_mpm/templates/questions/pr_strategy.py +311 -0
  297. claude_mpm/templates/questions/project_init.py +385 -0
  298. claude_mpm/templates/questions/ticket_mgmt.py +394 -0
  299. claude_mpm/tools/__main__.py +8 -8
  300. claude_mpm/tools/code_tree_analyzer/__init__.py +45 -0
  301. claude_mpm/tools/code_tree_analyzer/analysis.py +299 -0
  302. claude_mpm/tools/code_tree_analyzer/cache.py +131 -0
  303. claude_mpm/tools/code_tree_analyzer/core.py +380 -0
  304. claude_mpm/tools/code_tree_analyzer/discovery.py +403 -0
  305. claude_mpm/tools/code_tree_analyzer/events.py +168 -0
  306. claude_mpm/tools/code_tree_analyzer/gitignore.py +308 -0
  307. claude_mpm/tools/code_tree_analyzer/models.py +39 -0
  308. claude_mpm/tools/code_tree_analyzer/multilang_analyzer.py +224 -0
  309. claude_mpm/tools/code_tree_analyzer/python_analyzer.py +284 -0
  310. claude_mpm/utils/agent_dependency_loader.py +80 -13
  311. claude_mpm/utils/agent_filters.py +288 -0
  312. claude_mpm/utils/dependency_cache.py +3 -1
  313. claude_mpm/utils/gitignore.py +244 -0
  314. claude_mpm/utils/log_cleanup.py +3 -3
  315. claude_mpm/utils/migration.py +372 -0
  316. claude_mpm/utils/progress.py +387 -0
  317. claude_mpm/utils/robust_installer.py +3 -5
  318. claude_mpm/utils/structured_questions.py +619 -0
  319. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/METADATA +496 -65
  320. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/RECORD +328 -416
  321. claude_mpm/agents/templates/.claude-mpm/memories/README.md +0 -17
  322. claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +0 -3
  323. claude_mpm/agents/templates/agent-manager.json +0 -273
  324. claude_mpm/agents/templates/agentic-coder-optimizer.json +0 -248
  325. claude_mpm/agents/templates/api_qa.json +0 -180
  326. claude_mpm/agents/templates/circuit_breakers.md +0 -638
  327. claude_mpm/agents/templates/clerk-ops.json +0 -235
  328. claude_mpm/agents/templates/code_analyzer.json +0 -101
  329. claude_mpm/agents/templates/content-agent.json +0 -358
  330. claude_mpm/agents/templates/dart_engineer.json +0 -307
  331. claude_mpm/agents/templates/data_engineer.json +0 -225
  332. claude_mpm/agents/templates/documentation.json +0 -211
  333. claude_mpm/agents/templates/engineer.json +0 -210
  334. claude_mpm/agents/templates/gcp_ops_agent.json +0 -253
  335. claude_mpm/agents/templates/golang_engineer.json +0 -270
  336. claude_mpm/agents/templates/imagemagick.json +0 -264
  337. claude_mpm/agents/templates/java_engineer.json +0 -346
  338. claude_mpm/agents/templates/local_ops_agent.json +0 -1840
  339. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +0 -39
  340. claude_mpm/agents/templates/logs/prompts/agent_engineer_20250901_010124_142.md +0 -400
  341. claude_mpm/agents/templates/memory_manager.json +0 -158
  342. claude_mpm/agents/templates/nextjs_engineer.json +0 -285
  343. claude_mpm/agents/templates/ops.json +0 -185
  344. claude_mpm/agents/templates/php-engineer.json +0 -281
  345. claude_mpm/agents/templates/product_owner.json +0 -338
  346. claude_mpm/agents/templates/project_organizer.json +0 -140
  347. claude_mpm/agents/templates/prompt-engineer.json +0 -737
  348. claude_mpm/agents/templates/python_engineer.json +0 -387
  349. claude_mpm/agents/templates/qa.json +0 -242
  350. claude_mpm/agents/templates/react_engineer.json +0 -238
  351. claude_mpm/agents/templates/refactoring_engineer.json +0 -276
  352. claude_mpm/agents/templates/research.json +0 -188
  353. claude_mpm/agents/templates/ruby-engineer.json +0 -280
  354. claude_mpm/agents/templates/rust_engineer.json +0 -275
  355. claude_mpm/agents/templates/security.json +0 -202
  356. claude_mpm/agents/templates/svelte-engineer.json +0 -225
  357. claude_mpm/agents/templates/ticketing.json +0 -177
  358. claude_mpm/agents/templates/typescript_engineer.json +0 -285
  359. claude_mpm/agents/templates/vercel_ops_agent.json +0 -412
  360. claude_mpm/agents/templates/version_control.json +0 -157
  361. claude_mpm/agents/templates/web_qa.json +0 -399
  362. claude_mpm/agents/templates/web_ui.json +0 -189
  363. claude_mpm/cli/commands/mpm_init.py +0 -2093
  364. claude_mpm/commands/mpm-tickets.md +0 -102
  365. claude_mpm/dashboard/.claude-mpm/socketio-instances.json +0 -1
  366. claude_mpm/dashboard/react/components/DataInspector/DataInspector.module.css +0 -188
  367. claude_mpm/dashboard/react/components/EventViewer/EventViewer.module.css +0 -156
  368. claude_mpm/dashboard/react/components/shared/ConnectionStatus.module.css +0 -38
  369. claude_mpm/dashboard/react/components/shared/FilterBar.module.css +0 -92
  370. claude_mpm/dashboard/static/archive/activity_dashboard_fixed.html +0 -248
  371. claude_mpm/dashboard/static/archive/activity_dashboard_test.html +0 -61
  372. claude_mpm/dashboard/static/archive/test_activity_connection.html +0 -179
  373. claude_mpm/dashboard/static/archive/test_claude_tree_tab.html +0 -68
  374. claude_mpm/dashboard/static/archive/test_dashboard.html +0 -409
  375. claude_mpm/dashboard/static/archive/test_dashboard_fixed.html +0 -519
  376. claude_mpm/dashboard/static/archive/test_dashboard_verification.html +0 -181
  377. claude_mpm/dashboard/static/archive/test_file_data.html +0 -315
  378. claude_mpm/dashboard/static/archive/test_file_tree_empty_state.html +0 -243
  379. claude_mpm/dashboard/static/archive/test_file_tree_fix.html +0 -234
  380. claude_mpm/dashboard/static/archive/test_file_tree_rename.html +0 -117
  381. claude_mpm/dashboard/static/archive/test_file_tree_tab.html +0 -115
  382. claude_mpm/dashboard/static/archive/test_file_viewer.html +0 -224
  383. claude_mpm/dashboard/static/archive/test_final_activity.html +0 -220
  384. claude_mpm/dashboard/static/archive/test_tab_fix.html +0 -139
  385. claude_mpm/dashboard/static/built/assets/events.DjpNxWNo.css +0 -1
  386. claude_mpm/dashboard/static/built/components/activity-tree.js +0 -2
  387. claude_mpm/dashboard/static/built/components/agent-hierarchy.js +0 -777
  388. claude_mpm/dashboard/static/built/components/agent-inference.js +0 -2
  389. claude_mpm/dashboard/static/built/components/build-tracker.js +0 -333
  390. claude_mpm/dashboard/static/built/components/code-simple.js +0 -857
  391. claude_mpm/dashboard/static/built/components/code-tree/tree-breadcrumb.js +0 -353
  392. claude_mpm/dashboard/static/built/components/code-tree/tree-constants.js +0 -235
  393. claude_mpm/dashboard/static/built/components/code-tree/tree-search.js +0 -409
  394. claude_mpm/dashboard/static/built/components/code-tree/tree-utils.js +0 -435
  395. claude_mpm/dashboard/static/built/components/code-tree.js +0 -2
  396. claude_mpm/dashboard/static/built/components/code-viewer.js +0 -2
  397. claude_mpm/dashboard/static/built/components/connection-debug.js +0 -654
  398. claude_mpm/dashboard/static/built/components/diff-viewer.js +0 -891
  399. claude_mpm/dashboard/static/built/components/event-processor.js +0 -2
  400. claude_mpm/dashboard/static/built/components/event-viewer.js +0 -2
  401. claude_mpm/dashboard/static/built/components/export-manager.js +0 -2
  402. claude_mpm/dashboard/static/built/components/file-change-tracker.js +0 -443
  403. claude_mpm/dashboard/static/built/components/file-change-viewer.js +0 -690
  404. claude_mpm/dashboard/static/built/components/file-tool-tracker.js +0 -2
  405. claude_mpm/dashboard/static/built/components/file-viewer.js +0 -2
  406. claude_mpm/dashboard/static/built/components/hud-library-loader.js +0 -2
  407. claude_mpm/dashboard/static/built/components/hud-manager.js +0 -2
  408. claude_mpm/dashboard/static/built/components/hud-visualizer.js +0 -2
  409. claude_mpm/dashboard/static/built/components/module-viewer.js +0 -2
  410. claude_mpm/dashboard/static/built/components/nav-bar.js +0 -145
  411. claude_mpm/dashboard/static/built/components/page-structure.js +0 -429
  412. claude_mpm/dashboard/static/built/components/session-manager.js +0 -2
  413. claude_mpm/dashboard/static/built/components/socket-manager.js +0 -2
  414. claude_mpm/dashboard/static/built/components/ui-state-manager.js +0 -2
  415. claude_mpm/dashboard/static/built/components/unified-data-viewer.js +0 -2
  416. claude_mpm/dashboard/static/built/components/working-directory.js +0 -2
  417. claude_mpm/dashboard/static/built/connection-manager.js +0 -536
  418. claude_mpm/dashboard/static/built/dashboard.js +0 -2
  419. claude_mpm/dashboard/static/built/extension-error-handler.js +0 -164
  420. claude_mpm/dashboard/static/built/react/events.js +0 -30
  421. claude_mpm/dashboard/static/built/shared/dom-helpers.js +0 -396
  422. claude_mpm/dashboard/static/built/shared/event-bus.js +0 -330
  423. claude_mpm/dashboard/static/built/shared/event-filter-service.js +0 -540
  424. claude_mpm/dashboard/static/built/shared/logger.js +0 -385
  425. claude_mpm/dashboard/static/built/shared/page-structure.js +0 -249
  426. claude_mpm/dashboard/static/built/shared/tooltip-service.js +0 -253
  427. claude_mpm/dashboard/static/built/socket-client.js +0 -2
  428. claude_mpm/dashboard/static/built/tab-isolation-fix.js +0 -185
  429. claude_mpm/dashboard/static/dist/assets/events.DjpNxWNo.css +0 -1
  430. claude_mpm/dashboard/static/dist/components/activity-tree.js +0 -2
  431. claude_mpm/dashboard/static/dist/components/agent-inference.js +0 -2
  432. claude_mpm/dashboard/static/dist/components/code-tree.js +0 -2
  433. claude_mpm/dashboard/static/dist/components/code-viewer.js +0 -2
  434. claude_mpm/dashboard/static/dist/components/event-processor.js +0 -2
  435. claude_mpm/dashboard/static/dist/components/event-viewer.js +0 -2
  436. claude_mpm/dashboard/static/dist/components/export-manager.js +0 -2
  437. claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +0 -2
  438. claude_mpm/dashboard/static/dist/components/file-viewer.js +0 -2
  439. claude_mpm/dashboard/static/dist/components/hud-library-loader.js +0 -2
  440. claude_mpm/dashboard/static/dist/components/hud-manager.js +0 -2
  441. claude_mpm/dashboard/static/dist/components/hud-visualizer.js +0 -2
  442. claude_mpm/dashboard/static/dist/components/module-viewer.js +0 -2
  443. claude_mpm/dashboard/static/dist/components/session-manager.js +0 -2
  444. claude_mpm/dashboard/static/dist/components/socket-manager.js +0 -2
  445. claude_mpm/dashboard/static/dist/components/ui-state-manager.js +0 -2
  446. claude_mpm/dashboard/static/dist/components/unified-data-viewer.js +0 -2
  447. claude_mpm/dashboard/static/dist/components/working-directory.js +0 -2
  448. claude_mpm/dashboard/static/dist/dashboard.js +0 -2
  449. claude_mpm/dashboard/static/dist/react/events.js +0 -30
  450. claude_mpm/dashboard/static/dist/socket-client.js +0 -2
  451. claude_mpm/dashboard/static/events.html +0 -607
  452. claude_mpm/dashboard/static/index.html +0 -635
  453. claude_mpm/dashboard/static/js/shared/dom-helpers.js +0 -396
  454. claude_mpm/dashboard/static/js/shared/event-bus.js +0 -330
  455. claude_mpm/dashboard/static/js/shared/logger.js +0 -385
  456. claude_mpm/dashboard/static/js/shared/tooltip-service.js +0 -253
  457. claude_mpm/dashboard/static/js/stores/dashboard-store.js +0 -562
  458. claude_mpm/dashboard/static/legacy/activity.html +0 -736
  459. claude_mpm/dashboard/static/legacy/agents.html +0 -786
  460. claude_mpm/dashboard/static/legacy/files.html +0 -747
  461. claude_mpm/dashboard/static/legacy/tools.html +0 -831
  462. claude_mpm/dashboard/static/monitors.html +0 -431
  463. claude_mpm/dashboard/static/production/events.html +0 -659
  464. claude_mpm/dashboard/static/production/main.html +0 -698
  465. claude_mpm/dashboard/static/production/monitors.html +0 -483
  466. claude_mpm/dashboard/static/test-archive/dashboard.html +0 -635
  467. claude_mpm/dashboard/static/test-archive/debug-events.html +0 -147
  468. claude_mpm/dashboard/static/test-archive/test-navigation.html +0 -256
  469. claude_mpm/dashboard/static/test-archive/test-react-exports.html +0 -180
  470. claude_mpm/dashboard/static/test-archive/test_debug.html +0 -25
  471. claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +0 -75
  472. claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +0 -184
  473. claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +0 -107
  474. claude_mpm/skills/bundled/collaboration/requesting-code-review/code-reviewer.md +0 -146
  475. claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +0 -118
  476. claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +0 -177
  477. claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +0 -119
  478. claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +0 -148
  479. claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +0 -483
  480. claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +0 -452
  481. claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +0 -449
  482. claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +0 -411
  483. claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +0 -14
  484. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +0 -58
  485. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +0 -68
  486. claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +0 -69
  487. claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +0 -175
  488. claude_mpm/skills/bundled/debugging/verification-before-completion/references/common-failures.md +0 -213
  489. claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +0 -314
  490. claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +0 -227
  491. claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +0 -74
  492. claude_mpm/skills/bundled/main/internal-comms/SKILL.md +0 -32
  493. claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +0 -47
  494. claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +0 -65
  495. claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +0 -30
  496. claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +0 -16
  497. claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +0 -328
  498. claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +0 -602
  499. claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +0 -915
  500. claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +0 -916
  501. claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +0 -752
  502. claude_mpm/skills/bundled/main/skill-creator/SKILL.md +0 -209
  503. claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +0 -123
  504. claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +0 -145
  505. claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +0 -543
  506. claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +0 -741
  507. claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +0 -470
  508. claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +0 -458
  509. claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +0 -639
  510. claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +0 -304
  511. claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +0 -96
  512. claude_mpm/tools/code_tree_analyzer.py +0 -1825
  513. /claude_mpm/agents/templates/{git_file_tracking.md → git-file-tracking.md} +0 -0
  514. /claude_mpm/agents/templates/{pm_examples.md → pm-examples.md} +0 -0
  515. /claude_mpm/agents/templates/{response_format.md → response-format.md} +0 -0
  516. /claude_mpm/agents/templates/{validation_templates.md → validation-templates.md} +0 -0
  517. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/WHEEL +0 -0
  518. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/entry_points.txt +0 -0
  519. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/licenses/LICENSE +0 -0
  520. {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Activity Tree Component - Linear Tree View
3
- *
3
+ *
4
4
  * HTML/CSS-based linear tree visualization for showing PM activity hierarchy.
5
5
  * Replaces D3.js with simpler, cleaner linear tree structure.
6
6
  * Uses UnifiedDataViewer for consistent data display with Tools viewer.
@@ -25,11 +25,11 @@ class ActivityTree {
25
25
  this.expandedTools = new Set();
26
26
  this.selectedItem = null;
27
27
  this.sessionFilterInitialized = false; // Flag to prevent initialization loop
28
-
28
+
29
29
  // Add debounce for renderTree to prevent excessive DOM rebuilds
30
30
  this.renderTreeDebounced = this.debounce(() => this.renderTree(), 100);
31
31
  }
32
-
32
+
33
33
  /**
34
34
  * Debounce helper to prevent excessive DOM updates
35
35
  */
@@ -50,12 +50,12 @@ class ActivityTree {
50
50
  */
51
51
  initialize() {
52
52
  console.log('ActivityTree.initialize() called, initialized:', this.initialized);
53
-
53
+
54
54
  if (this.initialized) {
55
55
  console.log('Activity tree already initialized, skipping');
56
56
  return;
57
57
  }
58
-
58
+
59
59
  this.container = document.getElementById('activity-tree-container');
60
60
  if (!this.container) {
61
61
  this.container = document.getElementById('activity-tree');
@@ -64,14 +64,14 @@ class ActivityTree {
64
64
  return;
65
65
  }
66
66
  }
67
-
67
+
68
68
  // Check if the container is visible before initializing
69
69
  const tabPanel = document.getElementById('activity-tab');
70
70
  if (!tabPanel) {
71
71
  console.error('Activity tab panel (#activity-tab) not found in DOM');
72
72
  return;
73
73
  }
74
-
74
+
75
75
  // Initialize even if tab is not active
76
76
  if (!tabPanel.classList.contains('active')) {
77
77
  console.log('Activity tab not active, initializing but deferring render');
@@ -84,7 +84,7 @@ class ActivityTree {
84
84
  this.setupControls();
85
85
  this.createLinearTreeView();
86
86
  this.subscribeToEvents();
87
-
87
+
88
88
  this.initialized = true;
89
89
  console.log('Activity tree initialization complete');
90
90
  }
@@ -94,7 +94,7 @@ class ActivityTree {
94
94
  */
95
95
  forceShow() {
96
96
  console.log('ActivityTree.forceShow() called');
97
-
97
+
98
98
  if (!this.container) {
99
99
  this.container = document.getElementById('activity-tree-container') || document.getElementById('activity-tree');
100
100
  if (!this.container) {
@@ -102,23 +102,23 @@ class ActivityTree {
102
102
  return;
103
103
  }
104
104
  }
105
-
105
+
106
106
  this.createLinearTreeView();
107
107
  this.renderTree();
108
108
  }
109
-
109
+
110
110
  /**
111
111
  * Render the visualization when tab becomes visible
112
112
  */
113
113
  renderWhenVisible() {
114
114
  console.log('ActivityTree.renderWhenVisible() called');
115
-
115
+
116
116
  if (!this.initialized) {
117
117
  console.log('Not initialized yet, calling initialize...');
118
118
  this.initialize();
119
119
  return;
120
120
  }
121
-
121
+
122
122
  this.createLinearTreeView();
123
123
  this.renderTree();
124
124
  }
@@ -198,17 +198,17 @@ class ActivityTree {
198
198
  */
199
199
  createLinearTreeView() {
200
200
  console.log('Creating linear tree view');
201
-
201
+
202
202
  // Clear container
203
203
  this.container.innerHTML = '';
204
-
204
+
205
205
  // Create main tree container
206
206
  const treeContainer = document.createElement('div');
207
207
  treeContainer.id = 'linear-tree';
208
208
  treeContainer.className = 'linear-tree';
209
-
209
+
210
210
  this.container.appendChild(treeContainer);
211
-
211
+
212
212
  console.log('Linear tree view created');
213
213
  }
214
214
 
@@ -228,7 +228,7 @@ class ActivityTree {
228
228
  // FIXED: Now correctly receives both events AND sessions from socket client
229
229
  window.socketClient.onEventUpdate((events, sessions) => {
230
230
  console.log(`ActivityTree: onEventUpdate called with ${events.length} total events and ${sessions.size} sessions`);
231
-
231
+
232
232
  // IMPORTANT: Don't clear sessions! We need to preserve the accumulated agent data
233
233
  // Only create new sessions if they don't exist yet
234
234
  for (const [sessionId, sessionData] of sessions.entries()) {
@@ -265,40 +265,40 @@ class ActivityTree {
265
265
  // These are built up from events and must be preserved!
266
266
  }
267
267
  }
268
-
268
+
269
269
  // Process only events we haven't seen before
270
270
  const newEvents = events.filter(event => {
271
271
  const eventId = event.id || `${event.type}-${event.timestamp}-${Math.random()}`;
272
272
  return !this.processedEventIds.has(eventId);
273
273
  });
274
-
274
+
275
275
  if (newEvents.length > 0) {
276
276
  console.log(`ActivityTree: Processing ${newEvents.length} new events`, newEvents);
277
-
277
+
278
278
  newEvents.forEach(event => {
279
279
  const eventId = event.id || `${event.type}-${event.timestamp}-${Math.random()}`;
280
280
  this.processedEventIds.add(eventId);
281
281
  this.processEvent(event);
282
282
  });
283
283
  }
284
-
284
+
285
285
  this.events = [...events];
286
286
  // Use debounced render to prevent excessive DOM rebuilds
287
287
  this.renderTreeDebounced();
288
-
288
+
289
289
  // Debug: Log session state after processing
290
290
  console.log(`ActivityTree: Sessions after sync with socket client:`, Array.from(this.sessions.entries()));
291
291
  });
292
292
 
293
293
  // Load existing data from socket client
294
294
  const socketState = window.socketClient?.getState();
295
-
295
+
296
296
  if (socketState && socketState.events.length > 0) {
297
297
  console.log(`ActivityTree: Loading existing data - ${socketState.events.length} events, ${socketState.sessions.size} sessions`);
298
-
298
+
299
299
  // Initialize from existing socket client data
300
300
  // Don't clear existing sessions - preserve accumulated data
301
-
301
+
302
302
  // Convert authoritative sessions Map to our format
303
303
  for (const [sessionId, sessionData] of socketState.sessions.entries()) {
304
304
  if (!this.sessions.has(sessionId)) {
@@ -320,13 +320,13 @@ class ActivityTree {
320
320
  this.sessions.set(sessionId, activitySession);
321
321
  }
322
322
  }
323
-
323
+
324
324
  // Process only events we haven't seen before
325
325
  const unprocessedEvents = socketState.events.filter(event => {
326
326
  const eventId = event.id || `${event.type}-${event.timestamp}-${Math.random()}`;
327
327
  return !this.processedEventIds.has(eventId);
328
328
  });
329
-
329
+
330
330
  if (unprocessedEvents.length > 0) {
331
331
  console.log(`ActivityTree: Processing ${unprocessedEvents.length} unprocessed events from initial load`);
332
332
  unprocessedEvents.forEach(event => {
@@ -335,11 +335,11 @@ class ActivityTree {
335
335
  this.processEvent(event);
336
336
  });
337
337
  }
338
-
338
+
339
339
  this.events = [...socketState.events];
340
340
  // Initial render can be immediate
341
341
  this.renderTree();
342
-
342
+
343
343
  // Debug: Log initial session state
344
344
  console.log(`ActivityTree: Initial sessions state:`, Array.from(this.sessions.entries()));
345
345
  } else {
@@ -358,15 +358,15 @@ class ActivityTree {
358
358
  console.log('ActivityTree: Ignoring null event');
359
359
  return;
360
360
  }
361
-
361
+
362
362
  // Determine event type
363
363
  let eventType = this.getEventType(event);
364
364
  if (!eventType) {
365
365
  return;
366
366
  }
367
-
367
+
368
368
  console.log(`ActivityTree: Processing event: ${eventType}`, event);
369
-
369
+
370
370
  // Fix timestamp processing - ensure we get a valid date
371
371
  let timestamp;
372
372
  if (event.timestamp) {
@@ -381,24 +381,24 @@ class ActivityTree {
381
381
  console.warn('ActivityTree: No timestamp found, using current time');
382
382
  timestamp = new Date();
383
383
  }
384
-
384
+
385
385
  // Get session ID from event - this should match the authoritative sessions
386
386
  const sessionId = event.session_id || event.data?.session_id;
387
-
387
+
388
388
  // Skip events without session ID - they can't be properly categorized
389
389
  if (!sessionId) {
390
390
  console.log(`ActivityTree: Skipping event without session_id: ${eventType}`);
391
391
  return;
392
392
  }
393
-
393
+
394
394
  // Find the session - it should already exist from authoritative sessions
395
395
  if (!this.sessions.has(sessionId)) {
396
396
  console.warn(`ActivityTree: Session ${sessionId} not found in authoritative sessions - skipping event`);
397
397
  return;
398
398
  }
399
-
399
+
400
400
  const session = this.sessions.get(sessionId);
401
-
401
+
402
402
  switch (eventType) {
403
403
  case 'Start':
404
404
  // New PM session started
@@ -424,7 +424,7 @@ class ActivityTree {
424
424
  this.updateToolStatus(event, session, 'completed');
425
425
  break;
426
426
  }
427
-
427
+
428
428
  this.updateStats();
429
429
  }
430
430
 
@@ -435,7 +435,7 @@ class ActivityTree {
435
435
  if (event.hook_event_name) {
436
436
  return event.hook_event_name;
437
437
  }
438
-
438
+
439
439
  if (event.type === 'hook' && event.subtype) {
440
440
  const mapping = {
441
441
  'pre_tool': 'PreToolUse',
@@ -446,24 +446,24 @@ class ActivityTree {
446
446
  };
447
447
  return mapping[event.subtype];
448
448
  }
449
-
449
+
450
450
  if (event.type === 'todo' && event.subtype === 'updated') {
451
451
  return 'TodoWrite';
452
452
  }
453
-
453
+
454
454
  if (event.type === 'subagent') {
455
455
  if (event.subtype === 'started') return 'SubagentStart';
456
456
  if (event.subtype === 'stopped') return 'SubagentStop';
457
457
  }
458
-
458
+
459
459
  if (event.type === 'start') {
460
460
  return 'Start';
461
461
  }
462
-
462
+
463
463
  if (event.type === 'user_prompt' || event.subtype === 'user_prompt') {
464
464
  return 'user_prompt';
465
465
  }
466
-
466
+
467
467
  return null;
468
468
  }
469
469
 
@@ -475,7 +475,7 @@ class ActivityTree {
475
475
  processUserInstruction(event, session) {
476
476
  const promptText = event.prompt_text || event.data?.prompt_text || event.prompt || '';
477
477
  if (!promptText) return;
478
-
478
+
479
479
  const instruction = {
480
480
  id: `instruction-${session.id}-${Date.now()}`,
481
481
  text: promptText,
@@ -483,12 +483,12 @@ class ActivityTree {
483
483
  timestamp: event.timestamp || new Date().toISOString(),
484
484
  type: 'user_instruction'
485
485
  };
486
-
486
+
487
487
  // NEW USER PROMPT: Only collapse agents if we have existing ones
488
488
  // Don't clear - we want to keep the history!
489
489
  if (session.agents.size > 0) {
490
490
  console.log('ActivityTree: New user prompt detected, collapsing previous agents');
491
-
491
+
492
492
  // Mark all existing agents as completed (not active)
493
493
  for (let agent of session.agents.values()) {
494
494
  if (agent.status === 'active') {
@@ -498,13 +498,13 @@ class ActivityTree {
498
498
  this.expandedAgents.delete(agent.id);
499
499
  }
500
500
  }
501
-
501
+
502
502
  // Reset current active agent for new work
503
503
  session.currentActiveAgent = null;
504
-
504
+
505
505
  // Add to session's user instructions
506
506
  session.userInstructions.push(instruction);
507
-
507
+
508
508
  // Keep only last 5 instructions to prevent memory bloat
509
509
  if (session.userInstructions.length > 5) {
510
510
  session.userInstructions = session.userInstructions.slice(-5);
@@ -516,11 +516,11 @@ class ActivityTree {
516
516
  */
517
517
  processTodoWrite(event, session) {
518
518
  let todos = event.todos || event.data?.todos || event.data || [];
519
-
519
+
520
520
  if (todos && typeof todos === 'object' && todos.todos) {
521
521
  todos = todos.todos;
522
522
  }
523
-
523
+
524
524
  if (!Array.isArray(todos) || todos.length === 0) {
525
525
  return;
526
526
  }
@@ -535,13 +535,13 @@ class ActivityTree {
535
535
 
536
536
  // Find the appropriate agent to attach this TodoWrite to
537
537
  let targetAgent = session.currentActiveAgent;
538
-
538
+
539
539
  if (!targetAgent) {
540
540
  // Fall back to most recent active agent
541
541
  const activeAgents = this.getAllAgents(session)
542
542
  .filter(agent => agent.status === 'active' || agent.status === 'in_progress')
543
543
  .sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
544
-
544
+
545
545
  if (activeAgents.length > 0) {
546
546
  targetAgent = activeAgents[0];
547
547
  } else {
@@ -564,10 +564,10 @@ class ActivityTree {
564
564
  if (!targetAgent.todoWrites) {
565
565
  targetAgent.todoWrites = [];
566
566
  }
567
-
567
+
568
568
  // Check if we already have a TodoWrite instance
569
569
  const existingTodoWrite = targetAgent.todoWritesMap.get('TodoWrite');
570
-
570
+
571
571
  if (existingTodoWrite) {
572
572
  // Update existing TodoWrite instance
573
573
  existingTodoWrite.todos = todos;
@@ -588,11 +588,11 @@ class ActivityTree {
588
588
  },
589
589
  updateCount: 1
590
590
  };
591
-
591
+
592
592
  targetAgent.todoWritesMap.set('TodoWrite', todoWriteInstance);
593
593
  targetAgent.todoWrites = [todoWriteInstance]; // Keep single instance
594
594
  }
595
-
595
+
596
596
  // Update agent's current todos for display when collapsed
597
597
  targetAgent.currentTodos = todos;
598
598
  } else {
@@ -603,7 +603,7 @@ class ActivityTree {
603
603
  if (!session.todoWritesMap) {
604
604
  session.todoWritesMap = new Map();
605
605
  }
606
-
606
+
607
607
  const existingTodoWrite = session.todoWritesMap.get('TodoWrite');
608
608
  if (existingTodoWrite) {
609
609
  existingTodoWrite.todos = todos;
@@ -633,20 +633,20 @@ class ActivityTree {
633
633
  const agentName = event.agent_name || event.data?.agent_name || event.data?.agent_type || event.agent_type || event.agent || 'unknown';
634
634
  const agentSessionId = event.session_id || event.data?.session_id;
635
635
  const parentAgent = event.parent_agent || event.data?.parent_agent;
636
-
636
+
637
637
  // Use a composite key based on agent name and session to find existing instances
638
638
  // This ensures we track unique agent instances per session
639
639
  const agentKey = `${agentName}-${agentSessionId || 'no-session'}`;
640
-
640
+
641
641
  // Check if this exact agent already exists (same name and session)
642
642
  let existingAgent = null;
643
643
  const allAgents = this.getAllAgents(session);
644
- existingAgent = allAgents.find(a =>
645
- a.name === agentName &&
644
+ existingAgent = allAgents.find(a =>
645
+ a.name === agentName &&
646
646
  a.sessionId === agentSessionId &&
647
647
  a.status === 'active' // Only reuse if still active
648
648
  );
649
-
649
+
650
650
  let agent;
651
651
  if (existingAgent) {
652
652
  // Update existing active agent
@@ -673,7 +673,7 @@ class ActivityTree {
673
673
  instanceCount: 1,
674
674
  toolsMap: new Map() // Track unique tools by name
675
675
  };
676
-
676
+
677
677
  // If this is a subagent, nest it under the parent agent
678
678
  if (parentAgent) {
679
679
  // Find the parent agent in the session
@@ -684,7 +684,7 @@ class ActivityTree {
684
684
  break;
685
685
  }
686
686
  }
687
-
687
+
688
688
  if (parent) {
689
689
  // Add as nested subagent
690
690
  if (!parent.subagents) {
@@ -699,11 +699,11 @@ class ActivityTree {
699
699
  // Top-level agent, add to session
700
700
  session.agents.set(agent.id, agent);
701
701
  }
702
-
702
+
703
703
  // Auto-expand new agents
704
704
  this.expandedAgents.add(agent.id);
705
705
  }
706
-
706
+
707
707
  // Track the currently active agent for tool/todo association
708
708
  session.currentActiveAgent = agent;
709
709
  }
@@ -713,7 +713,7 @@ class ActivityTree {
713
713
  */
714
714
  processSubagentStop(event, session) {
715
715
  const agentSessionId = event.session_id || event.data?.session_id;
716
-
716
+
717
717
  // Find and mark agent as completed
718
718
  if (agentSessionId && session.agents.has(agentSessionId)) {
719
719
  const agent = session.agents.get(agentSessionId);
@@ -723,7 +723,7 @@ class ActivityTree {
723
723
 
724
724
  /**
725
725
  * Process tool use event
726
- *
726
+ *
727
727
  * DISPLAY RULES:
728
728
  * 1. TodoWrite is a privileged tool that ALWAYS appears first under the agent/PM
729
729
  * 2. Each tool appears only once per unique instance (updated in place)
@@ -737,7 +737,7 @@ class ActivityTree {
737
737
 
738
738
  // Find the appropriate agent to attach this tool to
739
739
  let targetAgent = session.currentActiveAgent;
740
-
740
+
741
741
  if (!targetAgent) {
742
742
  // Fall back to finding by session ID or most recent active
743
743
  const allAgents = this.getAllAgents(session);
@@ -753,12 +753,12 @@ class ActivityTree {
753
753
  if (!targetAgent.tools) {
754
754
  targetAgent.tools = [];
755
755
  }
756
-
756
+
757
757
  // Check if we already have this tool instance
758
758
  // Use tool name + params hash for unique identification
759
759
  const toolKey = this.getToolKey(toolName, params);
760
760
  let existingTool = targetAgent.toolsMap.get(toolKey);
761
-
761
+
762
762
  if (existingTool) {
763
763
  // UPDATE RULE: Update existing tool instance in place
764
764
  existingTool.params = params;
@@ -766,7 +766,7 @@ class ActivityTree {
766
766
  existingTool.status = 'in_progress';
767
767
  existingTool.eventId = event.id;
768
768
  existingTool.callCount = (existingTool.callCount || 1) + 1;
769
-
769
+
770
770
  // Update current tool for collapsed display
771
771
  targetAgent.currentTool = existingTool;
772
772
  } else {
@@ -783,15 +783,15 @@ class ActivityTree {
783
783
  callCount: 1,
784
784
  createdAt: event.timestamp // Track creation order
785
785
  };
786
-
786
+
787
787
  // Special handling for Task tool (subagent delegation)
788
788
  if (toolName === 'Task' && params.subagent_type) {
789
789
  tool.isSubagentTask = true;
790
790
  tool.subagentType = params.subagent_type;
791
791
  }
792
-
792
+
793
793
  targetAgent.toolsMap.set(toolKey, tool);
794
-
794
+
795
795
  // ORDERING RULE: TodoWrite always goes first, others in creation order
796
796
  if (toolName === 'TodoWrite') {
797
797
  // Insert TodoWrite at the beginning
@@ -800,7 +800,7 @@ class ActivityTree {
800
800
  // Append other tools in creation order
801
801
  targetAgent.tools.push(tool);
802
802
  }
803
-
803
+
804
804
  targetAgent.currentTool = tool;
805
805
  }
806
806
  } else {
@@ -812,10 +812,10 @@ class ActivityTree {
812
812
  if (!session.toolsMap) {
813
813
  session.toolsMap = new Map();
814
814
  }
815
-
815
+
816
816
  const toolKey = this.getToolKey(toolName, params);
817
817
  let existingTool = session.toolsMap.get(toolKey);
818
-
818
+
819
819
  if (existingTool) {
820
820
  // UPDATE RULE: Update existing tool instance in place
821
821
  existingTool.params = params;
@@ -837,16 +837,16 @@ class ActivityTree {
837
837
  callCount: 1,
838
838
  createdAt: event.timestamp // Track creation order
839
839
  };
840
-
840
+
841
841
  session.toolsMap.set(toolKey, tool);
842
-
842
+
843
843
  // ORDERING RULE: TodoWrite always goes first for PM too
844
844
  if (toolName === 'TodoWrite') {
845
845
  session.tools.unshift(tool);
846
846
  } else {
847
847
  session.tools.push(tool);
848
848
  }
849
-
849
+
850
850
  session.currentTool = tool;
851
851
  }
852
852
  }
@@ -862,11 +862,11 @@ class ActivityTree {
862
862
  if (toolName === 'TodoWrite') {
863
863
  return 'TodoWrite'; // Single instance per agent/PM
864
864
  }
865
-
865
+
866
866
  // For other tools, we generally want one instance per tool type
867
867
  // that gets updated with each call (not creating new instances)
868
868
  let key = toolName;
869
-
869
+
870
870
  // Only add distinguishing params if we need multiple instances
871
871
  // For example, multiple files being edited simultaneously
872
872
  if (toolName === 'Edit' || toolName === 'Write' || toolName === 'Read') {
@@ -874,13 +874,13 @@ class ActivityTree {
874
874
  key += `-${params.file_path}`;
875
875
  }
876
876
  }
877
-
877
+
878
878
  // For search tools, we might want separate instances for different searches
879
879
  if ((toolName === 'Grep' || toolName === 'Glob') && params.pattern) {
880
880
  // Only add pattern if significantly different
881
881
  key += `-${params.pattern.substring(0, 20)}`;
882
882
  }
883
-
883
+
884
884
  // Most tools should have a single instance that updates
885
885
  // This prevents the tool list from growing unbounded
886
886
  return key;
@@ -893,19 +893,19 @@ class ActivityTree {
893
893
  const toolName = event.tool_name || event.data?.tool_name || event.tool || 'unknown';
894
894
  const params = event.tool_parameters || event.data?.tool_parameters || event.parameters || event.data?.parameters || {};
895
895
  const agentSessionId = event.session_id || event.data?.session_id;
896
-
896
+
897
897
  // Generate the same key we used to store the tool
898
898
  const toolKey = this.getToolKey(toolName, params);
899
-
899
+
900
900
  // Find the appropriate agent
901
901
  let targetAgent = session.currentActiveAgent;
902
-
902
+
903
903
  if (!targetAgent) {
904
904
  const allAgents = this.getAllAgents(session);
905
905
  targetAgent = allAgents.find(a => a.sessionId === agentSessionId) ||
906
906
  allAgents.find(a => a.status === 'active');
907
907
  }
908
-
908
+
909
909
  if (targetAgent && targetAgent.toolsMap) {
910
910
  const tool = targetAgent.toolsMap.get(toolKey);
911
911
  if (tool) {
@@ -920,7 +920,7 @@ class ActivityTree {
920
920
  return;
921
921
  }
922
922
  }
923
-
923
+
924
924
  // Check session-level tools
925
925
  if (session.toolsMap) {
926
926
  const tool = session.toolsMap.get(toolKey);
@@ -936,7 +936,7 @@ class ActivityTree {
936
936
  return;
937
937
  }
938
938
  }
939
-
939
+
940
940
  console.log(`ActivityTree: Could not find tool to update status for ${toolName} with key ${toolKey} (event ${event.id})`);
941
941
  }
942
942
 
@@ -946,23 +946,23 @@ class ActivityTree {
946
946
  renderTree() {
947
947
  const treeContainer = document.getElementById('linear-tree');
948
948
  if (!treeContainer) return;
949
-
949
+
950
950
  // Clear tree
951
951
  treeContainer.innerHTML = '';
952
-
952
+
953
953
  // Add sessions directly (no project root)
954
954
  const sortedSessions = Array.from(this.sessions.values())
955
955
  .sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
956
-
956
+
957
957
  for (let session of sortedSessions) {
958
958
  if (this.selectedSessionFilter !== 'all' && this.selectedSessionFilter !== session.id) {
959
959
  continue;
960
960
  }
961
-
961
+
962
962
  const sessionElement = this.createSessionElement(session);
963
963
  treeContainer.appendChild(sessionElement);
964
964
  }
965
-
965
+
966
966
  // Session filtering is now handled by the main session selector via event listeners
967
967
  }
968
968
 
@@ -972,7 +972,7 @@ class ActivityTree {
972
972
  */
973
973
  createSessionElement(session) {
974
974
  const isExpanded = this.expandedSessions.has(session.id) || session.expanded;
975
-
975
+
976
976
  // Ensure timestamp is valid and format it consistently
977
977
  let sessionTime;
978
978
  try {
@@ -987,19 +987,19 @@ class ActivityTree {
987
987
  sessionTime = 'Invalid Date';
988
988
  console.error('ActivityTree: Error formatting session timestamp:', error, session.timestamp);
989
989
  }
990
-
990
+
991
991
  const element = document.createElement('div');
992
992
  element.className = 'tree-node session';
993
993
  element.dataset.sessionId = session.id;
994
-
994
+
995
995
  const expandIcon = isExpanded ? '▼' : '▶';
996
996
  // Count ALL agents including nested ones
997
997
  const agentCount = this.getAllAgents(session).length;
998
998
  const todoCount = session.currentTodos ? session.currentTodos.length : 0;
999
999
  const instructionCount = session.userInstructions ? session.userInstructions.length : 0;
1000
-
1000
+
1001
1001
  console.log(`ActivityTree: Rendering session ${session.id}: ${agentCount} agents, ${instructionCount} instructions, ${todoCount} todos at ${sessionTime}`);
1002
-
1002
+
1003
1003
  element.innerHTML = `
1004
1004
  <div class="tree-node-content" onclick="window.activityTreeInstance.toggleSession('${session.id}')">
1005
1005
  <span class="tree-expand-icon">${expandIcon}</span>
@@ -1011,13 +1011,13 @@ class ActivityTree {
1011
1011
  ${this.renderSessionContent(session)}
1012
1012
  </div>
1013
1013
  `;
1014
-
1014
+
1015
1015
  return element;
1016
1016
  }
1017
1017
 
1018
1018
  /**
1019
1019
  * Render session content (user instructions, todos, agents, tools)
1020
- *
1020
+ *
1021
1021
  * PM DISPLAY RULES (documented inline):
1022
1022
  * 1. User instructions appear first (context)
1023
1023
  * 2. PM-level tools follow the same rules as agent tools:
@@ -1028,14 +1028,14 @@ class ActivityTree {
1028
1028
  */
1029
1029
  renderSessionContent(session) {
1030
1030
  let html = '';
1031
-
1031
+
1032
1032
  // Render user instructions first
1033
1033
  if (session.userInstructions && session.userInstructions.length > 0) {
1034
1034
  for (let instruction of session.userInstructions.slice(-3)) { // Show last 3 instructions
1035
1035
  html += this.renderUserInstructionElement(instruction, 1);
1036
1036
  }
1037
1037
  }
1038
-
1038
+
1039
1039
  // PM TOOL DISPLAY RULES:
1040
1040
  // Render PM-level tools (TodoWrite first, then others in creation order)
1041
1041
  // The session.tools array is already properly ordered by processToolUse
@@ -1044,15 +1044,15 @@ class ActivityTree {
1044
1044
  html += this.renderToolElement(tool, 1);
1045
1045
  }
1046
1046
  }
1047
-
1047
+
1048
1048
  // Render agents (they will have their own TodoWrite at the top)
1049
1049
  const agents = Array.from(session.agents.values())
1050
1050
  .sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
1051
-
1051
+
1052
1052
  for (let agent of agents) {
1053
1053
  html += this.renderAgentElement(agent, 1);
1054
1054
  }
1055
-
1055
+
1056
1056
  return html;
1057
1057
  }
1058
1058
 
@@ -1062,7 +1062,7 @@ class ActivityTree {
1062
1062
  renderUserInstructionElement(instruction, level) {
1063
1063
  const isSelected = this.selectedItem && this.selectedItem.type === 'instruction' && this.selectedItem.data.id === instruction.id;
1064
1064
  const selectedClass = isSelected ? 'selected' : '';
1065
-
1065
+
1066
1066
  return `
1067
1067
  <div class="tree-node user-instruction ${selectedClass}" data-level="${level}">
1068
1068
  <div class="tree-node-content">
@@ -1082,18 +1082,18 @@ class ActivityTree {
1082
1082
  const checklistId = `checklist-${Date.now()}`;
1083
1083
  const isExpanded = this.expandedTools.has(checklistId) !== false; // Default to expanded
1084
1084
  const expandIcon = isExpanded ? '▼' : '▶';
1085
-
1085
+
1086
1086
  // Calculate status summary
1087
1087
  let completedCount = 0;
1088
1088
  let inProgressCount = 0;
1089
1089
  let pendingCount = 0;
1090
-
1090
+
1091
1091
  todos.forEach(todo => {
1092
1092
  if (todo.status === 'completed') completedCount++;
1093
1093
  else if (todo.status === 'in_progress') inProgressCount++;
1094
1094
  else pendingCount++;
1095
1095
  });
1096
-
1096
+
1097
1097
  let statusSummary = '';
1098
1098
  if (inProgressCount > 0) {
1099
1099
  statusSummary = `${inProgressCount} in progress, ${completedCount} completed`;
@@ -1102,7 +1102,7 @@ class ActivityTree {
1102
1102
  } else {
1103
1103
  statusSummary = `${todos.length} todo(s)`;
1104
1104
  }
1105
-
1105
+
1106
1106
  let html = `
1107
1107
  <div class="tree-node todo-checklist" data-level="${level}">
1108
1108
  <div class="tree-node-content">
@@ -1113,7 +1113,7 @@ class ActivityTree {
1113
1113
  <span class="tree-status status-active">checklist</span>
1114
1114
  </div>
1115
1115
  `;
1116
-
1116
+
1117
1117
  // Show expanded todo items if expanded
1118
1118
  if (isExpanded) {
1119
1119
  html += '<div class="tree-children">';
@@ -1121,7 +1121,7 @@ class ActivityTree {
1121
1121
  const statusIcon = this.getCheckboxIcon(todo.status);
1122
1122
  const statusClass = `status-${todo.status}`;
1123
1123
  const displayText = todo.status === 'in_progress' ? todo.activeForm : todo.content;
1124
-
1124
+
1125
1125
  html += `
1126
1126
  <div class="tree-node todo-item ${statusClass}" data-level="${level + 1}">
1127
1127
  <div class="tree-node-content">
@@ -1135,7 +1135,7 @@ class ActivityTree {
1135
1135
  }
1136
1136
  html += '</div>';
1137
1137
  }
1138
-
1138
+
1139
1139
  html += '</div>';
1140
1140
  return html;
1141
1141
  }
@@ -1150,13 +1150,13 @@ class ActivityTree {
1150
1150
  const hasSubagents = agent.subagents && agent.subagents.size > 0;
1151
1151
  const hasContent = hasTools || hasSubagents;
1152
1152
  const isSelected = this.selectedItem && this.selectedItem.type === 'agent' && this.selectedItem.data.id === agent.id;
1153
-
1153
+
1154
1154
  const expandIcon = hasContent ? (isExpanded ? '▼' : '▶') : '';
1155
1155
  const selectedClass = isSelected ? 'selected' : '';
1156
-
1156
+
1157
1157
  // Add instance count if called multiple times
1158
1158
  const instanceIndicator = agent.instanceCount > 1 ? ` (${agent.instanceCount}x)` : '';
1159
-
1159
+
1160
1160
  // Build status display for collapsed state
1161
1161
  let collapsedStatus = '';
1162
1162
  if (!isExpanded && hasContent) {
@@ -1174,7 +1174,7 @@ class ActivityTree {
1174
1174
  collapsedStatus = ` • ${parts.join(' • ')}`;
1175
1175
  }
1176
1176
  }
1177
-
1177
+
1178
1178
  let html = `
1179
1179
  <div class="tree-node agent ${statusClass} ${selectedClass}" data-level="${level}">
1180
1180
  <div class="tree-node-content">
@@ -1184,17 +1184,17 @@ class ActivityTree {
1184
1184
  <span class="tree-status ${statusClass}">${agent.status}</span>
1185
1185
  </div>
1186
1186
  `;
1187
-
1187
+
1188
1188
  // Render nested content when expanded
1189
1189
  if (hasContent && isExpanded) {
1190
1190
  html += '<div class="tree-children">';
1191
-
1191
+
1192
1192
  // DISPLAY ORDER RULES (documented inline):
1193
1193
  // 1. TodoWrite is a privileged tool - ALWAYS appears first
1194
1194
  // 2. Each tool appears only once per unique instance
1195
1195
  // 3. Tools are displayed in order of creation (after TodoWrite)
1196
1196
  // 4. Tool instances are updated in place as new events arrive
1197
-
1197
+
1198
1198
  // Render all tools in their proper order
1199
1199
  // The tools array is already ordered: TodoWrite first, then others by creation
1200
1200
  if (hasTools) {
@@ -1202,7 +1202,7 @@ class ActivityTree {
1202
1202
  html += this.renderToolElement(tool, level + 1);
1203
1203
  }
1204
1204
  }
1205
-
1205
+
1206
1206
  // Then render subagents (they will have their own TodoWrite at the top)
1207
1207
  if (hasSubagents) {
1208
1208
  const subagents = Array.from(agent.subagents.values());
@@ -1210,10 +1210,10 @@ class ActivityTree {
1210
1210
  html += this.renderAgentElement(subagent, level + 1);
1211
1211
  }
1212
1212
  }
1213
-
1213
+
1214
1214
  html += '</div>';
1215
1215
  }
1216
-
1216
+
1217
1217
  html += '</div>';
1218
1218
  return html;
1219
1219
  }
@@ -1226,14 +1226,14 @@ class ActivityTree {
1226
1226
  const params = this.getToolParams(tool);
1227
1227
  const isSelected = this.selectedItem && this.selectedItem.type === 'tool' && this.selectedItem.data.id === tool.id;
1228
1228
  const selectedClass = isSelected ? 'selected' : '';
1229
-
1229
+
1230
1230
  // Add visual status indicators
1231
1231
  const statusIcon = this.getToolStatusIcon(tool.status);
1232
1232
  const statusLabel = this.getToolStatusLabel(tool.status);
1233
-
1233
+
1234
1234
  // Add call count if more than 1
1235
1235
  const callIndicator = tool.callCount > 1 ? ` (${tool.callCount} calls)` : '';
1236
-
1236
+
1237
1237
  let html = `
1238
1238
  <div class="tree-node tool ${statusClass} ${selectedClass}" data-level="${level}">
1239
1239
  <div class="tree-node-content">
@@ -1246,7 +1246,7 @@ class ActivityTree {
1246
1246
  </div>
1247
1247
  </div>
1248
1248
  `;
1249
-
1249
+
1250
1250
  return html;
1251
1251
  }
1252
1252
 
@@ -1255,7 +1255,7 @@ class ActivityTree {
1255
1255
  */
1256
1256
  getToolParams(tool) {
1257
1257
  if (!tool.params) return '';
1258
-
1258
+
1259
1259
  if (tool.name === 'Read' && tool.params.file_path) {
1260
1260
  return tool.params.file_path;
1261
1261
  }
@@ -1272,7 +1272,7 @@ class ActivityTree {
1272
1272
  if (tool.name === 'WebFetch' && tool.params.url) {
1273
1273
  return tool.params.url;
1274
1274
  }
1275
-
1275
+
1276
1276
  return '';
1277
1277
  }
1278
1278
 
@@ -1321,10 +1321,10 @@ class ActivityTree {
1321
1321
  */
1322
1322
  getAllAgents(session) {
1323
1323
  const agents = [];
1324
-
1324
+
1325
1325
  const collectAgents = (agentMap) => {
1326
1326
  if (!agentMap) return;
1327
-
1327
+
1328
1328
  for (let agent of agentMap.values()) {
1329
1329
  agents.push(agent);
1330
1330
  if (agent.subagents && agent.subagents.size > 0) {
@@ -1332,7 +1332,7 @@ class ActivityTree {
1332
1332
  }
1333
1333
  }
1334
1334
  };
1335
-
1335
+
1336
1336
  collectAgents(session.agents);
1337
1337
  return agents;
1338
1338
  }
@@ -1345,22 +1345,22 @@ class ActivityTree {
1345
1345
  const isExpanded = this.expandedTools.has(todoWriteId);
1346
1346
  const expandIcon = isExpanded ? '▼' : '▶';
1347
1347
  const todos = todoWrite.todos || [];
1348
-
1348
+
1349
1349
  // Calculate status summary
1350
1350
  let completedCount = 0;
1351
1351
  let inProgressCount = 0;
1352
1352
  let pendingCount = 0;
1353
-
1353
+
1354
1354
  todos.forEach(todo => {
1355
1355
  if (todo.status === 'completed') completedCount++;
1356
1356
  else if (todo.status === 'in_progress') inProgressCount++;
1357
1357
  else pendingCount++;
1358
1358
  });
1359
-
1359
+
1360
1360
  // Find current in-progress todo for highlighting
1361
1361
  const currentTodo = todos.find(t => t.status === 'in_progress');
1362
1362
  const currentIndicator = currentTodo ? ` • 🔄 ${currentTodo.activeForm || currentTodo.content}` : '';
1363
-
1363
+
1364
1364
  let statusSummary = '';
1365
1365
  if (inProgressCount > 0) {
1366
1366
  statusSummary = `${inProgressCount} in progress, ${completedCount}/${todos.length} done`;
@@ -1369,10 +1369,10 @@ class ActivityTree {
1369
1369
  } else {
1370
1370
  statusSummary = `${completedCount}/${todos.length} done`;
1371
1371
  }
1372
-
1372
+
1373
1373
  // Add update count if more than 1
1374
1374
  const updateIndicator = todoWrite.updateCount > 1 ? ` (${todoWrite.updateCount} updates)` : '';
1375
-
1375
+
1376
1376
  let html = `
1377
1377
  <div class="tree-node todowrite ${currentTodo ? 'has-active' : ''}" data-level="${level}">
1378
1378
  <div class="tree-node-content">
@@ -1383,7 +1383,7 @@ class ActivityTree {
1383
1383
  <span class="tree-status status-active">todos</span>
1384
1384
  </div>
1385
1385
  `;
1386
-
1386
+
1387
1387
  // Show expanded todo items if expanded
1388
1388
  if (isExpanded && todos.length > 0) {
1389
1389
  html += '<div class="tree-children">';
@@ -1392,7 +1392,7 @@ class ActivityTree {
1392
1392
  const statusClass = `status-${todo.status}`;
1393
1393
  const displayText = todo.status === 'in_progress' ? todo.activeForm : todo.content;
1394
1394
  const isCurrentTodo = todo === currentTodo;
1395
-
1395
+
1396
1396
  html += `
1397
1397
  <div class="tree-node todo-item ${statusClass} ${isCurrentTodo ? 'current-active' : ''}" data-level="${level + 1}">
1398
1398
  <div class="tree-node-content">
@@ -1406,7 +1406,7 @@ class ActivityTree {
1406
1406
  }
1407
1407
  html += '</div>';
1408
1408
  }
1409
-
1409
+
1410
1410
  html += '</div>';
1411
1411
  return html;
1412
1412
  }
@@ -1479,13 +1479,13 @@ class ActivityTree {
1479
1479
  } else {
1480
1480
  this.expandedSessions.add(sessionId);
1481
1481
  }
1482
-
1482
+
1483
1483
  // Update the session in the data structure
1484
1484
  const session = this.sessions.get(sessionId);
1485
1485
  if (session) {
1486
1486
  session.expanded = this.expandedSessions.has(sessionId);
1487
1487
  }
1488
-
1488
+
1489
1489
  this.renderTree();
1490
1490
  }
1491
1491
 
@@ -1524,11 +1524,11 @@ class ActivityTree {
1524
1524
  const nodeCountEl = document.getElementById('node-count');
1525
1525
  const activeCountEl = document.getElementById('active-count');
1526
1526
  const depthEl = document.getElementById('tree-depth');
1527
-
1527
+
1528
1528
  if (nodeCountEl) nodeCountEl.textContent = totalNodes;
1529
1529
  if (activeCountEl) activeCountEl.textContent = activeNodes;
1530
1530
  if (depthEl) depthEl.textContent = maxDepth;
1531
-
1531
+
1532
1532
  console.log(`ActivityTree: Stats updated - Nodes: ${totalNodes}, Active: ${activeNodes}, Depth: ${maxDepth}`);
1533
1533
  }
1534
1534
 
@@ -1540,22 +1540,22 @@ class ActivityTree {
1540
1540
  for (let session of this.sessions.values()) {
1541
1541
  count += 1; // Session
1542
1542
  count += session.agents.size; // Agents
1543
-
1543
+
1544
1544
  // Count user instructions
1545
1545
  if (session.userInstructions) {
1546
1546
  count += session.userInstructions.length;
1547
1547
  }
1548
-
1548
+
1549
1549
  // Count todos
1550
1550
  if (session.todos) {
1551
1551
  count += session.todos.length;
1552
1552
  }
1553
-
1553
+
1554
1554
  // Count session-level tools
1555
1555
  if (session.tools) {
1556
1556
  count += session.tools.length;
1557
1557
  }
1558
-
1558
+
1559
1559
  // Count tools in agents
1560
1560
  for (let agent of session.agents.values()) {
1561
1561
  if (agent.tools) {
@@ -1574,21 +1574,21 @@ class ActivityTree {
1574
1574
  for (let session of this.sessions.values()) {
1575
1575
  // Count active session
1576
1576
  if (session.status === 'active') count++;
1577
-
1577
+
1578
1578
  // Count active todos
1579
1579
  if (session.todos) {
1580
1580
  for (let todo of session.todos) {
1581
1581
  if (todo.status === 'in_progress') count++;
1582
1582
  }
1583
1583
  }
1584
-
1584
+
1585
1585
  // Count session-level tools
1586
1586
  if (session.tools) {
1587
1587
  for (let tool of session.tools) {
1588
1588
  if (tool.status === 'in_progress') count++;
1589
1589
  }
1590
1590
  }
1591
-
1591
+
1592
1592
  // Count agents and their tools
1593
1593
  for (let agent of session.agents.values()) {
1594
1594
  if (agent.status === 'active') count++;
@@ -1609,27 +1609,27 @@ class ActivityTree {
1609
1609
  let maxDepth = 0; // No project root anymore
1610
1610
  for (let session of this.sessions.values()) {
1611
1611
  let sessionDepth = 1; // Session level (now root level)
1612
-
1612
+
1613
1613
  // Check session content (instructions, todos, tools)
1614
1614
  if (session.userInstructions && session.userInstructions.length > 0) {
1615
1615
  sessionDepth = Math.max(sessionDepth, 2); // Instruction level
1616
1616
  }
1617
-
1617
+
1618
1618
  if (session.todos && session.todos.length > 0) {
1619
1619
  sessionDepth = Math.max(sessionDepth, 3); // Todo checklist -> todo items
1620
1620
  }
1621
-
1621
+
1622
1622
  if (session.tools && session.tools.length > 0) {
1623
1623
  sessionDepth = Math.max(sessionDepth, 2); // Tool level
1624
1624
  }
1625
-
1625
+
1626
1626
  // Check agents
1627
1627
  for (let agent of session.agents.values()) {
1628
1628
  if (agent.tools && agent.tools.length > 0) {
1629
1629
  sessionDepth = Math.max(sessionDepth, 3); // Tool level under agents
1630
1630
  }
1631
1631
  }
1632
-
1632
+
1633
1633
  maxDepth = Math.max(maxDepth, sessionDepth);
1634
1634
  }
1635
1635
  return maxDepth;
@@ -1646,7 +1646,7 @@ class ActivityTree {
1646
1646
  }
1647
1647
  this.renderTree();
1648
1648
  }
1649
-
1649
+
1650
1650
  /**
1651
1651
  * Toggle tool expansion (deprecated - tools are no longer expandable)
1652
1652
  */
@@ -1675,18 +1675,18 @@ class ActivityTree {
1675
1675
  const isExpanded = this.expandedTools.has(checklistId) !== false; // Default to expanded
1676
1676
  const expandIcon = isExpanded ? '▼' : '▶';
1677
1677
  const todos = pinnedTodos.todos || [];
1678
-
1678
+
1679
1679
  // Calculate status summary
1680
1680
  let completedCount = 0;
1681
1681
  let inProgressCount = 0;
1682
1682
  let pendingCount = 0;
1683
-
1683
+
1684
1684
  todos.forEach(todo => {
1685
1685
  if (todo.status === 'completed') completedCount++;
1686
1686
  else if (todo.status === 'in_progress') inProgressCount++;
1687
1687
  else pendingCount++;
1688
1688
  });
1689
-
1689
+
1690
1690
  let statusSummary = '';
1691
1691
  if (inProgressCount > 0) {
1692
1692
  statusSummary = `${inProgressCount} in progress, ${completedCount} completed`;
@@ -1695,7 +1695,7 @@ class ActivityTree {
1695
1695
  } else {
1696
1696
  statusSummary = `${todos.length} todo(s)`;
1697
1697
  }
1698
-
1698
+
1699
1699
  let html = `
1700
1700
  <div class="tree-node pinned-todos" data-level="${level}">
1701
1701
  <div class="tree-node-content">
@@ -1706,7 +1706,7 @@ class ActivityTree {
1706
1706
  <span class="tree-status status-active">pinned</span>
1707
1707
  </div>
1708
1708
  `;
1709
-
1709
+
1710
1710
  // Show expanded todo items if expanded
1711
1711
  if (isExpanded) {
1712
1712
  html += '<div class="tree-children">';
@@ -1714,7 +1714,7 @@ class ActivityTree {
1714
1714
  const statusIcon = this.getCheckboxIcon(todo.status);
1715
1715
  const statusClass = `status-${todo.status}`;
1716
1716
  const displayText = todo.status === 'in_progress' ? todo.activeForm : todo.content;
1717
-
1717
+
1718
1718
  html += `
1719
1719
  <div class="tree-node todo-item ${statusClass}" data-level="${level + 1}">
1720
1720
  <div class="tree-node-content">
@@ -1728,7 +1728,7 @@ class ActivityTree {
1728
1728
  }
1729
1729
  html += '</div>';
1730
1730
  }
1731
-
1731
+
1732
1732
  html += '</div>';
1733
1733
  return html;
1734
1734
  }
@@ -1741,7 +1741,7 @@ class ActivityTree {
1741
1741
  if (event) {
1742
1742
  event.stopPropagation();
1743
1743
  }
1744
-
1744
+
1745
1745
  this.selectedItem = { data: item, type: itemType };
1746
1746
  this.displayItemData(item, itemType);
1747
1747
  this.renderTree(); // Re-render to show selection highlight
@@ -1755,16 +1755,16 @@ class ActivityTree {
1755
1755
  if (!this.unifiedViewer) {
1756
1756
  this.unifiedViewer = new UnifiedDataViewer('module-data-content');
1757
1757
  }
1758
-
1758
+
1759
1759
  // Use the same UnifiedDataViewer as Tools viewer for consistent display
1760
1760
  this.unifiedViewer.display(item, itemType);
1761
-
1761
+
1762
1762
  // Update module header for consistency
1763
1763
  const moduleHeader = document.querySelector('.module-data-header h5');
1764
1764
  if (moduleHeader) {
1765
1765
  const icons = {
1766
1766
  'agent': '🤖',
1767
- 'tool': '🔧',
1767
+ 'tool': '🔧',
1768
1768
  'instruction': '💬',
1769
1769
  'session': '🎯',
1770
1770
  'todo': '📝'
@@ -1796,7 +1796,7 @@ class ActivityTree {
1796
1796
  .call(this.zoom.transform, d3.zoomIdentity);
1797
1797
  }
1798
1798
  }
1799
-
1799
+
1800
1800
  /**
1801
1801
  * Escape JSON for safe inclusion in HTML attributes
1802
1802
  */
@@ -1819,7 +1819,7 @@ const setupActivityTreeListeners = () => {
1819
1819
  window.activityTreeInstance = activityTree;
1820
1820
  window.activityTree = () => activityTree; // For debugging
1821
1821
  }
1822
-
1822
+
1823
1823
  setTimeout(() => {
1824
1824
  console.log('Attempting to initialize Activity Tree visualization...');
1825
1825
  activityTree.initialize();
@@ -1850,7 +1850,7 @@ const setupActivityTreeListeners = () => {
1850
1850
  console.log('Activity tab is active on load, initializing tree...');
1851
1851
  initializeActivityTree();
1852
1852
  }
1853
-
1853
+
1854
1854
  const activityPanel = document.getElementById('activity-tab');
1855
1855
  if (activityPanel && activityPanel.classList.contains('active')) {
1856
1856
  console.log('Activity panel is active on load, initializing tree...');