oh-my-claude-sisyphus 3.6.2 → 3.7.0

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 (124) hide show
  1. package/README.md +16 -0
  2. package/commands/doctor.md +1 -1
  3. package/dist/__tests__/delegation-enforcement-levels.test.d.ts +9 -0
  4. package/dist/__tests__/delegation-enforcement-levels.test.d.ts.map +1 -0
  5. package/dist/__tests__/delegation-enforcement-levels.test.js +550 -0
  6. package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -0
  7. package/dist/__tests__/installer.test.js +1 -1
  8. package/dist/__tests__/rate-limit-wait/daemon.test.d.ts +5 -0
  9. package/dist/__tests__/rate-limit-wait/daemon.test.d.ts.map +1 -0
  10. package/dist/__tests__/rate-limit-wait/daemon.test.js +313 -0
  11. package/dist/__tests__/rate-limit-wait/daemon.test.js.map +1 -0
  12. package/dist/__tests__/rate-limit-wait/integration.test.d.ts +8 -0
  13. package/dist/__tests__/rate-limit-wait/integration.test.d.ts.map +1 -0
  14. package/dist/__tests__/rate-limit-wait/integration.test.js +329 -0
  15. package/dist/__tests__/rate-limit-wait/integration.test.js.map +1 -0
  16. package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.d.ts +5 -0
  17. package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.d.ts.map +1 -0
  18. package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.js +167 -0
  19. package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.js.map +1 -0
  20. package/dist/__tests__/rate-limit-wait/tmux-detector.test.d.ts +5 -0
  21. package/dist/__tests__/rate-limit-wait/tmux-detector.test.d.ts.map +1 -0
  22. package/dist/__tests__/rate-limit-wait/tmux-detector.test.js +295 -0
  23. package/dist/__tests__/rate-limit-wait/tmux-detector.test.js.map +1 -0
  24. package/dist/__tests__/skills.test.js +6 -5
  25. package/dist/__tests__/skills.test.js.map +1 -1
  26. package/dist/cli/commands/wait.d.ts +52 -0
  27. package/dist/cli/commands/wait.d.ts.map +1 -0
  28. package/dist/cli/commands/wait.js +229 -0
  29. package/dist/cli/commands/wait.js.map +1 -0
  30. package/dist/cli/index.js +54 -0
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/features/rate-limit-wait/daemon.d.ts +52 -0
  33. package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -0
  34. package/dist/features/rate-limit-wait/daemon.js +545 -0
  35. package/dist/features/rate-limit-wait/daemon.js.map +1 -0
  36. package/dist/features/rate-limit-wait/index.d.ts +16 -0
  37. package/dist/features/rate-limit-wait/index.d.ts.map +1 -0
  38. package/dist/features/rate-limit-wait/index.js +18 -0
  39. package/dist/features/rate-limit-wait/index.js.map +1 -0
  40. package/dist/features/rate-limit-wait/rate-limit-monitor.d.ts +22 -0
  41. package/dist/features/rate-limit-wait/rate-limit-monitor.d.ts.map +1 -0
  42. package/dist/features/rate-limit-wait/rate-limit-monitor.js +99 -0
  43. package/dist/features/rate-limit-wait/rate-limit-monitor.js.map +1 -0
  44. package/dist/features/rate-limit-wait/tmux-detector.d.ts +59 -0
  45. package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -0
  46. package/dist/features/rate-limit-wait/tmux-detector.js +304 -0
  47. package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -0
  48. package/dist/features/rate-limit-wait/types.d.ts +121 -0
  49. package/dist/features/rate-limit-wait/types.d.ts.map +1 -0
  50. package/dist/features/rate-limit-wait/types.js +8 -0
  51. package/dist/features/rate-limit-wait/types.js.map +1 -0
  52. package/dist/hooks/bridge.d.ts +1 -1
  53. package/dist/hooks/bridge.d.ts.map +1 -1
  54. package/dist/hooks/bridge.js +50 -4
  55. package/dist/hooks/bridge.js.map +1 -1
  56. package/dist/hooks/index.d.ts +5 -0
  57. package/dist/hooks/index.d.ts.map +1 -1
  58. package/dist/hooks/index.js +15 -0
  59. package/dist/hooks/index.js.map +1 -1
  60. package/dist/hooks/omc-orchestrator/audit.d.ts +2 -1
  61. package/dist/hooks/omc-orchestrator/audit.d.ts.map +1 -1
  62. package/dist/hooks/omc-orchestrator/audit.js.map +1 -1
  63. package/dist/hooks/omc-orchestrator/index.d.ts +7 -0
  64. package/dist/hooks/omc-orchestrator/index.d.ts.map +1 -1
  65. package/dist/hooks/omc-orchestrator/index.js +95 -8
  66. package/dist/hooks/omc-orchestrator/index.js.map +1 -1
  67. package/dist/hooks/permission-handler/__tests__/index.test.d.ts +2 -0
  68. package/dist/hooks/permission-handler/__tests__/index.test.d.ts.map +1 -0
  69. package/dist/hooks/permission-handler/__tests__/index.test.js +244 -0
  70. package/dist/hooks/permission-handler/__tests__/index.test.js.map +1 -0
  71. package/dist/hooks/permission-handler/index.d.ts +42 -0
  72. package/dist/hooks/permission-handler/index.d.ts.map +1 -0
  73. package/dist/hooks/permission-handler/index.js +111 -0
  74. package/dist/hooks/permission-handler/index.js.map +1 -0
  75. package/dist/hooks/pre-compact/index.d.ts +82 -0
  76. package/dist/hooks/pre-compact/index.d.ts.map +1 -0
  77. package/dist/hooks/pre-compact/index.js +265 -0
  78. package/dist/hooks/pre-compact/index.js.map +1 -0
  79. package/dist/hooks/session-end/index.d.ts +50 -0
  80. package/dist/hooks/session-end/index.d.ts.map +1 -0
  81. package/dist/hooks/session-end/index.js +207 -0
  82. package/dist/hooks/session-end/index.js.map +1 -0
  83. package/dist/hooks/setup/index.d.ts +66 -0
  84. package/dist/hooks/setup/index.d.ts.map +1 -0
  85. package/dist/hooks/setup/index.js +299 -0
  86. package/dist/hooks/setup/index.js.map +1 -0
  87. package/dist/hooks/setup/types.d.ts +25 -0
  88. package/dist/hooks/setup/types.d.ts.map +1 -0
  89. package/dist/hooks/setup/types.js +5 -0
  90. package/dist/hooks/setup/types.js.map +1 -0
  91. package/dist/hooks/subagent-tracker/index.d.ts +68 -29
  92. package/dist/hooks/subagent-tracker/index.d.ts.map +1 -1
  93. package/dist/hooks/subagent-tracker/index.js +301 -131
  94. package/dist/hooks/subagent-tracker/index.js.map +1 -1
  95. package/dist/installer/index.d.ts +1 -1
  96. package/dist/installer/index.js +1 -1
  97. package/docs/MIGRATION.md +2 -2
  98. package/hooks/hooks.json +83 -1
  99. package/package.json +3 -1
  100. package/scripts/permission-handler.mjs +23 -0
  101. package/scripts/pre-compact.mjs +23 -0
  102. package/scripts/session-end.mjs +23 -0
  103. package/scripts/setup-init.mjs +23 -0
  104. package/scripts/setup-maintenance.mjs +23 -0
  105. package/scripts/subagent-tracker.mjs +35 -0
  106. package/skills/doctor/SKILL.md +1 -1
  107. package/templates/hooks/keyword-detector.mjs +198 -0
  108. package/templates/hooks/keyword-detector.sh +102 -0
  109. package/templates/hooks/persistent-mode.mjs +249 -0
  110. package/templates/hooks/persistent-mode.sh +187 -0
  111. package/templates/hooks/post-tool-use.mjs +133 -0
  112. package/templates/hooks/post-tool-use.sh +90 -0
  113. package/templates/hooks/pre-tool-use.mjs +145 -0
  114. package/templates/hooks/pre-tool-use.sh +113 -0
  115. package/templates/hooks/session-start.mjs +100 -0
  116. package/templates/hooks/session-start.sh +62 -0
  117. package/templates/hooks/stop-continuation.mjs +80 -0
  118. package/templates/hooks/stop-continuation.sh +40 -0
  119. package/templates/rules/README.md +40 -0
  120. package/templates/rules/coding-style.md +74 -0
  121. package/templates/rules/git-workflow.md +41 -0
  122. package/templates/rules/performance.md +40 -0
  123. package/templates/rules/security.md +41 -0
  124. package/templates/rules/testing.md +42 -0
