ctrlcode 0.1.0__tar.gz

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 (181) hide show
  1. ctrlcode-0.1.0/.gitignore +87 -0
  2. ctrlcode-0.1.0/AGENT.md +46 -0
  3. ctrlcode-0.1.0/INTEGRATION_SUMMARY.md +283 -0
  4. ctrlcode-0.1.0/PKG-INFO +93 -0
  5. ctrlcode-0.1.0/README.md +73 -0
  6. ctrlcode-0.1.0/benchmarks/benchmark_batch_embedding.py +136 -0
  7. ctrlcode-0.1.0/benchmarks/benchmark_lru_cache.py +268 -0
  8. ctrlcode-0.1.0/benchmarks/benchmark_persistent_index.py +249 -0
  9. ctrlcode-0.1.0/benchmarks/historical_learning_benchmark.py +366 -0
  10. ctrlcode-0.1.0/benchmarks/profile_performance.py +342 -0
  11. ctrlcode-0.1.0/config.example.toml +75 -0
  12. ctrlcode-0.1.0/docs/AGENTS.md +108 -0
  13. ctrlcode-0.1.0/docs/WORLD_CLASS_AGENT_PROPOSAL.md +1553 -0
  14. ctrlcode-0.1.0/docs/active-plans/agent-registry-integration.md +218 -0
  15. ctrlcode-0.1.0/docs/active-plans/event-driven-tui-summary.md +522 -0
  16. ctrlcode-0.1.0/docs/active-plans/multi-agent-architecture.md +318 -0
  17. ctrlcode-0.1.0/docs/active-plans/multi-agent-tui-integration.md +659 -0
  18. ctrlcode-0.1.0/docs/active-plans/simplified-tui-redesign.md +885 -0
  19. ctrlcode-0.1.0/docs/active-plans/tui-integration-complete.md +357 -0
  20. ctrlcode-0.1.0/docs/active-plans/tui-integration-progress.md +329 -0
  21. ctrlcode-0.1.0/docs/architectural-patterns/event-bus-architecture.md +552 -0
  22. ctrlcode-0.1.0/docs/architectural-patterns.md +253 -0
  23. ctrlcode-0.1.0/docs/coding-standards.md +185 -0
  24. ctrlcode-0.1.0/docs/core-beliefs.md +93 -0
  25. ctrlcode-0.1.0/docs/generated/tool-registry.md +86 -0
  26. ctrlcode-0.1.0/docs/golden-principles/index.md +53 -0
  27. ctrlcode-0.1.0/docs/golden-principles/no-yolo-parsing.md +249 -0
  28. ctrlcode-0.1.0/docs/golden-principles/prefer-shared-utils.md +345 -0
  29. ctrlcode-0.1.0/docs/golden-principles/structured-logging.md +504 -0
  30. ctrlcode-0.1.0/docs/references/harness-utils-api.md +307 -0
  31. ctrlcode-0.1.0/docs/references/multi-agent-guide.md +777 -0
  32. ctrlcode-0.1.0/docs/tech-debt/tracker.md +73 -0
  33. ctrlcode-0.1.0/docs/user-guide/configuration.md +409 -0
  34. ctrlcode-0.1.0/docs/user-guide/features.md +636 -0
  35. ctrlcode-0.1.0/docs/user-guide/getting-started.md +112 -0
  36. ctrlcode-0.1.0/docs/user-guide/security.md +485 -0
  37. ctrlcode-0.1.0/main.py +6 -0
  38. ctrlcode-0.1.0/prompts/SYSTEM_PROMPT.md +36 -0
  39. ctrlcode-0.1.0/prompts/agents/cleanup.md +397 -0
  40. ctrlcode-0.1.0/prompts/agents/coder.md +326 -0
  41. ctrlcode-0.1.0/prompts/agents/executor.md +666 -0
  42. ctrlcode-0.1.0/prompts/agents/orchestrator.md +483 -0
  43. ctrlcode-0.1.0/prompts/agents/planner.md +275 -0
  44. ctrlcode-0.1.0/prompts/agents/reviewer.md +358 -0
  45. ctrlcode-0.1.0/pyproject.toml +49 -0
  46. ctrlcode-0.1.0/src/ctrlcode/__init__.py +8 -0
  47. ctrlcode-0.1.0/src/ctrlcode/agents/__init__.py +29 -0
  48. ctrlcode-0.1.0/src/ctrlcode/agents/cleanup.py +388 -0
  49. ctrlcode-0.1.0/src/ctrlcode/agents/communication.py +439 -0
  50. ctrlcode-0.1.0/src/ctrlcode/agents/observability.py +421 -0
  51. ctrlcode-0.1.0/src/ctrlcode/agents/react_loop.py +297 -0
  52. ctrlcode-0.1.0/src/ctrlcode/agents/registry.py +211 -0
  53. ctrlcode-0.1.0/src/ctrlcode/agents/result_parser.py +242 -0
  54. ctrlcode-0.1.0/src/ctrlcode/agents/workflow.py +723 -0
  55. ctrlcode-0.1.0/src/ctrlcode/analysis/__init__.py +28 -0
  56. ctrlcode-0.1.0/src/ctrlcode/analysis/ast_diff.py +163 -0
  57. ctrlcode-0.1.0/src/ctrlcode/analysis/bug_detector.py +149 -0
  58. ctrlcode-0.1.0/src/ctrlcode/analysis/code_graphs.py +329 -0
  59. ctrlcode-0.1.0/src/ctrlcode/analysis/semantic.py +205 -0
  60. ctrlcode-0.1.0/src/ctrlcode/analysis/static.py +183 -0
  61. ctrlcode-0.1.0/src/ctrlcode/analysis/synthesizer.py +281 -0
  62. ctrlcode-0.1.0/src/ctrlcode/analysis/tests.py +189 -0
  63. ctrlcode-0.1.0/src/ctrlcode/cleanup/__init__.py +16 -0
  64. ctrlcode-0.1.0/src/ctrlcode/cleanup/auto_merge.py +350 -0
  65. ctrlcode-0.1.0/src/ctrlcode/cleanup/doc_gardening.py +388 -0
  66. ctrlcode-0.1.0/src/ctrlcode/cleanup/pr_automation.py +330 -0
  67. ctrlcode-0.1.0/src/ctrlcode/cleanup/scheduler.py +356 -0
  68. ctrlcode-0.1.0/src/ctrlcode/config.py +380 -0
  69. ctrlcode-0.1.0/src/ctrlcode/embeddings/__init__.py +6 -0
  70. ctrlcode-0.1.0/src/ctrlcode/embeddings/embedder.py +192 -0
  71. ctrlcode-0.1.0/src/ctrlcode/embeddings/vector_store.py +213 -0
  72. ctrlcode-0.1.0/src/ctrlcode/fuzzing/__init__.py +24 -0
  73. ctrlcode-0.1.0/src/ctrlcode/fuzzing/analyzer.py +280 -0
  74. ctrlcode-0.1.0/src/ctrlcode/fuzzing/budget.py +112 -0
  75. ctrlcode-0.1.0/src/ctrlcode/fuzzing/context.py +665 -0
  76. ctrlcode-0.1.0/src/ctrlcode/fuzzing/context_fuzzer.py +506 -0
  77. ctrlcode-0.1.0/src/ctrlcode/fuzzing/derived_orchestrator.py +732 -0
  78. ctrlcode-0.1.0/src/ctrlcode/fuzzing/oracle_adapter.py +135 -0
  79. ctrlcode-0.1.0/src/ctrlcode/linters/__init__.py +11 -0
  80. ctrlcode-0.1.0/src/ctrlcode/linters/hand_rolled_utils.py +221 -0
  81. ctrlcode-0.1.0/src/ctrlcode/linters/yolo_parsing.py +217 -0
  82. ctrlcode-0.1.0/src/ctrlcode/metrics/__init__.py +6 -0
  83. ctrlcode-0.1.0/src/ctrlcode/metrics/dashboard.py +283 -0
  84. ctrlcode-0.1.0/src/ctrlcode/metrics/tech_debt.py +663 -0
  85. ctrlcode-0.1.0/src/ctrlcode/paths.py +68 -0
  86. ctrlcode-0.1.0/src/ctrlcode/permissions.py +179 -0
  87. ctrlcode-0.1.0/src/ctrlcode/providers/__init__.py +15 -0
  88. ctrlcode-0.1.0/src/ctrlcode/providers/anthropic.py +138 -0
  89. ctrlcode-0.1.0/src/ctrlcode/providers/base.py +77 -0
  90. ctrlcode-0.1.0/src/ctrlcode/providers/openai.py +197 -0
  91. ctrlcode-0.1.0/src/ctrlcode/providers/parallel.py +104 -0
  92. ctrlcode-0.1.0/src/ctrlcode/server.py +871 -0
  93. ctrlcode-0.1.0/src/ctrlcode/session/__init__.py +6 -0
  94. ctrlcode-0.1.0/src/ctrlcode/session/baseline.py +57 -0
  95. ctrlcode-0.1.0/src/ctrlcode/session/manager.py +967 -0
  96. ctrlcode-0.1.0/src/ctrlcode/skills/__init__.py +10 -0
  97. ctrlcode-0.1.0/src/ctrlcode/skills/builtin/commit.toml +29 -0
  98. ctrlcode-0.1.0/src/ctrlcode/skills/builtin/docs.toml +25 -0
  99. ctrlcode-0.1.0/src/ctrlcode/skills/builtin/refactor.toml +33 -0
  100. ctrlcode-0.1.0/src/ctrlcode/skills/builtin/review.toml +28 -0
  101. ctrlcode-0.1.0/src/ctrlcode/skills/builtin/test.toml +28 -0
  102. ctrlcode-0.1.0/src/ctrlcode/skills/loader.py +111 -0
  103. ctrlcode-0.1.0/src/ctrlcode/skills/registry.py +139 -0
  104. ctrlcode-0.1.0/src/ctrlcode/storage/__init__.py +19 -0
  105. ctrlcode-0.1.0/src/ctrlcode/storage/history_db.py +708 -0
  106. ctrlcode-0.1.0/src/ctrlcode/tools/__init__.py +220 -0
  107. ctrlcode-0.1.0/src/ctrlcode/tools/bash.py +112 -0
  108. ctrlcode-0.1.0/src/ctrlcode/tools/browser.py +352 -0
  109. ctrlcode-0.1.0/src/ctrlcode/tools/executor.py +153 -0
  110. ctrlcode-0.1.0/src/ctrlcode/tools/explore.py +486 -0
  111. ctrlcode-0.1.0/src/ctrlcode/tools/mcp.py +108 -0
  112. ctrlcode-0.1.0/src/ctrlcode/tools/observability.py +561 -0
  113. ctrlcode-0.1.0/src/ctrlcode/tools/registry.py +193 -0
  114. ctrlcode-0.1.0/src/ctrlcode/tools/todo.py +291 -0
  115. ctrlcode-0.1.0/src/ctrlcode/tools/update.py +266 -0
  116. ctrlcode-0.1.0/src/ctrlcode/tools/webfetch.py +147 -0
  117. ctrlcode-0.1.0/tests/__init__.py +1 -0
  118. ctrlcode-0.1.0/tests/analysis/test_bug_detector.py +222 -0
  119. ctrlcode-0.1.0/tests/analysis/test_code_graphs.py +428 -0
  120. ctrlcode-0.1.0/tests/conftest.py +51 -0
  121. ctrlcode-0.1.0/tests/demo_agents.py +175 -0
  122. ctrlcode-0.1.0/tests/embeddings/test_batch_embedding.py +126 -0
  123. ctrlcode-0.1.0/tests/embeddings/test_embedder.py +125 -0
  124. ctrlcode-0.1.0/tests/embeddings/test_vector_store.py +175 -0
  125. ctrlcode-0.1.0/tests/fuzzing/test_context.py +352 -0
  126. ctrlcode-0.1.0/tests/fuzzing/test_oracle_adapter.py +240 -0
  127. ctrlcode-0.1.0/tests/fuzzing/test_persistent_vector_store.py +342 -0
  128. ctrlcode-0.1.0/tests/integration/test_full_pipeline.py +519 -0
  129. ctrlcode-0.1.0/tests/integration_example.py +286 -0
  130. ctrlcode-0.1.0/tests/metrics/test_dashboard.py +266 -0
  131. ctrlcode-0.1.0/tests/mocks/__init__.py +5 -0
  132. ctrlcode-0.1.0/tests/mocks/mock_provider.py +178 -0
  133. ctrlcode-0.1.0/tests/storage/test_history_db.py +293 -0
  134. ctrlcode-0.1.0/tests/storage/test_oracle_versioning.py +292 -0
  135. ctrlcode-0.1.0/tests/test_agent_execution.py +388 -0
  136. ctrlcode-0.1.0/tests/test_agent_registry.py +313 -0
  137. ctrlcode-0.1.0/tests/test_auto_merge.py +393 -0
  138. ctrlcode-0.1.0/tests/test_browser_tools.py +325 -0
  139. ctrlcode-0.1.0/tests/test_cleanup_scheduler.py +271 -0
  140. ctrlcode-0.1.0/tests/test_doc_gardening.py +293 -0
  141. ctrlcode-0.1.0/tests/test_linters.py +297 -0
  142. ctrlcode-0.1.0/tests/test_observability_tools.py +394 -0
  143. ctrlcode-0.1.0/tests/test_pr_automation.py +312 -0
  144. ctrlcode-0.1.0/tests/test_tech_debt_metrics.py +213 -0
  145. ctrlcode-0.1.0/tui/README.md +84 -0
  146. ctrlcode-0.1.0/tui/ctrlcode_tui/__init__.py +3 -0
  147. ctrlcode-0.1.0/tui/ctrlcode_tui/app.py +1738 -0
  148. ctrlcode-0.1.0/tui/ctrlcode_tui/app_event_bus_example.py +525 -0
  149. ctrlcode-0.1.0/tui/ctrlcode_tui/app_simplified_example.py +344 -0
  150. ctrlcode-0.1.0/tui/ctrlcode_tui/client.py +285 -0
  151. ctrlcode-0.1.0/tui/ctrlcode_tui/event_bus.py +288 -0
  152. ctrlcode-0.1.0/tui/ctrlcode_tui/event_bus_new.py +288 -0
  153. ctrlcode-0.1.0/tui/ctrlcode_tui/launcher.py +134 -0
  154. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/__init__.py +29 -0
  155. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/agent_panel.py +117 -0
  156. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/code_block.py +102 -0
  157. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/fuzzing.py +61 -0
  158. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/history_input.py +75 -0
  159. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modal_base.py +62 -0
  160. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/__init__.py +19 -0
  161. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/agents_modal.py +109 -0
  162. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/history_modal.py +194 -0
  163. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/metrics_modal.py +112 -0
  164. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/permission_modal.py +87 -0
  165. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/review_modal.py +118 -0
  166. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/status_modal.py +123 -0
  167. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/modals/tasks_modal.py +84 -0
  168. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/observability_results.py +153 -0
  169. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/parallel_execution.py +115 -0
  170. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/review_feedback.py +116 -0
  171. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/status_line.py +58 -0
  172. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/task_graph.py +146 -0
  173. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/todo_modal.py +137 -0
  174. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/tool_panel.py +57 -0
  175. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/variants.py +50 -0
  176. ctrlcode-0.1.0/tui/ctrlcode_tui/widgets/workflow_status.py +86 -0
  177. ctrlcode-0.1.0/tui/pyproject.toml +21 -0
  178. ctrlcode-0.1.0/tui/src/ctrlcode_tui/__init__.py +2 -0
  179. ctrlcode-0.1.0/tui/src/ctrlcode_tui/py.typed +0 -0
  180. ctrlcode-0.1.0/twitter.txt +139 -0
  181. ctrlcode-0.1.0/wandb.key +1 -0
