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.
Files changed (192) hide show
  1. agents/__init__.py +2 -0
  2. agents/coder/__init__.py +0 -0
  3. agents/coder/agent.json +4 -0
  4. agents/coder/api-integration.md +2150 -0
  5. agents/coder/cli-pretty.md +765 -0
  6. agents/coder/code-review.md +1092 -0
  7. agents/coder/database-design.md +1525 -0
  8. agents/coder/debugging.md +1102 -0
  9. agents/coder/dependency-management.md +1397 -0
  10. agents/coder/git-workflow.md +1099 -0
  11. agents/coder/refactoring.md +1454 -0
  12. agents/coder/security-hardening.md +1732 -0
  13. agents/coder/system_prompt.md +1448 -0
  14. agents/coder/tdd.md +1367 -0
  15. agents/creative-writer/__init__.py +0 -0
  16. agents/creative-writer/agent.json +4 -0
  17. agents/creative-writer/character-development.md +1852 -0
  18. agents/creative-writer/dialogue-craft.md +1122 -0
  19. agents/creative-writer/plot-structure.md +1073 -0
  20. agents/creative-writer/revision-editing.md +1484 -0
  21. agents/creative-writer/system_prompt.md +690 -0
  22. agents/creative-writer/worldbuilding.md +2049 -0
  23. agents/data-analyst/__init__.py +30 -0
  24. agents/data-analyst/agent.json +4 -0
  25. agents/data-analyst/data-visualization.md +992 -0
  26. agents/data-analyst/exploratory-data-analysis.md +1110 -0
  27. agents/data-analyst/pandas-data-manipulation.md +1081 -0
  28. agents/data-analyst/sql-query-optimization.md +881 -0
  29. agents/data-analyst/statistical-analysis.md +1118 -0
  30. agents/data-analyst/system_prompt.md +928 -0
  31. agents/default/__init__.py +0 -0
  32. agents/default/agent.json +4 -0
  33. agents/default/dead-code.md +794 -0
  34. agents/default/explore-agent-system.md +585 -0
  35. agents/default/system_prompt.md +1448 -0
  36. agents/kollabor/__init__.py +0 -0
  37. agents/kollabor/analyze-plugin-lifecycle.md +175 -0
  38. agents/kollabor/analyze-terminal-rendering.md +388 -0
  39. agents/kollabor/code-review.md +1092 -0
  40. agents/kollabor/debug-mcp-integration.md +521 -0
  41. agents/kollabor/debug-plugin-hooks.md +547 -0
  42. agents/kollabor/debugging.md +1102 -0
  43. agents/kollabor/dependency-management.md +1397 -0
  44. agents/kollabor/git-workflow.md +1099 -0
  45. agents/kollabor/inspect-llm-conversation.md +148 -0
  46. agents/kollabor/monitor-event-bus.md +558 -0
  47. agents/kollabor/profile-performance.md +576 -0
  48. agents/kollabor/refactoring.md +1454 -0
  49. agents/kollabor/system_prompt copy.md +1448 -0
  50. agents/kollabor/system_prompt.md +757 -0
  51. agents/kollabor/trace-command-execution.md +178 -0
  52. agents/kollabor/validate-config.md +879 -0
  53. agents/research/__init__.py +0 -0
  54. agents/research/agent.json +4 -0
  55. agents/research/architecture-mapping.md +1099 -0
  56. agents/research/codebase-analysis.md +1077 -0
  57. agents/research/dependency-audit.md +1027 -0
  58. agents/research/performance-profiling.md +1047 -0
  59. agents/research/security-review.md +1359 -0
  60. agents/research/system_prompt.md +492 -0
  61. agents/technical-writer/__init__.py +0 -0
  62. agents/technical-writer/agent.json +4 -0
  63. agents/technical-writer/api-documentation.md +2328 -0
  64. agents/technical-writer/changelog-management.md +1181 -0
  65. agents/technical-writer/readme-writing.md +1360 -0
  66. agents/technical-writer/style-guide.md +1410 -0
  67. agents/technical-writer/system_prompt.md +653 -0
  68. agents/technical-writer/tutorial-creation.md +1448 -0
  69. core/__init__.py +0 -2
  70. core/application.py +343 -88
  71. core/cli.py +229 -10
  72. core/commands/menu_renderer.py +463 -59
  73. core/commands/registry.py +14 -9
  74. core/commands/system_commands.py +2461 -14
  75. core/config/loader.py +151 -37
  76. core/config/service.py +18 -6
  77. core/events/bus.py +29 -9
  78. core/events/executor.py +205 -75
  79. core/events/models.py +27 -8
  80. core/fullscreen/command_integration.py +20 -24
  81. core/fullscreen/components/__init__.py +10 -1
  82. core/fullscreen/components/matrix_components.py +1 -2
  83. core/fullscreen/components/space_shooter_components.py +654 -0
  84. core/fullscreen/plugin.py +5 -0
  85. core/fullscreen/renderer.py +52 -13
  86. core/fullscreen/session.py +52 -15
  87. core/io/__init__.py +29 -5
  88. core/io/buffer_manager.py +6 -1
  89. core/io/config_status_view.py +7 -29
  90. core/io/core_status_views.py +267 -347
  91. core/io/input/__init__.py +25 -0
  92. core/io/input/command_mode_handler.py +711 -0
  93. core/io/input/display_controller.py +128 -0
  94. core/io/input/hook_registrar.py +286 -0
  95. core/io/input/input_loop_manager.py +421 -0
  96. core/io/input/key_press_handler.py +502 -0
  97. core/io/input/modal_controller.py +1011 -0
  98. core/io/input/paste_processor.py +339 -0
  99. core/io/input/status_modal_renderer.py +184 -0
  100. core/io/input_errors.py +5 -1
  101. core/io/input_handler.py +211 -2452
  102. core/io/key_parser.py +7 -0
  103. core/io/layout.py +15 -3
  104. core/io/message_coordinator.py +111 -2
  105. core/io/message_renderer.py +129 -4
  106. core/io/status_renderer.py +147 -607
  107. core/io/terminal_renderer.py +97 -51
  108. core/io/terminal_state.py +21 -4
  109. core/io/visual_effects.py +816 -165
  110. core/llm/agent_manager.py +1063 -0
  111. core/llm/api_adapters/__init__.py +44 -0
  112. core/llm/api_adapters/anthropic_adapter.py +432 -0
  113. core/llm/api_adapters/base.py +241 -0
  114. core/llm/api_adapters/openai_adapter.py +326 -0
  115. core/llm/api_communication_service.py +167 -113
  116. core/llm/conversation_logger.py +322 -16
  117. core/llm/conversation_manager.py +556 -30
  118. core/llm/file_operations_executor.py +84 -32
  119. core/llm/llm_service.py +934 -103
  120. core/llm/mcp_integration.py +541 -57
  121. core/llm/message_display_service.py +135 -18
  122. core/llm/plugin_sdk.py +1 -2
  123. core/llm/profile_manager.py +1183 -0
  124. core/llm/response_parser.py +274 -56
  125. core/llm/response_processor.py +16 -3
  126. core/llm/tool_executor.py +6 -1
  127. core/logging/__init__.py +2 -0
  128. core/logging/setup.py +34 -6
  129. core/models/resume.py +54 -0
  130. core/plugins/__init__.py +4 -2
  131. core/plugins/base.py +127 -0
  132. core/plugins/collector.py +23 -161
  133. core/plugins/discovery.py +37 -3
  134. core/plugins/factory.py +6 -12
  135. core/plugins/registry.py +5 -17
  136. core/ui/config_widgets.py +128 -28
  137. core/ui/live_modal_renderer.py +2 -1
  138. core/ui/modal_actions.py +5 -0
  139. core/ui/modal_overlay_renderer.py +0 -60
  140. core/ui/modal_renderer.py +268 -7
  141. core/ui/modal_state_manager.py +29 -4
  142. core/ui/widgets/base_widget.py +7 -0
  143. core/updates/__init__.py +10 -0
  144. core/updates/version_check_service.py +348 -0
  145. core/updates/version_comparator.py +103 -0
  146. core/utils/config_utils.py +685 -526
  147. core/utils/plugin_utils.py +1 -1
  148. core/utils/session_naming.py +111 -0
  149. fonts/LICENSE +21 -0
  150. fonts/README.md +46 -0
  151. fonts/SymbolsNerdFont-Regular.ttf +0 -0
  152. fonts/SymbolsNerdFontMono-Regular.ttf +0 -0
  153. fonts/__init__.py +44 -0
  154. {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/METADATA +54 -4
  155. kollabor-0.4.15.dist-info/RECORD +228 -0
  156. {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/top_level.txt +2 -0
  157. plugins/agent_orchestrator/__init__.py +39 -0
  158. plugins/agent_orchestrator/activity_monitor.py +181 -0
  159. plugins/agent_orchestrator/file_attacher.py +77 -0
  160. plugins/agent_orchestrator/message_injector.py +135 -0
  161. plugins/agent_orchestrator/models.py +48 -0
  162. plugins/agent_orchestrator/orchestrator.py +403 -0
  163. plugins/agent_orchestrator/plugin.py +976 -0
  164. plugins/agent_orchestrator/xml_parser.py +191 -0
  165. plugins/agent_orchestrator_plugin.py +9 -0
  166. plugins/enhanced_input/box_styles.py +1 -0
  167. plugins/enhanced_input/color_engine.py +19 -4
  168. plugins/enhanced_input/config.py +2 -2
  169. plugins/enhanced_input_plugin.py +61 -11
  170. plugins/fullscreen/__init__.py +6 -2
  171. plugins/fullscreen/example_plugin.py +1035 -222
  172. plugins/fullscreen/setup_wizard_plugin.py +592 -0
  173. plugins/fullscreen/space_shooter_plugin.py +131 -0
  174. plugins/hook_monitoring_plugin.py +436 -78
  175. plugins/query_enhancer_plugin.py +66 -30
  176. plugins/resume_conversation_plugin.py +1494 -0
  177. plugins/save_conversation_plugin.py +98 -32
  178. plugins/system_commands_plugin.py +70 -56
  179. plugins/tmux_plugin.py +154 -78
  180. plugins/workflow_enforcement_plugin.py +94 -92
  181. system_prompt/default.md +952 -886
  182. core/io/input_mode_manager.py +0 -402
  183. core/io/modal_interaction_handler.py +0 -315
  184. core/io/raw_input_processor.py +0 -946
  185. core/storage/__init__.py +0 -5
  186. core/storage/state_manager.py +0 -84
  187. core/ui/widget_integration.py +0 -222
  188. core/utils/key_reader.py +0 -171
  189. kollabor-0.4.9.dist-info/RECORD +0 -128
  190. {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/WHEEL +0 -0
  191. {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/entry_points.txt +0 -0
  192. {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/licenses/LICENSE +0 -0
File without changes
@@ -0,0 +1,175 @@
1
+ Trace plugin initialization, lifecycle, and shutdown events in Kollabor CLI.
2
+
3
+ skill name: analyze-plugin-lifecycle
4
+
5
+ purpose:
6
+ diagnose plugin-related issues by tracing the complete plugin lifecycle from
7
+ discovery through loading, initialization, hook registration, and shutdown.
8
+ helps identify why plugins fail to load, initialize incorrectly, or cause
9
+ startup problems.
10
+
11
+ when to use:
12
+ - a plugin is not loading or showing up
13
+ - application fails during startup with plugin-related errors
14
+ - need to verify plugin initialization order
15
+ - investigating plugin shutdown issues
16
+ - want to see which hooks a plugin has registered
17
+ - debugging plugin dependency or configuration problems
18
+
19
+ methodology:
20
+
21
+ step 1: check plugin discovery
22
+ verify plugins are being discovered from the plugins directory.
23
+ check both package installation directory and development fallback.
24
+
25
+ step 2: examine plugin loading
26
+ review which plugin modules were successfully loaded and which failed.
27
+ check for import errors or security validation failures.
28
+
29
+ step 3: trace plugin instantiation
30
+ verify plugin classes were instantiated with correct dependencies.
31
+ check factory errors and instantiation results.
32
+
33
+ step 4: verify plugin initialization
34
+ confirm initialize() was called on each plugin instance.
35
+ check for errors during plugin initialization.
36
+
37
+ step 5: audit hook registration
38
+ review which hooks each plugin registered.
39
+ verify hook priority and event type bindings.
40
+
41
+ step 6: check shutdown sequence
42
+ verify plugins shutdown cleanly on application exit.
43
+
44
+ tools and commands:
45
+
46
+ files to read:
47
+ - core/plugins/discovery.py (file scanning, module loading, security)
48
+ - core/plugins/factory.py (instantiation, init, shutdown)
49
+ - core/plugins/registry.py (coordinates discovery, factory, collector)
50
+ - core/plugins/collector.py (status collection)
51
+ - core/application.py (plugin orchestration in __init__, start, shutdown)
52
+
53
+ log inspection:
54
+ - .kollabor-cli/logs/kollabor.log (plugin lifecycle messages)
55
+
56
+ grep patterns:
57
+ - "Plugin.*initialized" (plugin initialization)
58
+ - "Loaded plugin class" (successful plugin loading)
59
+ - "Failed to.*plugin" (plugin failures)
60
+ - "Registered hooks for" (hook registration)
61
+ - "shutdown plugin" (plugin shutdown)
62
+
63
+ python inspection:
64
+ - inspect PluginDiscovery.get_discovery_stats()
65
+ - inspect PluginFactory.get_factory_stats()
66
+ - inspect PluginRegistry.get_registry_stats()
67
+
68
+ example workflow:
69
+
70
+ scenario: plugin not loading
71
+
72
+ 1. check logs for plugin discovery:
73
+ grep "Discovered.*plugin" .kollabor-cli/logs/kollabor.log
74
+
75
+ 2. verify plugin file exists and is named correctly:
76
+ ls plugins/*_plugin.py
77
+ (must end with _plugin.py)
78
+
79
+ 3. check for loading errors:
80
+ grep -i "error.*plugin" .kollabor-cli/logs/kollabor.log
81
+
82
+ 4. verify plugin class structure:
83
+ grep "class.*Plugin" plugins/your_plugin.py
84
+ grep "def get_default_config" plugins/your_plugin.py
85
+
86
+ 5. check security validation:
87
+ grep "Skipping invalid plugin" .kollabor-cli/logs/kollabor.log
88
+ grep "Plugin location verification failed" .kollabor-cli/logs/kollabor.log
89
+
90
+ expected output:
91
+
92
+ plugin discovery summary:
93
+ [ok] plugins directory: /path/to/plugins
94
+ [ok] discovered modules: 8
95
+ [ok] loaded classes: 8
96
+ [ok] plugins with config: 6
97
+
98
+ plugin instantiation:
99
+ [ok] hookmonitoringplugin -> HookMonitoringPlugin
100
+ [ok] enhancedinputplugin -> EnhancedInputPlugin
101
+ [ok] systemcommandsplugin -> SystemCommandsPlugin
102
+
103
+ initialization status:
104
+ [ok] HookMonitoringPlugin: initialize() called
105
+ [ok] EnhancedInputPlugin: initialize() called
106
+ [warn] CustomPlugin: initialize() method not found
107
+
108
+ hook registration:
109
+ [ok] HookMonitoringPlugin: 12 hooks registered
110
+ [ok] EnhancedInputPlugin: 5 hooks registered
111
+
112
+ troubleshooting tips:
113
+
114
+ plugin not discovered:
115
+ - verify filename ends with _plugin.py
116
+ - check file is in plugins/ directory
117
+ - verify filename contains only alphanumeric chars and underscores
118
+ - check logs for security validation failures
119
+
120
+ plugin fails to load:
121
+ - check for syntax errors in plugin file
122
+ - verify all imports are available
123
+ - check get_default_config() method exists
124
+ - look for import errors in logs
125
+
126
+ plugin fails to initialize:
127
+ - verify initialize() method is async
128
+ - check initialize() signature accepts kwargs
129
+ - look for exceptions in plugin initialize() code
130
+ - check required dependencies are available
131
+
132
+ plugin hooks not firing:
133
+ - verify register_hooks() method exists and is async
134
+ - check hooks are registered with correct event types
135
+ - verify hook priority is set correctly
136
+ - check event bus is properly passed to plugin
137
+
138
+ plugin shutdown issues:
139
+ - verify shutdown() method is async
140
+ - check for exceptions during shutdown
141
+ - ensure plugin cleans up resources properly
142
+
143
+ key implementation details:
144
+
145
+ plugin discovery order:
146
+ 1. PluginRegistry initialized with plugins_dir
147
+ 2. PluginDiscovery.scan_plugin_files() finds *_plugin.py files
148
+ 3. security validation (_sanitize_plugin_name, _verify_plugin_location)
149
+ 4. load_module() imports and extracts plugin classes
150
+ 5. classes must: end with 'Plugin', have get_default_config()
151
+
152
+ instantiation flow:
153
+ 1. PluginFactory.instantiate_all() called
154
+ 2. each plugin class instantiated with: name, state_manager, event_bus,
155
+ renderer, config
156
+ 3. instances stored in factory.plugin_instances dict
157
+ 4. duplicate storage: both "PluginName" and "pluginname" keys
158
+
159
+ initialization flow:
160
+ 1. application._initialize_plugins() called after llm service init
161
+ 2. for each unique instance (by id):
162
+ - if initialize() exists: call with kwargs
163
+ - if register_hooks() exists: call to register event hooks
164
+ 3. system commands hooks registered last
165
+
166
+ shutdown flow:
167
+ 1. cleanup() called from finally block
168
+ 2. background tasks cancelled
169
+ 3. running = False, startup_complete = False
170
+ 4. shutdown() method:
171
+ - input_handler.stop()
172
+ - llm_service.shutdown()
173
+ - for each plugin: if shutdown() exists, await it
174
+ - clear terminal, restore state
175
+ - state_manager.close()
@@ -0,0 +1,388 @@
1
+ <!-- Terminal Rendering Analysis skill - debug rendering pipeline, buffer states, and display issues -->
2
+
3
+ skill name: analyze-terminal-rendering
4
+
5
+ purpose:
6
+ diagnose and fix terminal rendering issues in kollabor-cli, including:
7
+ - duplicate input boxes after modal close
8
+ - stale renders after resize
9
+ - message display race conditions
10
+ - buffer transition state bugs
11
+ - render loop interference
12
+
13
+
14
+ when to use:
15
+ [ ] seeing duplicate input prompts
16
+ [ ] messages not displaying correctly
17
+ [ ] rendering artifacts after terminal resize
18
+ [ ] modal fullscreen issues
19
+ [ ] input box stuck or missing
20
+ [ ] status lines not updating
21
+ [ ] flickering during render loop
22
+
23
+
24
+ methodology:
25
+
26
+ PHASE 1: INSPECT RENDERER STATE
27
+
28
+ check terminal renderer initialization:
29
+ <read><file>core/io/terminal_renderer.py</file><lines>1-100</lines></read>
30
+
31
+ verify key state properties:
32
+ grep -n "writing_messages\|input_line_written\|last_line_count" core/io/terminal_renderer.py
33
+
34
+ check render cache status:
35
+ grep -n "_last_render_content\|_render_cache" core/io/terminal_renderer.py
36
+
37
+
38
+ PHASE 2: INSPECT MESSAGE COORDINATOR
39
+
40
+ read coordinator implementation:
41
+ <read><file>core/io/message_coordinator.py</file></read>
42
+
43
+ check queue status method:
44
+ grep -n "get_queue_status\|display_message_sequence" core/io/message_coordinator.py
45
+
46
+ verify buffer transition methods:
47
+ grep -n "enter_alternate_buffer\|exit_alternate_buffer" core/io/message_coordinator.py
48
+
49
+
50
+ PHASE 3: INSPECT BUFFER MANAGER
51
+
52
+ read buffer manager:
53
+ <read><file>core/io/buffer_manager.py</file></read>
54
+
55
+ check buffer statistics method:
56
+ grep -n "get_stats\|content\|cursor_position" core/io/buffer_manager.py
57
+
58
+
59
+ PHASE 4: INSPECT LAYOUT SYSTEM
60
+
61
+ read layout manager:
62
+ <read><file>core/io/layout.py</file><lines>1-250</lines></read>
63
+
64
+ check layout rendering:
65
+ grep -n "render_areas\|calculate_layout" core/io/layout.py
66
+
67
+
68
+ PHASE 5: DIAGNOSE SPECIFIC ISSUES
69
+
70
+ duplicate input box diagnosis:
71
+ [1] check if input_line_written is True incorrectly
72
+ [2] verify render loop is blocked during modal
73
+ [3] check if exit_alternate_buffer was called
74
+ [4] verify writing_messages flag reset
75
+ [5] check render cache invalidation
76
+
77
+ stale render after resize:
78
+ [1] check resize detection in render_active_area
79
+ [2] verify invalidate_render_cache called
80
+ [3] check aggressive clearing logic
81
+ [4] verify active_area_start_position saved
82
+
83
+
84
+ tools and commands:
85
+
86
+ core files to read:
87
+ core/io/terminal_renderer.py - main renderer, state management
88
+ core/io/message_coordinator.py - message coordination, buffer transitions
89
+ core/io/buffer_manager.py - input buffer management
90
+ core/io/layout.py - layout and thinking animations
91
+ core/io/input_handler.py - input handling and modal detection
92
+ core/io/terminal_state.py - terminal state (raw mode, size)
93
+
94
+ key grep patterns for debugging:
95
+
96
+ find render state modifications:
97
+ grep -rn "writing_messages\s*=" core/io/
98
+ grep -rn "input_line_written\s*=" core/io/
99
+ grep -rn "last_line_count\s*=" core/io/
100
+
101
+ find buffer transitions:
102
+ grep -rn "enter_alternate_buffer\|exit_alternate_buffer" core/
103
+ grep -rn "\.enter_raw_mode\|\.exit_raw_mode" core/
104
+
105
+ find message display calls:
106
+ grep -rn "display_message_sequence\|display_single_message" core/
107
+ grep -rn "write_message\|write_streaming_chunk" core/io/
108
+
109
+ find render cache operations:
110
+ grep -rn "invalidate_render_cache\|_last_render_content" core/
111
+
112
+ runtime debugging commands:
113
+
114
+ check application logs:
115
+ tail -100 .kollabor-cli/logs/kollabor.log | grep -i "render\|buffer\|modal"
116
+
117
+ find render-related errors:
118
+ grep -i "error.*render\|error.*terminal" .kollabor-cli/logs/kollabor.log
119
+
120
+ check for resize events:
121
+ grep -i "resize\|terminal.*size" .kollabor-cli/logs/kollabor.log
122
+
123
+
124
+ example workflow:
125
+
126
+ problem: duplicate input box after closing modal
127
+
128
+ step 1 - verify modal exit pattern:
129
+ grep -A 10 "exit_alternate_buffer" core/io/message_coordinator.py
130
+
131
+ step 2 - check render loop blocking:
132
+ grep -B 5 -A 5 "writing_messages = True" core/io/terminal_renderer.py
133
+
134
+ step 3 - verify input renderer reset:
135
+ grep -A 5 "def _exit_modal" core/ui/modal.py
136
+
137
+ step 4 - check minimal exit pattern:
138
+ grep -B 2 -A 10 "_exit_modal_minimal" plugins/
139
+
140
+ step 5 - identify root cause:
141
+ if exit_alternate_buffer(restore_state=False) not called
142
+ or writing_messages not reset to False
143
+ or render cache not invalidated
144
+
145
+ step 6 - verify fix:
146
+ [ ] modal closes cleanly
147
+ [ ] only one input box appears
148
+ [ ] render loop resumes normally
149
+
150
+
151
+ expected output:
152
+
153
+ when running this skill, you should:
154
+
155
+ renderer state snapshot:
156
+ [ok] terminal_state raw_mode status, terminal size
157
+ [ok] writing_messages flag status (should be False normally)
158
+ [ok] input_line_written should be False after message display
159
+ [ok] last_line_count number of lines in last render
160
+ [ok] render_cache cache content and status
161
+
162
+ coordinator state snapshot:
163
+ [ok] message_queue pending messages count
164
+ [ok] is_displaying atomic display flag
165
+ [ok] _in_alternate_buffer buffer mode flag
166
+ [ok] _saved_main_buffer_state captured state (if any)
167
+
168
+ buffer manager state:
169
+ [ok] buffer_length current input length
170
+ [ok] cursor_position cursor index
171
+ [ok] history_count commands in history
172
+ [ok] buffer_limit max buffer size
173
+
174
+ layout state:
175
+ [ok] terminal_width current width
176
+ [ok] terminal_height current height
177
+ [ok] thinking_active animation status
178
+ [ok] visible_areas which areas are shown
179
+
180
+
181
+ troubleshooting tips:
182
+
183
+ common issue: duplicate input box
184
+
185
+ symptoms:
186
+ - two input prompts appear after modal closes
187
+ - input box appears in wrong location
188
+ - old input box not cleared
189
+
190
+ root causes:
191
+ [1] exit_alternate_buffer not called after modal close
192
+ [2] writing_messages left True after message display
193
+ [3] render cache not invalidated after buffer transition
194
+ [4] input_line_written not reset to False
195
+ [5] using _exit_modal_minimal when full exit needed
196
+
197
+ fix pattern:
198
+ # in modal close handler
199
+ await self._exit_modal_mode() # full exit
200
+ # OR for commands that render their own content
201
+ await self._exit_modal_mode_minimal() # minimal exit
202
+
203
+ # exit_alternate_buffer should always be called:
204
+ renderer.message_coordinator.exit_alternate_buffer(restore_state=False)
205
+
206
+ verify fix:
207
+ [ ] modal closes
208
+ [ ] saved state cleared
209
+ [ ] writing_messages = False
210
+ [ ] input_line_written = False
211
+ [ ] render cache cleared
212
+
213
+
214
+ common issue: stale renders after resize
215
+
216
+ symptoms:
217
+ - old content visible after resize
218
+ - lines not clearing properly
219
+ - cursor in wrong position
220
+
221
+ root causes:
222
+ [1] render cache not invalidated on resize
223
+ [2] aggressive clearing not triggered
224
+ [3] active_area_start_position not saved
225
+ [4] resize debounce too short/long
226
+
227
+ fix pattern:
228
+ # in render_active_area, check resize:
229
+ resize_settled = self.terminal_state.check_and_clear_resize_flag()
230
+ if resize_settled:
231
+ self.invalidate_render_cache()
232
+ # trigger aggressive clearing
233
+
234
+ verify fix:
235
+ [ ] resize detected
236
+ [ ] cache invalidated
237
+ [ ] aggressive clear used
238
+ [ ] cursor position restored
239
+
240
+
241
+ common issue: messages not displaying
242
+
243
+ symptoms:
244
+ - messages appear delayed or not at all
245
+ - system messages missing
246
+ - streaming chunks not showing
247
+
248
+ root causes:
249
+ [1] messages queued but not flushed
250
+ [2] display_queued_messages not called
251
+ [3] render loop interfering with display
252
+ [4] message_router not processing queue
253
+
254
+ fix pattern:
255
+ # always use coordinated display:
256
+ renderer.message_coordinator.display_message_sequence([
257
+ ("system", "Thinking...", {}),
258
+ ("assistant", response, {})
259
+ ])
260
+
261
+ verify fix:
262
+ [ ] messages queued
263
+ [ ] display_queued_messages called
264
+ [ ] atomic display completes
265
+ [ ] flags reset correctly
266
+
267
+
268
+ common issue: flickering during render
269
+
270
+ symptoms:
271
+ - visible flicker on each render
272
+ - content flashing
273
+ - poor visual quality
274
+
275
+ root causes:
276
+ [1] not using buffered write
277
+ [2] too frequent renders
278
+ [3] render cache disabled
279
+ [4] multiple clear+redraw cycles
280
+
281
+ fix pattern:
282
+ # use buffered write to reduce flicker:
283
+ self._start_buffered_write()
284
+ # ... clear and write ...
285
+ self._flush_buffered_write()
286
+
287
+ # enable render cache:
288
+ renderer.set_render_cache_enabled(True)
289
+
290
+ verify fix:
291
+ [ ] buffered write enabled
292
+ [ ] render cache working
293
+ [ ] only changed content renders
294
+
295
+
296
+ critical rules for terminal rendering:
297
+
298
+ [1] NEVER directly modify terminal_renderer state
299
+ use message_coordinator methods instead
300
+
301
+ [2] ALWAYS call enter_alternate_buffer before modal
302
+ and exit_alternate_buffer after modal closes
303
+
304
+ [3] ALWAYS use display_message_sequence for messages
305
+ never write directly during active render loop
306
+
307
+ [4] ALWAYS invalidate_render_cache after external changes
308
+ resize, config change, manual refresh
309
+
310
+ [5] ALWAYS use _exit_modal_mode or _exit_modal_mode_minimal
311
+ never mix exit patterns
312
+
313
+ [6] NEVER set writing_messages=True without setting False later
314
+ this blocks the render loop permanently
315
+
316
+ [7] ALWAYS check command_mode before rendering
317
+ skip render when modal or live_modal is active
318
+
319
+ [8] ALWAYS use buffered write for multiple operations
320
+ reduces flicker, especially on windows
321
+
322
+
323
+ quick diagnostic commands:
324
+
325
+ check all render state at once:
326
+ grep -n "self\.writing_messages\|self\.input_line_written\|self\.last_line_count" core/io/terminal_renderer.py
327
+
328
+ find all message display paths:
329
+ grep -rn "display_message_sequence\|display_single_message\|display_queued_messages" core/
330
+
331
+ trace modal lifecycle:
332
+ grep -rn "enter_alternate_buffer\|exit_alternate_buffer" core/
333
+
334
+ check render cache usage:
335
+ grep -rn "invalidate_render_cache\|_last_render_content" core/
336
+
337
+ find all clear operations:
338
+ grep -rn "clear_active_area\|clear_line" core/io/
339
+
340
+
341
+ debugging checklist:
342
+
343
+ initial diagnosis:
344
+ [ ] what is the visual symptom?
345
+ [ ] when does it occur? (startup, modal, resize, idle)
346
+ [ ] is it reproducible?
347
+ [ ] what was the last action before symptom?
348
+
349
+ state inspection:
350
+ [ ] check renderer.writing_messages flag
351
+ [ ] check renderer.input_line_written flag
352
+ [ ] check coordinator._in_alternate_buffer
353
+ [ ] check render cache content
354
+ [ ] check message queue status
355
+
356
+ code inspection:
357
+ [ ] find where symptom originates
358
+ [ ] trace code path from symptom to state change
359
+ [ ] identify missing state reset
360
+ [ ] verify buffer transition calls
361
+
362
+ fix verification:
363
+ [ ] apply minimal fix
364
+ [ ] test symptom is gone
365
+ [ ] test no new symptoms introduced
366
+ [ ] verify state consistency after fix
367
+
368
+
369
+ advanced debugging:
370
+
371
+ add render state logging:
372
+ import logging
373
+ logger = logging.getLogger(__name__)
374
+
375
+ # in render_active_area
376
+ logger.debug(f"render state: writing_messages={self.writing_messages}, "
377
+ f"input_line_written={self.input_line_written}, "
378
+ f"last_line_count={self.last_line_count}")
379
+
380
+ trace message flow:
381
+ # in message_coordinator
382
+ logger.debug(f"queue status: {self.get_queue_status()}")
383
+ logger.debug(f"buffer state: {self._in_alternate_buffer}")
384
+
385
+ trace buffer transitions:
386
+ # add logging in enter/exit methods
387
+ logger.debug(f"buffer transition: enter={self._in_alternate_buffer}, "
388
+ f"saved={self._saved_main_buffer_state}")