package/hooks/hooks.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "Sisyphus orchestration hooks for keyword detection, tool enforcement, session restoration, and continuation persistence",
2
+ "description": "OMC orchestration hooks with async capabilities",
3
3
  "hooks": {
4
4
  "UserPromptSubmit": [
5
5
  {
@@ -30,6 +30,28 @@
30
30
  ]
31
31
  }
32
32
  ],
33
+ "Setup": [
34
+ {
35
+ "matcher": "init",
36
+ "hooks": [
37
+ {
38
+ "type": "command",
39
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/setup-init.mjs\"",
40
+ "timeout": 30
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "matcher": "maintenance",
46
+ "hooks": [
47
+ {
48
+ "type": "command",
49
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/setup-maintenance.mjs\"",
50
+ "timeout": 60
51
+ }
52
+ ]
53
+ }
54
+ ],
33
55
  "PreToolUse": [
34
56
  {
35
57
  "matcher": "*",
@@ -42,6 +64,18 @@
42
64
  ]
43
65
  }
44
66
  ],
67
+ "PermissionRequest": [
68
+ {
69
+ "matcher": "Bash",
70
+ "hooks": [
71
+ {
72
+ "type": "command",
73
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/permission-handler.mjs\"",
74
+ "timeout": 5
75
+ }
76
+ ]
77
+ }
78
+ ],
45
79
  "PostToolUse": [
46
80
  {
47
81
  "matcher": "*",
@@ -54,6 +88,42 @@
54
88
  ]
55
89
  }
56
90
  ],