@@ -0,0 +1,87 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+
25
+ # Virtual Environments
26
+ .env
27
+ .venv
28
+ env/
29
+ venv/
30
+ ENV/
31
+ env.bak/
32
+ venv.bak/
33
+
34
+ # PyInstaller
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Unit test / coverage
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+ cover/
52
+
53
+ # MyPy
54
+ .mypy_cache/
55
+ .dmypy.json
56
+ dmypy.json
57
+
58
+ # Ruff
59
+ .ruff_cache/
60
+
61
+ # IDEs
62
+ .vscode/
63
+ .idea/
64
+ *.swp
65
+ *.swo
66
+ *~
67
+ .DS_Store
68
+
69
+ # Project specific
70
+ *.log
71
+ .claude/
72
+ *.jsonl
73
+
74
+ # Config files with secrets
75
+ config.toml
76
+ **/config.toml
77
+ !**/config.example.toml
78
+ .ctrlcode/
79
+
80
+ # Temporary files
81
+ *.tmp
82
+ tmp/
83
+ temp/
84
+
85
+ # uv
86
+ .python-version
87
+ uv.lock
@@ -0,0 +1,46 @@
1
+ # ctrl+code Project Instructions
2
+
3
+ > Note: This is the project-level AGENT.md. Global defaults are in ~/.config/ctrlcode/AGENT.md
4
+
5
+ ## Project Overview
6
+
7
+ This is a differential fuzzing harness for AI-assisted coding. It generates code variants, runs tests, and uses static/semantic analysis to find the best implementation.
8
+
9
+ ## Architecture
10
+
11
+ - **Server** (`src/ctrlcode/server.py`): JSON-RPC server handling sessions
12
+ - **Session Manager** (`src/ctrlcode/session/manager.py`): Conversation orchestration
13
+ - **Providers** (`src/ctrlcode/providers/`): LLM integrations (OpenAI, Anthropic)
14
+ - **Tools** (`src/ctrlcode/tools/`): Built-in explore tools + MCP support
15
+ - **Skills** (`src/ctrlcode/skills/`): Reusable command templates
16
+ - **Fuzzing** (`src/ctrlcode/fuzzing/`): Variant generation and analysis
17
+ - **TUI** (`tui/`): Textual-based interface
18
+
19
+ ## Code Style
20
+
21
+ - Use Python 3.12+ features (type hints, match/case, etc.)
22
+ - Prefer async/await for I/O operations
23
+ - Keep functions focused and single-purpose
24
+ - Use dataclasses for structured data
25
+ - Follow existing logging patterns (`logger.info/warning/error`)
26
+
27
+ ## Tool Usage
28
+
29
+ When exploring this codebase:
30
+ - Use `search_code` to find class/function definitions
31
+ - Use `search_files` to locate files by pattern
32
+ - Use `read_file` to examine implementation details
33
+ - Check related files (e.g., if editing a provider, check base.py first)
34
+
35
+ ## Testing
36
+
37
+ - Run tests with `uv run pytest`
38
+ - Skills are in `src/ctrlcode/skills/builtin/`
39
+ - Test execution uses `analysis/tests.py`
40
+
41
+ ## Key Patterns
42
+
43
+ - All RPC methods are in `server.py` and call into `SessionManager`
44
+ - Tool execution loop is in `session/manager.py:process_turn()`
45
+ - Streaming events use `StreamEvent` dataclass from `providers/base.py`
46
+ - Skills expand via `SkillRegistry.process_input()`
@@ -0,0 +1,283 @@
1
+ # Event-Driven TUI Integration - Complete ✅
2
+
3
+ **Date:** 2026-02-14
4
+ **Status:** Ready for Testing
5
+
6
+ ---
7
+
8
+ ## What We Built
9
+
10
+ ### 🎯 Core Achievement
11
+
12
+ Built a **simple, event-driven TUI** with:
13
+ 1. ✅ Clean chat-first interface (no clutter)
14
+ 2. ✅ On-demand modals via slash commands
15
+ 3. ✅ **Event bus viewer** - see everything on the bus
16
+ 4. ✅ Complete event history tracking
17
+ 5. ✅ Loosely coupled components via events
18
+
19
+ ---
20
+
21
+ ## New Slash Commands
22
+
23
+ ```bash
24
+ /status # ⭐ Event bus viewer (shows ALL events)
25
+ /agents # Show active agents
26
+ /tasks # Show task graph
27
+ /review # Show review feedback
28
+ /metrics # Show observability results
29
+ ```
30
+
31
+ **How it works:**
32
+ - Inline summaries appear in chat automatically
33
+ - Type `/command` to see full details in modal
34
+ - Press ESC to close modal
35
+
36
+ ---
37
+
38
+ ## Event Bus Viewer (`/status`) - The Key Feature
39
+
40
+ Shows **every single event** flowing through the system:
41
+
42
+ ```
43
+ ╔══════════════════════════════════════╗
44
+ ║ Event Bus Stream ║
45
+ ╠══════════════════════════════════════╣
46
+ ║ 14:32:01 workflow_phase_change ║
47
+ ║ phase: idle → planning ║
48
+ ║ progress: 0.0 ║
49
+ ║ ║
50
+ ║ 14:32:05 workflow_agent_spawned ║
51
+ ║ agent_id: planner-1 ║
52
+ ║ type: planner ║
53
+ ║ task: Decompose intent ║
54
+ ║ ║
55
+ ║ 14:32:08 workflow_task_graph_created ║
56
+ ║ tasks: 5 ║
57
+ ╚══════════════════════════════════════╝
58
+ [Auto-scroll ON] Press Space, ESC to close
59
+ ```
60
+
61
+ **Why it matters:**
62
+ - Complete transparency into multi-agent workflows
63
+ - Debug issues by viewing event sequence
64
+ - No more black box - see everything
65
+ - Full audit trail
66
+
67
+ ---
68
+
69
+ ## Files Created
70
+
71
+ ```
72
+ tui/ctrlcode_tui/
73
+ ├── event_bus_new.py # Async event bus + history
74
+ ├── widgets/
75
+ │ ├── status_line.py # Single-line status
76
+ │ ├── modal_base.py # Modal base class
77
+ │ └── modals/
78
+ │ ├── __init__.py
79
+ │ ├── status_modal.py # Event bus viewer ⭐
80
+ │ ├── agents_modal.py # Active agents
81
+ │ ├── tasks_modal.py # Task graph
82
+ │ ├── review_modal.py # Review feedback
83
+ │ └── metrics_modal.py # Observability
84
+
85
+ docs/
86
+ ├── active-plans/
87
+ │ ├── simplified-tui-redesign.md # Design plan
88
+ │ ├── event-driven-tui-summary.md # Architecture
89
+ │ └── tui-integration-complete.md # Integration details
90
+ └── architectural-patterns/
91
+ └── event-bus-architecture.md # Event bus patterns
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Files Modified
97
+
98
+ ```
99
+ tui/ctrlcode_tui/app.py
100
+ ├── ✅ Added LegacyEventBus wrapper (backwards compat)
101
+ ├── ✅ Added 5 new slash commands
102
+ ├── ✅ Added modal action methods
103
+ ├── ✅ Added state tracking (agents, tasks, feedback, metrics)
104
+ ├── ✅ Updated event handlers to populate state
105
+ ├── ✅ Updated help text
106
+ └── ✅ Added inline hints ("Type /tasks for full graph")
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Architecture
112
+
113
+ ```
114
+ Event Flow:
115
+ Workflow publishes event
116
+
117
+ EventBus receives
118
+
119
+ Distributes to subscribers
120
+
121
+ ┌─────────┬──────────┬──────────┐
122
+ │ │ │ │
123
+ Chat StatusModal AgentsModal etc.
124
+ (inline) (bus viewer) (on-demand)
125
+ ```
126
+
127
+ **Key benefits:**
128
+ - Components don't know about each other
129
+ - Event bus is single source of truth
130
+ - Complete observability
131
+ - Easy to add new subscribers
132
+
133
+ ---
134
+
135
+ ## Testing
136
+
137
+ ### Verify Integration
138
+
139
+ ```bash
140
+ cd /home/jtregunna/Projects/ctrl+code
141
+
142
+ # 1. Test imports
143
+ uv run python -c "from tui.ctrlcode_tui.event_bus_new import EventBus; print('✅ Event bus OK')"
144
+ uv run python -c "from tui.ctrlcode_tui.widgets.modals import StatusModal; print('✅ Modals OK')"
145
+
146
+ # 2. Start TUI
147
+ uv run ctrl-code tui
148
+
149
+ # 3. In TUI, test commands:
150
+ /help # Should show new commands
151
+ /status # Should open event bus viewer (empty for now)
152
+ # Press ESC to close
153
+ ```
154
+
155
+ ### Manual Test Workflow
156
+
157
+ ```
158
+ 1. Type "/help"
159
+ → Verify 5 new commands listed under "Multi-Agent Workflow Commands"
160
+
161
+ 2. Type "/status"
162
+ → Event bus viewer modal opens
163
+ → Shows "Event Bus Stream" title
164
+ → Currently empty (no events yet)
165
+ → Press ESC to close
166
+
167
+ 3. Type "/agents"
168
+ → Shows "No agents active (not in multi-agent mode)"
169
+
170
+ 4. Type "/tasks"
171
+ → Shows "No task graph available"
172
+
173
+ 5. When workflow runs (future):
174
+ → Events appear in chat inline
175
+ → Type "/status" to see all events
176
+ → Type "/agents" to see agent details
177
+ → Type "/tasks" to see full task graph
178
+ ```
179
+
180
+ ---
181
+
182
+ ## What's Next
183
+
184
+ ### 1. Wire Workflow to Event Bus
185
+
186
+ **File:** `src/ctrlcode/session/manager.py`
187
+
188
+ **Need:**
189
+ - Pass TUI event bus to workflow orchestrator
190
+ - Workflow calls `await bus.publish()` for each event
191
+ - Events flow: Workflow → EventBus → TUI → Modals
192
+
193
+ ### 2. Test End-to-End
194
+
195
+ - Run multi-agent workflow
196
+ - Verify events appear in `/status`
197
+ - Verify modals show real-time data
198
+ - Verify inline hints work
199
+
200
+ ### 3. Polish
201
+
202
+ - Animations (fade in/out)
203
+ - Color coding by event type
204
+ - Keyboard shortcuts (Ctrl+S for /status)
205
+ - Event filtering in bus viewer
206
+
207
+ ---
208
+
209
+ ## Event Catalog
210
+
211
+ All events defined in `event_bus_new.py`:
212
+
213
+ **Workflow Events:**
214
+ - `workflow_phase_change` - Phase transitions
215
+ - `workflow_agent_spawned` - New agent created
216
+ - `workflow_agent_updated` - Agent progress
217
+ - `workflow_agent_completed` - Agent finished
218
+ - `workflow_task_graph_created` - Planner output
219
+ - `workflow_task_updated` - Task status change
220
+ - `workflow_review_feedback` - Reviewer issues
221
+ - `workflow_observability_results` - Validation
222
+ - `workflow_error` - Error occurred
223
+ - `workflow_complete` - Workflow done
224
+
225
+ **UI Events:**
226
+ - `ui_command_entered` - User typed /command
227
+ - `ui_modal_opened` - Modal opened
228
+ - `ui_modal_closed` - Modal closed
229
+
230
+ **System Events:**
231
+ - `system_info` - Info message
232
+ - `system_warning` - Warning
233
+ - `system_error` - Error
234
+
235
+ ---
236
+
237
+ ## Success Criteria
238
+
239
+ - [x] Event bus implemented with history
240
+ - [x] Event catalog defined (EventTypes)
241
+ - [x] Modals created (5 modals)
242
+ - [x] Slash commands added (5 new commands)
243
+ - [x] State tracking integrated
244
+ - [x] Event handlers updated
245
+ - [x] Help text updated
246
+ - [x] Inline hints added
247
+ - [x] Imports verified (✅ all working)
248
+ - [ ] Workflow connected to event bus
249
+ - [ ] End-to-end test with real workflow
250
+ - [ ] Polish and animations
251
+
252
+ ---
253
+
254
+ ## Key Innovation
255
+
256
+ **Event Bus Viewer (`/status`)** provides:
257
+ - Complete transparency into system
258
+ - Full audit trail of all events
259
+ - Real-time debugging capability
260
+ - No more "what's happening?" mystery
261
+
262
+ This single feature makes complex multi-agent workflows **debuggable** and **understandable**.
263
+
264
+ ---
265
+
266
+ ## Ready to Use
267
+
268
+ ```bash
269
+ # Start TUI
270
+ uv run ctrl-code tui
271
+
272
+ # Try new commands
273
+ /help
274
+ /status
275
+ /agents
276
+ /tasks
277
+ ```
278
+
279
+ **Next:** Connect workflow orchestrator to event bus, then test with real multi-agent workflow.
280
+
281
+ ---
282
+
283
+ **Integration Status:** ✅ Complete and ready for workflow connection
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: ctrlcode
3
+ Version: 0.1.0
4
+ Summary: Adaptive coding harness with differential fuzzing - transforms AI slop into production-ready code
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: aiohttp>=3.10.0
7
+ Requires-Dist: anthropic>=0.40.0
8
+ Requires-Dist: apscheduler>=3.11.2
9
+ Requires-Dist: ctrlcode-tui
10
+ Requires-Dist: faiss-cpu>=1.13.2
11
+ Requires-Dist: harness-utils>=0.3.1
12
+ Requires-Dist: mcp>=1.0.0
13
+ Requires-Dist: networkx>=3.6.1
14
+ Requires-Dist: openai>=1.54.0
15
+ Requires-Dist: platformdirs>=4.5.1
16
+ Requires-Dist: playwright>=1.58.0
17
+ Requires-Dist: sentence-transformers>=5.2.2
18
+ Requires-Dist: tiktoken>=0.12.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # ctrl+code
22
+
23
+ Adaptive coding harness with differential fuzzing - transforms AI slop into production-ready code.
24
+
25
+ ## Configuration
26
+
27
+ ctrl+code follows platform conventions for config and data storage:
28
+
29
+ | Platform | Config | Data | Cache |
30
+ |----------|--------|------|-------|
31
+ | **Linux** | `~/.config/ctrlcode/` | `~/.local/share/ctrlcode/` | `~/.cache/ctrlcode/` |
32
+ | **macOS** | `~/Library/Application Support/ctrlcode/` | `~/Library/Application Support/ctrlcode/` | `~/Library/Caches/ctrlcode/` |
33
+ | **Windows** | `%APPDATA%\ctrlcode\` | `%LOCALAPPDATA%\ctrlcode\` | `%LOCALAPPDATA%\ctrlcode\Cache\` |
34
+
35
+ ### Environment Variables
36
+
37
+ Override default directories:
38
+ - `CTRLCODE_CONFIG_DIR`: Config file location
39
+ - `CTRLCODE_DATA_DIR`: Session logs and persistent data
40
+ - `CTRLCODE_CACHE_DIR`: Conversation storage and temp files
41
+
42
+ ### Configuration File
43
+
44
+ Copy `config.example.toml` to your config directory as `config.toml` and fill in your API keys.
45
+
46
+ ### Agent Instructions (AGENT.md)
47
+
48
+ Customize agent behavior with `AGENT.md` files, loaded hierarchically:
49
+
50
+ 1. **Global** (`~/.config/ctrlcode/AGENT.md`) - Your personal defaults across all projects
51
+ 2. **Project** (`<workspace>/AGENT.md`) - Project-specific instructions
52
+
53
+ Example global `AGENT.md`:
54
+ ```markdown
55
+ # Global Agent Defaults
56
+
57
+ - Always use semantic commit messages
58
+ - Show tool results explicitly
59
+ - Prefer built-in tools over scripts
60
+ ```
61
+
62
+ Example project `AGENT.md`:
63
+ ```markdown
64
+ # MyProject Instructions
65
+
66
+ ## Architecture
67
+ - Frontend: React + TypeScript
68
+ - Backend: FastAPI + PostgreSQL
69
+
70
+ ## Style
71
+ - Use async/await for all I/O
72
+ - Prefer functional components
73
+ ```
74
+
75
+ Instructions are injected into the system prompt, giving the agent context about your preferences and project structure.
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ uv pip install ctrlcode
81
+ ```
82
+
83
+ ## Usage
84
+
85
+ Start the TUI (auto-launches server):
86
+ ```bash
87
+ ctrlcode
88
+ ```
89
+
90
+ Or start server separately:
91
+ ```bash
92
+ ctrlcode-server
93
+ ```
@@ -0,0 +1,73 @@
1
+ # ctrl+code
2
+
3
+ Adaptive coding harness with differential fuzzing - transforms AI slop into production-ready code.
4
+
5
+ ## Configuration
6
+
7
+ ctrl+code follows platform conventions for config and data storage:
8
+
9
+ | Platform | Config | Data | Cache |
10
+ |----------|--------|------|-------|
11
+ | **Linux** | `~/.config/ctrlcode/` | `~/.local/share/ctrlcode/` | `~/.cache/ctrlcode/` |
12
+ | **macOS** | `~/Library/Application Support/ctrlcode/` | `~/Library/Application Support/ctrlcode/` | `~/Library/Caches/ctrlcode/` |
13
+ | **Windows** | `%APPDATA%\ctrlcode\` | `%LOCALAPPDATA%\ctrlcode\` | `%LOCALAPPDATA%\ctrlcode\Cache\` |
14
+
15
+ ### Environment Variables
16
+
17
+ Override default directories:
18
+ - `CTRLCODE_CONFIG_DIR`: Config file location
19
+ - `CTRLCODE_DATA_DIR`: Session logs and persistent data
20
+ - `CTRLCODE_CACHE_DIR`: Conversation storage and temp files
21
+
22
+ ### Configuration File
23
+
24
+ Copy `config.example.toml` to your config directory as `config.toml` and fill in your API keys.
25
+
26
+ ### Agent Instructions (AGENT.md)
27
+
28
+ Customize agent behavior with `AGENT.md` files, loaded hierarchically:
29
+
30
+ 1. **Global** (`~/.config/ctrlcode/AGENT.md`) - Your personal defaults across all projects
31
+ 2. **Project** (`<workspace>/AGENT.md`) - Project-specific instructions
32
+
33
+ Example global `AGENT.md`:
34
+ ```markdown
35
+ # Global Agent Defaults
36
+
37
+ - Always use semantic commit messages
38
+ - Show tool results explicitly
39
+ - Prefer built-in tools over scripts
40
+ ```
41
+
42
+ Example project `AGENT.md`:
43
+ ```markdown
44
+ # MyProject Instructions
45
+
46
+ ## Architecture
47
+ - Frontend: React + TypeScript
48
+ - Backend: FastAPI + PostgreSQL
49
+
50
+ ## Style
51
+ - Use async/await for all I/O
52
+ - Prefer functional components
53
+ ```
54
+
55
+ Instructions are injected into the system prompt, giving the agent context about your preferences and project structure.
56
+
57
+ ## Installation
58
+
59
+ ```bash
60
+ uv pip install ctrlcode
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ Start the TUI (auto-launches server):
66
+ ```bash
67
+ ctrlcode
68
+ ```
69
+
70
+ Or start server separately:
71
+ ```bash
72
+ ctrlcode-server
73
+ ```