stravinsky 0.2.40__py3-none-any.whl → 0.3.4__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 (56) hide show
  1. mcp_bridge/__init__.py +1 -1
  2. mcp_bridge/auth/token_refresh.py +130 -0
  3. mcp_bridge/cli/__init__.py +6 -0
  4. mcp_bridge/cli/install_hooks.py +1265 -0
  5. mcp_bridge/cli/session_report.py +585 -0
  6. mcp_bridge/hooks/HOOKS_SETTINGS.json +175 -0
  7. mcp_bridge/hooks/README.md +215 -0
  8. mcp_bridge/hooks/__init__.py +119 -43
  9. mcp_bridge/hooks/edit_recovery.py +42 -37
  10. mcp_bridge/hooks/git_noninteractive.py +89 -0
  11. mcp_bridge/hooks/keyword_detector.py +30 -0
  12. mcp_bridge/hooks/manager.py +50 -0
  13. mcp_bridge/hooks/notification_hook.py +103 -0
  14. mcp_bridge/hooks/parallel_enforcer.py +127 -0
  15. mcp_bridge/hooks/parallel_execution.py +111 -0
  16. mcp_bridge/hooks/pre_compact.py +123 -0
  17. mcp_bridge/hooks/preemptive_compaction.py +81 -7
  18. mcp_bridge/hooks/rules_injector.py +507 -0
  19. mcp_bridge/hooks/session_idle.py +116 -0
  20. mcp_bridge/hooks/session_notifier.py +125 -0
  21. mcp_bridge/{native_hooks → hooks}/stravinsky_mode.py +51 -16
  22. mcp_bridge/hooks/subagent_stop.py +98 -0
  23. mcp_bridge/hooks/task_validator.py +73 -0
  24. mcp_bridge/hooks/tmux_manager.py +141 -0
  25. mcp_bridge/hooks/todo_continuation.py +90 -0
  26. mcp_bridge/hooks/todo_delegation.py +88 -0
  27. mcp_bridge/hooks/tool_messaging.py +164 -0
  28. mcp_bridge/hooks/truncator.py +21 -17
  29. mcp_bridge/notifications.py +151 -0
  30. mcp_bridge/prompts/__init__.py +3 -1
  31. mcp_bridge/prompts/dewey.py +30 -20
  32. mcp_bridge/prompts/explore.py +46 -8
  33. mcp_bridge/prompts/multimodal.py +24 -3
  34. mcp_bridge/prompts/planner.py +222 -0
  35. mcp_bridge/prompts/stravinsky.py +107 -28
  36. mcp_bridge/server.py +170 -10
  37. mcp_bridge/server_tools.py +554 -32
  38. mcp_bridge/tools/agent_manager.py +316 -106
  39. mcp_bridge/tools/background_tasks.py +2 -1
  40. mcp_bridge/tools/code_search.py +97 -11
  41. mcp_bridge/tools/lsp/__init__.py +7 -0
  42. mcp_bridge/tools/lsp/manager.py +448 -0
  43. mcp_bridge/tools/lsp/tools.py +637 -150
  44. mcp_bridge/tools/model_invoke.py +270 -47
  45. mcp_bridge/tools/semantic_search.py +2492 -0
  46. mcp_bridge/tools/templates.py +32 -18
  47. stravinsky-0.3.4.dist-info/METADATA +420 -0
  48. stravinsky-0.3.4.dist-info/RECORD +79 -0
  49. stravinsky-0.3.4.dist-info/entry_points.txt +5 -0
  50. mcp_bridge/native_hooks/edit_recovery.py +0 -46
  51. mcp_bridge/native_hooks/truncator.py +0 -23
  52. stravinsky-0.2.40.dist-info/METADATA +0 -204
  53. stravinsky-0.2.40.dist-info/RECORD +0 -57
  54. stravinsky-0.2.40.dist-info/entry_points.txt +0 -3
  55. /mcp_bridge/{native_hooks → hooks}/context.py +0 -0
  56. {stravinsky-0.2.40.dist-info → stravinsky-0.3.4.dist-info}/WHEEL +0 -0
@@ -2,11 +2,16 @@
2
2
  Templates for stravinsky repository initialization.
3
3
  """
4
4
 
5
- CLAUDE_MD_TEMPLATE = """## stravinsky MCP (Parallel Agents)
5
+ CLAUDE_MD_TEMPLATE = """## stravinsky MCP (Multi-Model Orchestration)
6
6
 
7
- Use stravinsky MCP tools. **DEFAULT: spawn parallel agents for multi-step tasks.**
7
+ Stravinsky provides multi-model AI orchestration with parallel agent execution.
8
8
 
9
- ### Agent Tools
9
+ ### Architecture
10
+ - **Native Subagent**: Stravinsky orchestrator (.claude/agents/stravinsky.md) auto-delegates complex tasks
11
+ - **MCP Tools**: agent_spawn, invoke_gemini, invoke_openai, LSP tools, code search
12
+ - **Specialist Agents**: explore, dewey, frontend, delphi, multimodal, document_writer
13
+
14
+ ### Agent Tools (via MCP)
10
15
  - `agent_spawn(prompt, agent_type, description)` - Spawn background agent with full tool access
11
16
  - `agent_output(task_id, block)` - Get results (block=True to wait)
12
17
  - `agent_progress(task_id)` - Check real-time progress
@@ -14,15 +19,17 @@ Use stravinsky MCP tools. **DEFAULT: spawn parallel agents for multi-step tasks.
14
19
  - `agent_cancel(task_id)` - Stop a running agent
15
20
 
16
21
  ### Agent Types
17
- - `explore` - Codebase search, "where is X?" questions
18
- - `dewey` - Documentation research, implementation examples
19
- - `frontend` - UI/UX work, component design
20
- - `delphi` - Strategic advice, architecture review
21
-
22
- ### Parallel Execution (IRONSTAR)
22
+ - `explore` - Codebase search, structural analysis (Gemini 3 Flash)
23
+ - `dewey` - Documentation research, web search (Gemini 3 Flash + Web)
24
+ - `frontend` - UI/UX implementation (Gemini 3 Pro High)
25
+ - `delphi` - Strategic advice, architecture review (GPT-5.2 Medium)
26
+ - `multimodal` - Visual analysis, screenshots (Gemini 3 Flash Vision)
27
+ - `document_writer` - Technical documentation (Gemini 3 Flash)
28
+
29
+ ### Parallel Execution (MANDATORY)
23
30
  For ANY task with 2+ independent steps:
24
31
  1. **Immediately use agent_spawn** for each independent component
25
- 2. Fire all agents simultaneously, don't wait
32
+ 2. Fire all agents simultaneously in ONE response, don't wait
26
33
  3. Monitor with agent_progress, collect with agent_output
27
34
 
28
35
  ### Trigger Commands
@@ -30,6 +37,12 @@ For ANY task with 2+ independent steps:
30
37
  - **ULTRATHINK**: Engage exhaustive deep reasoning, multi-dimensional analysis
31
38
  - **SEARCH**: Maximize search effort across codebase and external resources
32
39
  - **ANALYZE**: Deep analysis mode with delphi consultation for complex issues
40
+
41
+ ### Native Subagent Benefits
42
+ - ✅ Auto-delegation (no manual /stravinsky invocation)
43
+ - ✅ Context isolation (orchestrator runs as subagent)
44
+ - ✅ Full MCP tool access (agent_spawn, invoke_gemini/openai, LSP, etc.)
45
+ - ✅ Multi-model routing (Gemini for UI/research, GPT for strategy)
33
46
  """
