kollabor 0.4.9__py3-none-any.whl → 0.4.15__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.
- agents/__init__.py +2 -0
- agents/coder/__init__.py +0 -0
- agents/coder/agent.json +4 -0
- agents/coder/api-integration.md +2150 -0
- agents/coder/cli-pretty.md +765 -0
- agents/coder/code-review.md +1092 -0
- agents/coder/database-design.md +1525 -0
- agents/coder/debugging.md +1102 -0
- agents/coder/dependency-management.md +1397 -0
- agents/coder/git-workflow.md +1099 -0
- agents/coder/refactoring.md +1454 -0
- agents/coder/security-hardening.md +1732 -0
- agents/coder/system_prompt.md +1448 -0
- agents/coder/tdd.md +1367 -0
- agents/creative-writer/__init__.py +0 -0
- agents/creative-writer/agent.json +4 -0
- agents/creative-writer/character-development.md +1852 -0
- agents/creative-writer/dialogue-craft.md +1122 -0
- agents/creative-writer/plot-structure.md +1073 -0
- agents/creative-writer/revision-editing.md +1484 -0
- agents/creative-writer/system_prompt.md +690 -0
- agents/creative-writer/worldbuilding.md +2049 -0
- agents/data-analyst/__init__.py +30 -0
- agents/data-analyst/agent.json +4 -0
- agents/data-analyst/data-visualization.md +992 -0
- agents/data-analyst/exploratory-data-analysis.md +1110 -0
- agents/data-analyst/pandas-data-manipulation.md +1081 -0
- agents/data-analyst/sql-query-optimization.md +881 -0
- agents/data-analyst/statistical-analysis.md +1118 -0
- agents/data-analyst/system_prompt.md +928 -0
- agents/default/__init__.py +0 -0
- agents/default/agent.json +4 -0
- agents/default/dead-code.md +794 -0
- agents/default/explore-agent-system.md +585 -0
- agents/default/system_prompt.md +1448 -0
- agents/kollabor/__init__.py +0 -0
- agents/kollabor/analyze-plugin-lifecycle.md +175 -0
- agents/kollabor/analyze-terminal-rendering.md +388 -0
- agents/kollabor/code-review.md +1092 -0
- agents/kollabor/debug-mcp-integration.md +521 -0
- agents/kollabor/debug-plugin-hooks.md +547 -0
- agents/kollabor/debugging.md +1102 -0
- agents/kollabor/dependency-management.md +1397 -0
- agents/kollabor/git-workflow.md +1099 -0
- agents/kollabor/inspect-llm-conversation.md +148 -0
- agents/kollabor/monitor-event-bus.md +558 -0
- agents/kollabor/profile-performance.md +576 -0
- agents/kollabor/refactoring.md +1454 -0
- agents/kollabor/system_prompt copy.md +1448 -0
- agents/kollabor/system_prompt.md +757 -0
- agents/kollabor/trace-command-execution.md +178 -0
- agents/kollabor/validate-config.md +879 -0
- agents/research/__init__.py +0 -0
- agents/research/agent.json +4 -0
- agents/research/architecture-mapping.md +1099 -0
- agents/research/codebase-analysis.md +1077 -0
- agents/research/dependency-audit.md +1027 -0
- agents/research/performance-profiling.md +1047 -0
- agents/research/security-review.md +1359 -0
- agents/research/system_prompt.md +492 -0
- agents/technical-writer/__init__.py +0 -0
- agents/technical-writer/agent.json +4 -0
- agents/technical-writer/api-documentation.md +2328 -0
- agents/technical-writer/changelog-management.md +1181 -0
- agents/technical-writer/readme-writing.md +1360 -0
- agents/technical-writer/style-guide.md +1410 -0
- agents/technical-writer/system_prompt.md +653 -0
- agents/technical-writer/tutorial-creation.md +1448 -0
- core/__init__.py +0 -2
- core/application.py +343 -88
- core/cli.py +229 -10
- core/commands/menu_renderer.py +463 -59
- core/commands/registry.py +14 -9
- core/commands/system_commands.py +2461 -14
- core/config/loader.py +151 -37
- core/config/service.py +18 -6
- core/events/bus.py +29 -9
- core/events/executor.py +205 -75
- core/events/models.py +27 -8
- core/fullscreen/command_integration.py +20 -24
- core/fullscreen/components/__init__.py +10 -1
- core/fullscreen/components/matrix_components.py +1 -2
- core/fullscreen/components/space_shooter_components.py +654 -0
- core/fullscreen/plugin.py +5 -0
- core/fullscreen/renderer.py +52 -13
- core/fullscreen/session.py +52 -15
- core/io/__init__.py +29 -5
- core/io/buffer_manager.py +6 -1
- core/io/config_status_view.py +7 -29
- core/io/core_status_views.py +267 -347
- core/io/input/__init__.py +25 -0
- core/io/input/command_mode_handler.py +711 -0
- core/io/input/display_controller.py +128 -0
- core/io/input/hook_registrar.py +286 -0
- core/io/input/input_loop_manager.py +421 -0
- core/io/input/key_press_handler.py +502 -0
- core/io/input/modal_controller.py +1011 -0
- core/io/input/paste_processor.py +339 -0
- core/io/input/status_modal_renderer.py +184 -0
- core/io/input_errors.py +5 -1
- core/io/input_handler.py +211 -2452
- core/io/key_parser.py +7 -0
- core/io/layout.py +15 -3
- core/io/message_coordinator.py +111 -2
- core/io/message_renderer.py +129 -4
- core/io/status_renderer.py +147 -607
- core/io/terminal_renderer.py +97 -51
- core/io/terminal_state.py +21 -4
- core/io/visual_effects.py +816 -165
- core/llm/agent_manager.py +1063 -0
- core/llm/api_adapters/__init__.py +44 -0
- core/llm/api_adapters/anthropic_adapter.py +432 -0
- core/llm/api_adapters/base.py +241 -0
- core/llm/api_adapters/openai_adapter.py +326 -0
- core/llm/api_communication_service.py +167 -113
- core/llm/conversation_logger.py +322 -16
- core/llm/conversation_manager.py +556 -30
- core/llm/file_operations_executor.py +84 -32
- core/llm/llm_service.py +934 -103
- core/llm/mcp_integration.py +541 -57
- core/llm/message_display_service.py +135 -18
- core/llm/plugin_sdk.py +1 -2
- core/llm/profile_manager.py +1183 -0
- core/llm/response_parser.py +274 -56
- core/llm/response_processor.py +16 -3
- core/llm/tool_executor.py +6 -1
- core/logging/__init__.py +2 -0
- core/logging/setup.py +34 -6
- core/models/resume.py +54 -0
- core/plugins/__init__.py +4 -2
- core/plugins/base.py +127 -0
- core/plugins/collector.py +23 -161
- core/plugins/discovery.py +37 -3
- core/plugins/factory.py +6 -12
- core/plugins/registry.py +5 -17
- core/ui/config_widgets.py +128 -28
- core/ui/live_modal_renderer.py +2 -1
- core/ui/modal_actions.py +5 -0
- core/ui/modal_overlay_renderer.py +0 -60
- core/ui/modal_renderer.py +268 -7
- core/ui/modal_state_manager.py +29 -4
- core/ui/widgets/base_widget.py +7 -0
- core/updates/__init__.py +10 -0
- core/updates/version_check_service.py +348 -0
- core/updates/version_comparator.py +103 -0
- core/utils/config_utils.py +685 -526
- core/utils/plugin_utils.py +1 -1
- core/utils/session_naming.py +111 -0
- fonts/LICENSE +21 -0
- fonts/README.md +46 -0
- fonts/SymbolsNerdFont-Regular.ttf +0 -0
- fonts/SymbolsNerdFontMono-Regular.ttf +0 -0
- fonts/__init__.py +44 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/METADATA +54 -4
- kollabor-0.4.15.dist-info/RECORD +228 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/top_level.txt +2 -0
- plugins/agent_orchestrator/__init__.py +39 -0
- plugins/agent_orchestrator/activity_monitor.py +181 -0
- plugins/agent_orchestrator/file_attacher.py +77 -0
- plugins/agent_orchestrator/message_injector.py +135 -0
- plugins/agent_orchestrator/models.py +48 -0
- plugins/agent_orchestrator/orchestrator.py +403 -0
- plugins/agent_orchestrator/plugin.py +976 -0
- plugins/agent_orchestrator/xml_parser.py +191 -0
- plugins/agent_orchestrator_plugin.py +9 -0
- plugins/enhanced_input/box_styles.py +1 -0
- plugins/enhanced_input/color_engine.py +19 -4
- plugins/enhanced_input/config.py +2 -2
- plugins/enhanced_input_plugin.py +61 -11
- plugins/fullscreen/__init__.py +6 -2
- plugins/fullscreen/example_plugin.py +1035 -222
- plugins/fullscreen/setup_wizard_plugin.py +592 -0
- plugins/fullscreen/space_shooter_plugin.py +131 -0
- plugins/hook_monitoring_plugin.py +436 -78
- plugins/query_enhancer_plugin.py +66 -30
- plugins/resume_conversation_plugin.py +1494 -0
- plugins/save_conversation_plugin.py +98 -32
- plugins/system_commands_plugin.py +70 -56
- plugins/tmux_plugin.py +154 -78
- plugins/workflow_enforcement_plugin.py +94 -92
- system_prompt/default.md +952 -886
- core/io/input_mode_manager.py +0 -402
- core/io/modal_interaction_handler.py +0 -315
- core/io/raw_input_processor.py +0 -946
- core/storage/__init__.py +0 -5
- core/storage/state_manager.py +0 -84
- core/ui/widget_integration.py +0 -222
- core/utils/key_reader.py +0 -171
- kollabor-0.4.9.dist-info/RECORD +0 -128
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/WHEEL +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/entry_points.txt +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
<!-- Profile and identify performance bottlenecks in the application -->
|
|
2
|
+
|
|
3
|
+
skill name: profile-performance
|
|
4
|
+
|
|
5
|
+
purpose:
|
|
6
|
+
identify performance bottlenecks across the application.
|
|
7
|
+
measures render loop performance, llm api call latency,
|
|
8
|
+
plugin execution time, and memory usage to pinpoint
|
|
9
|
+
slow components and optimize the user experience.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
when to use:
|
|
13
|
+
[ ] application feels slow or sluggish
|
|
14
|
+
[ ] render loop causing high cpu usage
|
|
15
|
+
[ ] llm responses taking longer than expected
|
|
16
|
+
[ ] plugins causing delays
|
|
17
|
+
[ ] memory usage growing over time
|
|
18
|
+
[ ] terminal flickering or stuttering
|
|
19
|
+
[ ] want to optimize specific components
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
methodology:
|
|
23
|
+
|
|
24
|
+
phase 1: render loop profiling
|
|
25
|
+
measure render fps, check render cache efficiency,
|
|
26
|
+
identify expensive render operations
|
|
27
|
+
|
|
28
|
+
phase 2: llm api latency analysis
|
|
29
|
+
measure api call timing, check connection pool health,
|
|
30
|
+
identify network-related bottlenecks
|
|
31
|
+
|
|
32
|
+
phase 3: plugin performance audit
|
|
33
|
+
measure hook execution time, identify slow plugins,
|
|
34
|
+
check for blocking operations
|
|
35
|
+
|
|
36
|
+
phase 4: memory and resource profiling
|
|
37
|
+
check memory usage patterns, analyze conversation
|
|
38
|
+
history size, identify memory leaks
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
tools and commands:
|
|
42
|
+
|
|
43
|
+
core files to read:
|
|
44
|
+
<read>file>core/application.py</file>
|
|
45
|
+
<read>file>core/io/terminal_renderer.py</file>
|
|
46
|
+
<read>file>core/llm/api_communication_service.py</read>
|
|
47
|
+
<read>file>core/events/executor.py</file>
|
|
48
|
+
|
|
49
|
+
configuration files:
|
|
50
|
+
<read>file>.kollabor-cli/config.json</file>
|
|
51
|
+
|
|
52
|
+
log files for performance data:
|
|
53
|
+
<read>file>.kollabor-cli/logs/kollabor.log</read>
|
|
54
|
+
|
|
55
|
+
check render fps configuration:
|
|
56
|
+
<terminal>grep -i "render_fps\|render_cache" .kollabor-cli/config.json</terminal>
|
|
57
|
+
|
|
58
|
+
check render performance logs:
|
|
59
|
+
<terminal>grep -i "render" .kollabor-cli/logs/kollabor.log | tail -50</terminal>
|
|
60
|
+
|
|
61
|
+
check api timing logs:
|
|
62
|
+
<terminal>grep -i "api call completed\|request_duration" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
63
|
+
|
|
64
|
+
check plugin hook performance:
|
|
65
|
+
<terminal>grep -i "hook.*performance\|hook.*ms\|hook.*slow" .kollabor-cli/logs/kollabor.log</terminal>
|
|
66
|
+
|
|
67
|
+
check connection statistics:
|
|
68
|
+
<terminal>grep -i "connection\|session" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
69
|
+
|
|
70
|
+
check for slow operations:
|
|
71
|
+
<terminal>grep -i "slow\|timeout\|blocking" .kollabor-cli/logs/kollabor.log</terminal>
|
|
72
|
+
|
|
73
|
+
monitor memory usage:
|
|
74
|
+
<terminal>ps aux | grep -i "python.*kollabor\|python.*main.py"</terminal>
|
|
75
|
+
|
|
76
|
+
check conversation history size:
|
|
77
|
+
<terminal>ls -lh .kollabor-cli/conversations/</terminal>
|
|
78
|
+
<terminal>wc -l .kollabor-cli/conversations/*.jsonl 2>/dev/null | tail -1</terminal>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
render loop architecture:
|
|
82
|
+
|
|
83
|
+
terminalrenderer (core/io/terminal_renderer.py)
|
|
84
|
+
manages terminal rendering with caching for optimization
|
|
85
|
+
|
|
86
|
+
key performance features:
|
|
87
|
+
- render cache: skips rendering when content unchanged
|
|
88
|
+
- buffered writes: reduces flickering by batching output
|
|
89
|
+
- resize debouncing: prevents rapid re-renders during terminal resize
|
|
90
|
+
- config-driven fps: terminal.render_fps (default: 20 fps)
|
|
91
|
+
|
|
92
|
+
key methods for profiling:
|
|
93
|
+
- render_active_area(): main render method called in loop
|
|
94
|
+
- _render_lines(): handles clearing and redrawing
|
|
95
|
+
- get_render_cache_status(): inspect cache effectiveness
|
|
96
|
+
- invalidate_render_cache(): force re-render
|
|
97
|
+
|
|
98
|
+
performance configuration:
|
|
99
|
+
- terminal.render_cache_enabled: enable/disable caching
|
|
100
|
+
- terminal.render_fps: frames per second (lower = less cpu)
|
|
101
|
+
- terminal.render_error_delay: delay after render error
|
|
102
|
+
|
|
103
|
+
render loop (core/application.py:567-582)
|
|
104
|
+
main rendering loop that drives the ui
|
|
105
|
+
|
|
106
|
+
loop structure:
|
|
107
|
+
while self.running:
|
|
108
|
+
await self.renderer.render_active_area()
|
|
109
|
+
await asyncio.sleep(1.0 / render_fps)
|
|
110
|
+
|
|
111
|
+
key metrics:
|
|
112
|
+
- render fps: how many times per second ui refreshes
|
|
113
|
+
- sleep time: 1.0 / fps (e.g., 20 fps = 0.05s sleep)
|
|
114
|
+
- cache hit rate: percentage of renders skipped due to cache
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
api communication service (core/llm/api_communication_service.py)
|
|
118
|
+
handles http communication with llm endpoints
|
|
119
|
+
|
|
120
|
+
connection pool configuration:
|
|
121
|
+
- http_connector_limit: total connections (default: 100)
|
|
122
|
+
- http_limit_per_host: per-host limit (default: 20)
|
|
123
|
+
- keepalive_timeout: connection reuse timeout (default: 30s)
|
|
124
|
+
- timeout: request timeout (from profile, default: 120s)
|
|
125
|
+
|
|
126
|
+
key methods for profiling:
|
|
127
|
+
- get_connection_stats(): comprehensive connection statistics
|
|
128
|
+
- health_check(): perform health check on api service
|
|
129
|
+
- get_api_stats(): get api communication statistics
|
|
130
|
+
|
|
131
|
+
tracked statistics:
|
|
132
|
+
- total_requests: number of api calls made
|
|
133
|
+
- failed_requests: number of failed requests
|
|
134
|
+
- recreated_sessions: number of times session was recreated
|
|
135
|
+
- connection_errors: number of connection errors
|
|
136
|
+
- failure_rate_percent: calculated failure rate
|
|
137
|
+
- connection_error_rate_percent: calculated connection error rate
|
|
138
|
+
- session_age_seconds: how long current session has been active
|
|
139
|
+
|
|
140
|
+
request timing:
|
|
141
|
+
- request_duration logged after each api call
|
|
142
|
+
- includes network latency + processing time
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
hook executor (core/events/executor.py)
|
|
146
|
+
executes plugin hooks with timeout and error handling
|
|
147
|
+
|
|
148
|
+
performance features:
|
|
149
|
+
- hook timeout: default 30 seconds per hook
|
|
150
|
+
- error handling: continues on error unless error_action="stop"
|
|
151
|
+
- execution stats: tracks hook execution results
|
|
152
|
+
|
|
153
|
+
check plugin hook monitoring for performance tracking:
|
|
154
|
+
<terminal>grep -i "log_performance\|performance_threshold" .kollabor-cli/config.json</terminal>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
phase 1: render loop profiling
|
|
158
|
+
|
|
159
|
+
step 1: check current render fps configuration
|
|
160
|
+
|
|
161
|
+
read config:
|
|
162
|
+
<terminal>cat .kollabor-cli/config.json | grep -a 5 -b 5 "render_fps"</terminal>
|
|
163
|
+
|
|
164
|
+
look for:
|
|
165
|
+
"terminal": {
|
|
166
|
+
"render_fps": 20,
|
|
167
|
+
"render_cache_enabled": true
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interpretation:
|
|
171
|
+
- 20 fps = 50ms per frame (standard)
|
|
172
|
+
- 30 fps = 33ms per frame (smoother, more cpu)
|
|
173
|
+
- 10 fps = 100ms per frame (slower, less cpu)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
step 2: check render cache effectiveness
|
|
177
|
+
|
|
178
|
+
add temporary debug code to check cache:
|
|
179
|
+
in core/application.py, add method:
|
|
180
|
+
|
|
181
|
+
def debug_get_render_cache_status(self):
|
|
182
|
+
"""get render cache status for profiling."""
|
|
183
|
+
return self.renderer.get_render_cache_status()
|
|
184
|
+
|
|
185
|
+
or check via logs:
|
|
186
|
+
<terminal>grep -i "cache.*invalidat\|cache.*enabled\|content unchanged" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
187
|
+
|
|
188
|
+
cache hit indicators:
|
|
189
|
+
- if content unchanged: render was skipped (cache hit)
|
|
190
|
+
- cache invalidated: force re-render
|
|
191
|
+
- no "content unchanged" logs: cache disabled or always changing
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
step 3: measure actual render time
|
|
195
|
+
|
|
196
|
+
add timing logs to render loop temporarily:
|
|
197
|
+
in core/application.py, modify _render_loop():
|
|
198
|
+
|
|
199
|
+
async def _render_loop(self) -> none:
|
|
200
|
+
import time
|
|
201
|
+
logger.info("render loop starting...")
|
|
202
|
+
while self.running:
|
|
203
|
+
try:
|
|
204
|
+
start = time.time()
|
|
205
|
+
await self.renderer.render_active_area()
|
|
206
|
+
elapsed = time.time() - start
|
|
207
|
+
if elapsed > 0.1: # log slow renders (>100ms)
|
|
208
|
+
logger.warning(f"slow render: {elapsed*1000:.1f}ms")
|
|
209
|
+
|
|
210
|
+
render_fps = self.config.get("terminal.render_fps", 20)
|
|
211
|
+
await asyncio.sleep(1.0 / render_fps)
|
|
212
|
+
except exception as e:
|
|
213
|
+
logger.error(f"render loop error: {e}")
|
|
214
|
+
|
|
215
|
+
check logs for slow renders:
|
|
216
|
+
<terminal>grep "slow render" .kollabor-cli/logs/kollabor.log</terminal>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
step 4: identify expensive render operations
|
|
220
|
+
|
|
221
|
+
status views are rendered every frame. check if any are slow:
|
|
222
|
+
|
|
223
|
+
grep for status view providers:
|
|
224
|
+
<terminal>grep -r "get_status_line\|content_provider" core/io/status_renderer.py</terminal>
|
|
225
|
+
|
|
226
|
+
disable status views temporarily to isolate:
|
|
227
|
+
in config.json, set:
|
|
228
|
+
"terminal": {
|
|
229
|
+
"status_enabled": false
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if performance improves, a status view is the bottleneck.
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
phase 2: llm api latency analysis
|
|
236
|
+
|
|
237
|
+
step 1: check api call timing in logs
|
|
238
|
+
|
|
239
|
+
find recent api calls with timing:
|
|
240
|
+
<terminal>grep -i "api call completed" .kollabor-cli/logs/kollabor.log | tail -20</terminal>
|
|
241
|
+
|
|
242
|
+
each log shows duration: "api call completed in 2.45s"
|
|
243
|
+
|
|
244
|
+
analyze timing:
|
|
245
|
+
- < 1s: excellent
|
|
246
|
+
- 1-3s: normal
|
|
247
|
+
- 3-10s: slow
|
|
248
|
+
- > 10s: very slow (check network/endpoint)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
step 2: get connection statistics
|
|
252
|
+
|
|
253
|
+
the api service tracks connection stats. to view them:
|
|
254
|
+
|
|
255
|
+
option a: check logs for connection info
|
|
256
|
+
<terminal>grep -i "session.*initiali\|http session\|connection" .kollabor-cli/logs/kollabor.log | tail -20</terminal>
|
|
257
|
+
|
|
258
|
+
option b: add debug endpoint in core/application.py:
|
|
259
|
+
|
|
260
|
+
def debug_get_api_stats(self):
|
|
261
|
+
"""get api service statistics for profiling."""
|
|
262
|
+
if hasattr(self.llm_service, 'api_service'):
|
|
263
|
+
return self.llm_service.api_service.get_api_stats()
|
|
264
|
+
return {"error": "api service not available"}
|
|
265
|
+
|
|
266
|
+
def debug_get_connection_stats(self):
|
|
267
|
+
"""get connection pool statistics."""
|
|
268
|
+
if hasattr(self.llm_service, 'api_service'):
|
|
269
|
+
return self.llm_service.api_service.get_connection_stats()
|
|
270
|
+
return {"error": "api service not available"}
|
|
271
|
+
|
|
272
|
+
option c: run health check
|
|
273
|
+
<terminal>grep -i "health_check\|session.*healthy" .kollabor-cli/logs/kollabor.log</terminal>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
step 3: analyze connection pool configuration
|
|
277
|
+
|
|
278
|
+
check connection settings:
|
|
279
|
+
<read>file>.kollabor-cli/config.json</file>
|
|
280
|
+
|
|
281
|
+
look for llm connection settings:
|
|
282
|
+
"core": {
|
|
283
|
+
"llm": {
|
|
284
|
+
"http_connector_limit": 100,
|
|
285
|
+
"http_limit_per_host": 20,
|
|
286
|
+
"keepalive_timeout": 30
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
bottleneck indicators:
|
|
291
|
+
- high recreated_sessions: connection issues
|
|
292
|
+
- high connection_errors: network problems
|
|
293
|
+
- failure_rate_percent > 10%: api issues
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
step 4: measure network latency
|
|
297
|
+
|
|
298
|
+
to isolate network vs processing time:
|
|
299
|
+
|
|
300
|
+
check raw interaction logs:
|
|
301
|
+
<terminal>ls -lt .kollabor-cli/conversations/raw_llm_interactions_*.jsonl | head -1</terminal>
|
|
302
|
+
<terminal>cat $(ls -t .kollabor-cli/conversations/raw_llm_interactions_*.jsonl | head -1) | head -1 | python -m json.tool</terminal>
|
|
303
|
+
|
|
304
|
+
timestamp comparison:
|
|
305
|
+
- request timestamp vs response timestamp
|
|
306
|
+
- difference includes network latency + api processing
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
phase 3: plugin performance audit
|
|
310
|
+
|
|
311
|
+
step 1: check hook execution timing
|
|
312
|
+
|
|
313
|
+
enable hook monitoring performance logging:
|
|
314
|
+
in .kollabor-cli/config.json:
|
|
315
|
+
"plugins": {
|
|
316
|
+
"hook_monitoring": {
|
|
317
|
+
"enabled": true,
|
|
318
|
+
"log_performance": true,
|
|
319
|
+
"performance_threshold_ms": 50
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
restart application and trigger some events.
|
|
324
|
+
|
|
325
|
+
check performance logs:
|
|
326
|
+
<terminal>grep -i "hook.*performance\|hook.*took\|hook.*ms" .kollabor-cli/logs/kollabor.log</terminal>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
step 2: identify slow hooks
|
|
330
|
+
|
|
331
|
+
hooks taking longer than threshold will be logged:
|
|
332
|
+
"hook example_plugin.my_hook took 150ms (threshold: 50ms)"
|
|
333
|
+
|
|
334
|
+
to fix slow hooks:
|
|
335
|
+
- move blocking operations to background tasks
|
|
336
|
+
- add caching for expensive computations
|
|
337
|
+
- reduce work done in hot path hooks (user_input, render_frame)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
step 3: profile specific plugin
|
|
341
|
+
|
|
342
|
+
identify which plugin is slow:
|
|
343
|
+
|
|
344
|
+
list loaded plugins:
|
|
345
|
+
<terminal>grep -i "plugin.*load\|plugin.*init" .kollabor-cli/logs/kollabor.log | head -20</terminal>
|
|
346
|
+
|
|
347
|
+
check plugin initialization time:
|
|
348
|
+
<terminal>grep -a 2 "initializing plugin" .kollabor-cli/logs/kollabor.log</terminal>
|
|
349
|
+
|
|
350
|
+
disable plugins one by one to isolate:
|
|
351
|
+
in config.json:
|
|
352
|
+
"plugins": {
|
|
353
|
+
"suspect_plugin": {
|
|
354
|
+
"enabled": false
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
step 4: check for blocking operations
|
|
360
|
+
|
|
361
|
+
grep for synchronous operations in async contexts:
|
|
362
|
+
<terminal>grep -r "time.sleep\|subprocess\." plugins/ --include="*.py"</terminal>
|
|
363
|
+
|
|
364
|
+
replace with async alternatives:
|
|
365
|
+
- time.sleep -> asyncio.sleep
|
|
366
|
+
- subprocess -> asyncio.create_subprocess
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
phase 4: memory and resource profiling
|
|
370
|
+
|
|
371
|
+
step 1: check process memory usage
|
|
372
|
+
|
|
373
|
+
get memory usage:
|
|
374
|
+
<terminal>ps aux | grep -i "python.*kollabor" | awk '{print $6}'</terminal>
|
|
375
|
+
|
|
376
|
+
output is in kb. convert to mb:
|
|
377
|
+
- 100,000 kb = ~100 mb
|
|
378
|
+
- 500,000 kb = ~500 mb
|
|
379
|
+
- > 1,000,000 kb = > 1 gb (concerning)
|
|
380
|
+
|
|
381
|
+
monitor over time:
|
|
382
|
+
<terminal>watch -n 5 'ps aux | grep -i "python.*kollabor"'</terminal>
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
step 2: check conversation history size
|
|
386
|
+
|
|
387
|
+
large conversation history causes:
|
|
388
|
+
- slower api calls (more tokens sent)
|
|
389
|
+
- higher memory usage
|
|
390
|
+
- slower response processing
|
|
391
|
+
|
|
392
|
+
check conversation file sizes:
|
|
393
|
+
<terminal>ls -lh .kollabor-cli/conversations/</terminal>
|
|
394
|
+
|
|
395
|
+
check message counts:
|
|
396
|
+
<terminal>wc -l .kollabor-cli/conversations/*.jsonl</terminal>
|
|
397
|
+
|
|
398
|
+
configure max history:
|
|
399
|
+
in .kollabor-cli/config.json:
|
|
400
|
+
"core": {
|
|
401
|
+
"llm": {
|
|
402
|
+
"max_history": 50
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
step 3: check for memory leaks
|
|
408
|
+
|
|
409
|
+
common causes:
|
|
410
|
+
- growing lists/dicts never cleared
|
|
411
|
+
- event listeners not removed
|
|
412
|
+
- background tasks never completing
|
|
413
|
+
- circular references
|
|
414
|
+
|
|
415
|
+
check background tasks:
|
|
416
|
+
<terminal>grep -i "background task\|create_task" .kollabor-cli/logs/kollabor.log</terminal>
|
|
417
|
+
|
|
418
|
+
check event listener count:
|
|
419
|
+
add debug code to count hooks:
|
|
420
|
+
<terminal>python -c "from core.events import eventbus; eb = eventbus(); print(eb.get_registry_stats())"</terminal>
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
step 4: profile with python tools
|
|
424
|
+
|
|
425
|
+
use memory_profiler:
|
|
426
|
+
<terminal>pip install memory_profiler</terminal>
|
|
427
|
+
<terminal>python -m memory_profiler main.py</terminal>
|
|
428
|
+
|
|
429
|
+
use cprofile for cpu profiling:
|
|
430
|
+
<terminal>python -m cprofile -o profile.stats main.py</terminal>
|
|
431
|
+
<terminal>python -c "import pstats; p = pstats.stats('profile.stats'); p.sort_stats('cumulative').print_stats(20)"</terminal>
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
example workflow:
|
|
435
|
+
|
|
436
|
+
scenario: "terminal feels sluggish, input lag"
|
|
437
|
+
|
|
438
|
+
step 1: check render fps
|
|
439
|
+
<terminal>grep "render_fps" .kollabor-cli/config.json</terminal>
|
|
440
|
+
if > 30 fps, try reducing to 20:
|
|
441
|
+
"terminal": {"render_fps": 20}
|
|
442
|
+
|
|
443
|
+
step 2: check for slow renders
|
|
444
|
+
add timing to _render_loop (see phase 1, step 3)
|
|
445
|
+
check logs for "slow render"
|
|
446
|
+
|
|
447
|
+
step 3: check render cache
|
|
448
|
+
<terminal>grep "content unchanged\|cache" .kollabor-cli/logs/kollabor.log | tail -30</terminal>
|
|
449
|
+
if few cache hits, something is causing constant re-renders
|
|
450
|
+
|
|
451
|
+
step 4: disable status views
|
|
452
|
+
set status_enabled: false temporarily
|
|
453
|
+
if performance improves, a status view is the culprit
|
|
454
|
+
|
|
455
|
+
step 5: check for expensive event handlers
|
|
456
|
+
disable hook monitoring plugin temporarily
|
|
457
|
+
if performance improves, the monitoring is adding overhead
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
example workflow 2:
|
|
461
|
+
|
|
462
|
+
scenario: "llm responses take too long"
|
|
463
|
+
|
|
464
|
+
step 1: measure api call time
|
|
465
|
+
<terminal>grep "api call completed" .kollabor-cli/logs/kollabor.log | tail -5</terminal>
|
|
466
|
+
|
|
467
|
+
step 2: check connection health
|
|
468
|
+
<terminal>grep "session.*recreat\|connection.*error" .kollabor-cli/logs/kollabor.log</terminal>
|
|
469
|
+
|
|
470
|
+
step 3: check conversation history size
|
|
471
|
+
<terminal>ls -lh .kollabor-cli/conversations/</terminal>
|
|
472
|
+
<terminal>wc -l .kollabor-cli/conversations/session_*.jsonl | tail -1</terminal>
|
|
473
|
+
|
|
474
|
+
step 4: reduce max history if large
|
|
475
|
+
"core": {"llm": {"max_history": 30}}
|
|
476
|
+
|
|
477
|
+
step 5: check network latency
|
|
478
|
+
compare timestamps in raw_llm_interactions_*.jsonl
|
|
479
|
+
request timestamp vs response timestamp
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
example workflow 3:
|
|
483
|
+
|
|
484
|
+
scenario: "high memory usage"
|
|
485
|
+
|
|
486
|
+
step 1: check process memory
|
|
487
|
+
<terminal>ps aux | grep -i "python.*kollabor"</terminal>
|
|
488
|
+
|
|
489
|
+
step 2: check conversation size
|
|
490
|
+
<terminal>du -sh .kollabor-cli/conversations/</terminal>
|
|
491
|
+
|
|
492
|
+
step 3: check for memory leaks
|
|
493
|
+
monitor memory over time:
|
|
494
|
+
<terminal>watch -n 10 'ps aux | grep -i "python.*kollabor" | awk "{print $6}"'</terminal>
|
|
495
|
+
|
|
496
|
+
step 4: reduce history size
|
|
497
|
+
"core": {"llm": {"max_history": 20}}
|
|
498
|
+
|
|
499
|
+
step 5: clear old conversations
|
|
500
|
+
<terminal>rm .kollabor-cli/conversations/session_*.jsonl</terminal>
|
|
501
|
+
(keeps only current session)
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
troubleshooting tips:
|
|
505
|
+
|
|
506
|
+
tip 1: reduce render cpu usage
|
|
507
|
+
- lower render_fps to 10-15
|
|
508
|
+
- ensure render_cache_enabled is true
|
|
509
|
+
- disable expensive status views
|
|
510
|
+
- reduce visual effects (shimmer, gradients)
|
|
511
|
+
|
|
512
|
+
tip 2: reduce llm latency
|
|
513
|
+
- reduce max_history (fewer tokens = faster)
|
|
514
|
+
- use faster model endpoint
|
|
515
|
+
- enable streaming for perceived speed
|
|
516
|
+
- check keepalive_timeout for connection reuse
|
|
517
|
+
|
|
518
|
+
tip 3: reduce plugin overhead
|
|
519
|
+
- disable unused plugins
|
|
520
|
+
- increase hook performance_threshold_ms
|
|
521
|
+
- move heavy work to background tasks
|
|
522
|
+
- avoid blocking operations in hooks
|
|
523
|
+
|
|
524
|
+
tip 4: reduce memory usage
|
|
525
|
+
- reduce max_history
|
|
526
|
+
- clear old conversation logs
|
|
527
|
+
- check for memory leaks (growing lists)
|
|
528
|
+
- restart application periodically
|
|
529
|
+
|
|
530
|
+
tip 5: identify bottlenecks scientifically
|
|
531
|
+
- change one thing at a time
|
|
532
|
+
- measure before and after
|
|
533
|
+
- use logging, not guesses
|
|
534
|
+
- focus on hot paths (render loop, input handling)
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
expected output:
|
|
538
|
+
|
|
539
|
+
when this skill executes successfully, you should be able to:
|
|
540
|
+
|
|
541
|
+
[ ] measure render loop fps and identify slow renders
|
|
542
|
+
[ ] check render cache hit rate
|
|
543
|
+
[ ] measure llm api call latency and connection health
|
|
544
|
+
[ ] identify slow plugin hooks
|
|
545
|
+
[ ] monitor memory usage patterns
|
|
546
|
+
[ ] optimize configuration for better performance
|
|
547
|
+
[ ] isolate which component is causing slowdowns
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
status tags reference:
|
|
551
|
+
|
|
552
|
+
[ok] performance is good
|
|
553
|
+
[warn] performance degraded but usable
|
|
554
|
+
[error] severe performance issue
|
|
555
|
+
[todo] action needed to optimize
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
common optimization targets:
|
|
559
|
+
|
|
560
|
+
render loop:
|
|
561
|
+
- reduce fps from 30 to 20
|
|
562
|
+
- disable shimmer effect
|
|
563
|
+
- disable expensive status views
|
|
564
|
+
- enable render cache
|
|
565
|
+
|
|
566
|
+
llm calls:
|
|
567
|
+
- reduce max_history from 90 to 30
|
|
568
|
+
- use faster model
|
|
569
|
+
- enable streaming
|
|
570
|
+
- optimize system prompt length
|
|
571
|
+
|
|
572
|
+
plugins:
|
|
573
|
+
- disable unused plugins
|
|
574
|
+
- increase hook timeout threshold
|
|
575
|
+
- disable hook monitoring performance logging
|
|
576
|
+
- move blocking operations to background
|