claude-code-templates 1.15.0 → 1.15.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 (101) hide show
  1. package/README.md +7 -7
  2. package/bin/create-claude-config.js +15 -8
  3. package/package.json +2 -3
  4. package/src/analytics/core/AgentAnalyzer.js +17 -3
  5. package/src/analytics/core/ProcessDetector.js +23 -7
  6. package/src/analytics/core/StateCalculator.js +102 -33
  7. package/src/analytics/data/DataCache.js +7 -7
  8. package/src/analytics-web/chats_mobile.html +2590 -0
  9. package/src/analytics-web/components/App.js +10 -10
  10. package/src/analytics-web/components/SessionTimer.js +1 -1
  11. package/src/analytics-web/components/Sidebar.js +5 -14
  12. package/src/analytics-web/index.html +932 -78
  13. package/src/analytics.js +263 -5
  14. package/src/chats-mobile.js +682 -0
  15. package/src/claude-api-proxy.js +460 -0
  16. package/src/file-operations.js +422 -83
  17. package/src/health-check.js +310 -0
  18. package/src/index.js +944 -56
  19. package/src/tracking-service.js +31 -34
  20. package/components/agents/api-security-audit.md +0 -92
  21. package/components/agents/database-optimization.md +0 -94
  22. package/components/agents/react-performance-optimization.md +0 -64
  23. package/components/commands/check-file.md +0 -53
  24. package/components/commands/generate-tests.md +0 -68
  25. package/components/mcps/deepgraph-nextjs.json +0 -12
  26. package/components/mcps/deepgraph-react.json +0 -12
  27. package/components/mcps/deepgraph-typescript.json +0 -12
  28. package/components/mcps/deepgraph-vue.json +0 -12
  29. package/components/mcps/filesystem-access.json +0 -12
  30. package/components/mcps/github-integration.json +0 -11
  31. package/components/mcps/memory-integration.json +0 -8
  32. package/components/mcps/mysql-integration.json +0 -11
  33. package/components/mcps/postgresql-integration.json +0 -11
  34. package/components/mcps/web-fetch.json +0 -8
  35. package/src/analytics-web/components/AgentsPage.js +0 -4761
  36. package/templates/common/.claude/commands/git-workflow.md +0 -239
  37. package/templates/common/.claude/commands/project-setup.md +0 -316
  38. package/templates/common/.mcp.json +0 -41
  39. package/templates/common/CLAUDE.md +0 -109
  40. package/templates/common/README.md +0 -96
  41. package/templates/go/.mcp.json +0 -78
  42. package/templates/go/README.md +0 -25
  43. package/templates/javascript-typescript/.claude/commands/api-endpoint.md +0 -51
  44. package/templates/javascript-typescript/.claude/commands/debug.md +0 -52
  45. package/templates/javascript-typescript/.claude/commands/lint.md +0 -48
  46. package/templates/javascript-typescript/.claude/commands/npm-scripts.md +0 -48
  47. package/templates/javascript-typescript/.claude/commands/refactor.md +0 -55
  48. package/templates/javascript-typescript/.claude/commands/test.md +0 -61
  49. package/templates/javascript-typescript/.claude/commands/typescript-migrate.md +0 -51
  50. package/templates/javascript-typescript/.claude/settings.json +0 -142
  51. package/templates/javascript-typescript/.mcp.json +0 -80
  52. package/templates/javascript-typescript/CLAUDE.md +0 -185
  53. package/templates/javascript-typescript/README.md +0 -259
  54. package/templates/javascript-typescript/examples/angular-app/.claude/commands/components.md +0 -63
  55. package/templates/javascript-typescript/examples/angular-app/.claude/commands/services.md +0 -62
  56. package/templates/javascript-typescript/examples/node-api/.claude/commands/api-endpoint.md +0 -46
  57. package/templates/javascript-typescript/examples/node-api/.claude/commands/database.md +0 -56
  58. package/templates/javascript-typescript/examples/node-api/.claude/commands/middleware.md +0 -61
  59. package/templates/javascript-typescript/examples/node-api/.claude/commands/route.md +0 -57
  60. package/templates/javascript-typescript/examples/node-api/CLAUDE.md +0 -102
  61. package/templates/javascript-typescript/examples/react-app/.claude/commands/component.md +0 -29
  62. package/templates/javascript-typescript/examples/react-app/.claude/commands/hooks.md +0 -44
  63. package/templates/javascript-typescript/examples/react-app/.claude/commands/state-management.md +0 -45
  64. package/templates/javascript-typescript/examples/react-app/CLAUDE.md +0 -81
  65. package/templates/javascript-typescript/examples/react-app/agents/react-performance-optimization.md +0 -530
  66. package/templates/javascript-typescript/examples/react-app/agents/react-state-management.md +0 -295
  67. package/templates/javascript-typescript/examples/vue-app/.claude/commands/components.md +0 -46
  68. package/templates/javascript-typescript/examples/vue-app/.claude/commands/composables.md +0 -51
  69. package/templates/python/.claude/commands/lint.md +0 -111
  70. package/templates/python/.claude/commands/test.md +0 -73
  71. package/templates/python/.claude/settings.json +0 -153
  72. package/templates/python/.mcp.json +0 -78
  73. package/templates/python/CLAUDE.md +0 -276
  74. package/templates/python/examples/django-app/.claude/commands/admin.md +0 -264
  75. package/templates/python/examples/django-app/.claude/commands/django-model.md +0 -124
  76. package/templates/python/examples/django-app/.claude/commands/views.md +0 -222
  77. package/templates/python/examples/django-app/CLAUDE.md +0 -313
  78. package/templates/python/examples/django-app/agents/django-api-security.md +0 -642
  79. package/templates/python/examples/django-app/agents/django-database-optimization.md +0 -752
  80. package/templates/python/examples/fastapi-app/.claude/commands/api-endpoints.md +0 -513
  81. package/templates/python/examples/fastapi-app/.claude/commands/auth.md +0 -775
  82. package/templates/python/examples/fastapi-app/.claude/commands/database.md +0 -657
  83. package/templates/python/examples/fastapi-app/.claude/commands/deployment.md +0 -160
  84. package/templates/python/examples/fastapi-app/.claude/commands/testing.md +0 -927
  85. package/templates/python/examples/fastapi-app/CLAUDE.md +0 -229
  86. package/templates/python/examples/flask-app/.claude/commands/app-factory.md +0 -384
  87. package/templates/python/examples/flask-app/.claude/commands/blueprint.md +0 -243
  88. package/templates/python/examples/flask-app/.claude/commands/database.md +0 -410
  89. package/templates/python/examples/flask-app/.claude/commands/deployment.md +0 -620
  90. package/templates/python/examples/flask-app/.claude/commands/flask-route.md +0 -217
  91. package/templates/python/examples/flask-app/.claude/commands/testing.md +0 -559
  92. package/templates/python/examples/flask-app/CLAUDE.md +0 -391
  93. package/templates/ruby/.claude/commands/model.md +0 -360
  94. package/templates/ruby/.claude/commands/test.md +0 -480
  95. package/templates/ruby/.claude/settings.json +0 -146
  96. package/templates/ruby/.mcp.json +0 -83
  97. package/templates/ruby/CLAUDE.md +0 -284
  98. package/templates/ruby/examples/rails-app/.claude/commands/authentication.md +0 -490
  99. package/templates/ruby/examples/rails-app/CLAUDE.md +0 -376
  100. package/templates/rust/.mcp.json +0 -78
  101. package/templates/rust/README.md +0 -26
