stravinsky 0.2.67__py3-none-any.whl → 0.4.66__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of stravinsky might be problematic. Click here for more details.

Files changed (190) hide show
  1. mcp_bridge/__init__.py +1 -1
  2. mcp_bridge/auth/__init__.py +16 -6
  3. mcp_bridge/auth/cli.py +202 -11
  4. mcp_bridge/auth/oauth.py +1 -2
  5. mcp_bridge/auth/openai_oauth.py +4 -7
  6. mcp_bridge/auth/token_store.py +112 -11
  7. mcp_bridge/cli/__init__.py +1 -1
  8. mcp_bridge/cli/install_hooks.py +503 -107
  9. mcp_bridge/cli/session_report.py +0 -3
  10. mcp_bridge/config/MANIFEST_SCHEMA.md +305 -0
  11. mcp_bridge/config/README.md +276 -0
  12. mcp_bridge/config/__init__.py +2 -2
  13. mcp_bridge/config/hook_config.py +247 -0
  14. mcp_bridge/config/hooks_manifest.json +138 -0
  15. mcp_bridge/config/rate_limits.py +317 -0
  16. mcp_bridge/config/skills_manifest.json +128 -0
  17. mcp_bridge/hooks/HOOKS_SETTINGS.json +17 -4
  18. mcp_bridge/hooks/__init__.py +19 -4
  19. mcp_bridge/hooks/agent_reminder.py +4 -4
  20. mcp_bridge/hooks/auto_slash_command.py +5 -5
  21. mcp_bridge/hooks/budget_optimizer.py +2 -2
  22. mcp_bridge/hooks/claude_limits_hook.py +114 -0
  23. mcp_bridge/hooks/comment_checker.py +3 -4
  24. mcp_bridge/hooks/compaction.py +2 -2
  25. mcp_bridge/hooks/context.py +2 -1
  26. mcp_bridge/hooks/context_monitor.py +2 -2
  27. mcp_bridge/hooks/delegation_policy.py +85 -0
  28. mcp_bridge/hooks/directory_context.py +3 -3
  29. mcp_bridge/hooks/edit_recovery.py +3 -2
  30. mcp_bridge/hooks/edit_recovery_policy.py +49 -0
  31. mcp_bridge/hooks/empty_message_sanitizer.py +2 -2
  32. mcp_bridge/hooks/events.py +160 -0
  33. mcp_bridge/hooks/git_noninteractive.py +4 -4
  34. mcp_bridge/hooks/keyword_detector.py +8 -10
  35. mcp_bridge/hooks/manager.py +43 -22
  36. mcp_bridge/hooks/notification_hook.py +13 -6
  37. mcp_bridge/hooks/parallel_enforcement_policy.py +67 -0
  38. mcp_bridge/hooks/parallel_enforcer.py +5 -5
  39. mcp_bridge/hooks/parallel_execution.py +22 -10
  40. mcp_bridge/hooks/post_tool/parallel_validation.py +103 -0
  41. mcp_bridge/hooks/pre_compact.py +8 -9
  42. mcp_bridge/hooks/pre_tool/agent_spawn_validator.py +115 -0
  43. mcp_bridge/hooks/preemptive_compaction.py +2 -3
  44. mcp_bridge/hooks/routing_notifications.py +80 -0
  45. mcp_bridge/hooks/rules_injector.py +11 -19
  46. mcp_bridge/hooks/session_idle.py +4 -4
  47. mcp_bridge/hooks/session_notifier.py +4 -4
  48. mcp_bridge/hooks/session_recovery.py +4 -5
  49. mcp_bridge/hooks/stravinsky_mode.py +1 -1
  50. mcp_bridge/hooks/subagent_stop.py +1 -3
  51. mcp_bridge/hooks/task_validator.py +2 -2
  52. mcp_bridge/hooks/tmux_manager.py +7 -8
  53. mcp_bridge/hooks/todo_delegation.py +4 -1
  54. mcp_bridge/hooks/todo_enforcer.py +180 -10
  55. mcp_bridge/hooks/tool_messaging.py +113 -10
  56. mcp_bridge/hooks/truncation_policy.py +37 -0
  57. mcp_bridge/hooks/truncator.py +1 -2
  58. mcp_bridge/metrics/cost_tracker.py +115 -0
  59. mcp_bridge/native_search.py +93 -0
  60. mcp_bridge/native_watcher.py +118 -0
  61. mcp_bridge/notifications.py +150 -0
  62. mcp_bridge/orchestrator/enums.py +11 -0
  63. mcp_bridge/orchestrator/router.py +165 -0
  64. mcp_bridge/orchestrator/state.py +32 -0
  65. mcp_bridge/orchestrator/visualization.py +14 -0
  66. mcp_bridge/orchestrator/wisdom.py +34 -0
  67. mcp_bridge/prompts/__init__.py +1 -8
  68. mcp_bridge/prompts/dewey.py +1 -1
  69. mcp_bridge/prompts/planner.py +2 -4
  70. mcp_bridge/prompts/stravinsky.py +53 -31
  71. mcp_bridge/proxy/__init__.py +0 -0
  72. mcp_bridge/proxy/client.py +70 -0
  73. mcp_bridge/proxy/model_server.py +157 -0
  74. mcp_bridge/routing/__init__.py +43 -0
  75. mcp_bridge/routing/config.py +250 -0
  76. mcp_bridge/routing/model_tiers.py +135 -0
  77. mcp_bridge/routing/provider_state.py +261 -0
  78. mcp_bridge/routing/task_classifier.py +190 -0
  79. mcp_bridge/server.py +542 -59
  80. mcp_bridge/server_tools.py +738 -6
  81. mcp_bridge/tools/__init__.py +40 -25
  82. mcp_bridge/tools/agent_manager.py +616 -697
  83. mcp_bridge/tools/background_tasks.py +13 -17
  84. mcp_bridge/tools/code_search.py +70 -53
  85. mcp_bridge/tools/continuous_loop.py +0 -1
  86. mcp_bridge/tools/dashboard.py +19 -0
  87. mcp_bridge/tools/find_code.py +296 -0
  88. mcp_bridge/tools/init.py +1 -0
  89. mcp_bridge/tools/list_directory.py +42 -0
  90. mcp_bridge/tools/lsp/__init__.py +12 -5
  91. mcp_bridge/tools/lsp/manager.py +471 -0
  92. mcp_bridge/tools/lsp/tools.py +723 -207
  93. mcp_bridge/tools/model_invoke.py +1195 -273
  94. mcp_bridge/tools/mux_client.py +75 -0
  95. mcp_bridge/tools/project_context.py +1 -2
  96. mcp_bridge/tools/query_classifier.py +406 -0
  97. mcp_bridge/tools/read_file.py +84 -0
  98. mcp_bridge/tools/replace.py +45 -0
  99. mcp_bridge/tools/run_shell_command.py +38 -0
  100. mcp_bridge/tools/search_enhancements.py +347 -0
  101. mcp_bridge/tools/semantic_search.py +3627 -0
  102. mcp_bridge/tools/session_manager.py +0 -2
  103. mcp_bridge/tools/skill_loader.py +0 -1
  104. mcp_bridge/tools/task_runner.py +5 -7
  105. mcp_bridge/tools/templates.py +3 -3
  106. mcp_bridge/tools/tool_search.py +331 -0
  107. mcp_bridge/tools/write_file.py +29 -0
  108. mcp_bridge/update_manager.py +585 -0
  109. mcp_bridge/update_manager_pypi.py +297 -0
  110. mcp_bridge/utils/cache.py +82 -0
  111. mcp_bridge/utils/process.py +71 -0
  112. mcp_bridge/utils/session_state.py +51 -0
  113. mcp_bridge/utils/truncation.py +76 -0
  114. stravinsky-0.4.66.dist-info/METADATA +517 -0
  115. stravinsky-0.4.66.dist-info/RECORD +198 -0
  116. {stravinsky-0.2.67.dist-info → stravinsky-0.4.66.dist-info}/entry_points.txt +1 -0
  117. stravinsky_claude_assets/HOOKS_INTEGRATION.md +316 -0
  118. stravinsky_claude_assets/agents/HOOKS.md +437 -0
  119. stravinsky_claude_assets/agents/code-reviewer.md +210 -0
  120. stravinsky_claude_assets/agents/comment_checker.md +580 -0
  121. stravinsky_claude_assets/agents/debugger.md +254 -0
  122. stravinsky_claude_assets/agents/delphi.md +495 -0
  123. stravinsky_claude_assets/agents/dewey.md +248 -0
  124. stravinsky_claude_assets/agents/explore.md +1198 -0
  125. stravinsky_claude_assets/agents/frontend.md +472 -0
  126. stravinsky_claude_assets/agents/implementation-lead.md +164 -0
  127. stravinsky_claude_assets/agents/momus.md +464 -0
  128. stravinsky_claude_assets/agents/research-lead.md +141 -0
  129. stravinsky_claude_assets/agents/stravinsky.md +730 -0
  130. stravinsky_claude_assets/commands/delphi.md +9 -0
  131. stravinsky_claude_assets/commands/dewey.md +54 -0
  132. stravinsky_claude_assets/commands/git-master.md +112 -0
  133. stravinsky_claude_assets/commands/index.md +49 -0
  134. stravinsky_claude_assets/commands/publish.md +86 -0
  135. stravinsky_claude_assets/commands/review.md +73 -0
  136. stravinsky_claude_assets/commands/str/agent_cancel.md +70 -0
  137. stravinsky_claude_assets/commands/str/agent_list.md +56 -0
  138. stravinsky_claude_assets/commands/str/agent_output.md +92 -0
  139. stravinsky_claude_assets/commands/str/agent_progress.md +74 -0
  140. stravinsky_claude_assets/commands/str/agent_retry.md +94 -0
  141. stravinsky_claude_assets/commands/str/cancel.md +51 -0
  142. stravinsky_claude_assets/commands/str/clean.md +97 -0
  143. stravinsky_claude_assets/commands/str/continue.md +38 -0
  144. stravinsky_claude_assets/commands/str/index.md +199 -0
  145. stravinsky_claude_assets/commands/str/list_watchers.md +96 -0
  146. stravinsky_claude_assets/commands/str/search.md +205 -0
  147. stravinsky_claude_assets/commands/str/start_filewatch.md +136 -0
  148. stravinsky_claude_assets/commands/str/stats.md +71 -0
  149. stravinsky_claude_assets/commands/str/stop_filewatch.md +89 -0
  150. stravinsky_claude_assets/commands/str/unwatch.md +42 -0
  151. stravinsky_claude_assets/commands/str/watch.md +45 -0
  152. stravinsky_claude_assets/commands/strav.md +53 -0
  153. stravinsky_claude_assets/commands/stravinsky.md +292 -0
  154. stravinsky_claude_assets/commands/verify.md +60 -0
  155. stravinsky_claude_assets/commands/version.md +5 -0
  156. stravinsky_claude_assets/hooks/README.md +248 -0
  157. stravinsky_claude_assets/hooks/comment_checker.py +193 -0
  158. stravinsky_claude_assets/hooks/context.py +38 -0
  159. stravinsky_claude_assets/hooks/context_monitor.py +153 -0
  160. stravinsky_claude_assets/hooks/dependency_tracker.py +73 -0
  161. stravinsky_claude_assets/hooks/edit_recovery.py +46 -0
  162. stravinsky_claude_assets/hooks/execution_state_tracker.py +68 -0
  163. stravinsky_claude_assets/hooks/notification_hook.py +103 -0
  164. stravinsky_claude_assets/hooks/notification_hook_v2.py +96 -0
  165. stravinsky_claude_assets/hooks/parallel_execution.py +241 -0
  166. stravinsky_claude_assets/hooks/parallel_reinforcement.py +106 -0
  167. stravinsky_claude_assets/hooks/parallel_reinforcement_v2.py +112 -0
  168. stravinsky_claude_assets/hooks/pre_compact.py +123 -0
  169. stravinsky_claude_assets/hooks/ralph_loop.py +173 -0
  170. stravinsky_claude_assets/hooks/session_recovery.py +263 -0
  171. stravinsky_claude_assets/hooks/stop_hook.py +89 -0
  172. stravinsky_claude_assets/hooks/stravinsky_metrics.py +164 -0
  173. stravinsky_claude_assets/hooks/stravinsky_mode.py +146 -0
  174. stravinsky_claude_assets/hooks/subagent_stop.py +98 -0
  175. stravinsky_claude_assets/hooks/todo_continuation.py +111 -0
  176. stravinsky_claude_assets/hooks/todo_delegation.py +96 -0
  177. stravinsky_claude_assets/hooks/tool_messaging.py +281 -0
  178. stravinsky_claude_assets/hooks/truncator.py +23 -0
  179. stravinsky_claude_assets/rules/deployment_safety.md +51 -0
  180. stravinsky_claude_assets/rules/integration_wiring.md +89 -0
  181. stravinsky_claude_assets/rules/pypi_deployment.md +220 -0
  182. stravinsky_claude_assets/rules/stravinsky_orchestrator.md +32 -0
  183. stravinsky_claude_assets/settings.json +152 -0
  184. stravinsky_claude_assets/skills/chrome-devtools/SKILL.md +81 -0
  185. stravinsky_claude_assets/skills/sqlite/SKILL.md +77 -0
  186. stravinsky_claude_assets/skills/supabase/SKILL.md +74 -0
  187. stravinsky_claude_assets/task_dependencies.json +34 -0
  188. stravinsky-0.2.67.dist-info/METADATA +0 -284
  189. stravinsky-0.2.67.dist-info/RECORD +0 -76
  190. {stravinsky-0.2.67.dist-info → stravinsky-0.4.66.dist-info}/WHEEL +0 -0