91
+ "SubagentStart": [
92
+ {
93
+ "matcher": "*",
94
+ "hooks": [
95
+ {
96
+ "type": "command",
97
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/subagent-tracker.mjs\" start",
98
+ "timeout": 3
99
+ }
100
+ ]
101
+ }
102
+ ],
103
+ "SubagentStop": [
104
+ {
105
+ "matcher": "*",
106
+ "hooks": [
107
+ {
108
+ "type": "command",
109
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/subagent-tracker.mjs\" stop",
110
+ "timeout": 5
111
+ }
112
+ ]
113
+ }
114
+ ],
115
+ "PreCompact": [
116
+ {
117
+ "matcher": "*",
118
+ "hooks": [
119
+ {
120
+ "type": "command",
121
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-compact.mjs\"",
122
+ "timeout": 10
123
+ }
124
+ ]
125
+ }
126
+ ],
57
127
  "Stop": [
58
128
  {
59
129
  "matcher": "*",
@@ -65,6 +135,18 @@
65
135
  }
66
136
  ]
67
137
  }
138
+ ],
139
+ "SessionEnd": [
140
+ {
141
+ "matcher": "*",
142
+ "hooks": [
143
+ {
144
+ "type": "command",
145
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/session-end.mjs\"",
146
+ "timeout": 10
147
+ }
148
+ ]
149
+ }
68
150
  ]
69
151
  }
70
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-claude-sisyphus",
3
- "version": "3.6.2",
3
+ "version": "3.7.0",
4
4
  "description": "Multi-agent orchestration system for Claude Code - Inspired by oh-my-opencode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "bin": {
15
15
  "oh-my-claudecode": "dist/cli/index.js",
16
+ "omc": "dist/cli/index.js",
16
17
  "omc-analytics": "dist/cli/analytics.js",
17
18
  "omc-cli": "dist/cli/index.js"
18
19
  },
@@ -24,6 +25,7 @@
24
25
  "hooks",