package/README.md CHANGED
@@ -51,14 +51,14 @@ npx claude-code-templates@latest --health-check
51
51
 
52
52
  ## 📖 Documentation
53
53
 
54
- **[📚 Complete Documentation](https://aitmpl.com/docu/)** - Comprehensive guides, examples, and API reference
54
+ **[📚 Complete Documentation](https://docs.aitmpl.com/)** - Comprehensive guides, examples, and API reference
55
55
 
56
56
  Quick links:
57
- - [Getting Started](https://aitmpl.com/docu/docs/intro) - Installation and first steps
58
- - [Project Setup](https://aitmpl.com/docu/docs/project-setup/interactive-setup) - Configure your projects
59
- - [Analytics Dashboard](https://aitmpl.com/docu/docs/analytics/overview) - Real-time monitoring
60
- - [Individual Components](https://aitmpl.com/docu/docs/components/overview) - Agents, Commands, MCPs
61
- - [CLI Options](https://aitmpl.com/docu/docs/cli-options) - All available commands
57
+ - [Getting Started](https://docs.aitmpl.com/docs/intro) - Installation and first steps
58
+ - [Project Setup](https://docs.aitmpl.com/docs/project-setup/interactive-setup) - Configure your projects
59
+ - [Analytics Dashboard](https://docs.aitmpl.com/docs/analytics/overview) - Real-time monitoring
60
+ - [Individual Components](https://docs.aitmpl.com/docs/components/overview) - Agents, Commands, MCPs
61
+ - [CLI Options](https://docs.aitmpl.com/docs/cli-options) - All available commands
62
62
 
63
63
  ## 🤝 Contributing
64
64
 
@@ -71,7 +71,7 @@ MIT License - see the [LICENSE](LICENSE) file for details.
71
71
  ## 🔗 Links
72
72
 
73
73
  - **🌐 Browse Components**: [aitmpl.com](https://aitmpl.com)
74
- - **📚 Documentation**: [aitmpl.com/docu](https://aitmpl.com/docu)
74
+ - **📚 Documentation**: [docs.aitmpl.com](https://docs.aitmpl.com)
75
75
  - **🐛 Issues**: [GitHub Issues](https://github.com/davila7/claude-code-templates/issues)
76
76
  - **💬 Discussions**: [GitHub Discussions](https://github.com/davila7/claude-code-templates/discussions)
77
77
 
@@ -35,16 +35,17 @@ console.log(chalk.hex('#F97316')('═══════════════
35
35
  console.log(
36
36
  chalk.hex('#D97706')('🚀 Setup Claude Code for any project language 🚀') +
37
37
  chalk.gray(`\n v${pkg.version}\n\n`) +
38
- chalk.blue('🌐 Templates: ') + chalk.underline('https://davila7.github.io/claude-code-templates/') + '\n' +
39
- chalk.blue('📖 Documentation: ') + chalk.underline('https://davila7.github.io/claude-code-templates/docu/')
38
+ chalk.blue('🌐 Templates: ') + chalk.underline('https://aitmpl.com') + '\n' +
39
+ chalk.blue('📖 Documentation: ') + chalk.underline('https://docs.aitmpl.com') + '\n'
40
40
  );
41
41
 
42
42
  program
43
43
  .name('create-claude-config')
44
44
  .description('Setup Claude Code configurations for different programming languages')
45
45
  .version(require('../package.json').version)
46
- .option('-l, --language <language>', 'specify programming language')
47
- .option('-f, --framework <framework>', 'specify framework')
46
+ .option('-l, --language <language>', 'specify programming language (deprecated, use --template)')
47
+ .option('-f, --framework <framework>', 'specify framework (deprecated, use --template)')
48
+ .option('-t, --template <template>', 'specify template (e.g., common, javascript-typescript, python, ruby)')
48
49
  .option('-d, --directory <directory>', 'target directory (default: current directory)')
49
50
  .option('-y, --yes', 'skip prompts and use defaults')
50
51
  .option('--dry-run', 'show what would be copied without actually copying')
@@ -52,11 +53,17 @@ program
52
53
  .option('--hook-stats, --hooks-stats', 'analyze existing automation hooks and offer optimization')
53
54
  .option('--mcp-stats, --mcps-stats', 'analyze existing MCP server configurations and offer optimization')
54
55
  .option('--analytics', 'launch real-time Claude Code analytics dashboard')
55
- .option('--chats, --agents', 'launch Claude Code chats/agents dashboard (opens directly to conversations)')
56
+ .option('--chats', 'launch mobile-first chats interface (AI-optimized for mobile devices)')
57
+ .option('--agents', 'launch Claude Code agents dashboard (opens directly to conversations)')
58
+ .option('--chats-mobile', 'launch mobile-first chats interface (AI-optimized for mobile devices)')
59
+ .option('--tunnel', 'enable Cloudflare Tunnel for remote access (use with --analytics or --chats)')
60
+ .option('--verbose', 'enable verbose logging for debugging and development')
56
61
  .option('--health-check, --health, --check, --verify', 'run comprehensive health check to verify Claude Code setup')
57
- .option('--agent <agent>', 'install specific agent component')
58
- .option('--command <command>', 'install specific command component')
59
- .option('--mcp <mcp>', 'install specific MCP component')
62
+ .option('--agent <agent>', 'install specific agent component (supports comma-separated values)')
63
+ .option('--command <command>', 'install specific command component (supports comma-separated values)')
64
+ .option('--mcp <mcp>', 'install specific MCP component (supports comma-separated values)')
65
+ .option('--workflow <workflow>', 'install workflow from hash (#hash) OR workflow YAML (base64 encoded) when used with --agent/--command/--mcp')
66
+ .option('--prompt <prompt>', 'execute the provided prompt in Claude Code after installation')
60
67
  .action(async (options) => {
61
68
  try {
62
69
  await createClaudeConfig(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-templates",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "CLI tool to setup Claude Code configurations with framework-specific commands, automation hooks and MCP Servers for your projects",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -69,6 +69,7 @@
69
69
  "inquirer": "^8.2.6",
70
70
  "open": "^8.4.2",
71
71
  "ora": "^5.4.1",
72
+ "uuid": "^11.1.0",
72
73
  "ws": "^8.18.3"
73
74
  },
74
75
  "engines": {
@@ -85,8 +86,6 @@
85
86
  "files": [
86
87
  "bin/",
87
88
  "src/",
88
- "templates/",
89
- "components/",
90
89
  "README.md"
91
90
  ],
92
91
  "devDependencies": {
@@ -287,11 +287,25 @@ class AgentAnalyzer {
287
287
  const content = await fs.readFile(filePath, 'utf8');
288
288
  const lines = content.trim().split('\n').filter(line => line.trim());
289
289
 
290
- return lines.map(line => {
290
+ return lines.map((line, index) => {
291
291
  try {
292
- return JSON.parse(line);
292
+ // Skip empty or whitespace-only lines
293
+ if (!line.trim()) {
294
+ return null;
295
+ }
296
+
297
+ // Basic validation - must start with { and end with }
298
+ const trimmed = line.trim();
299
+ if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) {
300
+ return null;
301
+ }
302
+
303
+ return JSON.parse(trimmed);
293
304
  } catch (error) {
294
- console.warn(`Error parsing JSONL line in ${filePath}:`, error.message);
305
+ // Only log the error occasionally to avoid spam
306
+ if (index % 10 === 0) {
307
+ console.warn(`Error parsing JSONL line ${index + 1} in ${filePath}:`, error.message.substring(0, 100));
308
+ }
295
309
  return null;
296
310
  }
297
311
  }).filter(Boolean);
@@ -29,22 +29,38 @@ class ProcessDetector {
29
29
 
30
30
  return new Promise((resolve) => {
31
31
  // Search for processes containing 'claude' but exclude our own analytics process and system processes
32
- exec('ps aux | grep -i claude | grep -v grep | grep -v analytics | grep -v "/Applications/Claude.app" | grep -v "npm start"', (error, stdout) => {
32
+ exec('ps aux | grep -i claude | grep -v grep | grep -v analytics | grep -v "/Applications/Claude.app" | grep -v "npm start" | grep -v chats-mobile', (error, stdout) => {
33
33
  if (error) {
34
34
  resolve([]);
35
35
  return;
36
36
  }
37
37
 
38
+ console.log('🔍 Raw Claude processes output:', stdout); // Debug output
39
+
38
40
  const processes = stdout.split('\n')
39
41
  .filter(line => line.trim())
40
42
  .filter(line => {
41
- // Only include actual Claude CLI processes, not system processes
43
+ // More flexible Claude CLI process detection
42
44
  const fullCommand = line.split(/\s+/).slice(10).join(' ');
43
- return fullCommand.includes('claude') &&
44
- !fullCommand.includes('chrome_crashpad_handler') &&
45
- !fullCommand.includes('create-claude-config') &&
46
- !fullCommand.includes('node bin/') &&
47
- fullCommand.trim() === 'claude'; // Only the basic claude command
45
+ const isClaudeProcess = (
46
+ fullCommand.includes('claude') &&
47
+ !fullCommand.includes('chrome_crashpad_handler') &&
48
+ !fullCommand.includes('create-claude-config') &&
49
+ !fullCommand.includes('chats-mobile') &&
50
+ !fullCommand.includes('analytics') &&
51
+ // Allow various Claude CLI invocations
52
+ (fullCommand.trim() === 'claude' ||
53
+ fullCommand.includes('claude --') ||
54
+ fullCommand.includes('claude ') ||
55
+ fullCommand.includes('/claude') ||
56
+ fullCommand.includes('bin/claude'))
57
+ );
58
+
59
+ if (isClaudeProcess) {
60
+ console.log('✅ Found Claude process:', fullCommand);
61
+ }
62
+
63
+ return isClaudeProcess;
48
64
  })
49
65
  .map(line => {
50
66
  const parts = line.split(/\s+/);
@@ -19,10 +19,21 @@ class StateCalculator {
19
19
  */
20
20
  determineConversationState(messages, lastModified, runningProcess = null) {
21
21
  const now = new Date();
22
- const timeDiff = now - lastModified;
23
- const minutesAgo = timeDiff / (1000 * 60);
22
+ const fileTimeDiff = now - lastModified;
23
+ const fileMinutesAgo = fileTimeDiff / (1000 * 60);
24
+
25
+ // Enhanced detection: Look for real Claude Code activity indicators
26
+ const claudeActivity = this.detectRealClaudeActivity(messages, lastModified);
27
+ if (claudeActivity.isActive) {
28
+ return claudeActivity.status;
29
+ }
30
+
31
+ // If there's very recent file activity (within 5 minutes), consider it active
32
+ if (fileMinutesAgo < 5) {
33
+ return 'Claude Code working...';
34
+ }
24
35
 
25
- // If there's an active process, use simpler and more stable logic
36
+ // If there's an active process, prioritize that
26
37
  if (runningProcess && runningProcess.hasActiveCommand) {
27
38
  // Check conversation flow first for immediate response
28
39
  if (messages.length > 0) {
@@ -32,39 +43,30 @@ class StateCalculator {
32
43
  const lastMessageMinutesAgo = (now - lastMessageTime) / (1000 * 60);
33
44
 
34
45
  if (lastMessage.role === 'user') {
35
- // User sent message - be more conservative about "working" state
36
- if (lastMessageMinutesAgo < 1) {
46
+ // User sent message - be more generous about active state
47
+ if (lastMessageMinutesAgo < 3) {
37
48
  return 'Claude Code working...';
38
- } else {
49
+ } else if (lastMessageMinutesAgo < 10) {
39
50
  return 'Awaiting response...';
51
+ } else {
52
+ return 'Active session';
40
53
  }
41
54
  } else if (lastMessage.role === 'assistant') {
42
- // Claude responded - check if file activity indicates continued work
43
- const fileTimeDiff = (now - lastModified) / 1000; // seconds
44
- if (fileTimeDiff < 30) {
45
- return 'Claude Code working...';
46
- }
47
- // Use broader time ranges for more stability
48
- if (lastMessageMinutesAgo < 5) {
55
+ // Claude responded - if there's an active process, still active
56
+ if (lastMessageMinutesAgo < 10) {
49
57
  return 'Awaiting user input...';
50
58
  } else {
51
- return 'User typing...';
59
+ return 'Active session';
52
60
  }
53
61
  }
54
62
  }
55
63
 
56
- // Very recent file activity = Claude working (fallback)
57
- const fileTimeDiff = (now - lastModified) / 1000; // seconds
58
- if (fileTimeDiff < 30) {
59
- return 'Claude Code working...';
60
- }
61
-
62
- // Default for active process
63
- return 'Awaiting user input...';
64
+ // Default for active process - be more generous
65
+ return 'Active session';
64
66
  }
65
67
 
66
68
  if (messages.length === 0) {
67
- return minutesAgo < 5 ? 'Waiting for input...' : 'Idle';
69
+ return fileMinutesAgo < 5 ? 'Waiting for input...' : 'Idle';
68
70
  }
69
71
 
70
72
  // Sort messages by timestamp to get the actual conversation flow
@@ -73,28 +75,32 @@ class StateCalculator {
73
75
  const lastMessageTime = new Date(lastMessage.timestamp);
74
76
  const lastMessageMinutesAgo = (now - lastMessageTime) / (1000 * 60);
75
77
 
76
- // Simplified and more stable state logic
78
+ // More generous logic for active conversations
77
79
  if (lastMessage.role === 'user') {
78
80
  // User sent last message
79
- if (lastMessageMinutesAgo < 1) {
81
+ if (lastMessageMinutesAgo < 3) {
80
82
  return 'Claude Code working...';
81
- } else if (lastMessageMinutesAgo < 5) {
83
+ } else if (lastMessageMinutesAgo < 10) {
82
84
  return 'Awaiting response...';
83
- } else {
85
+ } else if (lastMessageMinutesAgo < 30) {
84
86
  return 'User typing...';
87
+ } else {
88
+ return 'Recently active';
85
89
  }
86
90
  } else if (lastMessage.role === 'assistant') {
87
- // Assistant sent last message - consolidate similar states
88
- if (lastMessageMinutesAgo < 5) {
91
+ // Assistant sent last message
92
+ if (lastMessageMinutesAgo < 10) {
89
93
  return 'Awaiting user input...';
90
- } else {
94
+ } else if (lastMessageMinutesAgo < 30) {
91
95
  return 'User typing...';
96
+ } else {
97
+ return 'Recently active';
92
98
  }
93
99
  }
94
100
 
95
- // Fallback states
96
- if (minutesAgo < 5) return 'Recently active';
97
- if (minutesAgo < 60) return 'Idle';
101
+ // Fallback states - be more generous about "active" state
102
+ if (fileMinutesAgo < 10 || lastMessageMinutesAgo < 30) return 'Recently active';
103
+ if (fileMinutesAgo < 60 || lastMessageMinutesAgo < 120) return 'Idle';
98
104
  return 'Inactive';
99
105
  }
100
106
 
@@ -164,6 +170,69 @@ class StateCalculator {
164
170
  return 'inactive';
165
171
  }
166
172
 
173
+ /**
174
+ * Detect real Claude Code activity based on conversation patterns and file activity
175
+ * @param {Array} messages - Conversation messages
176
+ * @param {Date} lastModified - File last modification time
177
+ * @returns {Object} Activity detection result
178
+ */
179
+ detectRealClaudeActivity(messages, lastModified) {
180
+ const now = new Date();
181
+ const fileMinutesAgo = (now - lastModified) / (1000 * 60);
182
+
183
+ if (!messages || messages.length === 0) {
184
+ return { isActive: false, status: 'No messages' };
185
+ }
186
+
187
+ // Sort messages by timestamp
188
+ const sortedMessages = messages.sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp));
189
+ const lastMessage = sortedMessages[sortedMessages.length - 1];
190
+ const lastMessageTime = new Date(lastMessage.timestamp);
191
+ const messageMinutesAgo = (now - lastMessageTime) / (1000 * 60);
192
+
193
+ // Real activity indicators:
194
+
195
+ // 1. Very recent file modification (Claude Code just wrote to the conversation file)
196
+ if (fileMinutesAgo < 1) {
197
+ return { isActive: true, status: 'Claude Code working...' };
198
+ }
199
+
200
+ // 2. Recent user message with recent file activity (Claude is processing)
201
+ if (lastMessage.role === 'user' && messageMinutesAgo < 5 && fileMinutesAgo < 10) {
202
+ return { isActive: true, status: 'Claude Code working...' };
203
+ }
204
+
205
+ // 3. Recent assistant message with very recent file activity (might still be working)
206
+ if (lastMessage.role === 'assistant' && messageMinutesAgo < 2 && fileMinutesAgo < 5) {
207
+ return { isActive: true, status: 'Claude Code finishing...' };
208
+ }
209
+
210
+ // 4. Look for tool activity patterns (tools often indicate active sessions)
211
+ const recentMessages = sortedMessages.slice(-3);
212
+ const hasRecentTools = recentMessages.some(msg =>
213
+ (Array.isArray(msg.content) && msg.content.some(block => block.type === 'tool_use')) ||
214
+ (msg.toolResults && msg.toolResults.length > 0)
215
+ );
216
+
217
+ if (hasRecentTools && messageMinutesAgo < 10 && fileMinutesAgo < 15) {
218
+ return { isActive: true, status: 'Active session' };
219
+ }
220
+
221
+ // 5. Rapid message exchange pattern (back-and-forth conversation)
222
+ if (sortedMessages.length >= 2) {
223
+ const lastTwoMessages = sortedMessages.slice(-2);
224
+ const timeBetweenLast = Math.abs(
225
+ new Date(lastTwoMessages[1].timestamp) - new Date(lastTwoMessages[0].timestamp)
226
+ ) / (1000 * 60); // minutes
227
+
228
+ if (timeBetweenLast < 5 && messageMinutesAgo < 15 && fileMinutesAgo < 20) {
229
+ return { isActive: true, status: 'Active conversation' };
230
+ }
231
+ }
232
+
233
+ return { isActive: false, status: null };
234
+ }
235
+
167
236
  /**
168
237
  * Get CSS class for conversation state styling
169
238
  * @param {string} conversationState - The conversation state
@@ -33,14 +33,14 @@ class DataCache {
33
33
  projectStats: new Map(), // projectPath -> { data, timestamp }
34
34
  };
35
35
 
36
- // Cache configuration (reduced TTL for aggressive memory management)
36
+ // Cache configuration - balanced for performance vs memory
37
37
  this.config = {
38
- fileContentTTL: 30000, // 30 seconds for file content (reduced from 60s)
39
- parsedDataTTL: 15000, // 15 seconds for parsed data (reduced from 30s)
40
- computationTTL: 10000, // 10 seconds for expensive computations (reduced from 20s)
41
- metadataTTL: 5000, // 5 seconds for metadata (reduced from 10s)
42
- processTTL: 500, // 500ms for process data
43
- maxCacheSize: 25, // Aggressively reduced to 25 to prevent memory buildup
38
+ fileContentTTL: 60000, // 1 minute for file content
39
+ parsedDataTTL: 30000, // 30 seconds for parsed data
40
+ computationTTL: 20000, // 20 seconds for expensive computations
41
+ metadataTTL: 10000, // 10 seconds for metadata
42
+ processTTL: 1000, // 1 second for process data
43
+ maxCacheSize: 50, // Increased to reduce evictions
44
44
  };
45
45
 
46
46
  // Dependency tracking for smart invalidation