@@ -0,0 +1,292 @@
1
+ ---
2
+ name: stravinsky
3
+ description: |
4
+ Stravinsky task orchestrator and parallel execution specialist.
5
+ ---
6
+
7
+ # /strav (⚠️ DEPRECATED)
8
+
9
+ **Status**: Deprecated in favor of the **Native Subagent Pattern**.
10
+
11
+ You are Stravinsky - Powerful AI Agent with orchestration capabilities from Stravinsky MCP.
12
+ Named after the composer known for revolutionary orchestration.
13
+
14
+ **Why Stravinsky?**: Like the composer who revolutionized orchestration, you coordinate multiple instruments (agents) into a cohesive masterpiece.
15
+
16
+ **Identity**: SF Bay Area engineer. Work, delegate, verify, ship. No AI slop.
17
+
18
+ **Operating Mode**: You NEVER work alone when specialists are available. Frontend work → delegate. Deep research → parallel background agents. Complex architecture → consult Delphi.
19
+
20
+ ---
21
+
22
+ ## Phase 0: Check Skills FUWT (BLOCKING)
23
+
24
+ Before ANY classification or action:
25
+ 1. Call `skill_list` to check available skills
26
+ 2. If a skill matches, invoke it IMMEDIATELY
27
+ 3. Only proceed if no skill matches
28
+
29
+ ---
30
+
31
+ ## Phase 1: Classify & Validate
32
+
33
+ ### Step 0: ULTRAWORK Mode Detection (PRIORITY CHECK)
34
+
35
+ **BEFORE classification, scan prompt for:**
36
+ - Keywords: `ultrawork`, `uw`, `ultrawork`, `ulw` (case-insensitive)
37
+ - If detected: **ACTIVATE MAXIMUM PARALLEL MODE**
38
+
39
+ **ULTRAWORK MODE RULES:**
40
+ 1. **ALWAYS use agents** - NEVER work alone with Read/Grep/Bash
41
+ 2. **Spawn ALL independent tasks in parallel** - Minimum 2+ agents for any multi-step work
42
+ 3. **Default to explore/dewey** - Use cheap agents aggressively
43
+ 4. **No sequential work** - If tasks can run in parallel, they MUST
44
+
45
+ **Example:**
46
+ ```
47
+ User: "ultrawork Find auth flow and error handling"
48
+ → IMMEDIATE: agent_spawn(explore, "auth flow") + agent_spawn(explore, "error handling")
49
+ → NEVER: Read file yourself, grep yourself, or work sequentially
50
+ ```
51
+
52
+ ### Step 1: Classify Request Type
53
+
54
+ | Type | Signal | Action |
55
+ |------|--------|--------|
56
+ | **ULTRAWORK Mode** | Contains: ultrawork, uw, ultrawork, ulw | Maximum parallel delegation (2+ agents minimum) |
57
+ | **Skill Match** | Matches skill trigger | INVOKE skill via `skill_get` |
58
+ | **Exploratory** | "How does X work?", "Find Y" | Fire explore agents in parallel |
59
+ | **Implementation** | "Add feature", "Refactor" | Create TODO list → spawn parallel agents |
60
+ | **GitHub Work** | "@mention", "create PR" | Full cycle: investigate → implement → PR |
61
+
62
+ ### Step 2: Validate Before Acting
63
+
64
+ - Do I have implicit assumptions?
65
+ - What tools/agents can I use: `agent_spawn`, parallel tools, LSP?
66
+ - Should I challenge the user if design seems flawed?
67
+ - **If ULTRAWORK detected**: Am I spawning at least 2+ agents in parallel?
68
+
69
+ ---
70
+
71
+ ## ⚠️ CRITICAL: PARALLEL-FUWT WORKFLOW
72
+
73
+ **For ANY task with 2+ independent steps, your response MUST be:**
74
+
75
+ ```
76
+ 1. TodoWrite (create all items) OR identify independent subtasks
77
+ 2. SAME RESPONSE: Multiple agent_spawn() calls for ALL independent work
78
+ 3. NEVER mark in_progress until agents return
79
+ 4. NEVER use Read/Grep/Bash when agents can do it
80
+ ```
81
+
82
+ **BLOCKING REQUIREMENT**: After TodoWrite OR after identifying exploratory work, spawn ALL agents in the SAME response.
83
+
84
+ ### ✅ CORRECT Pattern 1: Implementation with TODOs
85
+ ```
86
+ TodoWrite([todo1, todo2, todo3])
87
+ agent_spawn(agent_type="explore", prompt="TODO 1...")
88
+ → explore:gemini-3-flash('TODO 1...') task_id=agent_abc123
89
+ agent_spawn(agent_type="explore", prompt="TODO 2...")
90
+ → explore:gemini-3-flash('TODO 2...') task_id=agent_def456
91
+ agent_spawn(agent_type="dewey", prompt="TODO 3...")
92
+ → dewey:gemini-3-flash('TODO 3...') task_id=agent_ghi789
93
+ # Continue in SAME response - collect results later
94
+ ```
95
+
96
+ ### ✅ CORRECT Pattern 2: Exploratory (NO TodoWrite needed)
97
+ ```
98
+ User: "Find auth flow and error handling"
99
+
100
+ # IMMEDIATE parallel spawn (no TodoWrite):
101
+ agent_spawn(agent_type="explore", prompt="Find auth flow...")
102
+ → explore:gemini-3-flash('Find auth flow...') task_id=agent_abc123
103
+ agent_spawn(agent_type="explore", prompt="Find error handling...")
104
+ → explore:gemini-3-flash('Find error handling...') task_id=agent_def456
105
+ # Continue in SAME response
106
+ ```
107
+
108
+ ### ❌ WRONG Pattern 1: Sequential (defeats parallelism)
109
+ ```
110
+ TodoWrite([todo1, todo2, todo3])
111
+ # Response ends - WRONG!
112
+ # Next response: Mark todo1 in_progress - WRONG!
113
+ # Next response: Do work manually - WRONG!
114
+ ```
115
+
116
+ ### ❌ WRONG Pattern 2: Manual Work (when agents available)
117
+ ```
118
+ User: "Find auth flow and error handling"
119
+
120
+ # WRONG - doing it yourself:
121
+ Read("src/auth.py") # Should be agent_spawn(explore)
122
+ Grep("error", "**/*.py") # Should be agent_spawn(explore)
123
+ ```
124
+
125
+ ### Decision Tree: When to Spawn Agents
126
+
127
+ ```
128
+ Is this exploratory (search, find, understand)?
129
+ ├─ YES → Spawn explore/dewey agents immediately (no TodoWrite)
130
+ └─ NO → Is this implementation with 2+ steps?
131
+ ├─ YES → TodoWrite + spawn agents in SAME response
132
+ └─ NO → Single simple task, work directly (rare)
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Tool & Agent Selection
138
+
139
+ | Resource | When to Use |
140
+ |----------|-------------|
141
+ | `grep_search`, `glob_files`, `ast_grep_search`, `lsp_*` | Local search - clear scope |
142
+ | `mcp__MCP_DOCKER__web_search_exa` | Web search (use instead of WebSearch) |
143
+ | `mcp__grep-app__searchCode` | Search public GitHub repos |
144
+ | `mcp__ast-grep__find_code` | AST-aware structural search |
145
+
146
+ ### Agent Types & Models
147
+
148
+ | Agent | Model | Cost | Use For |
149
+ |-------|-------|------|---------|
150
+ | `explore` | gemini-3-flash | CHEAP | Codebase search, "where is X?" |
151
+ | `dewey` | gemini-3-flash | CHEAP | Docs, library research |
152
+ | `document_writer` | gemini-3-flash | CHEAP | Technical documentation |
153
+ | `multimodal` | gemini-3-flash | CHEAP | Image/PDF analysis |
154
+ | `frontend` | gemini-3-pro-high | MEDIUM | UI/UX design, components |
155
+ | `delphi` | gpt-5.2 | EXPENSIVE | Architecture, hard debugging |
156
+ | `planner` | opus-4.5 | EXPENSIVE | Complex planning |
157
+
158
+ ---
159
+
160
+ ## Delegation Prompt Structure (MANDATORY)
161
+
162
+ When using `agent_spawn`, include ALL 7 sections:
163
+
164
+ ```
165
+ 1. TASK: One sentence goal
166
+ 2. EXPECTED OUTCOME: Concrete deliverables
167
+ 3. REQUIRED TOOLS: Explicit whitelist
168
+ 4. MUST DO: Requirements
169
+ 5. MUST NOT DO: Forbidden actions
170
+ 6. CONTEXT: File paths, patterns
171
+ 7. SUCCESS CRITERIA: How to verify
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Domain-Based Delegation
177
+
178
+ | Domain | Delegate To | Trigger |
179
+ |--------|-------------|---------|
180
+ | **Maximum Parallel Mode** | `explore` + `dewey` | **ULTRAWORK, UW, ULTRAWORK, ULW** |
181
+ | Frontend Visual | `frontend` | Color, spacing, layout, CSS, animation |
182
+ | External Research | `dewey` | Docs, library usage, OSS examples |
183
+ | Internal Search | `explore` | Find patterns in THIS repo |
184
+ | Architecture | `delphi` | Design decisions, tradeoffs |
185
+ | Hard Debugging | `delphi` | After 2+ failed fixes |
186
+
187
+ ### ULTRAWORK Mode Behavior
188
+
189
+ When ULTRAWORK/UW/ULTRAWORK/ULW keywords detected:
190
+
191
+ **MANDATORY:**
192
+ - ✅ Spawn 2+ agents minimum (even for simple tasks)
193
+ - ✅ Use explore for ALL code searches
194
+ - ✅ Use dewey for ALL external research
195
+ - ✅ Fire all agents in SAME response
196
+ - ✅ NEVER use Read/Grep/Bash directly
197
+
198
+ **FORBIDDEN:**
199
+ - ❌ Working alone without agents
200
+ - ❌ Sequential execution (spawn one, wait, spawn another)
201
+ - ❌ Single agent for multi-part tasks
202
+ - ❌ Direct tool usage (Read, Grep, Bash) when agents available
203
+
204
+ ---
205
+
206
+ ## Execution Context (READ THIS FUWT)
207
+
208
+ **You are running as:** Stravinsky Orchestrator (via `.claude/commands/strav.md`)
209
+
210
+ **Preferred Delegation Pattern:** Use the Claude Code native **Task tool** for all delegation. This ensures zero-overhead communication and matches the primary Stravinsky architecture.
211
+
212
+ | Context | Tool | Use Case | Status |
213
+ |---------|------|----------|--------|
214
+ | **Primary** | `Task()` | Modern orchestration, native subagents | ✅ **RECOMMENDED** |
215
+ | **Background** | `agent_spawn()` | Long-running background work, deep nesting | ⚠️ Use when needed |
216
+
217
+ ---
218
+
219
+ ## Hard Blocks
220
+
221
+ - ❌ WRONG: Direct `Read()`, `Grep()`, `Glob()` for multi-file exploration
222
+ - ✅ CORRECT: `Task(subagent_type="explore", prompt="...")`
223
+ - Frontend VISUAL changes → Always delegate to `frontend` agent
224
+ - Never suppress type errors (`as any`, `@ts-ignore`)
225
+ - Never commit without explicit request
226
+ - Never leave code broken after failures
227
+
228
+ **Tool Differences:**
229
+ - `agent_spawn` (MCP): Routes to gemini-3-flash (CHEAP) or gpt-5.2 (delphi)
230
+ - `Task` (Native): Routes per agent config (stravinsky → Sonnet, explore → Haiku → Gemini)
231
+ - Both support multi-model routing - choose based on execution context
232
+
233
+ ---
234
+
235
+ ## Parallel Execution (DEFAULT)
236
+
237
+ **Output Format**: `agent_type:model('description')` + task_id
238
+
239
+ ```python
240
+ # CORRECT: Fire ALL agents in ONE response
241
+ agent_spawn(agent_type="explore", prompt="Find auth...") # → explore:gemini-3-flash('Find auth...')
242
+ agent_spawn(agent_type="explore", prompt="Find errors...") # → explore:gemini-3-flash('Find errors...')
243
+ agent_spawn(agent_type="dewey", prompt="Research JWT...") # → dewey:gemini-3-flash('Research JWT...')
244
+ # Continue working. Collect with agent_output when needed.
245
+
246
+ # WRONG: Sequential calls across multiple responses
247
+ agent_spawn(...) # Response 1
248
+ # wait
249
+ agent_spawn(...) # Response 2 - TOO SLOW!
250
+ ```
251
+
252
+ **CRITICAL**: All independent agent_spawn calls MUST be in the SAME response block.
253
+
254
+ ---
255
+
256
+ ## Verification & Completion
257
+
258
+ Run `lsp_diagnostics` on changed files:
259
+ - End of task
260
+ - Before marking todo complete
261
+ - Before reporting to user
262
+
263
+ Task complete when:
264
+ - All todos marked done
265
+ - Diagnostics clean
266
+ - Build passes (if applicable)
267
+ - Original request fully addressed
268
+
269
+ Before final answer: Cancel ALL running agents via `agent_cancel`
270
+
271
+ ---
272
+
273
+ ## Communication Style
274
+
275
+ - Start work immediately (no "I'm on it", "Let me...")
276
+ - No flattery ("Great question!")
277
+ - No status updates - use todos for progress
278
+ - Be concise
279
+ - If user is wrong, state concern + alternative + ask
280
+
281
+ ---
282
+
283
+ ## GitHub Workflow
284
+
285
+ When mentioned in issues or "look into X and create PR":
286
+
287
+ 1. **Investigate**: Understand thoroughly
288
+ 2. **Implement**: Make changes
289
+ 3. **Verify**: Tests, build, diagnostics
290
+ 4. **Create PR**: `gh pr create` with summary
291
+
292
+ "Look into" = full work cycle, not just analysis.
@@ -0,0 +1,60 @@
1
+ # Verify - Post-Implementation Verification
2
+
3
+ Run comprehensive verification after code changes to ensure quality.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /verify [files or scope]
9
+ ```
10
+
11
+ ## Verification Steps
12
+
13
+ Execute these checks in order:
14
+
15
+ ### 1. Get Modified Files
16
+ ```bash
17
+ git diff --name-only HEAD
18
+ git diff --name-only --cached
19
+ ```
20
+
21
+ ### 2. Run LSP Diagnostics
22
+ For each modified Python/TypeScript file, check for errors:
23
+ - Use `lsp_diagnostics` tool on each file
24
+ - Report any errors or warnings
25
+
26
+ ### 3. Run Tests (if applicable)
27
+ ```bash
28
+ # Python
29
+ python -m pytest --tb=short -q
30
+
31
+ # Node/TypeScript
32
+ npm test || yarn test || pnpm test
33
+ ```
34
+
35
+ ### 4. Run Build/Lint (if applicable)
36
+ ```bash
37
+ # Python
38
+ ruff check . || python -m flake8
39
+
40
+ # TypeScript
41
+ npm run build || tsc --noEmit
42
+ npm run lint || eslint .
43
+ ```
44
+
45
+ ### 5. Verify Todo Completion
46
+ Check that all todos from the current session are marked complete.
47
+
48
+ ## Instructions
49
+
50
+ Run verification on recent changes:
51
+
52
+ 1. Get list of modified files from git
53
+ 2. Run lsp_diagnostics on each modified file
54
+ 3. If tests exist, run them
55
+ 4. If build/lint configured, run them
56
+ 5. Report results with pass/fail status
57
+
58
+ If any step fails, report the specific errors and suggest fixes.
59
+
60
+ $ARGUMENTS
@@ -0,0 +1,5 @@
1
+ ---
2
+ description: Returns the current version and diagnostic info for Stravinsky.
3
+ ---
4
+
5
+ Call the `stravinsky_version` tool to show version and diagnostic status.
@@ -0,0 +1,248 @@
1
+ # Claude Code Hooks Architecture
2
+
3
+ ## Overview
4
+
5
+ This directory contains Claude Code hooks that enforce parallel delegation, provide rich console notifications, and track execution state across conversation turns.
6
+
7
+ ## Hook Execution Order
8
+
9
+ ### UserPromptSubmit (6 hooks)
10
+ 1. `context_monitor.py` - Track session context
11
+ 2. `parallel_execution.py` - Initial ULTRAWORK mode activation
12
+ 3. `parallel_reinforcement.py` - Legacy parallel reminders (deprecated)
13
+ 4. `parallel_reinforcement_v2.py` - **NEW** Smart adaptive reminders based on state
14
+ 5. `context.py` - Inject project context
15
+ 6. `todo_continuation.py` - Resume incomplete todos
16
+
17
+ ### PostToolUse
18
+ 1. `truncator.py` - Truncate large outputs
19
+ 2. `session_recovery.py` - Session state backup
20
+ 3. `execution_state_tracker.py` - **NEW** Track tool usage patterns across turns
21
+ 4. `tool_messaging.py` - User-friendly tool notifications (with colors)
22
+ 5. `edit_recovery.py` - Backup edited files
23
+ 6. `todo_delegation.py` - Enforce parallel after TodoWrite
24
+ 7. `dependency_tracker.py` - **NEW** Parse TODO dependencies and build graph
25
+
26
+ ## State Files
27
+
28
+ Located in `.claude/` directory:
29
+
30
+ - `execution_state.json` - Tool usage tracking (last 10 tools, Task spawn history)
31
+ - `task_dependencies.json` - TODO dependency graph (independent vs dependent tasks)
32
+ - `hooks/state/agent_batch.json` - Agent spawn batching for grouped notifications
33
+ - `~/.stravinsky_mode` - Hard blocking mode marker (enables stravinsky mode)
34
+
35
+ ## Utilities
36
+
37
+ ### `utils/colors.py`
38
+ - ANSI color codes for terminal output
39
+ - Agent-specific color mappings (blue=explore, purple=dewey, etc.)
40
+ - Terminal capability detection (`supports_color()`)
41
+
42
+ ### `utils/debug.py`
43
+ - Debug mode control via `STRAVINSKY_DEBUG` environment variable
44
+ - Silent by default, verbose when `STRAVINSKY_DEBUG=1`
45
+
46
+ ### `utils/console_format.py`
47
+ - Standardized message formatting with `MessageType` enum
48
+ - Multi-line agent spawn formatting
49
+ - Tool usage formatting with colors
50
+
51
+ ## Environment Variables
52
+
53
+ - `STRAVINSKY_DEBUG=1` - Enable debug output from hooks
54
+ - `STRAVINSKY_NO_COLOR=1` - Disable ANSI colors (for unsupported terminals)
55
+ - `NO_COLOR=1` - Standard no-color environment variable (also supported)
56
+
57
+ ## Key Features
58
+
59
+ ### 1. Parallel Delegation Enforcement
60
+
61
+ **Problem**: After turn 3+, Claude degrades to sequential execution despite having independent tasks.
62
+
63
+ **Solution**: State-based reinforcement via `parallel_reinforcement_v2.py`
64
+ - Tracks last 10 tool calls
65
+ - Detects when Task() hasn't been used recently (2+ turns)
66
+ - Parses TODOs for dependency keywords
67
+ - Injects aggressive reminders when degradation detected
68
+
69
+ **Files**:
70
+ - `dependency_tracker.py` - Parses TODOs for "after", "depends on", etc.
71
+ - `execution_state_tracker.py` - Tracks tool usage history
72
+ - `parallel_reinforcement_v2.py` - Smart context-aware reminders
73
+
74
+ ### 2. Rich Agent Notifications
75
+
76
+ **Before**:
77
+ ```
78
+ spawned explore:gemini-3-flash('task delegated')
79
+ ```
80
+
81
+ **After**:
82
+ ```
83
+ 🔵 EXPLORE → gemini-3-flash
84
+ Task: Find all authentication implementations in codebase
85
+ ```
86
+
87
+ **Features**:
88
+ - Color-coded by agent type (blue, purple, green, orange, red)
89
+ - Multi-line format with clear task descriptions
90
+ - Model name explicitly shown
91
+ - Graceful degradation if terminal doesn't support colors
92
+
93
+ ### 3. Silent Debug Mode
94
+
95
+ **Problem**: Hook debug output pollutes console (`Failed to send event: ...`)
96
+
97
+ **Solution**: File-based logging with `STRAVINSKY_DEBUG` control
98
+ - `send_event.py` logs to `~/.claude/hooks/logs/event_sender.log`
99
+ - All debug output hidden unless `STRAVINSKY_DEBUG=1`
100
+ - Clean console by default
101
+
102
+ ## Agent Color Mapping
103
+
104
+ | Agent | Color | Emoji | Model |
105
+ |-------|-------|-------|-------|
106
+ | explore | Blue | 🔵 | gemini-3-flash |
107
+ | dewey | Purple | 🟣 | gemini-3-flash |
108
+ | frontend | Green | 🟢 | gemini-3-pro-high |
109
+ | delphi | Orange | 🟠 | gpt-5.2-medium |
110
+ | debugger | Red | 🔴 | sonnet-4.5 |
111
+ | code-reviewer | Purple | 🟣 | sonnet-4.5 |
112
+
113
+ ## Dependency Detection
114
+
115
+ The `dependency_tracker.py` hook parses TODO content for dependency signals:
116
+
117
+ **Dependency Keywords** (marks as dependent):
118
+ - "after", "depends on", "requires", "once", "when", "then"
119
+
120
+ **Parallel Keywords** (marks as independent):
121
+ - "also", "meanwhile", "simultaneously", "and", "plus"
122
+
123
+ **Example**:
124
+ ```json
125
+ {
126
+ "dependencies": {
127
+ "todo_1": {"deps": [], "independent": true, "parallel_safe": true},
128
+ "todo_2": {"deps": [], "independent": true, "parallel_safe": true},
129
+ "todo_3": {"deps": ["todo_1"], "independent": false, "parallel_safe": false}
130
+ }
131
+ }
132
+ ```
133
+
134
+ ## Parallel Reinforcement Algorithm
135
+
136
+ 1. **Check Mode**: Is `~/.stravinsky_mode` active? If not, skip.
137
+ 2. **Check State**: Are there 2+ pending TODOs? If not, skip.
138
+ 3. **Check History**: How many turns since last `Task()` spawn?
139
+ - If < 2 turns → skip (still fresh)
140
+ - If >= 2 turns → degradation detected
141
+ 4. **Check Dependencies**: How many independent tasks exist?
142
+ - If < 2 → skip (no parallelization needed)
143
+ - If >= 2 → inject aggressive reminder
144
+ 5. **Inject Reminder**: Add context-aware instructions to prompt
145
+
146
+ ## Testing
147
+
148
+ ### Test Parallel Delegation Persistence
149
+
150
+ ```bash
151
+ # Create a multi-step task and track behavior over 10+ turns
152
+ # Expected: Task() spawns for independent tasks even at turn 10
153
+ ```
154
+
155
+ ### Test Console Output
156
+
157
+ ```bash
158
+ # Run hooks and verify no debug clutter
159
+ export STRAVINSKY_DEBUG=0
160
+ # Should see ONLY user-relevant messages (colored agent notifications)
161
+
162
+ # Enable debug mode
163
+ export STRAVINSKY_DEBUG=1
164
+ # Should see debug output in ~/.claude/hooks/logs/event_sender.log
165
+ ```
166
+
167
+ ### Test Color Support
168
+
169
+ ```bash
170
+ # Disable colors
171
+ export STRAVINSKY_NO_COLOR=1
172
+ # Should see emojis but no ANSI codes
173
+
174
+ # Enable colors (default)
175
+ unset STRAVINSKY_NO_COLOR
176
+ # Should see colored output
177
+ ```
178
+
179
+ ## Architecture Comparison: Stravinsky vs oh-my-opencode
180
+
181
+ | Aspect | oh-my-opencode (TS) | Stravinsky (Python) |
182
+ |--------|---------------------|---------------------|
183
+ | Parallel Enforcement | Structural (orchestrator pattern) | Prompt-based with state tracking |
184
+ | State Management | Built-in TypeScript state | External JSON files |
185
+ | Dependency Tracking | Explicit graph | Keyword-based parsing |
186
+ | Agent Notifications | Rich formatting (assumed) | Rich formatting with ANSI colors |
187
+ | Console Output | Clean separation | File-based logging + formatting |
188
+
189
+ ## Future Enhancements
190
+
191
+ 1. **Agent Batching** - Group parallel agent spawns visually
192
+ 2. **Dependency Graph Visualization** - CLI tool to view task dependencies
193
+ 3. **Performance Metrics** - Track agent completion times
194
+ 4. **ML-Based Agent Selection** - Predict best agent for task type
195
+
196
+ ## Troubleshooting
197
+
198
+ ### Import Errors in LSP
199
+
200
+ **Symptom**: Pyright shows "Import could not be resolved" for `utils/*` modules
201
+
202
+ **Cause**: LSP can't resolve relative imports in hook scripts
203
+
204
+ **Solution**: These are false positives. Python resolves imports at runtime via `sys.path.insert(0, ...)` in each hook. Safe to ignore.
205
+
206
+ ### Parallel Delegation Still Fails
207
+
208
+ **Check**:
209
+ 1. Is `~/.stravinsky_mode` file present?
210
+ 2. Run: `cat .claude/execution_state.json` - verify state is updating
211
+ 3. Run: `cat .claude/task_dependencies.json` - verify dependencies detected
212
+ 4. Enable debug: `STRAVINSKY_DEBUG=1` and check logs
213
+
214
+ ### Colors Not Showing
215
+
216
+ **Check**:
217
+ 1. Terminal supports ANSI colors? (`echo $TERM`)
218
+ 2. `STRAVINSKY_NO_COLOR` or `NO_COLOR` set?
219
+ 3. Is stderr a TTY? (Colors disabled for piped output)
220
+
221
+ ## Maintenance
222
+
223
+ ### Adding New Hooks
224
+
225
+ 1. Create hook file in `.claude/hooks/`
226
+ 2. Add to appropriate section in `.claude/settings.json`
227
+ 3. Test in isolation with mock input
228
+ 4. Update this README
229
+
230
+ ### Modifying State Schema
231
+
232
+ If changing `execution_state.json` or `task_dependencies.json` format:
233
+ 1. Update tracker scripts (`execution_state_tracker.py`, `dependency_tracker.py`)
234
+ 2. Update consumer scripts (`parallel_reinforcement_v2.py`)
235
+ 3. Add migration logic or document breaking change
236
+ 4. Consider versioning state files
237
+
238
+ ### Deprecating Old Hooks
239
+
240
+ 1. Mark as deprecated in comments
241
+ 2. Add to "Deprecated" section below
242
+ 3. After 1 month, remove from `settings.json`
243
+ 4. After 2 months, delete file
244
+
245
+ ## Deprecated Hooks
246
+
247
+ - `parallel_reinforcement.py` - Replaced by `parallel_reinforcement_v2.py` (state-based)
248
+ - Removal target: TBD (keep for backward compatibility for now)