oh-my-claude-sisyphus 3.7.16 → 3.8.1
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +8 -6
- package/agents/AGENTS.md +8 -8
- package/agents/architect.md +32 -0
- package/agents/build-fixer.md +35 -0
- package/agents/code-reviewer.md +51 -0
- package/agents/executor-high.md +49 -0
- package/agents/explore-high.md +39 -0
- package/agents/explore-medium.md +33 -0
- package/dist/__tests__/hooks/learner/bridge.test.js +13 -7
- package/dist/__tests__/hooks/learner/bridge.test.js.map +1 -1
- package/dist/__tests__/hooks.test.js +306 -67
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +31 -15
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/hooks/bridge.js +3 -3
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/clear-suggestions/constants.d.ts +54 -0
- package/dist/hooks/clear-suggestions/constants.d.ts.map +1 -0
- package/dist/hooks/clear-suggestions/constants.js +102 -0
- package/dist/hooks/clear-suggestions/constants.js.map +1 -0
- package/dist/hooks/clear-suggestions/index.d.ts +61 -0
- package/dist/hooks/clear-suggestions/index.d.ts.map +1 -0
- package/dist/hooks/clear-suggestions/index.js +276 -0
- package/dist/hooks/clear-suggestions/index.js.map +1 -0
- package/dist/hooks/clear-suggestions/triggers.d.ts +65 -0
- package/dist/hooks/clear-suggestions/triggers.d.ts.map +1 -0
- package/dist/hooks/clear-suggestions/triggers.js +222 -0
- package/dist/hooks/clear-suggestions/triggers.js.map +1 -0
- package/dist/hooks/clear-suggestions/types.d.ts +92 -0
- package/dist/hooks/clear-suggestions/types.d.ts.map +1 -0
- package/dist/hooks/clear-suggestions/types.js +9 -0
- package/dist/hooks/clear-suggestions/types.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js +51 -51
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +18 -5
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/docs/CLAUDE.md +83 -0
- package/package.json +1 -1
- package/scripts/keyword-detector.mjs +203 -83
- package/scripts/post-tool-verifier.mjs +39 -1
- package/templates/hooks/keyword-detector.sh +197 -31
package/docs/CLAUDE.md
CHANGED
|
@@ -309,6 +309,89 @@ Always use `oh-my-claudecode:` prefix when calling via Task tool.
|
|
|
309
309
|
| Data analysis/stats | `scientist` | sonnet |
|
|
310
310
|
| Quick data inspection | `scientist-low` | haiku |
|
|
311
311
|
| Complex ML/hypothesis | `scientist-high` | opus |
|
|
312
|
+
| Find symbol references | `explore-high` | opus |
|
|
313
|
+
| Get file/workspace symbol outline | `explore` | haiku |
|
|
314
|
+
| Structural code pattern search | `explore` | haiku |
|
|
315
|
+
| Structural code transformation | `executor-high` | opus |
|
|
316
|
+
| Project-wide type checking | `build-fixer` | sonnet |
|
|
317
|
+
| Check single file for errors | `executor-low` | haiku |
|
|
318
|
+
| Data analysis / computation | `scientist` | sonnet |
|
|
319
|
+
|
|
320
|
+
### MCP Tools & Agent Capabilities
|
|
321
|
+
|
|
322
|
+
*Source of truth: `src/agents/definitions.ts`*
|
|
323
|
+
|
|
324
|
+
#### Tool Inventory
|
|
325
|
+
|
|
326
|
+
| Tool | Category | Purpose | Assigned to Agents? |
|
|
327
|
+
|------|----------|---------|---------------------|
|
|
328
|
+
| `lsp_hover` | LSP | Get type info and documentation at a code position | NO (orchestrator-direct) |
|
|
329
|
+
| `lsp_goto_definition` | LSP | Jump to where a symbol is defined | NO (orchestrator-direct) |
|
|
330
|
+
| `lsp_find_references` | LSP | Find all usages of a symbol across the codebase | YES (`explore-high` only) |
|
|
331
|
+
| `lsp_document_symbols` | LSP | Get outline of all symbols in a file | YES |
|
|
332
|
+
| `lsp_workspace_symbols` | LSP | Search for symbols by name across the workspace | YES |
|
|
333
|
+
| `lsp_diagnostics` | LSP | Get errors, warnings, and hints for a file | YES |
|
|
334
|
+
| `lsp_diagnostics_directory` | LSP | Project-level type checking (tsc --noEmit or LSP) | YES |
|
|
335
|
+
| `lsp_prepare_rename` | LSP | Check if a symbol can be renamed | NO (orchestrator-direct) |
|
|
336
|
+
| `lsp_rename` | LSP | Rename a symbol across the entire project | NO (orchestrator-direct) |
|
|
337
|
+
| `lsp_code_actions` | LSP | Get available refactorings and quick fixes | NO (orchestrator-direct) |
|
|
338
|
+
| `lsp_code_action_resolve` | LSP | Get full edit details for a code action | NO (orchestrator-direct) |
|
|
339
|
+
| `lsp_servers` | LSP | List available language servers and install status | NO (orchestrator-direct) |
|
|
340
|
+
| `ast_grep_search` | AST | Pattern-based structural code search using AST | YES |
|
|
341
|
+
| `ast_grep_replace` | AST | Pattern-based structural code transformation | YES (`executor-high` only) |
|
|
342
|
+
| `python_repl` | Data | Persistent Python REPL for data analysis and computation | YES |
|
|
343
|
+
|
|
344
|
+
#### Agent Tool Matrix (MCP Tools Only)
|
|
345
|
+
|
|
346
|
+
| Agent | LSP Diagnostics | LSP Dir Diagnostics | LSP Symbols | LSP References | AST Search | AST Replace | Python REPL |
|
|
347
|
+
|-------|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
348
|
+
| `explore` | - | - | doc + workspace | - | yes | - | - |
|
|
349
|
+
| `explore-medium` | - | - | doc + workspace | - | yes | - | - |
|
|
350
|
+
| `explore-high` | - | - | doc + workspace | yes | yes | - | - |
|
|
351
|
+
| `architect-low` | yes | - | - | - | - | - | - |
|
|
352
|
+
| `architect-medium` | yes | yes | - | - | yes | - | - |
|
|
353
|
+
| `architect` | yes | yes | - | - | yes | - | - |
|
|
354
|
+
| `executor-low` | yes | - | - | - | - | - | - |
|
|
355
|
+
| `executor` | yes | yes | - | - | - | - | - |
|
|
356
|
+
| `executor-high` | yes | yes | - | - | yes | yes | - |
|
|
357
|
+
| `build-fixer` | yes | yes | - | - | - | - | - |
|
|
358
|
+
| `build-fixer-low` | yes | yes | - | - | - | - | - |
|
|
359
|
+
| `tdd-guide` | yes | - | - | - | - | - | - |
|
|
360
|
+
| `tdd-guide-low` | yes | - | - | - | - | - | - |
|
|
361
|
+
| `code-reviewer` | yes | - | - | - | yes | - | - |
|
|
362
|
+
| `code-reviewer-low` | yes | - | - | - | - | - | - |
|
|
363
|
+
| `qa-tester` | yes | - | - | - | - | - | - |
|
|
364
|
+
| `qa-tester-high` | yes | - | - | - | - | - | - |
|
|
365
|
+
| `scientist-low` | - | - | - | - | - | - | yes |
|
|
366
|
+
| `scientist` | - | - | - | - | - | - | yes |
|
|
367
|
+
| `scientist-high` | - | - | - | - | - | - | yes |
|
|
368
|
+
|
|
369
|
+
#### Unassigned Tools (Orchestrator-Direct)
|
|
370
|
+
|
|
371
|
+
The following 7 MCP tools are NOT assigned to any agent. Use directly when needed:
|
|
372
|
+
|
|
373
|
+
| Tool | When to Use Directly |
|
|
374
|
+
|------|---------------------|
|
|
375
|
+
| `lsp_hover` | Quick type lookups during conversation |
|
|
376
|
+
| `lsp_goto_definition` | Navigating to symbol definitions during analysis |
|
|
377
|
+
| `lsp_prepare_rename` | Checking rename feasibility before deciding on approach |
|
|
378
|
+
| `lsp_rename` | Safe rename operations (returns edit preview, does not auto-apply) |
|
|
379
|
+
| `lsp_code_actions` | Discovering available refactorings |
|
|
380
|
+
| `lsp_code_action_resolve` | Getting details of a specific code action |
|
|
381
|
+
| `lsp_servers` | Checking language server availability |
|
|
382
|
+
|
|
383
|
+
For complex rename or refactoring tasks requiring implementation, delegate to `executor-high` which can use `ast_grep_replace` for structural transformations.
|
|
384
|
+
|
|
385
|
+
#### Tool Selection Guidance
|
|
386
|
+
|
|
387
|
+
- **Need file symbol outline or workspace search?** Use `lsp_document_symbols`/`lsp_workspace_symbols` via `explore`, `explore-medium`, or `explore-high`
|
|
388
|
+
- **Need to find all usages of a symbol?** Use `lsp_find_references` via `explore-high` (only agent with it)
|
|
389
|
+
- **Need structural code patterns?** (e.g., "find all functions matching X shape") Use `ast_grep_search` via `explore` family, `architect`/`architect-medium`, or `code-reviewer`
|
|
390
|
+
- **Need to transform code structurally?** Use `ast_grep_replace` via `executor-high` (only agent with it)
|
|
391
|
+
- **Need project-wide type checking?** Use `lsp_diagnostics_directory` via `architect`/`architect-medium`, `executor`/`executor-high`, or `build-fixer` family
|
|
392
|
+
- **Need single-file error checking?** Use `lsp_diagnostics` via many agents (see matrix)
|
|
393
|
+
- **Need data analysis / computation?** Use `python_repl` via `scientist` agents (all tiers)
|
|
394
|
+
- **Need quick type info or definition lookup?** Use `lsp_hover`/`lsp_goto_definition` directly (orchestrator-direct tools)
|
|
312
395
|
|
|
313
396
|
---
|
|
314
397
|
|
package/package.json
CHANGED
|
@@ -1,51 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Detects
|
|
4
|
+
* OMC Keyword Detector Hook (Node.js)
|
|
5
|
+
* Detects magic keywords and invokes skill tools
|
|
6
6
|
* Cross-platform: Windows, macOS, Linux
|
|
7
|
+
*
|
|
8
|
+
* Supported keywords (in priority order):
|
|
9
|
+
* 1. cancel: Stop active modes
|
|
10
|
+
* 2. ralph: Persistence mode until task completion
|
|
11
|
+
* 3. autopilot: Full autonomous execution
|
|
12
|
+
* 4. ultrapilot: Parallel autopilot
|
|
13
|
+
* 5. ultrawork/ulw: Maximum parallel execution
|
|
14
|
+
* 6. ecomode/eco: Token-efficient execution
|
|
15
|
+
* 7. swarm: N coordinated agents
|
|
16
|
+
* 8. pipeline: Sequential agent chaining
|
|
17
|
+
* 9. ralplan: Iterative planning with consensus
|
|
18
|
+
* 10. plan: Planning interview mode
|
|
19
|
+
* 11. tdd: Test-driven development
|
|
20
|
+
* 12. research: Research orchestration
|
|
21
|
+
* 13. ultrathink/think: Extended reasoning
|
|
22
|
+
* 14. deepsearch: Codebase search (restricted patterns)
|
|
23
|
+
* 15. analyze: Analysis mode (restricted patterns)
|
|
7
24
|
*/
|
|
8
25
|
|
|
9
|
-
import { writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
26
|
+
import { writeFileSync, mkdirSync, existsSync, unlinkSync } from 'fs';
|
|
10
27
|
import { join } from 'path';
|
|
11
28
|
import { homedir } from 'os';
|
|
12
29
|
|
|
13
|
-
const ULTRAWORK_MESSAGE = `<ultrawork-mode>
|
|
14
|
-
|
|
15
|
-
**MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
|
|
16
|
-
|
|
17
|
-
[CODE RED] Maximum precision required. Ultrathink before acting.
|
|
18
|
-
|
|
19
|
-
YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
|
|
20
|
-
TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
|
21
|
-
|
|
22
|
-
## AGENT UTILIZATION PRINCIPLES
|
|
23
|
-
- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS
|
|
24
|
-
- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS
|
|
25
|
-
- **Planning & Strategy**: NEVER plan yourself - spawn planning agent
|
|
26
|
-
- **High-IQ Reasoning**: Use oracle for architecture decisions
|
|
27
|
-
- **Frontend/UI Tasks**: Delegate to frontend-engineer
|
|
28
|
-
|
|
29
|
-
## EXECUTION RULES
|
|
30
|
-
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY.
|
|
31
|
-
- **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially.
|
|
32
|
-
- **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent).
|
|
33
|
-
- **VERIFY**: Check ALL requirements met before done.
|
|
34
|
-
- **DELEGATE**: Orchestrate specialized agents.
|
|
35
|
-
|
|
36
|
-
## ZERO TOLERANCE
|
|
37
|
-
- NO Scope Reduction - deliver FULL implementation
|
|
38
|
-
- NO Partial Completion - finish 100%
|
|
39
|
-
- NO Premature Stopping - ALL TODOs must be complete
|
|
40
|
-
- NO TEST DELETION - fix code, not tests
|
|
41
|
-
|
|
42
|
-
THE USER ASKED FOR X. DELIVER EXACTLY X.
|
|
43
|
-
|
|
44
|
-
</ultrawork-mode>
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
30
|
const ULTRATHINK_MESSAGE = `<think-mode>
|
|
50
31
|
|
|
51
32
|
**ULTRATHINK MODE ENABLED** - Extended reasoning activated.
|
|
@@ -63,34 +44,6 @@ Use your extended thinking capabilities to provide the most thorough and well-re
|
|
|
63
44
|
---
|
|
64
45
|
`;
|
|
65
46
|
|
|
66
|
-
const SEARCH_MESSAGE = `<search-mode>
|
|
67
|
-
MAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:
|
|
68
|
-
- explore agents (codebase patterns, file structures)
|
|
69
|
-
- librarian agents (remote repos, official docs, GitHub examples)
|
|
70
|
-
Plus direct tools: Grep, Glob
|
|
71
|
-
NEVER stop at first result - be exhaustive.
|
|
72
|
-
</search-mode>
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
const ANALYZE_MESSAGE = `<analyze-mode>
|
|
78
|
-
ANALYSIS MODE. Gather context before diving deep:
|
|
79
|
-
|
|
80
|
-
CONTEXT GATHERING (parallel):
|
|
81
|
-
- 1-2 explore agents (codebase patterns, implementations)
|
|
82
|
-
- 1-2 librarian agents (if external library involved)
|
|
83
|
-
- Direct tools: Grep, Glob, LSP for targeted searches
|
|
84
|
-
|
|
85
|
-
IF COMPLEX (architecture, multi-system, debugging after 2+ failures):
|
|
86
|
-
- Consult oracle agent for strategic guidance
|
|
87
|
-
|
|
88
|
-
SYNTHESIZE findings before proceeding.
|
|
89
|
-
</analyze-mode>
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
47
|
// Read all stdin
|
|
95
48
|
async function readStdin() {
|
|
96
49
|
const chunks = [];
|
|
@@ -127,8 +80,8 @@ function removeCodeBlocks(text) {
|
|
|
127
80
|
.replace(/`[^`]+`/g, '');
|
|
128
81
|
}
|
|
129
82
|
|
|
130
|
-
// Create
|
|
131
|
-
function
|
|
83
|
+
// Create state file for a mode
|
|
84
|
+
function activateState(directory, prompt, stateName) {
|
|
132
85
|
const state = {
|
|
133
86
|
active: true,
|
|
134
87
|
started_at: new Date().toISOString(),
|
|
@@ -142,14 +95,43 @@ function activateUltraworkState(directory, prompt) {
|
|
|
142
95
|
if (!existsSync(localDir)) {
|
|
143
96
|
try { mkdirSync(localDir, { recursive: true }); } catch {}
|
|
144
97
|
}
|
|
145
|
-
try { writeFileSync(join(localDir,
|
|
98
|
+
try { writeFileSync(join(localDir, `${stateName}-state.json`), JSON.stringify(state, null, 2)); } catch {}
|
|
146
99
|
|
|
147
100
|
// Write to global .omc/state directory
|
|
148
101
|
const globalDir = join(homedir(), '.omc', 'state');
|
|
149
102
|
if (!existsSync(globalDir)) {
|
|
150
103
|
try { mkdirSync(globalDir, { recursive: true }); } catch {}
|
|
151
104
|
}
|
|
152
|
-
try { writeFileSync(join(globalDir,
|
|
105
|
+
try { writeFileSync(join(globalDir, `${stateName}-state.json`), JSON.stringify(state, null, 2)); } catch {}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Clear state files for cancel operation
|
|
110
|
+
*/
|
|
111
|
+
function clearStateFiles(directory, modeNames) {
|
|
112
|
+
for (const name of modeNames) {
|
|
113
|
+
const localPath = join(directory, '.omc', 'state', `${name}-state.json`);
|
|
114
|
+
const globalPath = join(homedir(), '.omc', 'state', `${name}-state.json`);
|
|
115
|
+
try { if (existsSync(localPath)) unlinkSync(localPath); } catch {}
|
|
116
|
+
try { if (existsSync(globalPath)) unlinkSync(globalPath); } catch {}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Create a skill invocation message that tells Claude to use the Skill tool
|
|
122
|
+
*/
|
|
123
|
+
function createSkillInvocation(skillName, originalPrompt, args = '') {
|
|
124
|
+
const argsSection = args ? `\nArguments: ${args}` : '';
|
|
125
|
+
return `[MAGIC KEYWORD: ${skillName.toUpperCase()}]
|
|
126
|
+
|
|
127
|
+
You MUST invoke the skill using the Skill tool:
|
|
128
|
+
|
|
129
|
+
Skill: oh-my-claudecode:${skillName}${argsSection}
|
|
130
|
+
|
|
131
|
+
User request:
|
|
132
|
+
${originalPrompt}
|
|
133
|
+
|
|
134
|
+
IMPORTANT: Invoke the skill IMMEDIATELY. Do not proceed without loading the skill instructions.`;
|
|
153
135
|
}
|
|
154
136
|
|
|
155
137
|
// Main
|
|
@@ -173,28 +155,166 @@ async function main() {
|
|
|
173
155
|
|
|
174
156
|
const cleanPrompt = removeCodeBlocks(prompt).toLowerCase();
|
|
175
157
|
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
158
|
+
// Priority order: cancel > ralph > autopilot > ultrapilot > ultrawork > ecomode > swarm > pipeline > ralplan > plan > tdd > research > ultrathink > deepsearch > analyze
|
|
159
|
+
|
|
160
|
+
// Priority 1: Cancel (BEFORE other modes - clears states)
|
|
161
|
+
if (/\b(stop|cancel|abort)\b/i.test(cleanPrompt)) {
|
|
162
|
+
// Special: clear state files instead of creating them
|
|
163
|
+
clearStateFiles(directory, ['ralph', 'autopilot', 'ultrapilot', 'ultrawork', 'ecomode', 'swarm', 'pipeline']);
|
|
164
|
+
console.log(JSON.stringify({
|
|
165
|
+
continue: true,
|
|
166
|
+
message: createSkillInvocation('cancel', prompt)
|
|
167
|
+
}));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Priority 2: Ralph keywords
|
|
172
|
+
if (/\b(ralph|don't stop|must complete|until done)\b/i.test(cleanPrompt)) {
|
|
173
|
+
activateState(directory, prompt, 'ralph');
|
|
174
|
+
activateState(directory, prompt, 'ultrawork');
|
|
175
|
+
console.log(JSON.stringify({
|
|
176
|
+
continue: true,
|
|
177
|
+
message: createSkillInvocation('ralph', prompt)
|
|
178
|
+
}));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Priority 3: Autopilot keywords
|
|
183
|
+
if (/\b(autopilot|auto pilot|auto-pilot|autonomous|full auto|fullsend)\b/i.test(cleanPrompt) ||
|
|
184
|
+
/\bbuild\s+me\s+/i.test(cleanPrompt) ||
|
|
185
|
+
/\bcreate\s+me\s+/i.test(cleanPrompt) ||
|
|
186
|
+
/\bmake\s+me\s+/i.test(cleanPrompt) ||
|
|
187
|
+
/\bi\s+want\s+a\s+/i.test(cleanPrompt) ||
|
|
188
|
+
/\bi\s+want\s+an\s+/i.test(cleanPrompt) ||
|
|
189
|
+
/\bhandle\s+it\s+all\b/i.test(cleanPrompt) ||
|
|
190
|
+
/\bend\s+to\s+end\b/i.test(cleanPrompt) ||
|
|
191
|
+
/\be2e\s+this\b/i.test(cleanPrompt)) {
|
|
192
|
+
activateState(directory, prompt, 'autopilot');
|
|
193
|
+
console.log(JSON.stringify({
|
|
194
|
+
continue: true,
|
|
195
|
+
message: createSkillInvocation('autopilot', prompt)
|
|
196
|
+
}));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Priority 4: Ultrapilot
|
|
201
|
+
if (/\b(ultrapilot|ultra-pilot)\b/i.test(cleanPrompt) ||
|
|
202
|
+
/\bparallel\s+build\b/i.test(cleanPrompt) ||
|
|
203
|
+
/\bswarm\s+build\b/i.test(cleanPrompt)) {
|
|
204
|
+
activateState(directory, prompt, 'ultrapilot');
|
|
205
|
+
console.log(JSON.stringify({
|
|
206
|
+
continue: true,
|
|
207
|
+
message: createSkillInvocation('ultrapilot', prompt)
|
|
208
|
+
}));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Priority 5: Ultrawork keywords
|
|
213
|
+
if (/\b(ultrawork|ulw|uw)\b/i.test(cleanPrompt)) {
|
|
214
|
+
activateState(directory, prompt, 'ultrawork');
|
|
215
|
+
console.log(JSON.stringify({
|
|
216
|
+
continue: true,
|
|
217
|
+
message: createSkillInvocation('ultrawork', prompt)
|
|
218
|
+
}));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Priority 6: Ecomode keywords (includes "efficient")
|
|
223
|
+
if (/\b(eco|ecomode|eco-mode|efficient|save-tokens|budget)\b/i.test(cleanPrompt)) {
|
|
224
|
+
activateState(directory, prompt, 'ecomode');
|
|
225
|
+
console.log(JSON.stringify({
|
|
226
|
+
continue: true,
|
|
227
|
+
message: createSkillInvocation('ecomode', prompt)
|
|
228
|
+
}));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Priority 7: Swarm - parse N from "swarm N agents"
|
|
233
|
+
const swarmMatch = cleanPrompt.match(/\bswarm\s+(\d+)\s+agents?\b/i);
|
|
234
|
+
if (swarmMatch || /\bcoordinated\s+agents\b/i.test(cleanPrompt)) {
|
|
235
|
+
const agentCount = swarmMatch ? swarmMatch[1] : '3'; // default 3
|
|
236
|
+
console.log(JSON.stringify({
|
|
237
|
+
continue: true,
|
|
238
|
+
message: createSkillInvocation('swarm', prompt, agentCount)
|
|
239
|
+
}));
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Priority 8: Pipeline
|
|
244
|
+
if (/\b(pipeline)\b/i.test(cleanPrompt) || /\bchain\s+agents\b/i.test(cleanPrompt)) {
|
|
245
|
+
console.log(JSON.stringify({
|
|
246
|
+
continue: true,
|
|
247
|
+
message: createSkillInvocation('pipeline', prompt)
|
|
248
|
+
}));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Priority 9: Ralplan keyword (before plan to avoid false match)
|
|
253
|
+
if (/\b(ralplan)\b/i.test(cleanPrompt)) {
|
|
254
|
+
console.log(JSON.stringify({
|
|
255
|
+
continue: true,
|
|
256
|
+
message: createSkillInvocation('ralplan', prompt)
|
|
257
|
+
}));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Priority 10: Plan keywords
|
|
262
|
+
if (/\b(plan this|plan the)\b/i.test(cleanPrompt)) {
|
|
263
|
+
console.log(JSON.stringify({
|
|
264
|
+
continue: true,
|
|
265
|
+
message: createSkillInvocation('plan', prompt)
|
|
266
|
+
}));
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Priority 11: TDD
|
|
271
|
+
if (/\b(tdd)\b/i.test(cleanPrompt) ||
|
|
272
|
+
/\btest\s+first\b/i.test(cleanPrompt) ||
|
|
273
|
+
/\bred\s+green\b/i.test(cleanPrompt)) {
|
|
274
|
+
console.log(JSON.stringify({
|
|
275
|
+
continue: true,
|
|
276
|
+
message: createSkillInvocation('tdd', prompt)
|
|
277
|
+
}));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Priority 12: Research
|
|
282
|
+
// "research" alone OR "analyze data" OR "statistics" trigger research skill
|
|
283
|
+
if (/\b(research)\b/i.test(cleanPrompt) ||
|
|
284
|
+
/\banalyze\s+data\b/i.test(cleanPrompt) ||
|
|
285
|
+
/\bstatistics\b/i.test(cleanPrompt)) {
|
|
286
|
+
console.log(JSON.stringify({
|
|
287
|
+
continue: true,
|
|
288
|
+
message: createSkillInvocation('research', prompt)
|
|
289
|
+
}));
|
|
180
290
|
return;
|
|
181
291
|
}
|
|
182
292
|
|
|
183
|
-
//
|
|
184
|
-
if (/\b(ultrathink|think)\b
|
|
293
|
+
// Priority 13: Ultrathink/think keywords (keep inline message)
|
|
294
|
+
if (/\b(ultrathink|think hard|think deeply)\b/i.test(cleanPrompt)) {
|
|
185
295
|
console.log(JSON.stringify({ continue: true, message: ULTRATHINK_MESSAGE }));
|
|
186
296
|
return;
|
|
187
297
|
}
|
|
188
298
|
|
|
189
|
-
//
|
|
190
|
-
if (/\b(
|
|
191
|
-
|
|
299
|
+
// Priority 14: Deepsearch (RESTRICTED patterns)
|
|
300
|
+
if (/\b(deepsearch)\b/i.test(cleanPrompt) ||
|
|
301
|
+
/\bsearch\s+(the\s+)?(codebase|code|files?|project)\b/i.test(cleanPrompt) ||
|
|
302
|
+
/\bfind\s+(in\s+)?(codebase|code|all\s+files?)\b/i.test(cleanPrompt)) {
|
|
303
|
+
console.log(JSON.stringify({
|
|
304
|
+
continue: true,
|
|
305
|
+
message: createSkillInvocation('deepsearch', prompt)
|
|
306
|
+
}));
|
|
192
307
|
return;
|
|
193
308
|
}
|
|
194
309
|
|
|
195
|
-
//
|
|
196
|
-
if (/\b(analyze
|
|
197
|
-
|
|
310
|
+
// Priority 15: Analyze (RESTRICTED patterns)
|
|
311
|
+
if (/\b(deep\s*analyze)\b/i.test(cleanPrompt) ||
|
|
312
|
+
/\binvestigate\s+(the|this|why)\b/i.test(cleanPrompt) ||
|
|
313
|
+
/\bdebug\s+(the|this|why)\b/i.test(cleanPrompt)) {
|
|
314
|
+
console.log(JSON.stringify({
|
|
315
|
+
continue: true,
|
|
316
|
+
message: createSkillInvocation('analyze', prompt)
|
|
317
|
+
}));
|
|
198
318
|
return;
|
|
199
319
|
}
|
|
200
320
|
|
|
@@ -15,6 +15,7 @@ import { fileURLToPath } from 'url';
|
|
|
15
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
16
16
|
const __dirname = dirname(__filename);
|
|
17
17
|
const distDir = join(__dirname, '..', 'dist', 'hooks', 'notepad');
|
|
18
|
+
const clearSuggestionsDistDir = join(__dirname, '..', 'dist', 'hooks', 'clear-suggestions');
|
|
18
19
|
|
|
19
20
|
// Try to import notepad functions (may fail if not built)
|
|
20
21
|
let setPriorityContext = null;
|
|
@@ -27,6 +28,15 @@ try {
|
|
|
27
28
|
// Notepad module not available - remember tags will be silently ignored
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
// Try to import clear suggestions functions (may fail if not built)
|
|
32
|
+
let checkClearSuggestion = null;
|
|
33
|
+
try {
|
|
34
|
+
const clearSuggestionsModule = await import(join(clearSuggestionsDistDir, 'index.js'));
|
|
35
|
+
checkClearSuggestion = clearSuggestionsModule.checkClearSuggestion;
|
|
36
|
+
} catch {
|
|
37
|
+
// Clear suggestions module not available - will be silently skipped
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
// State file for session tracking
|
|
31
41
|
const STATE_FILE = join(homedir(), '.claude', '.session-stats.json');
|
|
32
42
|
|
|
@@ -262,9 +272,37 @@ async function main() {
|
|
|
262
272
|
// Generate contextual message
|
|
263
273
|
const message = generateMessage(toolName, toolOutput, sessionId, toolCount);
|
|
264
274
|
|
|
275
|
+
// Check for clear suggestions (complements /compact suggestions)
|
|
276
|
+
let clearSuggestionMessage = null;
|
|
277
|
+
if (checkClearSuggestion) {
|
|
278
|
+
try {
|
|
279
|
+
const stats = loadStats();
|
|
280
|
+
const session = stats.sessions[sessionId];
|
|
281
|
+
// Estimate context usage from total tool calls (rough heuristic)
|
|
282
|
+
const estimatedContextRatio = session ? Math.min(session.total_calls / 200, 1.0) : 0;
|
|
283
|
+
|
|
284
|
+
const clearResult = checkClearSuggestion({
|
|
285
|
+
sessionId,
|
|
286
|
+
directory,
|
|
287
|
+
toolName,
|
|
288
|
+
toolOutput,
|
|
289
|
+
contextUsageRatio: estimatedContextRatio,
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
if (clearResult.shouldSuggest && clearResult.message) {
|
|
293
|
+
clearSuggestionMessage = clearResult.message;
|
|
294
|
+
}
|
|
295
|
+
} catch {
|
|
296
|
+
// Clear suggestion check failed - continue without it
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
265
300
|
// Build response
|
|
266
301
|
const response = { continue: true };
|
|
267
|
-
|
|
302
|
+
// Prefer clear suggestion over contextual message (more impactful)
|
|
303
|
+
if (clearSuggestionMessage) {
|
|
304
|
+
response.message = clearSuggestionMessage;
|
|
305
|
+
} else if (message) {
|
|
268
306
|
response.message = message;
|
|
269
307
|
}
|
|
270
308
|
|