34
47
 
35
48
  COMMAND_STRAVINSKY = """---
@@ -74,15 +87,16 @@ stravinsky:agent_spawn(prompt="Task 3...", agent_type="dewey", description="Task
74
87
  stravinsky:agent_output(task_id="[id]", block=true)
75
88
  ```
76
89
 
77
- ### DO NOT USE:
78
- - Built-in Read tool for file reading
79
- - Built-in Search/Glob for searching
80
- - Built-in Task tool for subagents
90
+ ### Recommended Tool Usage:
91
+ - For file operations within agents: Use standard Read/Edit tools
92
+ - For parallel agent spawning: Use stravinsky:agent_spawn (supports nesting, unlike native Task tool)
93
+ - For collecting results: Use stravinsky:agent_output
94
+ - For monitoring agents: Use stravinsky:agent_list
81
95
 
82
- ### ALWAYS USE:
83
- - stravinsky:agent_spawn for ALL exploration
84
- - stravinsky:agent_output for collecting results
85
- - stravinsky:agent_list to see running agents
96
+ ### Native Subagent Integration:
97
+ - Stravinsky orchestrator configured as native Claude Code subagent (.claude/agents/stravinsky.md)
98
+ - Native subagents CAN call Stravinsky MCP tools (agent_spawn, invoke_gemini, etc.)
99
+ - This enables auto-delegation without manual /stravinsky invocation
86
100
 
87
101
  ### Execution Modes:
88
102
  - `ironstar` / `irs` / `ultrawork` - Maximum parallel execution (10+ agents)
@@ -0,0 +1,420 @@
1
+ Metadata-Version: 2.4
2
+ Name: stravinsky
3
+ Version: 0.3.4
4
+ Summary: MCP Bridge for Claude Code with Multi-Model Support. Install globally: claude mcp add --scope user stravinsky -- uvx stravinsky. Add to CLAUDE.md: See https://pypi.org/project/stravinsky/
5
+ Project-URL: Repository, https://github.com/GratefulDave/stravinsky
6
+ Project-URL: Issues, https://github.com/GratefulDave/stravinsky/issues
7
+ Author: Stravinsky Team
8
+ License: MIT
9
+ Keywords: claude,gemini,mcp,oauth,openai
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: aiofiles>=23.1.0
12
+ Requires-Dist: chromadb>=0.6.0; python_version < '3.14'
13
+ Requires-Dist: cryptography>=41.0.0
14
+ Requires-Dist: google-auth-oauthlib>=1.0.0
15
+ Requires-Dist: google-auth>=2.20.0
16
+ Requires-Dist: httpx>=0.24.0
17
+ Requires-Dist: jedi-language-server>=0.41.0
18
+ Requires-Dist: jedi>=0.19.2
19
+ Requires-Dist: keyring>=25.7.0
20
+ Requires-Dist: lsprotocol>=2023.0.0
21
+ Requires-Dist: mcp>=1.2.1
22
+ Requires-Dist: ollama>=0.6.1
23
+ Requires-Dist: openai>=1.0.0
24
+ Requires-Dist: plyer>=2.1.0
25
+ Requires-Dist: psutil>=5.9.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: pygls>=1.3.0
28
+ Requires-Dist: python-dotenv>=1.0.0
29
+ Requires-Dist: rich>=13.0.0
30
+ Requires-Dist: ruff>=0.14.10
31
+ Requires-Dist: tenacity>=8.5.0
32
+ Requires-Dist: watchdog~=5.0.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
35
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
36
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
37
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
38
+ Provides-Extra: semantic
39
+ Requires-Dist: chromadb>=0.5.0; extra == 'semantic'
40
+ Description-Content-Type: text/markdown
41
+
42
+ <div align="center">
43
+ <img src="https://raw.githubusercontent.com/GratefulDave/stravinsky/main/assets/logo.png" width="300" alt="Stravinsky Logo">
44
+ <h1>Stravinsky</h1>
45
+ <p><strong>The Avant-Garde MCP Bridge for Claude Code</strong></p>
46
+ <p><em>Movement • Rhythm • Precision</em></p>
47
+ </div>
48
+
49
+ ---
50
+
51
+ ## What is Stravinsky?
52
+
53
+ **Multi-model AI orchestration** with OAuth authentication for Claude Code.
54
+
55
+ ## Features
56
+
57
+ - 🔐 **OAuth Authentication** - Secure browser-based auth for Google (Gemini) and OpenAI (ChatGPT)
58
+ - 🤖 **Multi-Model Support** - Seamlessly invoke Gemini and GPT models from Claude
59
+ - 🎯 **Native Subagent Orchestration** - Auto-delegating orchestrator with parallel execution (zero CLI overhead)
60
+ - 🛠️ **38 MCP Tools** - Model invocation, code search, semantic search, LSP refactoring, session management, and more
61
+ - 🧠 **9 Specialized Native Agents** - Stravinsky (orchestrator), Research Lead, Implementation Lead, Delphi (GPT-5.2 advisor), Dewey (documentation), Explore (code search), Frontend (Gemini 3 Pro High UI/UX), Code Reviewer, Debugger
62
+ - 🔄 **Hook-Based Delegation** - PreToolUse hooks enforce delegation patterns with hard boundaries (exit code 2)
63
+ - 📝 **LSP Integration** - Full Language Server Protocol support with persistent servers (35x speedup), code refactoring, and advanced navigation
64
+ - 🔍 **AST-Aware Search** - Structural code search and refactoring with ast-grep
65
+ - 🧠 **Semantic Code Search** - Natural language queries with local embeddings (ChromaDB + Ollama)
66
+ - ⚡ **Cost-Optimized Routing** - Free/cheap agents (explore, dewey) always async, expensive (delphi) only when needed
67
+
68
+ ## Quick Start
69
+
70
+ ### Installation
71
+
72
+ **CRITICAL: Always use --global with @latest for auto-updates**
73
+
74
+ ```bash
75
+ # CORRECT: Global installation with automatic updates
76
+ claude mcp add --global stravinsky -- uvx stravinsky@latest
77
+
78
+ # Why this matters:
79
+ # - --global: Works across all projects (not just current directory)
80
+ # - @latest: Auto-checks PyPI on every Claude restart (no stale cache)
81
+ ```
82
+
83
+ **WRONG - Do NOT use these:**
84
+
85
+ ```bash
86
+ # ❌ Local scope (only works in one project)
87
+ claude mcp add stravinsky -- uvx stravinsky@latest
88
+
89
+ # ❌ No @latest (cache never updates, stays on old version)
90
+ claude mcp add --global stravinsky -- uvx stravinsky
91
+
92
+ # ❌ uv tool install (requires manual upgrades)
93
+ uv tool install stravinsky
94
+ ```
95
+
96
+ **Development (local editable install):**
97
+
98
+ ```bash
99
+ # ONLY for active development on stravinsky source code
100
+ uv tool install --editable /path/to/stravinsky
101
+ claude mcp add --global stravinsky -- stravinsky
102
+ ```
103
+
104
+ ### Authentication
105
+
106
+ ```bash
107
+ # Login to Google (Gemini)
108
+ stravinsky-auth login gemini
109
+
110
+ # Login to OpenAI (ChatGPT Plus/Pro required)
111
+ stravinsky-auth login openai
112
+
113
+ # Check status
114
+ stravinsky-auth status
115
+
116
+ # Logout
117
+ stravinsky-auth logout gemini
118
+ ```
119
+
120
+ ### Slash Commands
121
+
122
+ Slash commands are discovered from:
123
+ - Project-local: `.claude/commands/**/*.md` (recursive)
124
+ - User-global: `~/.claude/commands/**/*.md` (recursive)
125
+
126
+ Commands can be organized in subdirectories (e.g., `.claude/commands/strav/stravinsky.md`).
127
+
128
+ ## Native Subagent Architecture
129
+
130
+ Stravinsky uses **native Claude Code subagents** (.claude/agents/) with automatic delegation:
131
+
132
+ ### How It Works
133
+
134
+ 1. **Auto-Delegation**: Claude Code automatically delegates complex tasks to the Stravinsky orchestrator
135
+ 2. **Hook-Based Control**: PreToolUse hooks intercept direct tool calls and enforce delegation patterns
136
+ 3. **Parallel Execution**: Task tool enables true parallel execution of specialist agents
137
+ 4. **Multi-Model Routing**: Specialists use invoke_gemini/openai MCP tools for multi-model access
138
+
139
+ ### Agent Types
140
+
141
+ | Agent | Model | Cost | Use For |
142
+ |-------|-------|------|---------|
143
+ | **stravinsky** | Claude Sonnet 4.5 (32k thinking) | Moderate | Auto-delegating orchestrator (primary) |
144
+ | **explore** | Gemini 3 Flash (via MCP) | Free | Code search, always async |
145
+ | **dewey** | Gemini 3 Flash + WebSearch | Cheap | Documentation research, always async |
146
+ | **code-reviewer** | Claude Sonnet (native) | Cheap | Quality analysis, always async |
147
+ | **debugger** | Claude Sonnet (native) | Medium | Root cause (after 2+ failures) |
148
+ | **frontend** | Gemini 3 Pro High (via MCP) | Medium | ALL visual changes (blocking) |
149
+ | **delphi** | GPT-5.2 Medium (via MCP) | Expensive | Architecture (after 3+ failures) |
150
+
151
+ ### Delegation Rules (oh-my-opencode Pattern)
152
+
153
+ - **Always Async**: explore, dewey, code-reviewer (free/cheap)
154
+ - **Blocking**: debugger (2+ failures), frontend (ALL visual), delphi (3+ failures or architecture)
155
+ - **Never Work Alone**: Orchestrator blocks Read/Grep/Bash via PreToolUse hooks
156
+
157
+ ### ULTRATHINK / ULTRAWORK
158
+
159
+ - **ULTRATHINK**: Engage exhaustive deep reasoning with extended thinking budget (32k tokens)
160
+ - **ULTRAWORK**: Maximum parallel execution - spawn all async agents immediately
161
+ ````
162
+
163
+ ## Tools (38)
164
+
165
+ | Category | Tools |
166
+ | ---------------- | ---------------------------------------------------------------------------------- |
167
+ | **Model Invoke** | `invoke_gemini`, `invoke_openai`, `get_system_health` |
168
+ | **Environment** | `get_project_context`, `task_spawn`, `task_status`, `task_list` |
169
+ | **Agents** | `agent_spawn`, `agent_output`, `agent_cancel`, `agent_list`, `agent_progress`, `agent_retry` |
170
+ | **Code Search** | `ast_grep_search`, `ast_grep_replace`, `grep_search`, `glob_files` |
171
+ | **Semantic** | `semantic_search`, `semantic_index`, `semantic_stats` |
172
+ | **LSP** | `lsp_diagnostics`, `lsp_hover`, `lsp_goto_definition`, `lsp_find_references`, `lsp_document_symbols`, `lsp_workspace_symbols`, `lsp_prepare_rename`, `lsp_rename`, `lsp_code_actions`, `lsp_code_action_resolve`, `lsp_extract_refactor`, `lsp_servers` (12 tools) |
173
+ | **Sessions** | `session_list`, `session_read`, `session_search` |
174
+ | **Skills** | `skill_list`, `skill_get` |
175
+
176
+ ### LSP Performance & Refactoring
177
+
178
+ The Phase 2 update introduced the `LSPManager`, which maintains persistent language server instances:
179
+
180
+ - **35x Speedup**: Subsequent LSP calls are near-instant because the server no longer needs to re-initialize and re-index the codebase for every request
181
+ - **Code Refactoring**: New support for `lsp_extract_refactor` allows automated code extraction (e.g., extracting a method or variable) with full symbol resolution
182
+ - **Code Actions**: `lsp_code_action_resolve` enables complex, multi-step refactoring workflows with automatic fixes for diagnostics
183
+
184
+ ### Semantic Code Search
185
+
186
+ Natural language code search powered by embeddings. Find code by meaning, not just keywords.
187
+
188
+ **Prerequisites:**
189
+
190
+ ```bash
191
+ # Install Ollama (default provider - free, local)
192
+ brew install ollama
193
+
194
+ # Pull the recommended lightweight embedding model (274MB)
195
+ ollama pull nomic-embed-text
196
+
197
+ # Or for better accuracy (670MB, slower):
198
+ ollama pull mxbai-embed-large
199
+ ```
200
+
201
+ **Recommended model:** `nomic-embed-text` is lightweight (274MB), fast, and works great for code search. It's the best choice for most users, especially on space-constrained systems like MacBooks.
202
+
203
+ **Workflow:**
204
+
205
+ ```bash
206
+ # STEP 1: Initial indexing (REQUIRED - run once per project)
207
+ semantic_index(project_path=".", provider="ollama")
208
+
209
+ # STEP 2: Enable auto-updates (OPTIONAL - recommended for active projects)
210
+ start_file_watcher(".", provider="ollama", debounce_seconds=2.0)
211
+
212
+ # STEP 3: Search your codebase with natural language
213
+ semantic_search(query="OAuth authentication logic", n_results=5)
214
+ semantic_stats() # View index statistics
215
+
216
+ # STEP 4: Stop watching when done (optional - watcher cleans up on exit)
217
+ stop_file_watcher(".")
218
+ ```
219
+
220
+ **⚠️ Important:** You MUST run `semantic_index()` first before using semantic search or starting the FileWatcher. If you skip this step:
221
+ - `semantic_search()` will return no results
222
+ - `start_file_watcher()` will show a warning but still work (indexes on first file change)
223
+
224
+ **Example queries:**
225
+ - "find authentication logic"
226
+ - "error handling in API endpoints"
227
+ - "database connection pooling"
228
+
229
+ **Providers:**
230
+
231
+ | Provider | Model | Size | Cost | Setup |
232
+ |----------|-------|------|------|-------|
233
+ | `ollama` (default) | nomic-embed-text (recommended) | 274MB | Free/local | `ollama pull nomic-embed-text` |
234
+ | `ollama` | mxbai-embed-large (advanced) | 670MB | Free/local | `ollama pull mxbai-embed-large` |
235
+ | `gemini` | gemini-embedding-001 | N/A | OAuth/cloud | `stravinsky-auth login gemini` |
236
+ | `openai` | text-embedding-3-small | N/A | OAuth/cloud | `stravinsky-auth login openai` |
237
+
238
+ **Technical details:**
239
+ - **AST-aware chunking**: Python files split by functions/classes for better semantic boundaries
240
+ - **Persistent storage**: ChromaDB at `~/.stravinsky/vectordb/<project>_<provider>/`
241
+ - **Async parallel embeddings**: 10 concurrent for fast indexing
242
+ - **Automatic file watching**: Background reindexing on code changes with configurable debouncing (2s default)
243
+
244
+ ## Native Subagents (9)
245
+
246
+ Configured in `.claude/agents/*.md`:
247
+
248
+ | Agent | Purpose | Location |
249
+ | ---------------- | --------------------------------------------------------------------- | -------- |
250
+ | `stravinsky` | Task orchestration with 32k extended thinking (Sonnet 4.5) | .claude/agents/stravinsky.md |
251
+ | `research-lead` | Research coordinator - spawns explore/dewey, synthesizes findings (Gemini Flash) | .claude/agents/research-lead.md |
252
+ | `implementation-lead` | Implementation coordinator - spawns frontend/debugger/reviewer (Haiku) | .claude/agents/implementation-lead.md |
253
+ | `explore` | Codebase search and structural analysis (Gemini 3 Flash) | .claude/agents/explore.md |
254
+ | `dewey` | Documentation research and web search (Gemini 3 Flash) | .claude/agents/dewey.md |
255
+ | `code-reviewer` | Security, quality, and best practice analysis (Claude Sonnet) | .claude/agents/code-reviewer.md |
256
+ | `debugger` | Root cause analysis and fix strategies (Claude Sonnet) | .claude/agents/debugger.md |
257
+ | `frontend` | UI/UX implementation with creative generation (Gemini 3 Pro High) | .claude/agents/frontend.md |
258
+ | `delphi` | Strategic architecture advisor with 32k thinking (GPT-5.2 Medium) | .claude/agents/delphi.md |
259
+
260
+ ## Development
261
+
262
+ ```bash
263
+ # Install in development mode
264
+ uv pip install -e .
265
+
266
+ # Run server
267
+ stravinsky
268
+ ```
269
+
270
+ ## Project Structure
271
+
272
+ ```
273
+ stravinsky/
274
+ ├── .claude/ # Claude Code configuration
275
+ │ ├── agents/ # Native subagent configurations (7 agents)
276
+ │ │ ├── stravinsky.md # Orchestrator (auto-delegated)
277
+ │ │ ├── explore.md # Code search specialist
278
+ │ │ ├── dewey.md # Documentation research
279
+ │ │ ├── code-reviewer.md # Quality analysis
280
+ │ │ ├── debugger.md # Root cause analysis
281
+ │ │ ├── frontend.md # UI/UX specialist
282
+ │ │ ├── delphi.md # Strategic advisor (GPT-5.2)
283
+ │ │ └── HOOKS.md # Hook architecture guide
284
+ │ ├── commands/ # Slash commands (skills)
285
+ │ │ ├── stravinsky.md # /stravinsky orchestrator
286
+ │ │ ├── delphi.md # /delphi strategic advisor
287
+ │ │ ├── dewey.md # /dewey documentation research
288
+ │ │ ├── publish.md # /publish PyPI release
289
+ │ │ ├── review.md # /review code review
290
+ │ │ ├── verify.md # /verify post-implementation
291
+ │ │ └── version.md # /version diagnostic info
292
+ │ ├── hooks/ # Native Claude Code hooks (11 hooks)
293
+ │ │ ├── stravinsky_mode.py # PreToolUse delegation enforcer
294
+ │ │ ├── context.py # UserPromptSubmit context injection
295
+ │ │ ├── todo_continuation.py # UserPromptSubmit todo continuation
296
+ │ │ ├── truncator.py # PostToolUse output truncation
297
+ │ │ ├── tool_messaging.py # PostToolUse user messaging
298
+ │ │ ├── edit_recovery.py # PostToolUse edit backup
299
+ │ │ ├── todo_delegation.py # PostToolUse parallel reminder
300
+ │ │ ├── parallel_execution.py # PostToolUse parallel enforcement
301
+ │ │ ├── notification_hook.py # PreToolUse agent spawn notifications
302
+ │ │ ├── subagent_stop.py # PostToolUse agent completion handling
303
+ │ │ └── pre_compact.py # PreCompact context preservation
304
+ │ ├── skills/ # Skill library (empty, skills in commands/)
305
+ │ ├── settings.json # Hook configuration
306
+ │ └── HOOKS_INTEGRATION.md # Hook integration guide
307
+ ├── mcp_bridge/ # Python MCP server
308
+ │ ├── server.py # MCP server entry point
309
+ │ ├── server_tools.py # Tool definitions
310
+ │ ├── auth/ # OAuth authentication
311
+ │ │ ├── oauth.py # Google OAuth (Gemini)
312
+ │ │ ├── openai_oauth.py # OpenAI OAuth (ChatGPT)
313
+ │ │ ├── token_store.py # Keyring storage
314
+ │ │ ├── token_refresh.py # Auto-refresh tokens
315
+ │ │ └── cli.py # stravinsky-auth CLI
316
+ │ ├── tools/ # MCP tool implementations
317
+ │ │ ├── model_invoke.py # invoke_gemini, invoke_openai
318
+ │ │ ├── agent_manager.py # agent_spawn, agent_output, etc.
319
+ │ │ ├── code_search.py # ast_grep, grep, glob
320
+ │ │ ├── semantic_search.py # semantic_search, semantic_index, semantic_stats
321
+ │ │ ├── session_manager.py # session_list, session_read, etc.
322
+ │ │ ├── skill_loader.py # skill_list, skill_get
323
+ │ │ ├── project_context.py # get_project_context
324
+ │ │ ├── lsp/ # LSP tool implementations
325
+ │ │ └── templates.py # Project templates
326
+ │ ├── prompts/ # Agent system prompts (legacy CLI)
327
+ │ │ ├── stravinsky.py # Legacy orchestrator prompt
328
+ │ │ ├── delphi.py # Legacy advisor prompt
329
+ │ │ ├── dewey.py # Legacy research prompt
330
+ │ │ ├── explore.py # Legacy search prompt
331
+ │ │ ├── frontend.py # Legacy UI/UX prompt
332
+ │ │ └── multimodal.py # Multimodal analysis prompt
333
+ │ ├── hooks/ # MCP internal hooks (17+ hooks)
334
+ │ │ ├── manager.py # Hook orchestration
335
+ │ │ ├── truncator.py # Output truncation
336
+ │ │ ├── parallel_enforcer.py # Parallel execution
337
+ │ │ ├── todo_enforcer.py # Todo continuation
338
+ │ │ └── ... # 13+ more optimization hooks
339
+ │ ├── native_hooks/ # Native Claude Code hooks
340
+ │ │ ├── stravinsky_mode.py # PreToolUse delegation enforcer
341
+ │ │ ├── tool_messaging.py # PostToolUse user messaging
342
+ │ │ ├── todo_delegation.py # TodoWrite parallel reminder
343
+ │ │ ├── todo_continuation.py # UserPromptSubmit todo injection
344
+ │ │ ├── context.py # UserPromptSubmit context
345
+ │ │ ├── truncator.py # PostToolUse truncation
346
+ │ │ └── edit_recovery.py # PostToolUse backup
347
+ │ ├── cli/ # CLI utilities
348
+ │ │ └── session_report.py # Session analysis
349
+ │ ├── config/ # Configuration
350
+ │ │ └── hooks.py # Hook configuration
351
+ │ └── utils/ # Utility functions
352
+ ├── .stravinsky/ # Agent execution logs (gitignored)
353
+ ├── assets/ # Logo, images
354
+ ├── docs/ # Additional documentation
355
+ ├── logs/ # Application logs
356
+ ├── tests/ # Test suite
357
+ ├── pyproject.toml # Build configuration
358
+ ├── uv.lock # Dependency lock
359
+ ├── ARCHITECTURE.md # Architecture guide (oh-my-opencode comparison)
360
+ ├── CLAUDE.md # Project instructions
361
+ ├── INSTALL.md # Installation guide
362
+ └── README.md # This file
363
+ ```
364
+
365
+ ## Troubleshooting
366
+
367
+ ### OpenAI "Port 1455 in use"
368
+
369
+ The Codex CLI uses the same port. Stop it with: `killall codex`
370
+
371
+ ### OpenAI Authentication Failed
372
+
373
+ - Ensure you have a ChatGPT Plus/Pro subscription
374
+ - Tokens expire occasionally; run `stravinsky-auth login openai` to refresh
375
+
376
+ ### Claude Code Not Loading Latest Version After Update
377
+
378
+ **Problem:** After deploying a new version to PyPI, Claude Code still uses the old cached version even after restart.
379
+
380
+ **Root Cause:** `uvx` caches packages and doesn't automatically check for updates. This is a known uvx behavior that affects all packages, not just Stravinsky.
381
+
382
+ **Solution - Force Reinstall:**
383
+
384
+ ```bash
385
+ # Option 1: Run latest version with uvx (if using uvx in .mcp.json)
386
+ uvx stravinsky@latest
387
+
388
+ # Option 2: Upgrade with uv tool (if installed globally)
389
+ uv tool install --upgrade --force stravinsky
390
+ # or reinstall all tools:
391
+ uv tool upgrade --all --reinstall
392
+
393
+ # Option 3: Clear uvx cache entirely (nuclear option)
394
+ uv cache prune
395
+
396
+ # Option 4: Remove and re-add MCP server
397
+ claude mcp remove stravinsky
398
+ claude mcp add stravinsky -- uvx stravinsky@latest
399
+
400
+ # After any option, restart Claude Code
401
+ claude restart
402
+ ```
403
+
404
+ **Verify Version:**
405
+
406
+ ```bash
407
+ # Check installed version
408
+ stravinsky --version
409
+ # or
410
+ python -c "import mcp_bridge; print(mcp_bridge.__version__)"
411
+
412
+ # Check PyPI latest version
413
+ curl -s https://pypi.org/pypi/stravinsky/json | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])"
414
+ ```
415
+
416
+ ## License
417
+
418
+ MIT
419
+
420
+ ---
@@ -0,0 +1,79 @@
1
+ mcp_bridge/__init__.py,sha256=oYLGMpySamd16KLiaBTfRyrAS7_oyp-TOEHmzmeumwg,22
2
+ mcp_bridge/notifications.py,sha256=C4qPvGD1NnAsU_ukwbiqWdo7cA6ScU0qGhjie3vPpjM,5134
3
+ mcp_bridge/server.py,sha256=kRt9BfPSM1AOc_jvfe9XFTBsR9zTr9jLdQaPcPCApLU,29476
4
+ mcp_bridge/server_tools.py,sha256=dbhnz17VuoNv_dtS75uSNKctiKnjV7aFHs_dXr0M5Js,45070
5
+ mcp_bridge/auth/__init__.py,sha256=AGHNtKzqvZYMLQ35Qg6aOabpxBqmkR-pjXv8Iby9oMw,797
6
+ mcp_bridge/auth/cli.py,sha256=jaXyrzq6HwnW61g6CHHcj8bF5PJLYrYufD_jmN0jeiQ,8502
7
+ mcp_bridge/auth/oauth.py,sha256=gWYk3KJWbUM1J5AKVDJ_4k4zdQzwwaYJZ5J25If0r8c,12804
8
+ mcp_bridge/auth/openai_oauth.py,sha256=0Ks2X-NXLCBzqs3xnbj9QLZpugICOX5qB5y5vtDENOo,11522
9
+ mcp_bridge/auth/token_refresh.py,sha256=goWp1Wz3yWOoFuxvFMDZLjo8gLPXcajZxHpzZtSoKcQ,3760
10
+ mcp_bridge/auth/token_store.py,sha256=3A6TZJ7Wju6QfhALeX4IMhY5jzb9OWMrDzwRbfAukiU,5650
11
+ mcp_bridge/cli/__init__.py,sha256=J1cFw06fYSm3uU7cbEj3GgWuDxTn1X0cDhPi1gJq7eM,200
12
+ mcp_bridge/cli/install_hooks.py,sha256=cmLctih9xie1iaY8uyzO11egvEkpMa7Zc-Nyb5dITlg,36955
13
+ mcp_bridge/cli/session_report.py,sha256=sYUje44R4qIwxML_GCaEyJwz4jgis4sZOwTDZGQJ3MM,22198
14
+ mcp_bridge/config/__init__.py,sha256=uapHdrSWWrafVKD9CTB1J_7Dw0_RajRhoDGjy9zH21o,256
15
+ mcp_bridge/config/hooks.py,sha256=WvWC6ZUc8y1IXPlGCjLYAAsGGigd5tWeGiw585OGNwA,4624
16
+ mcp_bridge/hooks/HOOKS_SETTINGS.json,sha256=IY47eGigQwTaQ0XwM2NzVopGBga3Zaocmq09I1M1inw,6434
17
+ mcp_bridge/hooks/README.md,sha256=ocKp2BE6U4o8OhnA4dbXoth8A9YD8MYQLi5uXw7bLEo,7549
18
+ mcp_bridge/hooks/__init__.py,sha256=_R8Qbz7puDeQ_LWwKLSU_GKnxdA1JyESEihM1PM5HFo,3946
19
+ mcp_bridge/hooks/agent_reminder.py,sha256=OxKPxi7e2MIBm44Ebzzl9j9fDV5bBgogGF0lj7wun5s,1913
20
+ mcp_bridge/hooks/auto_slash_command.py,sha256=LUndZHxUzEF7PQuOdp3v7VfqNUgsiDE2gzI_TkR9he4,5280
21
+ mcp_bridge/hooks/budget_optimizer.py,sha256=Im0qSGVUdRByk04hP5VyKt7tjlDVYG0LJb6IeUjjnj8,1323
22
+ mcp_bridge/hooks/comment_checker.py,sha256=MslXZYiHjfxjUU7VzmZfa1n2WR9o4lnaktJ6eUPBUDs,3772
23
+ mcp_bridge/hooks/compaction.py,sha256=UXTwmyo9C4Jm3j72KvVU11ukSAHaGaTey_h3L43e3rY,1186
24
+ mcp_bridge/hooks/context.py,sha256=JBHqnX75qtMO3JAEFooBEAK6DxcsVaXykhrP7tdFm6E,949
25
+ mcp_bridge/hooks/context_monitor.py,sha256=IEr75e_gqbPEUslxxfkwftiy6alDmJxQhSB6cy8BVg4,1885
26
+ mcp_bridge/hooks/directory_context.py,sha256=0VjdJITJIGUqR4-q-wZlB6kmkFQMraaFvU2Nz2PnJCM,1225
27
+ mcp_bridge/hooks/edit_recovery.py,sha256=1OWpb3v87txFUsgnNe1hoeTI7rIKCkKYONld5BK1TyA,1503
28
+ mcp_bridge/hooks/empty_message_sanitizer.py,sha256=iZZnETju1wBvJXV1k4msV8FxLNg5LkVm2eaFA2nQWxI,6606
29
+ mcp_bridge/hooks/git_noninteractive.py,sha256=1VETo7Gf76NYEx_J7RxA52wYnlj5wiOwFL9lSMdshEM,2864
30
+ mcp_bridge/hooks/keyword_detector.py,sha256=w7wW8dYYKiHpmgMYJtWw2MJd0ly631C7rFVWtC_kkq8,6105
31
+ mcp_bridge/hooks/manager.py,sha256=SG08soeyHSzfl9NE9yX2x5B_NEbv9LxJnmRBUaOhGfE,5835
32
+ mcp_bridge/hooks/notification_hook.py,sha256=GElHxaIn0BF935IXuRQjYERk7W_msBiCm0UwutumdiM,2770
33
+ mcp_bridge/hooks/parallel_enforcer.py,sha256=qzPB7PX22Laz6yC3MCbAmYBhP59P9ac6WHpgXOABOuQ,3651
34
+ mcp_bridge/hooks/parallel_execution.py,sha256=nIINPRm-1P1dci3lTCacJKN_4NIkm9IyTrVx-rmbXl4,3602
35
+ mcp_bridge/hooks/pre_compact.py,sha256=QXcCO9kByn8Ta27NWoQP8IPPUa379KO4qb1BBLzfzuU,3398
36
+ mcp_bridge/hooks/preemptive_compaction.py,sha256=x4-dLWCconVFD-nR93P1EB_tG9n4LHdESq7uDFS3ut8,7937
37
+ mcp_bridge/hooks/rules_injector.py,sha256=jZN9_b464ATEKAFJvIlIVKT-UvcoNAuZGDI4TmJ0Uxc,16485
38
+ mcp_bridge/hooks/session_idle.py,sha256=5wo6XakXglWVCP-HN1i976OptfntwCNnbjxoM--veh4,3525
39
+ mcp_bridge/hooks/session_notifier.py,sha256=dkrSwRquMbcCRuUCsBVqUY6cHSGDO2UuPWKTNf6Y7fc,3750
40
+ mcp_bridge/hooks/session_recovery.py,sha256=c5eoIWJAgMTPY0wq_64MmCUNLCB_GSowZlA3lo4R9LU,6260
41
+ mcp_bridge/hooks/stravinsky_mode.py,sha256=ru9vg5m1QjhK0ABwopC68S2Gzy2-sEW1b1AbveFO57o,4066
42
+ mcp_bridge/hooks/subagent_stop.py,sha256=GUPY3FNVAtsc6J4PbddSRK9XuDs-gw2CaFoGXt5gsME,2865
43
+ mcp_bridge/hooks/task_validator.py,sha256=YSeUWbtwjA-oWCrOVS5DTRxu9_0VTgzpF2mf-QIIw9E,2183
44
+ mcp_bridge/hooks/tmux_manager.py,sha256=vXU0o612PrJ8Xb0IMq4qnEY3i_Z1sT_E-56SqalmrQA,4125
45
+ mcp_bridge/hooks/todo_continuation.py,sha256=tmhTVfMZMDuDw4cwyuU7r_TkUqmtAx55u0WNTawgMyo,2652
46
+ mcp_bridge/hooks/todo_delegation.py,sha256=tOAE1RYAPSH8UOeO8Vsk7sdLf9H4GmXE2lbc_GGjlYI,2676
47
+ mcp_bridge/hooks/todo_enforcer.py,sha256=LRvVxYILqQ6YuQl3tky4hgyD-irXIPDE5e0EdKr6jcc,2274
48
+ mcp_bridge/hooks/tool_messaging.py,sha256=Zfmny1w4wS-KHaFbZG2peaXIyejff5Qyt5RbbalrekU,5705
49
+ mcp_bridge/hooks/truncator.py,sha256=h3hb8sZXTvc59C0-5GdZwCVZHlxBKdo47JT9TMxHG3g,530
50
+ mcp_bridge/prompts/__init__.py,sha256=wzveum1x50IXGkE0JFpvHAj8P0yqnSrgtrmyIIpnnBI,358
51
+ mcp_bridge/prompts/delphi.py,sha256=ZlnLY2o1PrK3CxLLaCkozAGPIAJ5OFmw5u8o6-LXmgI,4960
52
+ mcp_bridge/prompts/dewey.py,sha256=u5OaOj8kinZERflWvUv4M4WVAwxw0kJrNT00wHksIHI,9264
53
+ mcp_bridge/prompts/document_writer.py,sha256=hiCbxgTU8HKPJkS0eNpPPtzSqDXPreApU2OqiS6zh-0,5618
54
+ mcp_bridge/prompts/explore.py,sha256=oZxh4fe4KNGa_ozakJSpLYeQVfO4-jQ2M1BSOw1Sw10,5801
55
+ mcp_bridge/prompts/frontend.py,sha256=j91I8k5vcVed13eeX-Ebiv49x9Qj4HO_SQN1xhB8TLQ,4943
56
+ mcp_bridge/prompts/multimodal.py,sha256=Q_rutR7r5iBcLViVfdLxoukCQe2OA0lDJhxkoo0OSMw,2692
57
+ mcp_bridge/prompts/planner.py,sha256=wcdXIxPlZM0UYd9KQSKXnuXTRj2acSnqlqeQ_NxxEqw,6985
58
+ mcp_bridge/prompts/stravinsky.py,sha256=gJgzMgsa6u0fLbFWOkPY2lq78-yJTuD46wrnk-5rem0,27498
59
+ mcp_bridge/tools/__init__.py,sha256=SRnMaUni0BhlvCABBEYeyveNiOAMQPNBXmjUKG6aXQA,1150
60
+ mcp_bridge/tools/agent_manager.py,sha256=PUiP0VJ-Ntu7f9-mq0mfWRMVU39-tIDJ-kNM7L4M-jE,35827
61
+ mcp_bridge/tools/background_tasks.py,sha256=bwbVYWCDzuXb3Q_OdIr10r76lgjFTphfjdTmOHYZI7w,5252
62
+ mcp_bridge/tools/code_search.py,sha256=xawUBapNSCp1lL_LESsiiVU6fno1iFeSji2Ke5WAO6M,13170
63
+ mcp_bridge/tools/continuous_loop.py,sha256=MM3FnF3ULuR32h0tqJP8uF48iJg6R9dbyHy_36KLOls,2100
64
+ mcp_bridge/tools/init.py,sha256=sU95M9M_tjsfuew389TrFrxxeCavuSC16qbkydk_6PU,1586
65
+ mcp_bridge/tools/model_invoke.py,sha256=chWma7C2ZKew4sb_dyoW7iH8F31p87hruM7i_N3U32U,35669
66
+ mcp_bridge/tools/project_context.py,sha256=bXKxuW1pGjtIbeNjMgpBoQL-d_CI94UPBVpRjUyhX20,4707
67
+ mcp_bridge/tools/semantic_search.py,sha256=t45D7LlMmTpvLew-TpHU2hYNEyWiLhWRkXQaw_ssMH8,87056
68
+ mcp_bridge/tools/session_manager.py,sha256=tCVLLvO-Kttla7OxPImb_NSGL_9aW46ilq5ej_IcnlA,9252
69
+ mcp_bridge/tools/skill_loader.py,sha256=RQ5eC357pm-6q85G3EyrQugz0S3OO5lxWtM9n9ECF-c,6010
70
+ mcp_bridge/tools/task_runner.py,sha256=xjE3MXv62gcUCwOEwHjAGL_Ud_ZlKFBN0UHpvFjj3uk,3918
71
+ mcp_bridge/tools/templates.py,sha256=ANsSXGFKvc7NR58jbmR7SejlbBQucqXZi4DYagYz3CQ,7008
72
+ mcp_bridge/tools/lsp/__init__.py,sha256=v-2OENfPrZxglAwpbooH3rFjcZDmhAMXEFZhygwq3II,753
73
+ mcp_bridge/tools/lsp/manager.py,sha256=DR0XDDL0ElKsf8I3iqJIXhV4oX25Kh2QoPLGGtpgM7o,16272
74
+ mcp_bridge/tools/lsp/tools.py,sha256=DANgPzp52vPomBAEnwOU9YZiNowz9yWQZGLQZ1wXTeY,34521
75
+ mcp_bridge/utils/__init__.py,sha256=pbHV4nq5SLUYcAyTmLUZYrp293Ctud57X8hwsMGA_BM,20
76
+ stravinsky-0.3.4.dist-info/METADATA,sha256=j29JYRyoH1mxUbZVx6bQ158hL78XHiPzSDMrwamKkUQ,19875
77
+ stravinsky-0.3.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
78
+ stravinsky-0.3.4.dist-info/entry_points.txt,sha256=MB1dqHW9dx-ae0-cDi6fYEY9HtyzbyB5VhJxza0wDDc,215
79
+ stravinsky-0.3.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ stravinsky = mcp_bridge.server:main
3
+ stravinsky-auth = mcp_bridge.auth.cli:main
4
+ stravinsky-install-hooks = mcp_bridge.cli.install_hooks:main
5
+ stravinsky-sessions = mcp_bridge.cli.session_report:main
@@ -1,46 +0,0 @@
1
- import os
2
- import sys
3
- import json
4
- import re
5
-
6
- def main():
7
- # Claude Code PostToolUse inputs via Environment Variables
8
- tool_name = os.environ.get("CLAUDE_TOOL_NAME")
9
-
10
- # We only care about Edit/MultiEdit
11
- if tool_name not in ["Edit", "MultiEdit"]:
12
- return
13
-
14
- # Read from stdin (Claude Code passes the tool response via stdin for some hook types,
15
- # but for PostToolUse it's often better to check the environment variable if available.
16
- # Actually, the summary says input is a JSON payload.
17
- try:
18
- data = json.load(sys.stdin)
19
- tool_response = data.get("tool_response", "")
20
- except Exception:
21
- # Fallback to direct string if not JSON
22
- return
23
-
24
- # Error patterns
25
- error_patterns = [
26
- r"oldString not found",
27
- r"oldString matched multiple times",
28
- r"line numbers out of range"
29
- ]
30
-
31
- recovery_needed = any(re.search(p, tool_response, re.IGNORECASE) for p in error_patterns)
32
-
33
- if recovery_needed:
34
- correction = (
35
- "\n\n[SYSTEM RECOVERY] It appears the Edit tool failed to find the target string. "
36
- "Please call 'Read' on the file again to verify the current content, "
37
- "then ensure your 'oldString' is an EXACT match including all whitespace."
38
- )
39
- # For PostToolUse, stdout is captured and appended/replaces output
40
- print(tool_response + correction)
41
- else:
42
- # No change
43
- print(tool_response)
44
-
45
- if __name__ == "__main__":
46
- main()
@@ -1,23 +0,0 @@
1
- import os
2
- import sys
3
- import json
4
-
5
- MAX_CHARS = 30000
6
-
7
- def main():
8
- try:
9
- data = json.load(sys.stdin)
10
- tool_response = data.get("tool_response", "")
11
- except Exception:
12
- return
13
-
14
- if len(tool_response) > MAX_CHARS:
15
- header = f"[TRUNCATED - {len(tool_response)} chars reduced to {MAX_CHARS}]\n"
16
- footer = "\n...[TRUNCATED]"
17
- truncated = tool_response[:MAX_CHARS]
18
- print(header + truncated + footer)
19
- else:
20
- print(tool_response)
21
-
22
- if __name__ == "__main__":
23
- main()