25
26
  "scripts",
26
27
  "skills",
28
+ "templates",
27
29
  "docs",
28
30
  "plugin.json",
29
31
  "README.md",
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ // Read stdin
7
+ let input = '';
8
+ for await (const chunk of process.stdin) {
9
+ input += chunk;
10
+ }
11
+
12
+ try {
13
+ const data = JSON.parse(input);
14
+ const { processPermissionRequest } = await import('../dist/hooks/permission-handler/index.js');
15
+ const result = await processPermissionRequest(data);
16
+ console.log(JSON.stringify(result));
17
+ } catch (error) {
18
+ console.error('[permission-handler] Error:', error.message);
19
+ process.exit(0); // Don't block on errors
20
+ }
21
+ }
22
+
23
+ main();
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ // Read stdin
7
+ let input = '';
8
+ for await (const chunk of process.stdin) {
9
+ input += chunk;
10
+ }
11
+
12
+ try {
13
+ const data = JSON.parse(input);
14
+ const { processPreCompact } = await import('../dist/hooks/pre-compact/index.js');
15
+ const result = await processPreCompact(data);
16
+ console.log(JSON.stringify(result));
17
+ } catch (error) {
18
+ console.error('[pre-compact] Error:', error.message);
19
+ process.exit(0); // Don't block on errors
20
+ }
21
+ }
22
+
23
+ main();
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ // Read stdin
7
+ let input = '';
8
+ for await (const chunk of process.stdin) {
9
+ input += chunk;
10
+ }
11
+
12
+ try {
13
+ const data = JSON.parse(input);
14
+ const { processSessionEnd } = await import('../dist/hooks/session-end/index.js');
15
+ const result = await processSessionEnd(data);
16
+ console.log(JSON.stringify(result));
17
+ } catch (error) {
18
+ console.error('[session-end] Error:', error.message);
19
+ process.exit(0); // Don't block on errors
20
+ }
21
+ }
22
+
23
+ main();
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ // Read stdin
7
+ let input = '';
8
+ for await (const chunk of process.stdin) {
9
+ input += chunk;
10
+ }
11
+
12
+ try {
13
+ const data = JSON.parse(input);
14
+ const { processSetupInit } = await import('../dist/hooks/setup/index.js');
15
+ const result = await processSetupInit(data);
16
+ console.log(JSON.stringify(result));
17
+ } catch (error) {
18
+ console.error('[setup-init] Error:', error.message);
19
+ process.exit(0); // Don't block on errors
20
+ }
21
+ }
22
+
23
+ main();
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ // Read stdin
7
+ let input = '';
8
+ for await (const chunk of process.stdin) {
9
+ input += chunk;
10
+ }
11
+
12
+ try {
13
+ const data = JSON.parse(input);
14
+ const { processSetupMaintenance } = await import('../dist/hooks/setup/index.js');
15
+ const result = await processSetupMaintenance(data);
16
+ console.log(JSON.stringify(result));
17
+ } catch (error) {
18
+ console.error('[setup-maintenance] Error:', error.message);
19
+ process.exit(0); // Don't block on errors
20
+ }
21
+ }
22
+
23
+ main();
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module';
3
+ const require = createRequire(import.meta.url);
4
+
5
+ async function main() {
6
+ const action = process.argv[2]; // 'start' or 'stop'
7
+
8
+ // Read stdin
9
+ let input = '';
10
+ for await (const chunk of process.stdin) {
11
+ input += chunk;
12
+ }
13
+
14
+ try {
15
+ const data = JSON.parse(input);
16
+ const { processSubagentStart, processSubagentStop } = await import('../dist/hooks/subagent-tracker/index.js');
17
+
18
+ let result;
19
+ if (action === 'start') {
20
+ result = await processSubagentStart(data);
21
+ } else if (action === 'stop') {
22
+ result = await processSubagentStop(data);
23
+ } else {
24
+ console.error(`[subagent-tracker] Unknown action: ${action}`);
25
+ process.exit(0);
26
+ }
27
+
28
+ console.log(JSON.stringify(result));
29
+ } catch (error) {
30
+ console.error('[subagent-tracker] Error:', error.message);
31
+ process.exit(0); // Don't block on errors
32
+ }
33
+ }
34
+
35
+ main();
@@ -17,7 +17,7 @@ INSTALLED=$(ls ~/.claude/plugins/cache/omc/oh-my-claudecode/ 2>/dev/null | sort
17
17
  echo "Installed: $INSTALLED"
18
18
 
19
19
  # Get latest from npm
20
- LATEST=$(npm view oh-my-claudecode version 2>/dev/null)
20
+ LATEST=$(npm view oh-my-claude-sisyphus version 2>/dev/null)
21
21
  echo "Latest: $LATEST"
22
22
  ```
23
23
 
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env node
2
+ // OMC Keyword Detector Hook (Node.js)
3
+ // Detects ultrawork/ultrathink/search/analyze keywords and injects enhanced mode messages
4
+ // Cross-platform: Windows, macOS, Linux
5
+
6
+ const ULTRAWORK_MESSAGE = `<ultrawork-mode>
7
+
8
+ **MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
9
+
10
+ [CODE RED] Maximum precision required. Ultrathink before acting.
11
+
12
+ YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
13
+ TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
14
+
15
+ ## AGENT UTILIZATION PRINCIPLES
16
+ - **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS
17
+ - **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS
18
+ - **Planning & Strategy**: NEVER plan yourself - spawn planning agent
19
+ - **High-IQ Reasoning**: Use oracle for architecture decisions
20
+ - **Frontend/UI Tasks**: Delegate to frontend-engineer
21
+
22
+ ## EXECUTION RULES
23
+ - **TODO**: Track EVERY step. Mark complete IMMEDIATELY.
24
+ - **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially.
25
+ - **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent).
26
+ - **VERIFY**: Check ALL requirements met before done.
27
+ - **DELEGATE**: Orchestrate specialized agents.
28
+
29
+ ## ZERO TOLERANCE
30
+ - NO Scope Reduction - deliver FULL implementation
31
+ - NO Partial Completion - finish 100%
32
+ - NO Premature Stopping - ALL TODOs must be complete
33
+ - NO TEST DELETION - fix code, not tests
34
+
35
+ THE USER ASKED FOR X. DELIVER EXACTLY X.
36
+
37
+ </ultrawork-mode>
38
+
39
+ ---
40
+ `;
41
+
42
+ const ULTRATHINK_MESSAGE = `<think-mode>
43
+
44
+ **ULTRATHINK MODE ENABLED** - Extended reasoning activated.
45
+
46
+ You are now in deep thinking mode. Take your time to:
47
+ 1. Thoroughly analyze the problem from multiple angles
48
+ 2. Consider edge cases and potential issues
49
+ 3. Think through the implications of each approach
50
+ 4. Reason step-by-step before acting
51
+
52
+ Use your extended thinking capabilities to provide the most thorough and well-reasoned response.
53
+
54
+ </think-mode>
55
+
56
+ ---
57
+ `;
58
+
59
+ const SEARCH_MESSAGE = `<search-mode>
60
+ MAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:
61
+ - explore agents (codebase patterns, file structures)
62
+ - librarian agents (remote repos, official docs, GitHub examples)
63
+ Plus direct tools: Grep, Glob
64
+ NEVER stop at first result - be exhaustive.
65
+ </search-mode>
66
+
67
+ ---
68
+ `;
69
+
70
+ const ANALYZE_MESSAGE = `<analyze-mode>
71
+ ANALYSIS MODE. Gather context before diving deep:
72
+
73
+ CONTEXT GATHERING (parallel):
74
+ - 1-2 explore agents (codebase patterns, implementations)
75
+ - 1-2 librarian agents (if external library involved)
76
+ - Direct tools: Grep, Glob, LSP for targeted searches
77
+
78
+ IF COMPLEX (architecture, multi-system, debugging after 2+ failures):
79
+ - Consult oracle agent for strategic guidance
80
+
81
+ SYNTHESIZE findings before proceeding.
82
+ </analyze-mode>
83
+
84
+ ---
85
+ `;
86
+
87
+ // Read all stdin
88
+ async function readStdin() {
89
+ const chunks = [];
90
+ for await (const chunk of process.stdin) {
91
+ chunks.push(chunk);
92
+ }
93
+ return Buffer.concat(chunks).toString('utf-8');
94
+ }
95
+
96
+ // Extract prompt from various JSON structures
97
+ function extractPrompt(input) {
98
+ try {
99
+ const data = JSON.parse(input);
100
+ if (data.prompt) return data.prompt;
101
+ if (data.message?.content) return data.message.content;
102
+ if (Array.isArray(data.parts)) {
103
+ return data.parts
104
+ .filter(p => p.type === 'text')
105
+ .map(p => p.text)
106
+ .join(' ');
107
+ }
108
+ return '';
109
+ } catch {
110
+ // Fallback: try to extract with regex
111
+ const match = input.match(/"(?:prompt|content|text)"\s*:\s*"([^"]+)"/);
112
+ return match ? match[1] : '';
113
+ }
114
+ }
115
+
116
+ // Remove code blocks to prevent false positives
117
+ function removeCodeBlocks(text) {
118
+ return text
119
+ .replace(/```[\s\S]*?```/g, '')
120
+ .replace(/`[^`]+`/g, '');
121
+ }
122
+
123
+ import { writeFileSync, mkdirSync, existsSync } from 'fs';
124
+ import { join } from 'path';
125
+ import { homedir } from 'os';
126
+
127
+ // Create ultrawork state file
128
+ function activateUltraworkState(directory, prompt) {
129
+ const state = {
130
+ active: true,
131
+ started_at: new Date().toISOString(),
132
+ original_prompt: prompt,
133
+ reinforcement_count: 0,
134
+ last_checked_at: new Date().toISOString()
135
+ };
136
+ const localDir = join(directory, '.omc');
137
+ if (!existsSync(localDir)) { try { mkdirSync(localDir, { recursive: true }); } catch {} }
138
+ try { writeFileSync(join(localDir, 'ultrawork-state.json'), JSON.stringify(state, null, 2)); } catch {}
139
+ const globalDir = join(homedir(), '.claude');
140
+ if (!existsSync(globalDir)) { try { mkdirSync(globalDir, { recursive: true }); } catch {} }
141
+ try { writeFileSync(join(globalDir, 'ultrawork-state.json'), JSON.stringify(state, null, 2)); } catch {}
142
+ }
143
+
144
+ // Main
145
+ async function main() {
146
+ try {
147
+ const input = await readStdin();
148
+ if (!input.trim()) {
149
+ console.log(JSON.stringify({ continue: true }));
150
+ return;
151
+ }
152
+
153
+ let data = {};
154
+ try { data = JSON.parse(input); } catch {}
155
+ const directory = data.directory || process.cwd();
156
+
157
+ const prompt = extractPrompt(input);
158
+ if (!prompt) {
159
+ console.log(JSON.stringify({ continue: true }));
160
+ return;
161
+ }
162
+
163
+ const cleanPrompt = removeCodeBlocks(prompt).toLowerCase();
164
+
165
+ // Check for ultrawork keywords (highest priority)
166
+ if (/\b(ultrawork|ulw|uw)\b/.test(cleanPrompt)) {
167
+ activateUltraworkState(directory, prompt);
168
+ console.log(JSON.stringify({ continue: true, message: ULTRAWORK_MESSAGE }));
169
+ return;
170
+ }
171
+
172
+ // Check for ultrathink/think keywords
173
+ if (/\b(ultrathink|think)\b/.test(cleanPrompt)) {
174
+ console.log(JSON.stringify({ continue: true, message: ULTRATHINK_MESSAGE }));
175
+ return;
176
+ }
177
+
178
+ // Check for search keywords
179
+ if (/\b(search|find|locate|lookup|explore|discover|scan|grep|query|browse|detect|trace|seek|track|pinpoint|hunt)\b|where\s+is|show\s+me|list\s+all/.test(cleanPrompt)) {
180
+ console.log(JSON.stringify({ continue: true, message: SEARCH_MESSAGE }));
181
+ return;
182
+ }
183
+
184
+ // Check for analyze keywords
185
+ if (/\b(analyze|analyse|investigate|examine|research|study|deep.?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to/.test(cleanPrompt)) {
186
+ console.log(JSON.stringify({ continue: true, message: ANALYZE_MESSAGE }));
187
+ return;
188
+ }
189
+
190
+ // No keywords detected
191
+ console.log(JSON.stringify({ continue: true }));
192
+ } catch (error) {
193
+ // On any error, allow continuation
194
+ console.log(JSON.stringify({ continue: true }));
195
+ }
196
+ }
197
+
198
+ main();
@@ -0,0 +1,102 @@
1
+ #!/bin/bash
2
+ # OMC Keyword Detector Hook
3
+ # Detects ultrawork/ultrathink/search/analyze keywords and injects enhanced mode messages
4
+ # Also activates persistent ultrawork state when ultrawork keyword is detected
5
+
6
+ # Read stdin (JSON input from Claude Code)
7
+ INPUT=$(cat)
8
+
9
+ # Extract directory from input
10
+ DIRECTORY=""
11
+ if command -v jq &> /dev/null; then
12
+ DIRECTORY=$(echo "$INPUT" | jq -r '.directory // ""' 2>/dev/null)
13
+ fi
14
+ if [ -z "$DIRECTORY" ] || [ "$DIRECTORY" = "null" ]; then
15
+ DIRECTORY=$(pwd)
16
+ fi
17
+
18
+ # Extract the prompt text - try multiple JSON paths
19
+ PROMPT=""
20
+ if command -v jq &> /dev/null; then
21
+ # Try to extract from various possible JSON structures
22
+ PROMPT=$(echo "$INPUT" | jq -r '
23
+ if .prompt then .prompt
24
+ elif .message.content then .message.content
25
+ elif .parts then ([.parts[] | select(.type == "text") | .text] | join(" "))
26
+ else ""
27
+ end
28
+ ' 2>/dev/null)
29
+ fi
30
+
31
+ # Fallback: simple grep extraction if jq fails
32
+ if [ -z "$PROMPT" ] || [ "$PROMPT" = "null" ]; then
33
+ PROMPT=$(echo "$INPUT" | grep -oP '"(prompt|content|text)"\s*:\s*"\K[^"]+' | head -1)
34
+ fi
35
+
36
+ # Exit if no prompt found
37
+ if [ -z "$PROMPT" ]; then
38
+ echo '{"continue": true}'
39
+ exit 0
40
+ fi
41
+
42
+ # Remove code blocks before checking keywords (prevents false positives)
43
+ PROMPT_NO_CODE=$(echo "$PROMPT" | sed 's/```[^`]*```//g' | sed 's/`[^`]*`//g')
44
+
45
+ # Convert to lowercase for case-insensitive matching
46
+ PROMPT_LOWER=$(echo "$PROMPT_NO_CODE" | tr '[:upper:]' '[:lower:]')
47
+
48
+ # Check for ultrawork keywords (highest priority)
49
+ if echo "$PROMPT_LOWER" | grep -qE '\b(ultrawork|ulw|uw)\b'; then
50
+ # Create persistent ultrawork state
51
+ mkdir -p "$DIRECTORY/.omc" 2>/dev/null
52
+ mkdir -p "$HOME/.claude" 2>/dev/null
53
+
54
+ # Escape prompt for JSON
55
+ PROMPT_ESCAPED=$(echo "$PROMPT" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | tr '\n' ' ')
56
+
57
+ STATE_JSON="{
58
+ \"active\": true,
59
+ \"started_at\": \"$(date -Iseconds)\",
60
+ \"original_prompt\": \"$PROMPT_ESCAPED\",
61
+ \"reinforcement_count\": 0,
62
+ \"last_checked_at\": \"$(date -Iseconds)\"
63
+ }"
64
+
65
+ # Write state to both local and global locations
66
+ echo "$STATE_JSON" > "$DIRECTORY/.omc/ultrawork-state.json" 2>/dev/null
67
+ echo "$STATE_JSON" > "$HOME/.claude/ultrawork-state.json" 2>/dev/null
68
+
69
+ # Return ultrawork mode injection
70
+ cat << 'EOF'
71
+ {"continue": true, "message": "<ultrawork-mode>\\n\\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\\n\\n[CODE RED] Maximum precision required. Ultrathink before acting.\\n\\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.\\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\\n\\n## AGENT UTILIZATION PRINCIPLES\\n- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS\\n- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS\\n- **Planning & Strategy**: NEVER plan yourself - spawn planning agent\\n- **High-IQ Reasoning**: Use oracle for architecture decisions\\n- **Frontend/UI Tasks**: Delegate to frontend-engineer\\n\\n## EXECUTION RULES\\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY.\\n- **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially.\\n- **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent).\\n- **VERIFY**: Check ALL requirements met before done.\\n- **DELEGATE**: Orchestrate specialized agents.\\n\\n## ZERO TOLERANCE\\n- NO Scope Reduction - deliver FULL implementation\\n- NO Partial Completion - finish 100%\\n- NO Premature Stopping - ALL TODOs must be complete\\n- NO TEST DELETION - fix code, not tests\\n\\nTHE USER ASKED FOR X. DELIVER EXACTLY X.\\n\\n</ultrawork-mode>\\n\\n---\\n"}
72
+ EOF
73
+ exit 0
74
+ fi
75
+
76
+ # Check for ultrathink/think keywords
77
+ if echo "$PROMPT_LOWER" | grep -qE '\b(ultrathink|think)\b'; then
78
+ cat << 'EOF'
79
+ {"continue": true, "message": "<think-mode>\\n\\n**ULTRATHINK MODE ENABLED** - Extended reasoning activated.\\n\\nYou are now in deep thinking mode. Take your time to:\\n1. Thoroughly analyze the problem from multiple angles\\n2. Consider edge cases and potential issues\\n3. Think through the implications of each approach\\n4. Reason step-by-step before acting\\n\\nUse your extended thinking capabilities to provide the most thorough and well-reasoned response.\\n\\n</think-mode>\\n\\n---\\n"}
80
+ EOF
81
+ exit 0
82
+ fi
83
+
84
+ # Check for search keywords (EN + multilingual)
85
+ if echo "$PROMPT_LOWER" | grep -qE '\b(search|find|locate|lookup|explore|discover|scan|grep|query|browse|detect|trace|seek|track|pinpoint|hunt)\b|where\s+is|show\s+me|list\s+all'; then
86
+ cat << 'EOF'
87
+ {"continue": true, "message": "<search-mode>\\nMAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:\\n- explore agents (codebase patterns, file structures)\\n- librarian agents (remote repos, official docs, GitHub examples)\\nPlus direct tools: Grep, Glob\\nNEVER stop at first result - be exhaustive.\\n</search-mode>\\n\\n---\\n"}
88
+ EOF
89
+ exit 0
90
+ fi
91
+
92
+ # Check for analyze keywords
93
+ if echo "$PROMPT_LOWER" | grep -qE '\b(analyze|analyse|investigate|examine|research|study|deep.?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to'; then
94
+ cat << 'EOF'
95
+ {"continue": true, "message": "<analyze-mode>\\nANALYSIS MODE. Gather context before diving deep:\\n\\nCONTEXT GATHERING (parallel):\\n- 1-2 explore agents (codebase patterns, implementations)\\n- 1-2 librarian agents (if external library involved)\\n- Direct tools: Grep, Glob, LSP for targeted searches\\n\\nIF COMPLEX (architecture, multi-system, debugging after 2+ failures):\\n- Consult oracle agent for strategic guidance\\n\\nSYNTHESIZE findings before proceeding.\\n</analyze-mode>\\n\\n---\\n"}
96
+ EOF
97
+ exit 0
98
+ fi
99
+
100
+ # No keywords detected - continue without modification
101
+ echo '{"continue": true}'
102
+ exit 0